1 2011-05-24 David Meyer <pdox@google.com>
3 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4 with name parameter. Add found_name parameter.
5 * fileread.cc (Input_file::find_file): Adjust code accordingly.
6 * dirsearch.h (class Dirsearch): Update declaration.
8 2011-05-24 Ian Lance Taylor <iant@google.com>
10 * archive.cc (Library_base::should_include_member): Pull in object
11 from archive if it defines the entry symbol.
12 * parameters.cc (Parameters::entry): New function.
13 * parameters.h (class Parameters): Declare entry.
14 * output.h (class Output_file_header): Remove entry_ field.
15 * output.cc (Output_file_header::Output_file_header): Remove entry
16 parameter. Change all callers.
17 (Output_file_header::entry): Use parameters->entry.
18 * gold.cc (queue_middle_tasks): Likewise.
19 * plugin.cc (Plugin_hook::run): Likewise.
21 2011-05-24 Cary Coutant <ccoutant@google.com>
23 * gold.cc (queue_initial_tasks): Pass incremental base filename
24 to Output_file::open_base_file; don't print error message.
25 * incremental-dump.cc (main): Adjust call to
26 Output_file::open_for_modification.
27 * incremental-dump.cc (main): Likewise.
28 * incremental.cc (Incremental_inputs::report_command_line):
29 Ignore --incremental-base option when comparing command lines.
30 Ignore parameter when given as separate argument.
31 * options.h (class General_options): Add --incremental-base.
32 * output.cc (Output_file::Output_file):
33 (Output_file::open_base_file): Add base_name and writable parameters;
34 read base file into new file; print error message here.
35 (Output_file::map_no_anonymous): Add writable parameter; adjust all
37 * output.h (Output_file::open_for_modification): Rename to...
38 (Output_file::open_base_file): ...this; add base_name and
39 writable parameters; adjust all callers.
40 (Output_file::map_no_anonymous): Add writable parameter; adjust all
42 * testsuite/Makefile.am (incremental_test_4): Test
44 * testsuite/Makefile.in: Regenerate.
46 2011-05-24 Cary Coutant <ccoutant@google.com>
48 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
50 * testsuite/Makefile.in: Regenerate.
51 * testsuite/two_file_test_1_v1.cc: New test source file.
52 * testsuite/two_file_test_1b_v1.cc: New test source file.
53 * testsuite/two_file_test_2_v1.cc: New test source file.
55 2011-05-24 Cary Coutant <ccoutant@google.com>
57 * dynobj.h (Dynobj::do_dynobj): New function.
58 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
59 flag and soname for shared objects.
60 * incremental.cc (Incremental_inputs::report_object): Make
61 either Incremental_object_entry or Incremental_dynobj_entry; add
62 soname to string table.
63 (Incremental_inputs::report_input_section): Add assertion.
64 (Output_section_incremental_inputs::set_final_data_size): Adjust
65 type of input file entry for shared libraries; adjust size of
66 shared library info entry.
67 (Output_section_incremental_inputs::write_input_files): Write
68 as_needed flag for shared libraries.
69 (Output_section_incremental_inputs::write_info_blocks): Adjust type
70 of input file entry for shared libraries; write soname.
71 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
72 soname from incremental info.
73 * incremental.h (enum Incremental_input_flags): Add
74 INCREMENTAL_INPUT_AS_NEEDED.
75 (Incremental_input_entry::Incremental_input_entry): Initialize new
77 (Incremental_input_entry::set_as_needed): New function.
78 (Incremental_input_entry::as_needed): New function.
79 (Incremental_input_entry::do_dynobj_entry): New function.
80 (Incremental_input_entry::as_needed_): New data member.
81 (Incremental_object_entry::Incremental_object_entry): Don't check
83 (Incremental_object_entry::do_type): Likewise.
84 (class Incremental_dynobj_entry): New class.
85 (Incremental_input_entry_reader::as_needed): New function.
86 (Incremental_input_entry_reader::get_soname): New function.
87 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
88 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
89 size of shared library info entry.
90 * layout.cc (Layout::finish_dynamic_section): Don't test for
91 incremental link when adding DT_NEEDED entries.
92 * object.h (Object::Object): Initialize new data member.
93 (Object::dynobj): New function.
94 (Object::set_as_needed): New function.
95 (Object::as_needed): New function.
96 (Object::do_dynobj): New function.
97 (Object::as_needed_): New data member.
99 2011-05-24 Cary Coutant <ccoutant@google.com>
101 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
102 info; adjust display of GOT entries.
103 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
104 vector of input objects; remove file_status_.
105 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
106 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
107 got_plt reader; call target hooks to reserve GOT entries.
108 (Output_section_incremental_inputs::set_final_data_size): Adjust size
109 of input file info header and GOT info entry.
110 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
112 (Got_plt_view_info::got_descriptor): Remove.
113 (Got_plt_view_info::sym_index): New data member.
114 (Got_plt_view_info::input_index): New data member.
115 (Local_got_offset_visitor::visit): Write input file index.
116 (Global_got_offset_visitor::visit): Write 0 for input file index.
117 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
118 with sym_index and input_index.
119 (Output_section_incremental_inputs::write_got_plt): Adjust size of
120 incremental info GOT entry; replace got_descriptor with input_index.
121 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
122 map from input file index to object.
123 (Sized_relobj_incr::do_layout): Replace direct data member reference
124 with accessor function.
125 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
126 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
127 Adjust size of input file info header.
128 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
129 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
130 (Incremental_input_entry_reader::get_input_section): Adjust size of
131 input file info header.
132 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
133 of incremental info GOT entry.
134 (Incremental_got_plt_reader::get_got_desc): Remove.
135 (Incremental_got_plt_reader::get_got_symndx): New function.
136 (Incremental_got_plt_reader::get_got_input_index): New function.
137 (Sized_incremental_binary::Sized_incremental_binary): Remove
138 file_status_; add input_objects_.
139 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
140 (Sized_incremental_binary::set_file_is_unchanged): Remove.
141 (Sized_incremental_binary::file_is_unchanged): Remove.
142 (Sized_incremental_binary::set_input_object): New function.
143 (Sized_incremental_binary::input_object): New function.
144 (Sized_incremental_binary::file_status_): Remove.
145 (Sized_incremental_binary::input_objects_): New data member.
146 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
148 (Sized_relobj_incr::invalid_address): Move to base class.
149 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
151 (Sized_relobj_incr::do_output_section_offset): Likewise.
152 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
153 (Sized_relobj_incr::section_offsets_): Likewise.
154 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
156 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
157 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
158 with accessor function.
159 (Sized_relobj_file::do_layout): Likewise.
160 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
161 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
162 (Sized_relobj_file::compute_final_local_value): Replace refs to
163 section_offsets_ with accessor function.
164 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
165 * object.h (Relobj::Relobj): Initialize new data members.
166 (Relobj::add_dyn_reloc): New function.
167 (Relobj::first_dyn_reloc): New function.
168 (Relobj::dyn_reloc_count): New function.
169 (Relobj::first_dyn_reloc_): New data member.
170 (Relobj::dyn_reloc_count_): New data member.
171 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
173 (Sized_relobj::Address): New typedef.
174 (Sized_relobj::invalid_address): Move here from child class.
175 (Sized_relobj::Sized_relobj): Initialize new data members.
176 (Sized_relobj::sized_relobj): New function.
177 (Sized_relobj::is_output_section_offset_invalid): Move here from
179 (Sized_relobj::get_output_section_offset): Likewise.
180 (Sized_relobj::local_has_got_offset): Likewise.
181 (Sized_relobj::local_got_offset): Likewise.
182 (Sized_relobj::set_local_got_offset): Likewise.
183 (Sized_relobj::do_for_all_local_got_entries): Likewise.
184 (Sized_relobj::clear_got_offsets): New function.
185 (Sized_relobj::section_offsets): Move here from child class.
186 (Sized_relobj::do_output_section_offset): Likewise.
187 (Sized_relobj::do_set_section_offset): Likewise.
188 (Sized_relobj::Local_got_offsets): Likewise.
189 (Sized_relobj::local_got_offsets_): Likewise.
190 (Sized_relobj::section_offsets_): Likewise.
191 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
193 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
195 (Sized_relobj_file::sized_relobj): New function
196 (Sized_relobj_file::local_has_got_offset): Move to base class.
197 (Sized_relobj_file::local_got_offset): Likewise.
198 (Sized_relobj_file::set_local_got_offset): Likewise.
199 (Sized_relobj_file::get_output_section_offset): Likewise.
200 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
201 (Sized_relobj_file::do_output_section_offset): Likewise.
202 (Sized_relobj_file::do_set_section_offset): Likewise.
203 (Sized_relobj_file::Local_got_offsets): Likewise.
204 (Sized_relobj_file::local_got_offsets_): Likewise.
205 (Sized_relobj_file::section_offsets_): Likewise.
206 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
208 (set_needs_dynsym_index): Convert relobj to derived class pointer.
209 (Output_reloc::get_symbol_index): Likewise.
210 (Output_reloc::local_section_offset): Likewise.
211 (Output_reloc::get_address): Likewise.
212 (Output_reloc::symbol_value): Likewise.
213 (Output_data_got::reserve_slot): Move to class definition.
214 (Output_data_got::reserve_local): New function.
215 (Output_data_got::reserve_slot_for_global): Remove.
216 (Output_data_got::reserve_global): New function.
217 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
218 (all constructors, two instantiations).
219 (Output_reloc::get_relobj): New function (two instantiations).
220 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
221 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
222 (Output_data_reloc::add_global): Adjust type of relobj.
223 (Output_data_reloc::add_global_relative): Likewise.
224 (Output_data_reloc::add_symbolless_global_addend): Likewise.
225 (Output_data_reloc::add_local): Likewise.
226 (Output_data_reloc::add_local_relative): Likewise.
227 (Output_data_reloc::add_symbolless_local_addend): Likewise.
228 (Output_data_reloc::add_local_section): Likewise.
229 (Output_data_reloc::add_output_section): Likewise.
230 (Output_data_reloc::add_absolute): Likewise.
231 (Output_data_reloc::add_target_specific): Likewise.
232 (Output_data_got::reserve_slot): Move definition here.
233 (Output_data_got::reserve_local): New function.
234 (Output_data_got::reserve_global): New function.
235 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
236 section_offsets_ with accessor function.
237 (Sized_relobj_file::write_sections): Likewise.
238 (Sized_relobj_file::do_relocate_sections): Likewise.
239 * target.h (Sized_target::reserve_local_got_entry): New function.
240 (Sized_target::reserve_global_got_entry): New function.
241 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
242 (Target_x86_64::reserve_global_got_entry): New function.
243 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
245 2011-05-23 Cary Coutant <ccoutant@google.com>
247 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
248 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
249 bit when checking got_type.
250 * incremental.cc (Sized_incremental_binary::setup_readers):
251 Store symbol table and string table locations; initialize bit vector
252 of file status flags.
253 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
255 (Sized_incremental_binary::do_process_got_plt): New function.
256 (Sized_incremental_binary::get_symtab_view): Use stored locations.
257 (Output_section_incremental_inputs::set_final_data_size): Record
258 file index for each input file.
259 (Output_section_incremental_inputs::write_got_plt): Store file index
260 instead of input entry offset for each GOT entry.
262 (Incremental_input_entry::Incremental_input_entry): Initialize new
264 (Incremental_input_entry::set_offset): Store file index.
265 (Incremental_input_entry::get_file_index): New function.
266 (Incremental_input_entry::file_index_): New data member.
267 (Incremental_binary::process_got_plt): New function.
268 (Incremental_binary::do_process_got_plt): New function.
269 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
271 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
272 (Sized_incremental_binary::set_file_is_unchanged): New function.
273 (Sized_incremental_binary::file_is_unchanged): New function.
274 (Sized_incremental_binary::do_process_got_plt): New function.
275 (Sized_incremental_binary::file_status_): New data member.
276 (Sized_incremental_binary::main_symtab_loc_): New data member.
277 (Sized_incremental_binary::main_strtab_loc_): New data member.
278 * output.cc (Output_data_got::Got_entry::write): Add case
280 (Output_data_got::add_global): Call add_got_entry.
281 (Output_data_got::add_global_plt): Likewise.
282 (Output_data_got::add_global_with_rel): Likewise.
283 (Output_data_got::add_global_with_rela): Likewise.
284 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
285 (Output_data_got::add_global_pair_with_rela): Likewise.
286 (Output_data_got::add_local): Call add_got_entry.
287 (Output_data_got::add_local_plt): Likewise.
288 (Output_data_got::add_local_with_rel): Likewise.
289 (Output_data_got::add_local_with_rela): Likewise.
290 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
291 (Output_data_got::add_local_pair_with_rela): Likewise.
292 (Output_data_got::reserve_slot): New function.
293 (Output_data_got::reserve_slot_for_global): New function.
294 (Output_data_got::add_got_entry): New function.
295 (Output_data_got::add_got_entry_pair): New function.
296 (Output_section::add_output_section_data): Edit FIXME.
298 (Output_section_data_build::Output_section_data_build): New
299 constructor with size parameter.
300 (Output_data_space::Output_data_space): Likewise.
301 (Output_data_got::Output_data_got): Initialize new data member; new
302 constructor with size parameter.
303 (Output_data_got::add_constant): Call add_got_entry.
304 (Output_data_got::reserve_slot): New function.
305 (Output_data_got::reserve_slot_for_global): New function.
306 (class Output_data_got::Got_entry): Add RESERVED_CODE.
307 (Output_data_got::add_got_entry): New function.
308 (Output_data_got::add_got_entry_pair): New function.
309 (Output_data_got::free_list_): New data member.
310 * target.h (Sized_target::init_got_plt_for_update): New function.
311 (Sized_target::register_global_plt_entry): New function.
312 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
313 Initialize new data member; call init; add constructor with PLT count.
314 (Output_data_plt_x86_64::init): New function.
315 (Output_data_plt_x86_64::add_relocation): New function.
316 (Output_data_plt_x86_64::reserve_slot): New function.
317 (Output_data_plt_x86_64::free_list_): New data member.
318 (Target_x86_64::init_got_plt_for_update): New function.
319 (Target_x86_64::register_global_plt_entry): New function.
320 (Output_data_plt_x86_64::add_entry): Allocate from free list for
322 (Output_data_plt_x86_64::add_relocation): New function.
323 * testsuite/object_unittest.cc (Object_test): Set default options.
325 2011-05-16 Ian Lance Taylor <iant@google.com>
327 * options.h (class General_options): Make -i a synonym for -r.
329 2011-05-16 Ian Lance Taylor <iant@google.com>
331 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
333 2011-05-10 Cary Coutant <ccoutant@google.com>
335 * object.cc (Sized_relobj::do_count_local_symbols): Check for
338 2011-05-06 Ian Lance Taylor <iant@google.com>
340 * layout.cc (Layout::layout): If the output section flags change,
343 2011-04-25 Cary Coutant <ccoutant@google.com>
345 * incremental-dump.cc (dump_incremental_inputs): Print local
346 symbol info for each input file.
348 (Output_section_incremental_inputs::set_final_data_size): Add local
349 symbol info to input file entries in incremental info.
350 (Output_section_incremental_inputs::write_info_blocks): Likewise.
351 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
352 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
353 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
355 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
356 (Sized_incr_relobj::do_relocate): Write the local symbols.
357 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
358 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
359 Adjust size of input file header.
360 (Incremental_inputs_reader::get_local_symbol_offset): New function.
361 (Incremental_inputs_reader::get_local_symbol_count): New function.
362 (Incremental_inputs_reader::get_input_section): Adjust size of input
364 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
365 (Sized_incr_relobj::This): New typedef.
366 (Sized_incr_relobj::sym_size): New const data member.
367 (Sized_incr_relobj::Local_symbol): New struct.
368 (Sized_incr_relobj::do_output_local_symbol_count): New function.
369 (Sized_incr_relobj::do_local_symbol_offset): New function.
370 (Sized_incr_relobj::local_symbol_count_): New data member.
371 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
372 (Sized_incr_relobj::local_symbol_index_): New data member.
373 (Sized_incr_relobj::local_symbol_offset_): New data member.
374 (Sized_incr_relobj::local_dynsym_offset_): New data member.
375 (Sized_incr_relobj::local_symbols_): New data member.
376 * object.h (Relobj::output_local_symbol_count): New function.
377 (Relobj::local_symbol_offset): New function.
378 (Relobj::do_output_local_symbol_count): New function.
379 (Relobj::do_local_symbol_offset): New function.
380 (Sized_relobj::do_output_local_symbol_count): New function.
381 (Sized_relobj::do_local_symbol_offset): New function.
383 2011-04-22 Vladimir Simonov <sv@sw.ru>
385 * descriptors.cc (set_close_on_exec): New function.
386 (Descriptors::open): Use set_close_on_exec.
387 * output.cc (S_ISLNK): Define if not defined.
389 2011-04-22 Cary Coutant <ccoutant@google.com>
391 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
393 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
394 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
395 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
397 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
398 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
399 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
401 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
403 (Incremental_binary::apply_incremental_relocs): New function.
404 (Incremental_binary::do_apply_incremental_relocs): New function.
405 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
407 (Sized_incremental_binary::add_global_symbol): New function.
408 (Sized_incremental_binary::global_symbol): New function.
409 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
410 (Sized_incremental_binary::symbol_map_): New data member.
411 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
412 * target.h (Sized_target::apply_relocation): New function.
413 * target-reloc.h (apply_relocation): New function.
414 * x86_64.cc (Target_x86_64::apply_relocation): New function.
416 2011-04-22 Doug Kwan <dougkwan@google.com>
418 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
419 flag of a SHT_ARM_EXIDX section.
420 * testsuite/Makefile.am (arm_exidx_test): New test rules.
421 * testsuite/Makefile.in: Regenerate.
422 * testsuite/arm_exidx_test.s: New file.
423 * testsuite/arm_exidx_test.sh: Same.
425 2011-04-20 Cary Coutant <ccoutant@google.com>
428 * archive.h (Incremental_archive_entry::Archive_member):
429 Initialize arg_serial_ (second constructor).
431 2011-04-17 Ian Lance Taylor <iant@google.com>
433 * object.cc (Relocate_info::location): Simplify location string.
434 * errors.cc (Errors::error_at_location): Don't print program
436 (Errors::warning_at_location): Likewise.
437 (Errors::undefined_symbol): Likewise.
438 * testsuite/debug_msg.sh: Update accordingly.
440 2011-04-14 Cary Coutant <ccoutant@google.com>
442 * gold/layout.cc (Layout::symtab_section_offset): New function.
443 * gold/layout.h (Layout::symtab_section_offset): New function.
444 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
446 2011-04-12 Ian Lance Taylor <iant@google.com>
448 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
450 * output.h (class Output_file): Add map_is_allocated_ field.
451 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
452 not available, provide stubs. If mremap is not available, #define
454 (MREMAP_MAYMOVE): Define if not defined.
455 (Output_file::Output_file): Initialize map_is_allocated_.
456 (Output_file::resize): Check map_is_allocated_.
457 (Output_file::map_anonymous): If mmap fails, use malloc.
458 (Output_file::unmap): Don't do anything for an anonymous map.
459 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
460 is not available, provide stubs.
461 (File_read::View::~View): Use free rather than delete[].
462 (File_read::make_view): Use malloc rather than new[]. If mmap
464 (File_read::find_or_make_view): Use malloc rather than new[].
465 * gold.h: Remove HAVE_REMAP code.
466 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
467 exists. Rename mremap to gold_mremap. If mmap is not available
469 * configure, config.in: Rebuild.
471 2011-04-11 Ian Lance Taylor <iant@google.com>
473 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
474 initialize local variable v.
476 2011-04-11 Cary Coutant <ccoutant@google.com>
478 * archive.cc (Archive::include_member): Adjust call to
480 (Add_archive_symbols::run): Track argument serial numbers.
481 (Lib_group::include_member): Likewise.
482 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
483 * archive.h (Incremental_archive_entry::Archive_member):
484 Initialize arg_serial_.
485 (Archive_member::arg_serial_): New data member.
486 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
487 (Sized_dynobj::do_add_symbols): Track symbols when doing an
489 (Sized_dynobj::do_for_all_local_got_entries): New function.
490 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
492 * fileread.cc (get_mtime): New function.
493 * fileread.h (get_mtime): New function.
494 * gold.cc (queue_initial_tasks): Check for incremental update.
495 (process_incremental_input): New function.
496 (queue_middle_tasks): Don't force valid target for incremental
498 * incremental-dump.cc (find_input_containing_global): Adjust
499 size of symbol info entry.
500 (dump_incremental_inputs): Dump argument serial number and
501 in_system_directory flag; bias shndx by 1; print symbol names
502 when dumping per-file symbol lists; use new symbol info readers.
504 (Output_section_incremental_inputs:update_data_size): New function.
505 (Sized_incremental_binary::setup_readers): Setup input readers
506 for each input file; build maps for files added from libraries
508 (Sized_incremental_binary::check_input_args): New function.
509 (Sized_incremental_binary::do_check_inputs): Build map of argument
510 serial numbers to input arguments.
511 (Sized_incremental_binary::do_file_has_changed): Rename
512 do_file_is_unchanged to this; compare file modification times.
513 (Sized_incremental_binary::do_init_layout): New function.
514 (Sized_incremental_binary::do_reserve_layout): New function.
515 (Sized_incremental_binary::do_get_input_reader): Remove.
516 (Sized_incremental_binary::get_symtab_view): New function.
517 (Incremental_checker::can_incrementally_link_output_file): Remove.
518 (Incremental_inputs::report_command_line): Exclude --debug options.
519 (Incremental_inputs::report_archive_begin): Add parameter; track
520 argument serial numbers; don't put input file entry for archive
521 before archive members.
522 (Incremental_inputs::report_archive_end): Put input file entry
523 for archive after archive members.
524 (Incremental_inputs::report_object): Add parameter; track argument
525 serial numbers and in_system_directory flag.
526 (Incremental_inputs::report_script): Add parameter; track argument
528 (Output_section_incremental_inputs::set_final_data_size): Adjust
529 size of symbol info entry; check for forwarding symbols.
530 (Output_section_incremental_inputs::write_input_files): Write
531 in_system_directory flag and argument serial number.
532 (Output_section_incremental_inputs::write_info_blocks): Map section
533 indices between incremental info and original input file; store
534 input section index for each symbol.
535 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
536 change operator() to visit().
537 (class Global_got_offset_visitor): Likewise.
538 (class Global_symbol_visitor_got_plt):
539 (Output_section_incremental_inputs::write_got_plt): Use new visitor
541 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
542 (Sized_incr_relobj::do_read_symbols): New function.
543 (Sized_incr_relobj::do_layout): New function.
544 (Sized_incr_relobj::do_layout_deferred_sections): New function.
545 (Sized_incr_relobj::do_add_symbols): New function.
546 (Sized_incr_relobj::do_should_include_member): New function.
547 (Sized_incr_relobj::do_for_all_global_symbols): New function.
548 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
549 (Sized_incr_relobj::do_section_size): New function.
550 (Sized_incr_relobj::do_section_name): New function.
551 (Sized_incr_relobj::do_section_contents): New function.
552 (Sized_incr_relobj::do_section_flags): New function.
553 (Sized_incr_relobj::do_section_entsize): New function.
554 (Sized_incr_relobj::do_section_address): New function.
555 (Sized_incr_relobj::do_section_type): New function.
556 (Sized_incr_relobj::do_section_link): New function.
557 (Sized_incr_relobj::do_section_info): New function.
558 (Sized_incr_relobj::do_section_addralign): New function.
559 (Sized_incr_relobj::do_initialize_xindex): New function.
560 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
561 (Sized_incr_relobj::do_read_relocs): New function.
562 (Sized_incr_relobj::do_gc_process_relocs): New function.
563 (Sized_incr_relobj::do_scan_relocs): New function.
564 (Sized_incr_relobj::do_count_local_symbols): New function.
565 (Sized_incr_relobj::do_finalize_local_symbols): New function.
566 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
567 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
568 (Sized_incr_relobj::do_relocate): New function.
569 (Sized_incr_relobj::do_set_section_offset): New function.
570 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
571 (Sized_incr_dynobj::do_read_symbols): New function.
572 (Sized_incr_dynobj::do_layout): New function.
573 (Sized_incr_dynobj::do_add_symbols): New function.
574 (Sized_incr_dynobj::do_should_include_member): New function.
575 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
576 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
577 (Sized_incr_dynobj::do_section_size): New function.
578 (Sized_incr_dynobj::do_section_name): New function.
579 (Sized_incr_dynobj::do_section_contents): New function.
580 (Sized_incr_dynobj::do_section_flags): New function.
581 (Sized_incr_dynobj::do_section_entsize): New function.
582 (Sized_incr_dynobj::do_section_address): New function.
583 (Sized_incr_dynobj::do_section_type): New function.
584 (Sized_incr_dynobj::do_section_link): New function.
585 (Sized_incr_dynobj::do_section_info): New function.
586 (Sized_incr_dynobj::do_section_addralign): New function.
587 (Sized_incr_dynobj::do_initialize_xindex): New function.
588 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
589 (make_sized_incremental_object): New function.
590 (Incremental_library::copy_unused_symbols): New function.
591 (Incremental_library::do_for_all_unused_symbols): New function.
592 * incremental.h (enum Incremental_input_flags): New type.
593 (class Incremental_checker): Remove.
594 (Incremental_input_entry::Incremental_input_entry): Add argument
596 (Incremental_input_entry::arg_serial): New function.
597 (Incremental_input_entry::set_is_in_system_directory): New function.
598 (Incremental_input_entry::is_in_system_directory): New function.
599 (Incremental_input_entry::arg_serial_): New data member.
600 (Incremental_input_entry::is_in_system_directory_): New data member.
601 (class Script_info): Move here from script.h.
602 (Script_info::Script_info): Add filename parameter.
603 (Script_info::filename): New function.
604 (Script_info::filename_): New data member.
605 (Incremental_script_entry::Incremental_script_entry): Add argument
607 (Incremental_object_entry::Incremental_object_entry): Likewise.
608 (Incremental_object_entry::add_input_section): Build list of input
609 sections with map to original shndx.
610 (Incremental_object_entry::get_input_section_index): New function.
611 (Incremental_object_entry::shndx_): New data member.
612 (Incremental_object_entry::name_key_): Rename; adjust all refs.
613 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
614 (Incremental_archive_entry::Incremental_archive_entry): Add argument
616 (Incremental_inputs::report_archive_begin): Likewise.
617 (Incremental_inputs::report_object): Likewise.
618 (Incremental_inputs::report_script): Likewise.
619 (class Incremental_global_symbol_reader): New class.
620 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
621 and store flags and input file type.
622 (Incremental_input_entry_reader::arg_serial): New function.
623 (Incremental_input_entry_reader::type): Extract type from flags.
624 (Incremental_input_entry_reader::is_in_system_directory): New function.
625 (Incremental_input_entry_reader::get_input_section_count): Call
626 accessor function for type.
627 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
628 function for type; adjust size of global symbol entry.
629 (Incremental_input_entry_reader::get_global_symbol_count): Call
630 accessor function for type.
631 (Incremental_input_entry_reader::get_object_count): Likewise.
632 (Incremental_input_entry_reader::get_object_offset): Likewise.
633 (Incremental_input_entry_reader::get_member_count): Likewise.
634 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
635 (Incremental_input_entry_reader::get_member_offset): Likewise.
636 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
637 (Incremental_input_entry_reader::Global_symbol_info): Remove.
638 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
639 (Incremental_input_entry_reader::get_global_symbol_reader): New
641 (Incremental_input_entry_reader::get_output_symbol_index): New
643 (Incremental_input_entry_reader::type_): Remove.
644 (Incremental_input_entry_reader::flags_): New data member.
645 (Incremental_inputs_reader::input_file_offset): New function.
646 (Incremental_inputs_reader::input_file_index): New function.
647 (Incremental_inputs_reader::input_file): Call input_file_offset.
648 (Incremental_inputs_reader::input_file_at_offset): New function.
649 (Incremental_relocs_reader::get_r_type): Reformat.
650 (Incremental_relocs_reader::get_r_shndx): Reformat.
651 (Incremental_relocs_reader::get_r_offset): Reformat.
652 (Incremental_relocs_reader::data): New function.
653 (Incremental_binary::Incremental_binary): Initialize new data members.
654 (Incremental_binary::check_inputs): Add cmdline parameter.
655 (Incremental_binary::file_is_unchanged): Remove.
656 (Input_reader::arg_serial): New function.
657 (Input_reader::get_unused_symbol_count): New function.
658 (Input_reader::get_unused_symbol): New function.
659 (Input_reader::do_arg_serial): New function.
660 (Input_reader::do_get_unused_symbol_count): New function.
661 (Input_reader::do_get_unused_symbol): New function.
662 (Incremental_binary::input_file_count): New function.
663 (Incremental_binary::get_input_reader): Change signature to use
664 index instead of filename.
665 (Incremental_binary::file_has_changed): New function.
666 (Incremental_binary::get_input_argument): New function.
667 (Incremental_binary::get_library): New function.
668 (Incremental_binary::get_script_info): New function.
669 (Incremental_binary::init_layout): New function.
670 (Incremental_binary::reserve_layout): New function.
671 (Incremental_binary::output_file): New function.
672 (Incremental_binary::do_check_inputs): New function.
673 (Incremental_binary::do_file_is_unchanged): Remove.
674 (Incremental_binary::do_file_has_changed): New function.
675 (Incremental_binary::do_init_layout): New function.
676 (Incremental_binary::do_reserve_layout): New function.
677 (Incremental_binary::do_input_file_count): New function.
678 (Incremental_binary::do_get_input_reader): Change signature.
679 (Incremental_binary::input_args_map_): New data member.
680 (Incremental_binary::library_map_): New data member.
681 (Incremental_binary::script_map_): New data member.
682 (Sized_incremental_binary::Sized_incremental_binary): Initialize
684 (Sized_incremental_binary::output_section): New function.
685 (Sized_incremental_binary::inputs_reader): Add const.
686 (Sized_incremental_binary::symtab_reader): Add const.
687 (Sized_incremental_binary::relocs_reader): Add const.
688 (Sized_incremental_binary::got_plt_reader): Add const.
689 (Sized_incremental_binary::get_symtab_view): New function.
690 (Sized_incremental_binary::Inputs_reader): New typedef.
691 (Sized_incremental_binary::Input_entry_reader): New typedef.
692 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
693 (Sized_incremental_binary::do_file_is_unchanged): Remove.
694 (Sized_incremental_binary::do_file_has_changed): New function.
695 (Sized_incremental_binary::do_init_layout): New function.
696 (Sized_incremental_binary::do_reserve_layout): New function.
697 (Sized_input_reader::Inputs_reader): Remove.
698 (Sized_input_reader::Input_entry_reader): Remove.
699 (Sized_input_reader::do_arg_serial): New function.
700 (Sized_input_reader::do_get_unused_symbol_count): New function.
701 (Sized_input_reader::do_get_unused_symbol): New function.
702 (Sized_incremental_binary::do_input_file_count): New function.
703 (Sized_incremental_binary::do_get_input_reader): Change signature;
704 use index instead of filename.
705 (Sized_incremental_binary::section_map_): New data member.
706 (Sized_incremental_binary::input_entry_readers_): New data member.
707 (class Sized_incr_relobj): New class.
708 (class Sized_incr_dynobj): New class.
709 (make_sized_incremental_object): New function.
710 (class Incremental_library): New class.
711 * layout.cc (Free_list::num_lists): New static data member.
712 (Free_list::num_nodes): New static data member.
713 (Free_list::num_removes): New static data member.
714 (Free_list::num_remove_visits): New static data member.
715 (Free_list::num_allocates): New static data member.
716 (Free_list::num_allocate_visits): New static data member.
717 (Free_list::init): New function.
718 (Free_list::remove): New function.
719 (Free_list::allocate): New function.
720 (Free_list::dump): New function.
721 (Free_list::print_stats): New function.
722 (Layout_task_runner::run): Resize output file for incremental updates.
723 (Layout::Layout): Initialize new data members.
724 (Layout::set_incremental_base): New function.
725 (Layout::init_fixed_output_section): New function.
726 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
728 (Layout::create_gold_note): Do not create gold note section for
730 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
731 for incremental updates.
732 (Layout::set_section_offsets): For incremental updates, allocate space
734 (Layout::create_symtab_sections): Layout with offsets relative to
735 start of section; for incremental updates, allocate space from free
737 (Layout::create_shdrs): For incremental updates, allocate space from
739 (Layout::finish_dynamic_section): For incremental updates, do not
740 check --as-needed (fixed in subsequent patch).
741 * layout.h (class Free_list): New class.
742 (Layout::set_incremental_base): New function.
743 (Layout::incremental_base): New function.
744 (Layout::init_fixed_output_section): New function.
745 (Layout::allocate): New function.
746 (Layout::incremental_base_): New data member.
747 (Layout::free_list_): New data member.
748 * main.cc (main): Print Free_list statistics.
749 * object.cc (Relobj::finalize_incremental_relocs): Add
750 clear_counts parameter; clear counts only when clear_counts is set.
751 (Sized_relobj::Sized_relobj): Initialize new base class.
752 (Sized_relobj::do_layout): Don't report special sections.
753 (Sized_relobj::do_for_all_local_got_entries): New function.
754 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
755 symtab_off to all symbol table offsets.
756 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
757 * object.h (class Got_offset_list): Move to top of file.
758 (Object::Object): Allow case where input_file == NULL.
759 (Object::~Object): Likewise.
760 (Object::input_file): Assert that input_file != NULL.
761 (Object::lock): Allow case where input_file == NULL.
762 (Object::unlock): Likewise.
763 (Object::is_locked): Likewise.
764 (Object::token): Likewise.
765 (Object::release): Likewise.
766 (Object::is_incremental): New function.
767 (Object::get_mtime): New function.
768 (Object::for_all_local_got_entries): New function.
769 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
770 (Object::set_is_in_system_directory): New function.
771 (Object::is_in_system_directory): New function.
772 (Object::do_is_incremental): New function.
773 (Object::do_get_mtime): New function.
774 (Object::do_for_all_local_got_entries): New function.
775 (Object::is_in_system_directory_): New data member.
776 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
777 (class Sized_relobj_base): New class.
778 (class Sized_relobj): Derive from Sized_relobj_base.
779 (class Sized_relobj::Symbols): Redeclare from base class.
780 (class Sized_relobj::local_got_offset_list): Remove.
781 (class Sized_relobj::Output_sections): Redeclare from base class.
782 (class Sized_relobj::do_for_all_local_got_entries): New function.
783 (class Sized_relobj::write_local_symbols): Add offset parameter.
784 (class Sized_relobj::local_symbol_offset_): Update comment.
785 (class Sized_relobj::local_dynsym_offset_): Update comment.
786 * options.cc (Input_arguments::add_file): Remove const.
787 * options.h (Input_file_argument::Input_file_argument):
788 Initialize arg_serial_ (all constructors).
789 (Input_file_argument::set_arg_serial): New function.
790 (Input_file_argument::arg_serial): New function.
791 (Input_file_argument::arg_serial_): New data member.
792 (Input_arguments::Input_arguments): Initialize file_count_.
793 (Input_arguments::add_file): Remove const.
794 (Input_arguments::number_of_input_files): New function.
795 (Input_arguments::file_count_): New data member.
796 (Command_line::number_of_input_files): Call
797 Input_arguments::number_of_input_files.
798 * output.cc (Output_segment_headers::Output_segment_headers):
800 (Output_section::Input_section::current_data_size): New function.
801 (Output_section::Output_section): Initialize new data members.
802 (Output_section::add_input_section): Don't do merge sections for
803 an incremental link; allocate space from free list for an
805 (Output_section::add_output_section_data): Allocate space from
806 free list for an incremental update.
807 (Output_section::update_data_size): New function.
808 (Output_section::set_fixed_layout): New function.
809 (Output_section::reserve): New function.
810 (Output_segment::set_section_addresses): Remove const.
811 (Output_segment::set_section_list_addresses): Remove const; allocate
812 space from free list for an incremental update.
813 (Output_segment::set_offset): Adjust size of RELRO segment for an
815 * output.h (Output_data::current_data_size): Move here from
817 (Output_data::pre_finalize_data_size): New function.
818 (Output_data::update_data_size): New function.
819 (Output_section_headers::update_data_size): new function.
820 (Output_section_data_build::current_data_size): Move to Output_data.
821 (Output_data_strtab::update_data_size): New function.
822 (Output_section::current_data_size): Move to Output_data.
823 (Output_section::set_fixed_layout): New function.
824 (Output_section::has_fixed_layout): New function.
825 (Output_section::reserve): New function.
826 (Output_section::update_data_size): New function.
827 (Output_section::has_fixed_layout_): New data member.
828 (Output_section::free_list_): New data member.
829 (Output_segment::set_section_addresses): Remove const.
830 (Output_segment::set_section_list_addresses): Remove const.
831 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
833 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
835 * readsyms.cc (Read_symbols::do_read_symbols): Add library
836 parameter when calling Add_symbols constructor; store argument
837 serial number for members of a lib group.
838 (Add_symbols::locks): Allow case where token == NULL.
839 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
840 (Read_member::~Read_member): New function.
841 (Read_member::is_runnable): New function.
842 (Read_member::locks): New function.
843 (Read_member::run): New function.
844 (Check_script::~Check_script): New function.
845 (Check_script::is_runnable): New function.
846 (Check_script::locks): New function.
847 (Check_script::run): New function.
848 (Check_library::~Check_library): New function.
849 (Check_library::is_runnable): New function.
850 (Check_library::locks): New function.
851 (Check_library::run): New function.
852 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
853 (Add_symbols::library_): New data member.
854 (class Read_member): New class.
855 (class Check_script): New class.
856 (class Check_library): New class.
857 * reloc.cc (Read_relocs::is_runnable): Allow case where
859 (Read_relocs::locks): Likewise.
860 (Scan_relocs::locks): Likewise.
861 (Relocate_task::locks): Likewise.
862 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
864 (Sized_relobj::incremental_relocs_scan): Fix comment.
865 (Sized_relobj::do_relocate): Pass output file offset to
867 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
868 from class declaration.
869 * script.cc (read_input_script): Allocate Script_info; pass
870 argument serial number to report_script.
871 * script.h (class Script_info): Move to incremental.h.
872 * symtab.cc (Symbol_table::add_from_incrobj): New function.
873 * symtab.h (Symbol_table::add_from_incrobj): New function.
874 (Symbol_table::set_file_offset): New function.
876 2011-04-05 Cary Coutant <ccoutant@google.com>
878 * incremental-dump.cc (dump_incremental_inputs): Change signature
879 to take a Sized_incremental_binary; change caller. Use readers
880 in Sized_incremental_binary.
882 (Sized_incremental_binary::find_incremental_inputs_sections):
883 Rename do_find_incremental_inputs_sections to this.
884 (Sized_incremental_binary::setup_readers): New function.
885 (Sized_incremental_binary::do_check_inputs): Check
886 has_incremental_info_ flag; move setup code to setup_readers;
888 (Sized_incremental_binary::do_file_is_unchanged): New function.
889 (Sized_incremental_binary::do_get_input_reader): New function.
890 * incremental.h (class Incremental_binary): Move to end of file.
891 (Incremental_binary::file_is_unchanged): New function.
892 (Incremental_binary::do_file_is_unchanged): New function.
893 (Incremental_binary::Input_reader): New class.
894 (Incremental_binary::get_input_reader): New function.
895 (class Sized_incremental_binary): Move to end of file.
896 (Sized_incremental_binary::Sized_incremental_binary): Setup the
897 input section reader classes.
898 (Sized_incremental_binary::has_incremental_info): New function.
899 (Sized_incremental_binary::inputs_reader): New function.
900 (Sized_incremental_binary::symtab_reader): New function.
901 (Sized_incremental_binary::relocs_reader): New function.
902 (Sized_incremental_binary::got_plt_reader): New function.
903 (Sized_incremental_binary::do_file_is_unchanged): New function.
904 (Sized_incremental_binary::Sized_input_reader): New class.
905 (Sized_incremental_binary::get_input_reader): New function.
906 (Sized_incremental_binary::find_incremental_inputs_sections):
907 Rename do_find_incremental_inputs_sections to this.
908 (Sized_incremental_binary::setup_readers): New function.
909 (Sized_incremental_binary::has_incremental_info_): New data member.
910 (Sized_incremental_binary::inputs_reader_): New data member.
911 (Sized_incremental_binary::symtab_reader_): New data member.
912 (Sized_incremental_binary::relocs_reader_): New data member.
913 (Sized_incremental_binary::got_plt_reader_): New data member.
914 (Sized_incremental_binary::current_input_file_): New data member.
916 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
919 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
922 2011-03-30 Cary Coutant <ccoutant@google.com>
924 * archive.cc (Archive::include_member): Adjust call to report_object.
925 (Add_archive_symbols::run): Add script_info to call to
926 report_archive_begin.
927 (Lib_group::include_member): Adjust call to report_object.
928 (Add_lib_group_symbols::run): Adjust call to report_object.
929 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
930 blocks. Add object count for script input files.
931 * incremental.cc (Incremental_inputs::report_archive_begin): Add
932 script_info parameter; change all callers.
933 (Incremental_inputs::report_object): Add script_info parameter;
935 (Incremental_inputs::report_script): Store backpointer to
936 incremental info entry.
937 (Output_section_incremental_inputs::set_final_data_size): Record
938 additional information for scripts.
939 (Output_section_incremental_inputs::write_info_blocks): Likewise.
940 * incremental.h (Incremental_script_entry::add_object): New function.
941 (Incremental_script_entry::get_object_count): New function.
942 (Incremental_script_entry::get_object): New function.
943 (Incremental_script_entry::objects_): New data member; adjust
945 (Incremental_inputs::report_archive_begin): Add script_info parameter.
946 (Incremental_inputs::report_object): Add script_info parameter.
947 (Incremental_inputs_reader::get_object_count): New function.
948 (Incremental_inputs_reader::get_object_offset): New function.
949 * options.cc (Input_arguments::add_file): Return reference to
951 * options.h (Input_argument::set_script_info): New function.
952 (Input_argument::script_info): New function.
953 (Input_argument::script_info_): New data member; adjust all
955 (Input_file_group::add_file): Return reference to new input argument.
956 (Input_file_lib::add_file): Likewise.
957 (Input_arguments::add_file): Likewise.
958 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
959 * script.cc (Parser_closure::Parser_closure): Add script_info
960 parameter; adjust all callers.
961 (Parser_closure::script_info): New function.
962 (Parser_closure::script_info_): New data member.
963 (read_input_script): Report scripts earlier to incremental info.
964 (script_add_file): Set script_info in Input_argument.
965 (script_add_library): Likewise.
966 * script.h (Script_options::Script_info): Rewrite class.
968 2011-03-29 Cary Coutant <ccoutant@google.com>
970 * archive.cc (Library_base::should_include_member): Move
971 method here from class Archive.
972 (Archive::Archive): Initialize base class.
973 (Archive::should_include_member): Move to base class.
974 (Archive::do_for_all_unused_symbols): New function.
975 (Add_archive_symbols::run): Remove redundant access to
977 (Lib_group::Lib_group): Initialize base class.
978 (Lib_group::do_filename): New function.
979 (Lib_group::include_member): Pass pointer to Lib_group to
981 (Lib_group::do_for_all_unused_symbols): New function.
982 (Add_lib_group_symbols::run): Report archive information for
984 * archive.h (class Library_base): New base class.
985 (class Archive): Derive from Library_base.
986 (Archive::filename): Move to base class.
987 (Archive::set_incremental_info): Likewise.
988 (Archive::incremental_info): Likewise.
989 (Archive::Should_include): Likewise.
990 (Archive::should_include_member): Likewise.
991 (Archive::Armap_entry): Remove.
992 (Archive::Unused_symbol_iterator): Remove.
993 (Archive::unused_symbols_begin): Remove.
994 (Archive::unused_symbols_end): Remove.
995 (Archive::do_filename): New function.
996 (Archive::do_get_mtime): New function.
997 (Archive::do_for_all_unused_symbols): New function.
998 (Archive::task_): Move to base class.
999 (Archive::incremental_info_): Likewise.
1000 (class Lib_group): Derive from Library_base.
1001 (Lib_group::do_filename): New function.
1002 (Lib_group::do_get_mtime): New function.
1003 (Lib_group::do_for_all_unused_symbols): New function.
1004 (Lib_group::task_): Move to base class.
1005 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1007 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1009 * incremental.cc (Incremental_inputs::report_archive_begin):
1010 Use Library_base; call library's get_mtime; add incremental inputs
1011 entry before members.
1012 (class Unused_symbol_visitor): New class.
1013 (Incremental_inputs::report_archive_end): Use Library_base; use
1014 visitor class to record unused symbols; don't add incremental inputs
1015 entry after members.
1016 (Incremental_inputs::report_object): Use Library_base.
1018 (Incremental_archive_entry::Incremental_archive_entry): Remove
1019 unused Archive parameter.
1020 (Incremental_inputs::report_archive_begin): Use Library_base.
1021 (Incremental_inputs::report_archive_end): Likewise.
1022 (Incremental_inputs::report_object): Likewise.
1023 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1025 * object.h (Object::for_all_global_symbols): New function.
1026 (Object::do_for_all_global_symbols): New function.
1027 (Sized_relobj::do_for_all_global_symbols): New function.
1028 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1030 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1033 2011-03-27 Ian Lance Taylor <iant@google.com>
1035 * archive.cc (Archive::interpret_header): Return -1 if something
1036 goes wrong. Change callers accordingly.
1038 2011-03-25 Cary Coutant <ccoutant@google.com>
1040 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1041 * testsuite/Makefile.in: Regenerate.
1043 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1045 * plugin.cc (get_view): New.
1046 (Plugin::load): Pass get_view to the plugin.
1047 (Plugin_manager::get_view): New.
1049 2011-03-21 Ian Lance Taylor <iant@google.com>
1051 * testsuite/final_layout.sh: Rewrite to not use dc.
1052 * testsuite/relro_test.sh: Fail if dc is not present.
1054 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1056 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1058 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1059 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1061 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1062 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1064 2011-03-14 Ian Lance Taylor <iant@google.com>
1066 * script-sections.cc (Sort_output_sections::script_compare):
1067 Rename from is_before, change return type.
1068 (Sort_output_sections::operator()): Adjust accordingly.
1070 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1073 * testsuite/odr_violation2.cc: Add comment to make all error line
1074 numbers double digits.
1075 * testsuite/debug_msg.sh: Adjust expected errors.
1077 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1079 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1080 but mark earlier ones as non-canonical
1081 (offset_to_iterator): Update search target and example
1082 (do_addr2line): Return extra lines in a vector*
1083 (format_file_lineno): Extract from do_addr2line
1084 (one_addr2line): Add vector* out-param
1085 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1086 when a lineno entry appeared last for its instruction
1087 (Dwarf_line_info): Add vector* out-param
1088 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1089 * symtab.cc (Odr_violation_compare): Include the lineno in the
1091 (linenos_from_loc): New. Combine the canonical line for an
1092 address with its other lines.
1093 (True_if_intersect): New. Helper functor to make
1094 std::set_intersection a query.
1095 (detect_odr_violations): Compare sets of lines instead of just
1096 one line for each function. This became less deterministic, but
1097 has fewer false positives.
1098 * symtab.h: Declarations.
1099 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1100 mix an optimized and non-optimized object in the same binary
1101 (odr_violation2.so): Same.
1102 * testsuite/Makefile.in: Regenerate from Makefile.am.
1103 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1104 * testsuite/debug_msg.sh: Update line numbers and add
1106 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1107 non-optimized context.
1108 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1109 isn't inlined, and use OdrDerived in an optimized context.
1110 * testsuite/odr_header1.h: Defines OdrDerived, where
1111 optimization will change the
1112 first-instruction-in-the-destructor's file and line number.
1113 * testsuite/odr_header2.h: Defines OdrBase.
1115 2011-03-09 Ian Lance Taylor <iant@google.com>
1117 * fileread.cc (File_read::clear_views): Don't delete the whole
1120 2011-03-08 Ian Lance Taylor <iant@google.com>
1123 * fileread.cc: #include <climits>.
1124 (GOLD_IOV_MAX): Define.
1125 (File_read::read_multiple): Limit number of entries by iov_max.
1126 * fileread.h (class File_read): Always set max_readv_entries to
1129 2011-03-07 Ian Lance Taylor <iant@google.com>
1132 * options.h (class General_options): Add -dy and -dn.
1134 2011-03-02 Cary Coutant <ccoutant@google.com>
1136 * testsuite/script_test_9.t: Add TLS segment.
1138 2011-03-02 Simon Baldwin <simonb@google.com>
1140 * configure.ac: Add check for gnu_indirect_function support in
1141 the toolchain building binutils.
1142 * configure: Rebuild.
1144 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1146 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1147 plugin only symbols.
1148 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1149 in plugin files as not needed in the symbol table.
1151 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1153 * output.cc (Output_section::add_input_section): Delay fill
1154 generation for section ordering.
1156 2011-02-09 Ian Lance Taylor <iant@google.com>
1159 * object.h (class Sized_relobj): Remove clear_local_symbols.
1160 * reloc.cc (Sized_relobj::do_relocate): Don't call
1161 clear_local_symbols.
1163 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1165 * plugin.cc (is_visible_from_outside): Return true for symbols
1168 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1170 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1173 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1175 * icf.h (is_section_foldable_candidate): Change type of parameter
1177 * icf.cc (Icf::find_identical_sections): Change type of local variable
1178 section_name to be std::string.
1179 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1181 2011-01-25 Ian Lance Taylor <iant@google.com>
1183 * script.cc (script_add_extern): Rewrite to use
1184 add_symbol_reference.
1186 2011-01-25 Doug Kwan <dougkwan@google.com>
1188 * icf.cc (get_section_contents): Always lock section's object.
1190 2011-01-24 Ian Lance Taylor <iant@google.com>
1192 * options.h (class General_options): Accept
1193 --no-detect-odr-violations.
1195 2011-01-24 Ian Lance Taylor <iant@google.com>
1197 * version.cc (version_string): Bump to 1.11.
1199 2011-01-24 Ian Lance Taylor <iant@google.com>
1201 * plugin.cc (class Plugin_rescan): Define new class.
1202 (Plugin_manager::claim_file): Set any_claimed_.
1203 (Plugin_manager::save_archive): New function.
1204 (Plugin_manager::save_input_group): New function.
1205 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1207 (Plugin_manager::new_undefined_symbol): New function.
1208 (Plugin_manager::rescan): New function.
1209 (Plugin_manager::rescannable_defines): New function.
1210 (Plugin_manager::add_input_file): Set any_added_.
1211 * plugin.h (class Plugin_manager): define new fields rescannable_,
1212 undefined_symbols_, any_claimed_, and any_added_. Declare
1213 Plugin_rescan as friend. Declare new functions.
1214 (Plugin_manager::Rescannable): Define type.
1215 (Plugin_manager::Rescannable_list): Define type.
1216 (Plugin_manager::Undefined_symbol_list): Define type.
1217 (Plugin_manager::Plugin_manager): Initialize new fields.
1218 * archive.cc (Archive::defines_symbol): New function.
1219 (Add_archive_symbols::run): Pass archive to plugins if any.
1220 * archive.h (class Archive): Declare defines_symbol.
1221 * readsyms.cc (Input_group::~Input_group): New function.
1222 (Finish_group::run): Pass input_group to plugins if any.
1223 * readsyms.h (class Input_group): Declare destructor.
1224 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1227 2011-01-10 Ian Lance Taylor <iant@google.com>
1229 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1231 (Layout::set_segment_offsets): Reset increase_relro before calling
1232 set_section_addresses a second time.
1234 2011-01-04 Cary Coutant <ccoutant@google.com>
1236 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1237 sections before NOBITS sections.
1239 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1241 * version.cc (print_version): Update copyright to 2011.
1243 2010-12-23 Cary Coutant <ccoutant@google.com>
1245 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1246 of OS to this->add. Add OD parameter to second form of the function.
1248 2010-12-20 Ian Lance Taylor <iant@google.com>
1250 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1251 second of two consecutive entries with same offset.
1253 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1255 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1256 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1257 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1258 to avoid unneeded links against $(LDADD).
1259 * testsuite/Makefile.in: Regenerate.
1261 2010-12-15 Ian Lance Taylor <iant@google.com>
1264 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1265 for R_X86_64_32 and R_X86_64_PC32.
1266 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1267 ver_matching_def_pic.o.
1268 (ver_matching_def_pic.o): New target.
1270 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1272 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1273 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1274 Move definition before File_read::View member definitions.
1275 (File_read::View::~View): Initialize and hold lock before
1276 updating current_mapped_bytes.
1278 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1280 * dwarf_reader.cc: Remove outdated comment.
1281 * gold-threads.cc: Fix typo in error message.
1282 * archive.cc: Fix typos in comments.
1283 * archive.h: Likewise.
1284 * arm-reloc-property.cc: Likewise.
1285 * arm-reloc-property.h: Likewise.
1286 * arm-reloc.def: Likewise.
1288 * attributes.h: Likewise.
1289 * cref.cc: Likewise.
1290 * ehframe.cc: Likewise.
1291 * fileread.h: Likewise.
1293 * i386.cc: Likewise.
1295 * incremental.h: Likewise.
1296 * int_encoding.cc: Likewise.
1297 * layout.h: Likewise.
1298 * main.cc: Likewise.
1299 * merge.h: Likewise.
1300 * object.cc: Likewise.
1301 * object.h: Likewise.
1302 * options.cc: Likewise.
1303 * readsyms.cc: Likewise.
1304 * reduced_debug_output.cc: Likewise.
1305 * reloc.cc: Likewise.
1306 * script-sections.cc: Likewise.
1307 * sparc.cc: Likewise.
1308 * symtab.h: Likewise.
1309 * target-reloc.h: Likewise.
1310 * target.cc: Likewise.
1311 * target.h: Likewise.
1312 * timer.cc: Likewise.
1313 * timer.h: Likewise.
1314 * x86_64.cc: Likewise.
1316 2010-12-09 Cary Coutant <ccoutant@google.com>
1318 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1320 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1321 parameter; change all callers.
1322 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1323 * options.h (warn_execstack): New option.
1325 2010-12-07 Doug Kwan <dougkwan@google.com>
1327 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1328 like function call relocations.
1330 2010-12-07 Ian Lance Taylor <iant@google.com>
1332 * archive.cc (Archive::get_elf_object_for_member): Permit
1333 punconfigured to be NULL.
1334 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1335 (Archive::include_member): Pass NULL to get_elf_object_for_member
1336 if we searched for the archive and this is the first included
1339 2010-12-01 Ian Lance Taylor <iant@google.com>
1341 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1342 track_relocs_type_ field.
1343 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1344 Set track_relocs_type_.
1345 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1346 contents when using RELA relocs.
1347 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1349 * reloc.cc (Track_relocs::next_addend): New function.
1350 * reloc.h (class Track_relocs): Declare next_addend.
1352 2010-12-01 Ian Lance Taylor <iant@google.com>
1354 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1357 2010-12-01 Ian Lance Taylor <iant@google.com>
1359 * README: Update compilers known to work and fail.
1361 2010-11-23 Matthias Klose <doko@ubuntu.com>
1363 * configure.in: For --enable-gold, handle value `default' instead of
1364 `both*'. Always install ld as ld.bfd, install as ld if gold is
1366 * configure: Regenerate.
1368 2010-11-18 Doug Kwan <dougkwan@google.com>
1370 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1371 and right_alignment to be zero. Store result alignment only if it is
1372 greater than existing alignment.
1374 2010-11-16 Cary Coutant <ccoutant@google.com>
1377 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1378 Check for ".zdebug_line".
1380 2010-11-16 Doug Kwan <dougkwan@google.com>
1381 Cary Coutant <ccoutant@google.com>
1383 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1384 by reference; adjust all callers.
1385 * output.cc (Output_segment::set_section_addresses): Adjust references
1386 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1388 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1389 end at page boundary.
1391 2010-11-16 Cary Coutant <ccoutant@google.com>
1394 * layout.cc (Layout::choose_output_section): Transform names of
1395 compressed sections even when using a script with a SECTIONS clause.
1396 (Layout::output_section_name): Remove code to transform
1397 compressed debug section names.
1398 * output.cc (Output_section::add_input_section): Use uncompressed
1399 section size when tracking input sections.
1401 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1403 * symtab.h (Symbol::NON_PIC_REF): Remove.
1404 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1405 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1406 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1407 (Symbol::use_plt_offset): Take a flags argument and pass it
1408 directly to needs_dynamic_reloc. Restrict check for undefined
1409 weak symbols to function calls.
1410 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1411 (Target_arm::Scan::global): Use it.
1412 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1413 (Target_arm::Relocate::relocate): Likewise.
1414 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1415 parameter with an r_type parameter. Use get_reference_flags
1417 (Target_arm::Relocate::relocate): Update accordingly.
1418 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1419 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1420 (Target_i386::Scan::global): Likewise.
1421 (Target_i386::Relocate::relocate): Likewise.
1422 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1423 parameter with an r_type parameter. Use get_reference_flags
1425 (Target_i386::Relocate::relocate): Update accordingly.
1426 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1427 (Target_powerpc::Scan::global): Use it.
1428 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1429 (Target_powerpc::Relocate::relocate): Likewise.
1430 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1431 (Target_sparc::Scan::global): Use it.
1432 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1433 (Target_sparc::Relocate::relocate): Likewise.
1434 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1435 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1436 (Target_x86_64::Scan::global): Likewise.
1437 (Target_x86_64::Relocate::relocate): Likewise.
1439 2010-11-08 Doug Kwan <dougkwan@google.com>
1440 Cary Coutant <ccoutant@google.com>
1442 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1443 (Arm_exidx_merge_section::section_contents_): New data member.
1444 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1445 (Arm_input_section::~Arm_input_section): De-allocate memory.
1446 (Arm_input_section::original_contents_): New data member.
1447 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1448 in parameters instead of calling Object::section_contents without
1450 (Arm_output_section::group_section): New parameter TASK. Pass it
1451 to callees that need locking objects.
1452 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1453 to lock EXIDX input sections. Fix a formatting issue. Call
1454 Arm_exidx_merged_section::build_contents to create merged section
1456 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1457 to lock object of stub table owner.
1458 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1459 TEXT_SIZE to initialize data member TEXT_SIZE_.
1460 (Arm_exidx_input_section::addralign): Fix typo in comment.
1461 (Arm_exidx_input_section::text_size): New method.
1462 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1463 that require locking objects. Lock objects before scanning for stubs
1464 and updating local symbols.
1465 (Arm_input_section<big_endian>::init): Copy contents of original
1467 (Arm_input_section<big_endian>::do_write): Use saved contents of
1468 original input section instead of calling Object::section_contents
1470 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1471 size without calling Object::section_size().
1472 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1473 for size. Allocate a buffer for merged EXIDX entries.
1474 (Arm_exidx_merged_section::build_contents): New method.
1475 (Arm_exidx_merged_section::do_write): Move merge section contents
1476 building code to Arm_exidx_merged_section::build_contetns. Write
1477 out contetns in buffer instead of building it on the fly.
1478 (Arm_relobj::make_exidx_input_section): Also pass text section size
1479 to Arm_exidx_input_section constructor.
1480 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1481 (Arm_dynobj::do_read_symbols): Fix memory leak.
1482 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1483 * target.h: (class Task): Add forward declaration.
1484 (Target::relax): Add new parameter TASK and pass it to
1486 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1488 2010-11-05 Cary Coutant <ccoutant@google.com>
1491 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1492 object when reading from the file.
1493 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1495 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1496 when reading section contents.
1497 (get_section_contents): Likewise.
1498 (icf::find_identical_sections): Likewise.
1499 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1500 object when reading from the file.
1501 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1502 the object when doing deferred section layout.
1504 2010-11-03 Nick Clifton <nickc@redhat.com>
1507 * script.h (class Symbol_assignment: name): New member. Returns
1508 the name of the symbol.
1509 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1510 Returns true if the given symbol name is on the list of
1511 assignments wating to be processed.
1512 * archive.cc (should_incldue_member): If the symbol is undefined,
1513 check to see if it is on the list of symbols pending assignment.
1515 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1517 * script-sections.cc (Script_sections::find_memory_region): Check
1518 for a NULL output section pointer.
1520 2010-10-29 Doug Kwan <dougkwan@google.com>
1522 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1523 Output_section::add_relaxed_input_section.
1524 * output.cc (Output_section::add_relaxed_input_section): Add new
1525 arguments LAYOUT and NAME. Set section order index.
1526 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1527 Copy section order index.
1528 * output.h (Output_section::add_relaxed_input_section): Add new
1529 arguments LAYOUT and NAME.
1531 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1533 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1534 NATIVE_OR_CROSS_LINKER.
1535 * testsuite/Makefile.in: Regenerate.
1537 2010-10-20 Doug Kwan <dougkwan@google.com>
1539 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1540 without SHF_LINK_ORDER flags.
1541 * layout.cc (Layout::choose_output_section): Do not filter
1542 SHF_LINK_ORDER flag in a relocatable link.
1544 2010-10-17 Cary Coutant <ccoutant@google.com>
1546 * output.h (Output_segment::set_section_addresses): Change function
1547 signature. Update all callers.
1548 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1550 (Output_segment::set_section_addresses): Align after last TLS
1551 section. Add padding before last relro section instead of after.
1553 2010-10-17 Doug Kwan <dougkwan@google.com>
1555 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1556 GOT output section to be writable.
1558 2010-10-14 Cary Coutant <ccoutant@google.com>
1560 * debug.h (DEBUG_INCREMENTAL): New flag.
1561 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1562 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1564 * incremental.cc (report_command_line): Ignore all forms of
1566 * layout.cc (Layout::Layout): Check parameters for incremental link
1568 * options.cc (General_options::parse_incremental): New function.
1569 (General_options::parse_no_incremental): New function.
1570 (General_options::parse_incremental_full): New function.
1571 (General_options::parse_incremental_update): New function.
1572 (General_options::incremental_mode_): New data member.
1573 (General_options::finalize): Check incremental_mode_.
1574 * options.h (General_options): Update help text for --incremental.
1575 Add --no-incremental, --incremental-full, --incremental-update.
1576 (General_options::Incremental_mode): New enum type.
1577 (General_options::incremental_mode): New function.
1578 (General_options::incremental_mode_): New data member.
1579 * parameters.cc (Parameters::incremental_mode_): New data member.
1580 (Parameters::set_options): Set incremental_mode_.
1581 (Parameters::set_incremental_full): New function.
1582 (Parameters::incremental): New function.
1583 (Parameters::incremental_update): New function.
1584 (set_parameters_incremental_full): New function.
1585 * parameters.h (Parameters::set_incremental_full): New function.
1586 (Parameters::incremental): New function.
1587 (Parameters::incremental_update): New function.
1588 (Parameters::incremental_mode_): New data member.
1589 (set_parameters_incremental_full): New function.
1590 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1591 incremental link mode.
1592 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1593 (Sized_relobj::do_relocate_sections): Likewise.
1594 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1596 * testsuite/Makefile.in: Regenerate.
1597 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1599 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1601 * script-sections.h (class Script_sections): Make
1602 Sections_elements typedef public.
1603 * script-sections.cc (class Sort_output_sections): Add elements_
1604 field. Add constructor which sets it; change all callers.
1605 (Sort_output_sections::is_before): New function.
1606 (Sort_output_sections::operator()): Call is_before.
1607 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1609 * testsuite/script_test_10.sh: New test. Test script section
1611 * testsuite/script_test_10.t: Likewise.
1612 * testsuite/script_test_10.s: Likewise.
1613 * testsuite/Makefile.am: Wrap the cross linker tests and the
1614 common tests into NATIVE_OR_CROSS_LINKER.
1615 (check_SCRIPTS): Add script_test_10.sh.
1616 (check_DATA): Add script_test_10.stdout.
1617 (script_test_10.o, script_test_10): New targets.
1618 (script_test_10.stdout): New target.
1619 * configure, testsuite/Makefile.in: Regenerate.
1621 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1623 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1624 error for the deprecated relocations.
1625 (Target_arm::Scan::global): Likewise.
1626 (Target_arm::Relocate::relocate): Likewise.
1628 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1630 * fileread.cc (Input_file::find_file): Initialize *found_name
1631 and *namep when using the fallback search for case 4.
1633 2010-10-11 Cary Coutant <ccoutant@google.com>
1635 * options.h (class General_options): Redefine -z lazy as an alias for
1636 the negation of -z now.
1638 2010-10-11 Ian Lance Taylor <iant@google.com>
1640 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1643 2010-10-06 Nick Clifton <nickc@redhat.com>
1645 * script-sections.cc(class Memory_region): Remove
1646 current_lma_offset_ field. Rename current_vma_offset_ to
1647 current_offset_. Add last_section_ field.
1648 (Memory_region::get_current_vma_address): Rename to
1649 get_current_address.
1650 (Memory_region::get_current_lma_address): Delete.
1651 (Memory_region::increment_vma_offset): Rename to
1653 (Memory_region::increment_lma_offset): Delete.
1654 (Memory_region::attributes_compatible): New method. Returns
1655 true if the provided section is compatible with the region.
1656 (Memory_region::get_last_section): New method. Returns the last
1657 section to use the region.
1658 (Memory_region::set_last_section): New method. Stores the last
1659 section to use the region.
1660 (Script_sections::block_in_region): New method. Returns true if
1661 a block of memory is contained within a region.
1662 (Script_sections::find_memory_region): New method. Locates a
1663 memory region to be used to set a VMA or LMA address.
1664 (Output_section_definition::set_section_addresses): Add code to
1665 check for addresses set by memory regions.
1666 (Output_segment::set_section_addresses): Remove memory region
1668 (Script_sections::create_segment): Add a warning if a header
1669 segment is created outside of any region.
1670 * script-sections.h (class Script_sections): Add prototypes for
1671 find_memory_region and block_in_region methods.
1672 * testsuite/memory_test.s: Use .long instead of .word.
1673 * testsuite/memory_test.t: Add some more output sections.
1674 * testsuite/memory_test.sh: Update expected output.
1676 2010-10-02 Doug Kwan <dougkwan@google.com>
1678 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1679 defintion to symtab.h
1680 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1681 declaration to defintion.
1683 2010-10-01 Nick Clifton <nickc@redhat.com>
1685 * expression.cc (eval): Replace dummy argument with NULL.
1686 (eval_maybe_dot): Check for a NULL result section pointer.
1687 (Symbol_expression::value): Likewise.
1688 (Dot_expression::value): Likewise.
1689 (BINARY_EXPRESSION): Likewise.
1690 (Max_expression::value): Likewise.
1691 (Min_expression::value): Likewise.
1692 (Absolute_expression::value): Likewise.
1693 (Addr_expression::value_from_output_section): Likewise.
1694 (Loaddddr_expression::value_from_output_section): Likewise.
1695 (Segment_start_expression::value): Likewise.
1696 * script-sections.cc
1697 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1699 (Sections_elememt_dot_assignment::set_section_addresses):
1701 (Output_data_expression::do_write_to_buffer): Likewise.
1702 (Output_section_definition::finalize_symbols): Likewise.
1703 (Output_section_definition::set_section_addresses): Likewise.
1705 2010-09-30 Doug Kwan <dougkwan@google.com>
1707 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1709 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1711 * target.h (Target::can_icf_inline_merge_sections): New virtual
1713 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1715 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1717 * icf.cc (get_section_contents): Inline merge sections only when
1720 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1722 * configure: Regenerate.
1724 2010-09-17 Ian Lance Taylor <iant@google.com>
1726 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1727 * testsuite/Makefile.am (memory_test.o): New target.
1728 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1730 * testsuite/Makefile.in: Rebuild.
1732 2010-09-17 Doug Kwan <dougkwan@google.com>
1734 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1735 defintion if relocation uses GOT entries of the symbol.
1736 * testsuite/icf_safe_test.sh: Fix test.
1737 * testsuite/icf_safe_so_test.sh: Fix test.
1739 2010-09-16 Cary Coutant <ccoutant@google.com>
1741 * script_sections.cc (class Memory_region): Remove "NULL" from
1742 vector initializations.
1744 2010-09-15 Cary Coutant <ccoutant@google.com>
1746 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1747 Resolve forwarding symbols.
1749 2010-09-15 Doug Kwan <dougkwan@google.com>
1751 * gold/testsuite/script_test_3.t: Add ARM special sections.
1752 * gold/testsuite/script_test_4.t: Same.
1753 * gold/testsuite/script_test_5.t: Same.
1754 * gold/testsuite/script_test_6.t: Same.
1755 * gold/testsuite/script_test_7.t: Same.
1756 * gold/testsuite/script_test_7.t: Same.
1757 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1759 2010-09-14 Cary Coutant <ccoutant@google.com>
1761 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1762 (Target_x86_64::Relocate::relocate_tls): Replace check for
1763 saw_tls_block_reloc_ with test for executable section.
1765 2010-09-12 Cary Coutant <ccoutant@google.com>
1767 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1768 position-independent executables to shared libraries need dynamic
1770 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1771 position-independent executables.
1772 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1773 * testsuite/Makefile.in: Regenerate.
1775 2010-09-10 Nick Clifton <nickc@redhat.com>
1778 * testsuite/memory_test.t: Discard any sections that are not
1781 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1784 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1785 "This::" to work around a bug in gcc 4.2.
1787 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1789 2010-09-09 Rafael Espindola <espindola@google.com>
1791 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1792 sections with different PF_X flags in the same segment.
1793 (Layout::find_first_load_seg): Search all segments to find the first
1795 * options.h (rosegment): New.
1797 2010-09-08 Rafael Espindola <espindola@google.com>
1799 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1801 2010-09-08 Doug Kwan <dougkwan@google.com>
1803 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1804 (Arm_relobj::do_relocate_sections): Add new parameter for output
1805 file to match the parent.
1806 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1807 of local symbols instead of input values. Update code to track
1808 changes in gold::relocate_section.
1809 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1810 (Sized_relobj::compute_final_local_value_internal): New methods.
1811 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1812 body into private version of Sized_relobj::compute_final_local_value.
1813 Call the inline method.
1814 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1815 merged symbol value if there is one.
1816 (Symbol_value::has_output_value): New method defintiion.
1817 (Sized_relobj::Compute_final_local_value_status): New enum type.
1818 (Sized_relobj::compute_final_local_value): New methods.
1819 (Sized_relobj::compute_final_local_value_internal): New methods.
1820 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1821 and arm_cortex_a8.sh.
1822 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1823 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1825 * Makefile.in: Regenerate.
1826 * testsuite/arm_bl_out_of_range.s: Update test.
1827 * testsuite/thumb_bl_out_of_range.s: Ditto.
1828 * testsuite/thumb_blx_out_of_range.s: Ditto.
1829 * testsuite/arm_branch_out_of_range.sh: New file.
1830 * testsuite/arm_cortex_a8.sh: Ditto.
1831 * testsuite/arm_cortex_a8_b.s: Ditto.
1832 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1833 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1834 * testsuite/arm_cortex_a8_bl.s: Ditto.
1835 * testsuite/arm_cortex_a8_blx.s: Ditto.
1836 * testsuite/arm_cortex_a8_local.s: Ditto.
1837 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1838 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1840 2010-09-08 Rafael Espindola <espindola@google.com>
1842 * Makefile.am (memory_test.stdout): Run readelf with -W.
1843 * Makefile.in: Regenerate.
1844 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1847 2010-09-08 Rafael Espindola <espindola@google.com>
1849 * script-sections.cc (Script_sections::add_memory_region): Convert
1850 field precision to int.
1851 * script.cc (script_set_section_region, script_set_section_region):
1852 Convert field precision to int.
1854 2010-09-08 Rafael Espindola <espindola@google.com>
1856 * arm.cc (do_finalize_sections): Create the __exidx_start and
1857 __exdix_end symbols even when the section is missing.
1859 2010-09-08 Nick Clifton <nickc@redhat.com>
1861 * README: Remove claim that MEMORY is not supported.
1862 * expression.cc (script_exp_function_origin)
1863 (script_exp_function_length): Move from here to ...
1864 * script.cc: ... here.
1865 (script_set_section_region, script_add_memory)
1866 (script_parse_memory_attr, script_include_directive): New
1868 * script-sections.cc
1869 (class Memory_region): New class.
1870 (class Output_section_definition): Add set_memory_region,
1871 set_section_vma, set_section_lma and get_section_name methods.
1872 (class Script_Sections): Add add_memory_region,
1873 find_memory_region, find_memory_region_origin,
1874 find_memory_region_length and set_memory_region methods.
1875 Have set_section_addresses method walk the list of set memory
1877 Extend the print methos to display memory regions.
1878 * script-sections.h: Add prototypes for new methods.
1879 Add enum for MEMORY region attributes.
1880 * yyscript.y: Add support for parsing MEMORY regions.
1881 * script-c.h: Add prototypes for new functions.
1882 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1883 * testsuite/Makefile.in: Regenerate.
1884 * testsuite/memory_test.sh: New script.
1885 * testsuite/memory_test.s: New assembler source file.
1886 * testsuite/memory_test.t: New linker script.
1888 2010-08-27 Doug Kwan <dougkwan@google.com>
1890 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1891 reference override an existing dynamic weak reference.
1892 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1893 * testsuite/Makefile.in: Regenerate.
1894 * testsuite/dyn_weak_ref.sh: New file.
1895 * testsuite/dyn_weak_ref_1.c: Ditto.
1896 * testsuite/dyn_weak_ref_2.c: Ditto.
1898 2010-08-27 Ian Lance Taylor <iant@google.com>
1900 * incremental.h (class Incremental_input_entry): Add virtual
1903 2010-08-27 Ian Lance Taylor <iant@google.com>
1905 * testsuite/start_lib_test_3.c: Mark t3 as used.
1907 2010-08-27 Nick Clifton <nickc@redhat.com>
1909 * options.cc (version_script): Fix small typo in previous
1912 2010-08-25 Nick Clifton <nickc@redhat.com>
1914 * archive.cc: Formatting fixes: Remove whitespace between
1915 typename and following asterisk. Remove whitespace between
1916 function name and opening parenthesis.
1917 * archive.h: Likewise.
1919 * attributes.cc: Likewise.
1920 * attributes.h: Likewise.
1921 * common.cc: Likewise.
1922 * copy-relocs.cc: Likewise.
1923 * dirsearch.h: Likewise.
1924 * dynobj.cc: Likewise.
1925 * ehframe.cc: Likewise.
1926 * ehframe.h: Likewise.
1927 * expression.cc: Likewise.
1928 * fileread.cc: Likewise.
1929 * fileread.h: Likewise.
1931 * gold-threads.cc: Likewise.
1932 * gold.cc: Likewise.
1933 * i386.cc: Likewise.
1935 * incremental-dump.cc: Likewise.
1936 * incremental.cc: Likewise.
1937 * layout.cc: Likewise.
1938 * layout.h: Likewise.
1939 * main.cc: Likewise.
1940 * merge.cc: Likewise.
1941 * merge.h: Likewise.
1942 * object.cc: Likewise.
1943 * object.h: Likewise.
1944 * options.cc: Likewise.
1945 * options.h: Likewise.
1946 * output.cc: Likewise.
1947 * output.h: Likewise.
1948 * plugin.cc: Likewise.
1949 * plugin.h: Likewise.
1950 * powerpc.cc: Likewise.
1951 * reloc.cc: Likewise.
1952 * script-c.h: Likewise.
1953 * script-sections.cc: Likewise.
1954 * script.cc: Likewise.
1955 * stringpool.cc: Likewise.
1956 * symtab.cc: Likewise.
1957 * symtab.h: Likewise.
1958 * target.cc: Likewise.
1959 * timer.cc: Likewise.
1960 * timer.h: Likewise.
1961 * version.cc: Likewise.
1962 * x86_64.cc: Likewise.
1964 2010-08-24 Nick Clifton <nickc@redhat.com>
1967 * layout.cc (segment_precedes): Sort segments by their physical
1968 addresses, if they have been set.
1970 2010-08-23 Cary Coutant <ccoutant@google.com>
1972 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1974 (Lib_group::include_member): Unlock object after deleting its
1976 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1979 2010-08-19 Neil Vachharajani <nvachhar@google.com>
1980 Cary Coutant <ccoutant@google.com>
1982 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1983 constructor, and set_blocker.
1984 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1986 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1987 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1988 * testsuite/Makefile.am (start_lib_test): New test case.
1989 * testsuite/Makefile.in: Regenerate.
1990 * testsuite/start_lib_test_main.c: New file.
1991 * testsuite/start_lib_test_1.c: New file.
1992 * testsuite/start_lib_test_2.c: New file.
1993 * testsuite/start_lib_test_3.c: New file.
1995 2010-08-19 Ian Lance Taylor <iant@google.com>
1997 * Makefile.in: Rebuild with automake 1.11.1.
1998 * aclocal.m4: Likewise.
1999 * testsuite/Makefile.in: Likewise.
2001 2010-08-19 Ian Lance Taylor <iant@google.com>
2004 * i386.cc (class Output_data_plt_i386): Update declarations.
2005 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2006 local_ifuncs_ fields.
2007 (Target_i386::do_plt_section_for_global): New function.
2008 (Target_i386::do_plt_section_for_local): New function.
2009 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2010 parameter; change all callers. Initialize global_ifuncs_ and
2011 local_ifuncs_. If doing a static link define __rel_iplt_start and
2013 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2014 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2015 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2017 (Target_i386::make_plt_section): New function, broken out of
2018 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2019 (Target_i386::make_plt_entry): Call make_plt_section.
2020 (Target_i386::make_local_ifunc_plt_entry): New function.
2021 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2022 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2023 R_386_IRELATIVE to switch.
2024 (Target_i386::Scan::global): Likewise.
2025 (Target_i386::Relocate::relocate): Likewise.
2026 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2028 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2029 (Target_x86_64::do_plt_section_for_global): New function.
2030 (Target_x86_64::do_plt_section_for_local): New function.
2031 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2032 parameter; change all callers. If doing a static link define
2033 __rela_iplt_start and __rela_iplt_end.
2034 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2035 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2036 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2038 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2039 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2041 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2042 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2043 R_X86_64_IRELATIVE to switch.
2044 (Target_x86_64::Scan::global): Likewise.
2045 (Target_x86_64::Relocate::relocate): Likewise.
2046 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2048 * target.h (class Target): Add plt_section_for_global and
2049 plt_section_for_local functions. Add do_plt_section_for_global
2050 and do_plt_section_for_local virtual functions.
2051 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2052 clarifying comments.
2053 (Symbol::use_plt_offset): Handle IFUNC symbol.
2054 * object.cc (Sized_relobj::Sized_relobj): Initialize
2056 (Sized_relobj::local_has_plt_offset): New function.
2057 (Sized_relobj::local_plt_offset): New function.
2058 (Sized_relobj::set_local_plt_offset): New function.
2059 (Sized_relobj::do_count): Handle IFUNC symbol.
2060 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2061 a bit away from input_shndx_ field. Add set_is_func_symbol and
2062 is_ifunc_symbol functions.
2063 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2064 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2065 local_plt_offsets_ field.
2066 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2067 * output.h (class Output_section_data): Add non-const
2068 output_section function.
2069 (class Output_data_got): Update declarations.
2070 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2071 Add use_plt_offset parameter to global and local constructors.
2072 Change all callers. Change local_sym_index_ field to 31 bits.
2073 Change GSYM_CODE and CONSTANT_CODE accordingly.
2074 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2075 doing a static link don't set sh_link field.
2076 (Output_data_got::Got_entry::write): Use PLT offset if
2078 (Output_data_got::add_global_plt): New function.
2079 (Output_data_got::add_local_plt): New function.
2080 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2081 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2082 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2083 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2084 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2086 * testsuite/ifunc-sel.h: New file.
2087 * testsuite/ifuncmain1.c: New file.
2088 * testsuite/ifuncmain1vis.c: New file.
2089 * testsuite/ifuncmod1.c: New file.
2090 * testsuite/ifuncdep2.c: New file.
2091 * testsuite/ifuncmain2.c: New file.
2092 * testsuite/ifuncmain3.c: New file.
2093 * testsuite/ifuncmod3.c: New file.
2094 * testsuite/ifuncmain4.c: New file.
2095 * testsuite/ifuncmain5.c: New file.
2096 * testsuite/ifuncmod5.c: New file.
2097 * testsuite/ifuncmain6pie.c: New file.
2098 * testsuite/ifuncmod6.c: New file.
2099 * testsuite/ifuncmain7.c: New file.
2100 * configure, testsuite/Makefile.in: Rebuild.
2102 2010-08-18 Ian Lance Taylor <iant@google.com>
2105 (Output_section_incremental_inputs::write_input_files): Add cast
2106 to avoid signed/unsigned comparison warning.
2107 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2109 2010-08-12 Cary Coutant <ccoutant@google.com>
2111 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2113 2010-08-13 Ian Lance Taylor <iant@google.com>
2115 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2117 2010-08-12 Cary Coutant <ccoutant@google.com>
2118 Doug Kwan <dougkwan@google.com>
2120 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2121 defintion overrides non-weak undef, remember that the original undef
2123 * symtab.cc (Symbol_table::sized_write_global): For undef without
2124 an original weak binding, set binding to global in output.
2125 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2126 * testsuite/Makefile.in: Regenerate.
2127 * testsuite/strong_ref_weak_def.sh: New file.
2128 * testsuite/strong_ref_weak_def_1.c: Ditto.
2129 * testsuite/strong_ref_weak_def_2.c: Ditto.
2131 2010-08-12 Cary Coutant <ccoutant@google.com>
2133 * testsuite/incremental_test.sh: Rewrite.
2134 * testsuite/incremental_test_1.c: Rewrite.
2135 * testsuite/incremental_test_2.c: Rewrite.
2137 2010-08-12 Cary Coutant <ccoutant@google.com>
2139 * arm.cc (Target_arm::got_size): Add const.
2140 (Target_arm::got_entry_count): New function.
2141 (Target_arm::plt_entry_count): New function.
2142 (Target_arm::first_plt_entry_offset): New function.
2143 (Target_arm::plt_entry_size): New function.
2144 (Output_data_plt_arm::entry_count): New function.
2145 (Output_data_plt_arm::first_plt_entry_offset): New function.
2146 (Output_data_plt_arm::get_plt_entry_size): New function.
2147 * i386.cc (Target_i386::got_size): Add const.
2148 (Target_i386::got_entry_count): New function.
2149 (Target_i386::plt_entry_count): New function.
2150 (Target_i386::first_plt_entry_offset): New function.
2151 (Target_i386::plt_entry_size): New function.
2152 (Output_data_plt_i386::entry_count): New function.
2153 (Output_data_plt_i386::first_plt_entry_offset): New function.
2154 (Output_data_plt_i386::get_plt_entry_size): New function.
2155 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2156 find_incremental_inputs_sections. Dump incremental_got_plt section.
2157 * incremental.cc: Include target.h.
2158 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2159 parameter. Adjust all callers. Find incremental_got_plt section.
2160 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2162 (Output_section_incremental_inputs::set_final_data_size): Calculate
2163 size of incremental_got_plt section.
2164 (Output_section_incremental_inputs::do_write): Write the
2165 incremental_got_plt section.
2166 (Got_plt_view_info): New struct.
2167 (Local_got_offset_visitor): New class.
2168 (Global_got_offset_visitor): New class.
2169 (Global_symbol_visitor_got_plt): New class.
2170 (Output_section_incremental_inputs::write_got_plt): New function.
2171 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2172 Add parameter. Adjust all callers.
2173 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2174 (Incremental_inputs::got_plt_section): New function.
2175 (Incremental_inputs::got_plt_section_): New data member.
2176 (Incremental_got_plt_reader): New class.
2177 * layout.cc (Layout::create_incremental_info_sections): Add the
2178 incremental_got_plt section.
2179 * object.h (Got_offset_list::get_list): New function.
2180 (Got offset_list::for_all_got_offsets): New function.
2181 (Sized_relobj::local_got_offset_list): New function.
2182 * powerpc.cc (Target_powerpc::got_size): Add const.
2183 (Target_powerpc::got_entry_count): New function.
2184 (Target_powerpc::plt_entry_count): New function.
2185 (Target_powerpc::first_plt_entry_offset): New function.
2186 (Target_powerpc::plt_entry_size): New function.
2187 (Output_data_plt_powerpc::entry_count): New function.
2188 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2189 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2190 * sparc.cc (Target_sparc::got_size): Add const.
2191 (Target_sparc::got_entry_count): New function.
2192 (Target_sparc::plt_entry_count): New function.
2193 (Target_sparc::first_plt_entry_offset): New function.
2194 (Target_sparc::plt_entry_size): New function.
2195 (Output_data_plt_sparc::entry_count): New function.
2196 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2197 (Output_data_plt_sparc::get_plt_entry_size): New function.
2198 * symtab.h (Symbol::got_offset_list): New function.
2199 (Symbol_table::for_all_symbols): New function.
2200 * target.h (Sized_target::got_entry_count): New function.
2201 (Sized_target::plt_entry_count): New function.
2202 (Sized_target::plt_entry_size): New function.
2203 * x86_64.cc (Target_x86_64::got_size): Add const.
2204 (Target_x86_64::got_entry_count): New function.
2205 (Target_x86_64::plt_entry_count): New function.
2206 (Target_x86_64::first_plt_entry_offset): New function.
2207 (Target_x86_64::plt_entry_size): New function.
2208 (Output_data_plt_x86_64::entry_count): New function.
2209 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2210 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2212 2010-08-12 Cary Coutant <ccoutant@google.com>
2214 * archive.cc: Include incremental.h.
2215 (Archive::Archive): Initialize incremental_info_.
2216 (Archive::include_member): Record archive members in incremental info.
2217 (Add_archive_symbols::run): Record begin and end of an archive in
2219 (Lib_group::include_member): Record objects in incremental info.
2220 * archive.h (Incremental_archive_entry): Forward declaration.
2221 (Archive::set_incremental_info): New member function.
2222 (Archive::incremental_info): New member function.
2223 (Archive::Unused_symbol_iterator): New class.
2224 (Archive::unused_symbols_begin): New member function.
2225 (Archive::unused_symbols_end): New member function.
2226 (Archive::incremental_info_): New data member.
2227 * incremental-dump.cc (find_input_containing_global): New function.
2228 (dump_incremental_inputs): Dump new incremental info sections.
2229 * incremental.cc: Include symtab.h.
2230 (Output_section_incremental_inputs): New class.
2231 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2232 new incremental info sections.
2233 (Sized_incremental_binary::do_check_inputs): Likewise.
2234 (Incremental_inputs::report_archive): Remove.
2235 (Incremental_inputs::report_archive_begin): New function.
2236 (Incremental_inputs::report_archive_end): New function.
2237 (Incremental_inputs::report_object): New function.
2238 (Incremental_inputs::finalize_inputs): Remove.
2239 (Incremental_inputs::report_input_section): New function.
2240 (Incremental_inputs::report_script): Rewrite.
2241 (Incremental_inputs::finalize): Do nothing but finalize string table.
2242 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2243 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2244 (Incremental_inputs::create_data_sections): New function.
2245 (Incremental_inputs::relocs_entsize): New function.
2246 (Output_section_incremental_inputs::set_final_data_size): New function.
2247 (Output_section_incremental_inputs::do_write): New function.
2248 (Output_section_incremental_inputs::write_header): New function.
2249 (Output_section_incremental_inputs::write_input_files): New function.
2250 (Output_section_incremental_inputs::write_info_blocks): New function.
2251 (Output_section_incremental_inputs::write_symtab): New function.
2252 * incremental.h (Incremental_script_entry): Forward declaration.
2253 (Incremental_object_entry): Forward declaration.
2254 (Incremental_archive_entry): Forward declaration.
2255 (Incremental_inputs): Forward declaration.
2256 (Incremental_inputs_header_data): Remove.
2257 (Incremental_inputs_header): Remove.
2258 (Incremental_inputs_header_write): Remove.
2259 (Incremental_inputs_entry_data): Remove.
2260 (Incremental_inputs_entry): Remove.
2261 (Incremental_inputs_entry_write): Remove.
2262 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2263 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2264 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2265 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2267 (Incremental_input_entry): New class.
2268 (Incremental_script_entry): New class.
2269 (Incremental_object_entry): New class.
2270 (Incremental_archive_entry): New class.
2271 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2272 (Incremental_inputs::report_inputs): Remove.
2273 (Incremental_inputs::report_archive): Remove.
2274 (Incremental_inputs::report_archive_begin): New function.
2275 (Incremental_inputs::report_archive_end): New function.
2276 (Incremental_inputs::report_object): Change prototype.
2277 (Incremental_inputs::report_input_section): New function.
2278 (Incremental_inputs::report_script): Change prototype.
2279 (Incremental_inputs::get_reloc_count): New function.
2280 (Incremental_inputs::set_reloc_count): New function.
2281 (Incremental_inputs::create_data_sections): New function.
2282 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2283 (Incremental_inputs::inputs_section): New function.
2284 (Incremental_inputs::symtab_section): New function.
2285 (Incremental_inputs::relocs_section): New function.
2286 (Incremental_inputs::get_stringpool): Add const.
2287 (Incremental_inputs::command_line): Add const.
2288 (Incremental_inputs::inputs): Remove.
2289 (Incremental_inputs::command_line_key): New function.
2290 (Incremental_inputs::input_file_count): New function.
2291 (Incremental_inputs::input_files): New function.
2292 (Incremental_inputs::relocs_entsize): New function.
2293 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2294 (Incremental_inputs::finalize_inputs): Remove.
2295 (Incremental_inputs::Input_info): Remove.
2296 (Incremental_inputs::lock_): Remove.
2297 (Incremental_inputs::inputs_): Change type.
2298 (Incremental_inputs::inputs_map_): Remove.
2299 (Incremental_inputs::current_object_entry_): New data member.
2300 (Incremental_inputs::inputs_section_): New data member.
2301 (Incremental_inputs::symtab_section_): New data member.
2302 (Incremental_inputs::relocs_section_): New data member.
2303 (Incremental_inputs::reloc_count_): New data member.
2304 (Incremental_inputs_reader): New class.
2305 (Incremental_symtab_reader): New class.
2306 (Incremental_relocs_reader): New class.
2307 * layout.cc (Layout::finalize): Move finalization of incremental info
2308 and creation of incremental info sections to follow finalization of
2309 symbol table. Set offsets for postprocessing sections.
2310 (Layout::create_incremental_info_sections): Call
2311 Incremental_inputs::create_data_sections. Add incremental symtab
2312 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2313 sections to layout after input sections.
2314 * layout.h (struct Timespec): Forward declaration.
2315 (Layout::incremental_inputs): Add const.
2316 (Layout::create_incremental_info_sections): Add parameter.
2317 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2318 * object.cc: Include incremental.h.
2319 (Relobj::finalize_incremental_relocs): New function.
2320 (Sized_relobj::do_layout): Record input sections in incremental info.
2321 * object.h (Object::output_section): New function.
2322 (Object::output_section_offset): Moved from Relobj.
2323 (Object::get_incremental_reloc_base): New function.
2324 (Object::get_incremental_reloc_count): New function.
2325 (Object::do_output_section): New function.
2326 (Object::do_output_section_offset): Moved from Relobj.
2327 (Object::do_get_incremental_reloc_base): New function.
2328 (Object::do_get_incremental_reloc_count): New function.
2329 (Object::Object): Initialize new data members.
2330 (Relobj::output_section): Renamed do_output_section and moved to
2332 (Relobj::output_section_offset): Moved to Object.
2333 (Relobj::do_get_incremental_reloc_base): New function.
2334 (Relobj::do_get_incremental_reloc_count): New function.
2335 (Relobj::allocate_incremental_reloc_counts): New function.
2336 (Relobj::count_incremental_reloc): New function.
2337 (Relobj::finalize_incremental_relocs): New function.
2338 (Relobj::next_incremental_reloc_index): New function.
2339 (Relobj::reloc_counts_): New data member.
2340 (Relobj::reloc_bases_): New data member.
2341 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2342 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2343 (Sized_relobj::incremental_relocs_scan): New function.
2344 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2345 (Sized_relobj::incremental_relocs_write): New function.
2346 (Sized_relobj::incremental_relocs_write_reltype): New function.
2347 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2349 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2350 archives and object files elsewhere.
2351 (Add_symbols::run): Report object files here.
2352 (Finish_group::run): Report end of archive at end of group.
2353 * reloc.cc: Include layout.h, incremental.h.
2354 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2355 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2356 (Sized_relobj::incremental_relocs_scan): New function.
2357 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2358 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2359 (Sized_relobj::incremental_relocs_write): New function.
2360 (Sized_relobj::incremental_relocs_write_reltype): New function.
2361 * script.cc (read_input_script): Rewrite test for incremental link.
2362 Change call to Incremental_inputs::report_script.
2363 * symtab.h (Symbol_table::first_global_index): New function.
2364 (Symbol_table::output_count): New function.
2366 2010-08-12 Doug Kwan <dougkwan@google.com>
2368 * arm.cc (Target_arm::merge_object_attributes): Check command line
2369 options --no-wchar-size-warning and --no-enum-size-warning.
2370 * options.h (General_options): Add ld-compatible options
2371 --no-enum-size-warning and --no-wchar-size-warning.
2373 2010-08-04 Ian Lance Taylor <iant@google.com>
2375 * x86_64.cc (Target_x86_64::Scan::local): Use
2376 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2377 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2378 (Target_x86_64::Scan::global): Likewise.
2379 (Target_x86_64::Relocate::relocate): Likewise.
2380 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2383 2010-08-03 Cary Coutant <ccoutant@google.com>
2385 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2386 to reserve space in merged_strings vector. Keep total input size
2388 (Output_merge_string::do_print_merge_stats): Print total input size.
2389 * merge.h (Output_merge_string): Add input_size_ field.
2390 * stringpool.cc (Stringpool_template::string_length): Move
2391 implementations out of Stringpool_template class and place in
2393 * stringpool.h (string_length): Move out of Stringpool_template.
2395 2010-08-03 Ian Lance Taylor <iant@google.com>
2398 * layout.cc (relaxation_loop_body): If address of load segment is
2399 set, adjust address to include headers if possible.
2401 2010-08-03 Ian Lance Taylor <iant@google.com>
2403 * version.cc (version_string): Bump to 1.10.
2405 2010-08-03 Ian Lance Taylor <iant@google.com>
2408 * layout.h (enum Output_section_order): Define.
2409 (class Layout): Update declarations.
2410 * layout.cc (Layout::get_output_section): Add order parameter.
2411 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2412 is_first_non_relro parameters. Change all callers.
2413 (Layout::choose_output_section): Likewise.
2414 (Layout::add_output_section_data): Likewise.
2415 (Layout::make_output_section): Likewise. Set order.
2416 (Layout::default_section_order): New function.
2417 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2418 * output.cc (Output_section::Output_section): Initialize order_.
2419 Don't initialize deleted fields.
2420 (Output_segment::Output_segment): Don't initialize deleted
2422 (Output_segment::add_output_section_to_load): New function
2423 replacing add_output_section. Change all callers to call this or
2424 add_output_section_to_nonload.
2425 (Output_segment::add_output_section_to_nonload): New function.
2426 (Output_segment::remove_output_section): Rewrite.
2427 (Output_segment::add_initial_output_data): Likewise.
2428 (Output_segment::has_any_data_sections): Likewise.
2429 (Output_segment::is_first_section_relro): Likewise.
2430 (Output_segment::maximum_alignment): Likewise.
2431 (Output_segment::has_dynamic_reloc): New function replacing
2432 dynamic_reloc_count. Change all callers.
2433 (Output_segment::has_dynamic_reloc_list): New function replacing
2434 dynamic_reloc_count_list. Change all callers.
2435 (Output_segment::set_section_addresses): Rewrite.
2436 (Output_segment::set_offset): Rewrite.
2437 (Output_segment::find_first_and_last_list): Remove.
2438 (Output_segment::set_tls_offsets): Rewrite.
2439 (Output_segment::first_section_load_address): Likewise.
2440 (Output_segment::output_section_count): Likewise.
2441 (Output_segment::section_with_lowest_load_address): Likewise.
2442 (Output_segment::write_section_headers): Likewise.
2443 (Output_segment::print_sections_to_map): Likewise.
2444 * output.h (class Output_data): Remove dynamic_reloc_count_
2445 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2446 (Output_data::add_dynamic_reloc): Rewrite.
2447 (Output_data::has_dynamic_reloc): New function.
2448 (Output_data::dynamic_reloc_count): Remove.
2449 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2450 is_last_relro_, is_first_non_relro_, is_interp_,
2451 is_dynamic_linker_section_ fields. Add order and set_order
2452 functions. Remove is_relro_local, set_is_relro_local,
2453 is_last_relro, set_is_last_relro, is_first_non_relro,
2454 set_is_first_non_relro functions, is_interp, set_is_interp,
2455 is_dynamic_linker_section, and set_is_dynamic_linker_section
2457 (class Output_segment): Change Output_data_list from std::list to
2458 std:;vector. Add output_lists_ field. Remove output_data_ and
2459 output_bss_ fields. Update declarations.
2461 2010-08-02 Ian Lance Taylor <iant@google.com>
2463 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2464 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2465 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2467 2010-08-02 Ian Lance Taylor <iant@google.com>
2470 * script.cc (Script_options::Script_options): Initialize
2471 symbol_definitions_ and symbol_references_.
2472 (Script_options::add_symbol_assignment): Update
2473 symbol_definitions_ and symbol_references_.
2474 (Script_options::add_symbol_reference): New function.
2475 (script_symbol): New function.
2476 * script.h (class Script_options): Add symbol_definitions_ and
2477 symbol_references_ fields.
2478 (Script_options::referenced_const_iterator): New type.
2479 (Script_options::referenced_begin): New function.
2480 (Script_options::referenced_end): New function.
2481 (Script_options::is_referenced): New function.
2482 (Script_options::any_unreferenced): New function.
2483 * script-c.h (script_symbol): Declare.
2484 * yyscript.y (exp): Call script_symbol.
2485 * symtab.cc: Include "script.h".
2486 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2487 Change all callers. Check symbols referenced by scripts.
2488 (Symbol_table::add_undefined_symbols_from_command_line): Add
2489 layout parameter. Change all callers.
2490 (Symbol_table::do_add_undefined_symbols_from_command_line):
2491 Likewise. Break out loop body. Check symbols referenced by
2493 (Symbol_table::add_undefined_symbol_from_command_line): New
2494 function broken out of
2495 do_add_undefined_symbols_from_command_line.
2496 * symtab.h (class Symbol_table): Update declarations.
2497 * archive.cc: Include "layout.h".
2498 (Archive::should_include_member): Add layout parameter. Change
2499 all callers. Check for symbol mentioned in expression.
2500 * archive.h (class Archive): Update declaration.
2501 * object.cc (Sized_relobj::do_should_include_member): Add layout
2503 * object.h (Object::should_include_member): Add layout parameter.
2505 (Object::do_should_include_member): Add layout parameter.
2506 (class Sized_relobj): Update declaration.
2507 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2509 * dynobj.h (class Sized_dynobj): Update declaration.
2510 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2512 * plugin.h (class Sized_pluginobj): Update declaration.
2514 2010-08-02 Ian Lance Taylor <iant@google.com>
2517 * output.cc (Output_segment::set_offset): Search for the first and
2518 last sections rather than assuming that the list is in order.
2519 (Output_segment::find_first_and_last_list): New function.
2520 * output.h (class Output_segment): Update declarations.
2521 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2522 (relro_strip_test_SOURCES): New variable.
2523 (relro_strip_test_DEPENDENCIES): New variable.
2524 (relro_strip_test_LDFLAGS): New variable.
2525 (relro_strip_test_LDADD): New variable.
2526 (relro_strip_test.so): New target.
2528 2010-08-02 Ian Lance Taylor <iant@google.com>
2530 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2531 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2532 (Target_i386::got_tlsdesc_section): New function.
2533 (Target_i386::got_section): Create space for GOT entries for
2534 TLSDESC relocations.
2535 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2537 (Target_i386::Scan::global): Likewise.
2538 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2540 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2541 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2542 (Target_x86_64::got_tlsdesc_section): New function.
2543 (Target_x86_64::got_section): Create space for GOT entries for
2544 TLSDESC relocations.
2545 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2547 (Target_x86_64::Scan::global): Likewise.
2548 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2551 2010-08-02 Ian Lance Taylor <iant@google.com>
2553 * testsuite/final_layout.sh: Use dc to convert from hex to
2556 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2558 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2559 paramter to the call to gold::gc_process_relocs.
2560 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2561 paramter to the call to gold::gc_process_relocs.
2562 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2563 parameter to the call to gold::gc_process_relocs.
2564 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2565 template parameter to the call to gold::gc_process_relocs.
2566 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2567 paramter to the call to gold::gc_process_relocs.
2568 * gc.h (get_embedded_addend_size): New function.
2569 (gc_process_relocs): Save the size of the reloc for use by ICF.
2570 * icf.cc (get_section_contents): Get the addend from the text section
2571 for SHT_REL relocation sections.
2572 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2573 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2574 * int_encoding.h (read_from_pointer): New overloaded function.
2575 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2576 * testsuite/icf_sht_rel_addend_test.sh: New file.
2577 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2578 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2580 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2582 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2583 * Makefile.in: Regenerate.
2584 * testsuite/Makefile.in: Regenerate.
2586 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2588 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2589 * gold/testsuite/debug_msg.cc: Likewise.
2590 * gold/testsuite/odr_violation1.cc
2591 * gold/testsuite/odr_violation2.cc
2593 2010-07-21 Cary Coutant <ccoutant@google.com>
2595 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2596 string, and length fields.
2597 (Output_merge_string::Merged_strings_list): New type.
2598 (Output_merge_string::Merged_strings_lists): New typedef.
2599 (Output_merge_string): Replace merged_strings_ with
2600 merged_strings_lists_.
2601 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2602 Merged_strings_list per input object and section. Don't store pointer
2603 to the string. Don't store length with each merged string entry.
2604 (Output_merge_string::finalize_merged_data): Loop over list of merged
2605 strings lists. Recompute length of each merged string.
2607 2010-07-15 Cary Coutant <ccoutant@google.com>
2609 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2612 2010-07-14 Ian Lance Taylor <iant@google.com>
2614 * descriptors.cc (Descriptors::open): Report correct name in error
2617 2010-07-13 Doug Kwan <dougkwan@google.com>
2619 * arm.cc (Arm_input_section::Arm_input_section): For a
2620 SHT_ARM_EXIDX section, always keeps the input sections.
2621 (Arm_input_section::set_exidx_section_link): New method.
2622 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2623 has_errors_ to false.
2624 (Arm_exidx_input_section::has_errors,
2625 Arm_exidx_input_section::set_has_errors): New methods.
2626 (Arm_exidx_input_section::has_errors_): New data member.
2627 (Arm_relobj::get_exidx_shndx_list): New method.
2628 (Arm_output_section::append_text_sections_to_list): Do not skip
2629 section without SHF_EXECINSTR.
2630 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2632 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2633 section header. Make error messages more verbose. Check for
2634 a non-executable section linked to an EXIDX section.
2635 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2636 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2637 check that there is no deferred EXIDX section if we exit early.
2638 Instead of not making an EXIDX section in case of an error, make one
2639 and set the has_errors flag of it.
2640 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2641 in a relocatable link.
2642 (Target_arm::do_relax): Look for the EXIDX output section instead of
2643 assuming that it is called .ARM.exidx.
2644 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2645 section list. Do not check for SHF_EXECINSTR section flags but
2646 skip any input section with errors.
2647 * output.cc (Output_section::Output_section): Initialize
2648 always_keeps_input_sections_ to false.
2649 (Output_section::add_input_section): Check for
2650 always_keeps_input_sections_.
2651 * output.h (Output_section::always_keeps_input_sections,
2652 Output_section::set_always_keeps_input_sections): New methods.
2653 (Output_section::always_keeps_input_sections): New data member.
2655 2010-07-13 Rafael Espindola <espindola@google.com>
2657 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2658 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2660 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2661 Ian Lance Taylor <iant@google.com>
2663 * output.h (Output_section_lookup_maps::add_merge_section):
2664 Correct check of whether value was inserted.
2665 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2666 (Output_section_lookup_maps::add_relaxed_input_section):
2668 * arm.cc (Target_arm::got_section): Remove used local os.
2669 * i386.cc (Target_i386::got_section): Likewise.
2670 * x86_64.cc (Target_x86_64::got_section): Likewise.
2671 * sparc.cc (Target_sparc::got_section): Likewise.
2672 (Target_sparc::relocate): Remove unused local have_got_offset.
2673 * powerpc.cc (Target_powerpc::relocate): Likewise.
2675 2010-07-13 Ian Lance Taylor <iant@google.com>
2677 * compressed_output.cc (zlib_decompress): Fix signature in
2680 * archive.cc (Archive::include_member): Unlock an external member
2681 of a thin archive. Don't bother to delete an object we know is
2684 2010-07-12 Cary Coutant <ccoutant@google.com>
2686 * compressed_output.cc (zlib_decompress): New function.
2687 (get_uncompressed_size): New function.
2688 (decompress_input_section): New function.
2689 * compressed_output.h (get_uncompressed_size): New function.
2690 (decompress_input_section): New function.
2691 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2692 Handle compressed debug sections.
2693 * layout.cc (is_compressed_debug_section): New function.
2694 (Layout::output_section_name): Map compressed section names to
2696 * layout.h (is_compressed_debug_section): New function.
2697 (is_debug_info_section): Recognize compressed debug sections.
2698 * merge.cc: Include compressed_output.h.
2699 (Output_merge_data::do_add_input_section): Handle compressed
2701 (Output_merge_string::do_add_input_section): Handle compressed
2703 * object.cc: Include compressed_output.h.
2704 (Sized_relobj::Sized_relobj): Initialize new data members.
2705 (build_compressed_section_map): New function.
2706 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2707 * object.h (Object::section_is_compressed): New method.
2708 (Object::do_section_is_compressed): New method.
2709 (Sized_relobj::Compressed_section_map): New type.
2710 (Sized_relobj::do_section_is_compressed): New method.
2711 (Sized_relobj::compressed_sections_): New data member.
2712 * output.cc (Output_section::add_input_section): Handle compressed
2714 * reloc.cc: Include compressed_output.h.
2715 (Sized_relobj::write_sections): Handle compressed debug sections.
2717 2010-07-08 Cary Coutant <ccoutant@google.com>
2719 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2720 weak when resolving to a dynamic def.
2721 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2722 for weak undef/dynamic def cases. Adjust callers.
2723 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2724 undef_binding_weak_.
2725 (Symbol_table::sized_write_globals): Adjust symbol binding.
2726 (Symbol_table::sized_write_symbol): Add binding parameter.
2727 * symtab.h (Symbol::set_undef_binding): New method.
2728 (Symbol::is_undef_binding_weak): New method.
2729 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2730 (Symbol_table::should_override): Add new parameter.
2731 (Symbol_table::sized_write_symbol): Add new parameter.
2733 * testsuite/weak_undef_file1.cc: Add new test case.
2734 * testsuite/weak_undef_file2.cc: Fix header comment.
2735 * testsuite/weak_undef_test.cc: Add new test case.
2737 2010-06-29 Doug Kwan <dougkwan@google.com>
2739 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2740 Initialize USE_SYMBOL_.
2741 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2743 (Arm_reloc_property::uses_symbol_): New data member declaration.
2744 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2745 uses symbol value and symbol is undefined but not weakly undefined.
2747 2010-06-28 Rafael Espindola <espindola@google.com>
2749 * plugin.cc (Plugin::load): Use dlerror.
2751 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2753 * symtab.cc (detect_odr_violations): When reporting an ODR
2754 violation, report an object where the symbol is defined.
2756 2010-06-25 Doug Kwan <dougkwan@google.com>
2758 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2759 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2761 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2762 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2763 target hook to detect function points.
2764 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2765 * icf.h (Icf::check_section_for_function_pointers): Change type of
2766 parameter SECTION_NAME to const reference to std::string. Use
2767 target hook to determine if section may have unsafe pointers.
2768 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2771 2010-06-21 Rafael Espindola <espindola@google.com>
2773 * fileread.cc (Input_file::find_fie): New
2774 (Input_file::open): Use Input_file::find_fie.
2775 * fileread.h (Input_file::find_fie): New
2776 * plugin.cc (set_extra_library_path): New.
2777 (Plugin::load): Add set_extra_library_path to the transfer vector.
2778 (Plugin_manager::set_extra_library_path): New.
2779 (Plugin_manager::add_input_file): Use the extra search path if set.
2780 (set_extra_library_path(): New.
2781 * plugin.h (Plugin_manager): Add set_extra_library_path and
2784 2010-06-19 Cary Coutant <ccoutant@google.com>
2786 * layout.cc (gdb_sections): Add .debug_types.
2787 (lines_only_debug_sections): Likewise.
2789 2010-06-18 Rafael Espindola <espindola@google.com>
2791 * plugin.cc (add_input_file,add_input_library)
2792 (Plugin_manager::add_input_file): Make filename arguments const.
2793 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2796 2010-06-16 Doug Kwan <dougkwan@google.com>
2798 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2799 .ARM.attributes section if we have not merged any input
2800 attributes sections.
2802 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2804 * arm.cc: Allow combining objects with no EABI version
2807 2010-06-15 Rafael Espindola <espindola@google.com>
2809 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2811 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2813 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2814 (struct iovec): Correct !HAVE_READV definition.
2816 2010-06-10 Cary Coutant <ccoutant@google.com>
2818 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2819 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2821 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2824 * symtab.h (Symbol::is_placeholder): New member function.
2825 * target-reloc.h (relocate_section): Check for placeholder symbols.
2827 * testsuite/Makefile.am (plugin_test_8): New test.
2828 (plugin_test_9): New test.
2829 * testsuite/Makefile.in: Regenerate.
2831 2010-06-09 Nick Clifton <nickc@redhat.com>
2833 * yyscript.y (input_list_element): Allow strings prefixed with
2834 the '-' character. Treat these as libraries.
2835 * script.cc (script_add_library): New function. Adds a library
2836 specified by "-l<name>" found in an input script.
2837 * script-c.h: Add prototype for script_add_library.
2839 2010-06-07 Doug Kwan <dougkwan@google.com>
2841 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2842 Restrict stub-group size to be within long conditional branch
2843 range when working around cortex-A8 erratum.
2845 2010-06-07 Damien Diederen <dd@crosstwine.com>
2847 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2850 2010-06-03 Sriraman Tallam <tmsriram@google.com>
2854 (Output_section::Input_section_sort_entry::compare_section_ordering):
2855 Change to return non-zero correctly.
2856 (Output_section::Input_section_sort_section_order_index_compare
2857 ::operator()): Change to fix ambiguity in comparisons.
2859 2010-06-01 Sriraman Tallam <tmsriram@google.com>
2861 * gold.h (is_wildcard_string): New function.
2862 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2863 (Layout::layout_eh_frame): Ditto.
2864 (Layout::find_section_order_index): New method.
2865 (Layout::read_layout_from_file): New method.
2866 * layout.h (Layout::find_section_order_index): New method.
2867 (Layout::read_layout_from_file): New method.
2868 (Layout::input_section_position_): New private member.
2869 (Layout::input_section_glob_): New private member.
2870 * main.cc (main): Call read_layout_from_file here.
2871 * options.h (--section-ordering-file): New option.
2872 * output.cc (Output_section::input_section_order_specified_): New
2874 (Output_section::Output_section): Initialize new member.
2875 (Output_section::add_input_section): Add new parameter.
2876 Keep input sections when --section-ordering-file is used.
2877 (Output_section::set_final_data_size): Sort input sections when
2878 section ordering file is specified.
2879 (Output_section::Input_section_sort_entry): Add new parameter.
2881 (Output_section::Input_section_sort_entry::compare_section_ordering):
2883 (Output_section::Input_section_sort_compare::operator()): Change to
2884 consider section_order_index.
2885 (Output_section::Input_section_sort_init_fini_compare::operator()):
2886 Change to consider section_order_index.
2887 (Output_section::Input_section_sort_section_order_index_compare
2888 ::operator()): New method.
2889 (Output_section::sort_attached_input_sections): Change to sort
2890 according to section order when specified.
2891 (Output_section::add_input_section<32, true>): Add new parameter.
2892 (Output_section::add_input_section<64, true>): Add new parameter.
2893 (Output_section::add_input_section<32, false>): Add new parameter.
2894 (Output_section::add_input_section<64, false>): Add new parameter.
2895 * output.h (Output_section::add_input_section): Add new parameter.
2896 (Output_section::input_section_order_specified): New
2898 (Output_section::set_input_section_order_specified): New method.
2899 (Input_section::Input_section): Initialize section_order_index_.
2900 (Input_section::section_order_index): New method.
2901 (Input_section::set_section_order_index): New method.
2902 (Input_section::section_order_index_): New member.
2903 (Input_section::Input_section_sort_section_order_index_compare): New
2905 (Output_section::input_section_order_specified_): New member.
2906 * script-sections.cc (is_wildcard_string): Delete and move modified
2908 (Output_section_element_input::Output_section_element_input): Modify
2909 call to is_wildcard_string.
2910 (Output_section_element_input::Input_section_pattern
2911 ::Input_section_pattern): Ditto.
2912 (Output_section_element_input::Output_section_element_input): Ditto.
2913 * testsuite/Makefile.am (final_layout): New test case.
2914 * testsuite/Makefile.in: Regenerate.
2915 * testsuite/final_layout.cc: New file.
2916 * testsuite/final_layout.sh: New file.
2918 2010-06-01 Rafael Espindola <espindola@google.com>
2920 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2922 2010-06-01 Rafael Espindola <espindola@google.com>
2924 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2925 visibility of symbols.
2927 2010-05-27 Doug Kwan <dougkwan@google.com>
2929 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2930 from start of output section instead of address for a local symbol
2931 in a merged or relaxed section when doing a relocatable link.
2933 2010-05-26 Rafael Espindola <espindola@google.com>
2936 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2937 adding sections the garbage collector removed.
2938 * gold/testsuite/Makefile.am: Add test.
2939 * gold/testsuite/Makefile.in: Regenerate.
2940 * gold/testsuite/plugin_test_7.sh: New.
2941 * gold/testsuite/plugin_test_7_1.c: New.
2942 * gold/testsuite/plugin_test_7_2.c: New.
2944 2010-05-26 Rafael Espindola <espindola@google.com>
2946 * script-sections.cc (Output_section_definition::set_section_addresses):
2947 Check for --section-start.
2949 2010-05-26 Doug Kwan <dougkwan@google.com>
2951 * arm.cc (Arm_scan_relocatable_relocs): New class.
2952 (Target_arm::relocate_special_relocatable): New method.
2953 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2954 (Arm_relocate_functions::thumb_branch_common): Same.
2955 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2956 instead of Default_scan_relocatable_relocs.
2957 * target-reloc.h (relocate_for_relocatable): Let target handle
2958 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2959 * target.h (Sized_target::relocate_special_relocatable): New method.
2961 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2963 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2965 2010-05-23 Doug Kwan <dougkwan@google.com>
2967 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2969 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2970 with a direct branch, not a conditional branch, to a stub.
2971 * merge.cc (Output_merge_base::record_input_section): New method
2973 (Output_merge_data::do_add_input_section): Record input section if
2974 keeps-input-sections flag is set.
2975 (Output_merge_string::do_add_input_section): Ditto.
2976 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2977 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2979 (Output_merge_base::keeps_input_sections,
2980 Output_merge_base::set_keeps_input_sections,
2981 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2983 (Output_merge_base::Input_sections): New type declaration.
2984 (Output_merge_base::input_sections_begin,
2985 Output_merge_base::input_sections_end,
2986 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2987 (Output_merge_base::bool keeps_input_sections_,
2988 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2989 Output_merge_base::input_sections_): New data members.
2990 (Output_merge_data::do_set_keeps_input_sections): New method
2992 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2993 * output.cc (Output_section::Input_section::relobj): Move method
2994 defintion from class declaration to here and handle merge sections.
2995 (Output_section::Input_section::shndx): Ditto.
2996 (Output_section::Output_section): Remove initializations of removed
2997 data members and initialize new data member LOOKUP_MAPS_.
2998 (Output_section::add_input_section): Set keeps-input-sections flag
2999 for a newly created merge output section as appropriate. Adjust code
3000 to use Output_section_lookup_maps class.
3001 (Output_section::add_relaxed_input_section): Adjst code for lookup
3002 maps code refactoring.
3003 (Output_section::add_merge_input_section): Add a new parameter
3004 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3005 class. If adding input section to a newly created merge output
3006 section fails, remove the new merge section.
3007 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3008 Adjust code for use of the Output_section_lookup_maps class.
3009 (Output_section::find_merge_section): Ditto.
3010 (Output_section::build_lookup_maps): New method defintion.
3011 (Output_section::find_relaxed_input_section): Adjust code to use
3012 Output_section_lookup_maps class.
3013 (Output_section::get_input_sections): Export merge sections. Adjust
3014 code to use Output_section_lookup_maps class.
3015 (Output_section:::add_script_input_section): Adjust code to use
3016 Output_section_lookup_maps class. Update lookup maps for merge
3018 (Output_section::discard_states): Use Output_section_lookup_maps.
3019 (Output_section::restore_states): Same.
3020 * output.h (Merge_section_properties): Move class defintion out of
3022 (Output_section_lookup_maps): New class.
3023 (Output_section::Input_section::is_merge_section): New method
3025 (Output_section::Input_section::relobj): Move defintion out of class
3026 defintion. Declare method only.
3027 (Output_section::Input_section::shndx): Ditto.
3028 (Output_section::Input_section::output_merge_base): New method defintion.
3029 (Output_section::Input_section::u2_.pomb): New union field.
3030 (Output_section::Merge_section_by_properties_map,
3031 Output_section::Output_section_data_by_input_section_map,
3032 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3034 (Output_section::add_merge_input_section): Add new parameter
3035 KEEPS_INPUT_SECTIONS.
3036 (Output_section::build_lookup_maps): New method declaration.
3037 (Output_section::merge_section_map_,
3038 Output_section::merge_section_by_properties_map_,
3039 Output_section::relaxed_input_section_map_,
3040 Output_section::is_relaxed_input_section_map_valid_): Remove data
3042 (Output_section::lookup_maps_): New data member.
3044 2010-05-21 Doug Kwan <dougkwan@google.com>
3047 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3048 avoid a compilation error.
3050 2010-05-19 Rafael Espindola <espindola@google.com>
3052 * script-sections.cc (Output_section_definition::allocate_to_segment):
3053 Update the phdrs_list even when the output section is NULL.
3054 * testsuite/Makefile.am: Add test.
3055 * testsuite/Makefile.in: Regenerate.
3056 * testsuite/script_test_9.cc: New.
3057 * testsuite/script_test_9.sh: New.
3058 * testsuite/script_test_9.t: New.
3060 2010-05-19 Doug Kwan <dougkwan@google.com>
3062 * arm.cc (Arm_input_section::original_size): New method.
3063 (Arm_input_section::do_addralign): Add a cast.
3064 (Arm_input_section::do_output_offset): Remove static cast.
3065 (Arm_input_section::original_addralign,
3066 Arm_input_section::original_size_): Change type to uint32_t.
3067 (Arm_input_section::init): Add safe casts for section alignment
3069 (Arm_input_section::set_final_data_size): Do not set address and
3070 offset of stub table.
3071 (Arm_output_section::fix_exidx_coverage): Change use of of
3072 Output_section::Simple_input_section to that of
3073 Output_section::Input_section.
3074 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3075 except for the first pass.
3076 * output.cc (Output_section::get_input_sections): Change type of
3077 input_sections to std::list<Input_section>.
3078 (Output_section::add_script_input_section): Rename from
3079 Output_section::add_simple_input_section. Change type of SIS
3080 parameter from Simple_input_section to Input_section.
3081 * output.h (Output_section::Simple_input_section): Remove class.
3082 (Output_section::Input_section): Change class visibility to public.
3083 (Output_section::Input_section::addralign): Use stored alignments
3084 for special input sections if set.
3085 (Output_section::Input_section::set_addralign): New method.
3086 (Output_section::get_input_sections): Change parameter type from
3087 list of Simple_input_section to list of Input_section.
3088 (Output_section::add_script_input_section): Rename from
3089 Output_section::add_simple_input_section. Change first parameter's
3090 type from Simple_input_section to Input_section and remove the
3091 second and third parameters.
3092 * script-sections.cc (Input_section::Input_section_list): Change
3093 type to list of Output_section::Input_section/
3094 (Input_section_info::Input_section_info): Change parameter type of
3095 INPUT_SECTION to Output_section::Input_section.
3096 (Input_section_info::input_section): Change return type.
3097 (Input_section_info::input_section_): Change type to
3098 Output_section::Input_section.
3099 (Output_section_element_input::set_section_addresses): Adjust code
3100 to use Output_section::Input_section instead of
3101 Output_section::Simple_input_section. Adjust code for renaming
3102 of Output_section::add_simple_input_section.
3103 (Orphan_output_section::set_section_addresses): Ditto.
3105 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3107 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3108 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3110 2010-05-18 Rafael Espindola <espindola@google.com>
3112 * options.cc (General_options::finalize): Handle -nostdlib.
3113 * options.h (nostdlib): New option.
3114 * script.cc (script_add_search_dir): Handle -nostdlib.
3116 2010-05-12 Doug Kwan <dougkwan@google.com>
3118 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3119 attributes section only if there no attributes section after merging.
3120 (Target_arm::merge_object_attributes): Move value of
3121 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3122 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3123 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3124 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3125 and arm_attr_merge_7.stdout.
3126 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3127 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3128 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3129 arm_attr_merge_7b.o): New rules.
3130 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3132 * testsuite/Makefile.in: Regenerate.
3133 * testsuite/arm_attr_merge.sh: New file.
3134 * testsuite/arm_attr_merge_[67][ab].s: Same.
3136 2010-05-05 Nick Clifton <nickc@redhat.com>
3138 * po/es.po: Updated Spanish translation.
3140 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3142 * Makefile.am (install-exec-local): Properly install gold as
3143 default cross linker.
3144 * Makefile.in: Regenerated.
3146 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3147 Nick Clifton <nickc@redhat.com>
3149 * configure.ac (install_as_default): Define and set to false
3150 unless --enable-gold or --enable-gold=both/gold has been
3152 * configure: Regenerate.
3154 * Makefile.am (install-exec-local): Install the executable as
3155 'ld.gold'. If install_as_default is true then also install it as
3157 * Makefile.in: Regenerated.
3159 2010-04-24 Ian Lance Taylor <iant@google.com>
3161 * layout.cc (Layout::layout_reloc): In relocatable link don't
3162 combine reloc sections for grouped sections.
3164 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3166 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3167 sections that are not ordinary to icf.
3168 * icf.cc (get_section_contents): Handle relocation pointing to section
3169 with no object or shndx information.
3170 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3171 * testsuite/Makefile.in: Regenerate.
3172 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3173 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3175 2010-04-22 Ian Lance Taylor <iant@google.com>
3177 * expression.cc (Expression::Expression_eval_info): Add
3178 result_alignment_pointer field.
3179 (Expression::eval_with_dot): Add result_alignment_pointer
3180 parameter. Change all callers.
3181 (Expression::eval_maybe_dot): Likewise.
3182 (class Binary_expression): Add alignment_pointer parameter to
3183 left_value and right_value. Change all callers.
3184 (BINARY_EXPRESSION): Set result alignment.
3185 (class Trinary_expression): Add alignment_pointer parameter to
3186 arg2_value and arg3_value. Change all callers.
3187 (Trinary_cond::value): Set result alignment.
3188 (Max_expression::value, Min_expression::value): Likewise.
3189 (Align_expression::value): Likewise.
3190 * script-sections.cc (class Sections_element): Add dot_alignment
3191 parameter to set_section_addresses virtual function. Update
3193 (class Output_section_element): Likewise.
3194 (Script_sections::create_segments): Add dot_alignment parameter.
3196 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3197 (Script_sections::set_phdrs_clause_addresses): Likewise.
3198 * script-sections.h: Update declarations.
3199 * script.h: Update declarations.
3200 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3202 * testsuite/script_test_3.t: Set large alignment.
3203 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3204 segment has expected alignment.
3206 2010-04-22 Nick Clifton <nickc@redhat.com>
3208 * po/gold.pot: Updated by the Translation project.
3209 * po/vi.po: Updated Vietnamese translation.
3211 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3213 * testsuite/Makefile.am (check_PROGRAMS): Add
3214 icf_virtual_function_folding_test.
3215 * testsuite/Makefile.in: Regenerated.
3217 2010-04-15 Andrew Haley <aph@redhat.com>
3219 * options.h (merge_exidx_entries): New option.
3220 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3221 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3222 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3223 (Target_arm::merge_exidx_entries): New function.
3224 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3225 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3226 to Arm_exidx_fixup constructor.
3227 Add new arg, merge_exidx_entries.
3228 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3229 Arm_output_section::fix_exidx_coverage.
3231 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3233 * icf.cc (get_section_contents): Check for preemptible functions.
3234 Ignore addend when appropriate.
3235 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3237 (add_from_relobj): Check for section folded.
3238 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3239 * symtab.h (should_add_dynsym_entry): Add new parameter.
3240 * target-reloc.h (scan_relocs): Check for section folded.
3241 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3242 Check reloc types for function pointers in shared objects.
3243 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3245 (icf_preemptible_functions_test): New test case.
3246 (icf_string_merge_test): New test case.
3247 * testsuite.Makefile.in: Regenerate.
3248 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3249 bar_glob. Refactor code.
3250 * testsuite/icf_preemptible_functions_test.cc: New file.
3251 * testsuite/icf_preemptible_functions_test.sh: New file.
3252 * testsuite/icf_string_merge_test.cc: New file.
3253 * testsuite/icf_string_merge_test.sh: New file.
3254 * testsuite/icf_virtual_function_folding_test.cc: New file.
3255 * testsuite/icf_virtual_function_folding_test.sh: New file.
3257 2010-04-14 Doug Kwan <dougkwan@google.com>
3259 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3260 for local symbol recounting if we remove a section due to ICF.
3261 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3262 there are no regular objects in input.
3264 2010-04-13 Doug Kwan <dougkwan@google.com>
3266 * arm.cc (Arm_input_section::set_final_data_size): Compute
3267 accurate final data size instead of using current data size.
3269 2010-04-09 Doug Kwan <dougkwan@google.com>
3271 * layout.cc (Layout::choose_output_section): Handle script section
3273 (Layout::make_output_section_for_script): Add section type parameter.
3274 Handle script section types.
3275 * layout.h (Layout::make_output_section_for_script): Add section
3277 * output.cc (Output_section::Output_section): Initialize data member
3279 (Output_section::do_reset_address_and_file_offset): Do not set address
3280 to 0 if section is a NOLOAD section.
3281 * output.h (Output_section::is_noload): New method.
3282 (Output_section::set_is_noload): Ditto.
3283 (Output_section::is_noload_): New data member.
3284 * script-c.h (Script_section_type): New enum type.
3285 (struct Parser_output_section_header): Add new file section_type.
3286 * script-sections.cc (Sections_element::output_section_name): Add
3287 parameter for returning script section type.
3288 (Output_section_definition::output_section_name): Ditto.
3289 (Output_section_definition::section_type)P; New method.
3290 (Output_section_definiton::script_section_type_name): Ditto.
3291 (Output_section_definition::script_section_type_): New data member.
3292 (Output_section_definition::Output_section_definition): Initialize
3293 data member Output_section_definition::script_section_type_.
3294 (Output_section_definition::create_sections): Pass script section type
3295 to Layout::make_output_section_for_script.
3296 (Output_section_definition::output_section_name): Return script
3297 section type to caller.
3298 (Output_section_definition::set_section_address): Do not advance
3299 dot value and load address if section type is NOLOAD. Set address
3300 of NOLOAD sections regardless of section flags.
3301 (Output_section_definition::print): Print section type if it is
3302 not SCRIPT_SECTION_TYPE_NONE.
3303 (Output_section_definition::section_type): New method.
3304 (Output_section_definition::script_section_type_name): Ditto.
3305 (Script_sections::output_section_name): Add new parameter
3306 PSECTION_TYPE for returning script section type. Pass it to
3307 section elements. Handle discard sections.
3308 (Sort_output_sections::operator()): Handle NOLOAD sections.
3309 * script-sections.h (Script_sections::Section_type): New enum type.
3310 (Script_sections::output_section_name): Add a new parameter for
3311 returning script section type.
3312 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3314 * yyscript.y (union): Add new field SECTION_TYPE.
3315 (COPY, DSECT, INFO, NOLOAD): New tokens.
3316 (opt_address_and_section_type): Change type to output_section_header.
3317 (section_type): New non-terminal
3318 (section_header): Handle section type.
3319 (opt_address_and_section_type): Return section type value.
3321 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3323 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3324 * testsuite/plugin_common_test_2.c (foo): Likewise.
3326 2010-04-08 Doug Kwan <dougkwan@google.com>
3328 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3330 * output.cc (Output_section::add_merge_input_section): Simplify
3331 code and return status of Output_merge_base::add_input_section.
3332 Update merge section map only if Output_merge_base::add_input_section
3335 2010-04-07 Doug Kwan <dougkwan@google.com>
3337 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3338 if section is marked as containing instructions but has no mapping
3340 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3341 correct section index.
3342 (Arm_relobj::find_linked_text_section): Ditto.
3344 2010-04-07 Cary Coutant <ccoutant@google.com>
3346 * archive.cc (include_member): Destroy Read_symbols_data object before
3348 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3349 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3350 (Read_symbols_data::~Read_symbols_data) New destructor.
3351 (Section_relocs::Section_relocs) New constructor.
3352 (Section_relocs::~Section_relocs) New destructor.
3353 (Read_relocs_data::Read_relocs_data) New constructor.
3354 (Read_relocs_data::~Read_relocs_data) New destructor.
3355 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3356 pointers to NULL after deleting.
3358 2010-04-07 Doug Kwan <dougkwan@google.com>
3360 * arm.cc: Replace "endianity" with "endianness" in comments.
3361 (Arm_exidx_cantunwind): Ditto.
3362 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3363 (Arm_relobj::merge_flags_and_attributes): New method.
3364 (Arm_relobj::merge_flags_and_attributes_): New data member.
3365 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3366 (Arm_relobj::scan_sections_for_stubs): Ditto.
3367 (Arm_relobj::do_read_symbols): Check to see if we really want to
3368 merge processor-specific flags and attributes. Exit early if
3369 an object is empty except for section names and the undefined symbol.
3370 (Target_arm::do_finalize_sections): Move check for ELF format to
3371 Arm_relobj::do_read_symbols. Merge processor specific flags and
3372 attributes from a regular object only when we have determined that
3373 it is aapropriate. Do not create an .ARM.attributes section in
3374 output if there is no regular input object.
3375 (Target_arm::merge_processor_specific_flags): Check
3376 --warn-mismatch before printing any error.
3377 (Target_arm::merge_object_attributes): Ditto.
3378 * gold.cc (queue_middle_tasks): Handle the case in which there is
3379 no regular object in input.
3380 * options.cc (General_options::parse_EB): New method.
3381 (General_options::parse_EL): Same.
3382 (General_options::General_options): Initialize endianness_.
3383 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3385 (General_options::Endianness): New enum.
3386 (General_options::endianness): New method.
3387 (General_options::endianness_): New data member.
3388 * parameters.cc (Parameters::set_options): Check target endianness.
3389 (Parameters::set_target_once): Ditto.
3390 (Parameters::check_target_endianness): New method.
3391 (parameters_force_valid_target): If either -EL or -EB is specified,
3392 use it to define endianness of default target.
3393 * parameters.h (Parameters::check_target_endianness): New method
3395 * target.h (class Target): Change "endianity" to "endianness"
3398 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3400 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3401 * configure: Regenerate.
3402 * Makefile.in: Regenerate.
3403 * testsuite/Makefile.in: Regenerate.
3405 2010-04-06 Cary Coutant <ccoutant@google.com>
3408 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3409 prevailing definitions of common symbols.
3410 * testsuite/plugin_test_6.sh: New test case.
3411 * testsuite/plugin_common_test_1.c: New test case.
3412 * testsuite/plugin_common_test_2.c: New test case.
3413 * testsuite/Makefile.am (plugin_test_6): New test case.
3414 * testsuite/Makefile.in: Regenerate.
3416 2010-04-06 Nick Clifton <nickc@redhat.com>
3418 * po/vi.po: New Vietnamese translation.
3420 2010-03-30 Doug Kwan <dougkwan@google.com>
3422 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3424 2010-03-25 Doug Kwan <dougkwan@google.com>
3426 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3427 to avoid a conversion warning on a 32-bit host.
3429 2010-03-24 Ian Lance Taylor <iant@google.com>
3431 * testsuite/script_test_3.t: Add a TLS segment.
3432 * testsuite/Makefile.am (check_PROGRAMS): Add
3433 tls_phdrs_script_test.
3434 (tls_phdrs_script_test_SOURCES): Define.
3435 (tls_phdrs_script_test_DEPENDENCIES): Define.
3436 (tls_phdrs_script_test_LDFLAGS): Define.
3437 (tls_phdrs_script_test_LDADD): Define.
3438 * testsuite/Makefile.in: Rebuild.
3440 2010-03-23 Cary Coutant <ccoutant@google.com>
3442 * fileread.cc (find_or_make_view): Fix comment.
3444 2010-03-23 Ian Lance Taylor <iant@google.com>
3446 * script-sections.cc (class Orphan_section_placement): Define
3447 PLACE_TLS and PLACE_TLS_BSS.
3448 (Orphan_section_placement::Orphan_section_placement): Initialize
3450 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3451 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3452 (tls_script_test_SOURCES): Define.
3453 (tls_script_test_DEPENDENCIES): Define.
3454 (tls_script_test_LDFLAGS): Define.
3455 (tls_script_test_LDADD): Define.
3456 * testsuite/Makefile.in: Rebuild.
3458 2010-03-22 Doug Kwan <dougkwan@google.com>
3460 * arm.cc (Arm_relocate_functions::abs8,
3461 Arm_relocate_functions::abs16): Use correct check for overflow
3462 specified in the ARM ELF specs.
3463 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3464 target of a BLX instruction specially.
3465 (Reloc_stub::stub_type_for_reloc): Ditto.
3466 (Relocate::relocate): Use symbolic names instead of numeric relocation
3467 codes to report error.
3468 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3470 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3471 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3472 thumb2_blx_out_of_range.stdout
3473 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3474 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3475 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3476 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3477 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3478 thumb2_blx_in_range, thumb2_blx_in_range.o,
3479 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3480 thumb2_blx_out_of_range.o): New rules.
3481 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3482 thumb2_blx_in_range and thumb2_blx_out_of_range.
3483 * testsuite/Makefile.in: Regenerate.
3484 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3485 * testsuite/thumb_blx_in_range.s: New file.
3486 * testsuite/thumb_blx_out_of_range.s: New file.
3488 2010-03-22 Rafael Espindola <espindola@google.com>
3490 * archive.cc (Should_include): Move to archive.h.
3491 (should_include_member): Make it a member of Archive.
3493 (Add_lib_group_symbols): New.
3494 * archive.h: Include options.h.
3495 (Archive_member): Moved from Archive.
3496 (Should_include): Moved from archive.cc.
3498 (Add_lib_group_symbols): New.
3499 * dynobj.cc (do_should_include_member): New.
3500 * dynobj.h (do_should_include_member): New.
3501 * gold.cc (queue_initial_tasks): Update call to queue.
3502 * main.cc (main): Print lib group stats.
3503 * object.cc (do_should_include_member): New.
3504 * object.h: Include archive.h.
3505 (Object::should_include_member): New.
3506 (Object::do_should_include_member): New.
3507 (Sized_relobj::do_should_include_member): New.
3508 * options.cc (General_options::parse_start_lib): New.
3509 (General_options::parse_end_lib): New.
3510 (Input_arguments::add_file): Handle lib groups.
3511 (Input_arguments::start_group): Check we are not in a lib.
3512 (Input_arguments::start_lib): New.
3513 (Input_arguments::end_lib): New.
3514 * options.h (General_options): Add start_lib and end_lib.
3515 (Input_argument::lib_): New.
3516 (Input_argument::lib): New.
3517 (Input_argument::is_lib): New.
3518 (Input_file_lib): New.
3519 (Input_arguments::in_lib_): New.
3520 (Input_arguments::in_lib): New.
3521 (Input_arguments::start_lib): New.
3522 (Input_arguments::end_lib_): New.
3523 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3524 in unused members as preempted.
3525 (Sized_pluginobj::do_should_include_member): New.
3526 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3527 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3529 (Read_symbols::do_whole_lib_group): New.
3530 (Read_symbols::do_lib_group): New.
3531 (Read_symbols::do_read_symbols): Handle lib groups.
3532 (Read_symbols::get_name): Handle lib groups.
3533 * readsyms.h (Read_symbols): Add an archive member pointer.
3534 (Read_symbols::do_whole_lib_group): New.
3535 (Read_symbols::do_lib_group): New.
3536 (Read_symbols::member_): New.
3537 * script.cc (read_input_script): Update call to queue_soon.
3539 2010-03-19 Doug Kwan <dougkwan@google.com>
3541 * arm.cc (Stub_table::Stub_table): Initialize new data members
3542 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3543 (Stub_table::add_reloc_stub): Assign stub offset and update
3544 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3545 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3547 (Stub_table::update_data_size_and_addralign): Use
3548 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3549 instead of going over all reloc stubs.
3550 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3551 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3552 Stringpool_template::offset_ to size of Stringpool_char.
3553 (Stringpool_template::new_key_offset): Remove code to initialize
3554 Stringpool_template::offset_.
3555 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3556 Stringpool_template::offset_ to zero.
3558 2010-03-15 Doug Kwan <dougkwan@google.com>
3560 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3562 (Stringpool_template::new_key_offset): New method.
3563 (Stringpool_template::add_string): Assign offsets when adding new
3565 (Stringpool_template::set_string_offsets): Do not set string offsets
3566 when not optimizing.
3567 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3569 (Chunked_vector::clear): Clear size_.
3570 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3571 (Chunked_vector::size): Return size_.
3572 (Chunked_vector::push_back): Use size_ to find insert position.
3573 (Chunked_vector::size_): New data member.
3574 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3575 (Stringpool_template::new_key_offset): New method declaration.
3576 (Stringpool_template::offset_): New data member.
3578 2010-03-15 Rafael Espindola <espindola@google.com>
3580 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3581 Add_symbols' constructor.
3582 * readsyms.h (Add_symbols): Remove the input_group member.
3584 2010-03-10 Ian Lance Taylor <iant@google.com>
3586 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3587 target to ask whether a reference to a symbol requires a stack
3589 * target.h (Target::is_call_to_non_split): New function.
3590 (Target::do_is_call_to_non_split): Declare virtual function.
3591 * target.cc: Include "symtab.h".
3592 (Target::do_is_call_to_non_split): New function.
3593 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3595 2010-03-10 Cary Coutant <ccoutant@google.com>
3597 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3598 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3599 (File_read::open[2]): Add whole_file_view_ to list of views.
3600 (File_read::make_view): Remove test of whole_file_view_.
3601 (File_read::find_or_make_view): Create whole_file_view_ if
3603 (File_read::clear_views): Replace bool parameter with enum;
3604 adjust all callers. Don't delete views with permanent data;
3605 do delete cached views and views from archives if
3606 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3607 if clearing the corresponding view.
3608 * fileread.h (File_read::Clear_views_mode): New enum.
3609 (File_read::View::is_permanent_view): New method.
3610 (File_read::clear_views): Replace bool parameter
3611 with enum; adjust all callers.
3612 * options.h (General_options): Change keep_files_mapped option;
3613 add map_whole_files.
3614 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3616 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3619 2010-03-10 David S. Miller <davem@davemloft.net>
3621 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3623 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3625 * icf.cc (get_section_contents): Add '@' marker after processing the
3628 2010-03-08 Doug Kwan <dougkwan@google.com>
3630 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3631 due to a conversion warning.
3632 (Arm_relobj::update_output_local_symbol_count): Check for local
3633 symbol with unset output index.
3635 2010-03-05 Ian Lance Taylor <iant@google.com>
3637 * options.h (class General_options): Add --spare-dynamic-tags.
3638 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3639 --spare-dynamic-tags.
3641 2010-03-05 Ian Lance Taylor <iant@google.com>
3643 * incremental.cc: Include "libiberty.h".
3645 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3647 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3648 function, is_info_ member.
3649 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3650 (Versions::Versions): Update caller.
3651 (Versions::define_base_version): Likewise.
3652 (Versions::add_def): Likewise.
3654 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3656 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3657 (Scan::possible_function_pointer_reloc): New function.
3658 (Scan::local_reloc_may_be_function_pointer): Change to call
3659 possible_function_pointer_reloc.
3660 (Scan::global_reloc_may_be_function_pointer): Ditto.
3661 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3662 relocations in ".data.rel.ro._ZTV" section.
3663 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3664 * testsuite/icf_safe_so_test.cc: Ditto.
3665 * testsuite/icf_safe_test.cc: Ditto.
3666 * testsuite/icf_safe_test.sh: Ditto.
3668 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3669 Ian Lance Taylor <iant@google.com>
3671 * target-reloc.h (relocate_section): Check the symbol table index
3672 for -1U before setting the local symbol index.
3673 (scan_relocatable_relocs): If copying the relocation, record that
3674 the local symbol is required.
3675 * object.h (Symbol_value::is_output_symtab_index_set): New
3677 (Symbol_value::may_be_discarded_from_output_symtab): New
3679 (Symbol_value::has_output_symtab_entry): New function.
3680 (Symbol_value::needs_output_symtab_entry): Remove.
3681 (Symbol_value::output_symtab_index): Make sure the symbol index is
3683 (Symbol_value::set_output_symtab_index): Make sure the symbol
3684 index is not set. Make sure the new index is valid.
3685 (Symbol_value::set_must_have_output_symtab_entry): New function.
3686 (Symbol_value::has_output_dynsym_entry): New function.
3687 (Symbol_value::set_output_dynsym_index): Make sure the new index
3689 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3690 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3691 local symbol if permitted.
3692 (Sized_relobj::do_finalize_local_symbols): Call
3693 is_output_symtab_index_set rather than needs_output_symtab_entry.
3694 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3695 rather than needs_output_symtab_entry. Call
3696 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3697 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3698 is_output_symtab_index_set rather than needs_output_symtab_entry.
3699 * testsuite/discard_locals_relocatable_test.c: New file.
3700 * testsuite/discard_locals_test.sh: Test -r.
3701 * testsuite/Makefile.am (check_DATA): Add
3702 discard_locals_relocatable_test1.syms,
3703 discard_local_relocatable_test2.syms.
3704 (MOSTLYCLEANFILES): Likewise. Also add
3705 discard_locals_relocatable_test1.lout and
3706 discard_locals_relocatable_test2.out.
3707 (discard_locals_relocatable_test1.syms): New target.
3708 (discard_locals_relocatable_test.o): New target.
3709 (discard_locals_relocatable_test1.out): New target.
3710 (discard_locals_relocatable_test2.syms): New target.
3711 (discard_locals_relocatable_test2.out): New target.
3712 (various): Add missing ../ld-new dependencies.
3713 * testsuite/Makefile.in: Rebuild.
3715 2010-03-03 Nick Clifton <nickc@redhat.com>
3717 * po/fi.po: New Finnish translation.
3719 2010-03-01 Doug Kwan <dougkwan@google.com>
3721 * layout.cc (Layout::Layout): Force section types of .init_array*,
3722 .preinit_array* and .fini_array* sections.
3723 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3724 Fix check of return value of std::string::find.().
3725 (Output_section::Input_section_sort_compare::operator()): Remove
3726 comment about .init_array.
3727 (Output_section::Input_section_sort_init_fini_compare::operator()):
3729 (Output_section::sort_attached_input_sections): Handle .init_array
3730 and .fini_array specially.
3731 * output.h (Output_section::Inut_section_sort_compare): Update
3733 (Output_section::Input_section_sort_init_fini_compare): New struct.
3735 2010-02-26 Doug Kwan <dougkwan@google.com>
3737 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3738 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3739 * testsuite/debug_msg.sh: Avoid matching source line number for
3740 use of global variable undef_int.
3742 2010-02-26 Doug Kwan <dougkwan@google.com>
3744 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3745 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3746 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3747 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3748 * options.cc (General_options::General_options): Initialize member
3750 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3751 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3752 and rm_no_fix_v4bx.stdout
3753 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3754 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3755 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3756 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3757 and arm_no_fix_v4bx.
3758 * Makefile.in: Regenerate.
3759 * testsuite/arm_fix_v4bx.s: New file.
3760 * testsuite/arm_fix_v4bx.sh: Ditto.
3762 2010-02-24 Doug Kwan <dougkwan@google.com>
3764 * arm.cc (Target_arm::got_section): Make the .got section the first
3765 non RELRO section in the data segment.
3766 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3767 suffixes of section names.
3769 2010-02-24 Doug Kwan <dougkwan@google.com>
3771 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3772 flags and attributes merging if an input file is a binary file.
3773 * fileread.cc (Input_file::open): Record format of original file.
3774 * fileread.h (Input_file::Format): New enum type.
3775 (Input_file::Input_file): Initialize data member format_.
3776 (Input_file::format): New method definition.
3777 (Input_file::format_):: New data member.
3779 2010-02-24 Doug Kwan <dougkwan@google.com>
3781 * arm.cc (Arm_output_data_got): New class.
3782 (ARM_TCB_SIZE): New constant
3783 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3784 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3785 If user uses a script with a SECTIONS clause, issue only a warning
3786 for a misplaced EXIDX input section. Otherwise, issue an error.
3787 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3789 (Target_arm::got_mode_index_entry): Handle static linking.
3790 (Target_arm::Scan::local): Ditto.
3791 (Target_arm::Scan::global): Ditto.
3792 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3793 all incorrectly implemented relocations.
3794 (Target_arm::fix_exidx_coverage): Pass layout to
3795 Arm_output_section::fix_exidx_coverage.
3796 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3797 from ".ARM.exidx." and ".ARM.extab.".
3799 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3801 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3802 section if it does not already exist.
3803 * attributes.cc (Attributes_section_data::Attributes_section_data):
3804 Don't crash if size is zero.
3806 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3807 Ian Lance Taylor <iant@google.com>
3809 * gold.cc (queue_middle_tasks): If no input files were opened,
3811 * workqueue.h (Task_function::Task_function): Assert that there is
3814 2010-02-22 Doug Kwan <dougkwan@google.com>
3816 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3817 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3818 types to avoid warnings due to different uint64_t implementations
3821 2010-02-21 Doug Kwan <dougkwan@google.com>
3823 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3824 handling of the maximum backward branch offset.
3825 (Arm_relocate_functions::thumb_branch_common): Ditto.
3826 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3827 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3828 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3829 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3830 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3831 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3832 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3833 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3834 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3835 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3836 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3837 thumb2_bl_out_of_range.o): New rules.
3838 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3839 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3840 thumb2_bl_out_of_range
3841 * testsuite/Makefile.in: Regenerate.
3842 * testsuite/arm_bl_in_range.s: New file.
3843 * testsuite/arm_bl_out_of_range.s: Ditto.
3844 * testsuite/arm_branch_in_range.sh: Ditto.
3845 * testsuite/arm_branch_range.t: Ditto.
3846 * testsuite/thumb2_branch_range.t: Ditto.
3847 * testsuite/thumb_bl_in_range.s: Ditto.
3848 * testsuite/thumb_bl_out_of_range.s: Ditto.
3849 * testsuite/thumb_branch_range.t: Ditto.
3851 2010-02-20 Sriraman Tallam <tmsriram@google.com>
3853 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3854 Add reloc offset information.
3855 * icf.cc (get_section_contents): Change iterators to point to the new
3856 vectors. Add reloc offset information to the contents.
3857 * icf.h (Icf::Sections_reachable_info): New typedef.
3858 (Icf::Sections_reachable_list): New typedef.
3859 (Icf::Offset_info): New typedef.
3860 (Icf::Reloc_info): New struct typedef.
3861 (Icf::Reloc_info_list): New typedef.
3862 (Icf::symbol_reloc_list): Delete method.
3863 (Icf::addend_reloc_list): Delete method.
3864 (Icf::section_reloc_list): Delete method.
3865 (Icf::reloc_info_list): New method.
3866 (Icf::reloc_info_list_): New member.
3868 2010-02-19 Doug Kwan <dougkwan@google.com>
3870 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3871 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3872 * arm.cc (Arm_relocation_functions): New forward declaration.
3873 (Target_arm::Target_arm): Initialize new data members
3874 got_mod_index_offset_ and tls_base_symbol_defined_.
3875 (Target_arm::Relocate::relocate_tls): New method.
3876 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3877 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3879 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3880 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3881 (Target_arm::got_mod_index_offset_,
3882 Target_arm::tls_base_symbol_defined_): New data members.
3883 (Target_arm::Scan::local, Target::Scan::global,
3884 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3887 2010-02-18 Doug Kwan <dougkwan@google.com>
3889 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3890 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3891 text section as a parameter becuase some broken tools may not set
3892 the link in section header.
3893 (Target_arm::has_got_section): New method.
3894 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3895 without any mapping symbol as data only. Remove warning.
3896 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3897 link in its section header, try to discover the link by inspecting the
3898 REL31 relocation at the beginning of the section.
3899 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3901 (Target_arm::Scan::global): Treat any reference to the symbol
3902 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3904 2010-02-12 Sriraman Tallam <tmsriram@google.com>
3906 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3907 (Scan::global_reloc_may_be_function_pointer): New function.
3908 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3909 (Scan::global_reloc_may_be_function_pointer): New function.
3910 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3911 (Scan::global_reloc_may_be_function_pointer): New function.
3912 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3913 (Scan::global_reloc_may_be_function_pointer): New function.
3914 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3915 (Scan::global_reloc_may_be_function_pointer): New function.
3916 (Scan::possible_function_pointer_reloc): New function.
3917 (Target_x86_64::can_check_for_function_pointers): New function.
3918 * gc.h (gc_process_relocs): Scan relocation types to determine if
3919 function pointers were taken for targets that support it.
3920 * icf.cc (Icf::find_identical_sections): Include functions for
3921 folding in safe ICF whose pointer is not taken.
3922 * icf.h (Secn_fptr_taken_set): New typedef.
3923 (fptr_section_id_): New member.
3924 (section_has_function_pointers): New function.
3925 (set_section_has_function_pointers): New function.
3926 (check_section_for_function_pointers): New function.
3927 * options.h: Fix comment for safe ICF option.
3928 * target.h (can_check_for_function_pointers): New function.
3929 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3930 Modify icf_safe_test for X86-64.
3931 * testsuite/Makefile.in: Regenerate.
3932 * testsuite/icf_safe_so_test.cc: New file.
3933 * testsuite/icf_safe_so_test.sh: New file.
3934 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3935 (main): Change to take pointer to function kept_func_3.
3936 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3937 folding is done correctly for X86-64.
3939 2010-02-12 David S. Miller <davem@davemloft.net>
3941 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3942 is_symbolless parameter.
3943 (Output_reloc<SHT_REL>::is_symbolless): New.
3944 (Output_reloc<SHT_REL>::is_symbolless_): New.
3945 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3946 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3947 (Output_reloc<SHT_RELA>::is_symbolless): New.
3948 (Output_data_reloc::add_global): Handle is_symbolless.
3949 (Output_data_reloc::add_global_relative): Likewise.
3950 (Output_data_reloc::add_local): Likewise.
3951 (Output_data_reloc::add_local_relative): Likewise.
3952 (Output_data_reloc::add_symbolless_global_addend): New.
3953 (Output_data_reloc::add_symbolless_local_addend): New.
3954 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3956 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3957 instead of ->is_relative_
3958 (Output_reloc::write): Likewise.
3959 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3960 (Output_reloc::write_rel): Simplify.
3962 * sparc.cc (Target_sparc::Scan::local): Use
3963 ->add_symbolless_local_addend as needed.
3964 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3965 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3966 based upon relocation offset.
3968 2010-02-11 Doug Kwan <dougkwan@google.com>
3970 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3971 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3972 beginning of function.
3973 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3974 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3975 parameter is_32bit in calls to should_apply_static_reloc.
3976 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3977 (check_DATA): Add arm_abs_global.stdout.
3978 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3979 arm_abs_global.stdout): New rules.
3980 (MOSTLLYCLEANFILES): Add arm_abs_global
3981 * Makefile.in: Regenerate.
3982 * testsuite/arm_abs_global.s: New file.
3983 * testsuite/arm_abs_global.sh: Ditto.
3984 * testsuite/arm_abs_lib.s: Ditto.
3986 2010-02-11 Ian Lance Taylor <iant@google.com>
3988 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3990 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3991 Allocate_commons_task first.
3992 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3993 task, rather than symtab_lock_.
3994 (Gc_process_relocs::~Gc_process_relocs): New function.
3995 (Gc_process_relocs::is_runnable): Check this_blocker_.
3996 (Gc_process_relocs::locks): Use next_blocker_ rather than
3998 (Scan_relocs::~Scan_relocs): New function.
3999 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4001 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4003 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4004 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4005 constructor accordingly.
4006 (class Gc_process_relocs): Likewise.
4007 (class Scan_relocs): Likewise.
4008 * common.h (class Allocate_commons_task): Remove symtab_lock_
4009 field, and corresponding constructor parameter.
4010 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4012 (Allocate_commons_task::locks): Likewise.
4014 2010-02-11 Ian Lance Taylor <iant@google.com>
4016 * gold-threads.h (class Once): Define.
4017 (class Initialize_lock): Rewrite as child of Once.
4018 * gold-threads.cc (class Once_initialize): Define.
4019 (once_pointer_control): New static variable.
4020 (once_pointer, once_arg): New static variables.
4021 (c_run_once): New static function.
4022 (Once::Once, Once::run_once, Once::internal_run): New functions.
4023 (class Initialize_lock_once): Remove.
4024 (initialize_lock_control): Remove.
4025 (initialize_lock_pointer): Remove.
4026 (initialize_lock_once): Remove.
4027 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4028 (Initialize_lock::initialize): Rewrite.
4029 (Initialize_lock::do_run_once): New function.
4030 * archive.cc (Archive::interpret_header): Only clear name if it is
4032 * fileread.cc: Include "gold-threads.h"
4033 (file_counts_lock): New static variable.
4034 (file_counts_initialize_lock): Likewise.
4035 (File_read::release): Only increment counts when using --stats.
4036 Use a lock around the increment.
4037 * parameters.cc (class Set_parameters_target_once): Define.
4038 (set_parameters_target_once): New static variable.
4039 (Parameters::Parameters): Move here from parameters.h.
4040 (Parameters::set_target): Rewrite.
4041 (Parameters::set_target_once): New function.
4042 (Parameters::clear_target): Move here and rewrite.
4043 * parameters.h (class Parameters): Update declarations. Add
4044 set_parameters_target_once_ field.
4045 (Parameters::Parameters): Move to parameters.cc.
4046 (Parameters::clear_target): Likewise.
4047 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4049 (Start_group::~Start_group): New function.
4050 (Start_group::is_runnable): New function.
4051 (Start_group::locks, Start_group::run): New functions.
4052 (Finish_group::run): Change saw_undefined to size_t.
4053 * readsyms.h (class Start_group): Define.
4054 (class Finish_group): Change saw_undefined_ field to size_t.
4055 (Finish_group::Finish_group): Remove saw_undefined and
4056 this_blocker parameters. Change all callers.
4057 (Finish_group::set_saw_undefined): New function.
4058 (Finish_group::set_blocker): New function.
4059 * symtab.h (class Symbol_table): Change saw_undefined to return
4060 size_t. Change saw_undefined_ field to size_t.
4061 * target-select.cc (Set_target_once::do_run_once): New function.
4062 (Target_selector::Target_selector): Initialize set_target_once_
4063 field. Don't initialize lock_ and initialize_lock_ fields.
4064 (Target_selector::instantiate_target): Rewrite.
4065 (Target_selector::set_target): New function.
4066 * target-select.h (class Set_target_once): Define.
4067 (class Target_selector): Update declarations. Make
4068 Set_target_once a friend. Remove lock_ and initialize_lock_
4069 fields. Add set_target_once_ field.
4071 2010-02-10 Ian Lance Taylor <iant@google.com>
4073 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4075 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4076 (queue_middle_tasks): Add all blockers before queueing any tasks.
4077 (queue_final_tasks): Likewise.
4078 * token.h (Task_token::add_blockers): New function.
4079 * object.h (Input_objects::number_of_relobjs): New function.
4081 2010-02-10 Ian Lance Taylor <iant@google.com>
4083 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4084 shared, not if not position independent.
4085 * x86_64.cc (Relocate::relocate_tls): Likewise.
4086 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4087 (tls_pie_pic_test): New target.
4088 * testsuite/Makefile.in: Rebuild.
4090 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4091 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4092 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4093 * testsuite/Makefile.in: Rebuild.
4095 2010-02-09 David S. Miller <davem@davemloft.net>
4097 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4098 R_SPARC_RELATIVE using ->add_local_relative().
4099 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4101 * output.h (Output_data_dynamic::add_section_size): New method
4102 that takes two Output_data objects.
4103 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4104 entry param. Handle it in initializers.
4105 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4106 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4107 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4109 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4110 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4111 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4112 for dynrel_includes_plt.
4113 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4114 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4115 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4117 (Target_sparc::do_finalize_sections): Update to pass true for
4118 dynrel_includes_plt.
4119 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4120 output before .rela.plt
4121 (Target_powerpc::do_finalize_sections): Update to pass true for
4122 dynrel_includes_plt when 32-bit.
4124 2010-02-08 Doug Kwan <dougkwan@google.com>
4126 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4128 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4129 Arm_relobj::scan_section_for_cortex_a8_stubs,
4130 Arm_relobj::do_relocation_section): Instead of calling
4131 Output_section::output_address, use faster
4132 Arm_relobj::simple_input_section_output_address.
4134 2010-02-08 David S. Miller <davem@davemloft.net>
4136 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4137 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4138 relocation helper function.
4140 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4141 just like R_SPARC_GOT{10,13,22}.
4142 (Target_sparc::Scan::local): Likewise.
4143 (Target_sparc::Relocate:relocate): Likewise.
4145 2010-02-06 Ian Lance Taylor <iant@google.com>
4147 * configure.ac: Rewrite targetobjs duplicate removal code to use
4148 only shell constructs.
4149 * configure: Rebuild.
4151 2010-02-05 Doug Kwan <dougkwan@google.com>
4154 * arm.cc (Arm_relobj::section_is_scannable): New method.
4155 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4156 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4158 2010-02-04 Doug Kwan <dougkwan@google.com>
4161 * arm-reloc-property.cc (cstdio): Include.
4162 * configure.ac (targetobjs): Remove duplicates.
4163 * configure: Regenerate.
4164 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4165 big and little endian version for a given address size.
4167 2010-02-03 Doug Kwan <dougkwan@google.com>
4169 * arm-reloc-property.cc
4170 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4172 * arm-reloc-property.h
4173 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4174 New method definition.
4175 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4177 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4179 (GOT_PREL): Change implemented to Y.
4180 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4181 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4182 (Arm_relocate_functions::movw_abs_nc): Remove method.
4183 (Arm_relocate_functions::movt_abs): Ditto.
4184 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4185 (Arm_relocate_functions::thm_movt_abs): Ditto.
4186 (Arm_relocate_functions::movw_rel_nc): Ditto.
4187 (Arm_relocate_functions::movw_rel): Ditto.
4188 (Arm_relocate_functions::movt_rel): Ditto.
4189 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4190 (Arm_relocate_functions:thm_movw_rel): Ditto.
4191 (Arm_relocate_functions:thm_movt_rel): Ditto.
4192 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4193 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4194 New method definitions.
4195 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4196 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4197 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4198 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4199 (Target_arm::Relocate::relocate): Check for non-static or
4200 unimplemented relocation code and exit early. Change calls to
4201 Target_arm::reloc_uses_thumb_bit and
4202 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4203 instead. Refactor code to handle similar relocations to increase
4204 code sharing. Remove check for unsupported relocation code in switch
4206 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4207 relocation property table to find out size. Change error message to
4208 print out the name of a relocation code instead of the numeric value.
4209 (Target_arm::scan_reloc_for_stub): Use relocation property table
4210 instead of calling Target_arm::reloc_uses_thumb_bit().
4212 2010-02-02 Doug Kwan <dougkwan@google.com>
4214 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4215 types of relaxed input section.
4217 2010-02-02 Doug Kwan <dougkwan@google.com>
4219 * Makefile.am (HFILES): Add arm-reloc-property.h.
4221 (TARGETSOURCES): Add arm-reloc-property.cc
4222 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4223 (libgold_a_SOURCES): $(DEFFILES)
4224 * Makefile.in: Regenerate.
4225 * arm-reloc-property.cc: New file.
4226 * arm-reloc-property.h: New file.
4227 * arm-reloc.def: New file.
4228 * arm.cc: Update comments.
4229 (arm-reloc-property.h): New included header.
4230 (arm_reloc_property_table): New global variable.
4231 (Target_arm::do_select_as_default_target): New method definition.
4232 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4233 arm-reloc-property to targ_extra_obj.
4234 * parameters.cc (set_parameters_target): Call
4235 Target::select_as_default_target().
4236 * target.h (Target::select_as_default_target): New method definition.
4237 (Target::do_select_as_default_target): Same.
4239 2010-02-01 Doug Kwan <dougkwan@google.com>
4241 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4242 first_output_text_section_.
4243 (Arm_exidx_fixup::first_output_text_section): New method definition.
4244 (Arm_exidx_fixup::first_output_text_section_): New data member.
4245 (Arm_exidx_fixup::process_exidx_section): Record the first text
4246 output section seen.
4247 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4248 and entsize in output section header.
4250 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4252 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4253 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4254 (Arm_relocate_functions::thm_alu11): New Method.
4255 (Arm_relocate_functions::thm_pc8): New Method.
4256 (Arm_relocate_functions::thm_pc12): New Method.
4257 (Target_arm::Scan::local): Handle the relocations.
4258 (Target_arm::Scan::global): Likewise.
4259 (Target_arm::Relocate::relocate): Likewise.
4260 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4262 2010-01-29 Doug Kwan <dougkwan@google.com>
4264 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4265 of relocation types as ld.
4267 2010-01-29 Doug Kwan <dougkwan@google.com>
4269 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4271 (Arm_relocate_functions::thumb_branch_common): Ditto.
4272 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4273 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4274 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4275 Arm_relocate_functions::jump24): Remove.
4276 (Target_arm::Relocate::relocate): Adjust code to call
4277 Arm_relocation_functions::arm_branch_common and
4278 Arm_relocation_functions::thumb_branch_common instead of their removed
4279 wrappers. Merge switch-cases together to reduce source code size.
4281 2010-01-29 Doug Kwan <dougkwan@google.com>
4283 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4284 output_local_symbol_count_needs_update_.
4285 (Arm_relobj::output_local_symbol_count_needs_update,
4286 Arm_relobj::set_output_local_symbol_count_needs_update,
4287 Arm_relobj::update_output_local_symbol_count): New methods.
4288 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4290 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4291 of pointed function as in a R_ARM_PREL31 relocation.
4292 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4293 for output local symbol count updating.
4294 (Target_arm::do_relax): Update output local symbol counts in objects
4296 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4298 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4300 * arm.cc: Added support for the ARM relocations:
4301 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4302 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4303 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4305 (Arm_relocate_functions::movw_rel): New method.
4306 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4307 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4309 (Arm_relocate_functions::thm_movw_rel): New method.
4310 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4312 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4314 (Target_arm::Scan::global): Likewise.
4315 (Target_arm::Relocate::relocate): Likewise.
4316 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4319 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4321 * arm.cc: Added support for ARM group relocations.
4322 (Target_arm::reloc_needs_sym_origin): New method.
4323 (Arm_relocate_functions::calc_grp_kn): New method.
4324 (Arm_relocate_functions::calc_grp_residual): New method.
4325 (Arm_relocate_functions::calc_grp_gn): New method.
4326 (Arm_relocate_functions::arm_grp_alu): New Method.
4327 (Arm_relocate_functions::arm_grp_ldr): New Method.
4328 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4329 (Arm_relocate_functions::arm_grp_ldc): New Method.
4330 (Target_arm::Scan::local): Handle the ARM group relocations.
4331 (Target_arm::Scan::global): Likewise.
4332 (Target_arm::Relocate::relocate): Likewise.
4333 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4336 2010-01-26 Doug Kwan <dougkwan@google.com>
4338 * arm.cc (set): Include.
4339 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4341 (Arm_output_section::Text_section_list): New type.
4342 (Arm_output_section::append_text_sections_to_list): New method.
4343 (Arm_output_section::fix_exidx_coverage): Ditto.
4344 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4345 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4346 Relobj::set_section_offset() instead of
4347 Sized_relobj::invalidate_section_offset().
4348 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4349 parameter for section headers. Ignore relocation sections for
4350 unallocated sections and EXIDX sections.
4351 (Target_arm::fix_exidx_coverage): New method.
4352 (Target_arm::output_section_address_less_than): New type.
4353 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4354 linked text section instead of the EXIDX section.
4355 (Arm_output_section::create_stub_group): Add an assertion to check
4356 that this is not an EXIDX output section.
4357 (Arm_output_section::append_text_sections_to_list): New method.
4358 (Arm_output_section::fix_exidx_coverage): Ditto.
4359 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4360 Arm_relobj::section_needs_reloc_stub_scanning.
4361 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4363 (Target_arm::fix_exidx_coverage): New method.
4364 * object.h (Relobj::set_output_section): New method.
4365 (Sized_relobj::invalidate_section_offset): Remove method.
4366 (Sized_relobj::do_invalidate_section_offset): Remove method.
4367 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4369 2010-01-25 Doug Kwan <dougkwan@google.com>
4371 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4372 Fix warning due to signed and unsigned comparison on a 32-bit host.
4374 2010-01-22 Doug Kwan <dougkwan@google.com>
4376 * arm.cc (Target_arm::do_relax): Record an output section for section
4377 offset adjustment it contains any stub table that has changed.
4378 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4379 offsets in an output section if necessary.
4380 * output.cc (Output_section::Output_section): Initialize
4381 section_offsets_need_adjustments_.
4382 (Output_section::add_input_section_for_script): Renamed to
4383 Output_section::add_simple_input_section.
4384 (Output_section::save_states): Add a comment.
4385 (Output_section::discard_states): New method defintion.
4386 (Output_section::adjust_section_offsets): Same.
4387 * output.h (Output_section::add_input_section_for_script): Renamed to
4388 Output_section::add_simple_input_section.
4389 (Output_section::discard_states): New method declaration.
4390 (Output_section::adjust_section_offsets): Same.
4391 (Output_section::section_offsets_need_adjustment,
4392 Output_section::set_section_offsets_need_adjustment): New method
4394 (Output_section::section_offsets_need_adjustment_): New data member.
4395 * script-sections.cc
4396 (Output_section_element_input::set_section_address): Adjust code for
4397 renaming of Output_section::add_input_section_for_script.
4398 (Orphan_output_section::set_section_address): Same.
4400 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4402 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4403 Fix_v4bx enum values .
4404 * gold/options.h (General_options): New option definitions.
4405 (General_options::fix_v4bx): New method.
4406 (General_options::Fix_v4bx): New enum.
4407 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4408 (General_options::parse_fix_v4bx_interworking): New method.
4410 2010-01-22 Doug Kwan <dougkwan@google.com>
4412 * arm.cc (Arm_exidx_fixup): New class.
4414 2010-01-21 Doug Kwan <dougkwan@google.com>
4416 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4418 (Arm_exidx_section_offset_map): New type.
4420 2010-01-21 Doug Kwan <dougkwan@google.com>
4422 * arm.cc (Arm_exidx_input_section): New class.
4423 (Arm_relobj::exidx_input_section_by_link,
4424 Arm_relobj::exidx_input_section_by_shndx,
4425 Arm_relobj::make_exidx_input_section): New methods.
4426 (read_arm_attributes_section): Remove.
4427 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4428 information about them.
4429 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4432 2010-01-20 Doug Kwan <dougkwan@google.com>
4434 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4435 Input_section_specifier to Section_id.
4436 (Target_arm::new_arm_input_section: Adjust code for change of key
4438 (Target_arm::find_arm_input_section): Ditto.
4439 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4440 (Section_id): Remove.
4441 (Garbage_collection::Section_id_hash): Remove.
4442 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4443 (Section_id): Remove.
4444 (Icf::Section_id_hash): Remove.
4445 * object.h (Section_id, Const_section_id, Section_id_hash,
4446 Const_section_id_hash): New type definitions.
4447 * output.cc (Output_section::add_relaxed_input_section): Change to
4448 use Const_section_id instead of Input_section_specifier as key type.
4449 (Output_section::add_merge_input_section): Ditto.
4450 (Output_section::build_relaxation_map): Change to use Section_id
4451 instead of Input_section_specifier as key type.
4452 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4454 (Output_section::convert_input_sections_to_relaxed_sections): Change
4455 to use Const_section_id instead of Input_section_specifier as key type.
4456 (Output_section::find_merge_section): Ditto.
4457 (Output_section::find_relaxed_input_section): Ditto.
4458 * output.h (Input_section_specifier): Remove class.
4459 (Output_section::Output_section_data_by_input_section_map): Change
4460 key type to Const_section_id.
4461 (Output_section::Output_relaxed_input_section_by_input_section_map):
4463 (Output_section::Relaxation_map): Change key type to Section_id.
4465 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4467 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4468 (class Arm_v4bx_stub): New class.
4469 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4470 (Stub_factory::make_arm_v4bx_stub): New method.
4471 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4472 (Stub_table::empty): Handle v4bx stubs.
4473 (Stub_table::add_arm_v4bx_stub): New method.
4474 (Stub_table::find_arm_v4bx_stub): New method.
4475 (Arm_relocate_functions::v4bx): New method.
4476 (Target_arm::fix_v4bx): New method.
4477 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4478 (Stub_table::relocate_stubs): Likewise.
4479 (Stub_table::do_write): Likewise.
4480 (Stub_table::update_data_size_and_addralign): Likewise.
4481 (Stub_table::finalize_stubs): Likewise.
4482 (Target_arm::Scan::local): Likewise.
4483 (Target_arm::Scan::global): Likewise.
4484 (Target_arm::do_finalize_sections): Likewise.
4485 (Target_arm::Relocate::relocate): Likewise.
4486 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4488 (Target_arm::scan_reloc_for_stub): Likewise.
4489 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4491 2010-01-19 Ian Lance Taylor <iant@google.com>
4493 * output.cc (Output_section_headers::do_sized_write): Write large
4494 segment count to sh_info field.
4495 (Output_file_header::do_sized_write): For large segment count,
4496 write PN_XNUM to e_phnum field.
4498 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4500 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4501 (Arm_relocate_functions::thm_jump8): New function.
4502 (Arm_relocate_functions::thm_jump11): New function.
4503 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4505 (Target_arm::Scan::global): Likewise.
4506 (Target_arm::Relocate::relocate): Likewise.
4507 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4510 2010-01-14 Doug Kwan <dougkwan@google.com>
4512 * arm.cc (map, utility): Include headers.
4513 (Target_arm::apply_cortex_a8_workaround): New method.
4514 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4515 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4516 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4517 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4518 the --[no-]fix-cortex-a8 command line options.
4519 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4520 (Target_arm::relocate_stub): Use addend in instruction template.
4521 * options.h (DEFINE_bool): Set the user-set flag.
4522 (General_options): Add --[no-]-fix-cortex options.
4523 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4524 : Update fast look-up map after conversion.
4526 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4528 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4529 in the first pass of do_layout.
4531 2010-01-13 Doug Kwan <dougkwan@google.com>
4533 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4534 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4535 apparent compiler problem of not folding static constant integral
4536 data members of elfcpp::Elf_sizes<32>.
4538 2010-01-13 Doug Kwan <dougkwan@google.com>
4540 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4541 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4542 Arm_relobj::scan_section_for_cortex_a8_erratum,
4543 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4544 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4545 sections to scan for relocation stubs into a new method
4546 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4547 relocation and Cortex-A8 stub scanning.
4548 (Target_arm::do_relax): Force stubs to be after stubbed sections
4549 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4550 the beginning of a new relaxation pass. Update a comment.
4551 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4553 2010-01-12 Ian Lance Taylor <iant@google.com>
4555 * target-reloc.h (visibility_error): New inline function.
4556 (relocate_section): Call visibility_error.
4557 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4558 (MOSTLYCLEANFILES): Likewise.
4559 (protected_4_pic.o, protected_3.err): New targets.
4560 * testsuite/protected_4.cc: New file.
4562 2010-01-12 Doug Kwan <dougkwan@google.com>
4564 * arm.cc (Cortex_a8_reloc): New class.
4565 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4566 and cortex_a8_relocs_info_.
4567 (Target_arm::fix_cortex_a8): New method definition.
4568 (Target_arm::Cortex_a8_relocs_info): New type.
4569 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4570 New data member declarations.
4571 (Target_arm::scan_reloc_for_stub): Record information about
4572 relocations for THUMB branches that might be exempted from the
4573 Cortex-A8 workaround.
4574 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4575 at the beginning of a relaxation pass.
4577 2010-01-12 Doug Kwan <dougkwan@google.com>
4579 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4580 (Arm_relobj::Mapping_symbol_position,
4581 Arm_reloj::Mapping_symbol_position_less,
4582 Arm_relobj::Mapping_symbols_info): New types.
4583 (Target_arm::is_mapping_symbol_name): New method definition.
4584 (Arm_relobj::do_count_local_symbols): Save information about mapping
4587 2010-01-11 Doug Kwan <dougkwan@google.com>
4589 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4590 Arm_relocate_functions::thumb32_branch_upper,
4591 Arm_relocate_functions::thumb32_branch_lower,
4592 Arm_relocate_functions::thumb32_cond_branch_offset,
4593 Arm_relocate_functions::thumb32_cond_branch_upper,
4594 Arm_relocate_functions::thumb32_cond_branch_lower,
4595 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4596 branch offset encoding.
4597 (Arm_relocate_functions::thumb_branch_common): Use new branch
4598 offset encoding methods to avoid code duplication.
4599 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4600 (Stub_addend_reader::operator()): Use new branch encoding method
4601 to avoid code duplication.
4603 2010-01-11 Doug Kwan <dougkwan@google.com>
4605 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4606 (Target_arm::do_finalize_sections): Define special EXIDX section
4607 symbols only if referenced.
4608 * gc.h (Garbage_collection::add_reference): New method.
4609 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4612 2010-01-11 Ian Lance Taylor <iant@google.com>
4614 * script.cc (Version_script_info::build_expression_list_lookup):
4615 Change complaing about duplicate wildcard match from error to
4618 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4620 (Version_script_info::Version_script_info): Initialize globs_,
4621 default_version_, default_is_global_, and exact_. Don't
4622 initialize globals_ or locals_.
4623 (Version_script_info::build_lookup_tables): Build local symbols
4625 (Version_script_info::unquote): New function.
4626 (Version_script_info::add_exact_match): New function.
4627 (Version_script_info::build_expression_list_lookup): Remove lookup
4628 parameter. Add is_global parameter. Change all callers. Handle
4629 wildcard pattern specially. Unquote pattern. Call
4631 (Version_script_info::get_name_to_match): New function.
4632 (Version_script_info::get_symbol_version): New function.
4633 (Version_script_info::get_symbol_version_helper): Remove.
4634 (Version_script_info::check_unmatched_names): Call unquote.
4635 * script.h (class Version_script_info): Change get_symbol_version
4636 to be non-inline and add is_global parameter; change all callers.
4637 Rewrite symbol_is_local. Update declarations. Define struct
4638 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4639 Remove globals_ and locals_ members. Add exact_, globs_,
4640 default_version_, is_global_.
4641 (Version_script_info::Glob): Remove pattern, add expression and
4642 is_global. Update constructor. Change all callers.
4643 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4645 (Versions::symbol_section_contents): If a symbol is undefined, or
4646 defined in a dynamic object, set the version index to
4648 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4650 (Symbol_table::add_from_pluginobj): Likewise.
4651 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4653 2010-01-11 Doug Kwan <dougkwan@google.com>
4655 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4656 (incremental_dump_LDADD): Add linking option for libintl.
4657 * Makefile.in: Regenerate.
4659 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4662 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4664 * testsuite/Makefile.in: Regenerated.
4666 2010-01-10 Doug Kwan <dougkwan@google.com>
4668 * options.h (DEFINE_var): Use parentheses around argument varname__
4669 in macro body to avoid any unintended subsequent substitutions.
4671 2010-01-10 Ian Lance Taylor <iant@google.com>
4673 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4674 candidates before doing symbol resolution.
4676 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4677 ODR candidates if only one is weak.
4679 2010-01-08 Ian Lance Taylor <iant@google.com>
4681 * script.cc (Version_script_info::build_expression_list_lookup):
4682 Don't warn about ambiguous version, just record the ambiguity.
4683 (Version_script_info::get_symbol_version_helper): Give error if
4684 version is ambiguous.
4686 2010-01-08 Doug Kwan <dougkwan@google.com>
4688 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4689 prev_data_size_ and prev_addralign_. Remove initializer for
4690 deleted data member has_been_changed_.
4691 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4692 to determine if the table is empty.
4693 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4695 (Stub_table::add_reloc_stub): Define method in class definition
4696 instead of just declaring it there.
4697 (Stub_table::add_cortex_a8_stub): New method definition.
4698 (Stub_table::update_data_size_and_addralign): Ditto.
4699 (Stub_table::finalize_stubs): Ditto.
4700 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4701 (Stub_table::do_addralign_): Return address alignment in the
4702 (Stub_table::do_reset_address_and_file_offset): Define method in
4703 class definition instead of declaring it there. Set current data
4704 size to be the data size of the previous pass.
4705 (Stub_table::set_final_data_size): Use current data size as the
4707 (Stub_table::relocate_stub): Change parameter type of stub from
4708 Reloc_stub pointer to Stub pointer.
4709 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4710 (Stub_table::Cortex_a8_stub_list): New typedef.
4711 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4712 Stub_table::prev_addralign_): New data member.
4713 (Arm_relobj::Arm_relobj): Initialize data member
4714 section_has_cortex_a8_workaround_.
4715 (Arm_relobj::section_has_cortex_a8_workaround,
4716 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4718 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4720 (Target_arm::relocate_stub): Change parameter type of stub from
4721 Reloc_stub pointer to Stub pointer.
4722 (Insn_template::size, Insn_template::alignment): Handle
4723 THUMB16_SPECIAL_TYPE.
4724 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4725 Stub_table::update_data_size_and_addralign,
4726 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4728 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4729 (Stub_table::do_write): Ditto.
4730 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4732 2010-01-08 Ian Lance Taylor <iant@google.com>
4735 * symtab.h (class Symbol): Remove fields is_target_special_ and
4736 has_plt_offset_. Add field is_defined_in_discarded_section_.
4737 (Symbol::is_defined_in_discarded_section): New function.
4738 (Symbol::set_is_defined_in_discarded_section): New function.
4739 (Symbol::has_plt_offset): Rewrite.
4740 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4741 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4742 Don't initialize is_target_special_ or has_plt_offset_.
4743 Initialize is_defined_in_discarded_section_.
4744 (Symbol_table::add_from_relobj): If appropriate, set
4745 is_defined_in_discarded_section.
4746 * resolve.cc (Symbol::override_base_with_special): Don't test
4747 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4748 * target-reloc.h (relocate_section): Do special handling for
4749 symbols defined in discarded sections for global symbols as well
4752 2010-01-08 Ian Lance Taylor <iant@google.com>
4754 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4755 the SHT_SYMTAB case.
4757 2010-01-08 Ian Lance Taylor <iant@google.com>
4759 * object.cc (Sized_relobj::do_layout): Don't get confused if
4760 layout_eh_frame returns NULL.
4762 2010-01-08 Ian Lance Taylor <iant@google.com>
4765 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4766 dynamic symbol table, use the normal symbol table.
4767 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4770 2010-01-08 Ian Lance Taylor <iant@google.com>
4773 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4776 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4778 * version.cc (print_version): Change to "Copyright 2010".
4780 2010-01-08 Ian Lance Taylor <iant@google.com>
4784 * i386.cc (class Target_i386): Change return type of plt_section
4786 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4787 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4788 tls_desc_rel_ field.
4789 (Output_data_plt_i386::rel_tls_desc): New function.
4790 (Target_i386::rel_tls_desc_section): New function.
4791 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4792 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4793 R_386_TLS_DESC reloc in rel_tls_desc_section.
4794 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4795 Define struct Tlsdesc_info.
4796 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4797 (Target_x86_64::do_reloc_symbol_index): New function.
4798 (Target_x86_64::add_tlsdesc_info): New function.
4799 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4800 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4802 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4804 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4805 (Target_x86_64::rela_tlsdesc_section): New function.
4806 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4808 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4809 (Target_x86_64::do_reloc_addend): New function.
4810 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4811 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4812 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4813 (Output_reloc::type): New function.
4814 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4815 (Output_reloc::is_target_specific): New function.
4816 (Output_reloc::target_arg): New function.
4817 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4818 absolute relocs and target specific relocs.
4819 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4820 add_target_specific.
4821 (class Output_data_reloc) [SHT_RELA]: Likewise.
4822 * output.cc (Output_reloc::Output_reloc): Add four new versions
4823 for absolute relocs and target specific relocs.
4824 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4825 (Output_reloc::get_symbol_index): Likewise.
4826 (Output_reloc::local_section_offset): Check that local_sym_index_
4827 is not TARGET_CODE or 0.
4828 (Output_reloc::symbol_value): Likewise.
4829 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4831 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4832 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4834 * layout.cc (add_target_dynamic_tags): Use output section for
4835 DT_PLTRELSZ and DT_JMPREL.
4837 2010-01-07 Ian Lance Taylor <iant@google.com>
4840 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4842 (class Output_data_reloc_generic): Define.
4843 (class Output_data_reloc_base): Change base class to
4844 Output_data_reloc_generic. Change add() method to call
4845 bump_relative_reloc_count for a relative reloc. Remove
4847 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4849 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4850 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4852 * layout.h (class Layout): Update declaration.
4854 2010-01-07 Ian Lance Taylor <iant@google.com>
4856 * output.h (class Output_data): Add const version of
4857 output_section and do_output_section.
4858 (class Output_section_data): Add const version of
4860 (class Output_section): Likewise.
4861 * layout.cc (Layout::add_target_dynamic_tags): New function.
4862 * layout.h (class Layout): Update declarations.
4863 * arm.cc (Target_arm::do_finalize_sections): Use
4864 add_target_dynamic_tags.
4865 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4866 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4867 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4868 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4870 2010-01-07 Ian Lance Taylor <iant@google.com>
4873 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4876 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4877 Ian Lance Taylor <iant@google.com>
4880 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4881 Xindex::read_symtab_xindex.
4883 2010-01-07 Doug Kwan <dougkwan@google.com>
4885 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4886 (Insn_template::thumb16_bcond_insn): New method declaration.
4887 (Insn_template): Fix spelling.
4888 (Stub::thumb16_special): New method declaration.
4889 (Stub::do_write): Define virtual method which was previously pure
4891 (Stub::do_thumb16_special): New method declaration.
4892 (Stub::do_fixed_endian_write): New template member.
4893 (Reloc_stub::do_write): Remove.
4894 (Reloc_stub::do_fixed_endian_write): Remove.
4895 (Cortex_a8_stub): New class definition.
4896 (Stub_factory::make_cortex_a8_stub): New method definition.
4897 (Stub_factory::Stub_factory): Add missing static storage class
4898 qualifier for elf32_arm_stub_a8_veneer_blx.
4900 2010-01-07 Ian Lance Taylor <iant@google.com>
4903 * options.h (class General_options): Add --warn-unresolved-symbols
4904 and --error-unresolved-symbols.
4905 * errors.cc (Errors::undefined_symbol): Implement
4906 --warn-unresolved-symbols.
4908 * options.h (class General_options): Add -z text and -z textoff.
4909 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4911 2010-01-06 Sriraman Tallam <tmsriram@google.com>
4913 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4914 (Garbage_collection::cident_sections): New function.
4915 (Garbage_collection::add_cident_section): New function.
4916 (Garbage_collection::cident_sections_): New member.
4917 (gc_process_relocs): Add references to sections whose names are C
4919 * gold.h (cident_section_start_prefix): New constant.
4920 (cident_section_stop_prefix): New constant.
4921 (is_cident): New function.
4922 * layout.cc (Layout::define_section_symbols): Replace string constants
4923 with the newly defined constants.
4924 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4926 * testsuite/Makefile.am: Add gc_orphan_section_test.
4927 * testsuite/Makefile.in: Regenerate.
4928 * testsuite/gc_orphan_section_test.cc: New file.
4929 * testsuite/gc_orphan_section_test.sh: New file.
4931 2010-01-06 Ian Lance Taylor <iant@google.com>
4934 * options.h (class General_options): Add --warn-shared-textrel.
4935 * layout.cc (Layout::finish_dynamic_section): Implement
4936 --warn-shared-textrel.
4939 * options.h (class General_options): Add --warn-multiple-gp.
4941 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4943 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4944 $(THREADSLIB) and $(LIBDL).
4945 * Makefile.in: Rebuild.
4947 2010-01-06 Ian Lance Taylor <iant@google.com>
4950 * options.cc (General_options::parse_section_start): New function.
4951 (General_options::section_start): New function.
4952 (General_options::General_options): Initialize all members.
4953 * options.h: Include <map>
4954 (class General_options): Add --section-start. Add section_starts_
4956 * layout.cc (Layout::attach_allocated_section_to_segment): If
4957 --section-start was used, set the address of the segment. Remove
4958 local sort_sections.
4959 (Layout::relaxation_loop_body): If the address of the load segment
4960 has been set by --section-start, don't use it.
4961 * output.h (Output_segment::update_flags_for_output_section): New
4963 * output.cc (Output_segment::add_output_section): Call
4964 update_flags_for_output_section.
4966 2010-01-05 Ian Lance Taylor <iant@google.com>
4969 * options.h (class General_options): Add --undefined-version.
4970 * script.cc (struct Version_expression): Add was_matched_by_symbol
4972 (Version_script_info::matched_symbol): New function.
4973 (Version_script_info::get_symbol_version_helper): Call
4975 (Version_script_info::check_unmatched_names): New function.
4976 * script.h (class Version_script_info): Update declarations.
4977 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4979 * options.h (class General_options): Use DEFINE_bool_alias for
4980 allow_multiple_definition.
4981 * resolve.cc (Symbol_table::should_override): Don't test
4982 allow_multiple_definition.
4985 * options.h (class General_options): Add --cref.
4986 * main.cc (main): Print cref table if --cref. Don't close mapfile
4987 until after printing cref table.
4988 * cref.cc: Include "symtab.h".
4989 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4990 (Cref_table_compare::operator()): New function.
4991 (Cref_inputs::gather_cref): New function.
4992 (filecol): New static const.
4993 (Cref_inputs::print_cref): New function.
4994 (Cref::print_cref): New function.
4995 * cref.h: Include <cstdio>.
4996 (class Cref): Update declarations.
4997 * mapfile.h (Mapfile::file): New function.
4998 * object.h (class Object): Define Symbols. Declare virtual
4999 do_get_global_symbols.
5000 (Object::get_global_symbols): New function.
5001 * object.cc (Input_objects::add_object): Pass object to cref_ if
5003 (Input_objects::archive_start): Likewise.
5004 (Input_objects::archive_stop): Likewise.
5005 (Input_objects::print_cref): New function.
5006 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5007 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5009 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5011 * plugin.h (class Sized_pluginobj): Update declarations.
5013 2010-01-05 Ian Lance Taylor <iant@google.com>
5015 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5016 to is_default_version. Rename insdef to insdefault.
5017 (Symbol_table::add_from_relobj): Rename def to is_default_version
5018 and local to is_forced_local.
5019 (Symbol_table::add_from_pluginobj): Likewise.
5020 (Symbol_table::add_from_dynobj): Likewise.
5021 (Symbol_table::define_special_symbol): Rename insdef to
5024 2010-01-04 Ian Lance Taylor <iant@google.com>
5027 * options.h (class General_options): Add
5028 --allow-multiple-definition and -z muldefs.
5029 * resolve.cc (Symbol_table::should_override): Don't warn about a
5030 multiple symbol definition if --allow-multiple-definition or -z
5034 * options.h (class General_options): Add --add-needed and
5035 --copy-dt-needed-entries. Tweak --as-needed help entry.
5036 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5037 error if --copy-dt-needed-entries aka --add-needed is used and
5038 would cause a change in behaviour.
5041 * options.h (class General_options): Add -G as a short version of
5042 --shared. Add no-op options -assert, -g, and -i.
5044 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5046 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5047 check for .text or .gnu.linkonce.t sections.
5048 * icf.cc (Icf::find_identical_sections): Ditto.
5049 Change the detection for mangled function name within the section
5051 * icf.h (is_section_foldable_candidate): New function.
5053 2009-12-30 Ian Lance Taylor <iant@google.com>
5056 * options.h (class General_options): Permit two dashes with
5057 --retain-symbols-file.
5059 2009-12-30 Ian Lance Taylor <iant@google.com>
5062 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5063 don't put the file header and segment headers in the text
5067 * common.cc (Sort_commons::operator()): Stabilize sort when both
5069 (Symbol_table::do_allocate_commons_list): When allocating common
5070 symbols, skip a symbol which is no longer common.
5071 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5072 an object before checking its type.
5073 * testsuite/common_test_2.c: New file.
5074 * testsuite/common_test_3.c: New file.
5075 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5076 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5077 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5078 (common_test_2_pic.o, common_test_2.so): New targets.
5079 (common_test_3_pic.o, common_test_3.so): New targets.
5080 * testsuite/Makefile.in: Rebuild.
5083 * script.cc (read_input_script): If we see a new SECTIONS clause,
5084 and we have added an input section, give an error.
5085 * layout.h (class Layout): Add have_added_input_section function.
5086 Add have_added_input_section_ field.
5087 * layout.cc (Layout::Layout): Initialize
5088 have_added_input_section_.
5089 (Layout::layout): Set have_added_input_section_.
5090 (Layout::layout_eh_frame): Likewise.
5092 2009-12-30 Ian Lance Taylor <iant@google.com>
5095 * options.h (class General_options): Add --sort-common option.
5096 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5097 * common.cc (Sort_common): Add sort_order parameter to
5098 constructor. Add sort_order_ field.
5099 (Sort_commons::operator): Check sort_order_.
5100 (Symbol_table::allocate_commons): Determine the sort order.
5101 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5103 (Symbol_table::do_allocate_commons_list): Likewise.
5105 2009-12-30 Ian Lance Taylor <iant@google.com>
5108 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5109 symbols from this object, don't change the visibility of an
5111 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5113 2009-12-30 Ian Lance Taylor <iant@google.com>
5116 * script.h (class Version_script_info): Define Language enum.
5117 Update declarations. Define Glob, Exact, and Lookup types. Add
5118 new fields globals_, locals_, and is_finalized_.
5119 * script.cc: Various formatting fixes.
5120 (class Parser_closure): Change language_stack_ from a vector of
5121 std::string to one of Version_script_info::Language. Adjust all
5123 (class Lazy_demangler): Remove.
5124 (struct Version_expression): Change language from std::string to
5125 Version_script_info::Language.
5126 (Version_script_info::Version_script_info): New function.
5127 (Version_script_info::~Version_script_info): Don't call clear.
5128 (Version_script_info::finalize): New function.
5129 (Version_script_info::build_lookup_tables): New function.
5130 (Version_script_info::build_expression_list_lookup): New
5132 (Version_script_info::get_symbol_version_helper): Rewrite to use
5134 (Version_script_info::print_expression_list): Adjust to use
5135 Version_script_info::Language.
5136 (script_push_lex_into_version_mode): Check that the version script
5137 has not been finalized.
5138 (version_script_push_lang): Change language string to
5139 Version_script_info::Language.
5140 * options.cc (Command_line::version_script): New function.
5141 * options.h (class General_options): Add finalize_dynamic_list
5142 function. Change version_script from declaration to definition.
5143 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5144 * testsuite/version_script.map: Remove duplicate def of foo.
5145 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5147 * testsuite/Makefile.in: Rebuild.
5149 2009-12-30 Ian Lance Taylor <iant@google.com>
5152 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5153 if the input symbol index is 0, make the output symbol index 0.
5155 2009-12-30 Ian Lance Taylor <iant@google.com>
5158 * options.h (class General_options): Add -x/--discard-all.
5159 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5160 --discard-all. If the local symbol needs a dynamic entry, check
5161 that before handling --discard-locals.
5163 2009-12-30 Ian Lance Taylor <iant@google.com>
5166 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5168 (Output_segment::add_output_section): Don't change the flags if
5172 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5173 GNU hash table if they need a dynamic value. Otherwise, don't add
5174 them if they are defined in a dynamic object or are forced local.
5176 2009-12-29 Ian Lance Taylor <iant@google.com>
5179 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5180 .gnu.hash table for a 32-bit target.
5183 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5184 regular and a dynamic object only needs a dynamic symbol table
5185 entry if it is externally visible.
5188 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5189 constructor. Add global_offset_table_ field.
5190 (Target_i386::got_section): Set global_offset_table_.
5191 (Target_i386::do_finalize_sections): Set global_offset_table_
5193 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5194 in constructor. Add global_offset_table_ field.
5195 (Target_x86_64::got_section): Set global_offset_table_.
5196 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5199 * layout.cc (Layout::Layout): Initialize increase_relro_.
5200 (Layout::get_output_section): Add is_relro, is_last_relro, and
5201 is_first_non_relro parameters. Change all callers.
5202 (Layout::choose_output_section): Likewise.
5203 (Layout::add_output_section_data): Likewise.
5204 (Layout::make_output_section): Likewise.
5205 (Layout::set_segment_offsets): Clear increase_relro when using a
5207 * layout.h (class Layout): Add increase_relro method. Add
5208 increase_relro_ field. Update declarations.
5209 * output.cc (Output_section::Output_section): Initialize
5210 is_last_relro_ and is_first_non_relro_.
5211 (Output_segment::add_output_section): Group relro sections is
5212 do_sort is true. Handle is_last_relro and is_first_non_relro.
5213 (Output_segment::maximum_alignment): Remove relro handling.
5214 (Output_segment::set_section_addresses): Add increase_relro
5215 parameter. Change all callers. Add initial alignment to align
5216 relro sections on separate page. Remove old relro handling.
5217 (Output_segment::set_section_list_addresses): Remove in_relro
5218 parameter. Change all callers.
5219 (Output_segment::set_offset): Add increase parameter. Change all
5220 callers. Remove old relro handling.
5221 * output.h (class Output_section): Add new methods: is_last_relro,
5222 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5223 Add is_last_relro_ and is_first_non_relro_ fields.
5224 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5225 Create separate .got.plt section. Call increase_relro.
5226 * x86_64.cc (Target_x86_64::got_section): Likewise.
5227 * testsuite/relro_script_test.t: Add .got.plt.
5230 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5231 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5232 (Layout::finalize): Call set_dynamic_symbol_size.
5233 (Layout::set_dynamic_symbol_size): New function.
5234 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5235 set_dynamic_symbol_size.
5238 * output.h (class Output_section): Add is_entsize_zero_ field.
5239 * output.cc (Output_section::Output_section): Initialize
5241 (Output_section::set_entsize): If two different entsizes are
5242 requested, force it to zero.
5243 (Output_section::add_input_section): Set flags for .debug_str
5244 before updating section flags. Set entsize.
5245 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5246 and SHF_STRING if all input sections have those flags.
5248 2009-12-29 Rafael Espindola <espindola@google.com>
5250 * main.cc (main): Fix the sys time reporting.
5251 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5254 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5256 * options.cc (General_options::parse_version): Allow -v to exit
5257 without an error if there is nothing to link.
5259 2009-12-29 Ian Lance Taylor <iant@google.com>
5261 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5262 using a version of gcc before 4.1.
5263 * configure: Rebuild.
5265 2009-12-28 Chris Demetriou <cgd@google.com>
5267 * attributes.cc (Output_attributes_section_data::do_write): Use
5268 std::vector::front rather than std::vector::data.
5270 2009-12-28 Ian Lance Taylor <iant@google.com>
5272 * symtab.h (class Symbol_table): Add enum Defined.
5273 * resolve.cc (Symbol_table::should_override): Add defined
5274 parameter. Change all callers. Test whether object is NULL
5275 before calling a method on it.
5276 (Symbol_table::report_resolve_problem): Add defined parameter.
5278 (Symbol_table::should_override_with_special): Likewise.
5279 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5280 parameter. Change all callers.
5281 (Symbol_table::do_define_in_output_data): Likewise.
5282 (Symbol_table::define_in_output_segment): Likewise.
5283 (Symbol_table::do_define_in_output_segment): Likewise.
5284 (Symbol_table::define_as_constant): Likewise.
5285 (Symbol_table::do_define_as_constant): Likewise.
5286 * script.h (class Symbol_assignment): Add is_defsym parameter to
5287 constructor; change all callers.
5288 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5289 parameter. Change all callers. Add is_defsym_ field.
5290 (class Parser_closure): Add parsing_defsym parameter to
5291 constructor; change all callers. Add parsing_defsym accessor
5292 function. Add parsing_defsym_ field.
5294 2009-12-28 Ian Lance Taylor <iant@google.com>
5296 * gold.cc (queue_middle_tasks): Fix formatting.
5297 * object.cc (Relobj::is_section_name_included): Likewise.
5299 2009-12-23 Ian Lance Taylor <iant@google.com>
5301 * i386.cc (Target_i386::do_calls_non_split): Recognize
5302 -fsplit-stack prologue for a function with a static chain.
5303 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5304 -fsplit-stack prologue when using %r11.
5306 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5308 * options.cc (General_options::parse_version): Make -v continue and do
5309 the link like GNU ld does.
5311 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5313 * Makefile.am (CCFILES): Add timer.cc.
5314 (HFILES): Add timer.h.
5315 * configure.ac: Check for sysconf and times.
5316 * main.cc: include timer.h.
5317 (main): Use Timer instead of get_run_time.
5320 * workqueue.cc: include timer.h.
5321 (Workqueue::find_and_run_task):
5322 Report user, sys and wall time.
5323 * Makefile.in: Regenerate.
5324 * config.in: Regenerate.
5325 * configure: Regenerate.
5327 2009-12-16 Doug Kwan <dougkwan@google.com>
5329 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5331 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5332 relaxed input sections.
5333 * output.cc (Output_section::find_relaxed_input_section): Change
5334 return type to Output_relaxed_input_section pointer. Adjust code
5335 for new type of relaxed_input_section_map_.
5336 * output.h (Output_section::find_relaxed_input_section): Change
5337 return type to Output_relaxed_input_section pointer.
5338 (Output_section::Output_relaxed_input_section_by_input_section_map):
5340 (Output_section::relaxed_input_section_map_): Change type to
5341 Output_section::Output_relaxed_input_section_by_input_section_map.
5342 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5345 2009-12-15 Ian Lance Taylor <iant@google.com>
5347 * layout.cc (Layout::create_shstrtab): Only write out after input
5348 sections if we are compressing debug sections.
5350 2009-12-15 Ian Lance Taylor <iant@google.com>
5352 * archive.cc (Archive::add_symbols): Only look up a symbol without
5353 a version if there is, in fact, a version.
5355 2009-12-14 Ian Lance Taylor <iant@google.com>
5357 Revert -Wshadow changes, all changes from:
5358 2009-12-11 Doug Kwan <dougkwan@google.com>
5359 2009-12-11 Nick Clifton <nickc@redhat.com>
5360 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5362 2009-12-11 Doug Kwan <dougkwan@google.com>
5364 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5366 * attributes.cc (Object_attribute::size): Ditto.
5367 (Attributes_section_data::size): Ditto.
5368 (Attributes_section_data::Attributes_section_data): Ditto.
5369 (Output_attributes_section_data::do_write): Ditto.
5370 * attributes.h (Object_attribute::set_type): Ditto.
5371 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5373 2009-12-11 Nick Clifton <nickc@redhat.com>
5375 * archive.cc: Fix shadowed variable warnings.
5377 * compressed_output.cc: Likewise.
5378 * compressed_output.h: Likewise.
5379 * configure: Likewise.
5380 * dwarf_reader.cc: Likewise.
5381 * dynobj.cc: Likewise.
5382 * dynobj.h: Likewise.
5383 * ehframe.cc: Likewise.
5384 * ehframe.h: Likewise.
5385 * errors.cc: Likewise.
5386 * expression.cc: Likewise.
5387 * fileread.cc: Likewise.
5388 * fileread.h: Likewise.
5389 * freebsd.h: Likewise.
5390 * i386.cc: Likewise.
5392 * incremental.h: Likewise.
5393 * layout.cc: Likewise.
5394 * layout.h: Likewise.
5395 * mapfile.cc: Likewise.
5396 * merge.cc: Likewise.
5397 * merge.h: Likewise.
5398 * object.cc: Likewise.
5399 * object.h: Likewise.
5400 * options.h: Likewise.
5401 * output.cc: Likewise.
5402 * output.h: Likewise.
5403 * parameters.cc: Likewise.
5404 * plugin.cc: Likewise.
5405 * powerpc.cc: Likewise.
5406 * reduced_debug_output.cc: Likewise.
5407 * reduced_debug_output.h: Likewise.
5408 * reloc.cc: Likewise.
5409 * reloc.h: Likewise.
5410 * resolve.cc: Likewise.
5411 * script-sections.cc: Likewise.
5412 * script.cc: Likewise.
5413 * script.h: Likewise.
5414 * sparc.cc: Likewise.
5415 * symtab.cc: Likewise.
5416 * symtab.h: Likewise.
5417 * target-select.cc: Likewise.
5418 * target-select.h: Likewise.
5419 * token.h: Likewise.
5420 * workqueue.cc: Likewise.
5421 * workqueue.h: Likewise.
5422 * x86_64.cc: Likewise.
5424 2009-12-10 Doug Kwan <dougkwan@google.com>
5426 * arm.cc (attributes.h): New include.
5427 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5428 (Arm_relobj::~Arm_relobj): Delete object pointed by
5429 attributes_section_data_.
5430 (Arm_relobj::attributes_section_data): New method definition.
5431 (Arm_relobj::attributes_section_data_): New data member declaration.
5432 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5433 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5434 attributes_section_data_.
5435 (Arm_dynobj::attributes_section_data): New method definition.
5436 (Arm_dynobj::attributes_section_data_): New data member declaration.
5437 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5438 initialization value of may_use_blx_ to false.
5439 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5440 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5441 object attributes to compute results instead of hard-coding.
5442 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5443 Target_arm::get_secondary_compatible_arch,
5444 Target_arm::set_secondary_compatible_arch
5445 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5446 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5447 New method declarations.
5448 (Target_arm::get_aeabi_object_attribute): New method definition.
5449 (Target_arm::attributes_section_data_): New data member declaration.
5450 (read_arm_attributes_section): New template definition.
5451 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5452 (Arm_dynobj::do_read_symbols): Ditto.
5453 (Target_arm::do_finalize_sections): Merge attributes sections from
5454 input. Check for BLX use after attributes section merging.
5455 Fix __exidx_start and __exidx_end visibility. Create an
5456 .ARM.attributes section if necessary.
5457 (Target_arm::get_secondary_compatible_arch,
5458 Target_arm::set_secondary_compatible_arch,
5459 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5460 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5461 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5462 New method definitions.
5464 2009-12-09 Ian Lance Taylor <iant@google.com>
5466 * plugin.cc (Plugin::load): Don't cast from void* to a function
5469 2009-12-09 Ian Lance Taylor <iant@google.com>
5471 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5474 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5476 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5477 Replace two_file_shared_1.so with two_file_shared_2.so.
5478 * testsuite/Makefile.in: Regenerated.
5480 2009-12-08 Doug Kwan <dougkwan@google.com>
5482 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5483 (HFILES): Add attributes.h and int_encoding.h.
5484 * Makefile.in: Regenerate.
5485 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5486 function definitions to int_encoding.cc
5487 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5488 prototypes to int_encoding.h
5489 * reduced_debug_output.cc (int_encoding.h): New include.
5490 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5491 function definitions to int_encoding.cc
5492 (insert_into_vector, read_from_pointer): Move template definitions to
5494 * attributes.cc: New file.
5495 * attributes.h: New file.
5496 * int_encoding.cc: New file.
5497 * int_encoding.h: New file.
5499 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5502 * incremental-dump.cc (dump_incremental_inputs): New.
5503 (main): Use dump_incremental_inputs.
5505 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5508 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5509 checking elfcpp::STT_FUNC.
5510 (Target_i386::Relocate::relocate): Likewise.
5511 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5513 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5514 symbols from shared libraries into normal FUNC symbols.
5516 * symtab.h (Symbol): Add is_func and use it.
5518 2009-12-05 Doug Kwan <dougkwan@google.com>
5520 * arm.cc (Target_arm::arm_info): Initialize new fields
5521 attributes_section and attributes_vendor.
5522 * i386.cc (Target_i386::i386_info): Same.
5523 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5524 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5525 fields attributes_section and attributes_vendor.
5526 * sparc.cc (Target_sparc::sparc_info): Same.
5527 * target.h (Target::attributes_section, Target::attributes_vendor,
5528 Target::is_attributes_section, Target::attribute_arg_type,
5529 Target::attributes_order): New method definitions.
5530 (Target::Target_info::attributes_section,
5531 Target::Target_info::attributes_vendor): New fields.
5532 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5533 virtual method definitions.
5534 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5535 attributes_section and attributes_vendor.
5536 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5538 2009-12-05 Doug Kwan <dougkwan@google.com>
5540 * arm.cc: Update comments about interworking and stub generation.
5541 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5542 considered as non-PIC.
5543 (Arm_relocate_functions::base_abs): Fix formatting.
5544 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5545 of function to use GOT entry address instead of offset.
5546 (Target_arm::Scan::global): Issue an error if a symbol would need a
5547 PLT does not get one because it is untyped. Remove code to create
5548 dynamic symbols for relative branches.
5549 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5550 takes unsigned integer instead of boolean.
5552 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5554 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5555 (two_file_test_LDADD): Likewise.
5556 (common_test_1_LDADD): Likewise.
5557 (exception_test_LDADD) Likewise.
5558 (weak_test_LDADD): Likewise.
5559 (many_sections_test_LDADD): Likewise.
5560 (initpri1_LDADD): Likewise.
5561 (script_test_1_LDADD): Likewise.
5562 (script_test_2_LDADD): Likewise.
5563 (justsyms_LDADD): Likewise.
5564 (binary_test_LDADD): Likewise.
5565 (large_LDADD): Likewise.
5566 * testsuite/Makefile.in: Regenerated.
5568 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5570 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5571 (Symbol_table::override_with_special): Likewise.
5572 (Symbol_table::add_from_object): Likewise.
5574 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5576 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5577 Don't set the data_offset twice.
5579 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5581 * testsuite/Makefile.in: Regenerate.
5583 2009-12-03 Doug Kwan <dougkwan@google.com>
5585 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5586 (Target_arm::do_finalize_sections): Add parameter for symbol table
5587 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5588 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5589 parameter for symbol table pointer.
5590 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5591 an additional parameter for a pointer to symbol table.
5592 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5593 parameter for a symbol table pointer.
5594 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5595 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5597 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5598 parameter for a symbol table pointer.
5600 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5602 * incremental.cc (Incremental_inputs_header)
5603 (Incremental_inputs_header_write, Incremental_inputs_entry)
5604 (Incremental_inputs_entry_write): Move ...
5605 * incremental.h (Incremental_inputs_header)
5606 (Incremental_inputs_header_write, Incremental_inputs_entry)
5607 (Incremental_inputs_entry_write): here.
5609 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5611 * incremental.cc (make_sized_incremental_binary): Set the target.
5612 Error if it is incompatible.
5613 * output.h (Output_file): Add filename method.
5615 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5617 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5618 from the get_* methods.
5620 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5622 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5623 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5624 Write 0 for the data_offset of scripts.
5626 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5628 * testsuite/Makefile.am: Add the incremental_test.sh test.
5629 * testsuite/incremental_test.sh: New.
5630 * testsuite/incremental_test_1.c: New.
5631 * testsuite/incremental_test_2.c: New.
5633 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5635 * incremental-dump.cc (main): Fix typos.
5637 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5640 * incremental-dump.cc (main): Use llu to print 64 bit values.
5642 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5643 H.J. Lu <hongjiu.lu@intel.com>
5645 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5647 (incremental_dump_LDADD): Likewise.
5648 * Makefile.in: Regenerated.
5650 2009-11-25 Doug Kwan <dougkwan@google.com>
5654 2009-11-25 Doug Kwan <dougkwan@google.com>
5656 * arm.cc (Target_arm::Target_arm): Move method definition
5657 outside of class definition. Add code to handle
5658 --target1-rel, --target1-abs and --target2= options.
5659 (Target_arm::get_reloc_reloc_type): Change method to be
5660 non-static and const.
5661 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5662 New data member declaration.
5663 (Target_arm::Scan::local, Target_arm::Scan::global,
5664 Target_arm::Relocate::relocate,
5665 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5666 Adjust call to Target_arm::get_real_reloc_type.
5667 (Target_arm::get_real_reloc_type): Use command line options
5668 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5669 * options.h (--target1-rel, --target1-abs, --target2): New
5672 2009-11-25 Doug Kwan <dougkwan@google.com>
5674 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5675 class definition. Add code to handle --target1-rel, --target1-abs
5676 and --target2= options.
5677 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5679 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5681 (Target_arm::Scan::local, Target_arm::Scan::global,
5682 Target_arm::Relocate::relocate,
5683 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5684 call to Target_arm::get_real_reloc_type.
5685 (Target_arm::get_real_reloc_type): Use command line options to
5686 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5687 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5690 2009-11-25 Doug Kwan <dougkwan@google.com>
5692 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5693 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5694 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5696 (Arm_relocate_functions::thm_call): Replace body with a call to
5697 Arm_relocate_functions::thumb_branch_common.
5698 (Arm_relocate_functions::thm_jump24,
5699 Arm_relocate_functions::thm_xpc22): New method definitions.
5700 (Arm_relocate_functions::thumb_branch_common): New method definition.
5701 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5703 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5704 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5706 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5708 * Makefile.am: Build incremental-dump
5709 * Makefile.in: Regenerate.
5710 * incremental-dump.cc: New.
5711 * incremental.cc (Incremental_inputs_header_data,
5712 Incremental_inputs_entry_data): Move to incremental.h
5713 * incremental.h: (Incremental_inputs_header_data,
5714 Incremental_inputs_entry_data): Move from incremental.cc
5716 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5718 * incremental.cc (Incremental_inputs_header,
5719 Incremental_inputs_header_write, Incremental_inputs_entry,
5720 Incremental_inputs_entry_write): Add a typedef with the data type.
5722 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5724 * incremental.cc (Incremental_inputs_header,
5725 Incremental_inputs_header_write, Incremental_inputs_entry,
5726 Incremental_inputs_entry_write): Update comment about which
5727 type has the filed descriptions.
5729 2009-11-15 Doug Kwan <dougkwan@google.com>
5731 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5732 (Arm_relocate_functions::arm_branch_common): Change method defintion
5733 in class definition to a method declaration and update list of formal
5735 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5736 Arm_relocation_functions::jump24): Adjust call to
5737 Arm_relocate_functions::arm_branch_common. Update list of formal
5739 (Arm_relocate_functions::xpc25): New method definition.
5740 (Arm_relocate_functions::arm_branch_common): Move method defintion
5741 out from class definition. Use stubs for mode-switching and extending
5743 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5744 specially. Change code to enable use of stubs in ARM branches.
5746 2009-11-10 Doug Kwan <dougkwan@google.com>
5748 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5749 in method declaration.
5750 (Target_arm::relocate_stub): New method declaration.
5751 (Target_arm::default_target): Change to return a pointer instead of
5753 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5754 Target_arm::default_target.
5755 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5757 (Target_arm::relocate_section): Adjust view.
5758 (Target_arm::relocate_stub): New method definition.
5760 2009-11-10 Doug Kwan <dougkwan@google.com>
5762 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5764 * incremental.cc (open_incremental_binary): Initialized local
5765 variables to avoid warnings.
5766 * object.cc (make_elf_object): Ditto.
5767 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5770 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5773 * testsuite/plugin_test.c: Include "config.h".
5775 2009-11-09 Doug Kwan <dougkwan@google.com>
5777 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5778 (arm_symbol_value): Remove.
5779 (Arm_relocate_functions::arm_branch_common,
5780 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5781 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5782 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5783 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5784 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5785 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5786 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5787 Arm_relocate_functions::thm_mobw_abs_nc,
5788 Arm_relocate_functions::thm_mov_abs,
5789 Arm_relocate_functions::movw_prel_nc,
5790 Arm_relocate_functions::thm_movt_abs,
5791 Arm_relocate_functions::movt_prel,
5792 Arm_relocate_functions::thm_movw_prel_nc,
5793 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5794 (Target_arm::Relocate::relocate): Only decompose address into two
5795 parts if relocation type uses the thumb-bit and pass the actual
5796 bit instead of a flag indicating that the thumb-bit is used. Adjust
5797 calls to methods in Arm_relocate_functions for this change.
5799 2009-11-08 Ian Lance Taylor <iant@google.com>
5802 * reloc.cc: Instantiate
5803 Sized_relobj::initialize_input_to_output_maps and
5804 Sized_relobj:free_input_to_output_maps.
5806 2009-11-06 Ian Lance Taylor <iant@google.com>
5809 * defstd.cc (in_segment): Set only_if_ref true for "end".
5811 2009-11-06 Doug Kwan <dougkwan@google.com>
5813 * arm.cc (class Reloc_stub): Correct a comment.
5814 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5815 (Target_arm::scan_section_for_stubs): New method declaration.
5816 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5817 Change methods from private to protected.
5818 (Target_arm::do_may_relax): New method definition.
5819 (Target_arm::do_relax, Target_arm::group_sections,
5820 Target_arm::scan_reloc_for_stub,
5821 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5822 (Target_arm::arm_input_section_map_): New data member declaration.
5823 (Target_arm::scan_reloc_for_stub,
5824 Target_arm::scan_reloc_section_for_stubs,
5825 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5826 Target_arm::do_relax): New method definitions.
5828 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5830 * configure.ac: Check for (struct stat)::st_mtim
5831 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5832 * config.in: Regenerate.
5833 * configure: Regenerate.
5835 2009-11-05 Ian Lance Taylor <iant@google.com>
5838 * output.cc (Output_segment::add_output_section): Add missing
5841 2009-11-04 Ian Lance Taylor <iant@google.com>
5844 * object.h (class Object): Add is_needed and set_is_needed
5845 methods. Add is_needed_ field. Make bool fields into bitfields.
5846 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5847 defined in a dynamic object and referenced by a regular object,
5848 set is_needed for the dynamic object.
5849 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5850 if the file is marked with as_needed and it is not needed.
5852 2009-11-04 Ian Lance Taylor <iant@google.com>
5855 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5856 tags if data is discarded by linker script.
5857 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5858 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5859 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5860 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5862 2009-11-04 Ian Lance Taylor <iant@google.com>
5864 * layout.cc (Layout::get_output_section): Add is_interp and
5865 is_dynamic_linker_section parameters. Change all callers.
5866 (Layout::choose_output_section): Likewise.
5867 (Layout::make_output_section): Likewise.
5868 (Layout::add_output_section_data): Add is_dynamic_linker_section
5869 parameter. Change all callers.
5870 * layout.h (class Layout): Update declarations.
5871 * output.h (class Output_section): Add is_interp, set_is_interp,
5872 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5873 Add is_interp_, is_dynamic_linker_section_ fields. Change
5874 generate_code_fills_at_write_ to a bitfield.
5875 * output.cc (Output_section::Output_sections): Initialize new
5877 (Output_segment::add_output_section): Add do_sort parameter.
5880 2009-11-03 Ian Lance Taylor <iant@google.com>
5883 * options.h (class General_options): Add --warn-common.
5884 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5885 merging two common symbols.
5886 (Symbol_table::should_override): Handle --warn-common when merging
5887 a common symbol with a defined symbol. Use report_resolve_problem
5888 for multiple definitions.
5889 (Symbol_table::report_resolve_problem): New function.
5890 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5892 2009-11-03 Doug Kwan <dougkwan@google.com>
5894 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5896 (Target_arm::stub_factory): New method definition.
5897 (Target_arm::new_arm_input_section,
5898 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5899 Target_arm::reloc_uses_thumb_bit): New method declarations.
5900 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5901 New type definitions.
5902 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5903 member declarations.
5904 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5905 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5906 New method definitions.
5908 2009-11-03 Ian Lance Taylor <iant@google.com>
5910 * options.h (class General_options): Add --warn_constructors.
5912 2009-11-03 Ian Lance Taylor <iant@google.com>
5915 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5916 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5918 2009-11-03 Ian Lance Taylor <iant@google.com>
5921 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5922 --msgid-bugs-address.
5923 (install-pdf): New target.
5924 (install-data_yes): Look up one directory to find mkinstalldirs.
5926 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5928 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5931 2009-10-30 Doug Kwan <dougkwan@google.com>
5933 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5935 2009-10-30 Doug Kwan <dougkwan@google.com>
5937 * arm.cc (Stub_addend_reader): New struct template definition
5938 and partial specializations.
5939 (Stub_addend_reader::operator()): New method definition for a
5940 partially specialized template.
5942 2009-10-30 Doug Kwan <dougkwan@google.com>
5944 * arm.cc (Arm_relobj::processor_specific_flags): New method
5946 (Arm_relobj::do_read_symbols): New method declaration.
5947 (Arm_relobj::processor_specific_flags_): New data member declaration.
5948 (Arm_dynobj): New class definition.
5949 (Target_arm::do_finalize_sections): Add input_objects parameter.
5950 (Target_arm::do_adjust_elf_header): New method declaration.
5951 (Target_arm::are_eabi_versions_compatible,
5952 (Target_arm::merge_processor_specific_flags): New method declaration.
5953 (Target_arm::do_make_elf_object): New overloaded method definitions
5955 (Arm_relobj::do_read_symbols): New method definition.
5956 (Arm_dynobj::do_read_symbols): Ditto.
5957 (Target_arm::do_finalize_sections): Add input_objects parameters.
5958 Merge processor-specific flags from all input objects.
5959 (Target_arm::are_eabi_versions_compatible,
5960 Target_arm::merge_processor_specific_flags,
5961 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5962 New method definitions.
5963 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5964 Input_objects pointer type parameter.
5965 * layout.cc (Layout::finalize): Pass input objects to target's.
5966 finalize_sections function.
5967 * output.cc (Output_file_header::do_sized_write): Set ELF file
5968 header's processor-specific flags.
5969 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5970 Input_objects pointer type parameter.
5971 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5972 * target.h (Input_objects): New forward class declaration.
5973 (Target::processor_specific_flags,
5974 Target::are_processor_specific_flags_sect): New method definitions.
5975 (Target::finalize_sections): Add input_objects parameter.
5976 (Target::Target): Initialize processor_specific_flags_ and
5977 are_processor_specific_flags_set_.
5978 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5980 (Target::set_processor_specific_flags): New method definition.
5981 (Target::processor_specific_flags_,
5982 Target::are_processor_specific_flags_set_): New data member
5984 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5985 Input_objects pointer type parameter.
5987 2009-10-30 Doug Kwan <dougkwan@google.com>
5989 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5991 2009-10-28 Ian Lance Taylor <iant@google.com>
5993 * object.h (class Relobj): Drop options parameter from
5994 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5995 do_scan_relocs, do_relocate. Change all callers.
5996 (class Sized_relobj): Drop options parameters from
5997 do_gc_process_relocs, do_scan_relocs, do_relocate,
5998 do_relocate_sections, relocate_sections, emit_relocs_scan,
5999 emit_relocs_scan_reltype. Change all callers.
6000 (struct Relocate_info): Remove options field and all references to
6002 * reloc.h (class Read_relocs): Remove options constructor
6003 parameter and options_ field. Change all callers.
6004 (class Gc_process_relocs, class Scan_relocs): Likewise.
6005 (class Relocate_task): Likewise.
6006 * target-reloc.h (scan_relocs): Remove options parameter. Change
6008 (scan_relocatable_relocs): Likewise.
6009 * target.h (class Sized_target): Remove options parameter from
6010 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6012 * gc.h (gc_process_relocs): Remove options parameter. Change all
6014 * arm.cc: Update functions to remove options parameters.
6015 * i386.cc: Likewise.
6016 * powerpc.cc: Likewise.
6017 * sparc.cc: Likewise.
6018 * x86_64.cc: Likewise.
6019 * testsuite/testfile.cc: Likewise.
6021 2009-10-28 Doug Kwan <dougkwan@google.com>
6023 * arm.cc (Arm_relobj): New class definition.
6024 (Arm_relobj::scan_sections_for_stubs,
6025 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6026 New method definitions.
6028 2009-10-28 Cary Coutant <ccoutant@google.com>
6030 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6031 (Plugin::cleanup_done_): New member.
6032 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6033 (Plugin_manager::cleanup_done_): Remove.
6034 (Plugin_manager::add_input_file): Edit error message.
6035 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6036 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6038 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6040 * fileread.cc: (File_read::View::~View): Use the new
6041 data_ownership_ filed.
6042 (File_read::~File_read): Dispose the new whole_file_view_.
6043 (File_read::open): Mmap the whole file if needed.
6044 (File_read::open): Use whole_file_view_ instead of contents_.
6045 (File_read::find_view): Use whole_file_view_ if applicable.
6046 (File_read::do_read): Use whole_file_view_ instead of contents_.
6047 (File_read::make_view): Use whole_file_view_ instead of contents_,
6048 update File_read::View::View call.
6049 (File_read::find_or_make_view): Update File_read::View::View
6051 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6053 (File_read::View::Data_ownership): New enum.
6054 (File_read::View::View): Replace bool mapped_ with Data_ownership
6056 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6057 (File_read::View::data_ownership_): New field.
6058 (File_read::contents_): Remove (replaced by whole_file_view_).
6059 (File_read::whole_file_view_): New field.
6060 * options.h (class General_options): Add --keep-files-mapped.
6062 2009-10-27 Cary Coutant <ccoutant@google.com>
6064 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6065 * testsuite/Makefile.am (plugin_test_5): New test case.
6066 * testsuite/Makefile.in: Regenerate.
6068 2009-10-25 Doug Kwan <dougkwan@google.com>
6070 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6071 from private to protected to allow access by child class.
6072 (Sized_relobj::do_relocate_sections): New method declaration.
6073 (Sized_relobj::relocate_sections): Virtualize.
6074 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6075 Sized_relobj::relocate_sections. Instantiate template explicitly
6076 for different target sizes and endianity.
6078 2009-10-24 Doug Kwan <dougkwan@google.com>
6080 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6081 (Arm_input_section::as_arm_input_section): New method.
6082 (Arm_output_section): New class definition.
6083 (Arm_output_section::create_stub_group,
6084 Arm_output_section::group_sections): New method definitions.
6086 2009-10-22 Doug Kwan <dougkwan@google.com>
6088 * arm.cc (Arm_input_section): New class definition.
6089 (Arm_input_section::init, Arm_input_section:do_write,
6090 Arm_input_section::set_final_data_size,
6091 Arm_input_section::do_reset_address_and_file_offset): New method
6094 2009-10-21 Doug Kwan <dougkwan@google.com>
6096 * arm.cc (Stub_table, Arm_input_section): New forward class
6098 (Stub_table): New class defintion.
6099 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6100 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6101 New method definition.
6103 2009-10-21 Doug Kwan <dougkwan@google.com>
6105 * arm.cc: Update copyright comments.
6106 (Target_arm): New forward class template declaration.
6107 (Arm_address): New type.
6108 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6109 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6110 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6112 (Insn_template): Same.
6113 (DEF_STUBS): New macro.
6114 (Stub_type): New enum type.
6115 (Stub_template): New class definition.
6118 (Stub_factory): Same.
6119 (Target_arm::Target_arm): Initialize may_use_blx_ and
6120 should_force_pic_veneer_.
6121 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6122 Target_arm::should_force_pic_veneer,
6123 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6124 Target_arm::using_thumb_only, Target_arm:;default_target): New
6126 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6127 New data member declarations.
6128 (Insn_template::size, Insn_template::alignment): New method defintions.
6129 (Stub_template::Stub_template): New method definition.
6130 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6131 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6132 (Stub_factory::Stub_factory): New method definition.
6133 * gold.h (string_hash): New template.
6134 * output.h (Input_section_specifier::hash_value): Use
6136 (Input_section_specifier::string_hash): Remove.
6137 * stringpool.cc (Stringpool_template::string_hash): Use
6140 2009-10-20 Doug Kwan <dougkwan@google.com>
6142 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6143 symbols of relaxed input sections.
6144 * output.h (Output_section::find_relaxed_input_section): Make
6147 2009-10-16 Doug Kwan <dougkwan@google.com>
6149 * dynobj.cc (Versions::Versions): Initialize version_script_.
6150 Only insert base version symbol definition for a shared object
6151 if version script defines any version versions.
6152 (Versions::define_base_version): New method definition.
6153 (Versions::add_def): Check that base version is not needed.
6154 (Versions::add_need): Define base version lazily.
6155 * dynobj.h (Versions::define_base_version): New method declaration.
6156 (Versions::needs_base_version_): New data member declaration.
6157 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6158 (check_DATA): Add no_version_test.stdout.
6159 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6161 * testsuite/Makefile.in: Regenerate.
6162 * testsuite/no_version_test.c: New file.
6163 * testsuite/no_version_test.sh: Ditto.
6165 2009-10-16 Doug Kwan <dougkwan@google.com>
6167 * expression.cc (class Segment_start_expression): New class definition.
6168 (Segment_start_expression::value): New method definition.
6169 (script_exp_function_segment_start): Return a new
6170 Segment_start_expression.
6171 * gold/script-c.h (script_saw_segment_start_expression): New function
6173 * script-sections.cc (Script_sections::Script_sections): Initialize
6174 SAW_SEGMENT_START_EXPRESSION_ to false.
6175 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6176 and -Tbbs options to specify section addresses if given in
6177 command line and no SEGMENT_START expression is seen in a script.
6178 * script-sections.h (Script_sections::saw_segment_start_expression,
6179 Script_sections::set_saw_segment_start_expression): New method
6181 (Script_sections::saw_segment_start_expression_): New data member
6183 * script.cc (script_saw_segment_start_expression): New function.
6184 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6185 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6186 script_test_7.sh and script_test_8.sh.
6187 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6188 script_test_8.stdout.
6189 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6190 (script_test_6, script_test_6.stdout, script_test_7,
6191 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6192 * Makefile.in: Regenerate.
6193 * testsuite/script_test_6.sh: New file.
6194 * testsuite/script_test_6.t: Same.
6195 * testsuite/script_test_7.sh: Same.
6196 * testsuite/script_test_7.t: Same.
6197 * testsuite/script_test_8.sh: Same.
6199 2009-10-16 Doug Kwan <dougkwan@google.com>
6201 * output.cc (Output_segment::set_section_list_address): Cast
6202 expressions to unsigned long long type to avoid format warnings.
6204 2009-10-15 Ian Lance Taylor <iant@google.com>
6206 * script.cc (Script_options::add_symbol_assignment): Always add a
6207 dot assignment to script_sections_.
6208 * script-sections.cc (Script_sections::add_dot_assignment):
6209 Initialize if necessary.
6211 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6212 program headers with no load segment if there is a linker script.
6214 * layout.cc (Layout::set_segment_offsets): Align the file offset
6215 to the segment aligment for -N or -n with no load segment.
6216 * output.cc (Output_segment::add_output_section): Don't crash if
6217 the first section is a TLS section.
6218 (Output_segment::set_section_list_addresses): Print an error
6219 message if the address moves backward in a linker script.
6220 * script-sections.cc
6221 (Output_section_element_input::set_section_addresses): Don't
6222 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6223 (Orphan_output_section::set_section_addresses): Likewise.
6225 2009-10-15 Doug Kwan <dougkwan@google.com>
6227 * layout.cc (Layout::finish_dynamic_section): Generate tags
6228 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6229 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6230 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6232 2009-10-14 Ian Lance Taylor <iant@google.com>
6234 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6236 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6237 data_shdr fields of relinfo.
6238 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6239 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6240 R_386_TLS_LDO_32, adjust based on section flags.
6241 (Target_i386::Relocate::fix_up_ldo): Remove.
6243 2009-10-13 Ian Lance Taylor <iant@google.com>
6245 Add support for -pie.
6246 * options.h (class General_options): Add -pie and
6248 (General_options::output_is_position_independent): Test -pie.
6249 (General_options::output_is_executable): Return true if not shared
6250 and not relocatable.
6251 (General_options::output_is_pie): Remove.
6252 * options.cc (General_options::finalize): Reject incompatible uses
6254 * gold.cc (queue_middle_tasks): A -pie link is not static.
6255 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6256 * symtab.cc (Symbol::final_value_is_known): Return false if
6257 output_is_position_independent.
6258 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6259 output_is_position_independent.
6260 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6261 output_is_position_independent.
6262 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6263 output_is_position_independent.
6264 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6266 (basic_pie_test.o, basic_pie_test): New targets.
6267 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6268 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6269 (two_file_pie_test): New target.
6270 * testsuite/Makefile.in: Rebuild.
6271 * README: Remove note saying that -pie is not supported.
6273 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6275 * options.h (class General_options): Add -init and -fini.
6276 * layout.cc (Layout::finish_dynamic_section): Emit
6277 given init and fini functions.
6279 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6281 * gc.h (gc_process_relocs): Check if icf is enabled using new
6283 * gold.cc (queue_initial_tasks): Likewise.
6284 (queue_middle_tasks): Likewise.
6285 * object.cc (do_layout): Likewise.
6286 * symtab.cc (is_section_folded): Likewise.
6287 * main.cc (main): Likewise.
6288 * reloc.cc (Read_relocs::run): Likewise.
6289 (Sized_relobj::do_scan_relocs): Likewise.
6290 * icf.cc (is_function_ctor_or_dtor): New function.
6291 (Icf::find_identical_sections): Check if function is ctor or dtor when
6293 * options.h (General_options::icf): Change option to be an enum.
6294 (Icf_status): New enum.
6295 (icf_enabled): New method.
6296 (icf_safe_folding): New method.
6297 (set_icf_status): New method.
6298 (icf_status_): New variable.
6299 * (options.cc) (General_options::finalize): Set icf_status_.
6300 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6301 icf_test and icf_keep_unique_test to use the --icf enum flag.
6302 * testsuite/icf_safe_test.sh: New file.
6303 * testsuite/icf_safe_test.cc: New file.
6305 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6307 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6308 includes to gc.h and icf.h.
6309 * arm.cc: Include gc.h.
6310 * gold.cc: Likewise.
6311 * i386.cc: Likewise.
6312 * powerpc.cc: Likewise.
6313 * sparc.cc: Likewise.
6314 * x86_64.cc: Likewise.
6315 * gc.h: Include icf.h.
6317 2009-10-11 Ian Lance Taylor <iant@google.com>
6319 * plugin.cc: Include "gold.h" before other header files.
6321 2009-10-10 Chris Demetriou <cgd@google.com>
6323 * options.h (Input_file_argument::Input_file_type): New enum.
6324 (Input_file_argument::is_lib_): Replace with...
6325 (Input_file_argument::type_): New member.
6326 (Input_file_argument::Input_file_argument): Take Input_file_type
6327 'type' rather than boolean 'is_lib' as second argument.
6328 (Input_file_argument::is_lib): Use type_.
6329 (Input_file_argument::is_searched_file): New function.
6330 (Input_file_argument::may_need_search): Handle is_searched_file.
6331 * options.cc (General_options::parse_library): Support -l:filename.
6332 (General_options::parse_just_symbols): Update for Input_file_argument
6334 (Command_line::process): Likewise.
6335 * archive.cc (Archive::get_file_and_offset): Likewise.
6336 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6337 * script.cc (read_script_file, script_add_file): Likewise.
6338 * fileread.cc (Input_file::Input_file): Likewise.
6339 (Input_file::will_search_for): Handle is_searched_file.
6340 (Input_file::open): Likewise.
6341 * readsyms.cc (Read_symbols::get_name): Likewise.
6342 * testsuite/Makefile.am (searched_file_test): New test.
6343 * testsuite/Makefile.in: Regenerate.
6344 * testsuite/searched_file_test.cc: New file.
6345 * testsuite/searched_file_test_lib.cc: New file.
6347 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6348 Ian Lance Taylor <iant@google.com>
6350 * descriptor.cc: Include <cstdio> and "binary-io.h".
6351 (Descriptors::open): Open the files in binary mode always.
6352 * script.cc (Lex::get_token): Treat \r as whitespace.
6354 2009-10-09 Ian Lance Taylor <iant@google.com>
6356 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6358 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6359 Ian Lance Taylor <iant@google.com>
6361 * configure.ac: Check for readv function also.
6362 * fileread.cc (readv): Define if not HAVE_READV.
6363 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6365 * config.in: Regenerate.
6366 * configure: Regenerate.
6368 2009-10-09 Doug Kwan <dougkwan@google.com>
6370 * layout.cc (Layout::make_output_section): Call target hook to make
6371 ordinary output section.
6372 (Layout::finalize): Adjust parameter list of call the
6373 Target::may_relax().
6374 * layout.h (class Layout::section_list): New method.
6375 * merge.h (Output_merge_base::entsize): Change visibility to public.
6376 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6378 (Output_merge_string::do_is_string): New method.
6379 * object.cc (Sized_relobj::do_setup): renamed from
6380 Sized_relobj::set_up.
6381 * object.h (Sized_relobj::adjust_shndx,
6382 Sized_relobj::initializ_input_to_output_maps,
6383 Sized_relobj::free_input_to_output_maps): Change visibilities to
6385 (Sized_relobj::setup): Virtualize.
6386 (Sized_relobj::do_setup): New method declaration.
6387 (Sized_relobj::invalidate_section_offset,
6388 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6389 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6390 * options.cc (parse_int): New function.
6391 * options.h (parse_int): New declaration.
6392 (DEFINE_int): New macro.
6393 (stub_group_size): New option.
6394 * output.cc (Output_section::Output_section): Initialize memebers
6395 merge_section_map_, merge_section_by_properties_map_,
6396 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6397 (Output_section::add_input_section): Handled deferred code-fill
6398 generation and remove an old comment.
6399 (Output_section::add_relaxed_input_section): New method definition.
6400 (Output_section::add_merge_input_section): Use merge section by
6401 properties map to speed to search. Update merge section maps
6403 (Output_section::build_relaxation_map): New method definition.
6404 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6406 (Output_section::relax_input_section): Renamed to
6407 Output_section::convert_input_sections_to_relaxed_sections and change
6408 interface to take a vector of pointers to relaxed sections.
6409 (Output_section::find_merge_section,
6410 Output_section::find_relaxed_input_section): New method definitions.
6411 (Output_section::is_input_address_mapped,
6412 Output_section::output_offset, Output_section::output_address):
6413 Use output section data maps to speed up searching.
6414 (Output_section::find_starting_output_address): Add comments.
6415 (Output_section::do_write,
6416 Output_section::write_to_postprocessing_buffer): Do code-fill
6417 generation as appropriate.
6418 (Output_section::get_input_sections): Invalidate relaxed input section
6420 (Output_section::restore_states): Adjust type of checkpoint .
6421 Invalidate relaxed input section map.
6422 * output.h (Output_merge_base): New class declaration.
6423 (Input_section_specifier): New class defintion.
6424 (class Output_relaxed_input_section) Change base class to
6425 Output_section_data_build.
6426 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6427 base class initializer.
6428 (Output_section::add_relaxed_input_section): New method declaration.
6429 (Output_section::Input_section): Change visibility to protected.
6430 (Output_section::Input_section::relobj,
6431 Output_section::Input_section::shndx): Handle relaxed input sections.
6432 Output_section::input_sections) Change visibility to protected. Also
6433 define overload to return a non-const pointer.
6434 (Output_section::Merge_section_properties): New class defintion.
6435 (Output_section::Merge_section_by_properties_map,
6436 Output_section::Output_section_data_by_input_section_map,
6437 Output_section::Relaxation_map): New types.
6438 (Output_section::relax_input_section): Rename method to
6439 Output_section::convert_input_sections_to_relaxed_sections and change
6440 interface to take a vector of relaxed section pointers.
6441 (Output_section::find_merge_section,
6442 Output_section::find_relaxed_input_section,
6443 Output_section::build_relaxation_map,
6444 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6445 New method declarations.
6446 (Output_section::merge_section_map_
6447 Output_section::merge_section_by_properties_map_,
6448 Output_section::relaxed_input_section_map_,
6449 Output_section::is_relaxed_input_section_map_valid_,
6450 Output_section::generate_code_fills_at_write_): New data members.
6451 * script-sections.cc
6452 (Output_section_element_input::set_section_addresses): Call
6453 current_data_size and addralign methods of relaxed input sections.
6454 (Orphan_output_section::set_section_addresses): Call current_data_size
6455 and addralign methods of relaxed input sections.
6456 * symtab.cc (Symbol_table::compute_final_value): Extract template
6457 from the body of Symbol_table::sized_finalize_symbol.
6458 (Symbol_table::sized_finalized_symbol): Call
6459 Symbol_table::compute_final_value.
6460 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6461 (Symbol_table::compute_final_value): New templated method declaration.
6462 * target.cc (Target::do_make_output_section): New method defintion.
6463 * target.h (Target::make_output_section): New method declaration.
6464 (Target::relax): Add more parameters for input objects, symbol table
6465 and layout. Adjust call to do_relax.
6466 (Target::do_make_output_section): New method declaration.
6467 (Target::do_relax): Add parameters for input objects, symbol table
6470 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6472 * pread.c: Include stdio.h.
6474 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6476 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6479 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6481 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6482 Change read_shndx type to unsigned int.
6483 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6485 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6486 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6487 Change read_shndx type to unsigned int.
6488 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6490 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6491 * layout.cc (Layout::create_symtab_sections): Cast the result of
6492 local_symcount * symsize to off_t in the gold_assert.
6494 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6496 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6497 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6499 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6500 (Arm_relocate_functions::thm_abs5): New function.
6501 (Arm_relocate_functions::abs12): New function.
6502 (Arm_relocate_functions::abs16): New function.
6503 (Arm_relocate_functions::base_abs): New function.
6504 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6505 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6506 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6508 (Scan::global): Likewise.
6509 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6510 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6511 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6512 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6515 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6517 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6518 (Arm_relocate_functions::movt_prel): New function.
6519 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6520 (Arm_relocate_functions::thm_movt_prel): New function.
6521 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6522 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6523 (Scan::global, Relocate::relocate): Likewise.
6524 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6526 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6528 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6529 Incremental_checker.
6530 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6532 (class Incremental_inputs_header): New class.
6533 (Incremental_inputs_header_writer): Edit comment.
6534 (Incremental_inputs_entry): New class.
6535 (Incremental_inputs_entry_writer): Edit comment.
6536 (Sized_incremental_binary::do_find_incremental_inputs_section):
6537 Add *strtab_shndx parameter, fill it.
6538 (Sized_incremental_binary::do_check_inputs): New method.
6539 (Incremental_checker::can_incrementally_link_output_file): Use
6540 Sized_incremental_binary::check_inputs.
6541 (Incremental_inputs::report_command_line): Save command line in
6544 (Incremental_binary::find_incremental_inputs_section): New
6546 (Incremental_binary::do_find_incremental_inputs_section): Add
6547 strtab_shndx parameter.
6548 (Incremental_binary::do_check_inputs): New pure virtual method.
6549 (Sized_incremental_binary::do_check_inputs): Declare.
6550 (Incremental_checker::Incremental_checker): Add incremental_inputs
6551 parameter, use it to initialize incremental_inputs_.
6552 (Incremental_checker::incremental_inputs_): New field.
6553 (Incremental_checker::command_line): New method.
6554 (Incremental_checker::inputs): New method.
6555 (Incremental_checker::command_line_): New field.
6557 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6559 * incremental.cc: Include <cstdarg> and "target-select.h".
6560 (vexplain_no_incremental): New function.
6561 (explain_no_incremental): New function.
6562 (Incremental_binary::error): New method.
6563 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6565 (make_sized_incremental_binary): New function.
6566 (open_incremental_binary): New function.
6567 (can_incrementally_link_file): Add checks if output is ELF and has
6569 * incremental.h: Include "elfcpp_file.h" and "output.h".
6570 (Incremental_binary): New class.
6571 (Sized_incremental_binary): New class.
6572 (open_incremental_binary): Declare.
6573 * object.cc (is_elf_object): Use
6574 elfcpp::Elf_recognizer::is_elf_file.
6575 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6576 * output.h (Output_file::filesize): New method.
6578 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6580 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6582 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6583 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6585 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6587 (Arm_relocate_functions::movw_abs_nc): New function.
6588 (Arm_relocate_functions::movt_abs): New function.
6589 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6590 (Arm_relocate_functions::thm_movt_abs): New function.
6591 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6592 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6593 (Scan::global): Likewise.
6594 (Relocate::relocate): Likewise.
6595 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6597 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6599 * arm.cc (Arm_relocate_functions::got_prel) New function.
6600 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6601 (Relocate::relocate): Likewise.
6602 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6604 2009-10-06 Ian Lance Taylor <iant@google.com>
6606 * options.h (class General_options): Define
6607 split_stack_adjust_size parameter.
6608 * object.h (class Object): Add uses_split_stack_ and
6609 has_no_split_stack_ fields. Add uses_split_stack and
6610 has_no_split_stack accessor functions. Declare
6611 handle_split_stack_section.
6612 (class Reloc_symbol_changes): Define.
6613 (class Sized_relobj): Define Function_offsets. Declare
6614 split_stack_adjust, split_stack_adjust_reltype, and
6616 * object.cc (Object::handle_split_stack_section): New function.
6617 (Sized_relobj::do_layout): Call handle_split_stack_section.
6618 * dynobj.cc (Sized_dynobj::do_layout): Call
6619 handle_split_stack_section.
6620 * reloc.cc (Sized_relobj::relocate_sections): Call
6621 split_stack_adjust for executable sections in split_stack
6622 objects. Pass reloc_map to relocate_section.
6623 (Sized_relobj::split_stack_adjust): New function.
6624 (Sized_relobj::split_stack_adjust_reltype): New function.
6625 (Sized_relobj::find_functions): New function.
6626 * target-reloc.h: Include "object.h".
6627 (relocate_section): Add reloc_symbol_changes parameter. Change
6629 * target.h (class Target): Add calls_non_split method. Declare
6630 do_calls_non_split virtual method. Declare match_view and
6632 * target.cc: Include "elfcpp.h".
6633 (Target::do_calls_non_split): New function.
6634 (Target::match_view): New function.
6635 (Target::set_view_to_nop): New function.
6636 * gold.cc (queue_middle_tasks): Give an error if mixing
6637 split-stack and non-split-stack objects with -r.
6638 * i386.cc (Target_i386::relocate_section): Add
6639 reloc_symbol_changes parameter.
6640 (Target_i386::do_calls_non_split): New function.
6641 * x86_64.cc (Target_x86_64::relocate_section): Add
6642 reloc_symbol_changes parameter.
6643 (Target_x86_64::do_calls_non_split): New function.
6644 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6646 * powerpc.cc (Target_powerpc::relocate_section): Add
6647 reloc_symbol_changes parameter.
6648 * sparc.cc (Target_sparc::relocate_section): Add
6649 reloc_symbol_changes parameter.
6650 * configure.ac: Call AM_CONDITIONAL for the default target.
6651 * configure: Rebuild.
6652 * testsuite/Makefile.am (TEST_AS): New variable.
6653 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6654 (check_DATA): Add split_i386 and split_x86_64 files.
6655 (SPLIT_DEFSYMS): Define.
6656 (split_i386_[1234n].o): New targets.
6657 (split_i386_[124]): New targets.
6658 (split_i386_[1234r].stdout): New targets.
6659 (split_x86_64_[1234n].o): New targets.
6660 (split_x86_64_[124]): New targets.
6661 (split_x86_64_[1234r].stdout): New targets.
6662 (MOSTLYCLEANFILES): Add new executables.
6663 * testsuite/split_i386.sh: New file.
6664 * testsuite/split_x86_64.sh: New file.
6665 * testsuite/split_i386_1.s: New file.
6666 * testsuite/split_i386_2.s: New file.
6667 * testsuite/split_i386_3.s: New file.
6668 * testsuite/split_i386_4.s: New file.
6669 * testsuite/split_i386_n.s: New file.
6670 * testsuite/split_x86_64_1.s: New file.
6671 * testsuite/split_x86_64_2.s: New file.
6672 * testsuite/split_x86_64_3.s: New file.
6673 * testsuite/split_x86_64_4.s: New file.
6674 * testsuite/split_x86_64_n.s: New file.
6675 * testsuite/testfile.cc (Target_test): Update relocation_section
6677 * testsuite/Makefile.in: Rebuild.
6679 2009-10-06 Ian Lance Taylor <iant@google.com>
6681 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6682 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6683 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6684 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6685 the address on ldo_addrs_.
6686 (Target_i386::Relocate::fix_up_ldo): New function.
6688 2009-10-06 Rafael Espindola <espindola@google.com>
6690 * plugin.cc (add_input_library): New.
6691 (Plugin::load): Add add_input_library to tv.
6692 (Plugin_manager::add_input_file): Add the is_lib argument.
6693 (add_input_file): Update call to Plugin_manager::add_input_file.
6694 (add_input_library): New.
6695 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6697 2009-09-30 Doug Kwan <dougkwan@google.com>
6699 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6700 symbol and call Symbol::may_need_copy_reloc to determine if
6701 a copy reloc is needed.
6702 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6703 nocopyreloc is given in command line.
6704 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6705 given in command line.
6706 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6707 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6708 of the removed Target_i386::may_need_copy_reloc.
6709 * options.h (copyreloc): New option with default value false.
6710 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6711 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6712 instead of the removed Target_powerpc::may_need_copy_reloc.
6713 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6714 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6715 instead of the removed Target_sparc::may_need_copy_reloc.
6716 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6717 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6718 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6719 instead of the removed Target_x86_64::may_need_copy_reloc.
6721 2009-09-30 Ian Lance Taylor <iant@google.com>
6723 * object.h (class Object): Remove target_ field, and target,
6724 sized_target, and set_target methods.
6725 (Object::sized_target): Remove.
6726 (class Sized_relobj): Update declarations. Remove sized_target.
6727 * object.cc (Sized_relobj::setup): Remove target parameter.
6729 (Input_objects::add_object): Don't do anything with the target.
6730 (make_elf_sized_object): Add punconfigured parameter. Change all
6731 callers. Set or test parameter target.
6732 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6734 * parameters.cc (Parameters::set_target): Change parameter type to
6736 (Parameters::default_target): Remove.
6737 (set_parameters_target): Change parameter type to be non-const.
6738 (parameters_force_valid_target): New function.
6739 (parameters_clear_target): New function.
6740 * parameters.h (class Parameters): Update declarations. Remove
6741 default_target method. Add sized_target and clear_target
6742 methods. Change target_ to be non-const.
6743 (set_parameters_target): Update declaration.
6744 (parameters_force_valid_target): Declare.
6745 (parameters_clear_target): Declare.
6746 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6747 as NULL if we aren't searching.
6748 (Add_symbols::run): Don't check for compatible target.
6749 * fileread.cc (Input_file::open_binary): Call
6750 parameters_force_valid_target.
6751 * gold.cc (queue_middle_tasks): Likewise.
6752 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6753 set_target on object.
6754 * dynobj.h (class Sized_dynobj): Update declarations.
6755 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6756 make_elf_object returns NULL.
6757 (Archive::include_member): Don't check whether object target is
6759 * output.cc (Output_section::add_input_section): Get target from
6761 (Output_section::relax_input_section): Likewise.
6762 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6764 (Sized_relobj::do_scan_relocs): Likewise.
6765 (Sized_relobj::relocate_sections): Likewise.
6766 * resolve.cc (Symbol_table::resolve): Likewise.
6767 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6768 parameter. Change all callers.
6769 (Symbol_table::add_from_object): Get target from parameters.
6770 (Symbol_table::add_from_relobj): Don't check object target.
6771 (Symbol_table::add_from_dynobj): Likewise.
6772 (Symbol_table::define_special_symbol): Get target from
6774 * symtab.h (class Symbol_table): Update declaration.
6775 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6776 parameter. Change all callers. Clear parameter target.
6777 (Binary_test): Test target here.
6778 * testsuite/object_unittest.cc (gold_testsuite): Remove
6779 target_test_pointer parameter. Change all callers.
6780 (Object_test): Test target here.
6782 2009-09-26 Ian Lance Taylor <iant@google.com>
6784 * testsuite/initpri1.c: Don't try to use constructor priorities if
6785 compiling with gcc before 4.3.
6787 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6789 * testsuite/retain_symbols_file_test.sh (check_present): Change
6790 output file name to retain_symbols_file_test.stdout.
6791 (check_absent): Likewise.
6793 2009-09-18 Craig Silverstein <csilvers@google.com>
6795 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6796 * options.cc: Include <cerrno> and <fstream>.
6797 (General_options::finalize): Parse -retain-symbols-file tag.
6798 * options.h: New flag.
6799 (General_options): New method should_retain_symbol, new
6800 variable symbols_to_retain.
6801 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6802 should_retain_symbol map.
6803 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6804 * testsuite/Makefile.in: Regenerate.
6805 * testsuite/retain_symbols_file_test.sh: New file.
6807 2009-09-18 Nick Clifton <nickc@redhat.com>
6809 * po/es.po: Updated Spanish translation.
6811 2009-09-17 Doug Kwan <dougkwan@google.com>
6813 * debug.h (DEBUG_RELAXATION): New constant.
6814 (DEBUG_ALL): Add DEBUG_RELAXATION.
6815 (debug_string_to_enum): Add relaxation debug option.
6817 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6818 Layout::Relaxation_debug_check::read_sections,
6819 Layout::Relaxation_debug_check::read_sections): New method definitions.
6820 (Layout::Layout): Initialize data members
6821 record_output_section_data_from_scrips_,
6822 script_output_section_data_list_ and relaxation_debug_check_.
6823 (Layout::save_segments, Layout::restore_segments,
6824 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6825 Layout::relaxation_loop_body): New method definitions.
6826 (Layout::finalize): Support relaxation. Move section layout code to
6827 Layout::relaxation_loop_body.
6828 (Layout::set_asection_address_from_script): Move code for orphan
6829 section placement out.
6830 (Layout::place_orphan_sections_in_script): New method definition.
6831 * layout.h (Output_segment_headers, Output_file_header):
6832 New forward class declarations.
6833 (Layout::~Layout): Define.
6834 (Layout::new_output_section_data_from_script): New method definition.
6835 (Layout::place_orphan_sections_in_script): New method declaration.
6836 (Layout::Segment_states): New type declaration.
6837 (Layout::save_segments, Layout::restore_segments,
6838 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6839 Layout::relaxation_loop_body): New method declarations.
6840 (Layout::Output_section_data_list): New type declaration.
6841 (Layout::Relaxation_debug_check): New class definition.
6842 (Layout::record_output_section_data_from_script_,
6843 Layout::script_output_section_data_list_, Layout::segment_states_,
6844 Layout::relaxation_debug_check_): New data members.
6845 * output.cc: (Output_section_headers::do_size): New method definition.
6846 (Output_section_headers::Output_section_headers): Move size
6847 computation to Output_section_headers::do_size.
6848 (Output_segment_headers::do_size): New method definition.
6849 (Output_file_header::Output_file_header): Move size computation to
6850 Output_file_header::do_size and call it.
6851 (Output_file_header::do_size): New method definition.
6852 (Output_data_group::Output_data_group): Adjust call to
6853 Output_section_data.
6854 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6855 (Output_symtab_xindex::do_write): Add array bound check.
6856 (Output_section::Input_section::print_to_mapfile): Handle
6857 RELAXED_INPUT_SECTION_CODE.
6858 (Output_section::Output_section): Initialize data member checkpoint_.
6859 (Output_section::~Output_section): Delete checkpoint object pointed
6861 (Output_section::add_input_section): Always add an Input_section if
6863 (Output_section::add_merge_input_section): Add assert.
6864 (Output_section::relax_input_section): New method definition.
6865 (Output_section::set_final_data_size): Set load address to zero for
6866 an unallocated section.
6867 (Output_section::do_address_and_file_offset_have_reset_values):
6868 New method definition.
6869 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6870 Handle relaxed input section.
6871 (Output_section::sort_attached_input_sections): Checkpoint input
6872 section list lazily.
6873 (Output_section::get_input_sections): Change type of input_sections to
6874 list of Simple_input_section pointers. Checkpoint input section list
6875 lazily. Also handle relaxed input sections.
6876 (Output_section::add_input_section_for_script): Take a reference to
6877 a Simple_input_section object instead of Relobj pointer and section
6878 index as parameter. Handle relaxed input sections.
6879 (Output_section::save_states, Output_section::restore_states): New
6881 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6882 (Output_data::is_data_size_fixed): New method definition.
6883 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6885 (Output_data::address_and_file_offset_have_reset_values): New method
6887 (Output_data::do_address_and_file_offset_have_reset_values): New method
6889 (Output_data::set_data_size): Check that data size is not fixed.
6890 (Output_data::fix_data_size): New method definition.
6891 (Output_data::is_data_size_fixed_): New data member.
6892 (Output_section_headers::set_final_data_size): New method definition.
6893 (Output_section_headers::do_size): New method declaration.
6894 (Output_segment_headers::set_final_data_size): New method definition.
6895 (Output_segment_headers::do_size): New method declaration.
6896 (Output_file_header::set_final_data_size)::New method definition.
6897 (Output_file_header::do_size)::New method declaration.
6898 (Output_section_data::Output_section_data): Add new parameter
6899 is_data_size_fixed and use it to fix data size.
6900 (Output_data_const::Output_data_const): Adjust call to base class
6901 constructor and fix data size.
6902 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6903 base class constructor and fix data size.
6904 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6905 base class constructor and fix data size.
6906 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6907 class constructor and fix data size.
6908 (Output_data_group::set_final_data_size): New method definition.
6909 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6910 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6911 class constructor and fix data size.
6912 (Output_relaxed_input_section): New class definition.
6913 (Output_section::Simple_input_section): New class definition.
6914 (Output_section::get_input_sections): Adjust parameter list.
6915 (Output_section::add_input_section_for_script): Same.
6916 (Output_section::save_states, Output_section::restore_states,
6917 Output_section::do_address_and_file_offset_have_reset_values,
6918 (Output_section::Input_section::Input_section): Handle
6919 RELAXED_INPUT_SECTION_CODE. Add new overload for
6920 Output_relaxed_input_section.
6921 (Output_section::Input_section::is_input_section,
6922 Output_section::Input_section::set_output_section): Handle relaxed
6924 (Output_section::Input_section::is_relaxed_input_section,
6925 Output_section::Input_section::output_section_data,
6926 Output_section::Input_section::relaxed_input_section): New method
6928 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6930 (Output_section::Input_section::u1_): Update comments.
6931 (Output_section::Input_section::u2_): Add new union member poris.
6932 (Output_section::Checkpoint_output_section): New classs definition.
6933 (Output_section::relax_input_section): New method declaration.
6934 (Output_section::checkpoint_): New data member.
6935 (Output_segment): Update comments.
6936 (Output_segment::Output_segment): Un-privatize copy constructor.
6937 (Output_segment::operator=): Un-privatize.
6938 * script-sections.cc (Output_section_element::Input_section_list):
6939 Change element type to Output_section::Simple_input_section.
6940 (Output_section_element_dot_assignment::set_section_addresses):
6941 Register output section data for relaxation clean up.
6942 (Output_data_exression::Output_data_expression): Adjust call to base
6943 constructor to fix data size.
6944 (Output_section_element_data::set_section_addresses): Register
6945 Output_data_expression object for relaxation clean up.
6946 (struct Input_section_info): Replace Relobj pointer and section index
6947 pair with Output_section::Simple_input_section and Convert struct to a
6949 (Input_section_sorter::operator()): Adjust access to
6950 Input_section_info data member to use accessors.
6951 (Output_section_element_input::set_section_addresses): Use layout
6952 parameter. Adjust code to use Output_section::Simple_input_section
6953 and Input_secction_info classes. Register filler for relaxation
6955 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6956 and section index pair with Output_section::Simple_input_section
6957 class. Adjust code accordingly.
6958 (Phdrs_element::release_segment): New method definition.
6959 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6961 (Script_sections::release_segments): New method definition.
6962 * gold/script-sections.h (Script_sections::release_segments): New
6964 * gold/target.h (Target::may_relax, Target::relax,
6965 Target::do_may_relax, Target::do_relax): New method definitions.
6967 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6969 * arm.cc (has_signed_unsigned_overflow): New function.
6970 (Arm_relocate_functions::abs8): New function.
6971 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6972 (Target_arm::Scan::global): Likewise.
6973 (Target_arm::relocate::relocate): Likewise.
6974 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6977 2009-09-16 Cary Coutant <ccoutant@google.com>
6979 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6980 * testsuite/Makefile.in: Regenerate.
6982 2009-09-11 Nick Clifton <nickc@redhat.com>
6984 * po/gold.pot: Updated by the Translation project.
6986 2009-09-08 Cary Coutant <ccoutant@google.com>
6988 * output.cc (Output_file::open): Add execute permission to empty file.
6989 * testsuite/Makefile.am (permission_test): New test.
6990 * testsuite/Makefile.in: Regenerate.
6992 2009-09-02 Ian Lance Taylor <iant@google.com>
6994 * output.cc (Output_file::resize): Call map_no_anonymous rather
6997 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
6999 * gold.cc: Include "incremental.h".
7000 (queue_initial_tasks): Call Incremental_checker methods.
7001 * incremental.cc: Include "output.h".
7002 (Incremental_checker::can_incrementally_link_output_file): New
7004 * incremental.h (Incremental_checker): New class.
7006 * output.cc (Output_file::open_for_modification): New method.
7007 (Output_file::map_anonymous): Changed return type to bool. Record
7009 (Output_file::map_no_anonymous): New method, broken out of map.
7010 (Output_file::map): Use map_no_anonymous and map_anonymous.
7011 * output.h (class Output_file): Update declarations.
7013 2009-08-24 Cary Coutant <ccoutant@google.com>
7015 * options.h (Command_line::Pre_options): New class.
7016 (Command_line::pre_options): New member.
7017 * options.cc (gold::options::ready_to_register): New variable.
7018 (One_option::register_option): Do nothing if not registering options.
7019 Assert if same short option registered twice.
7020 (General_options::General_options): Turn off option registration when
7022 (Command_line::Pre_options::Pre_options): New constructor.
7024 2009-08-24 Cary Coutant <ccoutant@google.com>
7026 * options.h (General_options::no_keep_memory): Remove incorrect
7029 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7031 * Makefile.am (am__skiplex, am__skipyacc): New.
7032 * Makefile.in: Regenerate.
7034 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7036 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7037 (INCLUDES): ... this.
7038 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7039 (AM_CPPFLAGS): Renamed from ...
7040 (INCLUDE): ... this.
7041 * Makefile.in, testsuite/Makefile.in: Regenerate.
7043 * Makefile.in: Regenerate.
7044 * aclocal.m4: Likewise.
7045 * config.in: Likewise.
7046 * configure: Likewise.
7047 * testsuite/Makefile.in: Likewise.
7049 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7050 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7051 * Makefile.in: Regenerate.
7052 * testsuite/Makefile.in: Regenerate.
7054 2009-08-19 Cary Coutant <ccoutant@google.com>
7056 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7057 symbols in shared libraries overridden by hidden or internal symbols
7058 in the main program.
7060 2009-08-19 Chris Demetriou <cgd@google.com>
7062 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7063 checking source file names in error messages.
7065 2009-08-18 Doug Kwan <dougkwan@google.com>
7067 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7068 an elcpp::Ehdr as parameter. Adjust call to set_target.
7069 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7070 an elfcpp::Ehdr as parameter.
7071 * object.cc (Object::set_target): Remove the version that looks up
7072 a target and sets it.
7073 (Sized_relobj::setup): Take a Target object instead of
7074 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7075 (make_elf_sized_object): Find target and ask target to
7077 * object.h: (Object::set_target): Remove the version that looks up
7078 a target and sets it.
7079 (Sized_relobj::setup): Take a Target object instead of
7080 an elfcpp:Ehdr as parameter.
7081 * target.cc: Include dynobj.h.
7082 (Target::do_make_elf_object_implementation): New.
7083 (Target::do_make_elf_object): New.
7084 * target.h (Target::make_elf_object): New template declaration.
7085 (Target::do_make_elf_object): New method declarations.
7086 (Target::do_make_elf_object_implementation): New template declaration.
7088 2009-08-14 Ian Lance Taylor <iant@google.com>
7090 * gold.h (FUNCTION_NAME): Define.
7091 (gold_unreachable): Use FUNCTION_NAME.
7093 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7095 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7096 symbol in the --keep-unique list is not found.
7098 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7100 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7101 been maked as --keep-unique.
7102 (Icf::unfold_section): New function.
7103 * icf.h (Icf::unfold_section): New function.
7104 * options.h (General_options::keep_unique): New option.
7105 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7106 * testsuite/Makefile.in: Regenerate.
7107 * testsuite/icf_keep_unique_test.sh: New file.
7108 * testsuite/icf_keep_unique_test.cc: New file.
7110 2009-08-12 Cary Coutant <ccoutant@google.com>
7113 * resolve.cc (Symbol_table::resolve): Check for references from
7114 dynamic objects to hidden and internal symbols.
7115 * testsuite/Makefile.am (hidden_test.sh): New test.
7116 * testsuite/Makefile.in: Regenerate.
7117 * testsuite/hidden_test.sh: New script.
7118 * testsuite/hidden_test_1.c: New test source.
7119 * testsuite/hidden_test_main.c: New test source.
7121 2009-08-11 Doug Kwan <dougkwan@google.com>
7123 * arm.cc: Update comments.
7124 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7125 segment to locate the .ARM.exidx section if present.
7127 2009-08-09 Doug Kwan <dougkwan@google.com>
7129 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7132 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7133 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7136 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7138 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7139 valid tls_segment only for non-debug-section relocations.
7140 * testsuite/Makefile.am: Add gc_tls_test.
7141 * testsuite/Makefile.in: Regenerate.
7142 * testsuite/gc_tls_test.cc: New file.
7143 * testsuite/gc_tls_test.sh: New file.
7145 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7149 * Makefile.am (CCFILES): Add icf.cc.
7151 * Makefile.in: Regenerate.
7152 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7153 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7154 section, symbol and addend information for the relocs.
7155 * gold.cc (queue_middle_tasks): Call identical code folding.
7156 * gold.h: Add defines for multimap.
7157 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7158 to the call of finalize_local_symbols.
7159 * main.cc (main): Create object of class Icf.
7160 * object.cc (Sized_relobj::do_layout): Allow this function to be
7161 called twice during icf.
7162 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7163 to sections marked as identical by icf.
7164 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7166 (Sized_relobj::do_section_entsize): New function.
7167 * object.h (Object::section_entsize): New function.
7168 (Object::do_section_entsize): New pure virtual function.
7169 (Relobj::finalize_local_symbols): Add new parameter.
7170 (Relobj::do_section_entsize): New function.
7171 * options.h (General_options::icf): New option.
7172 (General_options::icf_iterations): New option.
7173 (General_options::print_icf_sections): New option.
7174 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7175 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7176 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7178 * symtab.cc (Symbol_table::is_section_folded): New function.
7179 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7180 to sections marked as identical by icf.
7181 * symtab.h (Symbol_table::set_icf): New function.
7182 (Symbol_table::icf): New function.
7183 (Symbol_table::is_section_folded): New function.
7184 (Symbol_table::icf_): New data member.
7185 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7186 * testsuite/Makefile.am: Add commands to build icf_test.
7187 * testsuite/Makefile.in: Regenerate.
7188 * testsuite/icf_test.sh: New file.
7189 * testsuite/icf_test.cc: New file.
7191 2009-07-24 Chris Demetriou <cgd@google.com>
7193 * layout.cc (is_compressible_debug_section): Fix incorrect
7194 comment about compressed section names.
7196 2009-07-20 Ian Lance Taylor <ian@airs.com>
7199 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7201 2009-07-16 Ian Lance Taylor <iant@google.com>
7204 * layout.h: #include <map>.
7205 (class Kept_section): Change from struct to class. Add accessors
7206 and setters. Add section size to Comdat_group mapping. Change
7207 Comdat_group to std::map. Add is_comdat_ field. Add
7208 linkonce_size field in union.
7209 (class Layout): Update declaration of find_or_add_kept_section.
7210 Don't declare find_kept_object.
7211 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7212 parameter. Add object, shndx, is_comdat, and is_group_name
7213 parameters. Change all callers. Adjust for new Kept_section.
7214 (Layout::find_kept_object): Remove.
7215 * object.cc (Sized_relobj::include_section_group): Update use of
7216 Kept_section. Rename secnum to shndx. Only record
7217 Kept_comdat_section if sections are the same size.
7218 (Sized_relobj::include_linkonce_section): Update use of
7219 Kept_section. Only record Kept_comdat_section if sections are the
7220 same size. Set size of linkonce section.
7221 (Sized_relobj::map_to_kept_section): Update call to
7222 get_kept_comdat_section.
7223 * object.h (class Sized_relobj): Rename fields in
7224 Kept_comdat_section to drop trailing underscores; change object
7225 field to Relobj*. Change Kept_comdat_section_table to store
7226 struct rather than pointer.
7227 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7228 Add kept_object and kept_shndx parameters. Change all callers.
7229 (Sized_relobj::get_kept_comdat_section): Change return type to
7230 bool. Add kept_object and kept_shndx parameters. Change all
7232 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7233 Layout::find_or_add_kept_section.
7235 2009-07-09 Ian Lance Taylor <iant@google.com>
7237 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7238 Reserve space in the hash table.
7240 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7242 * fileread.cc (File_read::get_mtime): New method.
7243 * fileread.h (Timespec): New structure.
7244 (File_read::get_mtime): New method.
7245 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7246 Renamed from timestamp_nsec.
7247 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7249 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7251 (Incremental_inputs::report_archive): Save mtime; style fix.
7252 (Incremental_inputs::report_obejct): Save mtime; style fix.
7253 (Incremental_inputs::report_script): Save mtime; style fix.
7254 (Incremental_inputs::finalize_inputs): Style fix.
7255 (Incremental_inputs::finalize): Style fix.
7256 (Incremental_inputs::create_input_section_data): Store inputs
7258 * incremental.h (Incremental_inputs::report_script): Add mtime
7260 (Incremental_inputs::Input_info::Input_info): Intialize only one
7262 (Incremental_inputs::Input_info::archive): Move to nameless
7264 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7265 (Incremental_inputs::Input_info::script): Move to nameless union.
7266 (Incremental_inputs::mtime): New field.
7267 * script.cc (read_input_script): Pass file mtime to
7269 * script.h (Script_info::inputs): Style fix.
7271 2009-07-01 Ian Lance Taylor <ian@airs.com>
7273 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7276 2009-06-24 Ian Lance Taylor <iant@google.com>
7279 * layout.cc (Layout::choose_output_section): If we find an
7280 existing section, update the flags.
7281 (Layout::create_notes): New function, broken out of
7283 (Layout::finalize): Don't create note sections.
7284 (Layout::create_note): Don't crash if linker script discards
7286 (Layout::create_gold_note): Likewise.
7287 (Layout::create_build_id): Likewise. Don't set
7288 after_input_sections on the section.
7289 (Layout::create_executable_stack_info): Remove target parameter.
7291 * layout.h (class Layout): Declare create_notes. Update
7292 declaration of create_executable_stack_info.
7293 * gold.cc (queue_middle_tasks): Call create_notes.
7294 * output.cc (Output_section::update_flags_for_input_section): Move
7295 here from output.h. If SHF_ALLOC flag is newly set, mark address
7297 * output.h (Output_data::mark_address_invalid): New function.
7298 (class Output_section): Only declare, not define,
7299 update_flags_for_input_section. Remove set_flags.
7301 2009-06-24 Ian Lance Taylor <iant@google.com>
7303 * script-sections.cc (Output_section_definition::
7304 set_section_addresses): Rename shadowing local load_address to
7307 2009-06-24 Ian Lance Taylor <iant@google.com>
7310 * reloc.cc (relocate_sections): Skip empty relocation sections.
7312 2009-06-23 Ian Lance Taylor <iant@google.com>
7315 * layout.cc (Layout::create_note): Use choose_output_section
7316 rather than make_output_section.
7318 2009-06-23 Ian Lance Taylor <iant@google.com>
7321 * options.cc (General_options::parse_V): Set printed_version_.
7322 (General_options::General_options): Initialize printed_version_.
7323 * options.h (class General_options): Add printed_version_ field.
7324 * gold.cc (queue_initial_tasks): If there are no input files,
7325 don't give a fatal error if we printed the version information.
7326 (queue_middle_tasks): If using -r with a shared object, give a
7327 fatal error rather than an ordinary error.
7329 2009-06-23 Ian Lance Taylor <iant@google.com>
7332 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7333 (Layout::make_output_section): Set have_stabstr_section_ if we see
7334 a .stab*str section.
7335 (Layout::finalize): Call link_stabs_sections.
7336 (Layout::link_stabs_sections): New file.
7337 * layout.h (class Layout): Add have_stabstr_section_ field.
7338 Declare link_stabs_sections.
7340 2009-06-23 Doug Kwan <dougkwan@google.com>
7342 * Makefile.am (libgold_a_LIBADD): New.
7343 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7344 * Makefile.in: Regenerate.
7345 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7346 * configure: Regenerate.
7347 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7348 * fileread.cc: Include sys/state.h
7349 * gold.h: Declare memmem and strndup if found missing.
7350 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7352 2009-06-23 Ian Lance Taylor <iant@google.com>
7354 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7355 * configure: Rebuild.
7357 2009-06-23 Ian Lance Taylor <iant@google.com>
7360 * object.cc (Object::section_contents): Don't try to get a view if
7361 the section has length zero.
7362 (Object::handle_gnu_warning_section): If the section is empty, use
7363 the name of the section as the warning.
7365 2009-06-23 Ian Lance Taylor <iant@google.com>
7368 * stringpool.h (class Stringpool_template): Add optimize_ field.
7369 (Stringpool_template::set_optimize): New function.
7370 * stringpool.cc (Stringpool_template::Stringpool_template):
7371 Initialize optimize_ field.
7372 (Stringpool_template::set_string_offsets): Test local optimize
7373 fild rather than parameter.
7374 * layout.cc (Layout::Layout): Call set_optimize on the section
7377 2009-06-22 Ian Lance Taylor <iant@google.com>
7380 * yyscript.y: Parse TARGET.
7381 * script.cc (script_set_target): New function.
7382 * script-c.h (script_set_target): Declare.
7383 * options.cc (General_options::string_to_object_format): Rename
7384 from string_to_object_format in anonymous namespace. Change
7386 * options.h (class General_options): Declare
7387 string_to_object_format.
7389 2009-06-22 Ian Lance Taylor <iant@google.com>
7391 * script-sections.cc (Script_sections::create_segments): Don't put
7392 program headers in a PT_LOAD segment if -n or -N.
7394 2009-06-22 Ian Lance Taylor <iant@google.com>
7397 * options.h (class General_options): Add -z lazy and -z now. Sort
7398 -z options into alphabetical order.
7399 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7401 2009-06-21 Ian Lance Taylor <iant@google.com>
7403 * layout.cc (Layout::make_output_section): Call
7404 Target::new_output_section.
7405 (Layout::attach_allocated_section_to_segment): Put large section
7406 sections in a separate load segment with the large segment flag
7408 (Layout::segment_precedes): Sort large data segments after other
7410 (align_file_offset): New static function.
7411 (Layout::set_segment_offsets): Use align_file_offset.
7412 * output.h (class Output_section): Add is_small_section_ and
7413 is_large_section_ fields.
7414 (Output_section::is_small_section): New function.
7415 (Output_section::set_is_small_section): New function.
7416 (Output_section::is_large_section): New function.
7417 (Output_section::set_is_large_section): New function.
7418 (Output_section::is_large_data_section): New function.
7419 (class Output_segment): Add is_large_data_segment_ field.
7420 (Output_segment::is_large_data_segment): New function.
7421 (Output_segment::set_is_large_data_segment): New function.
7422 * output.cc (Output_section::Output_section): Initialize new
7424 (Output_segment::Output_segment): Likewise.
7425 (Output_segment::add_output_section): Add assertion that large
7426 data sections always go in large data segments. Force small data
7427 sections to the end of the list of data sections. Force small BSS
7428 sections to the start of the list of BSS sections. For large BSS
7429 sections to the end of the list of BSS sections.
7430 * symtab.h (class Symbol): Declare is_common_shndx.
7431 (Symbol::is_defined): Check Symbol::is_common_shndx.
7432 (Symbol::is_common): Likewise.
7433 (class Symbol_table): Define enum Commons_section_type. Update
7434 declarations. Add small_commons_ and large_commons_ fields.
7435 * symtab.cc (Symbol::is_common_shndx): New function.
7436 (Symbol_table::Symbol_table): Initialize new fields.
7437 (Symbol_table::add_from_object): Put small and large common
7438 symbols in the right list.
7439 (Symbol_table::sized_finalized_symbol): Check
7440 Symbol::is_common_shndx.
7441 (Symbol_table::sized_write_globals): Likewise.
7442 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7443 common symbol lists. Don't call do_allocate_commons_list if the
7445 (Symbol_table::do_allocate_commons_list): Remove is_tls
7446 parameter. Add comons_section_type parameter. Change all
7447 callers. Handle small and large common symbols.
7448 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7449 Symbol::is_common_shndx.
7450 * resolve.cc (symbol_to_bits): Likewise.
7451 * target.h (Target::small_common_shndx): New function.
7452 (Target::small_common_section_flags): New function.
7453 (Target::large_common_shndx): New function.
7454 (Target::large_common_section_flags): New function.
7455 (Target::new_output_section): New function.
7456 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7457 small_common_section_flags, and large_common_section_flags
7459 (Target::do_new_output_section): New virtual function.
7460 * arm.cc (Target_arm::arm_info): Initialize new fields.
7461 * i386.cc (Target_i386::i386_info): Likewise.
7462 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7464 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7465 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7466 (Target_x86_64::do_new_output_section): New function.
7467 * configure.ac: Define conditional MCMODEL_MEDIUM.
7468 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7469 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7470 (large_LDFLAGS): Define.
7471 * testsuite/large.c: New file.
7472 * testsuite/testfile.cc (Target_test::test_target_info):
7473 Initialize new fields.
7474 * configure, testsuite/Makefile.in: Rebuild.
7476 2009-06-05 Doug Kwan <dougkwan@google.com>
7478 * Makefile.am (CCFILES): Add target.cc.
7479 * Makefile.in: Regenerate.
7480 * i386.cc (class Target_i386): Define new virtual method to
7481 override do_is_local_label_name in parent.
7482 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7483 local symbols if --discard-locals or -X is given.
7484 * options.h (class General_options): Declare new options
7485 '--discard-locals' and '-X' for discarding locals.
7486 * target.h (class Target): Define new methods is_local_label_name.
7487 Declare new virtual method do_is_local_label_name.
7488 * target.cc: New file.
7489 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7490 (check_SCRIPTS): Add discard_locals_test.sh.
7491 (check_DATA): Add discard_local_tests.syms.
7492 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7493 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7494 * testsuite/Makefile.in: Regenerate.
7495 * testsuite/discard_locals_test.c: New file.
7496 * testsuite/discard_locals_test.sh: Same.
7498 2009-06-05 Doug Kwan <dougkwan@google.com>
7500 * object.cc (Sized_relobj::Sized_relobj): Initialize
7501 discarded_eh_frame_shndx_ to -1U.
7502 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7504 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7505 a discarded .eh_frame section.
7506 (Sized_relobj::do_finalize_local_symbols): Ditto.
7507 * object.h (class Sized_relobj): Declare new member
7508 discarded_eh_frame_shndx_.
7509 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7510 (local_labels_test.o, local_labels_test): New rules.
7511 * testsuite/Makefile.in: Regenerate.
7513 2009-06-04 Doug Kwan <dougkwan@google.com>
7515 * layout.cc (Layout::section_name_mapping): Add mapping for
7516 special ARM sections.
7518 2009-06-03 Doug Kwan <dougkwan@google.com>
7520 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7521 (utils::has_overflow): Same.
7523 2009-06-03 Ian Lance Taylor <iant@google.com>
7525 * layout.cc (Layout::section_name_mapping): New array, replacing
7526 Layout::linkonce_mapping.
7527 (Layout::section_name_mapping_count): New variable, replacing
7528 Layout::linkonce_mapping_count.
7529 (Layout::linkonce_output_name): Remove.
7530 (Layout::output_section_name): Rewrite.
7531 * layout.h (class Layout): Rename Linkonce_mapping to
7532 Section_name_mapping, linkonce_mapping to section_name_mapping,
7533 linkonce_mapping_count to section_name_mapping_count. Don't
7534 declare linkonce_output_name.
7536 2009-06-03 Doug Kwan <dougkwan@google.com>
7538 * gold/arm.cc (namespace utils): New.
7539 (Target_arm::reloc_is_non_pic): Define new method.
7540 (class Arm_relocate_functions): New.
7541 (Target_arm::Relocate::relocate): Handle relocation types used by
7544 2009-06-03 Ian Lance Taylor <iant@google.com>
7546 * arm.cc (Target_arm::scan::global): Use || instead of |.
7548 2009-06-02 Doug Kwan <dougkwan@google.com>
7550 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7551 issued_non_pic_error_.
7552 (class Target_arm::Scan): Declare new method check_non_pic.
7553 Define new method symbol_needs_plt_entry.
7554 Declare new data member issued_non_pic_error_.
7555 (class Target_arm::Relocate): Declare new method
7556 should_apply_static_reloc.
7557 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7558 (Target_arm::Scan::check_non_pic): Define new method.
7559 (Target_arm::Scan::local): Handle a small subset of reloc types used
7561 (Target_arm::Scan::local): Same.
7562 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7564 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7566 * incremental.cc (Incremental_inputs::report_command_line): Filter
7567 out --incremental-* options.
7569 2009-05-29 Doug Kwan <dougkwan@google.com>
7571 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7573 (class Target_arm): Update comment.
7574 (Target_arm::Target_arm): Initialize new data members GOT_,
7575 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7576 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7577 and Target_arm::rel_dyn_section.
7578 Declare new_enum Target_arm::Got_type.
7579 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7581 Update commments for member do_dynsym_value.
7582 (Target_arm::got_size, Target_arm::plt_section,
7583 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7584 new methods inside class defintion.
7585 (Target_arm::got_section): Define new method.
7586 (Target_arm::rel_dyn_section): Same.
7587 (Output_data_plt_arm): New template class.
7588 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7589 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7590 (Output_data_plt_arm::add_entry): Same.
7591 (Output_data_plt_arm::first_plt_entry): Define new
7592 static data member for PLT instruction template.
7593 (Output_data_plt_arm::plt_entry): Same.
7594 (Output_data_plt_arm::do_write): Define new method.
7595 (Target_arm::make_plt_entry): Same.
7596 (Target_arm::do_finalize_sections): Same.
7597 (Target_arm::do_dynsym_value): Same.
7599 2009-05-28 Doug Kwan <dougkwan@google.com>
7601 * Makefile.am (TARGETSOURCES): Add arm.cc.
7602 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7603 * Makefile.in: Regenerate.
7605 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7607 2009-05-26 Doug Kwan <dougkwan@google.com>
7609 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7610 (General_options::check_excluded_libs): Strip off directories in
7611 archive name before matching like GNU ld does.
7612 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7613 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7614 (exclude_libs_test_LDFLAGS): Add linker option
7615 -Wl,--exclude-libs,libexclude_libs_test_3
7616 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7617 an explicit archive without using -l.
7618 (alt/libexclude_libs_test_3.a): New make rule.
7619 * testsuite/Makefile.in: Regenerate.
7620 * testsuite/exclude_libs_test.c : Declare lib3_default().
7622 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7623 * exclude_libs_test_3.c: New file.
7625 2009-05-26 Nick Clifton <nickc@redhat.com>
7627 * po/id.po: New Indonesian translation.
7628 * po/gold.pot: Updated template file.
7630 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7632 * testsuite/Makefile.am: Add -ffunction-sections to compile
7633 gc_comdat_test files. Add -Wl,--gc-sections to build
7635 * testsuite/Makefile.in: Regenerate.
7636 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7638 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7640 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7641 kept comdat section was garbage collected.
7642 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7643 * testsuite/Makefile.in: Regenerate.
7644 * testsuite/gc_comdat_test.sh: New file.
7645 * testsuite/gc_comdat_test_1.cc: New file.
7646 * testsuite/gc_comdat_test_2.cc: New file.
7648 2009-05-19 Doug Kwan <dougkwan@google.com>
7650 * archive.cc (Archive::Archive): Move constructor from archive.h
7651 to here. Initialize no_export_.
7652 (Archive::get_elf_object_for_member): Set no_export flag of object.
7653 * archive.h (Archive::Archive): Move constructor body to
7655 (Archive::no_export): New method.
7656 (Archive::no_export_): New field.
7657 * object.h (Object::Object): Initialize no_export_ to false.
7658 (Object::no_export, Object::set_no_export): New methods.
7659 (Object::no_export_): New field.
7660 * options.cc (General_options::parse_exclude_libs): New method.
7661 (General_options::check_excluded_libs) Same.
7662 * options.h (exclude_libs): New option.
7663 (General_options::check_excluded_libs): New method declaration.
7664 (General_options::excluded_libs_): New field.
7665 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7666 default or protected visibility if an object has no-export flag set.
7667 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7668 (check_SCRIPTS): Add exclude_libs_test.sh.
7669 (check_DATA): Add exclude_libs_test.syms.
7670 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7671 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7672 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7673 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7674 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7675 libexclude_libs_test_2.a): New rules.
7676 * testsuite/Makefile.in: Regenerate.
7677 * testsuite/exclude_libs_test.c: New file.
7678 * testsuite/exclude_libs_test.sh: Ditto.
7679 * testsuite/exclude_libs_test_1.c: Ditto.
7680 * testsuite/exclude_libs_test_2.c: Ditto.
7682 2009-05-15 Ian Lance Taylor <iant@google.com>
7684 * configure.ac: Check for declarations for cases where libiberty.h
7685 checks HAVE_DECL_xxx.
7686 * configure, config.in: Rebuild.
7688 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7690 * gold.h (Incremental_argument_list): Remove (invalid) forward
7692 * incremental.cc (Incremental_inputs::report_achive): New method.
7693 (Incremental_inputs::report_object): New method.
7694 (Incremental_inputs::report_script): New method.
7695 (Incremental_inputs::finalize_inputs): New method.
7696 (Incremental_inputs::finalize): Call finalize_inputs().
7697 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7698 Create inputs entries.
7699 * incremental.h (Incremental_input_type): New enum.
7700 (Incremental_inputs::Incremental_input): Initialize new fields.
7701 (Incremental_inputs::report_inputs): New method.
7702 (Incremental_inputs::report_achive): New method.
7703 (Incremental_inputs::report_object): New method.
7704 (Incremental_inputs::report_script): New method.
7705 (Incremental_inputs::finalize_inputs): New method.
7706 (Incremental_inputs::Input_info): New struct.
7707 (Incremental_inputs::Input_info_map): New typedef.
7708 (Incremental_inputs::lock_): New field.
7709 (Incremental_inputs::Inputs_): New field.
7710 (Incremental_inputs::Inputs_map): New field.
7711 * main.cc (main): Call Incremental_input::report_inputs.
7712 * options.h (Input_argument_list): Typedef moved from
7714 (Input_file_group::Files): Remove, use ::Input_argument_list.
7715 (Input_file_group::Input_argument_list): Remove, use
7716 ::Input_argument_list.
7717 * plugin.cc (Plugin_manager::add_input_file): Add error in
7719 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7721 * script.cc (read_input_script): Call
7722 Incremental_input::report_script.
7723 * script.h (Script_info): New class.
7725 2009-04-27 Ian Lance Taylor <iant@google.com>
7727 * x86_64.cc (do_adjust_output_section): Set entsize to
7730 2009-04-23 Elliott Hughes <enh@google.com>
7732 * output.cc (Output_file::close): After short writes, continue
7733 writing from the correct offset in the buffer being written.
7735 2009-04-23 Chris Demetriou <cgd@google.com>
7737 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7738 * configure: Regenerate.
7739 * config.in: Regenerate.
7740 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7741 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7743 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7745 * incremental.cc (Incremental_inputs_header_data): Renamed from
7746 Incremental_input_header_data.
7747 (Incremental_inputs_header_data::data_size): New field.
7748 (Incremental_inputs_header_data::put_input_file_count): Renamed
7749 from input_file_count.
7750 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7751 from command_line_offset.
7752 (Incremental_inputs_header_data::put_reserved): Renamed from
7754 (Incremental_inputs_entry_data): Renamed from
7755 Incremental_input_entry_data.
7756 (Incremental_inputs_entry_data::data_size): New field.
7757 (Incremental_inputs::report_command_line): New method.
7758 (Incremental_inputs::finalize): New method.
7759 (Incremental_inputs::create_incremental_inputs_data): New method.
7760 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7761 * incremental.h: New file.
7762 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7763 (Layout::finalize): Create incremental inputs section in
7765 (Layout::create_incremental_info_sections): New method.
7766 * layout.h (Layout::incremental_inputs): New method.
7767 (Layout::create_incremental_info_sections): New method.
7768 (Layout::incremental_inputs_): New field.
7769 * main.cc (main): Notify Incremental_input of the command line.
7771 2009-04-01 Ian Lance Taylor <iant@google.com>
7772 Mikolaj Zalewski <mikolajz@google.com>
7774 * gold.h (reserve_unordered_map): Define, three versions, one for
7775 each version of Unordered_map.
7776 * layout.cc (Layout::Layout): Remove options parameter. Add
7777 number_of_input_files parameter. Don't initialize options_.
7778 Initialize number_of_input_files_ and resized_signatures_. Move
7779 sections_are_attached_.
7780 (Layout::layout_group): Reserve space for group_signatures_.
7781 (Layout::find_or_add_kept_section): Change name parameter to be a
7782 reference. Resize signatures_ map when it gets large enough.
7783 (Layout::layout_eh_frame): Use parameters->options() instead of
7785 (Layout::make_output_section): Likewise.
7786 (Layout::attach_allocated_section_to_segment): Likewise.
7787 (Layout::finalize, Layout::create_executable_stack): Likewise.
7788 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7789 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7790 * layout.h (class Layout): Update declarations. Remove options_
7791 field. Add number_of_input_files_ and resized_signatures_
7792 fields. Move sections_are_attached_ field.
7793 * main.cc (main): Pass number of input files to Layout
7794 constructor. Don't pass options.
7796 2009-03-30 Ian Lance Taylor <iant@google.com>
7798 * ffsll.c (ffsll): Correct implementation.
7800 2009-03-27 Ian Lance Taylor <iant@google.com>
7802 * ffsll.c: New file.
7803 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7804 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7805 * ftruncate.c (ftruncate): Declare before definition.
7806 * mremap.c (mremap): Likewise.
7807 * pread.c (pread): Likewise.
7808 * configure, Makefile.in, config.in: Rebuild.
7810 * mremap.c: New file.
7811 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7812 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7813 (mremap): Declare if HAVE_MREMAP is not defined.
7814 * configure, Makefile.in, config.in: Rebuild.
7816 2009-03-27 Cary Coutant <ccoutant@google.com>
7818 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7819 position independent.
7820 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7821 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7823 2009-03-24 Cary Coutant <ccoutant@google.com>
7825 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7827 (needs_dynamic_reloc): Likewise.
7829 2009-03-24 Ian Lance Taylor <iant@google.com>
7831 * yyscript.y (file_cmd): Recognize EXTERN.
7832 (extern_name_list, extern_name_list_body): New nonterminals.
7833 * script.cc (script_add_extern): Define.
7834 * script-c.h (script_add_extern): Declare.
7836 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
7838 * object.cc (is_elf_object): Define.
7839 * object.h (is_elf_object): Declare.
7840 * archive.cc (Archive::get_elf_object_for_member): Call
7842 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7844 2009-03-24 Elliott Hughes <enh@google.com>
7846 * output.cc (Output_file::map_anonymous): Define.
7847 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7848 try an anonymous one. Report the size if the mmap fails.
7849 * output.h (class Output_file): Declare map_anonymous.
7851 2009-03-24 Ian Lance Taylor <iant@google.com>
7853 * target-select.cc (instantiate_target): Don't acquire the lock if
7854 the instantiated_target_ field has already been set.
7856 2009-03-23 Ian Lance Taylor <iant@google.com>
7858 * gold-threads.h (class Initialize_lock): Define.
7859 * gold-threads.cc (class Initialize_lock_once): Define.
7860 (initialize_lock_control): New static variable.
7861 (initialize_lock_pointer): New static variable.
7862 (initialize_lock_once): New static function.
7863 (Initialize_lock::Initialize_lock): Define.
7864 (Initialize_lock::initialize): Define.
7865 * target-select.h: Include "gold-threads.h".
7866 (class Target_selector): Add lock_ and initialize_lock_ fields.
7867 Don't define instantiate_target, just declare it.
7868 * target-select.cc (Target_selector::Target_selector): Initialize
7870 (Target_selector::instantiate_target): Define.
7871 * descriptors.h: Include "gold-threads.h".
7872 (class Descriptors): Add initialize_lock_ field.
7873 * descriptors.cc (Descriptors::Descriptors): Initialize new
7875 (Descriptors::open): Use initialize_lock_ field
7876 * errors.h (class Errors): Add initialize_lock_ field.
7877 * errors.cc (Errors::Errors): Initialize new field.
7878 (Errors::initialize_lock): Use initialize_lock_ field.
7879 * powerpc.cc (class Target_selector_powerpc): Remove
7880 instantiated_target_ field. In do_recognize call
7881 instantiate_target rather than do_instantiate_target. In
7882 do_instantiate_target just allocate a new target.
7883 * sparc.cc (class Target_selector_sparc): Likewise.
7885 * freebsd.h: New file.
7886 * i386.cc: Include "freebsd.h".
7887 (Target_i386): Derive from Target_freebsd rather than
7889 (Target_selector_i386): Derive from Target_selector_freebsd rather
7890 than Target_selector.
7891 * x86_64.cc: Include "freebsd.h".
7892 (Target_x86_64): Derive from Target_freebsd rather than
7894 (Target_selector_x86_64): Derive from Target_selector_freebsd
7895 rather than Target_selector.
7896 * target.h (class Target): Add adjust_elf_header and
7897 do_adjust_elf_header.
7898 * output.cc (Output_file_header:: do_sized_write): Call target
7899 adjust_elf_header routine.
7900 * configure.tgt: Set targ_osabi.
7901 * configure.ac: Define GOLD_DEFAULT_OSABI.
7902 * parameters.cc (Parameters::default_target): Pass
7903 GOLD_DEFAULT_OSABI to select_target.
7904 * target-select.h (class Target_selector): Make instantiate_target
7905 protected rather than private.
7906 * Makefile.am (HFILES): Add freebsd.h.
7907 * configure, Makefile.in, config.in: Rebuild.
7909 * merge.cc (do_add_input_section): Correct pend value. Change
7910 message about last entry not being null terminated from error to
7913 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7915 * incremental.cc: New file.
7916 * Makefile.am (CCFILES): Add incremental.cc.
7917 * Makefile.in: Rebuild.
7919 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7921 * layout.cc (Layout::output_section_name): Preserve names
7922 of '.note.' sections.
7924 2009-03-19 Ian Lance Taylor <iant@google.com>
7926 * descriptors.cc (Descriptors::open): Check that the options are
7927 valid before using them.
7929 2009-03-18 Ian Lance Taylor <iant@google.com>
7931 * script-sections.h: Include <list>.
7932 (class Script_sections): Change Sections_elements from std::vector
7933 to std::list. Typedef public Elements_iterator. Add
7934 orphan_section_placement_, data_segment_align_start_, and
7935 saw_data_segment_align_ fields. Remove data_segment_align_index_
7937 * script-sections.cc (class Orphan_section_placement): New class.
7938 (class Sections_element): Add virtual functions is_relro and
7939 orphan_section_init. Remove virtual function place_orphan_here.
7940 (class Output_section_definition): Add is_relro and
7941 orphan_section_init. Remove place_orphan_here.
7942 (class Orphan_output_section): Likewise.
7943 (Script_sections::Script_sections): Update for field changes.
7944 (Script_sections::data_segment_align): Set saw_data_segment_align_
7945 and data_segment_align_start_, not data_segment_align_index.
7946 (Script_sections::data_segment_relro_end): Check
7947 saw_data_segment_align_. Use data_segment_align_start_ rather
7948 than data_segment_align_index_.
7949 (Script_sections::place_orphan): Rewrite to use
7950 Orphan_section_placement.
7952 2009-03-17 Ian Lance Taylor <iant@google.com>
7954 * archive.cc (Archive::add_symbols): Check for a version attached
7955 to the symbol name in the archive map.
7956 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7957 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7958 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7959 (ver_test_11.a): New target.
7960 * testsuite/Makefile.in: Rebuild.
7962 * configure.ac: Check for chsize and posix_fallocate. Replace
7964 * ftruncate.c: New file, from gnulib.
7965 * output.cc (posix_fallocate): Define dummy version if not
7966 HAVE_POSIX_FALLOCATE.
7967 (Output_file::map): Call posix_fallocate rather than lseek and
7969 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7970 * configure, Makefile.in, config.in: Rebuild.
7972 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
7974 * layout.h (Layout::create_note): Add section_name parameter.
7975 * layout.cc (Layout::create_note): Likewise.
7976 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7978 2009-03-17 Ian Lance Taylor <iant@google.com>
7980 * descriptors.cc: Include "options.h".
7981 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7982 (Descriptors::open): Always use O_CLOEXEC when opening a new
7983 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7984 then set FD_CLOEXEC.
7986 * sparc.cc (class Target_sparc): Add has_got_section.
7987 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7988 make sure we have a GOT section.
7990 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7991 (Target_sparc::Scan::local): Likewise.
7992 (Target_sparc::Scan::global): Likewise.
7993 (Target_sparc::Relocate::relocate): Likewise.
7994 (Target_sparc::Relocate::relocate_tls): Likewise.
7996 * symtab.cc (Symbol_table::define_default_version): New function,
7997 broken out of add_from_object.
7998 (Symbol_table::add_from_object): Call define_default_version.
7999 (Symbol_table::define_special_symbol): Add resolve_oldsym
8000 parameter. Change all callers. If the version for a symbol comes
8001 from a version script, resolve it with the symbol with the same
8002 name with no version. Also add the symbol without a version if
8004 (do_define_in_output_data): If resolving with oldsym, don't delete
8006 (do_define_in_output_segment): Likewise.
8007 (do_define_as_constant): Likewise.
8008 * symtab.h (class Symbol_table): Update declarations.
8010 2009-03-13 Ian Lance Taylor <iant@google.com>
8012 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8013 (Read_symbols::requeue): New function.
8014 (Read_symbols::do_read_symbols): If make_elf_object fails because
8015 the target type is not configured, and the file was searched for,
8016 issue a warning and retry with the next directory.
8017 (Add_symbols::run): If the file has an incompatible format, and
8018 it was searched for, requeue the Read_symbols task. On error,
8020 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8021 dirindex parameter to constructor. Change all callers. Declare
8022 incompatible_warning and requeue.
8023 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8024 input_argument_ and input_group_ fields. Add them to
8025 constructor. Change all callers.
8026 (class Read_script): Add dirindex_ field. Add it to constructor.
8028 * archive.cc (Archive::setup): Remove input_objects parameter.
8030 (Archive::get_file_and_offset): Likewise.
8031 (Archive::read_all_symbols): Likewise.
8032 (Archive::read_symbols): Likewise.
8033 (Archive::get_elf_object_for_member): Remove input_objects
8034 parameter. Add punconfigured parameter. Change all callers.
8035 (Archive::add_symbols): Change return type to bool. Check return
8036 value of include_member.
8037 (Archive::include_all_members): Likewise.
8038 (Archive::include_member): Change return type to bool. Return
8039 false if first included object has incompatible target. Set
8040 included_member_ field.
8041 (Add_archive_symbols::run): If add_symbols returns false, requeue
8043 * archive.h (class Archive): Add included_member_ field.
8044 Initialize it in constructor. Add input_file and searched_for
8045 methods. Update declarations.
8046 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8047 input_argument_ fields. Add them to constructor. Change all
8049 * script.cc: Include "target-select.h".
8050 (class Parser_closure): Add skip_on_incompatible_target_ and
8051 found_incompatible_target_ fields. Add
8052 skip_on_incompatible_target parameter to constructor. Change all
8053 callers. Add methods skip_on_incompatible_target,
8054 clear_skip_on_incompatible_target, found_incompatible_target, and
8055 set_found_incompatible_target.
8056 (read_input_script): Add dirindex parameter. Change all callers.
8057 If parser finds an incompatible target, requeue Read_symbols
8059 (script_set_symbol): Clear skip_on_incompatible_target in
8061 (script_add_assertion, script_parse_option): Likewise.
8062 (script_start_sections, script_add_phdr): Likewise.
8063 (script_check_output_format): New function.
8064 * script.h (read_input_script): Update declaration.
8065 * script-c.h (script_check_output_format): Declare.
8066 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8067 (ignore_cmd): Remove OUTPUT_FORMAT.
8068 * fileread.cc (Input_file::Input_file): Add explicit this.
8069 (Input_file::will_search_for): New function.
8070 (Input_file::open): Add pindex parameter. Change all callers.
8071 * fileread.h (class Input_file): Add input_file_argument method.
8072 Declare will_search_for. Update declarations.
8073 * object.cc (make_elf_object): Add punconfigured parameter.
8075 * object.h (class Object): Make input_file public. Add
8076 searched_for method.
8077 (make_elf_object): Update declaration.
8078 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8080 * dirsearch.h (class Dirsearch): Update declaration.
8081 * options.h (class General_options): Add --warn-search-mismatch.
8082 * parameters.cc (Parameters::is_compatible_target): New function.
8083 * parameters.h (class Parameters): Declare is_compatible_target.
8084 * workqueue.cc (Workqueue::add_blocker): New function.
8085 * workqueue.h (class Workqueue): Declare add_blocker.
8087 * fileread.cc (Input_file::open): Remove options parameter.
8089 (Input_file::open_binary): Likewise.
8090 * script.cc (read_input_script): Likewise.
8091 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8092 options parameter from constructor. Change all callers.
8093 (class Read_script): Likewise.
8094 * fileread.h (class Input_file): Update declarations.
8095 * script.h (read_input_script): Update declaration.
8097 2009-03-10 Nick Clifton <nickc@redhat.com>
8099 * po/es.po: New Spanish translation.
8101 2009-03-06 Cary Coutant <ccoutant@google.com>
8103 * options.cc (parse_short_option): Keep dash_z from registering itself.
8105 2009-03-03 Ian Lance Taylor <iant@google.com>
8108 * target-reloc.h (relocate_section): Pass output_section to
8110 * i386.cc (Target_i386::should_apply_static_reloc): Add
8111 output_section parameter. Change all callers.
8112 (Target_i386::Relocate::relocate): Add output_section parameter.
8113 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8114 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8115 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8116 * testsuite/two_file_shared.sh: New script.
8117 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8118 (check_DATA): Add two_file_shared.dbg.
8119 (two_file_shared.dbg): New target.
8120 * testsuite/Makefile.in: Rebuild.
8122 2009-03-01 Ian Lance Taylor <iant@google.com>
8124 * configure.ac: Check for byteswap.h.
8125 * configure: Rebuild.
8126 * config.in: Rebuild.
8128 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8130 * layout.cc (Layout::find_or_add_kept_section): New function.
8131 (Layout::add_comdat): Removed.
8132 * layout.h (struct Kept_section): Move out of class Layout.
8133 Remove trailing underscores from field names. Add group_sections
8134 field. Rename group_ field to is_group. Change all uses.
8135 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8136 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8137 comdat_groups_ field.
8138 (Sized_relobj::include_section_group): Use
8139 find_or_add_kept_section and Kept_section::group_sections.
8140 (Sized_relobj::include_linkonce_section): Likewise.
8141 * object.cc (class Sized_relobj): Don't define Comdat_group or
8142 Comdat_group_table. Remove find_comdat_group and
8143 add_comdat_group. Remove comdat_groups_ field.
8144 * plugin.cc (include_comdat_group): Use
8145 Layout::find_or_add_kept_section.
8147 2009-02-28 Ian Lance Taylor <iant@google.com>
8149 * README: --gc-sections and map files are now supported. Document
8150 some build requirements.
8153 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8154 relocatable link set the value of the section symbol to zero.
8155 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8156 relocatable link don't include the section address in the local
8159 2009-02-27 Ian Lance Taylor <iant@google.com>
8162 * options.h (class Search_directory): Add is_system_directory.
8163 (class General_options): Declare is_in_system_directory.
8164 * options.cc (get_relative_sysroot): Make static.
8165 (get_default_sysroot): Make static.
8166 (General_optoins::is_in_system_directory): New function.
8167 * fileread.cc (Input_file::is_in_system_directory): New function.
8168 * fileread.h (class Input_file): Declare is_in_system_directory.
8169 * object.h (class Object): Add is_in_system_directory.
8170 (class Input_objects): Remove system_library_directory_ field.
8171 * object.cc (Input_objects::add_object): Don't set
8172 system_library_directory_.
8173 (input_objects::found_in_system_library_directory): Remove.
8174 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8175 parameter. Change all callers.
8176 (Symbol_table::sized_write_globals): Likewise.
8177 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8178 Call Object::is_in_system_directory.
8179 * symtab.h (class Symbol_table): Update declarations.
8182 * descriptors.h (Open_descriptor): Add is_on_stack field.
8183 * descriptors.cc (Descriptors::open): If the descriptor is on the
8184 top of the stack, remove it. Initialize is_on_stack field.
8185 (Descriptors::release): Only add pod to stack if it is not on the
8187 (Descriptors::close_some_descriptor): Clear stack_next and
8191 * output.cc (Output_section::find_starting_output_address): Rename
8192 from starting_output_address; add PADDR parameter; change return
8194 * output.h (class Output_section): Declare
8195 find_starting_output_address instead of starting_output_address.
8196 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8197 section symbol for which we can't find a merge section.
8200 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8201 hidden or internal, force the symbol to be local.
8202 * resolve.cc (Symbol::override_visibility): Define.
8203 (Symbol::override_base): Use override_visibility.
8204 (Symbol_table::resolve): Likewise.
8205 (Symbol::override_base_with_special): Likewise.
8206 (Symbol_table::override_with_special): If the visibility is hidden
8207 or internal, force the symbol to be local.
8208 * symtab.h (class Symbol): Add set_visibility and
8209 override_visibility.
8210 * testsuite/ver_test_1.sh: New file.
8211 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8212 (check_DATA): Add ver_test_1.syms.
8213 (ver_test_1.syms): New target.
8214 * testsuite/Makefile.in: Rebuild.
8216 2009-02-25 Cary Coutant <ccoutant@google.com>
8218 * layout.cc (Layout::choose_output_section): Don't rename sections
8219 when using a linker script that has a SECTIONS clause.
8220 * Makefile.in: Regenerate.
8222 * testsuite/Makefile.am (script_test_5.sh): New test case.
8223 * testsuite/Makefile.in: Regenerate.
8224 * testsuite/script_test_5.cc: New file.
8225 * testsuite/script_test_5.sh: New file.
8226 * testsuite/script_test_5.t: New file.
8228 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8230 * archive.cc (Archive::include_member): Update calls to add_symbols.
8231 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8232 the Layout argument.
8233 * dynobj.h (do_add_symbols): Add the Layout argument.
8234 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8236 * object.h (Object::add_symbols): Add the Layout argument.
8237 (Object::do_add_symbols): Add the Layout argument.
8238 (Sized_relobj::do_add_symbols): Add the Layout argument.
8239 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8240 Unify the two versions.
8241 (Add_plugin_symbols): Remove.
8242 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8243 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8244 (Add_plugin_symbols): Remove.
8245 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8246 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8247 (Add_symbols::run): Make it work with Pulginobj.
8249 2009-02-06 Ian Lance Taylor <iant@google.com>
8251 * object.cc (Sized_relobj::do_layout): Make info message start
8252 with lower case letter.
8254 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8256 * binary.cc: Fix file comment.
8258 * options.h (enum Incremental_disposition): Define.
8259 (class General_options): Add new options: --incremental,
8260 --incremental_changed, --incremental_unchanged,
8261 --incremental_unknown. Add incremental_disposition_ and
8262 implicit_incremental_ fields.
8263 (General_options::incremental_disposition): New function.
8264 (class Position_dependent_options): Add incremental_disposition
8266 (Position_dependent_options::copy_from_options): Set incremental
8268 * options.cc (General_options::parse_incremental_changed): New
8270 (General_options::parse_incremental_unchanged): New function.
8271 (General_options::parse_incremental_unknown): New function.
8272 (General_options::General_options): Initialize new fields
8273 incremental_disposition_ and implicit_incremental_.
8274 (General_options::finalize): Check for uasge of --incremental-*
8275 without --incremental.
8277 2009-02-06 Chris Demetriou <cgd@google.com>
8279 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8280 pointer and to report location as the file name associated with
8282 (gold_undefined_symbol_at_location): New function to replace the
8283 old gold_undefined_symbol functionality.
8284 * target-reloc.h (relocate_section): Update to use
8285 gold_undefined_symbol_at_location.
8286 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8287 Call gold_undefined_symbol function rather than gold_error.
8288 * errors.h (Errors::undefined_symbol): Take location as a
8289 string, rather than calculating it from a relocation.
8290 * errors.cc (Errors::fatal): Print "fatal error:" before the
8292 (Errors::error, Errors::error_at_location): Print "error: "
8293 before the formatted message.
8294 (Errors::undefined_symbol): Take location as a string, rather
8295 than calculating it from a relocation.
8296 (gold_undefined_symbol_at_location): New function akin to
8297 old gold_undefined_symbol, calculates location from relocation.
8298 (gold_undefined_symbol): Change to take only a Symbol pointer
8299 and to report location as the file name associated with the symbol.
8300 * testsuite/debug_msg.sh: Update for changed error messages.
8301 * testsuite/undef_symbol.sh: Likewise.
8303 2009-02-04 Duncan Sands <baldrick@free.fr>
8306 * reduced_debug_output.h
8307 (Output_reduced_debug_abbrev_section::failed): Use format for
8309 (Output_reduced_debug_info_section::faild): Likewise.
8311 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8313 * script.cc (Lazy_demangler): New class.
8314 (Version_script_info::get_symbol_version_helper): Demangle a
8317 2009-01-29 Cary Coutant <ccoutant@google.com>
8319 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8321 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8323 2009-01-28 Ian Lance Taylor <iant@google.com>
8325 * version.cc (version_string): Bump to 1.9.
8327 * gold.h: Include <cstring> and <stdint.h>.
8328 * version.cc: Include <cstdio>.
8329 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8331 * reduced_debug_output.cc (insert_into_vector): Rename from
8332 Insert_into_vector; change all callers. Use Swap_unaligned to
8333 avoid aliasing issue; remove union since it is unnecessary.
8335 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8337 * Makefile.am (CCFILES): Add gc.cc.
8339 * Makefile.in: Regenerate.
8340 * gold.cc (Gc_runner): New class.
8341 (queue_initial_tasks): Call garbage collection related tasks
8342 when corresponding options are invoked.
8343 (queue_middle_gc_tasks): New function.
8344 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8345 processed early before laying out sections during garbage collection.
8346 * gold.h (queue_middle_gc_tasks): New function.
8347 (is_prefix_of): Move from "layout.cc".
8348 * i386.cc (Target_i386::gc_process_relocs): New function.
8349 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8350 * main.cc (main): Create object of class "Garbage_collection".
8351 * object.cc (Relobj::copy_symbols_data): New function.
8352 (Relobj::is_section_name_included): New function.
8353 (Sized_relobj::do_layout): Allow this function to be called twice
8354 during garbage collection and defer layout of section during the
8356 * object.h (Relobj::get_symbols_data): New function.
8357 (Relobj::is_section_name_included): New function.
8358 (Relobj::copy_symbols_data): New function.
8359 (Relobj::set_symbols_data): New function.
8360 (Relobj::get_relocs_data): New function.
8361 (Relobj::set_relocs_data): New function.
8362 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8363 (Relobj::gc_process_relocs): New function.
8364 (Relobj::do_gc_process_relocs): New pure virtual function.
8365 (Relobj::sd_): New data member.
8366 (Sized_relobj::is_output_section_offset_invalid): New function.
8367 (Sized_relobj::do_gc_process_relocs): New function.
8368 * options.h (General_options::gc_sections): Modify to not be a no-op.
8369 (General_options::print_gc_sections): New option.
8370 * plugin.cc (Plugin_finish::run): Remove function call to
8371 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8372 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8373 * reloc.cc (Read_relocs::run): Add task to process relocs and
8374 determine unreferenced sections when doing garbage collection.
8375 (Gc_process_relocs): New class.
8376 (Sized_relobj::do_gc_process_relocs): New function.
8377 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8378 sections that are garbage collected.
8379 * reloc.h (Gc_process_relocs): New class.
8380 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8381 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8382 symbols whose corresponding sections are garbage collected.
8383 (Symbol_table::Symbol_table): Add new parameter for the garbage
8385 (Symbol_table::gc_mark_undef_symbols): New function.
8386 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8387 (Symbol_table::gc_mark_dyn_syms): New function.
8388 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8390 (Symbol_table::add_from_object): Likewise.
8391 (Symbol_table::add_from_relobj): When building shared objects, do not
8392 treat externally visible symbols as garbage.
8393 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8394 table information for static and relocatable links.
8395 * symtab.h (Symbol_table::set_gc): New function.
8396 (Symbol_table::gc): New function.
8397 (Symbol_table::gc_mark_undef_symbols): New function.
8398 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8399 (Symbol_table::gc_mark_dyn_syms): New function.
8400 (Symbol_table::gc_): New data member.
8401 * target.h (Sized_target::gc_process_relocs): New pure virtual
8403 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8404 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8406 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8408 * options.h (General_options::gc_sections): Define as a no-op for now.
8409 (General_options::no_keep_memory): Ditto.
8410 (General_options::Bshareable): Define.
8411 * options.cc (General_options::finalize): Honor -Bshareable.
8413 2009-01-20 Andreas Schwab <schwab@suse.de>
8415 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8416 read the value in the contents, since we don't use it. Use the
8417 template endianness when writing.
8418 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8420 2009-01-19 Andreas Schwab <schwab@suse.de>
8422 * configure.tgt (powerpc64-*): Fix targ_obj.
8424 2009-01-15 Ian Lance Taylor <iant@google.com>
8426 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8427 local symbols when stripping all symbols.
8429 2009-01-14 Cary Coutant <ccoutant@google.com>
8431 * output.cc (Output_reloc): Add explicit instantiations.
8433 2009-01-14 Cary Coutant <ccoutant@google.com>
8435 * archive.cc (Archive::get_elf_object_for_member): Remove call
8436 to File_read::claim_for_plugin.
8437 * descriptors.cc (Descriptors::open): Remove reference to
8439 (Descriptors::claim_for_plugin): Remove.
8440 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8441 (Descriptors::is_claimed): Remove.
8442 (claim_descriptor_for_plugin): Remove.
8443 * fileread.cc (File_read::claim_for_plugin): Remove.
8444 * fileread.h (File_read::claim_for_plugin): Remove.
8445 (File_read::descriptor): Reopen descriptor if necessary.
8446 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8447 (Plugin_manager::all_symbols_read): Add task parameter. Change
8449 (Plugin_manager::get_input_file): New function.
8450 (Plugin_manager::release_input_file): New function.
8451 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8452 corresponding data member.
8453 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8454 and pass to base constructor. Change all callers.
8455 (get_input_file, release_input_file): New functions.
8456 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8457 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8458 (Plugin_manager::all_symbols_read): Add task parameter.
8459 (Plugin_manager::get_input_file): New function.
8460 (Plugin_manager::release_input_file): New function.
8461 (Plugin_manager::task_): New data member.
8462 (Pluginobj::Pluginobj): Add filesize parameter.
8463 (Pluginobj::filename): New function.
8464 (Pluginobj::descriptor): New function.
8465 (Pluginobj::filesize): New function.
8466 (Pluginobj::filesize_): New data member.
8467 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8468 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8469 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8471 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8472 with archive libraries.
8473 * testsuite/Makefile.in: Regenerate.
8474 * testsuite/plugin_test.c (struct sym_info): New type.
8475 (get_input_file, release_input_file): New static variables.
8476 (onload): Capture new transfer vector entries.
8477 (claim_file_hook): Stop reading at end of file according to filesize.
8478 Factor out parsing of readelf output into separate function.
8479 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8480 APIs and get the source file name from the symbol table. Convert
8481 source file name to corresponding object file name. Print info
8482 message when adding new input files.
8483 (parse_readelf_line): New function.
8484 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8485 * testsuite/plugin_test_2.sh: Likewise.
8486 * testsuite/plugin_test_3.sh: Likewise.
8487 * testsuite/plugin_test_4.sh: New test case.
8489 2009-01-07 Ian Lance Taylor <iant@google.com>
8491 * version.cc (version_string): Bump to 1.8.
8493 2008-12-23 Cary Coutant <ccoutant@google.com>
8495 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8496 * plugin.cc (Plugin_manager::finish): Rename as
8497 layout_deferred_objects. Move cleanup to separate function.
8498 (Plugin_manager::cleanup): New function.
8499 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8501 * plugin.h (Plugin_manager::finish): Rename as
8502 layout_deferred_objects.
8503 (Plugin_manager::cleanup): New function.
8504 (Plugin_manager::cleanup_done): New field.
8506 2008-12-23 Cary Coutant <ccoutant@google.com>
8508 * plugin.cc (is_visible_from_outside): New function.
8509 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8510 so we don't return "IR only" status for exported symbols or -r links.
8512 * testsuite/Makefile.am (plugin_test_3): New test case.
8513 * testsuite/Makefile.in: Regenerate.
8514 * testsuite/plugin_test_3.sh: New file.
8516 2008-12-22 Cary Coutant <ccoutant@google.com>
8518 * object.cc (Sized_relobj::layout_section): New function.
8519 (Sized_relobj::do_layout): Defer layout of input sections until after
8520 plugin has provided replacement files.
8521 (Sized_relobj::do_layout_deferred_sections): New function.
8522 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8523 (Relobj::layout_deferred_sections): New function.
8524 (Relobj::do_layout_deferred_sections): New function.
8525 (Sized_relobj::do_layout_deferred_sections): New function.
8526 (Sized_relobj::layout_section): New function.
8527 (Sized_relobj::Deferred_layout): New structure.
8528 (Sized_relobj::deferred_layout_): New field.
8529 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8530 Change all callers. Layout deferred sections.
8531 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8533 (Plugin_hook::run): Move code from do_plugin_hook inline.
8534 (Plugin_hook::do_plugin_hook): Remove.
8535 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8536 (Plugin_manager::finish): Renamed, was cleanup.
8537 (Plugin_manager::should_defer_layout): New function.
8538 (Plugin_manager::add_deferred_layout_object): New function.
8539 (Plugin_manager::Deferred_layout_list): New type.
8540 (Plugin_manager::deferred_layout_objects_): New field.
8541 (Plugin_hook::do_plugin_hook): Remove.
8543 2008-12-17 Ian Lance Taylor <iant@google.com>
8545 * options.h (class General_options): Add --no case for
8548 2008-12-16 Cary Coutant <ccoutant@google.com>
8550 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8552 (Plugin_manager::claim_file): Create plugin object even if
8553 plugin did not call the add_symbols callback.
8554 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8555 asking for more symbols than were added.
8556 * testsuite/Makefile.am (plugin_test_1): Add test case with
8558 (empty.syms): New target.
8559 * testsuite/Makefile.in: Regenerate.
8560 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8561 message. Don't call add_symbols if no globals.
8562 (all_symbols_read_hook): Don't provide replacement for empty
8565 2008-12-12 Ian Lance Taylor <iant@google.com>
8567 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8568 r_type == 0 for a local symbol with r_sym == 0.
8569 (scan_relocatable_relocs): Pass r_sym to
8570 local_non_section_strategy.
8571 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8574 * configure.ac: Update test for TLS descriptors: they are
8575 supported as of glibc 2.9.
8576 * configure: Rebuild.
8578 2008-12-11 Ian Lance Taylor <iant@google.com>
8581 * target-reloc.h (Default_scan_relocatable_relocs): For each
8582 function, map r_type == 0 to RELOC_DISCARD.
8584 2008-12-10 Cary Coutant <ccoutant@google.com>
8586 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8587 object to override a kept COMDAT group from a plugin object.
8589 2008-12-09 Ian Lance Taylor <iant@google.com>
8592 * yyscript.y (file_cmd): Handle INPUT.
8594 * testsuite/initpri1.c: Change all declarations to be full
8595 prototypes by adding void, to avoid compiler warnings.
8597 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8599 * options.cc (General_options::parse_plugin_opt): New.
8600 (General_options::add_plugin): The argument now is just the filename.
8601 (General_options::add_plugin_option): New.
8602 * options.h (plugin_opt): New.
8603 (add_plugin): Change argument name.
8604 (add_plugin_option): New.
8605 * plugin.cc (Plugin::load): Don't parse the plugin option.
8606 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8607 (Plugin::add_option): New.
8608 (Plugin::args_): Change type.
8609 (Plugin::filename_): New.
8610 (Plugin_manager::add_plugin_option): New.
8611 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8612 * testsuite/Makefile.in: Regenerate.
8614 2008-12-05 Cary Coutant <ccoutant@google.com>
8616 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8617 Handle --strip-lto-sections option.
8618 * options.h (strip_lto_sections): New option.
8620 2008-12-01 Cary Coutant <ccoutant@google.com>
8622 * plugin.cc (ld_plugin_message): Change format parameter to const.
8623 Fix mismatch between new[] and delete.
8625 2008-11-14 Cary Coutant <ccoutant@google.com>
8627 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8630 2008-11-05 Craig Silverstein <csilvers@google.com>
8632 * options.cc (General_options::parse_dynamic_list): New function.
8633 * options.h (General_options): New flags dynamic_list,
8634 dynamic_list_data, dynamic_list_cpp_new, and
8635 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8636 (General_options::in_dynamic_list): New function.
8637 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8638 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8639 (Lex::can_continue_name): Likewise.
8641 (read_script_file): New parameter script_options.
8642 (read_dynamic_list): New function.
8643 (Script_options::define_dynamic_list): New function.
8644 (dynamic_list_keyword_parsecodes): New variable.
8645 (dynamic_list_keywords): New variable.
8646 * script.h (Script_options::define_dynamic_list): New function
8648 (read_dynamic_list): New function prototype.
8649 * symtab.cc (strprefix): New macro.
8650 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8651 dynamic_list_data, dynamic_list_cpp_new, and
8652 dynamic_list_cpp_typeinfo.
8653 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8654 (dynamic_list_expr): New rule.
8655 (dynamic_list_nodes): Likewise.
8656 (dynamic_list_node): Likewise.
8657 * testsuite/Makefile.am (dynamic_list): New test.
8658 * testsuite/Makefile.in: Regenerated.
8659 * testsuite/dynamic_list.t: New file.
8660 * testsuite/dynamic_list.sh: New file.
8662 2008-11-05 Craig Silverstein <csilvers@google.com>
8664 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8665 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8666 (t11_last): Likewise.
8667 * testsuite/ver_test_6.c (main): Likewise.
8669 2008-10-07 Cary Coutant <ccoutant@google.com>
8671 * options.c (General_options::finalize): Add check for -static and
8673 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8676 2008-10-02 Cary Coutant <ccoutant@google.com>
8678 * plugin.cc (make_sized_plugin_object): Fix conditional
8679 compilation to work when not all targets are enabled.
8681 2008-09-29 Cary Coutant <ccoutant@google.com>
8683 * archive.cc (Archive::get_file_and_offset): Use filename instead
8684 of name to get library path.
8685 (Archive::include_member): Unlock external member of a thin archive.
8687 * testsuite/Makefile.am (TEST_AR): New variable.
8688 (thin_archive_test_1): New test.
8689 (thin_archive_test_2): New test.
8690 * testsuite/Makefile.in: Regenerate.
8691 * testsuite/thin_archive_main.cc: New file.
8692 * testsuite/thin_archive_test_1.cc: New file.
8693 * testsuite/thin_archive_test_2.cc: New file.
8694 * testsuite/thin_archive_test_3.cc: New file.
8695 * testsuite/thin_archive_test_4.cc: New file.
8697 2008-09-29 Cary Coutant <ccoutant@google.com>
8699 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8700 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8702 (Sized_relobj::do_finalize_local_symbols): Likewise.
8703 (Sized_relobj::map_to_kept_section): Likewise.
8704 * object.h (Sized_relobj::invalid_address): New constant.
8705 (Sized_relobj::do_output_section_offset): Check for invalid_address
8707 * output.cc (Output_reloc::local_section_offset): Use constant
8708 invalid_address instead of -1U.
8709 (Output_reloc::get_address): Likewise.
8710 (Output_section::output_address): Change -1U to -1ULL.
8711 * output.h (Output_reloc::invalid_address): New constant.
8712 * reloc.cc (Sized_relobj::write_sections): Use constant
8713 invalid_address instead of -1U.
8714 (Sized_relobj::relocate_sections): Likewise.
8715 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8716 values for merge sections.
8717 * target-reloc.h (relocate_for_relocatable): Use constant
8718 invalid_address instead of -1U.
8720 2008-09-19 Cary Coutant <ccoutant@google.com>
8722 Add plugin functionality for link-time optimization (LTO).
8723 * configure.ac (plugins): Add --enable-plugins option.
8724 * configure: Regenerate.
8725 * config.in: Regenerate.
8726 * Makefile.am (LIBDL): New variable.
8727 (CCFILES): Add plugin.cc.
8728 (HFILES): Add plugin.h.
8729 (ldadd_var): Add LIBDL.
8730 * Makefile.in: Regenerate.
8732 * archive.cc: Include "plugin.h".
8733 (Archive::setup): Don't preread archive symbols when using a plugin.
8734 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8735 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8737 (Archive::include_member): Add symbols from plugin objects.
8738 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8739 * descriptors.cc (Descriptors::open): Check for file descriptors
8740 abandoned by plugins.
8741 (Descriptors::claim_for_plugin): New function.
8742 * descriptors.h (Descriptors::claim_for_plugin): New function.
8743 (Open_descriptor::is_claimed): New field.
8744 (claim_descriptor_for_plugin): New function.
8745 * fileread.cc (File_read::claim_for_plugin): New function.
8746 * fileread.h (File_read::claim_for_plugin): New function.
8747 (File_read::descriptor): New function.
8748 * gold.cc: Include "plugin.h".
8749 (queue_initial_tasks): Add task to call plugin hooks for generating
8751 * main.cc: Include "plugin.h".
8752 (main): Load plugin libraries.
8753 * object.h (Pluginobj): Declare.
8754 (Object::pluginobj): New function.
8755 (Object::do_pluginobj): New function.
8756 (Object::set_target): New function.
8757 * options.cc: Include "plugin.h".
8758 (General_options::parse_plugin): New function.
8759 (General_options::General_options): Initialize plugins_ field.
8760 (General_options::add_plugin): New function.
8761 * options.h (Plugin_manager): Declare.
8762 (General_options): Add --plugin option.
8763 (General_options::has_plugins): New function.
8764 (General_options::plugins): New function.
8765 (General_options::add_plugin): New function.
8766 (General_options::plugins_): New field.
8767 * plugin.cc: New file.
8768 * plugin.h: New file.
8769 * readsyms.cc: Include "plugin.h".
8770 (Read_symbols::do_read_symbols): Check for archive before checking
8771 for ELF file. Call plugin hooks to claim files.
8772 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8773 from a real object file; force override when processing replacement
8775 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8776 (Symbol::init_base_object): Likewise.
8777 (Symbol::init_base_output_data): Likewise.
8778 (Symbol::init_base_output_segment): Likewise.
8779 (Symbol::init_base_constant): Likewise.
8780 (Symbol::init_base_undefined): Likewise.
8781 (Symbol::output_section): Assert that object is not a plugin.
8782 (Symbol_table::add_from_pluginobj): New function.
8783 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8785 (Symbol_table::sized_write_globals): Likewise.
8786 (Symbol_table::add_from_pluginobj): Instantiate template.
8787 * symtab.h (Sized_pluginobj): Declare.
8788 (Symbol::in_real_elf): New function.
8789 (Symbol::set_in_real_elf): New function.
8790 (Symbol::in_real_elf_): New field.
8791 (Symbol_table::add_from_pluginobj): New function.
8793 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8794 (LIBDL): New variable.
8796 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8797 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8798 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8799 (MOSTLYCLEANFILES): Likewise.
8800 * testsuite/Makefile.in: Regenerate.
8801 * testsuite/plugin_test.c: New file.
8802 * testsuite/plugin_test_1.sh: New file.
8803 * testsuite/plugin_test_2.sh: New file.
8805 2008-09-16 Ian Lance Taylor <iant@google.com>
8807 * target-reloc.h (relocate_section): Check whether a symbol is
8808 defined by the ABI before reporting an undefined symbol error.
8809 * target.h (Target::is_defined_by_abi): Make parameter const.
8810 (Target::do_is_defined_by_abi): Likewise.
8811 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8812 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8813 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8814 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8815 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8816 * testsuite/Makefile.in: Rebuild.
8818 * fileread.cc (make_view): Add casts to avoid warning.
8820 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8822 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8823 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8825 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8827 * options.h (General_options::output_is_executable): New.
8828 (General_options::output_is_pie): New.
8829 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8830 for shared libraries.
8831 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8833 2008-09-11 Chris Demetriou <cgd@google.com>
8835 * options.h (origin): New -z option.
8836 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8837 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8840 2008-09-05 Cary Coutant <ccoutant@google.com>
8842 * fileread.cc (File_read::make_view): Add check for attempt to map
8845 2008-09-05 Cary Coutant <ccoutant@google.com>
8847 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8848 explicit instantiations.
8850 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8853 * options.cc (General_options::finalize): Allow undefined symbols
8854 in shlibs if linking -shared.
8857 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8858 symbols as not needing a dynsym entry.
8860 2008-08-20 Craig Silverstein <csilvers@google.com>
8862 * fileread.cc (File_read::open): Do not lock the file unless it
8863 was successfully opened.
8865 2008-08-14 Cary Coutant <ccoutant@google.com>
8867 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8868 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8869 * testsuite/tls_test.cc (struct int128): 128-bit struct
8870 for testing TLS relocs with non-zero addend.
8871 (v12): New TLS variable.
8873 (t_last): Add check for v12.
8874 * testsuite/tls_test.h (t12): New function.
8875 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8877 2008-08-13 Ian Lance Taylor <iant@google.com>
8879 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8880 set tls_segment_ or relro_segment_.
8881 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8883 * output.h (Output_section::clear_is_relro): New function.
8884 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8885 sections specially even when output_data_ is empty.
8886 (Output_segment::maximum_alignment): When first section is relro,
8887 only force alignment for PT_LOAD segments.
8888 * script.cc (script_data_segment_align): New function.
8889 (script_data_segment_relro_end): New function.
8890 * script-c.h (script_data_segment_align): Declare.
8891 (script_data_segment_relro_end): Declare.
8892 * script-sections.h (class Script_sections): Declare
8893 data_segment_align and data_segment_relro_end. Add fields
8894 segment_align_index_ and saw_relro_end_.
8895 * script-sections.cc (class Sections_element): Add set_is_relro
8896 virtual function. Add new bool* parameter to place_orphan_here.
8897 Add get_output_section virtual function.
8898 (class Output_section_definition): Add set_is_relro. Add new
8899 bool* parameter to place_orphan_here. Add get_output_section.
8900 Add is_relro_ field.
8901 (Output_section_definition::Output_section_definition): Initialize
8902 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8903 and is_relro_ fields.
8904 (Output_section_definition::place_orphan_here): Add is_relro
8906 (Output_section_definition::set_section_addresses): Set relro for
8908 (Output_section_definition::alternate_constraint): Likewise.
8909 (class Orphan_output_section): Add new bool* parameter to
8910 place_orphan_here. Add get_output_section.
8911 (Orphan_output_section::place_orphan_here): Add is_relro
8913 (Script_sections::Script_sections): Initialize
8914 data_segment_align_index_ and saw_relro_end_.
8915 (Script_sections::data_segment_align): New function.
8916 (Script_sections::data_segment_relro_end): New function.
8917 (Script_sections::place_orphan): Set or clear is_relro.
8918 (Script_sections::set_section_addresses): Force alignment of first
8920 * yyscript.y (exp): Call script_data_segment_align and
8921 script_data_segment_relro_end.
8922 * testsuite/relro_script_test.t: New file.
8923 * testsuite/relro_test.cc (using_script): Declare.
8924 (t1, t2): Test using_script.
8925 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8926 (relro_script_test_SOURCES): Define.
8927 (relro_script_test_DEPENDENCIES): Define.
8928 (relro_script_test_LDFLAGS): Define.
8929 (relro_script_test_LDADD): Define.
8930 (relro_script_test.so): New target.
8931 * testsuite/Makefile.in: Rebuild.
8933 2008-08-06 Cary Coutant <ccoutant@google.com>
8935 * archive.cc (Archive::total_archives, Archive::total_members)
8936 (Archive::total_members_loaded): New variables.
8937 (Archive::setup): Add parameter. Add option to preread
8939 (Archive::read_armap): Add counter.
8940 (Archive::get_file_and_offset): New function.
8941 (Archive::get_elf_object_for_member): New function.
8942 (Archive::read_all_symbols): New function.
8943 (Archive::read_symbols): New function.
8944 (Archive::add_symbols): Add counters.
8945 (Archive::include_all_members): Use armap to find members if it's
8947 (Archive::include_member): Skip reading symbols if already read.
8948 Factored code into Archive::get_file_and_offset and
8949 Archive::get_elf_object_for_member. Changed call to
8950 Mapfile::report_include_archive_member.
8951 (Archive::print_stats): New function.
8952 * archive.h: Declare Object and Read_symbols_data classes.
8953 (Archive::Archive): Add initializers for new members.
8954 (Archive::setup): Add parameter.
8955 (Archive::print_stats): New function.
8956 (Archive::total_archives, Archive::total_members)
8957 (Archive::total_members_loaded): New variables.
8958 (Archive::get_file_and_offset): New function.
8959 (Archive::get_elf_object_for_member): New function.
8960 (Archive::read_all_symbols): New function.
8961 (Archive::read_symbols): New function.
8962 (Archive::Archive_member): New class.
8963 (Archive::members_): New member.
8964 (Archive::num_members_): New member.
8965 * main.cc: Include archive.h.
8966 (main): Call Archive::print_stats.
8967 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8968 archive parameter; member_name is now the fully-decorated name.
8969 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8970 * options.h: (General_options): Add --preread-archive-symbols option.
8971 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8974 2008-08-04 Ian Lance Taylor <iant@google.com>
8976 * symtab.h (Symbol::use_plt_offset): New function.
8977 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8978 * powerpc.cc (Relocate::relocate): Likewise.
8979 * sparc.cc (Relocate::relocate): Likewise.
8980 * x86_64.cc (Relocate::relocate): Likewise.
8981 * testsuite/weak_plt.sh: New test.
8982 * testsuite/weak_plt_main.cc: New test.
8983 * testsuite/weak_plt_shared.cc: New test.
8984 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8985 (check_PROGRAMS): Add weak_plt.
8986 (check_DATA): Add weak_plt_shared.so.
8987 (weak_plt_main_pic.o, weak_plt): New targets.
8988 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8989 * testsuite/Makefile.in: Rebuild.
8991 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8993 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8994 * testsuite/Makefile.in: Rebuild.
8996 2008-08-04 Alan Modra <amodra@bigpond.net.au>
8998 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8999 * Makefile.in: Regenerate.
9000 * po/POTFILES.in: Regenerate.
9002 2008-07-29 Ian Lance Taylor <iant@google.com>
9004 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9005 symbols before other symbols.
9006 * testsuite/script_test_2.cc (test_addr): Declare.
9007 (test_addr_alias): Declare.
9008 (main): Check that test_addr and test_addr_alias have the right
9010 * testsuite/script_test_2.t: Define test_addr_alias and
9013 2008-07-24 Ian Lance Taylor <iant@google.com>
9016 * descriptors.cc: New file.
9017 * descriptors.h: New file.
9018 * gold-threads.h (class Hold_optional_lock): New class.
9019 * fileread.cc: Include "descriptors.h".
9020 (File_read::~File_read): Release descriptor rather than closing
9022 (File_read::open) [file]: Call open_descriptor rather than open.
9023 Set is_descriptor_opened_.
9024 (File_read::open) [memory]: Assert that descriptor is not open.
9025 (File_read::reopen_descriptor): New function.
9026 (File_read::release): Release descriptor.
9027 (File_read::do_read): Make non-const. Reopen descriptor.
9028 (File_read::read): Make non-const.
9029 (File_read::make_view): Reopen descriptor.
9030 (File_read::do_readv): Likewise.
9031 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9032 Update declarations.
9033 * layout.cc: Include "descriptors.h".
9034 (Layout::create_build_id): Use open_descriptor rather than open.
9035 * output.cc: Include "descriptors.h".
9036 (Output_file::open): Use open_descriptor rather than open.
9037 * archive.cc (Archive::const_iterator): Change Archive to be
9039 (Archive::begin, Archive::end): Make non-const.
9040 (Archive::count_members): Likewise.
9041 * archive.h (class Archive): Update declarations.
9042 * object.h (Object::read): Make non-const.
9043 * Makefile.am (CCFILES): Add descriptors.cc.
9044 (HFILES): Add descriptors.h.
9045 * Makefile.in: Rebuild.
9048 * gold.h: Always include <clocale>. Add Solaris workarounds
9049 following code in binutils/sysdep.h.
9052 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9053 this->eh_frame_hdr_ is NULL before using it.
9055 * dynobj.cc (Versions::Versions): Update comment.
9057 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9058 the base version name.
9060 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9061 array size plus one.
9062 (Stringpool_template::set_string_offsets): Subtract one from key
9063 before using it as an array index.
9064 (Stringpool_template::get_offset_with_length): Likewise.
9065 (Stringpool_template::write_to_buffer): Likewise.
9066 * stringpool.h (Stringpool_template::get_offset_from_key):
9069 2008-07-23 Ian Lance Taylor <iant@google.com>
9072 * object.h (Merged_symbol_value::value): Do our best to handle a
9076 * script.cc (Version_script_info::get_versions): Don't add empty
9077 version tag to return value.
9078 (Version_script_info::get_symbol_version_helper): Change return
9079 type to bool. Add pversion parameter. Change all callers.
9080 (script_register_vers_node): Don't require a non-NULL tag.
9081 * script.h (class Version_script_info): Update declarations.
9082 (Version_script_info::get_symbol_version): Change return type to
9083 bool. Add version parameter. Change all callers.
9084 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9085 handling. Handle an empty version from a version script.
9086 (Symbol_table::define_special_symbol): Likewise.
9087 * testsuite/ver_test_10.script: New file.
9088 * testsuite/ver_test_10.sh: New file.
9089 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9090 (check_DATA): Add ver_test_10.syms.
9091 (ver_test_10.syms, ver_test_10.so): New target.
9092 * testsuite/Makefile.in: Rebuild.
9094 2008-07-23 Simon Baldwin <simonb@google.com>
9096 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9097 to zero for undefined symbols from dynamic libraries.
9099 2008-07-23 Ian Lance Taylor <iant@google.com>
9101 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9103 * symtab.h (class Symbol_table): Update declaration.
9104 * testsuite/ver_test_9.cc: New file.
9105 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9106 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9107 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9108 (ver_test_9.so, ver_test_9.o): New targets.
9109 * testsuite/Makefile.in: Rebuild.
9111 2008-07-22 Ian Lance Taylor <iant@google.com>
9113 * options.h (class General_options): Define --check-sections.
9114 * layout.cc (Layout::set_segment_offsets): Handle
9117 * options.h (class General_options): Define -n/--nmagic and
9119 * options.cc (General_options::finalize): For -n/--nmagic or
9120 -N/--omagic, set -static.
9121 * layout.cc (Layout::attach_allocated_section_to_segment): If
9122 -N/--omagic, don't put read-only and read-write sections in
9124 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9125 finding a read-only segment.
9126 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9127 don't set the minimum segment alignment to the common page size,
9128 and don't set the file offset to the address modulo the page size.
9129 * script-sections.cc (Script_sections::create_segments): If
9130 -n/--omagic, don't put read-only and read-write sections in
9133 * cref.cc: New file.
9135 * options.h (class General_options): Add --print-symbol-counts.
9136 * main.cc (main): Issue defined symbol report if requested.
9137 * archive.cc (Archive::interpret_header): Make into a const member
9139 (Archive::add_symbols): Call Input_objects::archive_start and
9141 (Archive::const_iterator): Define new class.
9142 (Archive::begin, Archive::end): New functions.
9143 (Archive::include_all_members): Rewrite to use iterator.
9144 (Archive::count_members): New function.
9145 * archive.h (class Archive): Update declarations.
9146 (Archive::filename): New function.
9147 * object.cc: Include "cref.h".
9148 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9149 (Sized_relobj::do_get_global_symbol_counts): New function.
9150 (Input_objects::add_object): Add object to cross-referencer.
9151 (Input_objects::archive_start): New function.
9152 (Input_objects::archive_stop): New function.
9153 (Input_objects::print_symbol_counts): New function.
9154 * object.h: Declare Cref and Archive.
9155 (Object::get_global_symbol_counts): New function.
9156 (Object::do_get_global_symbol_counts): New pure virtual function.
9157 (class Sized_relobj): Add defined_count_ field. Update
9159 (class Input_objects): Add cref_ field. Update constructor.
9160 Update declarations.
9161 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9163 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9165 (Sized_dynobj::do_get_global_symbol_counts): New function.
9166 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9167 defined_count_. Update declarations. Define Symbols typedef.
9168 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9169 parameter. Change all callers.
9170 (Symbol_table::add_from_dynobj): Add sympointers and defined
9171 parameters. Change all callers.
9172 * symtab.h (class Symbol_table): Update declarations.
9173 * Makefile.am (CCFILES): Add cref.cc.
9174 (HFILES): Add cref.h.
9175 * Makefile.in: Rebuild.
9177 2008-07-22 Simon Baldwin <simonb@google.com>
9179 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9180 to zero when writing undefined symbols.
9182 2008-07-22 Ian Lance Taylor <iant@google.com>
9184 * output.cc (Output_section::add_input_section): Don't try to
9185 merge empty merge sections.
9187 2008-07-21 Craig Silverstein <csilvers@google.com>
9189 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9190 Include symbol version in error message.
9192 2008-07-20 Chris Demetriou <cgd@google.com>
9194 * configure.ac (gold_cv_c_random_seed): New configured variable.
9195 (RANDOM_SEED_CFLAGS): New substituted variable.
9196 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9197 * configure: Rebuild.
9198 * Makefile.in: Likewise.
9199 * testsuite/Makefile.in: Likewise.
9201 2008-07-18 Ian Lance Taylor <iant@google.com>
9203 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9204 where we see NAME/NULL and NAME/VERSION as separate symbols.
9205 * testsuite/ver_test_main.cc (main): Call t4.
9206 (t4, t4_2a): Define.
9207 * testsuite/ver_test_2.cc (t4_2): Define.
9208 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9209 * testsuite/ver_test_4.cc (t4_2a): Define.
9210 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9211 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9213 2008-07-17 Ian Lance Taylor <iant@google.com>
9215 * dynobj.cc (Versions::add_def): If we give an error about a
9216 missing version, go ahead and create the version anyhow.
9218 2008-07-10 Ian Lance Taylor <iant@google.com>
9220 Handle output sections with more than 0x7fffffff bytes.
9221 * object.h (class Relobj): Change map_to_output_ to
9222 output_sections_, and just keep a section pointer. Change all
9223 uses. Move comdat group support to Sized_relobj.
9224 (Relobj::is_section_specially_mapped): Remove.
9225 (Relobj::output_section): Remove poff parameter. Change all
9227 (Relobj::output_section_offset): New function.
9228 (Relobj::set_section_offset): Rewrite.
9229 (Relobj::map_to_output): Remove.
9230 (Relobj::output_sections): New function.
9231 (Relobj::do_output_section_offset): New pure virtual function.
9232 (Relobj::do_set_section_offset): Likewise.
9233 (class Sized_relobj): Add section_offsets_ field. Add comdat
9234 group support from Relobj. Update declarations.
9235 (Sized_relobj::get_output_section_offset): New function.
9236 (Sized_relobj::do_output_section_offset): New function.
9237 (Sized_relobj::do_set_section_offset): New function.
9238 * object.cc (Relobj::output_section_address): Remove.
9239 (Sized_relobj::Sized_relobj): Initialize new fields.
9240 (Sized_relobj::include_section_group): Cast find_kept_object to
9242 (Sized_relobj::include_linkonce_section): Likewise.
9243 (Sized_relobj::do_layout): Use separate arrays for output section
9245 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9247 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9248 output_sections and section_offsets.
9249 (Sized_relobj::write_local_symbols): Likewise.
9250 (map_to_kept_section): Compute output address directly.
9251 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9252 output_sections and section_offsets.
9253 (Sized_relobj::write_sections): Likewise.
9254 (Sized_relobj::relocate_sections): Likewise.
9255 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9256 * output.h (class Output_reloc): Update declarations. Change
9257 u2_.relobj to Sized_relobj*.
9258 (class Output_data_reloc): Change add functions to use
9260 * output.cc (Output_reloc::Output_reloc): Change relobj to
9262 (Output_reloc::local_section_offset): Change return type to
9263 Elf_Addr. Use get_output_section_offset.
9264 (Output_reloc::get_address): Likewise.
9265 (Output_section::is_input_address_mapped): Don't call
9266 is_section_specially_mapped.
9267 (Output_section::output_offset): Likewise.
9268 (Output_section::output_address): Likewise.
9269 (Output_section::starting_output_address): Likewise.
9270 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9271 parameter to Sized_relobj*.
9272 (Copy_relocs::need_copy_reloc): Likewise.
9273 (Copy_relocs::save): Likewise.
9274 * copy-relocs.h (class Copy_relocs): Update declarations.
9275 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9276 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9277 * target-reloc.h (relocate_for_relocatable): Change
9278 offset_in_output_section type to Elf_Addr. Change code that uses
9280 * layout.cc (Layout::layout): Always set *off.
9281 * mapfile.cc (Mapfile::print_input_section): Use
9282 output_section_offset.
9283 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9285 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9286 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9287 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9289 2008-07-03 Ian Lance Taylor <iant@google.com>
9291 * layout.cc (Layout::include_section): Do not discard unrecognized
9292 SHT_STRTAB sections.
9294 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9296 * script.cc (Lex::can_continue_name): Make '?' allowable in
9297 version-script names.
9298 * testsuite/version_script.map: Change glob pattern to use '?'
9300 2008-06-30 Manish Singh <yosh@gimp.org>
9303 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9306 2008-06-30 Ian Lance Taylor <iant@google.com>
9310 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9311 versions]: Don't try to read the value in the contents, since we
9312 don't use it. Use the template endianness when writing.
9314 2008-06-25 Cary Coutant <ccoutant@google.com>
9316 * fileread.cc (File_read::make_view): Assert on zero-length view.
9317 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9318 symbol table when there are no symbols to read.
9320 2008-06-23 Craig Silverstein <csilvers@google.com>
9322 * version.cc (version_string): Bump to 1.7
9324 2008-06-18 Craig Silverstein <csilvers@google.com>
9326 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9327 constant 0xFFFF to type Valtype.
9328 (Powerpc_relocate_functions::rel16_ha): Likewise.
9330 2008-06-17 Ian Lance Taylor <iant@google.com>
9332 * output.h (Output_section::Input_section): Initialize p2align_ to
9333 zero for Output_section_data constructors.
9334 (Output_section::Input_section::addralign): If not an input
9335 section, return the alignment of the Output_section_data.
9336 * testsuite/copy_test.cc: New file.
9337 * testsuite/copy_test_1.cc: New file.
9338 * testsuite/copy_test_2.cc: New file.
9339 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9340 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9341 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9342 (copy_test_1_pic.o, copy_test_1.so): New targets.
9343 (copy_test_2_pic.o, copy_test_2.so): New targets.
9344 * testsuite/Makefile.in: Rebuild.
9346 * script-sections.cc (Script_sections::place_orphan): Initialize
9347 local variable exact.
9349 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9351 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9353 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9354 David S. Miller <davem@davemloft.net>
9356 * powerpc.cc: New file.
9357 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9358 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9359 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9360 * Makefile.in: Rebuild.
9362 2008-06-09 Ian Lance Taylor <iant@google.com>
9364 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9366 (throwing, orig_terminate): New static variables.
9367 (terminate_handler): New static function.
9368 (t2): Set terminate handler.
9370 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9373 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9376 2008-05-30 Cary Coutant <ccoutant@google.com>
9378 * archive.cc (Archive::include_all_members) Correct to step
9379 over symbol table and extended name table in thin archives.
9381 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9384 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9387 2008-05-28 Caleb Howe <cshowe@google.com>
9389 * reduced_debug_output.cc: New file.
9390 * reduced_debug_output.h: New file.
9391 * options.h (class General_options): Add --strip-debug-non-line.
9392 * options.cc (General_options::finalize): Add strip_debug_non_line
9393 to the strip heirarchy.
9394 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9396 * layout.cc: Include "reduced_debug_output.h".
9397 (Layout::Layout): Initialize new fields.
9398 (line_only_debug_sections): New static array.
9399 (is_lines_only_debug_sections): New static inline function.
9400 (Layout::include_section): Handle --strip-debug-non-line.
9401 (Layout::make_output_section): If --strip-debug-non-line, build
9402 new output sections for .debug_abbrev and .debug_info.
9403 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9404 gold. Warn about possible overflow.
9405 (read_signed_LEB_128): Likewise.
9406 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9407 (read_signed_LEB_128): Declare.
9408 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9409 (HFILES): Add reduced_debug_output.h.
9410 * Makefile.in: Rebuild.
9412 2008-05-21 Ian Lance Taylor <iant@google.com>
9414 * mapfile.cc: New file.
9415 * mapfile.h: New file.
9416 * options.h (class General_options): Add -M/--print-map and -Map.
9417 * options.cc (General_options::finalize): Make -M equivalent to
9419 * main.cc: Include <cstdio> and "mapfile.h".
9420 (main): Open mapfile if requested.
9421 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9422 constructor. Change caller.
9423 (queue_initial_tasks): Add mapfile parameter. Change caller.
9424 (queue_middle_tasks): Likewise.
9425 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9427 * archive.cc: Include "mapfile.h".
9428 (Archive::add_symbols): Add mapfile parameter. Change all
9429 callers. Pass mapfile, symbol, and reason to include_member.
9430 (Archive::include_all_members): Add mapfile parameter. Change all
9432 (Archive::include_member): Add mapfile, sym, and why parameters.
9433 Change all callers. Report inclusion to map file.
9434 * archive.h: Include "fileread.h".
9435 (class Archive): Update declarations.
9436 (Archive::file): New const method.
9437 (class Add_archive_symbols): Add mapfile_ field. Update
9438 constructor. Change all callers.
9439 * readsyms.h (class Read_symbols): Likewise.
9440 (class Finish_group): Likewise.
9441 (class Read_script): Likewise.
9442 * common.cc: Include "mapfile.h".
9443 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9445 (Symbol_table::do_allocate_commons): Likewise.
9446 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9447 symbol allocation to mapfile.
9448 * common.h (class Allocate_commons_task): Add mapfile_ field.
9449 Update constructor. Change all callers.
9450 * symtab.h (class Symbol_table): Update declarations.
9451 * layout.cc: Include "mapfile.h".
9452 (Layout_task_runner::run): Print information to mapfile.
9453 (Layout::create_gold_note): Change Output_data_fixed_space to
9454 Output_data_zero_fill.
9455 (Layout::create_build_id): Likewise.
9456 (Layout::print_to_mapfile): New function.
9457 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9458 constructor. Change caller.
9459 (class Layout): Declare print_to_mapfile.
9460 * output.cc (Output_section::Input_section::print_to_mapfile): New
9462 (Output_section::add_input_section): If producing a map, always
9463 add to input_sections_ list.
9464 (Output_section::do_print_to_mapfile): New function.
9465 (Output_segment::print_sections_to_mapfile): New function.
9466 (Output_segment::print_section_list_to_mapfile): New function.
9467 * output.h: Include "mapfile.h".
9468 (Output_data::print_to_mapfile): New function.
9469 (Output_data::do_print_to_mapfile): New virtual function.
9470 (Output_segment_headers::do_print_to_mapfile): New function.
9471 (Output_file_header::do_print_to_mapfile): New function.
9472 (Output_data_const::do_print_to_mapfile): New function.
9473 (class Output_data_const_buffer): Add map_name_ field. Update
9474 constructor. Change all callers. Add do_print_to_mapfile
9476 (class Output_data_fixed_space): Likewise.
9477 (class Output_data_space): Likewise.
9478 (class Output_data_zero_fill): New class.
9479 (Output_data_strtab::do_print_to_mapfile): New function.
9480 (Output_data_reloc_base::do_print_to_mapfile): New function.
9481 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9482 (Output_data_group::do_print_to_mapfile): New function.
9483 (Output_data_got::do_print_to_mapfile): New function.
9484 (Output_data_dynamic::do_print_to_mapfile): New function.
9485 (Output_symtab_xindex::do_print_to_mapfile): New function.
9486 (class Output_section): Declare do_print_to_mapflie. Declare
9487 print_to_mapfile in Input_section.
9488 (class Output_segment): Declare new functions.
9489 * object.h (Sized_relobj::symbol_count): New function.
9490 * script-sections.cc
9491 (Output_section_element_dot_assignment::set_section_addresses):
9492 Change Output_data_fixed_space to Output_data_zero_fill.
9493 (Output_data_expression::do_print_to_mapfile): New function.
9494 * script.cc (read_input_script): Add mapfile parameter. Change
9496 * script.h (read_input_script): Update declaration.
9497 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9498 (Eh_frame::do_print_to_mapfile): New function.
9499 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9500 (Output_merge_string::do_print_to_mapfile): New function.
9501 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9503 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9505 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9507 * Makefile.am (CCFILES): Add mapfile.cc.
9508 (HFILES): Add mapfile.h.
9509 * Makefile.in: Rebuild.
9511 2008-05-19 Ian Lance Taylor <iant@google.com>
9513 * options.h (class General_options): Add -z relro.
9514 * layout.cc (Layout::Layout): Initialize relro_segment_.
9515 (Layout::add_output_section_data): Return the output section.
9516 (Layout::make_output_section): Rcognize relro sections and mark
9518 (Layout::attach_allocated_section_to_segment): Put relro sections
9519 in a PT_GNU_RELRO segment.
9520 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9522 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9524 (Layout::linkonce_mapping): Map d.rel.ro.local to
9526 (Layout::output_section_name): Us .data.rel.ro.local for any
9527 section which begins with that.
9528 * layout.h (class Layout): Update add_output_section_data
9529 declaration. Add relro_segment_ field.
9530 * output.cc (Output_section::Output_section): Initialize is_relro_
9531 and is_relro_local_ fields.
9532 (Output_segment::add_output_section): Group relro sections.
9533 (Output_segment::is_first_section_relro): New function.
9534 (Output_segment::maximum_alignment): If there is a relro section,
9535 align the segment to the common page size.
9536 (Output_segment::set_section_addresses): Track whether we are
9537 looking at relro sections. If the last section is a relro
9538 section, align to the common page size.
9539 (Output_segment::set_section_list_addresses): Add in_relro
9540 parameter. Change all callers. Align to the page size when
9541 moving from relro to non-relro section.
9542 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9544 * output.h (class Output_section): Add is_relro_ and
9545 is_relro_local_ fields.
9546 (Output_section::is_relro): New function.
9547 (Output_section::set_is_relro): New function.
9548 (Output_section::is_relro_local): New function.
9549 (Output_section::set_is_relro_local): New function.
9550 (class Output_segment): Update declarations.
9551 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9552 * sparc.cc (Target_sparc::got_section): Likewise.
9553 * x86_64.cc (Target_x86_64::got_section): Likewise.
9554 * testsuite/relro_test_main.cc: New file.
9555 * testsuite/relro_test.cc: New file.
9556 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9557 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9558 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9559 (relro_test.so, relro_test_pic.o): New targets.
9560 * testsuite/Makefile.in: Rebuild.
9562 2008-05-16 Ian Lance Taylor <iant@google.com>
9564 * output.cc (Output_segment::add_output_section): Remove front
9566 * output.h (class Output_segment): Remove
9567 add_initial_output_section and overloaded add_output_section.
9568 Update declaration of remaining add_output_section.
9569 * layout.cc (Layout::create_interp): Call add_output_section
9570 rather than add_initial_output_section.
9571 (Layout::finish_dynamic_section): Likewise.
9573 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9574 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9575 know the dynamic type.
9576 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9577 field. Initialize it in constructor.
9578 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9579 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9580 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9583 * output.cc (Output_reloc::get_address): Change return type to
9585 * output.h (class Output_reloc): Update get_address declaration.
9586 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9587 for section addresses.
9589 2008-05-09 Ian Lance Taylor <iant@google.com>
9592 * gold.cc (gold_nomem): Use return value of write.
9594 2008-05-08 Ian Lance Taylor <iant@google.com>
9596 * symtab.c (Symbol::init_base_output_data): Add version
9597 parameter. Change all callers.
9598 (Symbol::init_base_output_segment): Likewise.
9599 (Symbol::init_base_constant): Likewise.
9600 (Symbol::init_base_undefined): Likewise.
9601 (Sized_symbol::init_output_data): Likewise.
9602 (Sized_symbol::init_output_segment): Likewise.
9603 (Sized_symbol::init_constant): Likewise.
9604 (Sized_symbol::init_undefined): Likewise.
9605 (Symbol_table::do_define_in_output_data): If the new symbol has a
9606 version, mark it as the default.
9607 (Symbol_table::do_define_in_output_segment): Likewise.
9608 (Symbol_table::do_define_as_constant): Likewise.
9609 * symtab.h (class Symbol): Update declarations.
9610 (class Sized_symbol): Likewise.
9611 * resolve.cc (Symbol::override_version): New function.
9612 (Symbol::override_base): Call override_version.
9613 (Symbol::override_base_with_special): Likewise.
9614 * testsuite/ver_script_8.script: New file.
9615 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9616 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9617 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9618 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9620 2008-05-06 Ian Lance Taylor <iant@google.com>
9623 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9625 (class General_options): Remove existing --undefined, and add
9626 --no-undefined instead. Add new --undefined as synonym for -u.
9627 * archive.cc (Archive::add_symbols): Check whether symbol was
9629 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9630 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9631 all uses. Add IS_UNDEFINED. Update declarations to split
9632 different versions of init_base. Declare init_base_undefined.
9633 (Symbol::is_defined): Handle IS_UNDEFINED.
9634 (Symbol::is_undefined): Likewise.
9635 (Symbol::is_weak_undefined): Call is_undefined.
9636 (Symbol::is_absolute): Handle IS_CONSTANT.
9637 (class Sized_symbol): Update declarations to split different
9638 versions of init. Declare init_undefined.
9639 (class Symbol_table): Declare new functions.
9640 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9642 (Symbol::init_base_output_data): Likewise.
9643 (Symbol::init_base_output_segment): Likewise.
9644 (Symbol::init_base_constant): Likewise.
9645 (Symbol::init_base_undefined): New function.
9646 (Sized_symbol::init_object): Rename from init. Change all
9648 (Sized_symbol::init_output_data): Likewise.
9649 (Sized_symbol::init_output_segment): Likewise.
9650 (Sized_symbol::init_constant): Likewise.
9651 (Sized_symbol::init_undefined): New function.
9652 (Symbol_table::add_undefined_symbols_from_command_line): New
9654 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9656 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9657 (Symbol::output_section): Likewise.
9658 (Symbol::set_output_section): Likewise.
9659 (Symbol_table::sized_finalize_symbol): Likewise.
9660 (Symbol_table::sized_write_globals): Likewise.
9661 * resolve.cc (Symbol_table::should_override): Likewise.
9662 (Symbol::override_base_with_special): Likewise.
9664 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9665 symbol, change it to have default visibility.
9666 * testsuite/protected_1.cc: New file.
9667 * testsuite/protected_2.cc: New file.
9668 * testsuite/protected_3.cc: New file.
9669 * testsuite/protected_main_1.cc: New file.
9670 * testsuite/protected_main_2.cc: New file.
9671 * testsuite/protected_main_3.cc: New file.
9672 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9673 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9674 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9675 (protected_1.so): New target.
9676 (protected_1_pic.o, protected_2_pic.o): New targets.
9677 (protected_3_pic.o): New target.
9678 (check_PROGRAMS): Add protected_2.
9679 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9680 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9681 * testsuite/Makefile.in: Rebuild.
9683 * options.h (DEFINE_var): Add set_user_set_##varname__.
9684 (DEFINE_bool_alias): New macro.
9685 (class General_options): Define -Bstatic using DEFINE_bool_alias
9686 rather than DEFINE_special. Add --undefined as an alias for -z
9688 * options.cc (General_options::parse_Bstatic): Remove.
9690 * options.h (class General_options): Add --fatal-warnings.
9691 * main.cc (main): Implement --fatal-warnings.
9692 * errors.h (Errors::warning_count): New function.
9694 * options.h (class General_options): Add -Bsymbolic-functions.
9695 * symtab.h (Symbol::is_preemptible): Check for
9696 -Bsymbolic-functions.
9698 2008-05-05 Ian Lance Taylor <iant@google.com>
9700 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9701 as noVARNAME rather than no-VARNAME.
9702 (class General_options): Add option -z combreloc.
9703 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9705 (Output_reloc::sort_before) [SHT_REL]: New function.
9706 (Output_reloc::sort_before) [SHT_RELA]: New function.
9707 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9708 Sort_relocs_comparison.
9709 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9710 parameter. Change all callers.
9711 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9712 sort_relocs parameter. Change all callers.
9713 * output.cc (Output_reloc::get_address): New function, broken out
9715 (Output_reloc::write_rel): Call it.
9716 (Output_reloc::compare): New function.
9717 (Output_data_reloc_base::do_write): Optionally sort relocs.
9719 * configure.ac: If targ_extra_obj is set, link it in.
9720 * configure.tgt: Initialize all variables.
9721 (x86_64*): Set targ_extra_obj and targ_extra_size.
9722 * configure: Rebuild.
9724 * object.cc (Sized_relobj::include_section_group): Adjust section
9725 indexes read from group data. Build vector to pass to
9727 * layout.cc (Layout::layout_group): Add flags and shndxes
9728 parameters. Remove contents parameter. Change caller. Update
9729 explicit instantiations.
9730 * layout.h (class Layout): Update layout_group declaration.
9731 * output.cc (Output_data_group::Output_data_group): Add flags and
9732 input_shndxes parameters. Remove contents parameter. Change
9734 (Output_data_group::do_write): Change input_sections_ to
9736 * output.h (class Output_data_group): Update constructor
9737 declaration. Rename input_sections_ to input_shndxes_.
9738 * testsuite/many_sections_test.cc: Add template.
9740 2008-04-30 Cary Coutant <ccoutant@google.com>
9742 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9744 * layout.cc (Layout::include_section): Refactored check for debug
9746 (Layout::add_comdat): Add new parameters. Change type
9747 of signature parameter. Add object and shndx to signatures table.
9748 (Layout::find_kept_object): New function.
9749 * layout.h: Include <cstring>.
9750 (Layout::is_debug_info_section): New function.
9751 (Layout::add_comdat): Add new parameters.
9752 (Layout::find_kept_object): New function.
9753 (Layout::Kept_section): New struct.
9754 (Layout::Signatures): Change type of map range.
9755 * object.cc (Relobj::output_section_address): New function.
9756 (Sized_relobj::include_section_group): Add new parameters. Change
9757 calls to Layout::add_comdat. Change to build table of kept comdat
9758 groups and table mapping discarded sections to kept sections.
9759 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9760 (Sized_relobj::do_layout): Change calls to include_section_group and
9761 include_linkonce_section.
9762 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9763 value to zero when section is discarded.
9764 (Sized_relobj::map_to_kept_section): New function.
9765 * object.h (Relobj::output_section_address): New function.
9766 (Relobj::Comdat_group): New type.
9767 (Relobj::find_comdat_group): New function.
9768 (Relobj::Comdat_group_table): New type.
9769 (Relobj::Kept_comdat_section): New type.
9770 (Relobj::Kept_comdat_section_table): New type.
9771 (Relobj::add_comdat_group): New function.
9772 (Relobj::set_kept_comdat_section): New function.
9773 (Relobj::get_kept_comdat_section): New function.
9774 (Relobj::comdat_groups_): New field.
9775 (Relobj::kept_comdat_sections_): New field.
9776 (Symbol_value::input_value): Update comment.
9777 (Sized_relobj::map_to_kept_section) New function.
9778 (Sized_relobj::include_linkonce_section): Add new parameter.
9779 * target-reloc.h (Comdat_behavior): New type.
9780 (get_comdat_behavior): New function.
9781 (relocate_section): Add code to map a discarded section to the
9782 corresponding kept section when applying a relocation.
9784 2008-04-30 Craig Silverstein <csilvers@google.com>
9786 * dwarf_reader.cc (next_generation_count): New static var.
9787 (Addr2line_cache_entry): New struct.
9788 (addr2line_cache): New static var.
9789 (Dwarf_line_info::one_addr2line): Added caching.
9790 (Dwarf_line_info::clear_addr2line_cache): New function.
9791 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9792 cache-size parameter.
9793 (Dwarf_line_info::one_addr2line_cache): New function.
9794 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9795 new cache-size argument to one_addr2line(), and clear cache.
9797 2008-04-28 Cary Coutant <ccoutant@google.com>
9799 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9800 R_386_PC8 relocations.
9802 2008-04-23 Ian Lance Taylor <iant@google.com>
9804 * object.cc (Sized_relobj::include_section_group): Check for
9805 invalid section group.
9807 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9810 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9811 than read for file header.
9812 * archive.cc (Archive::include_member): Likewise.
9814 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
9816 * aclocal.m4: Regenerate.
9817 * configure: Regenerate.
9819 2008-04-19 Ian Lance Taylor <iant@google.com>
9821 * version.cc (version_string): Bump to 1.6.
9823 * testsuite/Makefile.am (many_sections_r_test): New target.
9824 (many_sections_r_test_SOURCES): Remove.
9825 (many_sections_r_test_DEPENDENCIES): Remove.
9826 (many_sections_r_test_LDFLAGS): Remove.
9827 (many_sections_r_test_LDADD): Remove.
9829 * object.cc (Sized_relobj::do_add_symbols): Always pass
9830 local_symbol_count_ to add_from_relobj.
9832 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9833 every thousand variables.
9834 * testsuite/Makefile.in: Rebuild.
9836 * object.cc (Xindex::initialize_symtab_xindex): New function.
9837 (Xindex::read_symtab_xindex): New function.
9838 (Xindex::sym_xindex_to_shndx): New function.
9839 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9841 (Sized_relobj::do_initialize_xindex): New function.
9842 (Sized_relobj::do_read_symbols): Adjust section links.
9843 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9844 parameter. Change all callers.
9845 (Sized_relobj::include_section_group): Adjust section links and
9846 symbol section indexes.
9847 (Sized_relobj::do_layout): Adjust section links.
9848 (Sized_relobj::do_count_local_symbols): Adjust section links and
9849 symbol section indexes.
9850 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9851 ordinary and special symbols.
9852 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9853 dynsym_xindex parameters. Change all callers. Adjust section
9854 links. Use SHN_XINDEX when needed.
9855 (Sized_relobj::get_symbol_location_info): Adjust section links.
9856 Don't get fooled by special symbols.
9857 * object.h (class Xindex): Define.
9858 (class Object): Add xindex_ parameter. Declare virtual functoin
9859 do_initialize_xindex.
9860 (Object::adjust_sym_shndx): New function.
9861 (Object::set_xindex): New protected function.
9862 (class Symbol_value): Add is_ordinary_shndx_ field.
9863 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9864 (Symbol_value::value): Assert ordinary section.
9865 (Symbol_value::initialize_input_to_output_map): Likewise.
9866 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9868 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9870 (class Sized_relobj): Update declarations.
9871 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9872 parameter. Change all callers.
9873 (Sized_relobj::adjust_shndx): New function.
9874 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9876 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9877 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9878 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9879 (Sized_dynobj::read_dynsym_section): Adjust section links.
9880 (Sized_dynobj::read_dynamic): Likewise.
9881 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9883 (Sized_dynobj::do_initialize_xindex): New function.
9884 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9885 do_initialize_xindex.
9886 (Sized_dynobj::adjust_shndx): New function.
9887 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9888 dynsym_xindex_ fields.
9889 (Layout::finalize): Add a call to set_section_indexes before
9890 creating the symtab sections.
9891 (Layout::set_section_indexes): Don't do anything if the section
9892 already has a section index.
9893 (Layout::create_symtab_sections): Add shnum parameter. Change
9894 caller. Create .symtab_shndx section if needed.
9895 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9897 (Layout::allocated_output_section_count): New function.
9898 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9900 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9901 fields. Update declarations.
9902 (Layout::symtab_xindex): New function.
9903 (Layout::dynsym_xindex): New function.
9904 (class Write_symbols_task): Add layout_ field.
9905 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9907 * output.cc (Output_section_headers::Output_section_headers): Add
9908 shstrtab_section parameter. Change all callers.
9909 (Output_section_headers::do_sized_write): Store overflow values
9910 for section count and section string table section index in
9911 section header zero.
9912 (Output_file_header::do_sized_write): Check for overflow of
9913 section count and section string table section index.
9914 (Output_symtab_xindex::do_write): New function.
9915 (Output_symtab_xindex::endian_do_write): New function.
9916 * output.h (class Output_section_headers): Add shstrtab_section_.
9917 Update declarations.
9918 (class Output_symtab_xindex): Define.
9919 (Output_section::has_out_shndx): New function.
9920 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9922 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9924 (Sized_symbol::init): Likewise.
9925 (Symbol::output_section): Check for ordinary symbol.
9926 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9927 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9929 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9930 Change all callers. Simplify handling of symbols from sections
9931 not included in the link.
9932 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9934 (Weak_alias_sorter::operator()): Assert that symbols are
9936 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9938 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9939 parameters. Change all callers.
9940 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9941 symbol distinction. Use SHN_XINDEX when needed.
9942 (Symbol_table::write_section_symbol): Add symtab_xindex
9943 parameter. Change all callers.
9944 (Symbol_table::sized_write_section_symbol): Likewise. Use
9945 SHN_XINDEX when needed.
9946 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9948 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9949 (Symbol::is_defined): Check is_ordinary.
9950 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9951 (Symbol::is_absolute, Symbol::is_common): Likewise.
9952 (class Sized_symbol): Update declarations.
9953 (class Symbol_table): Update declarations.
9954 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9955 parameters. Change all callers.
9956 (Sized_symbol::override): Likewise.
9957 (Symbol_table::override): Likewise.
9958 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9959 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9960 is_ordinary, and orig_st_shndx parameters. Change all callers.
9961 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9962 to be in an ordinary section.
9963 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9964 object and is_ordinary parameters. Change all callers.
9965 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9966 Change all callers. Don't add undefined or non-ordinary symbols
9968 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9970 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9972 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9973 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9974 (Sized_relobj::relocate_sections): Likewise.
9975 * target-reloc.h (scan_relocs): Adjust section symbol index.
9976 (scan_relocatable_relocs): Likewise.
9977 * i386.cc (Scan::local): Check for ordinary symbols.
9978 * sparc.cc (Scan::local): Likewise.
9979 * x86_64.cc (Scan::local): Likewise.
9980 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9981 to symbol_section_and_value.
9982 * testsuite/many_sections_test.cc: New file.
9983 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9984 (check_PROGRAMS): Add many_sections_test.
9985 (many_sections_test_SOURCES): Define.
9986 (many_sections_test_DEPENDENCIES): Define.
9987 (many_sections_test_LDFLAGS): Define.
9988 (BUILT_SOURCES): Add many_sections_define.h.
9989 (many_sections_define.h): New target.
9990 (BUILT_SOURCES): Add many_sections_check.h.
9991 (many_sections_check.h): New target.
9992 (check_PROGRAMS): Add many_sections_r_test.
9993 (many_sections_r_test_SOURCES): Define.
9994 (many_sections_r_test_DEPENDENCIES): Define.
9995 (many_sections_r_test_LDFLAGS): Define.
9996 (many_sections_r_test_LDADD): Define.
9997 (many_sections_r_test.o): New target.
9998 * testsuite/Makefile.in: Rebuild.
10000 2008-04-17 Cary Coutant <ccoutant@google.com>
10002 * errors.cc (Errors::info): New function.
10003 (gold_info): New function.
10004 * errors.h (Errors::info): New function.
10005 * gold.h (gold_info): New function.
10006 * object.cc (Input_objects::add_object): Print trace output.
10007 * options.cc (options::parse_set): New function.
10008 (General_options::parse_wrap): Deleted.
10009 (General_options::General_options): Deleted initializer.
10010 * options.h (options::String_set): New typedef.
10011 (options::parse_set): New function.
10012 (DEFINE_set): New macro.
10013 (General_options::wrap): Changed to use DEFINE_set. Changed
10014 callers of any_wrap_symbols and is_wrap_symbol.
10015 (General_options::trace, General_options::trace_symbol):
10017 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10018 (General_options::wrap_symbols_): Deleted.
10019 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10021 2008-04-17 David S. Miller <davem@davemloft.net>
10023 * options.cc (General_options::parse_V): New function.
10024 * options.h: Add entries for -V and -Qy.
10026 2008-04-17 Ian Lance Taylor <iant@google.com>
10028 * common.cc (Symbol_table::allocate_commons): Remove options
10029 parameter. Change caller.
10030 (Symbol_table::do_allocate_commons): Remove options parameter.
10031 Change caller. Just call do_allocate_commons_list twice.
10032 (Symbol_table::do_allocate_commons_list): New function, broken out
10033 of do_allocate_commons.
10034 * common.h (class Allocate_commons_task): Remove options_ field.
10035 Update constructor.
10036 * symtab.cc (Symbol_table::Symbol_table): Initialize
10038 (Symbol_table::add_from_object): Put TLS common symbols on
10040 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10041 which are IN_OUTPUT_DATA.
10042 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10043 allocate_commons and do_allocate_commons declarations. Declare
10044 do_allocate_commons_list.
10045 * gold.cc (queue_middle_tasks): Update creation of
10046 Allocate_commons_task to not pass options.
10047 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10048 (TLS_TEST_C_FLAGS): New variable.
10049 (tls_test_c_pic.o): New target.
10050 (tls_test_shared.so): Link in tls_test_c_pic.o.
10051 (tls_test_c_pic_ie.o): New target.
10052 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10053 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10054 (tls_test_c.o): New target.
10055 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10056 (tls_pic_test_LDADD): Likewise.
10057 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10058 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10059 (tls_test_c_gnu2.o): New target.
10060 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10062 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10063 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10064 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10065 * testsuite/tls_test.cc: Include "config.h".
10066 (t_last): Call t11_last.
10067 * testsuite/tls_test.h (t11, t11_last): Declare.
10068 * testsuite/tls_test_c.c: New file.
10069 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10070 * configure.ac: Check for OpenMP support.
10071 * configure, config.in, Makefile.in: Rebuild.
10072 * testsuite/Makefile.in: Rebuild.
10074 2008-04-16 Cary Coutant <ccoutant@google.com>
10076 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10077 (Target_i386::tls_base_symbol_defined_): New field.
10078 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10079 (Target_i386::Scan::global): Likewise.
10080 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10081 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10082 (Target_x86_64::tls_base_symbol_defined_): New field.
10083 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10084 (Target_x86_64::Scan::global): Likewise.
10086 2008-04-16 Cary Coutant <ccoutant@google.com>
10088 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10089 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10090 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10091 building shared libraries.
10092 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10093 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10094 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10095 * testsuite/Makefile.in: Rebuild.
10096 * testsuite/weak_undef.h: New file.
10097 * testsuite/weak_undef_file1.cc: Add extra test cases.
10098 * testsuite/weak_undef_file2.cc: Likewise.
10099 * testsuite/weak_undef_test.cc: Likewise.
10101 2008-04-16 David S. Miller <davem@davemloft.net>
10103 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10104 Add issued_non_pic_error_ field. Declare check_non_pic.
10105 (Target_sparc::Scan::check_non_pic): New function.
10106 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10107 (Target_sparc::Scan::global): Likewise.
10109 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10110 * configure: Rebuild.
10112 * options.h (DEFINE_enable): New macro.
10113 (new_dtags): New enable option.
10114 (initfirst, interpose, loadfltr, nodefaultlib,
10115 nodelete, nodlopen, nodump): New -z options.
10116 * layout.cc (Layout:finish_dynamic_section): If new
10117 dtags enabled, emit DT_RUNPATH. Also, emit a
10118 DT_FLAGS_1 containing any specified -z flags.
10120 2008-04-16 Ian Lance Taylor <iant@google.com>
10122 * copy-relocs.cc: New file.
10123 * copy-relocs.h: New file.
10124 * reloc.cc: Remove Copy_relocs code.
10125 * reloc.h: Likewise.
10126 * reloc-types.h (struct Reloc_types) [both versions]: Add
10127 get_reloc_addend_noerror.
10128 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10129 variants of add_global which take an addend which must be zero.
10130 * i386.cc: Include "copy-relocs.h".
10131 (class Target_i386): Change type of copy_relocs_ to variable,
10132 update initializer.
10133 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10134 Change all callers.
10135 (Target_i386::do_finalize_sections): Change handling of
10137 * sparc.cc: Include "copy-relocs.h".
10138 (class Target_sparc): Change type of copy_relocs_ to variable,
10139 update initializer.
10140 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10141 Change all callers.
10142 (Target_sparc::do_finalize_sections): Change handling of
10144 * x86_64.cc: Include "copy-relocs.h".
10145 (class Target_x86_64): Change type of copy_relocs_ to variable,
10146 update initializer.
10147 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10148 class. Change all callers.
10149 (Target_x86_64::do_finalize_sections): Change handling of
10151 * Makefile.am (CCFILES): Add copy-relocs.cc.
10152 (HFILES): Add copy-relocs.h.
10154 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10156 * testsuite/script_test_4.sh: Permit leading zeroes.
10158 2008-04-15 Ian Lance Taylor <iant@google.com>
10160 * script-sections.cc (Script_sections::create_segments): Use
10161 header_size_adjustment even when there is enough room for the
10163 * testsuite/script_test_4.sh: New file.
10164 * testsuite/script_test_4.t: New file.
10165 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10166 (check_DATA): Add script_test_4.stdout.
10167 (MOSTLYCLEANFILES): Likewise.
10168 (script_test_4): New target.
10169 (script_test_4.stdout): New target.
10170 * testsuite/Makefile.in: Rebuild.
10172 * sparc.cc: Add definitions for Output_data_plt_sparc class
10175 2008-04-14 David S. Miller <davem@davemloft.net>
10177 * sparc.cc: New file.
10178 * Makefile.am (TARGETSOURCES): Add sparc.cc
10179 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10180 * configure.tgt: Document targ_extra_size and
10181 targ_extra_big_endian. Add entries for sparc-* and
10183 * configure.ac: Handle targ_extra_size and
10184 targ_extra_big_endian.
10185 * Makefile.in: Rebuild.
10186 * configure: Likewise.
10187 * po/POTFILES.in: Likewise.
10188 * po/gold.pot: Likewise.
10190 2008-04-14 Ian Lance Taylor <iant@google.com>
10192 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10193 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10194 in the name/type/flags to section mapping. Don't call
10195 allocate_output_section.
10196 (Layout::choose_output_section): Change parameter from adjust_name
10197 to is_input_section. Don't permit input sections after sections
10198 are attached to segments. Don't call allocate_output_section.
10199 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10200 not write_enable_output_section.
10201 (Layout::make_output_section): Don't push to
10202 unattached_section_list_ nor call attach_to_segment. Call
10203 attach_section_to_segment if sections are attached.
10204 (Layout::attach_sections_to_segments): New function.
10205 (Layout::attach_section_to_segment): New function.
10206 (Layout::attach_allocated_section_to_segment): Rename from
10207 attach_to_segment. Remove flags parameter.
10208 (Layout::allocate_output_section): Remove function.
10209 (Layout::write_enable_output_section): Remove function.
10210 * layout.h (class Layout): Update for above changes. Add new
10211 field sections_are_attached_.
10212 * output.h (Output_section::update_flags_for_input_section): New
10214 * output.cc (Output_section::add_input_section): Call
10215 update_flags_for_input_section.
10216 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10218 2008-04-11 Cary Coutant <ccoutant@google.com>
10220 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10221 thought unnecessary.
10222 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10224 2008-04-11 Ian Lance Taylor <iant@google.com>
10226 * output.h (class Output_section_data): Remove inline definition
10228 * output.cc (Output_section_data::set_addralign): New function.
10230 2008-04-11 Cary Coutant <ccoutant@google.com>
10232 Add support for TLS descriptors for i386 and x86_64.
10233 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10234 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10235 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10237 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10238 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10239 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10241 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10242 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10243 Fix problem with initial-exec relocations.
10244 (Target_i386::Relocate::relocate_tls): Likewise.
10245 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10247 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10248 support for section-plus-offset dynamic table entries.
10249 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10250 (Output_data_dynamic::Dynamic_entry): Add support for
10251 section-plus-offset dynamic table entries.
10252 (Output_data_dynamic::Classification): Likewise.
10253 (Output_data_dynamic::classification_): Renamed offset_.
10254 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10255 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10256 (Target_x86_64::make_plt_section): New function.
10257 (Target_x86_64::reserve_tlsdesc_entries): New function.
10258 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10259 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10260 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10261 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10262 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10263 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10264 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10265 add extra PLT entry for TLS descriptors.
10266 (Output_data_plt_x86_64::got_): New field.
10267 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10268 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10270 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10272 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10273 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10274 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10275 R_386_TLS_DESC_CALL relocations.
10276 (Target_x86_64::Scan::global): Likewise.
10277 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10278 for TLS descriptors.
10279 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10280 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10281 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10282 GD-to-IE relaxation.
10283 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10284 and TLS_DESCRIPTORS.
10285 * Makefile.in: Rebuild.
10286 * configure: Rebuild.
10287 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10288 (tls_test_shared2.so): New target.
10289 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10290 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10291 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10292 (tls_shared_gd_to_ie_test_LDADD): New variable.
10293 (tls_shared_gnu2_gd_to_ie_test): New target.
10294 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10296 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10297 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10298 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10299 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10300 (tls_shared_gnu2_test): New target.
10301 (tls_test_gnu2_shared.so): New target.
10302 (tls_shared_gnu2_test_SOURCES): New variable.
10303 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10304 (tls_shared_gnu2_test_LDFLAGS): New variable.
10305 (tls_shared_gnu2_test_LDADD): New variable.
10306 * testsuite/Makefile.in: Rebuild.
10307 * testsuite/Makefile.
10309 2008-04-11 Ian Lance Taylor <iant@google.com>
10311 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10313 * testsuite/Makefile.in: Rebuild.
10315 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10317 * testsuite/script_test_2.cc (main): Adjust test.
10319 2008-04-11 David S. Miller <davem@davemloft.net>
10320 Ian Lance Taylor <iant@google.com>
10322 * options.h (General_options): Add entries for '-Y' and
10324 * options.cc (General_options:finalize): If -Y was used, add those
10325 entries to the library path instead of the default "/lib" and
10328 2008-04-11 David S. Miller <davem@davemloft.net>
10330 * testsuite/justsyms.t: Start at 0x100.
10331 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10332 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10334 * testsuite/script_test_2.cc: Adjust string and section length
10337 2008-04-09 Ian Lance Taylor <iant@google.com>
10340 * script-sections.cc (Sections_element::allocate_to_segment): Add
10342 (Output_section_definition::allocate_to_segment): Likewise.
10343 (Orphan_output_section::allocate_to_segment): Likewise.
10344 (Script_sections::attach_sections_using_phdrs_clause): Don't
10345 propagate non-PT_LOAD segments to orphan sections.
10346 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10347 readelf rather than objdump.
10348 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10349 .interp section and PT_INTERP segment are the same size.
10350 * testsuite/Makefile.in: Rebuild.
10352 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10353 aliases for symbols defined in the same object.
10354 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10355 (weak_alias_test_SOURCES): New variable.
10356 (weak_alias_test_DEPENDENCIES): New variable.
10357 (weak_alias_test_LDFLAGS): New variable.
10358 (weak_alias_test_LDADD): New variable.
10359 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10360 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10361 (weak_alias_test_3.o): New target.
10362 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10363 * testsuite/weak_alias_test_main.cc: New file.
10364 * testsuite/weak_alias_test_1.cc: New file.
10365 * testsuite/weak_alias_test_2.cc: New file.
10366 * testsuite/weak_alias_test_3.cc: New file.
10368 2008-04-08 Ian Lance Taylor <iant@google.com>
10370 * options.h (class General_options): Add --noinhibit-exec option.
10371 * main.cc (main): Check --noinhibit-exec.
10373 * options.h (class General_options): Define --wrap as a special
10374 option. Add wrap_symbols_ field.
10375 (General_options::any_wrap_symbols): New function.
10376 (General_options::is_wrap_symbol): New function.
10377 * options.cc (General_options::parse_wrap): New function.
10378 (General_options::General_options): Initialize wrap_symbols_.
10379 * symtab.cc (Symbol_table::wrap_symbol): New function.
10380 (Symbol_table::add_from_object): Handle --wrap.
10381 * symtab.h (class Symbol_table): Declare wrap_symbol.
10382 * target.h (Target::wrap_char): New function.
10383 (Target::Target_info): Add wrap_char field.
10384 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10385 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10386 * testsuite/testfile.cc (Target_test::test_target_info):
10389 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10392 * layout.h (class Layout): Add added_eh_frame_data_ field.
10393 * layout.cc (Layout::Layout): Initialize new field.
10394 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10395 output section until we find a section we merged successfully.
10396 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10397 that the size be non-zero.
10399 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10402 2008-04-08 Craig Silverstein <csilvers@google.com>
10404 * configure.ac: Export new conditional variable HAVE_ZLIB.
10405 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10407 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10408 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10410 2008-04-07 Ian Lance Taylor <iant@google.com>
10412 * version.cc (version_string): Set to "1.5".
10414 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10415 Add issued_non_pic_error_ field. Declare check_non_pic.
10416 (Target_x86_64::Scan::check_non_pic): New function.
10417 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10418 (Target_x86_64::Scan::global): Likewise.
10420 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10421 addend parameter. Change caller. Handle merge sections.
10422 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10423 Address to Addend. Don't add in the result of
10424 local_section_offset, pass down the addend and use the returned
10426 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10427 Update declarations of local_section_offset and symbol_value.
10428 * testsuite/two_file_test_1.cc (t18): New function.
10429 * testsuite/two_file_test_2.cc (f18): New function.
10430 * testsuite/two_file_test_main.cc (main): Call t18.
10431 * testsuite/two_file_test.h (t18, f18): Declare.
10433 * configure.ac: Don't test for objdump, c++filt, or readelf.
10434 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10436 (TEST_READELF): New variable.
10437 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10438 (check_PROGRAMS): Add two_file_strip_test.
10439 (two_file_strip_test): New target.
10440 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10441 (two_file_same_shared_strip_test_SOURCES): New variable.
10442 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10443 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10444 (two_file_same_shared_strip_test_LDADD): New variable.
10445 (two_file_shared_strip.so): New target.
10446 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10447 (ver_test_5.syms, ver_test_7.syms): Likewise.
10448 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10449 (strip_test_3.stdout): Use TEST_OBJDUMP.
10450 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10452 2008-04-04 Cary Coutant <ccoutant@google.com>
10454 * symtab.h (Symbol::is_weak_undefined): New function.
10455 (Symbol::is_strong_undefined): New function.
10456 (Symbol::is_absolute): New function.
10457 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10458 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10460 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10461 (weak_undef_test): New target.
10462 * testsuite/Makefile.in: Rebuild.
10463 * testsuite/weak_undef_file1.cc: New file.
10464 * testsuite/weak_undef_file2.cc: New file.
10465 * testsuite/weak_undef_test.cc: New file.
10467 2008-04-03 Craig Silverstein <csilvers@google.com>
10469 * compressed_output.h (class Output_compressed_section): Use
10471 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10473 (zlib_compressed_suffix): Removed.
10474 (Output_compressed_section::set_final_data_size): Use unsigned
10476 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10477 Fix linker invocation.
10478 (flagstest_o_specialfile_and_compress_debug_sections):
10480 * testsuite/Makefile.in: Regenerated.
10482 2008-04-02 David S. Miller <davem@davemloft.net>
10484 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10485 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10487 2008-04-02 Craig Silverstein <csilvers@google.com>
10491 2008-04-02 Ian Lance Taylor <iant@google.com>
10493 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10494 parameters. Update for new key type to views_. Change all
10496 (File_read::read): Adjust for byteshift in returned view.
10497 (File_read::add_view): New function, broken out of
10498 find_and_make_view.
10499 (File_read::make_view): New function, broken out of
10500 find_and_make_view.
10501 (File_read::find_or_make_view): Add offset and aligned
10502 parameters. Rewrite accordingly. Change all callers.
10503 (File_read::get_view): Add offset and aligned parameters. Adjust
10504 for byteshift in return value.
10505 (File_read::get_lasting_view): Likewise.
10506 * fileread.h (class File_read): Update declarations.
10507 (class File_read::View): Add byteshift_ field. Add byteshift to
10508 constructor. Add byteshift method.
10509 * archive.h (Archive::clear_uncached_views): New function.
10510 (Archive::get_view): Add aligned parameter. Change all callers.
10511 * object.h (Object::get_view): Add aligned parameter. Change all
10513 (Object::get_lasting_view): Likewise.
10515 * fileread.cc (File_read::release): Don't call clear_views if
10516 there are multiple objects.
10517 * fileread.h (File_read::clear_uncached_views): New function.
10518 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10521 2008-03-31 Cary Coutant <ccoutant@google.com>
10523 Add thin archive support.
10524 * archive.cc (Archive::armagt): New const.
10525 (Archive::setup): Remove task parameter and calls to unlock.
10526 (Archive::unlock_nested_archives): New function.
10527 (Archive::read_header): Add nested_off parameter. Change
10529 (Archive::interpret_header): Likewise.
10530 (Archive::include_all_members): Change to handle thin
10532 (Archive::include_member): Likewise.
10533 * archive.h (Archive::Archive): Add new parameters and
10535 (Archive::armagt): New const.
10536 (Archive::setup): Remove task parameter.
10537 (Archive::unlock_nested_archives): New function.
10538 (Archive::read_header): Add nested_off parameter.
10539 (Archive::interpret_header): Likewise.
10540 (Archive::Nested_archive_table): New typedef.
10541 (Archive::is_thin_archive_): New field.
10542 (Archive::nested_archives_): New field.
10543 (Archive::options_): New field.
10544 (Archive::dirpath_): New field.
10545 (Archive::task_): New field.
10546 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10547 for thin archives. Pass additional parameters to
10548 Archive::Archive. Unlock the archive file after calling
10551 2008-03-29 Ian Lance Taylor <iant@google.com>
10553 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10554 version symbol to be local.
10555 * testsuite/ver_test_4.sh: New file.
10556 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10557 (check_DATA): Add ver_test_4.syms.
10558 (ver_test_4.syms): New target.
10559 * testsuite/Makefile.in: Rebuild.
10562 (Output_section::Input_section_sort_entry::has_priority): New
10564 (Output_section::Input_section_sort_entry::match_file_name): New
10566 (Output_section::Input_section_sort_entry::match_section_name):
10568 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10570 (Output_section::Input_section_sort_entry::match_section_file):
10572 (Output_section::Input_section_sort_compare::operator()): Rewrite
10573 using new Input_section_sort_entry functions. Sort crtbegin and
10574 crtend first. Sort sections with no priority before sections with
10576 * testsuite/initpri1.c (d3): Check j != 4.
10577 (cd5): New constructor/destructor function.
10578 (main): Check j != 2.
10580 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10581 new symbol when resolving, don't call set_is_default.
10582 * testsuite/ver_test_7.cc: New file.
10583 * testsuite/ver_test_7.sh: New file.
10584 * testsuite/Makefile.am (ver_test_7.so): New target.
10585 (ver_test_7.o): New target.
10586 (check_SCRIPTS): Add ver_test_7.sh.
10587 (check_DATA): Add ver_test_7.syms.
10588 (ver_test_7.syms): New target.
10590 2008-03-28 Ian Lance Taylor <iant@google.com>
10592 * layout.cc (Layout::layout): If we see an input section with a
10593 name that needs sorting, set the must_sort flag for the output
10595 (Layout::make_output_section): If the name of the output section
10596 indicates that it might require sorting, set the may_sort flag.
10597 * output.h (Output_section::may_sort_attached_input_sections): New
10599 (Output_section::set_may_sort_attached_input_sections): New
10601 (Output_section::must_sort_attached_input_sections): New
10603 (Output_section::set_must_sort_attached_input_sections): New
10605 (class Output_section): Declare Input_section_sort_entry. Define
10606 Input_section_sort_compare. Declare
10607 sort_attached_input_sections. Add new fields:
10608 may_sort_attached_input_sections_,
10609 must_sort_attached_input_sections_,
10610 attached_input_sections_are_sorted_.
10611 * output.cc (Output_section::Output_section): Initialize new
10613 (Output_section::add_input_section): Add an entry to
10614 input_sections_ if may_sort or must_sort are true.
10615 (Output_section::set_final_data_size): Call
10616 sort_attached_input_sections if necessary.
10617 (Output_section::Input_section_sort_entry): Define new class.
10618 (Output_section::Input_section_sort_compare::operator()): New
10620 (Output_section::sort_attached_input_sections): New function.
10621 * configure.ac: Check whether the compiler supports constructor
10622 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10623 * testsuite/initpri1.c: New file.
10624 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10625 CONSTRUCTOR_PRIORITY.
10626 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10627 (initpri1_LDFLAGS): New variable.
10628 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10630 2008-03-27 Ian Lance Taylor <iant@google.com>
10632 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10633 * testsuite/common_test_1.c: New file.
10634 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10635 (common_test_1_SOURCES): New variable.
10636 (common_test_1_DEPENDENCIES): New variable.
10637 (common_test_1_LDFLAGS): New variable.
10639 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10640 and commons_ correctly when NAME/VERSION does not override
10642 * testsuite/ver_test_6.c: New file.
10643 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10644 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10645 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10647 2008-03-26 Ian Lance Taylor <iant@google.com>
10649 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10650 of an undefined symbol from a version script.
10651 * testsuite/Makefile.am (ver_test_5.so): New target.
10652 (ver_test_5.o): New target.
10653 (check_SCRIPTS): Add ver_test_5.sh.
10654 (check_DATA): Add ver_test_5.syms.
10655 (ver_test_5.syms): New target.
10656 * testsuite/ver_test_5.cc: New file.
10657 * testsuite/ver_test_5.script: New file.
10658 * testsuite/ver_test_5.sh: New file.
10659 * Makefile.in, testsuite/Makefile.in: Rebuild.
10662 Fix problems building gold with gcc 4.3.0.
10663 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10664 (gold_error_at_location, gold_warning_at_location): Use it.
10665 * configure.ac: Check whether we can compile and use a template
10666 function with a printf attribute.
10667 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10668 when jumping over bytes.
10669 * object.cc: Instantiate Object::read_section_data.
10670 * debug.h: Include <cstring>
10671 * dwarf_reader.cc: Include <algorithm>
10672 * main.cc: Include <cstring>.
10673 * options.cc: Include <cstring>.
10674 * output.cc: Include <cstring>.
10675 * script.cc: Include <cstring>.
10676 * script.h: Include <string>.
10677 * symtab.cc: Include <cstring> and <algorithm>.
10678 * target-select.cc: Include <cstring>.
10679 * version.cc: Include <string>.
10680 * testsuite/testmain.cc: Include <cstdlib>.
10681 * configure, config.in: Rebuild.
10683 2008-03-25 Ian Lance Taylor <iant@google.com>
10685 * options.cc: Include "../bfd/bfdver.h".
10686 (options::help): Print bug reporting address.
10688 * version.cc (print_version): Adjust output for current value of
10689 BFD_VERSION_STRING.
10693 * options.cc (options::help): Print list of supported targets.
10694 * target-select.h: Include <vector>.
10695 (class Target_selector): Make machine_, size_, and is_big_endian_
10696 fields const. Add bfd_name_ and instantiated_target_ fields.
10697 (Target_selector::Target_selector): Add bfd_name parameter.
10698 (Target_selector::recognize): Make non-virtual, call
10700 (Target_selector::recognize_by_name): Make non-virtual, call
10701 do_recognize_by_name.
10702 (Target_selector::supported_names): New function.
10703 (Target_selector::bfd_name): New function.
10704 (Target_selector::do_instantiate_target): New pure virtual
10706 (Target_selector::do_recognize): New virtual function.
10707 (Target_selector::do_recognize_by_name): New virtual function.
10708 (Target_selector::instantiate_target): New private function.
10709 (supported_target_names): Declare.
10710 * target-select.cc (Target_selector::Target_selector): Update for
10711 new parameter and fields.
10712 (select_target_by_name): Check that the name matches before
10713 calling recognize_by_name.
10714 (supported_target_names): New function.
10715 * i386.cc (class Target_selector_i386): Update Target_selector
10716 constructor call. Remove recognize and recognize_by_name. Add
10717 do_instantiate_target.
10718 * x86_64.cc (class Target_selector_x86_64): Likewise.
10719 * testsuite/testfile.cc (class Target_selector_test): Update for
10720 changes to Target_selector.
10722 * README: Rewrite, with some notes on unsupported features.
10724 2008-03-24 Cary Coutant <ccoutant@google.com>
10726 * i386.cc (Target_i386::Got_type): New enum declaration.
10727 (Target_i386::Scan::local): Updated callers of Output_data_got
10729 (Target_i386::Scan::global): Likewise.
10730 (Target_i386::Relocate::relocate): Likewise.
10731 (Target_i386::Relocate::relocate_tls): Likewise.
10732 * object.h (Got_offset_list): New class.
10733 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10734 (Sized_relobj::local_got_offset): Likewise.
10735 (Sized_relobj::set_local_got_offset): Likewise.
10736 (Sized_relobj::local_has_tls_got_offset): Removed.
10737 (Sized_relobj::local_tls_got_offset): Removed.
10738 (Sized_relobj::set_local_tls_got_offset): Removed.
10739 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10740 * output.cc (Output_data_got::add_global): Added got_type parameter.
10741 (Output_data_got::add_global_with_rel): Likewise.
10742 (Output_data_got::add_global_with_rela): Likewise.
10743 (Output_data_got::add_global_pair_with_rel): New function.
10744 (Output_data_got::add_global_pair_with_rela): New function.
10745 (Output_data_got::add_local): Added got_type parameter.
10746 (Output_data_got::add_local_with_rel): Likewise.
10747 (Output_data_got::add_local_with_rela): Likewise.
10748 (Output_data_got::add_local_pair_with_rel): New function.
10749 (Output_data_got::add_local_pair_with_rela): New function.
10750 (Output_data_got::add_global_tls): Removed.
10751 (Output_data_got::add_global_tls_with_rel): Removed.
10752 (Output_data_got::add_global_tls_with_rela): Removed.
10753 (Output_data_got::add_local_tls): Removed.
10754 (Output_data_got::add_local_tls_with_rel): Removed.
10755 (Output_data_got::add_local_tls_with_rela): Removed.
10756 * output.h (Output_data_got::add_global): Added got_type parameter.
10757 (Output_data_got::add_global_with_rel): Likewise.
10758 (Output_data_got::add_global_with_rela): Likewise.
10759 (Output_data_got::add_global_pair_with_rel): New function.
10760 (Output_data_got::add_global_pair_with_rela): New function.
10761 (Output_data_got::add_local): Added got_type parameter.
10762 (Output_data_got::add_local_with_rel): Likewise.
10763 (Output_data_got::add_local_with_rela): Likewise.
10764 (Output_data_got::add_local_pair_with_rel): New function.
10765 (Output_data_got::add_local_pair_with_rela): New function.
10766 (Output_data_got::add_global_tls): Removed.
10767 (Output_data_got::add_global_tls_with_rel): Removed.
10768 (Output_data_got::add_global_tls_with_rela): Removed.
10769 (Output_data_got::add_local_tls): Removed.
10770 (Output_data_got::add_local_tls_with_rel): Removed.
10771 (Output_data_got::add_local_tls_with_rela): Removed.
10772 * resolve.cc (Symbol::override_base_with_special): Removed
10773 reference to has_got_offset_ field.
10774 * symtab.cc (Symbol::init_fields): Replaced initialization
10775 of got_offset_ with got_offsets_. Removed initialization
10777 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10778 (Symbol::got_offset): Likewise.
10779 (Symbol::set_got_offset): Likewise.
10780 (Symbol::has_tls_got_offset): Removed.
10781 (Symbol::tls_got_offset): Removed.
10782 (Symbol::set_tls_got_offset): Removed.
10783 (Symbol::got_offset_): Removed.
10784 (Symbol::tls_mod_got_offset_): Removed.
10785 (Symbol::tls_pair_got_offset_): Removed.
10786 (Symbol::got_offsets_): New field.
10787 (Symbol::has_got_offset): Removed.
10788 (Symbol::has_tls_mod_got_offset): Removed.
10789 (Symbol::has_tls_pair_got_offset): Removed.
10790 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10791 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10793 (Target_x86_64::Scan::global): Likewise.
10794 (Target_x86_64::Relocate::relocate): Likewise.
10795 (Target_x86_64::Relocate::relocate_tls): Likewise.
10797 2008-03-25 Ben Elliston <bje@au.ibm.com>
10799 * yyscript.y: Fix spelling error in comment.
10801 2008-03-24 Ian Lance Taylor <iant@google.com>
10803 * options.h (class General_options): Define build_id option.
10804 * layout.h (class Layout): Declare write_build_id, create_note,
10805 create_build_id. Add build_id_note_ member.
10806 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10807 "libiberty.h", "md5.h", "sha1.h".
10808 (Layout::Layout): Initialize eh_frame_data_,
10809 eh_frame_hdr_section_, and build_id_note_.
10810 (Layout::finalize): Call create_build_id.
10811 (Layout::create_note): New function, broken out of
10812 Layout::create_gold_note.
10813 (Layout::create_gold_note): Call create_note.
10814 (Layout::create_build_id): New function.
10815 (Layout::write_build_id): New function.
10816 (Close_task_runner::run): Call write_build_id.
10818 * x86_64.cc: Correct license to GPLv3.
10820 2008-03-23 Ian Lance Taylor <iant@google.com>
10822 * options.cc: Include "demangle.h".
10823 (parse_optional_string): New function.
10824 (parse_long_option): Handle takes_optional_argument.
10825 (parse_short_option): Update dash_z initializer. Handle
10826 takes_optional_argument.
10827 (General_options::General_options): Initialize do_demangle_.
10828 (General_options::finalize): Set do_demangle_. Handle demangling
10830 * options.h (parse_optional_string): Declare.
10831 (struct One_option): Add optional_arg field. Update constructor.
10832 Update call constructor calls. Add takes_optional_argument
10834 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10835 (DEFINE_optional_string): Define.
10836 (General_options::demangle): Change from DEFINE_bool to
10837 DEFINE_optional_string.
10838 (General_options::no_demangle): New function.
10839 (General_options::do_demangle): New function.
10840 (General_options::set_do_demangle): New function.
10841 (General_options::execstack_status_): Move definition to end of
10843 (General_options::static_): Likewise.
10844 (General_options::do_demangle_): New field.
10845 * object.cc (big_endian>::get_symbol_location_info): Call
10846 Options::do_demangle, not Options::demangle.
10847 * symtab.cc (demangle): Likewise.
10849 2008-03-22 Ian Lance Taylor <iant@google.com>
10851 * gold.h: Include <cstddef> and <sys/types.h>
10852 * options.h: Include <cstring>.
10854 2008-03-21 Ian Lance Taylor <iant@google.com>
10856 * Added source code to GNU binutils.