* gold.cc (queue_initial_tasks): Pass incremental base filename
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2011-05-24 Cary Coutant <ccoutant@google.com>
2
3 * gold.cc (queue_initial_tasks): Pass incremental base filename
4 to Output_file::open_base_file; don't print error message.
5 * incremental-dump.cc (main): Adjust call to
6 Output_file::open_for_modification.
7 * incremental-dump.cc (main): Likewise.
8 * incremental.cc (Incremental_inputs::report_command_line):
9 Ignore --incremental-base option when comparing command lines.
10 Ignore parameter when given as separate argument.
11 * options.h (class General_options): Add --incremental-base.
12 * output.cc (Output_file::Output_file):
13 (Output_file::open_base_file): Add base_name and writable parameters;
14 read base file into new file; print error message here.
15 (Output_file::map_no_anonymous): Add writable parameter; adjust all
16 callers.
17 * output.h (Output_file::open_for_modification): Rename to...
18 (Output_file::open_base_file): ...this; add base_name and
19 writable parameters; adjust all callers.
20 (Output_file::map_no_anonymous): Add writable parameter; adjust all
21 callers.
22 * testsuite/Makefile.am (incremental_test_4): Test
23 --incremental-base.
24 * testsuite/Makefile.in: Regenerate.
25
26 2011-05-24 Cary Coutant <ccoutant@google.com>
27
28 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
29 incremental_test_4.
30 * testsuite/Makefile.in: Regenerate.
31 * testsuite/two_file_test_1_v1.cc: New test source file.
32 * testsuite/two_file_test_1b_v1.cc: New test source file.
33 * testsuite/two_file_test_2_v1.cc: New test source file.
34
35 2011-05-24 Cary Coutant <ccoutant@google.com>
36
37 * dynobj.h (Dynobj::do_dynobj): New function.
38 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
39 flag and soname for shared objects.
40 * incremental.cc (Incremental_inputs::report_object): Make
41 either Incremental_object_entry or Incremental_dynobj_entry; add
42 soname to string table.
43 (Incremental_inputs::report_input_section): Add assertion.
44 (Output_section_incremental_inputs::set_final_data_size): Adjust
45 type of input file entry for shared libraries; adjust size of
46 shared library info entry.
47 (Output_section_incremental_inputs::write_input_files): Write
48 as_needed flag for shared libraries.
49 (Output_section_incremental_inputs::write_info_blocks): Adjust type
50 of input file entry for shared libraries; write soname.
51 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
52 soname from incremental info.
53 * incremental.h (enum Incremental_input_flags): Add
54 INCREMENTAL_INPUT_AS_NEEDED.
55 (Incremental_input_entry::Incremental_input_entry): Initialize new
56 data member.
57 (Incremental_input_entry::set_as_needed): New function.
58 (Incremental_input_entry::as_needed): New function.
59 (Incremental_input_entry::do_dynobj_entry): New function.
60 (Incremental_input_entry::as_needed_): New data member.
61 (Incremental_object_entry::Incremental_object_entry): Don't check
62 for shared library.
63 (Incremental_object_entry::do_type): Likewise.
64 (class Incremental_dynobj_entry): New class.
65 (Incremental_input_entry_reader::as_needed): New function.
66 (Incremental_input_entry_reader::get_soname): New function.
67 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
68 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
69 size of shared library info entry.
70 * layout.cc (Layout::finish_dynamic_section): Don't test for
71 incremental link when adding DT_NEEDED entries.
72 * object.h (Object::Object): Initialize new data member.
73 (Object::dynobj): New function.
74 (Object::set_as_needed): New function.
75 (Object::as_needed): New function.
76 (Object::do_dynobj): New function.
77 (Object::as_needed_): New data member.
78
79 2011-05-24 Cary Coutant <ccoutant@google.com>
80
81 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
82 info; adjust display of GOT entries.
83 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
84 vector of input objects; remove file_status_.
85 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
86 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
87 got_plt reader; call target hooks to reserve GOT entries.
88 (Output_section_incremental_inputs::set_final_data_size): Adjust size
89 of input file info header and GOT info entry.
90 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
91 relocation info.
92 (Got_plt_view_info::got_descriptor): Remove.
93 (Got_plt_view_info::sym_index): New data member.
94 (Got_plt_view_info::input_index): New data member.
95 (Local_got_offset_visitor::visit): Write input file index.
96 (Global_got_offset_visitor::visit): Write 0 for input file index.
97 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
98 with sym_index and input_index.
99 (Output_section_incremental_inputs::write_got_plt): Adjust size of
100 incremental info GOT entry; replace got_descriptor with input_index.
101 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
102 map from input file index to object.
103 (Sized_relobj_incr::do_layout): Replace direct data member reference
104 with accessor function.
105 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
106 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
107 Adjust size of input file info header.
108 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
109 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
110 (Incremental_input_entry_reader::get_input_section): Adjust size of
111 input file info header.
112 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
113 of incremental info GOT entry.
114 (Incremental_got_plt_reader::get_got_desc): Remove.
115 (Incremental_got_plt_reader::get_got_symndx): New function.
116 (Incremental_got_plt_reader::get_got_input_index): New function.
117 (Sized_incremental_binary::Sized_incremental_binary): Remove
118 file_status_; add input_objects_.
119 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
120 (Sized_incremental_binary::set_file_is_unchanged): Remove.
121 (Sized_incremental_binary::file_is_unchanged): Remove.
122 (Sized_incremental_binary::set_input_object): New function.
123 (Sized_incremental_binary::input_object): New function.
124 (Sized_incremental_binary::file_status_): Remove.
125 (Sized_incremental_binary::input_objects_): New data member.
126 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
127 references.
128 (Sized_relobj_incr::invalid_address): Move to base class.
129 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
130 class.
131 (Sized_relobj_incr::do_output_section_offset): Likewise.
132 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
133 (Sized_relobj_incr::section_offsets_): Likewise.
134 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
135 function.
136 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
137 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
138 with accessor function.
139 (Sized_relobj_file::do_layout): Likewise.
140 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
141 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
142 (Sized_relobj_file::compute_final_local_value): Replace refs to
143 section_offsets_ with accessor function.
144 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
145 * object.h (Relobj::Relobj): Initialize new data members.
146 (Relobj::add_dyn_reloc): New function.
147 (Relobj::first_dyn_reloc): New function.
148 (Relobj::dyn_reloc_count): New function.
149 (Relobj::first_dyn_reloc_): New data member.
150 (Relobj::dyn_reloc_count_): New data member.
151 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
152 references.
153 (Sized_relobj::Address): New typedef.
154 (Sized_relobj::invalid_address): Move here from child class.
155 (Sized_relobj::Sized_relobj): Initialize new data members.
156 (Sized_relobj::sized_relobj): New function.
157 (Sized_relobj::is_output_section_offset_invalid): Move here from
158 child class.
159 (Sized_relobj::get_output_section_offset): Likewise.
160 (Sized_relobj::local_has_got_offset): Likewise.
161 (Sized_relobj::local_got_offset): Likewise.
162 (Sized_relobj::set_local_got_offset): Likewise.
163 (Sized_relobj::do_for_all_local_got_entries): Likewise.
164 (Sized_relobj::clear_got_offsets): New function.
165 (Sized_relobj::section_offsets): Move here from child class.
166 (Sized_relobj::do_output_section_offset): Likewise.
167 (Sized_relobj::do_set_section_offset): Likewise.
168 (Sized_relobj::Local_got_offsets): Likewise.
169 (Sized_relobj::local_got_offsets_): Likewise.
170 (Sized_relobj::section_offsets_): Likewise.
171 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
172 references.
173 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
174 class.
175 (Sized_relobj_file::sized_relobj): New function
176 (Sized_relobj_file::local_has_got_offset): Move to base class.
177 (Sized_relobj_file::local_got_offset): Likewise.
178 (Sized_relobj_file::set_local_got_offset): Likewise.
179 (Sized_relobj_file::get_output_section_offset): Likewise.
180 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
181 (Sized_relobj_file::do_output_section_offset): Likewise.
182 (Sized_relobj_file::do_set_section_offset): Likewise.
183 (Sized_relobj_file::Local_got_offsets): Likewise.
184 (Sized_relobj_file::local_got_offsets_): Likewise.
185 (Sized_relobj_file::section_offsets_): Likewise.
186 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
187 (all constructors).
188 (set_needs_dynsym_index): Convert relobj to derived class pointer.
189 (Output_reloc::get_symbol_index): Likewise.
190 (Output_reloc::local_section_offset): Likewise.
191 (Output_reloc::get_address): Likewise.
192 (Output_reloc::symbol_value): Likewise.
193 (Output_data_got::reserve_slot): Move to class definition.
194 (Output_data_got::reserve_local): New function.
195 (Output_data_got::reserve_slot_for_global): Remove.
196 (Output_data_got::reserve_global): New function.
197 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
198 (all constructors, two instantiations).
199 (Output_reloc::get_relobj): New function (two instantiations).
200 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
201 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
202 (Output_data_reloc::add_global): Adjust type of relobj.
203 (Output_data_reloc::add_global_relative): Likewise.
204 (Output_data_reloc::add_symbolless_global_addend): Likewise.
205 (Output_data_reloc::add_local): Likewise.
206 (Output_data_reloc::add_local_relative): Likewise.
207 (Output_data_reloc::add_symbolless_local_addend): Likewise.
208 (Output_data_reloc::add_local_section): Likewise.
209 (Output_data_reloc::add_output_section): Likewise.
210 (Output_data_reloc::add_absolute): Likewise.
211 (Output_data_reloc::add_target_specific): Likewise.
212 (Output_data_got::reserve_slot): Move definition here.
213 (Output_data_got::reserve_local): New function.
214 (Output_data_got::reserve_global): New function.
215 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
216 section_offsets_ with accessor function.
217 (Sized_relobj_file::write_sections): Likewise.
218 (Sized_relobj_file::do_relocate_sections): Likewise.
219 * target.h (Sized_target::reserve_local_got_entry): New function.
220 (Sized_target::reserve_global_got_entry): New function.
221 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
222 (Target_x86_64::reserve_global_got_entry): New function.
223 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
224
225 2011-05-23 Cary Coutant <ccoutant@google.com>
226
227 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
228 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
229 bit when checking got_type.
230 * incremental.cc (Sized_incremental_binary::setup_readers):
231 Store symbol table and string table locations; initialize bit vector
232 of file status flags.
233 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
234 unchanged files.
235 (Sized_incremental_binary::do_process_got_plt): New function.
236 (Sized_incremental_binary::get_symtab_view): Use stored locations.
237 (Output_section_incremental_inputs::set_final_data_size): Record
238 file index for each input file.
239 (Output_section_incremental_inputs::write_got_plt): Store file index
240 instead of input entry offset for each GOT entry.
241 * incremental.h
242 (Incremental_input_entry::Incremental_input_entry): Initialize new
243 data member.
244 (Incremental_input_entry::set_offset): Store file index.
245 (Incremental_input_entry::get_file_index): New function.
246 (Incremental_input_entry::file_index_): New data member.
247 (Incremental_binary::process_got_plt): New function.
248 (Incremental_binary::do_process_got_plt): New function.
249 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
250 data members.
251 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
252 (Sized_incremental_binary::set_file_is_unchanged): New function.
253 (Sized_incremental_binary::file_is_unchanged): New function.
254 (Sized_incremental_binary::do_process_got_plt): New function.
255 (Sized_incremental_binary::file_status_): New data member.
256 (Sized_incremental_binary::main_symtab_loc_): New data member.
257 (Sized_incremental_binary::main_strtab_loc_): New data member.
258 * output.cc (Output_data_got::Got_entry::write): Add case
259 RESERVED_CODE.
260 (Output_data_got::add_global): Call add_got_entry.
261 (Output_data_got::add_global_plt): Likewise.
262 (Output_data_got::add_global_with_rel): Likewise.
263 (Output_data_got::add_global_with_rela): Likewise.
264 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
265 (Output_data_got::add_global_pair_with_rela): Likewise.
266 (Output_data_got::add_local): Call add_got_entry.
267 (Output_data_got::add_local_plt): Likewise.
268 (Output_data_got::add_local_with_rel): Likewise.
269 (Output_data_got::add_local_with_rela): Likewise.
270 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
271 (Output_data_got::add_local_pair_with_rela): Likewise.
272 (Output_data_got::reserve_slot): New function.
273 (Output_data_got::reserve_slot_for_global): New function.
274 (Output_data_got::add_got_entry): New function.
275 (Output_data_got::add_got_entry_pair): New function.
276 (Output_section::add_output_section_data): Edit FIXME.
277 * output.h
278 (Output_section_data_build::Output_section_data_build): New
279 constructor with size parameter.
280 (Output_data_space::Output_data_space): Likewise.
281 (Output_data_got::Output_data_got): Initialize new data member; new
282 constructor with size parameter.
283 (Output_data_got::add_constant): Call add_got_entry.
284 (Output_data_got::reserve_slot): New function.
285 (Output_data_got::reserve_slot_for_global): New function.
286 (class Output_data_got::Got_entry): Add RESERVED_CODE.
287 (Output_data_got::add_got_entry): New function.
288 (Output_data_got::add_got_entry_pair): New function.
289 (Output_data_got::free_list_): New data member.
290 * target.h (Sized_target::init_got_plt_for_update): New function.
291 (Sized_target::register_global_plt_entry): New function.
292 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
293 Initialize new data member; call init; add constructor with PLT count.
294 (Output_data_plt_x86_64::init): New function.
295 (Output_data_plt_x86_64::add_relocation): New function.
296 (Output_data_plt_x86_64::reserve_slot): New function.
297 (Output_data_plt_x86_64::free_list_): New data member.
298 (Target_x86_64::init_got_plt_for_update): New function.
299 (Target_x86_64::register_global_plt_entry): New function.
300 (Output_data_plt_x86_64::add_entry): Allocate from free list for
301 incremental updates.
302 (Output_data_plt_x86_64::add_relocation): New function.
303 * testsuite/object_unittest.cc (Object_test): Set default options.
304
305 2011-05-16 Ian Lance Taylor <iant@google.com>
306
307 * options.h (class General_options): Make -i a synonym for -r.
308
309 2011-05-16 Ian Lance Taylor <iant@google.com>
310
311 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
312
313 2011-05-10 Cary Coutant <ccoutant@google.com>
314
315 * object.cc (Sized_relobj::do_count_local_symbols): Check for
316 strip_all (-s).
317
318 2011-05-06 Ian Lance Taylor <iant@google.com>
319
320 * layout.cc (Layout::layout): If the output section flags change,
321 update the ordering.
322
323 2011-04-25 Cary Coutant <ccoutant@google.com>
324
325 * incremental-dump.cc (dump_incremental_inputs): Print local
326 symbol info for each input file.
327 * incremental.cc
328 (Output_section_incremental_inputs::set_final_data_size): Add local
329 symbol info to input file entries in incremental info.
330 (Output_section_incremental_inputs::write_info_blocks): Likewise.
331 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
332 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
333 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
334 implementation.
335 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
336 (Sized_incr_relobj::do_relocate): Write the local symbols.
337 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
338 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
339 Adjust size of input file header.
340 (Incremental_inputs_reader::get_local_symbol_offset): New function.
341 (Incremental_inputs_reader::get_local_symbol_count): New function.
342 (Incremental_inputs_reader::get_input_section): Adjust size of input
343 file header.
344 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
345 (Sized_incr_relobj::This): New typedef.
346 (Sized_incr_relobj::sym_size): New const data member.
347 (Sized_incr_relobj::Local_symbol): New struct.
348 (Sized_incr_relobj::do_output_local_symbol_count): New function.
349 (Sized_incr_relobj::do_local_symbol_offset): New function.
350 (Sized_incr_relobj::local_symbol_count_): New data member.
351 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
352 (Sized_incr_relobj::local_symbol_index_): New data member.
353 (Sized_incr_relobj::local_symbol_offset_): New data member.
354 (Sized_incr_relobj::local_dynsym_offset_): New data member.
355 (Sized_incr_relobj::local_symbols_): New data member.
356 * object.h (Relobj::output_local_symbol_count): New function.
357 (Relobj::local_symbol_offset): New function.
358 (Relobj::do_output_local_symbol_count): New function.
359 (Relobj::do_local_symbol_offset): New function.
360 (Sized_relobj::do_output_local_symbol_count): New function.
361 (Sized_relobj::do_local_symbol_offset): New function.
362
363 2011-04-22 Vladimir Simonov <sv@sw.ru>
364
365 * descriptors.cc (set_close_on_exec): New function.
366 (Descriptors::open): Use set_close_on_exec.
367 * output.cc (S_ISLNK): Define if not defined.
368
369 2011-04-22 Cary Coutant <ccoutant@google.com>
370
371 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
372 global symbol map.
373 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
374 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
375 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
376 relocations.
377 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
378 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
379 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
380 * incremental.h
381 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
382 function.
383 (Incremental_binary::apply_incremental_relocs): New function.
384 (Incremental_binary::do_apply_incremental_relocs): New function.
385 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
386 data member.
387 (Sized_incremental_binary::add_global_symbol): New function.
388 (Sized_incremental_binary::global_symbol): New function.
389 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
390 (Sized_incremental_binary::symbol_map_): New data member.
391 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
392 * target.h (Sized_target::apply_relocation): New function.
393 * target-reloc.h (apply_relocation): New function.
394 * x86_64.cc (Target_x86_64::apply_relocation): New function.
395
396 2011-04-22 Doug Kwan <dougkwan@google.com>
397
398 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
399 flag of a SHT_ARM_EXIDX section.
400 * testsuite/Makefile.am (arm_exidx_test): New test rules.
401 * testsuite/Makefile.in: Regenerate.
402 * testsuite/arm_exidx_test.s: New file.
403 * testsuite/arm_exidx_test.sh: Same.
404
405 2011-04-20 Cary Coutant <ccoutant@google.com>
406
407 PR gold/12689
408 * archive.h (Incremental_archive_entry::Archive_member):
409 Initialize arg_serial_ (second constructor).
410
411 2011-04-17 Ian Lance Taylor <iant@google.com>
412
413 * object.cc (Relocate_info::location): Simplify location string.
414 * errors.cc (Errors::error_at_location): Don't print program
415 name.
416 (Errors::warning_at_location): Likewise.
417 (Errors::undefined_symbol): Likewise.
418 * testsuite/debug_msg.sh: Update accordingly.
419
420 2011-04-14 Cary Coutant <ccoutant@google.com>
421
422 * gold/layout.cc (Layout::symtab_section_offset): New function.
423 * gold/layout.h (Layout::symtab_section_offset): New function.
424 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
425
426 2011-04-12 Ian Lance Taylor <iant@google.com>
427
428 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
429 with MREMAP_MAYMOVE.
430 * output.h (class Output_file): Add map_is_allocated_ field.
431 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
432 not available, provide stubs. If mremap is not available, #define
433 it to gold_mremap.
434 (MREMAP_MAYMOVE): Define if not defined.
435 (Output_file::Output_file): Initialize map_is_allocated_.
436 (Output_file::resize): Check map_is_allocated_.
437 (Output_file::map_anonymous): If mmap fails, use malloc.
438 (Output_file::unmap): Don't do anything for an anonymous map.
439 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
440 is not available, provide stubs.
441 (File_read::View::~View): Use free rather than delete[].
442 (File_read::make_view): Use malloc rather than new[]. If mmap
443 fails, use malloc.
444 (File_read::find_or_make_view): Use malloc rather than new[].
445 * gold.h: Remove HAVE_REMAP code.
446 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
447 exists. Rename mremap to gold_mremap. If mmap is not available
448 don't do anything.
449 * configure, config.in: Rebuild.
450
451 2011-04-11 Ian Lance Taylor <iant@google.com>
452
453 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
454 initialize local variable v.
455
456 2011-04-11 Cary Coutant <ccoutant@google.com>
457
458 * archive.cc (Archive::include_member): Adjust call to
459 report_object.
460 (Add_archive_symbols::run): Track argument serial numbers.
461 (Lib_group::include_member): Likewise.
462 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
463 * archive.h (Incremental_archive_entry::Archive_member):
464 Initialize arg_serial_.
465 (Archive_member::arg_serial_): New data member.
466 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
467 (Sized_dynobj::do_add_symbols): Track symbols when doing an
468 incremental link.
469 (Sized_dynobj::do_for_all_local_got_entries): New function.
470 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
471 function.
472 * fileread.cc (get_mtime): New function.
473 * fileread.h (get_mtime): New function.
474 * gold.cc (queue_initial_tasks): Check for incremental update.
475 (process_incremental_input): New function.
476 (queue_middle_tasks): Don't force valid target for incremental
477 update.
478 * incremental-dump.cc (find_input_containing_global): Adjust
479 size of symbol info entry.
480 (dump_incremental_inputs): Dump argument serial number and
481 in_system_directory flag; bias shndx by 1; print symbol names
482 when dumping per-file symbol lists; use new symbol info readers.
483 * incremental.cc
484 (Output_section_incremental_inputs:update_data_size): New function.
485 (Sized_incremental_binary::setup_readers): Setup input readers
486 for each input file; build maps for files added from libraries
487 and scripts.
488 (Sized_incremental_binary::check_input_args): New function.
489 (Sized_incremental_binary::do_check_inputs): Build map of argument
490 serial numbers to input arguments.
491 (Sized_incremental_binary::do_file_has_changed): Rename
492 do_file_is_unchanged to this; compare file modification times.
493 (Sized_incremental_binary::do_init_layout): New function.
494 (Sized_incremental_binary::do_reserve_layout): New function.
495 (Sized_incremental_binary::do_get_input_reader): Remove.
496 (Sized_incremental_binary::get_symtab_view): New function.
497 (Incremental_checker::can_incrementally_link_output_file): Remove.
498 (Incremental_inputs::report_command_line): Exclude --debug options.
499 (Incremental_inputs::report_archive_begin): Add parameter; track
500 argument serial numbers; don't put input file entry for archive
501 before archive members.
502 (Incremental_inputs::report_archive_end): Put input file entry
503 for archive after archive members.
504 (Incremental_inputs::report_object): Add parameter; track argument
505 serial numbers and in_system_directory flag.
506 (Incremental_inputs::report_script): Add parameter; track argument
507 serial numbers.
508 (Output_section_incremental_inputs::set_final_data_size): Adjust
509 size of symbol info entry; check for forwarding symbols.
510 (Output_section_incremental_inputs::write_input_files): Write
511 in_system_directory flag and argument serial number.
512 (Output_section_incremental_inputs::write_info_blocks): Map section
513 indices between incremental info and original input file; store
514 input section index for each symbol.
515 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
516 change operator() to visit().
517 (class Global_got_offset_visitor): Likewise.
518 (class Global_symbol_visitor_got_plt):
519 (Output_section_incremental_inputs::write_got_plt): Use new visitor
520 classes.
521 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
522 (Sized_incr_relobj::do_read_symbols): New function.
523 (Sized_incr_relobj::do_layout): New function.
524 (Sized_incr_relobj::do_layout_deferred_sections): New function.
525 (Sized_incr_relobj::do_add_symbols): New function.
526 (Sized_incr_relobj::do_should_include_member): New function.
527 (Sized_incr_relobj::do_for_all_global_symbols): New function.
528 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
529 (Sized_incr_relobj::do_section_size): New function.
530 (Sized_incr_relobj::do_section_name): New function.
531 (Sized_incr_relobj::do_section_contents): New function.
532 (Sized_incr_relobj::do_section_flags): New function.
533 (Sized_incr_relobj::do_section_entsize): New function.
534 (Sized_incr_relobj::do_section_address): New function.
535 (Sized_incr_relobj::do_section_type): New function.
536 (Sized_incr_relobj::do_section_link): New function.
537 (Sized_incr_relobj::do_section_info): New function.
538 (Sized_incr_relobj::do_section_addralign): New function.
539 (Sized_incr_relobj::do_initialize_xindex): New function.
540 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
541 (Sized_incr_relobj::do_read_relocs): New function.
542 (Sized_incr_relobj::do_gc_process_relocs): New function.
543 (Sized_incr_relobj::do_scan_relocs): New function.
544 (Sized_incr_relobj::do_count_local_symbols): New function.
545 (Sized_incr_relobj::do_finalize_local_symbols): New function.
546 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
547 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
548 (Sized_incr_relobj::do_relocate): New function.
549 (Sized_incr_relobj::do_set_section_offset): New function.
550 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
551 (Sized_incr_dynobj::do_read_symbols): New function.
552 (Sized_incr_dynobj::do_layout): New function.
553 (Sized_incr_dynobj::do_add_symbols): New function.
554 (Sized_incr_dynobj::do_should_include_member): New function.
555 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
556 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
557 (Sized_incr_dynobj::do_section_size): New function.
558 (Sized_incr_dynobj::do_section_name): New function.
559 (Sized_incr_dynobj::do_section_contents): New function.
560 (Sized_incr_dynobj::do_section_flags): New function.
561 (Sized_incr_dynobj::do_section_entsize): New function.
562 (Sized_incr_dynobj::do_section_address): New function.
563 (Sized_incr_dynobj::do_section_type): New function.
564 (Sized_incr_dynobj::do_section_link): New function.
565 (Sized_incr_dynobj::do_section_info): New function.
566 (Sized_incr_dynobj::do_section_addralign): New function.
567 (Sized_incr_dynobj::do_initialize_xindex): New function.
568 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
569 (make_sized_incremental_object): New function.
570 (Incremental_library::copy_unused_symbols): New function.
571 (Incremental_library::do_for_all_unused_symbols): New function.
572 * incremental.h (enum Incremental_input_flags): New type.
573 (class Incremental_checker): Remove.
574 (Incremental_input_entry::Incremental_input_entry): Add argument
575 serial number.
576 (Incremental_input_entry::arg_serial): New function.
577 (Incremental_input_entry::set_is_in_system_directory): New function.
578 (Incremental_input_entry::is_in_system_directory): New function.
579 (Incremental_input_entry::arg_serial_): New data member.
580 (Incremental_input_entry::is_in_system_directory_): New data member.
581 (class Script_info): Move here from script.h.
582 (Script_info::Script_info): Add filename parameter.
583 (Script_info::filename): New function.
584 (Script_info::filename_): New data member.
585 (Incremental_script_entry::Incremental_script_entry): Add argument
586 serial number.
587 (Incremental_object_entry::Incremental_object_entry): Likewise.
588 (Incremental_object_entry::add_input_section): Build list of input
589 sections with map to original shndx.
590 (Incremental_object_entry::get_input_section_index): New function.
591 (Incremental_object_entry::shndx_): New data member.
592 (Incremental_object_entry::name_key_): Rename; adjust all refs.
593 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
594 (Incremental_archive_entry::Incremental_archive_entry): Add argument
595 serial number.
596 (Incremental_inputs::report_archive_begin): Likewise.
597 (Incremental_inputs::report_object): Likewise.
598 (Incremental_inputs::report_script): Likewise.
599 (class Incremental_global_symbol_reader): New class.
600 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
601 and store flags and input file type.
602 (Incremental_input_entry_reader::arg_serial): New function.
603 (Incremental_input_entry_reader::type): Extract type from flags.
604 (Incremental_input_entry_reader::is_in_system_directory): New function.
605 (Incremental_input_entry_reader::get_input_section_count): Call
606 accessor function for type.
607 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
608 function for type; adjust size of global symbol entry.
609 (Incremental_input_entry_reader::get_global_symbol_count): Call
610 accessor function for type.
611 (Incremental_input_entry_reader::get_object_count): Likewise.
612 (Incremental_input_entry_reader::get_object_offset): Likewise.
613 (Incremental_input_entry_reader::get_member_count): Likewise.
614 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
615 (Incremental_input_entry_reader::get_member_offset): Likewise.
616 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
617 (Incremental_input_entry_reader::Global_symbol_info): Remove.
618 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
619 (Incremental_input_entry_reader::get_global_symbol_reader): New
620 function.
621 (Incremental_input_entry_reader::get_output_symbol_index): New
622 function.
623 (Incremental_input_entry_reader::type_): Remove.
624 (Incremental_input_entry_reader::flags_): New data member.
625 (Incremental_inputs_reader::input_file_offset): New function.
626 (Incremental_inputs_reader::input_file_index): New function.
627 (Incremental_inputs_reader::input_file): Call input_file_offset.
628 (Incremental_inputs_reader::input_file_at_offset): New function.
629 (Incremental_relocs_reader::get_r_type): Reformat.
630 (Incremental_relocs_reader::get_r_shndx): Reformat.
631 (Incremental_relocs_reader::get_r_offset): Reformat.
632 (Incremental_relocs_reader::data): New function.
633 (Incremental_binary::Incremental_binary): Initialize new data members.
634 (Incremental_binary::check_inputs): Add cmdline parameter.
635 (Incremental_binary::file_is_unchanged): Remove.
636 (Input_reader::arg_serial): New function.
637 (Input_reader::get_unused_symbol_count): New function.
638 (Input_reader::get_unused_symbol): New function.
639 (Input_reader::do_arg_serial): New function.
640 (Input_reader::do_get_unused_symbol_count): New function.
641 (Input_reader::do_get_unused_symbol): New function.
642 (Incremental_binary::input_file_count): New function.
643 (Incremental_binary::get_input_reader): Change signature to use
644 index instead of filename.
645 (Incremental_binary::file_has_changed): New function.
646 (Incremental_binary::get_input_argument): New function.
647 (Incremental_binary::get_library): New function.
648 (Incremental_binary::get_script_info): New function.
649 (Incremental_binary::init_layout): New function.
650 (Incremental_binary::reserve_layout): New function.
651 (Incremental_binary::output_file): New function.
652 (Incremental_binary::do_check_inputs): New function.
653 (Incremental_binary::do_file_is_unchanged): Remove.
654 (Incremental_binary::do_file_has_changed): New function.
655 (Incremental_binary::do_init_layout): New function.
656 (Incremental_binary::do_reserve_layout): New function.
657 (Incremental_binary::do_input_file_count): New function.
658 (Incremental_binary::do_get_input_reader): Change signature.
659 (Incremental_binary::input_args_map_): New data member.
660 (Incremental_binary::library_map_): New data member.
661 (Incremental_binary::script_map_): New data member.
662 (Sized_incremental_binary::Sized_incremental_binary): Initialize
663 new data members.
664 (Sized_incremental_binary::output_section): New function.
665 (Sized_incremental_binary::inputs_reader): Add const.
666 (Sized_incremental_binary::symtab_reader): Add const.
667 (Sized_incremental_binary::relocs_reader): Add const.
668 (Sized_incremental_binary::got_plt_reader): Add const.
669 (Sized_incremental_binary::get_symtab_view): New function.
670 (Sized_incremental_binary::Inputs_reader): New typedef.
671 (Sized_incremental_binary::Input_entry_reader): New typedef.
672 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
673 (Sized_incremental_binary::do_file_is_unchanged): Remove.
674 (Sized_incremental_binary::do_file_has_changed): New function.
675 (Sized_incremental_binary::do_init_layout): New function.
676 (Sized_incremental_binary::do_reserve_layout): New function.
677 (Sized_input_reader::Inputs_reader): Remove.
678 (Sized_input_reader::Input_entry_reader): Remove.
679 (Sized_input_reader::do_arg_serial): New function.
680 (Sized_input_reader::do_get_unused_symbol_count): New function.
681 (Sized_input_reader::do_get_unused_symbol): New function.
682 (Sized_incremental_binary::do_input_file_count): New function.
683 (Sized_incremental_binary::do_get_input_reader): Change signature;
684 use index instead of filename.
685 (Sized_incremental_binary::section_map_): New data member.
686 (Sized_incremental_binary::input_entry_readers_): New data member.
687 (class Sized_incr_relobj): New class.
688 (class Sized_incr_dynobj): New class.
689 (make_sized_incremental_object): New function.
690 (class Incremental_library): New class.
691 * layout.cc (Free_list::num_lists): New static data member.
692 (Free_list::num_nodes): New static data member.
693 (Free_list::num_removes): New static data member.
694 (Free_list::num_remove_visits): New static data member.
695 (Free_list::num_allocates): New static data member.
696 (Free_list::num_allocate_visits): New static data member.
697 (Free_list::init): New function.
698 (Free_list::remove): New function.
699 (Free_list::allocate): New function.
700 (Free_list::dump): New function.
701 (Free_list::print_stats): New function.
702 (Layout_task_runner::run): Resize output file for incremental updates.
703 (Layout::Layout): Initialize new data members.
704 (Layout::set_incremental_base): New function.
705 (Layout::init_fixed_output_section): New function.
706 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
707 incremental updates.
708 (Layout::create_gold_note): Do not create gold note section for
709 incremental updates.
710 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
711 for incremental updates.
712 (Layout::set_section_offsets): For incremental updates, allocate space
713 from free list.
714 (Layout::create_symtab_sections): Layout with offsets relative to
715 start of section; for incremental updates, allocate space from free
716 list.
717 (Layout::create_shdrs): For incremental updates, allocate space from
718 free list.
719 (Layout::finish_dynamic_section): For incremental updates, do not
720 check --as-needed (fixed in subsequent patch).
721 * layout.h (class Free_list): New class.
722 (Layout::set_incremental_base): New function.
723 (Layout::incremental_base): New function.
724 (Layout::init_fixed_output_section): New function.
725 (Layout::allocate): New function.
726 (Layout::incremental_base_): New data member.
727 (Layout::free_list_): New data member.
728 * main.cc (main): Print Free_list statistics.
729 * object.cc (Relobj::finalize_incremental_relocs): Add
730 clear_counts parameter; clear counts only when clear_counts is set.
731 (Sized_relobj::Sized_relobj): Initialize new base class.
732 (Sized_relobj::do_layout): Don't report special sections.
733 (Sized_relobj::do_for_all_local_got_entries): New function.
734 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
735 symtab_off to all symbol table offsets.
736 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
737 * object.h (class Got_offset_list): Move to top of file.
738 (Object::Object): Allow case where input_file == NULL.
739 (Object::~Object): Likewise.
740 (Object::input_file): Assert that input_file != NULL.
741 (Object::lock): Allow case where input_file == NULL.
742 (Object::unlock): Likewise.
743 (Object::is_locked): Likewise.
744 (Object::token): Likewise.
745 (Object::release): Likewise.
746 (Object::is_incremental): New function.
747 (Object::get_mtime): New function.
748 (Object::for_all_local_got_entries): New function.
749 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
750 (Object::set_is_in_system_directory): New function.
751 (Object::is_in_system_directory): New function.
752 (Object::do_is_incremental): New function.
753 (Object::do_get_mtime): New function.
754 (Object::do_for_all_local_got_entries): New function.
755 (Object::is_in_system_directory_): New data member.
756 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
757 (class Sized_relobj_base): New class.
758 (class Sized_relobj): Derive from Sized_relobj_base.
759 (class Sized_relobj::Symbols): Redeclare from base class.
760 (class Sized_relobj::local_got_offset_list): Remove.
761 (class Sized_relobj::Output_sections): Redeclare from base class.
762 (class Sized_relobj::do_for_all_local_got_entries): New function.
763 (class Sized_relobj::write_local_symbols): Add offset parameter.
764 (class Sized_relobj::local_symbol_offset_): Update comment.
765 (class Sized_relobj::local_dynsym_offset_): Update comment.
766 * options.cc (Input_arguments::add_file): Remove const.
767 * options.h (Input_file_argument::Input_file_argument):
768 Initialize arg_serial_ (all constructors).
769 (Input_file_argument::set_arg_serial): New function.
770 (Input_file_argument::arg_serial): New function.
771 (Input_file_argument::arg_serial_): New data member.
772 (Input_arguments::Input_arguments): Initialize file_count_.
773 (Input_arguments::add_file): Remove const.
774 (Input_arguments::number_of_input_files): New function.
775 (Input_arguments::file_count_): New data member.
776 (Command_line::number_of_input_files): Call
777 Input_arguments::number_of_input_files.
778 * output.cc (Output_segment_headers::Output_segment_headers):
779 Set current size.
780 (Output_section::Input_section::current_data_size): New function.
781 (Output_section::Output_section): Initialize new data members.
782 (Output_section::add_input_section): Don't do merge sections for
783 an incremental link; allocate space from free list for an
784 incremental update.
785 (Output_section::add_output_section_data): Allocate space from
786 free list for an incremental update.
787 (Output_section::update_data_size): New function.
788 (Output_section::set_fixed_layout): New function.
789 (Output_section::reserve): New function.
790 (Output_segment::set_section_addresses): Remove const.
791 (Output_segment::set_section_list_addresses): Remove const; allocate
792 space from free list for an incremental update.
793 (Output_segment::set_offset): Adjust size of RELRO segment for an
794 incremental update.
795 * output.h (Output_data::current_data_size): Move here from
796 child classes.
797 (Output_data::pre_finalize_data_size): New function.
798 (Output_data::update_data_size): New function.
799 (Output_section_headers::update_data_size): new function.
800 (Output_section_data_build::current_data_size): Move to Output_data.
801 (Output_data_strtab::update_data_size): New function.
802 (Output_section::current_data_size): Move to Output_data.
803 (Output_section::set_fixed_layout): New function.
804 (Output_section::has_fixed_layout): New function.
805 (Output_section::reserve): New function.
806 (Output_section::update_data_size): New function.
807 (Output_section::has_fixed_layout_): New data member.
808 (Output_section::free_list_): New data member.
809 (Output_segment::set_section_addresses): Remove const.
810 (Output_segment::set_section_list_addresses): Remove const.
811 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
812 New function.
813 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
814 New function.
815 * readsyms.cc (Read_symbols::do_read_symbols): Add library
816 parameter when calling Add_symbols constructor; store argument
817 serial number for members of a lib group.
818 (Add_symbols::locks): Allow case where token == NULL.
819 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
820 (Read_member::~Read_member): New function.
821 (Read_member::is_runnable): New function.
822 (Read_member::locks): New function.
823 (Read_member::run): New function.
824 (Check_script::~Check_script): New function.
825 (Check_script::is_runnable): New function.
826 (Check_script::locks): New function.
827 (Check_script::run): New function.
828 (Check_library::~Check_library): New function.
829 (Check_library::is_runnable): New function.
830 (Check_library::locks): New function.
831 (Check_library::run): New function.
832 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
833 (Add_symbols::library_): New data member.
834 (class Read_member): New class.
835 (class Check_script): New class.
836 (class Check_library): New class.
837 * reloc.cc (Read_relocs::is_runnable): Allow case where
838 token == NULL.
839 (Read_relocs::locks): Likewise.
840 (Scan_relocs::locks): Likewise.
841 (Relocate_task::locks): Likewise.
842 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
843 to clear counters.
844 (Sized_relobj::incremental_relocs_scan): Fix comment.
845 (Sized_relobj::do_relocate): Pass output file offset to
846 write_local_symbols.
847 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
848 from class declaration.
849 * script.cc (read_input_script): Allocate Script_info; pass
850 argument serial number to report_script.
851 * script.h (class Script_info): Move to incremental.h.
852 * symtab.cc (Symbol_table::add_from_incrobj): New function.
853 * symtab.h (Symbol_table::add_from_incrobj): New function.
854 (Symbol_table::set_file_offset): New function.
855
856 2011-04-05 Cary Coutant <ccoutant@google.com>
857
858 * incremental-dump.cc (dump_incremental_inputs): Change signature
859 to take a Sized_incremental_binary; change caller. Use readers
860 in Sized_incremental_binary.
861 * incremental.cc
862 (Sized_incremental_binary::find_incremental_inputs_sections):
863 Rename do_find_incremental_inputs_sections to this.
864 (Sized_incremental_binary::setup_readers): New function.
865 (Sized_incremental_binary::do_check_inputs): Check
866 has_incremental_info_ flag; move setup code to setup_readers;
867 use input readers.
868 (Sized_incremental_binary::do_file_is_unchanged): New function.
869 (Sized_incremental_binary::do_get_input_reader): New function.
870 * incremental.h (class Incremental_binary): Move to end of file.
871 (Incremental_binary::file_is_unchanged): New function.
872 (Incremental_binary::do_file_is_unchanged): New function.
873 (Incremental_binary::Input_reader): New class.
874 (Incremental_binary::get_input_reader): New function.
875 (class Sized_incremental_binary): Move to end of file.
876 (Sized_incremental_binary::Sized_incremental_binary): Setup the
877 input section reader classes.
878 (Sized_incremental_binary::has_incremental_info): New function.
879 (Sized_incremental_binary::inputs_reader): New function.
880 (Sized_incremental_binary::symtab_reader): New function.
881 (Sized_incremental_binary::relocs_reader): New function.
882 (Sized_incremental_binary::got_plt_reader): New function.
883 (Sized_incremental_binary::do_file_is_unchanged): New function.
884 (Sized_incremental_binary::Sized_input_reader): New class.
885 (Sized_incremental_binary::get_input_reader): New function.
886 (Sized_incremental_binary::find_incremental_inputs_sections):
887 Rename do_find_incremental_inputs_sections to this.
888 (Sized_incremental_binary::setup_readers): New function.
889 (Sized_incremental_binary::has_incremental_info_): New data member.
890 (Sized_incremental_binary::inputs_reader_): New data member.
891 (Sized_incremental_binary::symtab_reader_): New data member.
892 (Sized_incremental_binary::relocs_reader_): New data member.
893 (Sized_incremental_binary::got_plt_reader_): New data member.
894 (Sized_incremental_binary::current_input_file_): New data member.
895
896 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
897
898 PR gold/12640
899 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
900 violation.
901
902 2011-03-30 Cary Coutant <ccoutant@google.com>
903
904 * archive.cc (Archive::include_member): Adjust call to report_object.
905 (Add_archive_symbols::run): Add script_info to call to
906 report_archive_begin.
907 (Lib_group::include_member): Adjust call to report_object.
908 (Add_lib_group_symbols::run): Adjust call to report_object.
909 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
910 blocks. Add object count for script input files.
911 * incremental.cc (Incremental_inputs::report_archive_begin): Add
912 script_info parameter; change all callers.
913 (Incremental_inputs::report_object): Add script_info parameter;
914 change all callers.
915 (Incremental_inputs::report_script): Store backpointer to
916 incremental info entry.
917 (Output_section_incremental_inputs::set_final_data_size): Record
918 additional information for scripts.
919 (Output_section_incremental_inputs::write_info_blocks): Likewise.
920 * incremental.h (Incremental_script_entry::add_object): New function.
921 (Incremental_script_entry::get_object_count): New function.
922 (Incremental_script_entry::get_object): New function.
923 (Incremental_script_entry::objects_): New data member; adjust
924 constructor.
925 (Incremental_inputs::report_archive_begin): Add script_info parameter.
926 (Incremental_inputs::report_object): Add script_info parameter.
927 (Incremental_inputs_reader::get_object_count): New function.
928 (Incremental_inputs_reader::get_object_offset): New function.
929 * options.cc (Input_arguments::add_file): Return reference to
930 new input argument.
931 * options.h (Input_argument::set_script_info): New function.
932 (Input_argument::script_info): New function.
933 (Input_argument::script_info_): New data member; adjust all
934 constructors.
935 (Input_file_group::add_file): Return reference to new input argument.
936 (Input_file_lib::add_file): Likewise.
937 (Input_arguments::add_file): Likewise.
938 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
939 * script.cc (Parser_closure::Parser_closure): Add script_info
940 parameter; adjust all callers.
941 (Parser_closure::script_info): New function.
942 (Parser_closure::script_info_): New data member.
943 (read_input_script): Report scripts earlier to incremental info.
944 (script_add_file): Set script_info in Input_argument.
945 (script_add_library): Likewise.
946 * script.h (Script_options::Script_info): Rewrite class.
947
948 2011-03-29 Cary Coutant <ccoutant@google.com>
949
950 * archive.cc (Library_base::should_include_member): Move
951 method here from class Archive.
952 (Archive::Archive): Initialize base class.
953 (Archive::should_include_member): Move to base class.
954 (Archive::do_for_all_unused_symbols): New function.
955 (Add_archive_symbols::run): Remove redundant access to
956 incremental_inputs.
957 (Lib_group::Lib_group): Initialize base class.
958 (Lib_group::do_filename): New function.
959 (Lib_group::include_member): Pass pointer to Lib_group to
960 report_object.
961 (Lib_group::do_for_all_unused_symbols): New function.
962 (Add_lib_group_symbols::run): Report archive information for
963 incremental links.
964 * archive.h (class Library_base): New base class.
965 (class Archive): Derive from Library_base.
966 (Archive::filename): Move to base class.
967 (Archive::set_incremental_info): Likewise.
968 (Archive::incremental_info): Likewise.
969 (Archive::Should_include): Likewise.
970 (Archive::should_include_member): Likewise.
971 (Archive::Armap_entry): Remove.
972 (Archive::Unused_symbol_iterator): Remove.
973 (Archive::unused_symbols_begin): Remove.
974 (Archive::unused_symbols_end): Remove.
975 (Archive::do_filename): New function.
976 (Archive::do_get_mtime): New function.
977 (Archive::do_for_all_unused_symbols): New function.
978 (Archive::task_): Move to base class.
979 (Archive::incremental_info_): Likewise.
980 (class Lib_group): Derive from Library_base.
981 (Lib_group::do_filename): New function.
982 (Lib_group::do_get_mtime): New function.
983 (Lib_group::do_for_all_unused_symbols): New function.
984 (Lib_group::task_): Move to base class.
985 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
986 function.
987 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
988 function.
989 * incremental.cc (Incremental_inputs::report_archive_begin):
990 Use Library_base; call library's get_mtime; add incremental inputs
991 entry before members.
992 (class Unused_symbol_visitor): New class.
993 (Incremental_inputs::report_archive_end): Use Library_base; use
994 visitor class to record unused symbols; don't add incremental inputs
995 entry after members.
996 (Incremental_inputs::report_object): Use Library_base.
997 * incremental.h
998 (Incremental_archive_entry::Incremental_archive_entry): Remove
999 unused Archive parameter.
1000 (Incremental_inputs::report_archive_begin): Use Library_base.
1001 (Incremental_inputs::report_archive_end): Likewise.
1002 (Incremental_inputs::report_object): Likewise.
1003 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1004 function.
1005 * object.h (Object::for_all_global_symbols): New function.
1006 (Object::do_for_all_global_symbols): New function.
1007 (Sized_relobj::do_for_all_global_symbols): New function.
1008 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1009 function.
1010 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1011 function.
1012
1013 2011-03-27 Ian Lance Taylor <iant@google.com>
1014
1015 * archive.cc (Archive::interpret_header): Return -1 if something
1016 goes wrong. Change callers accordingly.
1017
1018 2011-03-25 Cary Coutant <ccoutant@google.com>
1019
1020 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1021 * testsuite/Makefile.in: Regenerate.
1022
1023 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1024
1025 * plugin.cc (get_view): New.
1026 (Plugin::load): Pass get_view to the plugin.
1027 (Plugin_manager::get_view): New.
1028
1029 2011-03-21 Ian Lance Taylor <iant@google.com>
1030
1031 * testsuite/final_layout.sh: Rewrite to not use dc.
1032 * testsuite/relro_test.sh: Fail if dc is not present.
1033
1034 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1035
1036 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1037 Change == to -eq.
1038 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1039 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1040 Change == to -eq.
1041 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1042 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1043
1044 2011-03-14 Ian Lance Taylor <iant@google.com>
1045
1046 * script-sections.cc (Sort_output_sections::script_compare):
1047 Rename from is_before, change return type.
1048 (Sort_output_sections::operator()): Adjust accordingly.
1049
1050 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1051
1052 PR gold/12572
1053 * testsuite/odr_violation2.cc: Add comment to make all error line
1054 numbers double digits.
1055 * testsuite/debug_msg.sh: Adjust expected errors.
1056
1057 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1058
1059 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1060 but mark earlier ones as non-canonical
1061 (offset_to_iterator): Update search target and example
1062 (do_addr2line): Return extra lines in a vector*
1063 (format_file_lineno): Extract from do_addr2line
1064 (one_addr2line): Add vector* out-param
1065 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1066 when a lineno entry appeared last for its instruction
1067 (Dwarf_line_info): Add vector* out-param
1068 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1069 * symtab.cc (Odr_violation_compare): Include the lineno in the
1070 comparison again.
1071 (linenos_from_loc): New. Combine the canonical line for an
1072 address with its other lines.
1073 (True_if_intersect): New. Helper functor to make
1074 std::set_intersection a query.
1075 (detect_odr_violations): Compare sets of lines instead of just
1076 one line for each function. This became less deterministic, but
1077 has fewer false positives.
1078 * symtab.h: Declarations.
1079 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1080 mix an optimized and non-optimized object in the same binary
1081 (odr_violation2.so): Same.
1082 * testsuite/Makefile.in: Regenerate from Makefile.am.
1083 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1084 * testsuite/debug_msg.sh: Update line numbers and add
1085 assertions.
1086 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1087 non-optimized context.
1088 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1089 isn't inlined, and use OdrDerived in an optimized context.
1090 * testsuite/odr_header1.h: Defines OdrDerived, where
1091 optimization will change the
1092 first-instruction-in-the-destructor's file and line number.
1093 * testsuite/odr_header2.h: Defines OdrBase.
1094
1095 2011-03-09 Ian Lance Taylor <iant@google.com>
1096
1097 * fileread.cc (File_read::clear_views): Don't delete the whole
1098 file view.
1099
1100 2011-03-08 Ian Lance Taylor <iant@google.com>
1101
1102 PR gold/12525
1103 * fileread.cc: #include <climits>.
1104 (GOLD_IOV_MAX): Define.
1105 (File_read::read_multiple): Limit number of entries by iov_max.
1106 * fileread.h (class File_read): Always set max_readv_entries to
1107 128.
1108
1109 2011-03-07 Ian Lance Taylor <iant@google.com>
1110
1111 PR gold/12525
1112 * options.h (class General_options): Add -dy and -dn.
1113
1114 2011-03-02 Cary Coutant <ccoutant@google.com>
1115
1116 * testsuite/script_test_9.t: Add TLS segment.
1117
1118 2011-03-02 Simon Baldwin <simonb@google.com>
1119
1120 * configure.ac: Add check for gnu_indirect_function support in
1121 the toolchain building binutils.
1122 * configure: Rebuild.
1123
1124 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1125
1126 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1127 plugin only symbols.
1128 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1129 in plugin files as not needed in the symbol table.
1130
1131 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1132
1133 * output.cc (Output_section::add_input_section): Delay fill
1134 generation for section ordering.
1135
1136 2011-02-09 Ian Lance Taylor <iant@google.com>
1137
1138 PR gold/12316
1139 * object.h (class Sized_relobj): Remove clear_local_symbols.
1140 * reloc.cc (Sized_relobj::do_relocate): Don't call
1141 clear_local_symbols.
1142
1143 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1144
1145 * plugin.cc (is_visible_from_outside): Return true for symbols
1146 in the -u option.
1147
1148 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1149
1150 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1151 filename.
1152
1153 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1154
1155 * icf.h (is_section_foldable_candidate): Change type of parameter
1156 to std::string.
1157 * icf.cc (Icf::find_identical_sections): Change type of local variable
1158 section_name to be std::string.
1159 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1160
1161 2011-01-25 Ian Lance Taylor <iant@google.com>
1162
1163 * script.cc (script_add_extern): Rewrite to use
1164 add_symbol_reference.
1165
1166 2011-01-25 Doug Kwan <dougkwan@google.com>
1167
1168 * icf.cc (get_section_contents): Always lock section's object.
1169
1170 2011-01-24 Ian Lance Taylor <iant@google.com>
1171
1172 * options.h (class General_options): Accept
1173 --no-detect-odr-violations.
1174
1175 2011-01-24 Ian Lance Taylor <iant@google.com>
1176
1177 * version.cc (version_string): Bump to 1.11.
1178
1179 2011-01-24 Ian Lance Taylor <iant@google.com>
1180
1181 * plugin.cc (class Plugin_rescan): Define new class.
1182 (Plugin_manager::claim_file): Set any_claimed_.
1183 (Plugin_manager::save_archive): New function.
1184 (Plugin_manager::save_input_group): New function.
1185 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1186 necessary.
1187 (Plugin_manager::new_undefined_symbol): New function.
1188 (Plugin_manager::rescan): New function.
1189 (Plugin_manager::rescannable_defines): New function.
1190 (Plugin_manager::add_input_file): Set any_added_.
1191 * plugin.h (class Plugin_manager): define new fields rescannable_,
1192 undefined_symbols_, any_claimed_, and any_added_. Declare
1193 Plugin_rescan as friend. Declare new functions.
1194 (Plugin_manager::Rescannable): Define type.
1195 (Plugin_manager::Rescannable_list): Define type.
1196 (Plugin_manager::Undefined_symbol_list): Define type.
1197 (Plugin_manager::Plugin_manager): Initialize new fields.
1198 * archive.cc (Archive::defines_symbol): New function.
1199 (Add_archive_symbols::run): Pass archive to plugins if any.
1200 * archive.h (class Archive): Declare defines_symbol.
1201 * readsyms.cc (Input_group::~Input_group): New function.
1202 (Finish_group::run): Pass input_group to plugins if any.
1203 * readsyms.h (class Input_group): Declare destructor.
1204 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1205 any.
1206
1207 2011-01-10 Ian Lance Taylor <iant@google.com>
1208
1209 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1210 section as relro.
1211 (Layout::set_segment_offsets): Reset increase_relro before calling
1212 set_section_addresses a second time.
1213
1214 2011-01-04 Cary Coutant <ccoutant@google.com>
1215
1216 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1217 sections before NOBITS sections.
1218
1219 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1220
1221 * version.cc (print_version): Update copyright to 2011.
1222
1223 2010-12-23 Cary Coutant <ccoutant@google.com>
1224
1225 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1226 of OS to this->add. Add OD parameter to second form of the function.
1227
1228 2010-12-20 Ian Lance Taylor <iant@google.com>
1229
1230 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1231 second of two consecutive entries with same offset.
1232
1233 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1234
1235 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1236 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1237 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1238 to avoid unneeded links against $(LDADD).
1239 * testsuite/Makefile.in: Regenerate.
1240
1241 2010-12-15 Ian Lance Taylor <iant@google.com>
1242
1243 PR gold/12324
1244 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1245 for R_X86_64_32 and R_X86_64_PC32.
1246 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1247 ver_matching_def_pic.o.
1248 (ver_matching_def_pic.o): New target.
1249
1250 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1251
1252 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1253 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1254 Move definition before File_read::View member definitions.
1255 (File_read::View::~View): Initialize and hold lock before
1256 updating current_mapped_bytes.
1257
1258 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1259
1260 * dwarf_reader.cc: Remove outdated comment.
1261 * gold-threads.cc: Fix typo in error message.
1262 * archive.cc: Fix typos in comments.
1263 * archive.h: Likewise.
1264 * arm-reloc-property.cc: Likewise.
1265 * arm-reloc-property.h: Likewise.
1266 * arm-reloc.def: Likewise.
1267 * arm.cc: Likewise.
1268 * attributes.h: Likewise.
1269 * cref.cc: Likewise.
1270 * ehframe.cc: Likewise.
1271 * fileread.h: Likewise.
1272 * gold.h: Likewise.
1273 * i386.cc: Likewise.
1274 * icf.cc: Likewise.
1275 * incremental.h: Likewise.
1276 * int_encoding.cc: Likewise.
1277 * layout.h: Likewise.
1278 * main.cc: Likewise.
1279 * merge.h: Likewise.
1280 * object.cc: Likewise.
1281 * object.h: Likewise.
1282 * options.cc: Likewise.
1283 * readsyms.cc: Likewise.
1284 * reduced_debug_output.cc: Likewise.
1285 * reloc.cc: Likewise.
1286 * script-sections.cc: Likewise.
1287 * sparc.cc: Likewise.
1288 * symtab.h: Likewise.
1289 * target-reloc.h: Likewise.
1290 * target.cc: Likewise.
1291 * target.h: Likewise.
1292 * timer.cc: Likewise.
1293 * timer.h: Likewise.
1294 * x86_64.cc: Likewise.
1295
1296 2010-12-09 Cary Coutant <ccoutant@google.com>
1297
1298 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1299 stack.
1300 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1301 parameter; change all callers.
1302 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1303 * options.h (warn_execstack): New option.
1304
1305 2010-12-07 Doug Kwan <dougkwan@google.com>
1306
1307 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1308 like function call relocations.
1309
1310 2010-12-07 Ian Lance Taylor <iant@google.com>
1311
1312 * archive.cc (Archive::get_elf_object_for_member): Permit
1313 punconfigured to be NULL.
1314 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1315 (Archive::include_member): Pass NULL to get_elf_object_for_member
1316 if we searched for the archive and this is the first included
1317 object.
1318
1319 2010-12-01 Ian Lance Taylor <iant@google.com>
1320
1321 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1322 track_relocs_type_ field.
1323 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1324 Set track_relocs_type_.
1325 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1326 contents when using RELA relocs.
1327 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1328 reloc_map_.
1329 * reloc.cc (Track_relocs::next_addend): New function.
1330 * reloc.h (class Track_relocs): Declare next_addend.
1331
1332 2010-12-01 Ian Lance Taylor <iant@google.com>
1333
1334 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1335 virtual destructor.
1336
1337 2010-12-01 Ian Lance Taylor <iant@google.com>
1338
1339 * README: Update compilers known to work and fail.
1340
1341 2010-11-23 Matthias Klose <doko@ubuntu.com>
1342
1343 * configure.in: For --enable-gold, handle value `default' instead of
1344 `both*'. Always install ld as ld.bfd, install as ld if gold is
1345 not the default.
1346 * configure: Regenerate.
1347
1348 2010-11-18 Doug Kwan <dougkwan@google.com>
1349
1350 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1351 and right_alignment to be zero. Store result alignment only if it is
1352 greater than existing alignment.
1353
1354 2010-11-16 Cary Coutant <ccoutant@google.com>
1355
1356 PR gold/12220
1357 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1358 Check for ".zdebug_line".
1359
1360 2010-11-16 Doug Kwan <dougkwan@google.com>
1361 Cary Coutant <ccoutant@google.com>
1362
1363 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1364 by reference; adjust all callers.
1365 * output.cc (Output_segment::set_section_addresses): Adjust references
1366 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1367 list is empty.
1368 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1369 end at page boundary.
1370
1371 2010-11-16 Cary Coutant <ccoutant@google.com>
1372
1373 PR gold/12220
1374 * layout.cc (Layout::choose_output_section): Transform names of
1375 compressed sections even when using a script with a SECTIONS clause.
1376 (Layout::output_section_name): Remove code to transform
1377 compressed debug section names.
1378 * output.cc (Output_section::add_input_section): Use uncompressed
1379 section size when tracking input sections.
1380
1381 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1382
1383 * symtab.h (Symbol::NON_PIC_REF): Remove.
1384 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1385 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1386 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1387 (Symbol::use_plt_offset): Take a flags argument and pass it
1388 directly to needs_dynamic_reloc. Restrict check for undefined
1389 weak symbols to function calls.
1390 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1391 (Target_arm::Scan::global): Use it.
1392 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1393 (Target_arm::Relocate::relocate): Likewise.
1394 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1395 parameter with an r_type parameter. Use get_reference_flags
1396 to get the flags.
1397 (Target_arm::Relocate::relocate): Update accordingly.
1398 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1399 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1400 (Target_i386::Scan::global): Likewise.
1401 (Target_i386::Relocate::relocate): Likewise.
1402 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1403 parameter with an r_type parameter. Use get_reference_flags
1404 to get the flags.
1405 (Target_i386::Relocate::relocate): Update accordingly.
1406 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1407 (Target_powerpc::Scan::global): Use it.
1408 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1409 (Target_powerpc::Relocate::relocate): Likewise.
1410 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1411 (Target_sparc::Scan::global): Use it.
1412 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1413 (Target_sparc::Relocate::relocate): Likewise.
1414 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1415 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1416 (Target_x86_64::Scan::global): Likewise.
1417 (Target_x86_64::Relocate::relocate): Likewise.
1418
1419 2010-11-08 Doug Kwan <dougkwan@google.com>
1420 Cary Coutant <ccoutant@google.com>
1421
1422 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1423 (Arm_exidx_merge_section::section_contents_): New data member.
1424 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1425 (Arm_input_section::~Arm_input_section): De-allocate memory.
1426 (Arm_input_section::original_contents_): New data member.
1427 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1428 in parameters instead of calling Object::section_contents without
1429 locking.
1430 (Arm_output_section::group_section): New parameter TASK. Pass it
1431 to callees that need locking objects.
1432 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1433 to lock EXIDX input sections. Fix a formatting issue. Call
1434 Arm_exidx_merged_section::build_contents to create merged section
1435 contents.
1436 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1437 to lock object of stub table owner.
1438 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1439 TEXT_SIZE to initialize data member TEXT_SIZE_.
1440 (Arm_exidx_input_section::addralign): Fix typo in comment.
1441 (Arm_exidx_input_section::text_size): New method.
1442 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1443 that require locking objects. Lock objects before scanning for stubs
1444 and updating local symbols.
1445 (Arm_input_section<big_endian>::init): Copy contents of original
1446 input section.
1447 (Arm_input_section<big_endian>::do_write): Use saved contents of
1448 original input section instead of calling Object::section_contents
1449 without locking.
1450 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1451 size without calling Object::section_size().
1452 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1453 for size. Allocate a buffer for merged EXIDX entries.
1454 (Arm_exidx_merged_section::build_contents): New method.
1455 (Arm_exidx_merged_section::do_write): Move merge section contents
1456 building code to Arm_exidx_merged_section::build_contetns. Write
1457 out contetns in buffer instead of building it on the fly.
1458 (Arm_relobj::make_exidx_input_section): Also pass text section size
1459 to Arm_exidx_input_section constructor.
1460 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1461 (Arm_dynobj::do_read_symbols): Fix memory leak.
1462 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1463 * target.h: (class Task): Add forward declaration.
1464 (Target::relax): Add new parameter TASK and pass it to
1465 Target::do_relax().
1466 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1467
1468 2010-11-05 Cary Coutant <ccoutant@google.com>
1469
1470 PR gold/10708
1471 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1472 object when reading from the file.
1473 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1474 second layout pass.
1475 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1476 when reading section contents.
1477 (get_section_contents): Likewise.
1478 (icf::find_identical_sections): Likewise.
1479 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1480 object when reading from the file.
1481 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1482 the object when doing deferred section layout.
1483
1484 2010-11-03 Nick Clifton <nickc@redhat.com>
1485
1486 PR gold/12001
1487 * script.h (class Symbol_assignment: name): New member. Returns
1488 the name of the symbol.
1489 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1490 Returns true if the given symbol name is on the list of
1491 assignments wating to be processed.
1492 * archive.cc (should_incldue_member): If the symbol is undefined,
1493 check to see if it is on the list of symbols pending assignment.
1494
1495 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1496
1497 * script-sections.cc (Script_sections::find_memory_region): Check
1498 for a NULL output section pointer.
1499
1500 2010-10-29 Doug Kwan <dougkwan@google.com>
1501
1502 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1503 Output_section::add_relaxed_input_section.
1504 * output.cc (Output_section::add_relaxed_input_section): Add new
1505 arguments LAYOUT and NAME. Set section order index.
1506 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1507 Copy section order index.
1508 * output.h (Output_section::add_relaxed_input_section): Add new
1509 arguments LAYOUT and NAME.
1510
1511 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1512
1513 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1514 NATIVE_OR_CROSS_LINKER.
1515 * testsuite/Makefile.in: Regenerate.
1516
1517 2010-10-20 Doug Kwan <dougkwan@google.com>
1518
1519 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1520 without SHF_LINK_ORDER flags.
1521 * layout.cc (Layout::choose_output_section): Do not filter
1522 SHF_LINK_ORDER flag in a relocatable link.
1523
1524 2010-10-17 Cary Coutant <ccoutant@google.com>
1525
1526 * output.h (Output_segment::set_section_addresses): Change function
1527 signature. Update all callers.
1528 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1529 sections.
1530 (Output_segment::set_section_addresses): Align after last TLS
1531 section. Add padding before last relro section instead of after.
1532
1533 2010-10-17 Doug Kwan <dougkwan@google.com>
1534
1535 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1536 GOT output section to be writable.
1537
1538 2010-10-14 Cary Coutant <ccoutant@google.com>
1539
1540 * debug.h (DEBUG_INCREMENTAL): New flag.
1541 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1542 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1543 mode.
1544 * incremental.cc (report_command_line): Ignore all forms of
1545 --incremental.
1546 * layout.cc (Layout::Layout): Check parameters for incremental link
1547 mode.
1548 * options.cc (General_options::parse_incremental): New function.
1549 (General_options::parse_no_incremental): New function.
1550 (General_options::parse_incremental_full): New function.
1551 (General_options::parse_incremental_update): New function.
1552 (General_options::incremental_mode_): New data member.
1553 (General_options::finalize): Check incremental_mode_.
1554 * options.h (General_options): Update help text for --incremental.
1555 Add --no-incremental, --incremental-full, --incremental-update.
1556 (General_options::Incremental_mode): New enum type.
1557 (General_options::incremental_mode): New function.
1558 (General_options::incremental_mode_): New data member.
1559 * parameters.cc (Parameters::incremental_mode_): New data member.
1560 (Parameters::set_options): Set incremental_mode_.
1561 (Parameters::set_incremental_full): New function.
1562 (Parameters::incremental): New function.
1563 (Parameters::incremental_update): New function.
1564 (set_parameters_incremental_full): New function.
1565 * parameters.h (Parameters::set_incremental_full): New function.
1566 (Parameters::incremental): New function.
1567 (Parameters::incremental_update): New function.
1568 (Parameters::incremental_mode_): New data member.
1569 (set_parameters_incremental_full): New function.
1570 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1571 incremental link mode.
1572 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1573 (Sized_relobj::do_relocate_sections): Likewise.
1574 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1575 option.
1576 * testsuite/Makefile.in: Regenerate.
1577 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1578
1579 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1580
1581 * script-sections.h (class Script_sections): Make
1582 Sections_elements typedef public.
1583 * script-sections.cc (class Sort_output_sections): Add elements_
1584 field. Add constructor which sets it; change all callers.
1585 (Sort_output_sections::is_before): New function.
1586 (Sort_output_sections::operator()): Call is_before.
1587 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1588 conditional.
1589 * testsuite/script_test_10.sh: New test. Test script section
1590 order.
1591 * testsuite/script_test_10.t: Likewise.
1592 * testsuite/script_test_10.s: Likewise.
1593 * testsuite/Makefile.am: Wrap the cross linker tests and the
1594 common tests into NATIVE_OR_CROSS_LINKER.
1595 (check_SCRIPTS): Add script_test_10.sh.
1596 (check_DATA): Add script_test_10.stdout.
1597 (script_test_10.o, script_test_10): New targets.
1598 (script_test_10.stdout): New target.
1599 * configure, testsuite/Makefile.in: Regenerate.
1600
1601 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1602
1603 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1604 error for the deprecated relocations.
1605 (Target_arm::Scan::global): Likewise.
1606 (Target_arm::Relocate::relocate): Likewise.
1607
1608 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1609
1610 * fileread.cc (Input_file::find_file): Initialize *found_name
1611 and *namep when using the fallback search for case 4.
1612
1613 2010-10-11 Cary Coutant <ccoutant@google.com>
1614
1615 * options.h (class General_options): Redefine -z lazy as an alias for
1616 the negation of -z now.
1617
1618 2010-10-11 Ian Lance Taylor <iant@google.com>
1619
1620 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1621 binding.
1622
1623 2010-10-06 Nick Clifton <nickc@redhat.com>
1624
1625 * script-sections.cc(class Memory_region): Remove
1626 current_lma_offset_ field. Rename current_vma_offset_ to
1627 current_offset_. Add last_section_ field.
1628 (Memory_region::get_current_vma_address): Rename to
1629 get_current_address.
1630 (Memory_region::get_current_lma_address): Delete.
1631 (Memory_region::increment_vma_offset): Rename to
1632 increment_offset.
1633 (Memory_region::increment_lma_offset): Delete.
1634 (Memory_region::attributes_compatible): New method. Returns
1635 true if the provided section is compatible with the region.
1636 (Memory_region::get_last_section): New method. Returns the last
1637 section to use the region.
1638 (Memory_region::set_last_section): New method. Stores the last
1639 section to use the region.
1640 (Script_sections::block_in_region): New method. Returns true if
1641 a block of memory is contained within a region.
1642 (Script_sections::find_memory_region): New method. Locates a
1643 memory region to be used to set a VMA or LMA address.
1644 (Output_section_definition::set_section_addresses): Add code to
1645 check for addresses set by memory regions.
1646 (Output_segment::set_section_addresses): Remove memory region
1647 walking code.
1648 (Script_sections::create_segment): Add a warning if a header
1649 segment is created outside of any region.
1650 * script-sections.h (class Script_sections): Add prototypes for
1651 find_memory_region and block_in_region methods.
1652 * testsuite/memory_test.s: Use .long instead of .word.
1653 * testsuite/memory_test.t: Add some more output sections.
1654 * testsuite/memory_test.sh: Update expected output.
1655
1656 2010-10-02 Doug Kwan <dougkwan@google.com>
1657
1658 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1659 defintion to symtab.h
1660 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1661 declaration to defintion.
1662
1663 2010-10-01 Nick Clifton <nickc@redhat.com>
1664
1665 * expression.cc (eval): Replace dummy argument with NULL.
1666 (eval_maybe_dot): Check for a NULL result section pointer.
1667 (Symbol_expression::value): Likewise.
1668 (Dot_expression::value): Likewise.
1669 (BINARY_EXPRESSION): Likewise.
1670 (Max_expression::value): Likewise.
1671 (Min_expression::value): Likewise.
1672 (Absolute_expression::value): Likewise.
1673 (Addr_expression::value_from_output_section): Likewise.
1674 (Loaddddr_expression::value_from_output_section): Likewise.
1675 (Segment_start_expression::value): Likewise.
1676 * script-sections.cc
1677 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1678 argument with NULL.
1679 (Sections_elememt_dot_assignment::set_section_addresses):
1680 Likewise.
1681 (Output_data_expression::do_write_to_buffer): Likewise.
1682 (Output_section_definition::finalize_symbols): Likewise.
1683 (Output_section_definition::set_section_addresses): Likewise.
1684
1685 2010-09-30 Doug Kwan <dougkwan@google.com>
1686
1687 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1688
1689 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1690
1691 * target.h (Target::can_icf_inline_merge_sections): New virtual
1692 function.
1693 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1694 virtual function.
1695 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1696 virtual function.
1697 * icf.cc (get_section_contents): Inline merge sections only when
1698 target allows it.
1699
1700 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1701
1702 * configure: Regenerate.
1703
1704 2010-09-17 Ian Lance Taylor <iant@google.com>
1705
1706 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1707 * testsuite/Makefile.am (memory_test.o): New target.
1708 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1709 memory_test.t.
1710 * testsuite/Makefile.in: Rebuild.
1711
1712 2010-09-17 Doug Kwan <dougkwan@google.com>
1713
1714 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1715 defintion if relocation uses GOT entries of the symbol.
1716 * testsuite/icf_safe_test.sh: Fix test.
1717 * testsuite/icf_safe_so_test.sh: Fix test.
1718
1719 2010-09-16 Cary Coutant <ccoutant@google.com>
1720
1721 * script_sections.cc (class Memory_region): Remove "NULL" from
1722 vector initializations.
1723
1724 2010-09-15 Cary Coutant <ccoutant@google.com>
1725
1726 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1727 Resolve forwarding symbols.
1728
1729 2010-09-15 Doug Kwan <dougkwan@google.com>
1730
1731 * gold/testsuite/script_test_3.t: Add ARM special sections.
1732 * gold/testsuite/script_test_4.t: Same.
1733 * gold/testsuite/script_test_5.t: Same.
1734 * gold/testsuite/script_test_6.t: Same.
1735 * gold/testsuite/script_test_7.t: Same.
1736 * gold/testsuite/script_test_7.t: Same.
1737 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1738
1739 2010-09-14 Cary Coutant <ccoutant@google.com>
1740
1741 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1742 (Target_x86_64::Relocate::relocate_tls): Replace check for
1743 saw_tls_block_reloc_ with test for executable section.
1744
1745 2010-09-12 Cary Coutant <ccoutant@google.com>
1746
1747 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1748 position-independent executables to shared libraries need dynamic
1749 relocations.
1750 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1751 position-independent executables.
1752 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1753 * testsuite/Makefile.in: Regenerate.
1754
1755 2010-09-10 Nick Clifton <nickc@redhat.com>
1756
1757 PR gold/11997
1758 * testsuite/memory_test.t: Discard any sections that are not
1759 needed.
1760
1761 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1762
1763 PR gold/11996
1764 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1765 "This::" to work around a bug in gcc 4.2.
1766
1767 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1768
1769 2010-09-09 Rafael Espindola <espindola@google.com>
1770
1771 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1772 sections with different PF_X flags in the same segment.
1773 (Layout::find_first_load_seg): Search all segments to find the first
1774 one.
1775 * options.h (rosegment): New.
1776
1777 2010-09-08 Rafael Espindola <espindola@google.com>
1778
1779 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1780
1781 2010-09-08 Doug Kwan <dougkwan@google.com>
1782
1783 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1784 (Arm_relobj::do_relocate_sections): Add new parameter for output
1785 file to match the parent.
1786 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1787 of local symbols instead of input values. Update code to track
1788 changes in gold::relocate_section.
1789 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1790 (Sized_relobj::compute_final_local_value_internal): New methods.
1791 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1792 body into private version of Sized_relobj::compute_final_local_value.
1793 Call the inline method.
1794 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1795 merged symbol value if there is one.
1796 (Symbol_value::has_output_value): New method defintiion.
1797 (Sized_relobj::Compute_final_local_value_status): New enum type.
1798 (Sized_relobj::compute_final_local_value): New methods.
1799 (Sized_relobj::compute_final_local_value_internal): New methods.
1800 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1801 and arm_cortex_a8.sh.
1802 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1803 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1804 New tests.
1805 * Makefile.in: Regenerate.
1806 * testsuite/arm_bl_out_of_range.s: Update test.
1807 * testsuite/thumb_bl_out_of_range.s: Ditto.
1808 * testsuite/thumb_blx_out_of_range.s: Ditto.
1809 * testsuite/arm_branch_out_of_range.sh: New file.
1810 * testsuite/arm_cortex_a8.sh: Ditto.
1811 * testsuite/arm_cortex_a8_b.s: Ditto.
1812 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1813 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1814 * testsuite/arm_cortex_a8_bl.s: Ditto.
1815 * testsuite/arm_cortex_a8_blx.s: Ditto.
1816 * testsuite/arm_cortex_a8_local.s: Ditto.
1817 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1818 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1819
1820 2010-09-08 Rafael Espindola <espindola@google.com>
1821
1822 * Makefile.am (memory_test.stdout): Run readelf with -W.
1823 * Makefile.in: Regenerate.
1824 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1825 64 bit output.
1826
1827 2010-09-08 Rafael Espindola <espindola@google.com>
1828
1829 * script-sections.cc (Script_sections::add_memory_region): Convert
1830 field precision to int.
1831 * script.cc (script_set_section_region, script_set_section_region):
1832 Convert field precision to int.
1833
1834 2010-09-08 Rafael Espindola <espindola@google.com>
1835
1836 * arm.cc (do_finalize_sections): Create the __exidx_start and
1837 __exdix_end symbols even when the section is missing.
1838
1839 2010-09-08 Nick Clifton <nickc@redhat.com>
1840
1841 * README: Remove claim that MEMORY is not supported.
1842 * expression.cc (script_exp_function_origin)
1843 (script_exp_function_length): Move from here to ...
1844 * script.cc: ... here.
1845 (script_set_section_region, script_add_memory)
1846 (script_parse_memory_attr, script_include_directive): New
1847 functions.
1848 * script-sections.cc
1849 (class Memory_region): New class.
1850 (class Output_section_definition): Add set_memory_region,
1851 set_section_vma, set_section_lma and get_section_name methods.
1852 (class Script_Sections): Add add_memory_region,
1853 find_memory_region, find_memory_region_origin,
1854 find_memory_region_length and set_memory_region methods.
1855 Have set_section_addresses method walk the list of set memory
1856 regions.
1857 Extend the print methos to display memory regions.
1858 * script-sections.h: Add prototypes for new methods.
1859 Add enum for MEMORY region attributes.
1860 * yyscript.y: Add support for parsing MEMORY regions.
1861 * script-c.h: Add prototypes for new functions.
1862 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1863 * testsuite/Makefile.in: Regenerate.
1864 * testsuite/memory_test.sh: New script.
1865 * testsuite/memory_test.s: New assembler source file.
1866 * testsuite/memory_test.t: New linker script.
1867
1868 2010-08-27 Doug Kwan <dougkwan@google.com>
1869
1870 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1871 reference override an existing dynamic weak reference.
1872 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1873 * testsuite/Makefile.in: Regenerate.
1874 * testsuite/dyn_weak_ref.sh: New file.
1875 * testsuite/dyn_weak_ref_1.c: Ditto.
1876 * testsuite/dyn_weak_ref_2.c: Ditto.
1877
1878 2010-08-27 Ian Lance Taylor <iant@google.com>
1879
1880 * incremental.h (class Incremental_input_entry): Add virtual
1881 destructor.
1882
1883 2010-08-27 Ian Lance Taylor <iant@google.com>
1884
1885 * testsuite/start_lib_test_3.c: Mark t3 as used.
1886
1887 2010-08-27 Nick Clifton <nickc@redhat.com>
1888
1889 * options.cc (version_script): Fix small typo in previous
1890 whitespace tidyup.
1891
1892 2010-08-25 Nick Clifton <nickc@redhat.com>
1893
1894 * archive.cc: Formatting fixes: Remove whitespace between
1895 typename and following asterisk. Remove whitespace between
1896 function name and opening parenthesis.
1897 * archive.h: Likewise.
1898 * arm.cc: Likewise.
1899 * attributes.cc: Likewise.
1900 * attributes.h: Likewise.
1901 * common.cc: Likewise.
1902 * copy-relocs.cc: Likewise.
1903 * dirsearch.h: Likewise.
1904 * dynobj.cc: Likewise.
1905 * ehframe.cc: Likewise.
1906 * ehframe.h: Likewise.
1907 * expression.cc: Likewise.
1908 * fileread.cc: Likewise.
1909 * fileread.h: Likewise.
1910 * gc.h: Likewise.
1911 * gold-threads.cc: Likewise.
1912 * gold.cc: Likewise.
1913 * i386.cc: Likewise.
1914 * icf.h: Likewise.
1915 * incremental-dump.cc: Likewise.
1916 * incremental.cc: Likewise.
1917 * layout.cc: Likewise.
1918 * layout.h: Likewise.
1919 * main.cc: Likewise.
1920 * merge.cc: Likewise.
1921 * merge.h: Likewise.
1922 * object.cc: Likewise.
1923 * object.h: Likewise.
1924 * options.cc: Likewise.
1925 * options.h: Likewise.
1926 * output.cc: Likewise.
1927 * output.h: Likewise.
1928 * plugin.cc: Likewise.
1929 * plugin.h: Likewise.
1930 * powerpc.cc: Likewise.
1931 * reloc.cc: Likewise.
1932 * script-c.h: Likewise.
1933 * script-sections.cc: Likewise.
1934 * script.cc: Likewise.
1935 * stringpool.cc: Likewise.
1936 * symtab.cc: Likewise.
1937 * symtab.h: Likewise.
1938 * target.cc: Likewise.
1939 * timer.cc: Likewise.
1940 * timer.h: Likewise.
1941 * version.cc: Likewise.
1942 * x86_64.cc: Likewise.
1943
1944 2010-08-24 Nick Clifton <nickc@redhat.com>
1945
1946 PR 11899
1947 * layout.cc (segment_precedes): Sort segments by their physical
1948 addresses, if they have been set.
1949
1950 2010-08-23 Cary Coutant <ccoutant@google.com>
1951
1952 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1953 symbols data.
1954 (Lib_group::include_member): Unlock object after deleting its
1955 symbols data.
1956 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1957 the bug fixed here.
1958
1959 2010-08-19 Neil Vachharajani <nvachhar@google.com>
1960 Cary Coutant <ccoutant@google.com>
1961
1962 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1963 constructor, and set_blocker.
1964 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1965 readsyms_blocker_.
1966 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1967 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1968 * testsuite/Makefile.am (start_lib_test): New test case.
1969 * testsuite/Makefile.in: Regenerate.
1970 * testsuite/start_lib_test_main.c: New file.
1971 * testsuite/start_lib_test_1.c: New file.
1972 * testsuite/start_lib_test_2.c: New file.
1973 * testsuite/start_lib_test_3.c: New file.
1974
1975 2010-08-19 Ian Lance Taylor <iant@google.com>
1976
1977 * Makefile.in: Rebuild with automake 1.11.1.
1978 * aclocal.m4: Likewise.
1979 * testsuite/Makefile.in: Likewise.
1980
1981 2010-08-19 Ian Lance Taylor <iant@google.com>
1982
1983 PR 10893
1984 * i386.cc (class Output_data_plt_i386): Update declarations.
1985 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1986 local_ifuncs_ fields.
1987 (Target_i386::do_plt_section_for_global): New function.
1988 (Target_i386::do_plt_section_for_local): New function.
1989 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1990 parameter; change all callers. Initialize global_ifuncs_ and
1991 local_ifuncs_. If doing a static link define __rel_iplt_start and
1992 __rel_iplt_end.
1993 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1994 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1995 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1996 symbols.
1997 (Target_i386::make_plt_section): New function, broken out of
1998 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1999 (Target_i386::make_plt_entry): Call make_plt_section.
2000 (Target_i386::make_local_ifunc_plt_entry): New function.
2001 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2002 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2003 R_386_IRELATIVE to switch.
2004 (Target_i386::Scan::global): Likewise.
2005 (Target_i386::Relocate::relocate): Likewise.
2006 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2007 switch.
2008 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2009 (Target_x86_64::do_plt_section_for_global): New function.
2010 (Target_x86_64::do_plt_section_for_local): New function.
2011 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2012 parameter; change all callers. If doing a static link define
2013 __rela_iplt_start and __rela_iplt_end.
2014 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2015 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2016 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2017 to point to .plt.
2018 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2019 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2020 switch.
2021 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2022 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2023 R_X86_64_IRELATIVE to switch.
2024 (Target_x86_64::Scan::global): Likewise.
2025 (Target_x86_64::Relocate::relocate): Likewise.
2026 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2027 switch.
2028 * target.h (class Target): Add plt_section_for_global and
2029 plt_section_for_local functions. Add do_plt_section_for_global
2030 and do_plt_section_for_local virtual functions.
2031 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2032 clarifying comments.
2033 (Symbol::use_plt_offset): Handle IFUNC symbol.
2034 * object.cc (Sized_relobj::Sized_relobj): Initialize
2035 local_plt_offsets_.
2036 (Sized_relobj::local_has_plt_offset): New function.
2037 (Sized_relobj::local_plt_offset): New function.
2038 (Sized_relobj::set_local_plt_offset): New function.
2039 (Sized_relobj::do_count): Handle IFUNC symbol.
2040 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2041 a bit away from input_shndx_ field. Add set_is_func_symbol and
2042 is_ifunc_symbol functions.
2043 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2044 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2045 local_plt_offsets_ field.
2046 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2047 * output.h (class Output_section_data): Add non-const
2048 output_section function.
2049 (class Output_data_got): Update declarations.
2050 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2051 Add use_plt_offset parameter to global and local constructors.
2052 Change all callers. Change local_sym_index_ field to 31 bits.
2053 Change GSYM_CODE and CONSTANT_CODE accordingly.
2054 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2055 doing a static link don't set sh_link field.
2056 (Output_data_got::Got_entry::write): Use PLT offset if
2057 appropriate.
2058 (Output_data_got::add_global_plt): New function.
2059 (Output_data_got::add_local_plt): New function.
2060 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2061 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2062 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2063 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2064 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2065 IFUNC conditional.
2066 * testsuite/ifunc-sel.h: New file.
2067 * testsuite/ifuncmain1.c: New file.
2068 * testsuite/ifuncmain1vis.c: New file.
2069 * testsuite/ifuncmod1.c: New file.
2070 * testsuite/ifuncdep2.c: New file.
2071 * testsuite/ifuncmain2.c: New file.
2072 * testsuite/ifuncmain3.c: New file.
2073 * testsuite/ifuncmod3.c: New file.
2074 * testsuite/ifuncmain4.c: New file.
2075 * testsuite/ifuncmain5.c: New file.
2076 * testsuite/ifuncmod5.c: New file.
2077 * testsuite/ifuncmain6pie.c: New file.
2078 * testsuite/ifuncmod6.c: New file.
2079 * testsuite/ifuncmain7.c: New file.
2080 * configure, testsuite/Makefile.in: Rebuild.
2081
2082 2010-08-18 Ian Lance Taylor <iant@google.com>
2083
2084 * incremental.cc
2085 (Output_section_incremental_inputs::write_input_files): Add cast
2086 to avoid signed/unsigned comparison warning.
2087 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2088
2089 2010-08-12 Cary Coutant <ccoutant@google.com>
2090
2091 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2092
2093 2010-08-13 Ian Lance Taylor <iant@google.com>
2094
2095 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2096
2097 2010-08-12 Cary Coutant <ccoutant@google.com>
2098 Doug Kwan <dougkwan@google.com>
2099
2100 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2101 defintion overrides non-weak undef, remember that the original undef
2102 is not weak.
2103 * symtab.cc (Symbol_table::sized_write_global): For undef without
2104 an original weak binding, set binding to global in output.
2105 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2106 * testsuite/Makefile.in: Regenerate.
2107 * testsuite/strong_ref_weak_def.sh: New file.
2108 * testsuite/strong_ref_weak_def_1.c: Ditto.
2109 * testsuite/strong_ref_weak_def_2.c: Ditto.
2110
2111 2010-08-12 Cary Coutant <ccoutant@google.com>
2112
2113 * testsuite/incremental_test.sh: Rewrite.
2114 * testsuite/incremental_test_1.c: Rewrite.
2115 * testsuite/incremental_test_2.c: Rewrite.
2116
2117 2010-08-12 Cary Coutant <ccoutant@google.com>
2118
2119 * arm.cc (Target_arm::got_size): Add const.
2120 (Target_arm::got_entry_count): New function.
2121 (Target_arm::plt_entry_count): New function.
2122 (Target_arm::first_plt_entry_offset): New function.
2123 (Target_arm::plt_entry_size): New function.
2124 (Output_data_plt_arm::entry_count): New function.
2125 (Output_data_plt_arm::first_plt_entry_offset): New function.
2126 (Output_data_plt_arm::get_plt_entry_size): New function.
2127 * i386.cc (Target_i386::got_size): Add const.
2128 (Target_i386::got_entry_count): New function.
2129 (Target_i386::plt_entry_count): New function.
2130 (Target_i386::first_plt_entry_offset): New function.
2131 (Target_i386::plt_entry_size): New function.
2132 (Output_data_plt_i386::entry_count): New function.
2133 (Output_data_plt_i386::first_plt_entry_offset): New function.
2134 (Output_data_plt_i386::get_plt_entry_size): New function.
2135 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2136 find_incremental_inputs_sections. Dump incremental_got_plt section.
2137 * incremental.cc: Include target.h.
2138 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2139 parameter. Adjust all callers. Find incremental_got_plt section.
2140 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2141 section.
2142 (Output_section_incremental_inputs::set_final_data_size): Calculate
2143 size of incremental_got_plt section.
2144 (Output_section_incremental_inputs::do_write): Write the
2145 incremental_got_plt section.
2146 (Got_plt_view_info): New struct.
2147 (Local_got_offset_visitor): New class.
2148 (Global_got_offset_visitor): New class.
2149 (Global_symbol_visitor_got_plt): New class.
2150 (Output_section_incremental_inputs::write_got_plt): New function.
2151 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2152 Add parameter. Adjust all callers.
2153 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2154 (Incremental_inputs::got_plt_section): New function.
2155 (Incremental_inputs::got_plt_section_): New data member.
2156 (Incremental_got_plt_reader): New class.
2157 * layout.cc (Layout::create_incremental_info_sections): Add the
2158 incremental_got_plt section.
2159 * object.h (Got_offset_list::get_list): New function.
2160 (Got offset_list::for_all_got_offsets): New function.
2161 (Sized_relobj::local_got_offset_list): New function.
2162 * powerpc.cc (Target_powerpc::got_size): Add const.
2163 (Target_powerpc::got_entry_count): New function.
2164 (Target_powerpc::plt_entry_count): New function.
2165 (Target_powerpc::first_plt_entry_offset): New function.
2166 (Target_powerpc::plt_entry_size): New function.
2167 (Output_data_plt_powerpc::entry_count): New function.
2168 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2169 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2170 * sparc.cc (Target_sparc::got_size): Add const.
2171 (Target_sparc::got_entry_count): New function.
2172 (Target_sparc::plt_entry_count): New function.
2173 (Target_sparc::first_plt_entry_offset): New function.
2174 (Target_sparc::plt_entry_size): New function.
2175 (Output_data_plt_sparc::entry_count): New function.
2176 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2177 (Output_data_plt_sparc::get_plt_entry_size): New function.
2178 * symtab.h (Symbol::got_offset_list): New function.
2179 (Symbol_table::for_all_symbols): New function.
2180 * target.h (Sized_target::got_entry_count): New function.
2181 (Sized_target::plt_entry_count): New function.
2182 (Sized_target::plt_entry_size): New function.
2183 * x86_64.cc (Target_x86_64::got_size): Add const.
2184 (Target_x86_64::got_entry_count): New function.
2185 (Target_x86_64::plt_entry_count): New function.
2186 (Target_x86_64::first_plt_entry_offset): New function.
2187 (Target_x86_64::plt_entry_size): New function.
2188 (Output_data_plt_x86_64::entry_count): New function.
2189 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2190 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2191
2192 2010-08-12 Cary Coutant <ccoutant@google.com>
2193
2194 * archive.cc: Include incremental.h.
2195 (Archive::Archive): Initialize incremental_info_.
2196 (Archive::include_member): Record archive members in incremental info.
2197 (Add_archive_symbols::run): Record begin and end of an archive in
2198 incremental info.
2199 (Lib_group::include_member): Record objects in incremental info.
2200 * archive.h (Incremental_archive_entry): Forward declaration.
2201 (Archive::set_incremental_info): New member function.
2202 (Archive::incremental_info): New member function.
2203 (Archive::Unused_symbol_iterator): New class.
2204 (Archive::unused_symbols_begin): New member function.
2205 (Archive::unused_symbols_end): New member function.
2206 (Archive::incremental_info_): New data member.
2207 * incremental-dump.cc (find_input_containing_global): New function.
2208 (dump_incremental_inputs): Dump new incremental info sections.
2209 * incremental.cc: Include symtab.h.
2210 (Output_section_incremental_inputs): New class.
2211 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2212 new incremental info sections.
2213 (Sized_incremental_binary::do_check_inputs): Likewise.
2214 (Incremental_inputs::report_archive): Remove.
2215 (Incremental_inputs::report_archive_begin): New function.
2216 (Incremental_inputs::report_archive_end): New function.
2217 (Incremental_inputs::report_object): New function.
2218 (Incremental_inputs::finalize_inputs): Remove.
2219 (Incremental_inputs::report_input_section): New function.
2220 (Incremental_inputs::report_script): Rewrite.
2221 (Incremental_inputs::finalize): Do nothing but finalize string table.
2222 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2223 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2224 (Incremental_inputs::create_data_sections): New function.
2225 (Incremental_inputs::relocs_entsize): New function.
2226 (Output_section_incremental_inputs::set_final_data_size): New function.
2227 (Output_section_incremental_inputs::do_write): New function.
2228 (Output_section_incremental_inputs::write_header): New function.
2229 (Output_section_incremental_inputs::write_input_files): New function.
2230 (Output_section_incremental_inputs::write_info_blocks): New function.
2231 (Output_section_incremental_inputs::write_symtab): New function.
2232 * incremental.h (Incremental_script_entry): Forward declaration.
2233 (Incremental_object_entry): Forward declaration.
2234 (Incremental_archive_entry): Forward declaration.
2235 (Incremental_inputs): Forward declaration.
2236 (Incremental_inputs_header_data): Remove.
2237 (Incremental_inputs_header): Remove.
2238 (Incremental_inputs_header_write): Remove.
2239 (Incremental_inputs_entry_data): Remove.
2240 (Incremental_inputs_entry): Remove.
2241 (Incremental_inputs_entry_write): Remove.
2242 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2243 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2244 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2245 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2246 Likewise.
2247 (Incremental_input_entry): New class.
2248 (Incremental_script_entry): New class.
2249 (Incremental_object_entry): New class.
2250 (Incremental_archive_entry): New class.
2251 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2252 (Incremental_inputs::report_inputs): Remove.
2253 (Incremental_inputs::report_archive): Remove.
2254 (Incremental_inputs::report_archive_begin): New function.
2255 (Incremental_inputs::report_archive_end): New function.
2256 (Incremental_inputs::report_object): Change prototype.
2257 (Incremental_inputs::report_input_section): New function.
2258 (Incremental_inputs::report_script): Change prototype.
2259 (Incremental_inputs::get_reloc_count): New function.
2260 (Incremental_inputs::set_reloc_count): New function.
2261 (Incremental_inputs::create_data_sections): New function.
2262 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2263 (Incremental_inputs::inputs_section): New function.
2264 (Incremental_inputs::symtab_section): New function.
2265 (Incremental_inputs::relocs_section): New function.
2266 (Incremental_inputs::get_stringpool): Add const.
2267 (Incremental_inputs::command_line): Add const.
2268 (Incremental_inputs::inputs): Remove.
2269 (Incremental_inputs::command_line_key): New function.
2270 (Incremental_inputs::input_file_count): New function.
2271 (Incremental_inputs::input_files): New function.
2272 (Incremental_inputs::relocs_entsize): New function.
2273 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2274 (Incremental_inputs::finalize_inputs): Remove.
2275 (Incremental_inputs::Input_info): Remove.
2276 (Incremental_inputs::lock_): Remove.
2277 (Incremental_inputs::inputs_): Change type.
2278 (Incremental_inputs::inputs_map_): Remove.
2279 (Incremental_inputs::current_object_entry_): New data member.
2280 (Incremental_inputs::inputs_section_): New data member.
2281 (Incremental_inputs::symtab_section_): New data member.
2282 (Incremental_inputs::relocs_section_): New data member.
2283 (Incremental_inputs::reloc_count_): New data member.
2284 (Incremental_inputs_reader): New class.
2285 (Incremental_symtab_reader): New class.
2286 (Incremental_relocs_reader): New class.
2287 * layout.cc (Layout::finalize): Move finalization of incremental info
2288 and creation of incremental info sections to follow finalization of
2289 symbol table. Set offsets for postprocessing sections.
2290 (Layout::create_incremental_info_sections): Call
2291 Incremental_inputs::create_data_sections. Add incremental symtab
2292 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2293 sections to layout after input sections.
2294 * layout.h (struct Timespec): Forward declaration.
2295 (Layout::incremental_inputs): Add const.
2296 (Layout::create_incremental_info_sections): Add parameter.
2297 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2298 * object.cc: Include incremental.h.
2299 (Relobj::finalize_incremental_relocs): New function.
2300 (Sized_relobj::do_layout): Record input sections in incremental info.
2301 * object.h (Object::output_section): New function.
2302 (Object::output_section_offset): Moved from Relobj.
2303 (Object::get_incremental_reloc_base): New function.
2304 (Object::get_incremental_reloc_count): New function.
2305 (Object::do_output_section): New function.
2306 (Object::do_output_section_offset): Moved from Relobj.
2307 (Object::do_get_incremental_reloc_base): New function.
2308 (Object::do_get_incremental_reloc_count): New function.
2309 (Object::Object): Initialize new data members.
2310 (Relobj::output_section): Renamed do_output_section and moved to
2311 protected.
2312 (Relobj::output_section_offset): Moved to Object.
2313 (Relobj::do_get_incremental_reloc_base): New function.
2314 (Relobj::do_get_incremental_reloc_count): New function.
2315 (Relobj::allocate_incremental_reloc_counts): New function.
2316 (Relobj::count_incremental_reloc): New function.
2317 (Relobj::finalize_incremental_relocs): New function.
2318 (Relobj::next_incremental_reloc_index): New function.
2319 (Relobj::reloc_counts_): New data member.
2320 (Relobj::reloc_bases_): New data member.
2321 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2322 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2323 (Sized_relobj::incremental_relocs_scan): New function.
2324 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2325 (Sized_relobj::incremental_relocs_write): New function.
2326 (Sized_relobj::incremental_relocs_write_reltype): New function.
2327 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2328 incremental link.
2329 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2330 archives and object files elsewhere.
2331 (Add_symbols::run): Report object files here.
2332 (Finish_group::run): Report end of archive at end of group.
2333 * reloc.cc: Include layout.h, incremental.h.
2334 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2335 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2336 (Sized_relobj::incremental_relocs_scan): New function.
2337 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2338 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2339 (Sized_relobj::incremental_relocs_write): New function.
2340 (Sized_relobj::incremental_relocs_write_reltype): New function.
2341 * script.cc (read_input_script): Rewrite test for incremental link.
2342 Change call to Incremental_inputs::report_script.
2343 * symtab.h (Symbol_table::first_global_index): New function.
2344 (Symbol_table::output_count): New function.
2345
2346 2010-08-12 Doug Kwan <dougkwan@google.com>
2347
2348 * arm.cc (Target_arm::merge_object_attributes): Check command line
2349 options --no-wchar-size-warning and --no-enum-size-warning.
2350 * options.h (General_options): Add ld-compatible options
2351 --no-enum-size-warning and --no-wchar-size-warning.
2352
2353 2010-08-04 Ian Lance Taylor <iant@google.com>
2354
2355 * x86_64.cc (Target_x86_64::Scan::local): Use
2356 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2357 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2358 (Target_x86_64::Scan::global): Likewise.
2359 (Target_x86_64::Relocate::relocate): Likewise.
2360 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2361 Likewise.
2362
2363 2010-08-03 Cary Coutant <ccoutant@google.com>
2364
2365 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2366 to reserve space in merged_strings vector. Keep total input size
2367 for stats.
2368 (Output_merge_string::do_print_merge_stats): Print total input size.
2369 * merge.h (Output_merge_string): Add input_size_ field.
2370 * stringpool.cc (Stringpool_template::string_length): Move
2371 implementations out of Stringpool_template class and place in
2372 stringpool.h.
2373 * stringpool.h (string_length): Move out of Stringpool_template.
2374
2375 2010-08-03 Ian Lance Taylor <iant@google.com>
2376
2377 PR 11712
2378 * layout.cc (relaxation_loop_body): If address of load segment is
2379 set, adjust address to include headers if possible.
2380
2381 2010-08-03 Ian Lance Taylor <iant@google.com>
2382
2383 * version.cc (version_string): Bump to 1.10.
2384
2385 2010-08-03 Ian Lance Taylor <iant@google.com>
2386
2387 PR 11805
2388 * layout.h (enum Output_section_order): Define.
2389 (class Layout): Update declarations.
2390 * layout.cc (Layout::get_output_section): Add order parameter.
2391 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2392 is_first_non_relro parameters. Change all callers.
2393 (Layout::choose_output_section): Likewise.
2394 (Layout::add_output_section_data): Likewise.
2395 (Layout::make_output_section): Likewise. Set order.
2396 (Layout::default_section_order): New function.
2397 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2398 * output.cc (Output_section::Output_section): Initialize order_.
2399 Don't initialize deleted fields.
2400 (Output_segment::Output_segment): Don't initialize deleted
2401 fields.
2402 (Output_segment::add_output_section_to_load): New function
2403 replacing add_output_section. Change all callers to call this or
2404 add_output_section_to_nonload.
2405 (Output_segment::add_output_section_to_nonload): New function.
2406 (Output_segment::remove_output_section): Rewrite.
2407 (Output_segment::add_initial_output_data): Likewise.
2408 (Output_segment::has_any_data_sections): Likewise.
2409 (Output_segment::is_first_section_relro): Likewise.
2410 (Output_segment::maximum_alignment): Likewise.
2411 (Output_segment::has_dynamic_reloc): New function replacing
2412 dynamic_reloc_count. Change all callers.
2413 (Output_segment::has_dynamic_reloc_list): New function replacing
2414 dynamic_reloc_count_list. Change all callers.
2415 (Output_segment::set_section_addresses): Rewrite.
2416 (Output_segment::set_offset): Rewrite.
2417 (Output_segment::find_first_and_last_list): Remove.
2418 (Output_segment::set_tls_offsets): Rewrite.
2419 (Output_segment::first_section_load_address): Likewise.
2420 (Output_segment::output_section_count): Likewise.
2421 (Output_segment::section_with_lowest_load_address): Likewise.
2422 (Output_segment::write_section_headers): Likewise.
2423 (Output_segment::print_sections_to_map): Likewise.
2424 * output.h (class Output_data): Remove dynamic_reloc_count_
2425 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2426 (Output_data::add_dynamic_reloc): Rewrite.
2427 (Output_data::has_dynamic_reloc): New function.
2428 (Output_data::dynamic_reloc_count): Remove.
2429 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2430 is_last_relro_, is_first_non_relro_, is_interp_,
2431 is_dynamic_linker_section_ fields. Add order and set_order
2432 functions. Remove is_relro_local, set_is_relro_local,
2433 is_last_relro, set_is_last_relro, is_first_non_relro,
2434 set_is_first_non_relro functions, is_interp, set_is_interp,
2435 is_dynamic_linker_section, and set_is_dynamic_linker_section
2436 functions.
2437 (class Output_segment): Change Output_data_list from std::list to
2438 std:;vector. Add output_lists_ field. Remove output_data_ and
2439 output_bss_ fields. Update declarations.
2440
2441 2010-08-02 Ian Lance Taylor <iant@google.com>
2442
2443 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2444 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2445 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2446
2447 2010-08-02 Ian Lance Taylor <iant@google.com>
2448
2449 PR 11855
2450 * script.cc (Script_options::Script_options): Initialize
2451 symbol_definitions_ and symbol_references_.
2452 (Script_options::add_symbol_assignment): Update
2453 symbol_definitions_ and symbol_references_.
2454 (Script_options::add_symbol_reference): New function.
2455 (script_symbol): New function.
2456 * script.h (class Script_options): Add symbol_definitions_ and
2457 symbol_references_ fields.
2458 (Script_options::referenced_const_iterator): New type.
2459 (Script_options::referenced_begin): New function.
2460 (Script_options::referenced_end): New function.
2461 (Script_options::is_referenced): New function.
2462 (Script_options::any_unreferenced): New function.
2463 * script-c.h (script_symbol): Declare.
2464 * yyscript.y (exp): Call script_symbol.
2465 * symtab.cc: Include "script.h".
2466 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2467 Change all callers. Check symbols referenced by scripts.
2468 (Symbol_table::add_undefined_symbols_from_command_line): Add
2469 layout parameter. Change all callers.
2470 (Symbol_table::do_add_undefined_symbols_from_command_line):
2471 Likewise. Break out loop body. Check symbols referenced by
2472 scripts.
2473 (Symbol_table::add_undefined_symbol_from_command_line): New
2474 function broken out of
2475 do_add_undefined_symbols_from_command_line.
2476 * symtab.h (class Symbol_table): Update declarations.
2477 * archive.cc: Include "layout.h".
2478 (Archive::should_include_member): Add layout parameter. Change
2479 all callers. Check for symbol mentioned in expression.
2480 * archive.h (class Archive): Update declaration.
2481 * object.cc (Sized_relobj::do_should_include_member): Add layout
2482 parameter.
2483 * object.h (Object::should_include_member): Add layout parameter.
2484 Change all callers.
2485 (Object::do_should_include_member): Add layout parameter.
2486 (class Sized_relobj): Update declaration.
2487 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2488 parameter.
2489 * dynobj.h (class Sized_dynobj): Update declaration.
2490 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2491 layout parameter.
2492 * plugin.h (class Sized_pluginobj): Update declaration.
2493
2494 2010-08-02 Ian Lance Taylor <iant@google.com>
2495
2496 PR 11866
2497 * output.cc (Output_segment::set_offset): Search for the first and
2498 last sections rather than assuming that the list is in order.
2499 (Output_segment::find_first_and_last_list): New function.
2500 * output.h (class Output_segment): Update declarations.
2501 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2502 (relro_strip_test_SOURCES): New variable.
2503 (relro_strip_test_DEPENDENCIES): New variable.
2504 (relro_strip_test_LDFLAGS): New variable.
2505 (relro_strip_test_LDADD): New variable.
2506 (relro_strip_test.so): New target.
2507
2508 2010-08-02 Ian Lance Taylor <iant@google.com>
2509
2510 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2511 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2512 (Target_i386::got_tlsdesc_section): New function.
2513 (Target_i386::got_section): Create space for GOT entries for
2514 TLSDESC relocations.
2515 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2516 R_386_TLS_GOTDESC.
2517 (Target_i386::Scan::global): Likewise.
2518 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2519 using TLSDESC GOT.
2520 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2521 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2522 (Target_x86_64::got_tlsdesc_section): New function.
2523 (Target_x86_64::got_section): Create space for GOT entries for
2524 TLSDESC relocations.
2525 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2526 R_386_TLS_GOTDESC.
2527 (Target_x86_64::Scan::global): Likewise.
2528 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2529 using TLSDESC GOT.
2530
2531 2010-08-02 Ian Lance Taylor <iant@google.com>
2532
2533 * testsuite/final_layout.sh: Use dc to convert from hex to
2534 decimal.
2535
2536 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2537
2538 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2539 paramter to the call to gold::gc_process_relocs.
2540 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2541 paramter to the call to gold::gc_process_relocs.
2542 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2543 parameter to the call to gold::gc_process_relocs.
2544 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2545 template parameter to the call to gold::gc_process_relocs.
2546 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2547 paramter to the call to gold::gc_process_relocs.
2548 * gc.h (get_embedded_addend_size): New function.
2549 (gc_process_relocs): Save the size of the reloc for use by ICF.
2550 * icf.cc (get_section_contents): Get the addend from the text section
2551 for SHT_REL relocation sections.
2552 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2553 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2554 * int_encoding.h (read_from_pointer): New overloaded function.
2555 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2556 * testsuite/icf_sht_rel_addend_test.sh: New file.
2557 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2558 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2559
2560 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2561
2562 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2563 * Makefile.in: Regenerate.
2564 * testsuite/Makefile.in: Regenerate.
2565
2566 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2567
2568 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2569 * gold/testsuite/debug_msg.cc: Likewise.
2570 * gold/testsuite/odr_violation1.cc
2571 * gold/testsuite/odr_violation2.cc
2572
2573 2010-07-21 Cary Coutant <ccoutant@google.com>
2574
2575 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2576 string, and length fields.
2577 (Output_merge_string::Merged_strings_list): New type.
2578 (Output_merge_string::Merged_strings_lists): New typedef.
2579 (Output_merge_string): Replace merged_strings_ with
2580 merged_strings_lists_.
2581 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2582 Merged_strings_list per input object and section. Don't store pointer
2583 to the string. Don't store length with each merged string entry.
2584 (Output_merge_string::finalize_merged_data): Loop over list of merged
2585 strings lists. Recompute length of each merged string.
2586
2587 2010-07-15 Cary Coutant <ccoutant@google.com>
2588
2589 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2590 here.
2591
2592 2010-07-14 Ian Lance Taylor <iant@google.com>
2593
2594 * descriptors.cc (Descriptors::open): Report correct name in error
2595 message.
2596
2597 2010-07-13 Doug Kwan <dougkwan@google.com>
2598
2599 * arm.cc (Arm_input_section::Arm_input_section): For a
2600 SHT_ARM_EXIDX section, always keeps the input sections.
2601 (Arm_input_section::set_exidx_section_link): New method.
2602 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2603 has_errors_ to false.
2604 (Arm_exidx_input_section::has_errors,
2605 Arm_exidx_input_section::set_has_errors): New methods.
2606 (Arm_exidx_input_section::has_errors_): New data member.
2607 (Arm_relobj::get_exidx_shndx_list): New method.
2608 (Arm_output_section::append_text_sections_to_list): Do not skip
2609 section without SHF_EXECINSTR.
2610 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2611 errors.
2612 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2613 section header. Make error messages more verbose. Check for
2614 a non-executable section linked to an EXIDX section.
2615 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2616 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2617 check that there is no deferred EXIDX section if we exit early.
2618 Instead of not making an EXIDX section in case of an error, make one
2619 and set the has_errors flag of it.
2620 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2621 in a relocatable link.
2622 (Target_arm::do_relax): Look for the EXIDX output section instead of
2623 assuming that it is called .ARM.exidx.
2624 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2625 section list. Do not check for SHF_EXECINSTR section flags but
2626 skip any input section with errors.
2627 * output.cc (Output_section::Output_section): Initialize
2628 always_keeps_input_sections_ to false.
2629 (Output_section::add_input_section): Check for
2630 always_keeps_input_sections_.
2631 * output.h (Output_section::always_keeps_input_sections,
2632 Output_section::set_always_keeps_input_sections): New methods.
2633 (Output_section::always_keeps_input_sections): New data member.
2634
2635 2010-07-13 Rafael Espindola <espindola@google.com>
2636
2637 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2638 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2639
2640 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2641 Ian Lance Taylor <iant@google.com>
2642
2643 * output.h (Output_section_lookup_maps::add_merge_section):
2644 Correct check of whether value was inserted.
2645 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2646 (Output_section_lookup_maps::add_relaxed_input_section):
2647 Likewise.
2648 * arm.cc (Target_arm::got_section): Remove used local os.
2649 * i386.cc (Target_i386::got_section): Likewise.
2650 * x86_64.cc (Target_x86_64::got_section): Likewise.
2651 * sparc.cc (Target_sparc::got_section): Likewise.
2652 (Target_sparc::relocate): Remove unused local have_got_offset.
2653 * powerpc.cc (Target_powerpc::relocate): Likewise.
2654
2655 2010-07-13 Ian Lance Taylor <iant@google.com>
2656
2657 * compressed_output.cc (zlib_decompress): Fix signature in
2658 !HAVE_ZLIB_H case.
2659
2660 * archive.cc (Archive::include_member): Unlock an external member
2661 of a thin archive. Don't bother to delete an object we know is
2662 NULL.
2663
2664 2010-07-12 Cary Coutant <ccoutant@google.com>
2665
2666 * compressed_output.cc (zlib_decompress): New function.
2667 (get_uncompressed_size): New function.
2668 (decompress_input_section): New function.
2669 * compressed_output.h (get_uncompressed_size): New function.
2670 (decompress_input_section): New function.
2671 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2672 Handle compressed debug sections.
2673 * layout.cc (is_compressed_debug_section): New function.
2674 (Layout::output_section_name): Map compressed section names to
2675 canonical names.
2676 * layout.h (is_compressed_debug_section): New function.
2677 (is_debug_info_section): Recognize compressed debug sections.
2678 * merge.cc: Include compressed_output.h.
2679 (Output_merge_data::do_add_input_section): Handle compressed
2680 debug sections.
2681 (Output_merge_string::do_add_input_section): Handle compressed
2682 debug sections.
2683 * object.cc: Include compressed_output.h.
2684 (Sized_relobj::Sized_relobj): Initialize new data members.
2685 (build_compressed_section_map): New function.
2686 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2687 * object.h (Object::section_is_compressed): New method.
2688 (Object::do_section_is_compressed): New method.
2689 (Sized_relobj::Compressed_section_map): New type.
2690 (Sized_relobj::do_section_is_compressed): New method.
2691 (Sized_relobj::compressed_sections_): New data member.
2692 * output.cc (Output_section::add_input_section): Handle compressed
2693 debug sections.
2694 * reloc.cc: Include compressed_output.h.
2695 (Sized_relobj::write_sections): Handle compressed debug sections.
2696
2697 2010-07-08 Cary Coutant <ccoutant@google.com>
2698
2699 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2700 weak when resolving to a dynamic def.
2701 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2702 for weak undef/dynamic def cases. Adjust callers.
2703 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2704 undef_binding_weak_.
2705 (Symbol_table::sized_write_globals): Adjust symbol binding.
2706 (Symbol_table::sized_write_symbol): Add binding parameter.
2707 * symtab.h (Symbol::set_undef_binding): New method.
2708 (Symbol::is_undef_binding_weak): New method.
2709 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2710 (Symbol_table::should_override): Add new parameter.
2711 (Symbol_table::sized_write_symbol): Add new parameter.
2712
2713 * testsuite/weak_undef_file1.cc: Add new test case.
2714 * testsuite/weak_undef_file2.cc: Fix header comment.
2715 * testsuite/weak_undef_test.cc: Add new test case.
2716
2717 2010-06-29 Doug Kwan <dougkwan@google.com>
2718
2719 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2720 Initialize USE_SYMBOL_.
2721 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2722 definition.
2723 (Arm_reloc_property::uses_symbol_): New data member declaration.
2724 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2725 uses symbol value and symbol is undefined but not weakly undefined.
2726
2727 2010-06-28 Rafael Espindola <espindola@google.com>
2728
2729 * plugin.cc (Plugin::load): Use dlerror.
2730
2731 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2732
2733 * symtab.cc (detect_odr_violations): When reporting an ODR
2734 violation, report an object where the symbol is defined.
2735
2736 2010-06-25 Doug Kwan <dougkwan@google.com>
2737
2738 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2739 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2740 definition.
2741 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2742 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2743 target hook to detect function points.
2744 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2745 * icf.h (Icf::check_section_for_function_pointers): Change type of
2746 parameter SECTION_NAME to const reference to std::string. Use
2747 target hook to determine if section may have unsafe pointers.
2748 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2749 method definition.
2750
2751 2010-06-21 Rafael Espindola <espindola@google.com>
2752
2753 * fileread.cc (Input_file::find_fie): New
2754 (Input_file::open): Use Input_file::find_fie.
2755 * fileread.h (Input_file::find_fie): New
2756 * plugin.cc (set_extra_library_path): New.
2757 (Plugin::load): Add set_extra_library_path to the transfer vector.
2758 (Plugin_manager::set_extra_library_path): New.
2759 (Plugin_manager::add_input_file): Use the extra search path if set.
2760 (set_extra_library_path(): New.
2761 * plugin.h (Plugin_manager): Add set_extra_library_path and
2762 extra_search_path_.
2763
2764 2010-06-19 Cary Coutant <ccoutant@google.com>
2765
2766 * layout.cc (gdb_sections): Add .debug_types.
2767 (lines_only_debug_sections): Likewise.
2768
2769 2010-06-18 Rafael Espindola <espindola@google.com>
2770
2771 * plugin.cc (add_input_file,add_input_library)
2772 (Plugin_manager::add_input_file): Make filename arguments const.
2773 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2774 const.
2775
2776 2010-06-16 Doug Kwan <dougkwan@google.com>
2777
2778 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2779 .ARM.attributes section if we have not merged any input
2780 attributes sections.
2781
2782 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2783
2784 * arm.cc: Allow combining objects with no EABI version
2785 information.
2786
2787 2010-06-15 Rafael Espindola <espindola@google.com>
2788
2789 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2790
2791 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2792
2793 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2794 (struct iovec): Correct !HAVE_READV definition.
2795
2796 2010-06-10 Cary Coutant <ccoutant@google.com>
2797
2798 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2799 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2800 reloc sections.
2801 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2802
2803 PR 11683
2804 * symtab.h (Symbol::is_placeholder): New member function.
2805 * target-reloc.h (relocate_section): Check for placeholder symbols.
2806
2807 * testsuite/Makefile.am (plugin_test_8): New test.
2808 (plugin_test_9): New test.
2809 * testsuite/Makefile.in: Regenerate.
2810
2811 2010-06-09 Nick Clifton <nickc@redhat.com>
2812
2813 * yyscript.y (input_list_element): Allow strings prefixed with
2814 the '-' character. Treat these as libraries.
2815 * script.cc (script_add_library): New function. Adds a library
2816 specified by "-l<name>" found in an input script.
2817 * script-c.h: Add prototype for script_add_library.
2818
2819 2010-06-07 Doug Kwan <dougkwan@google.com>
2820
2821 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2822 Restrict stub-group size to be within long conditional branch
2823 range when working around cortex-A8 erratum.
2824
2825 2010-06-07 Damien Diederen <dd@crosstwine.com>
2826
2827 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2828 #ifdef typo.
2829
2830 2010-06-03 Sriraman Tallam <tmsriram@google.com>
2831
2832 PR gold/11658
2833 * output.cc
2834 (Output_section::Input_section_sort_entry::compare_section_ordering):
2835 Change to return non-zero correctly.
2836 (Output_section::Input_section_sort_section_order_index_compare
2837 ::operator()): Change to fix ambiguity in comparisons.
2838
2839 2010-06-01 Sriraman Tallam <tmsriram@google.com>
2840
2841 * gold.h (is_wildcard_string): New function.
2842 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2843 (Layout::layout_eh_frame): Ditto.
2844 (Layout::find_section_order_index): New method.
2845 (Layout::read_layout_from_file): New method.
2846 * layout.h (Layout::find_section_order_index): New method.
2847 (Layout::read_layout_from_file): New method.
2848 (Layout::input_section_position_): New private member.
2849 (Layout::input_section_glob_): New private member.
2850 * main.cc (main): Call read_layout_from_file here.
2851 * options.h (--section-ordering-file): New option.
2852 * output.cc (Output_section::input_section_order_specified_): New
2853 member.
2854 (Output_section::Output_section): Initialize new member.
2855 (Output_section::add_input_section): Add new parameter.
2856 Keep input sections when --section-ordering-file is used.
2857 (Output_section::set_final_data_size): Sort input sections when
2858 section ordering file is specified.
2859 (Output_section::Input_section_sort_entry): Add new parameter.
2860 Check sorting type.
2861 (Output_section::Input_section_sort_entry::compare_section_ordering):
2862 New method.
2863 (Output_section::Input_section_sort_compare::operator()): Change to
2864 consider section_order_index.
2865 (Output_section::Input_section_sort_init_fini_compare::operator()):
2866 Change to consider section_order_index.
2867 (Output_section::Input_section_sort_section_order_index_compare
2868 ::operator()): New method.
2869 (Output_section::sort_attached_input_sections): Change to sort
2870 according to section order when specified.
2871 (Output_section::add_input_section<32, true>): Add new parameter.
2872 (Output_section::add_input_section<64, true>): Add new parameter.
2873 (Output_section::add_input_section<32, false>): Add new parameter.
2874 (Output_section::add_input_section<64, false>): Add new parameter.
2875 * output.h (Output_section::add_input_section): Add new parameter.
2876 (Output_section::input_section_order_specified): New
2877 method.
2878 (Output_section::set_input_section_order_specified): New method.
2879 (Input_section::Input_section): Initialize section_order_index_.
2880 (Input_section::section_order_index): New method.
2881 (Input_section::set_section_order_index): New method.
2882 (Input_section::section_order_index_): New member.
2883 (Input_section::Input_section_sort_section_order_index_compare): New
2884 struct.
2885 (Output_section::input_section_order_specified_): New member.
2886 * script-sections.cc (is_wildcard_string): Delete and move modified
2887 method to gold.h.
2888 (Output_section_element_input::Output_section_element_input): Modify
2889 call to is_wildcard_string.
2890 (Output_section_element_input::Input_section_pattern
2891 ::Input_section_pattern): Ditto.
2892 (Output_section_element_input::Output_section_element_input): Ditto.
2893 * testsuite/Makefile.am (final_layout): New test case.
2894 * testsuite/Makefile.in: Regenerate.
2895 * testsuite/final_layout.cc: New file.
2896 * testsuite/final_layout.sh: New file.
2897
2898 2010-06-01 Rafael Espindola <espindola@google.com>
2899
2900 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2901
2902 2010-06-01 Rafael Espindola <espindola@google.com>
2903
2904 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2905 visibility of symbols.
2906
2907 2010-05-27 Doug Kwan <dougkwan@google.com>
2908
2909 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2910 from start of output section instead of address for a local symbol
2911 in a merged or relaxed section when doing a relocatable link.
2912
2913 2010-05-26 Rafael Espindola <espindola@google.com>
2914
2915 PR 11604
2916 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2917 adding sections the garbage collector removed.
2918 * gold/testsuite/Makefile.am: Add test.
2919 * gold/testsuite/Makefile.in: Regenerate.
2920 * gold/testsuite/plugin_test_7.sh: New.
2921 * gold/testsuite/plugin_test_7_1.c: New.
2922 * gold/testsuite/plugin_test_7_2.c: New.
2923
2924 2010-05-26 Rafael Espindola <espindola@google.com>
2925
2926 * script-sections.cc (Output_section_definition::set_section_addresses):
2927 Check for --section-start.
2928
2929 2010-05-26 Doug Kwan <dougkwan@google.com>
2930
2931 * arm.cc (Arm_scan_relocatable_relocs): New class.
2932 (Target_arm::relocate_special_relocatable): New method.
2933 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2934 (Arm_relocate_functions::thumb_branch_common): Same.
2935 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2936 instead of Default_scan_relocatable_relocs.
2937 * target-reloc.h (relocate_for_relocatable): Let target handle
2938 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2939 * target.h (Sized_target::relocate_special_relocatable): New method.
2940
2941 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2942
2943 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2944
2945 2010-05-23 Doug Kwan <dougkwan@google.com>
2946
2947 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2948 instead of a cast.
2949 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2950 with a direct branch, not a conditional branch, to a stub.
2951 * merge.cc (Output_merge_base::record_input_section): New method
2952 defintion.
2953 (Output_merge_data::do_add_input_section): Record input section if
2954 keeps-input-sections flag is set.
2955 (Output_merge_string::do_add_input_section): Ditto.
2956 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2957 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2958 INPUT_SECTIONS_.
2959 (Output_merge_base::keeps_input_sections,
2960 Output_merge_base::set_keeps_input_sections,
2961 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2962 method definitions.
2963 (Output_merge_base::Input_sections): New type declaration.
2964 (Output_merge_base::input_sections_begin,
2965 Output_merge_base::input_sections_end,
2966 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2967 (Output_merge_base::bool keeps_input_sections_,
2968 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2969 Output_merge_base::input_sections_): New data members.
2970 (Output_merge_data::do_set_keeps_input_sections): New method
2971 defintion.
2972 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2973 * output.cc (Output_section::Input_section::relobj): Move method
2974 defintion from class declaration to here and handle merge sections.
2975 (Output_section::Input_section::shndx): Ditto.
2976 (Output_section::Output_section): Remove initializations of removed
2977 data members and initialize new data member LOOKUP_MAPS_.
2978 (Output_section::add_input_section): Set keeps-input-sections flag
2979 for a newly created merge output section as appropriate. Adjust code
2980 to use Output_section_lookup_maps class.
2981 (Output_section::add_relaxed_input_section): Adjst code for lookup
2982 maps code refactoring.
2983 (Output_section::add_merge_input_section): Add a new parameter
2984 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2985 class. If adding input section to a newly created merge output
2986 section fails, remove the new merge section.
2987 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2988 Adjust code for use of the Output_section_lookup_maps class.
2989 (Output_section::find_merge_section): Ditto.
2990 (Output_section::build_lookup_maps): New method defintion.
2991 (Output_section::find_relaxed_input_section): Adjust code to use
2992 Output_section_lookup_maps class.
2993 (Output_section::get_input_sections): Export merge sections. Adjust
2994 code to use Output_section_lookup_maps class.
2995 (Output_section:::add_script_input_section): Adjust code to use
2996 Output_section_lookup_maps class. Update lookup maps for merge
2997 sections also.
2998 (Output_section::discard_states): Use Output_section_lookup_maps.
2999 (Output_section::restore_states): Same.
3000 * output.h (Merge_section_properties): Move class defintion out of
3001 Output_section.
3002 (Output_section_lookup_maps): New class.
3003 (Output_section::Input_section::is_merge_section): New method
3004 defintion.
3005 (Output_section::Input_section::relobj): Move defintion out of class
3006 defintion. Declare method only.
3007 (Output_section::Input_section::shndx): Ditto.
3008 (Output_section::Input_section::output_merge_base): New method defintion.
3009 (Output_section::Input_section::u2_.pomb): New union field.
3010 (Output_section::Merge_section_by_properties_map,
3011 Output_section::Output_section_data_by_input_section_map,
3012 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3013 Remove types.
3014 (Output_section::add_merge_input_section): Add new parameter
3015 KEEPS_INPUT_SECTIONS.
3016 (Output_section::build_lookup_maps): New method declaration.
3017 (Output_section::merge_section_map_,
3018 Output_section::merge_section_by_properties_map_,
3019 Output_section::relaxed_input_section_map_,
3020 Output_section::is_relaxed_input_section_map_valid_): Remove data
3021 members.
3022 (Output_section::lookup_maps_): New data member.
3023
3024 2010-05-21 Doug Kwan <dougkwan@google.com>
3025
3026 PR gold/11619
3027 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3028 avoid a compilation error.
3029
3030 2010-05-19 Rafael Espindola <espindola@google.com>
3031
3032 * script-sections.cc (Output_section_definition::allocate_to_segment):
3033 Update the phdrs_list even when the output section is NULL.
3034 * testsuite/Makefile.am: Add test.
3035 * testsuite/Makefile.in: Regenerate.
3036 * testsuite/script_test_9.cc: New.
3037 * testsuite/script_test_9.sh: New.
3038 * testsuite/script_test_9.t: New.
3039
3040 2010-05-19 Doug Kwan <dougkwan@google.com>
3041
3042 * arm.cc (Arm_input_section::original_size): New method.
3043 (Arm_input_section::do_addralign): Add a cast.
3044 (Arm_input_section::do_output_offset): Remove static cast.
3045 (Arm_input_section::original_addralign,
3046 Arm_input_section::original_size_): Change type to uint32_t.
3047 (Arm_input_section::init): Add safe casts for section alignment
3048 and size.
3049 (Arm_input_section::set_final_data_size): Do not set address and
3050 offset of stub table.
3051 (Arm_output_section::fix_exidx_coverage): Change use of of
3052 Output_section::Simple_input_section to that of
3053 Output_section::Input_section.
3054 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3055 except for the first pass.
3056 * output.cc (Output_section::get_input_sections): Change type of
3057 input_sections to std::list<Input_section>.
3058 (Output_section::add_script_input_section): Rename from
3059 Output_section::add_simple_input_section. Change type of SIS
3060 parameter from Simple_input_section to Input_section.
3061 * output.h (Output_section::Simple_input_section): Remove class.
3062 (Output_section::Input_section): Change class visibility to public.
3063 (Output_section::Input_section::addralign): Use stored alignments
3064 for special input sections if set.
3065 (Output_section::Input_section::set_addralign): New method.
3066 (Output_section::get_input_sections): Change parameter type from
3067 list of Simple_input_section to list of Input_section.
3068 (Output_section::add_script_input_section): Rename from
3069 Output_section::add_simple_input_section. Change first parameter's
3070 type from Simple_input_section to Input_section and remove the
3071 second and third parameters.
3072 * script-sections.cc (Input_section::Input_section_list): Change
3073 type to list of Output_section::Input_section/
3074 (Input_section_info::Input_section_info): Change parameter type of
3075 INPUT_SECTION to Output_section::Input_section.
3076 (Input_section_info::input_section): Change return type.
3077 (Input_section_info::input_section_): Change type to
3078 Output_section::Input_section.
3079 (Output_section_element_input::set_section_addresses): Adjust code
3080 to use Output_section::Input_section instead of
3081 Output_section::Simple_input_section. Adjust code for renaming
3082 of Output_section::add_simple_input_section.
3083 (Orphan_output_section::set_section_addresses): Ditto.
3084
3085 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3086
3087 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3088 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3089
3090 2010-05-18 Rafael Espindola <espindola@google.com>
3091
3092 * options.cc (General_options::finalize): Handle -nostdlib.
3093 * options.h (nostdlib): New option.
3094 * script.cc (script_add_search_dir): Handle -nostdlib.
3095
3096 2010-05-12 Doug Kwan <dougkwan@google.com>
3097
3098 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3099 attributes section only if there no attributes section after merging.
3100 (Target_arm::merge_object_attributes): Move value of
3101 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3102 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3103 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3104 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3105 and arm_attr_merge_7.stdout.
3106 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3107 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3108 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3109 arm_attr_merge_7b.o): New rules.
3110 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3111 arm_attr_merge_7
3112 * testsuite/Makefile.in: Regenerate.
3113 * testsuite/arm_attr_merge.sh: New file.
3114 * testsuite/arm_attr_merge_[67][ab].s: Same.
3115
3116 2010-05-05 Nick Clifton <nickc@redhat.com>
3117
3118 * po/es.po: Updated Spanish translation.
3119
3120 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3121
3122 * Makefile.am (install-exec-local): Properly install gold as
3123 default cross linker.
3124 * Makefile.in: Regenerated.
3125
3126 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3127 Nick Clifton <nickc@redhat.com>
3128
3129 * configure.ac (install_as_default): Define and set to false
3130 unless --enable-gold or --enable-gold=both/gold has been
3131 specified.
3132 * configure: Regenerate.
3133
3134 * Makefile.am (install-exec-local): Install the executable as
3135 'ld.gold'. If install_as_default is true then also install it as
3136 'ld'.
3137 * Makefile.in: Regenerated.
3138
3139 2010-04-24 Ian Lance Taylor <iant@google.com>
3140
3141 * layout.cc (Layout::layout_reloc): In relocatable link don't
3142 combine reloc sections for grouped sections.
3143
3144 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3145
3146 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3147 sections that are not ordinary to icf.
3148 * icf.cc (get_section_contents): Handle relocation pointing to section
3149 with no object or shndx information.
3150 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3151 * testsuite/Makefile.in: Regenerate.
3152 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3153 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3154
3155 2010-04-22 Ian Lance Taylor <iant@google.com>
3156
3157 * expression.cc (Expression::Expression_eval_info): Add
3158 result_alignment_pointer field.
3159 (Expression::eval_with_dot): Add result_alignment_pointer
3160 parameter. Change all callers.
3161 (Expression::eval_maybe_dot): Likewise.
3162 (class Binary_expression): Add alignment_pointer parameter to
3163 left_value and right_value. Change all callers.
3164 (BINARY_EXPRESSION): Set result alignment.
3165 (class Trinary_expression): Add alignment_pointer parameter to
3166 arg2_value and arg3_value. Change all callers.
3167 (Trinary_cond::value): Set result alignment.
3168 (Max_expression::value, Min_expression::value): Likewise.
3169 (Align_expression::value): Likewise.
3170 * script-sections.cc (class Sections_element): Add dot_alignment
3171 parameter to set_section_addresses virtual function. Update
3172 instantiations.
3173 (class Output_section_element): Likewise.
3174 (Script_sections::create_segments): Add dot_alignment parameter.
3175 Change all callers.
3176 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3177 (Script_sections::set_phdrs_clause_addresses): Likewise.
3178 * script-sections.h: Update declarations.
3179 * script.h: Update declarations.
3180 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3181 min_p_align.
3182 * testsuite/script_test_3.t: Set large alignment.
3183 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3184 segment has expected alignment.
3185
3186 2010-04-22 Nick Clifton <nickc@redhat.com>
3187
3188 * po/gold.pot: Updated by the Translation project.
3189 * po/vi.po: Updated Vietnamese translation.
3190
3191 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3192
3193 * testsuite/Makefile.am (check_PROGRAMS): Add
3194 icf_virtual_function_folding_test.
3195 * testsuite/Makefile.in: Regenerated.
3196
3197 2010-04-15 Andrew Haley <aph@redhat.com>
3198
3199 * options.h (merge_exidx_entries): New option.
3200 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3201 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3202 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3203 (Target_arm::merge_exidx_entries): New function.
3204 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3205 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3206 to Arm_exidx_fixup constructor.
3207 Add new arg, merge_exidx_entries.
3208 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3209 Arm_output_section::fix_exidx_coverage.
3210
3211 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3212
3213 * icf.cc (get_section_contents): Check for preemptible functions.
3214 Ignore addend when appropriate.
3215 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3216 section folded.
3217 (add_from_relobj): Check for section folded.
3218 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3219 * symtab.h (should_add_dynsym_entry): Add new parameter.
3220 * target-reloc.h (scan_relocs): Check for section folded.
3221 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3222 Check reloc types for function pointers in shared objects.
3223 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3224 case.
3225 (icf_preemptible_functions_test): New test case.
3226 (icf_string_merge_test): New test case.
3227 * testsuite.Makefile.in: Regenerate.
3228 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3229 bar_glob. Refactor code.
3230 * testsuite/icf_preemptible_functions_test.cc: New file.
3231 * testsuite/icf_preemptible_functions_test.sh: New file.
3232 * testsuite/icf_string_merge_test.cc: New file.
3233 * testsuite/icf_string_merge_test.sh: New file.
3234 * testsuite/icf_virtual_function_folding_test.cc: New file.
3235 * testsuite/icf_virtual_function_folding_test.sh: New file.
3236
3237 2010-04-14 Doug Kwan <dougkwan@google.com>
3238
3239 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3240 for local symbol recounting if we remove a section due to ICF.
3241 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3242 there are no regular objects in input.
3243
3244 2010-04-13 Doug Kwan <dougkwan@google.com>
3245
3246 * arm.cc (Arm_input_section::set_final_data_size): Compute
3247 accurate final data size instead of using current data size.
3248
3249 2010-04-09 Doug Kwan <dougkwan@google.com>
3250
3251 * layout.cc (Layout::choose_output_section): Handle script section
3252 types.
3253 (Layout::make_output_section_for_script): Add section type parameter.
3254 Handle script section types.
3255 * layout.h (Layout::make_output_section_for_script): Add section
3256 type parameter.
3257 * output.cc (Output_section::Output_section): Initialize data member
3258 is_noload_.
3259 (Output_section::do_reset_address_and_file_offset): Do not set address
3260 to 0 if section is a NOLOAD section.
3261 * output.h (Output_section::is_noload): New method.
3262 (Output_section::set_is_noload): Ditto.
3263 (Output_section::is_noload_): New data member.
3264 * script-c.h (Script_section_type): New enum type.
3265 (struct Parser_output_section_header): Add new file section_type.
3266 * script-sections.cc (Sections_element::output_section_name): Add
3267 parameter for returning script section type.
3268 (Output_section_definition::output_section_name): Ditto.
3269 (Output_section_definition::section_type)P; New method.
3270 (Output_section_definiton::script_section_type_name): Ditto.
3271 (Output_section_definition::script_section_type_): New data member.
3272 (Output_section_definition::Output_section_definition): Initialize
3273 data member Output_section_definition::script_section_type_.
3274 (Output_section_definition::create_sections): Pass script section type
3275 to Layout::make_output_section_for_script.
3276 (Output_section_definition::output_section_name): Return script
3277 section type to caller.
3278 (Output_section_definition::set_section_address): Do not advance
3279 dot value and load address if section type is NOLOAD. Set address
3280 of NOLOAD sections regardless of section flags.
3281 (Output_section_definition::print): Print section type if it is
3282 not SCRIPT_SECTION_TYPE_NONE.
3283 (Output_section_definition::section_type): New method.
3284 (Output_section_definition::script_section_type_name): Ditto.
3285 (Script_sections::output_section_name): Add new parameter
3286 PSECTION_TYPE for returning script section type. Pass it to
3287 section elements. Handle discard sections.
3288 (Sort_output_sections::operator()): Handle NOLOAD sections.
3289 * script-sections.h (Script_sections::Section_type): New enum type.
3290 (Script_sections::output_section_name): Add a new parameter for
3291 returning script section type.
3292 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3293 INFO and NOLOAD.
3294 * yyscript.y (union): Add new field SECTION_TYPE.
3295 (COPY, DSECT, INFO, NOLOAD): New tokens.
3296 (opt_address_and_section_type): Change type to output_section_header.
3297 (section_type): New non-terminal
3298 (section_header): Handle section type.
3299 (opt_address_and_section_type): Return section type value.
3300
3301 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3302
3303 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3304 * testsuite/plugin_common_test_2.c (foo): Likewise.
3305
3306 2010-04-08 Doug Kwan <dougkwan@google.com>
3307
3308 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3309 Output_merge_data.
3310 * output.cc (Output_section::add_merge_input_section): Simplify
3311 code and return status of Output_merge_base::add_input_section.
3312 Update merge section map only if Output_merge_base::add_input_section
3313 returns true.
3314
3315 2010-04-07 Doug Kwan <dougkwan@google.com>
3316
3317 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3318 if section is marked as containing instructions but has no mapping
3319 symbols.
3320 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3321 correct section index.
3322 (Arm_relobj::find_linked_text_section): Ditto.
3323
3324 2010-04-07 Cary Coutant <ccoutant@google.com>
3325
3326 * archive.cc (include_member): Destroy Read_symbols_data object before
3327 releasing file.
3328 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3329 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3330 (Read_symbols_data::~Read_symbols_data) New destructor.
3331 (Section_relocs::Section_relocs) New constructor.
3332 (Section_relocs::~Section_relocs) New destructor.
3333 (Read_relocs_data::Read_relocs_data) New constructor.
3334 (Read_relocs_data::~Read_relocs_data) New destructor.
3335 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3336 pointers to NULL after deleting.
3337
3338 2010-04-07 Doug Kwan <dougkwan@google.com>
3339
3340 * arm.cc: Replace "endianity" with "endianness" in comments.
3341 (Arm_exidx_cantunwind): Ditto.
3342 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3343 (Arm_relobj::merge_flags_and_attributes): New method.
3344 (Arm_relobj::merge_flags_and_attributes_): New data member.
3345 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3346 (Arm_relobj::scan_sections_for_stubs): Ditto.
3347 (Arm_relobj::do_read_symbols): Check to see if we really want to
3348 merge processor-specific flags and attributes. Exit early if
3349 an object is empty except for section names and the undefined symbol.
3350 (Target_arm::do_finalize_sections): Move check for ELF format to
3351 Arm_relobj::do_read_symbols. Merge processor specific flags and
3352 attributes from a regular object only when we have determined that
3353 it is aapropriate. Do not create an .ARM.attributes section in
3354 output if there is no regular input object.
3355 (Target_arm::merge_processor_specific_flags): Check
3356 --warn-mismatch before printing any error.
3357 (Target_arm::merge_object_attributes): Ditto.
3358 * gold.cc (queue_middle_tasks): Handle the case in which there is
3359 no regular object in input.
3360 * options.cc (General_options::parse_EB): New method.
3361 (General_options::parse_EL): Same.
3362 (General_options::General_options): Initialize endianness_.
3363 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3364 New options.
3365 (General_options::Endianness): New enum.
3366 (General_options::endianness): New method.
3367 (General_options::endianness_): New data member.
3368 * parameters.cc (Parameters::set_options): Check target endianness.
3369 (Parameters::set_target_once): Ditto.
3370 (Parameters::check_target_endianness): New method.
3371 (parameters_force_valid_target): If either -EL or -EB is specified,
3372 use it to define endianness of default target.
3373 * parameters.h (Parameters::check_target_endianness): New method
3374 declaration.
3375 * target.h (class Target): Change "endianity" to "endianness"
3376 in comments.
3377
3378 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3379
3380 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3381 * configure: Regenerate.
3382 * Makefile.in: Regenerate.
3383 * testsuite/Makefile.in: Regenerate.
3384
3385 2010-04-06 Cary Coutant <ccoutant@google.com>
3386
3387 gcc PR lto/42757
3388 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3389 prevailing definitions of common symbols.
3390 * testsuite/plugin_test_6.sh: New test case.
3391 * testsuite/plugin_common_test_1.c: New test case.
3392 * testsuite/plugin_common_test_2.c: New test case.
3393 * testsuite/Makefile.am (plugin_test_6): New test case.
3394 * testsuite/Makefile.in: Regenerate.
3395
3396 2010-04-06 Nick Clifton <nickc@redhat.com>
3397
3398 * po/vi.po: New Vietnamese translation.
3399
3400 2010-03-30 Doug Kwan <dougkwan@google.com>
3401
3402 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3403
3404 2010-03-25 Doug Kwan <dougkwan@google.com>
3405
3406 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3407 to avoid a conversion warning on a 32-bit host.
3408
3409 2010-03-24 Ian Lance Taylor <iant@google.com>
3410
3411 * testsuite/script_test_3.t: Add a TLS segment.
3412 * testsuite/Makefile.am (check_PROGRAMS): Add
3413 tls_phdrs_script_test.
3414 (tls_phdrs_script_test_SOURCES): Define.
3415 (tls_phdrs_script_test_DEPENDENCIES): Define.
3416 (tls_phdrs_script_test_LDFLAGS): Define.
3417 (tls_phdrs_script_test_LDADD): Define.
3418 * testsuite/Makefile.in: Rebuild.
3419
3420 2010-03-23 Cary Coutant <ccoutant@google.com>
3421
3422 * fileread.cc (find_or_make_view): Fix comment.
3423
3424 2010-03-23 Ian Lance Taylor <iant@google.com>
3425
3426 * script-sections.cc (class Orphan_section_placement): Define
3427 PLACE_TLS and PLACE_TLS_BSS.
3428 (Orphan_section_placement::Orphan_section_placement): Initialize
3429 new places.
3430 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3431 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3432 (tls_script_test_SOURCES): Define.
3433 (tls_script_test_DEPENDENCIES): Define.
3434 (tls_script_test_LDFLAGS): Define.
3435 (tls_script_test_LDADD): Define.
3436 * testsuite/Makefile.in: Rebuild.
3437
3438 2010-03-22 Doug Kwan <dougkwan@google.com>
3439
3440 * arm.cc (Arm_relocate_functions::abs8,
3441 Arm_relocate_functions::abs16): Use correct check for overflow
3442 specified in the ARM ELF specs.
3443 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3444 target of a BLX instruction specially.
3445 (Reloc_stub::stub_type_for_reloc): Ditto.
3446 (Relocate::relocate): Use symbolic names instead of numeric relocation
3447 codes to report error.
3448 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3449 workaround.
3450 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3451 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3452 thumb2_blx_out_of_range.stdout
3453 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3454 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3455 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3456 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3457 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3458 thumb2_blx_in_range, thumb2_blx_in_range.o,
3459 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3460 thumb2_blx_out_of_range.o): New rules.
3461 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3462 thumb2_blx_in_range and thumb2_blx_out_of_range.
3463 * testsuite/Makefile.in: Regenerate.
3464 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3465 * testsuite/thumb_blx_in_range.s: New file.
3466 * testsuite/thumb_blx_out_of_range.s: New file.
3467
3468 2010-03-22 Rafael Espindola <espindola@google.com>
3469
3470 * archive.cc (Should_include): Move to archive.h.
3471 (should_include_member): Make it a member of Archive.
3472 (Lib_group): New.
3473 (Add_lib_group_symbols): New.
3474 * archive.h: Include options.h.
3475 (Archive_member): Moved from Archive.
3476 (Should_include): Moved from archive.cc.
3477 (Lib_group): New.
3478 (Add_lib_group_symbols): New.
3479 * dynobj.cc (do_should_include_member): New.
3480 * dynobj.h (do_should_include_member): New.
3481 * gold.cc (queue_initial_tasks): Update call to queue.
3482 * main.cc (main): Print lib group stats.
3483 * object.cc (do_should_include_member): New.
3484 * object.h: Include archive.h.
3485 (Object::should_include_member): New.
3486 (Object::do_should_include_member): New.
3487 (Sized_relobj::do_should_include_member): New.
3488 * options.cc (General_options::parse_start_lib): New.
3489 (General_options::parse_end_lib): New.
3490 (Input_arguments::add_file): Handle lib groups.
3491 (Input_arguments::start_group): Check we are not in a lib.
3492 (Input_arguments::start_lib): New.
3493 (Input_arguments::end_lib): New.
3494 * options.h (General_options): Add start_lib and end_lib.
3495 (Input_argument::lib_): New.
3496 (Input_argument::lib): New.
3497 (Input_argument::is_lib): New.
3498 (Input_file_lib): New.
3499 (Input_arguments::in_lib_): New.
3500 (Input_arguments::in_lib): New.
3501 (Input_arguments::start_lib): New.
3502 (Input_arguments::end_lib_): New.
3503 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3504 in unused members as preempted.
3505 (Sized_pluginobj::do_should_include_member): New.
3506 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3507 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3508 return the blocker.
3509 (Read_symbols::do_whole_lib_group): New.
3510 (Read_symbols::do_lib_group): New.
3511 (Read_symbols::do_read_symbols): Handle lib groups.
3512 (Read_symbols::get_name): Handle lib groups.
3513 * readsyms.h (Read_symbols): Add an archive member pointer.
3514 (Read_symbols::do_whole_lib_group): New.
3515 (Read_symbols::do_lib_group): New.
3516 (Read_symbols::member_): New.
3517 * script.cc (read_input_script): Update call to queue_soon.
3518
3519 2010-03-19 Doug Kwan <dougkwan@google.com>
3520
3521 * arm.cc (Stub_table::Stub_table): Initialize new data members
3522 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3523 (Stub_table::add_reloc_stub): Assign stub offset and update
3524 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3525 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3526 New data members.
3527 (Stub_table::update_data_size_and_addralign): Use
3528 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3529 instead of going over all reloc stubs.
3530 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3531 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3532 Stringpool_template::offset_ to size of Stringpool_char.
3533 (Stringpool_template::new_key_offset): Remove code to initialize
3534 Stringpool_template::offset_.
3535 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3536 Stringpool_template::offset_ to zero.
3537
3538 2010-03-15 Doug Kwan <dougkwan@google.com>
3539
3540 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3541 offset_.
3542 (Stringpool_template::new_key_offset): New method.
3543 (Stringpool_template::add_string): Assign offsets when adding new
3544 strings.
3545 (Stringpool_template::set_string_offsets): Do not set string offsets
3546 when not optimizing.
3547 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3548 member size_.
3549 (Chunked_vector::clear): Clear size_.
3550 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3551 (Chunked_vector::size): Return size_.
3552 (Chunked_vector::push_back): Use size_ to find insert position.
3553 (Chunked_vector::size_): New data member.
3554 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3555 (Stringpool_template::new_key_offset): New method declaration.
3556 (Stringpool_template::offset_): New data member.
3557
3558 2010-03-15 Rafael Espindola <espindola@google.com>
3559
3560 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3561 Add_symbols' constructor.
3562 * readsyms.h (Add_symbols): Remove the input_group member.
3563
3564 2010-03-10 Ian Lance Taylor <iant@google.com>
3565
3566 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3567 target to ask whether a reference to a symbol requires a stack
3568 split.
3569 * target.h (Target::is_call_to_non_split): New function.
3570 (Target::do_is_call_to_non_split): Declare virtual function.
3571 * target.cc: Include "symtab.h".
3572 (Target::do_is_call_to_non_split): New function.
3573 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3574
3575 2010-03-10 Cary Coutant <ccoutant@google.com>
3576
3577 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3578 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3579 (File_read::open[2]): Add whole_file_view_ to list of views.
3580 (File_read::make_view): Remove test of whole_file_view_.
3581 (File_read::find_or_make_view): Create whole_file_view_ if
3582 necessary.
3583 (File_read::clear_views): Replace bool parameter with enum;
3584 adjust all callers. Don't delete views with permanent data;
3585 do delete cached views and views from archives if
3586 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3587 if clearing the corresponding view.
3588 * fileread.h (File_read::Clear_views_mode): New enum.
3589 (File_read::View::is_permanent_view): New method.
3590 (File_read::clear_views): Replace bool parameter
3591 with enum; adjust all callers.
3592 * options.h (General_options): Change keep_files_mapped option;
3593 add map_whole_files.
3594 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3595 releasing the file.
3596 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3597 the file.
3598
3599 2010-03-10 David S. Miller <davem@davemloft.net>
3600
3601 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3602
3603 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3604
3605 * icf.cc (get_section_contents): Add '@' marker after processing the
3606 merge reloc.
3607
3608 2010-03-08 Doug Kwan <dougkwan@google.com>
3609
3610 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3611 due to a conversion warning.
3612 (Arm_relobj::update_output_local_symbol_count): Check for local
3613 symbol with unset output index.
3614
3615 2010-03-05 Ian Lance Taylor <iant@google.com>
3616
3617 * options.h (class General_options): Add --spare-dynamic-tags.
3618 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3619 --spare-dynamic-tags.
3620
3621 2010-03-05 Ian Lance Taylor <iant@google.com>
3622
3623 * incremental.cc: Include "libiberty.h".
3624
3625 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3626
3627 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3628 function, is_info_ member.
3629 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3630 (Versions::Versions): Update caller.
3631 (Versions::define_base_version): Likewise.
3632 (Versions::add_def): Likewise.
3633
3634 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3635
3636 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3637 (Scan::possible_function_pointer_reloc): New function.
3638 (Scan::local_reloc_may_be_function_pointer): Change to call
3639 possible_function_pointer_reloc.
3640 (Scan::global_reloc_may_be_function_pointer): Ditto.
3641 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3642 relocations in ".data.rel.ro._ZTV" section.
3643 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3644 * testsuite/icf_safe_so_test.cc: Ditto.
3645 * testsuite/icf_safe_test.cc: Ditto.
3646 * testsuite/icf_safe_test.sh: Ditto.
3647
3648 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3649 Ian Lance Taylor <iant@google.com>
3650
3651 * target-reloc.h (relocate_section): Check the symbol table index
3652 for -1U before setting the local symbol index.
3653 (scan_relocatable_relocs): If copying the relocation, record that
3654 the local symbol is required.
3655 * object.h (Symbol_value::is_output_symtab_index_set): New
3656 function.
3657 (Symbol_value::may_be_discarded_from_output_symtab): New
3658 function.
3659 (Symbol_value::has_output_symtab_entry): New function.
3660 (Symbol_value::needs_output_symtab_entry): Remove.
3661 (Symbol_value::output_symtab_index): Make sure the symbol index is
3662 set.
3663 (Symbol_value::set_output_symtab_index): Make sure the symbol
3664 index is not set. Make sure the new index is valid.
3665 (Symbol_value::set_must_have_output_symtab_entry): New function.
3666 (Symbol_value::has_output_dynsym_entry): New function.
3667 (Symbol_value::set_output_dynsym_index): Make sure the new index
3668 is valid.
3669 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3670 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3671 local symbol if permitted.
3672 (Sized_relobj::do_finalize_local_symbols): Call
3673 is_output_symtab_index_set rather than needs_output_symtab_entry.
3674 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3675 rather than needs_output_symtab_entry. Call
3676 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3677 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3678 is_output_symtab_index_set rather than needs_output_symtab_entry.
3679 * testsuite/discard_locals_relocatable_test.c: New file.
3680 * testsuite/discard_locals_test.sh: Test -r.
3681 * testsuite/Makefile.am (check_DATA): Add
3682 discard_locals_relocatable_test1.syms,
3683 discard_local_relocatable_test2.syms.
3684 (MOSTLYCLEANFILES): Likewise. Also add
3685 discard_locals_relocatable_test1.lout and
3686 discard_locals_relocatable_test2.out.
3687 (discard_locals_relocatable_test1.syms): New target.
3688 (discard_locals_relocatable_test.o): New target.
3689 (discard_locals_relocatable_test1.out): New target.
3690 (discard_locals_relocatable_test2.syms): New target.
3691 (discard_locals_relocatable_test2.out): New target.
3692 (various): Add missing ../ld-new dependencies.
3693 * testsuite/Makefile.in: Rebuild.
3694
3695 2010-03-03 Nick Clifton <nickc@redhat.com>
3696
3697 * po/fi.po: New Finnish translation.
3698
3699 2010-03-01 Doug Kwan <dougkwan@google.com>
3700
3701 * layout.cc (Layout::Layout): Force section types of .init_array*,
3702 .preinit_array* and .fini_array* sections.
3703 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3704 Fix check of return value of std::string::find.().
3705 (Output_section::Input_section_sort_compare::operator()): Remove
3706 comment about .init_array.
3707 (Output_section::Input_section_sort_init_fini_compare::operator()):
3708 New method.
3709 (Output_section::sort_attached_input_sections): Handle .init_array
3710 and .fini_array specially.
3711 * output.h (Output_section::Inut_section_sort_compare): Update
3712 comment.
3713 (Output_section::Input_section_sort_init_fini_compare): New struct.
3714
3715 2010-02-26 Doug Kwan <dougkwan@google.com>
3716
3717 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3718 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3719 * testsuite/debug_msg.sh: Avoid matching source line number for
3720 use of global variable undef_int.
3721
3722 2010-02-26 Doug Kwan <dougkwan@google.com>
3723
3724 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3725 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3726 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3727 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3728 * options.cc (General_options::General_options): Initialize member
3729 fix_v4bx_.
3730 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3731 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3732 and rm_no_fix_v4bx.stdout
3733 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3734 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3735 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3736 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3737 and arm_no_fix_v4bx.
3738 * Makefile.in: Regenerate.
3739 * testsuite/arm_fix_v4bx.s: New file.
3740 * testsuite/arm_fix_v4bx.sh: Ditto.
3741
3742 2010-02-24 Doug Kwan <dougkwan@google.com>
3743
3744 * arm.cc (Target_arm::got_section): Make the .got section the first
3745 non RELRO section in the data segment.
3746 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3747 suffixes of section names.
3748
3749 2010-02-24 Doug Kwan <dougkwan@google.com>
3750
3751 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3752 flags and attributes merging if an input file is a binary file.
3753 * fileread.cc (Input_file::open): Record format of original file.
3754 * fileread.h (Input_file::Format): New enum type.
3755 (Input_file::Input_file): Initialize data member format_.
3756 (Input_file::format): New method definition.
3757 (Input_file::format_):: New data member.
3758
3759 2010-02-24 Doug Kwan <dougkwan@google.com>
3760
3761 * arm.cc (Arm_output_data_got): New class.
3762 (ARM_TCB_SIZE): New constant
3763 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3764 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3765 If user uses a script with a SECTIONS clause, issue only a warning
3766 for a misplaced EXIDX input section. Otherwise, issue an error.
3767 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3768 garbage collection.
3769 (Target_arm::got_mode_index_entry): Handle static linking.
3770 (Target_arm::Scan::local): Ditto.
3771 (Target_arm::Scan::global): Ditto.
3772 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3773 all incorrectly implemented relocations.
3774 (Target_arm::fix_exidx_coverage): Pass layout to
3775 Arm_output_section::fix_exidx_coverage.
3776 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3777 from ".ARM.exidx." and ".ARM.extab.".
3778
3779 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3780
3781 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3782 section if it does not already exist.
3783 * attributes.cc (Attributes_section_data::Attributes_section_data):
3784 Don't crash if size is zero.
3785
3786 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3787 Ian Lance Taylor <iant@google.com>
3788
3789 * gold.cc (queue_middle_tasks): If no input files were opened,
3790 exit.
3791 * workqueue.h (Task_function::Task_function): Assert that there is
3792 a blocker.
3793
3794 2010-02-22 Doug Kwan <dougkwan@google.com>
3795
3796 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3797 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3798 types to avoid warnings due to different uint64_t implementations
3799 on different hosts.
3800
3801 2010-02-21 Doug Kwan <dougkwan@google.com>
3802
3803 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3804 handling of the maximum backward branch offset.
3805 (Arm_relocate_functions::thumb_branch_common): Ditto.
3806 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3807 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3808 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3809 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3810 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3811 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3812 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3813 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3814 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3815 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3816 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3817 thumb2_bl_out_of_range.o): New rules.
3818 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3819 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3820 thumb2_bl_out_of_range
3821 * testsuite/Makefile.in: Regenerate.
3822 * testsuite/arm_bl_in_range.s: New file.
3823 * testsuite/arm_bl_out_of_range.s: Ditto.
3824 * testsuite/arm_branch_in_range.sh: Ditto.
3825 * testsuite/arm_branch_range.t: Ditto.
3826 * testsuite/thumb2_branch_range.t: Ditto.
3827 * testsuite/thumb_bl_in_range.s: Ditto.
3828 * testsuite/thumb_bl_out_of_range.s: Ditto.
3829 * testsuite/thumb_branch_range.t: Ditto.
3830
3831 2010-02-20 Sriraman Tallam <tmsriram@google.com>
3832
3833 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3834 Add reloc offset information.
3835 * icf.cc (get_section_contents): Change iterators to point to the new
3836 vectors. Add reloc offset information to the contents.
3837 * icf.h (Icf::Sections_reachable_info): New typedef.
3838 (Icf::Sections_reachable_list): New typedef.
3839 (Icf::Offset_info): New typedef.
3840 (Icf::Reloc_info): New struct typedef.
3841 (Icf::Reloc_info_list): New typedef.
3842 (Icf::symbol_reloc_list): Delete method.
3843 (Icf::addend_reloc_list): Delete method.
3844 (Icf::section_reloc_list): Delete method.
3845 (Icf::reloc_info_list): New method.
3846 (Icf::reloc_info_list_): New member.
3847
3848 2010-02-19 Doug Kwan <dougkwan@google.com>
3849
3850 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3851 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3852 * arm.cc (Arm_relocation_functions): New forward declaration.
3853 (Target_arm::Target_arm): Initialize new data members
3854 got_mod_index_offset_ and tls_base_symbol_defined_.
3855 (Target_arm::Relocate::relocate_tls): New method.
3856 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3857 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3858 New methods.
3859 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3860 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3861 (Target_arm::got_mod_index_offset_,
3862 Target_arm::tls_base_symbol_defined_): New data members.
3863 (Target_arm::Scan::local, Target::Scan::global,
3864 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3865 relocations.
3866
3867 2010-02-18 Doug Kwan <dougkwan@google.com>
3868
3869 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3870 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3871 text section as a parameter becuase some broken tools may not set
3872 the link in section header.
3873 (Target_arm::has_got_section): New method.
3874 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3875 without any mapping symbol as data only. Remove warning.
3876 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3877 link in its section header, try to discover the link by inspecting the
3878 REL31 relocation at the beginning of the section.
3879 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3880 in error message.
3881 (Target_arm::Scan::global): Treat any reference to the symbol
3882 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3883
3884 2010-02-12 Sriraman Tallam <tmsriram@google.com>
3885
3886 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3887 (Scan::global_reloc_may_be_function_pointer): New function.
3888 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3889 (Scan::global_reloc_may_be_function_pointer): New function.
3890 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3891 (Scan::global_reloc_may_be_function_pointer): New function.
3892 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3893 (Scan::global_reloc_may_be_function_pointer): New function.
3894 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3895 (Scan::global_reloc_may_be_function_pointer): New function.
3896 (Scan::possible_function_pointer_reloc): New function.
3897 (Target_x86_64::can_check_for_function_pointers): New function.
3898 * gc.h (gc_process_relocs): Scan relocation types to determine if
3899 function pointers were taken for targets that support it.
3900 * icf.cc (Icf::find_identical_sections): Include functions for
3901 folding in safe ICF whose pointer is not taken.
3902 * icf.h (Secn_fptr_taken_set): New typedef.
3903 (fptr_section_id_): New member.
3904 (section_has_function_pointers): New function.
3905 (set_section_has_function_pointers): New function.
3906 (check_section_for_function_pointers): New function.
3907 * options.h: Fix comment for safe ICF option.
3908 * target.h (can_check_for_function_pointers): New function.
3909 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3910 Modify icf_safe_test for X86-64.
3911 * testsuite/Makefile.in: Regenerate.
3912 * testsuite/icf_safe_so_test.cc: New file.
3913 * testsuite/icf_safe_so_test.sh: New file.
3914 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3915 (main): Change to take pointer to function kept_func_3.
3916 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3917 folding is done correctly for X86-64.
3918
3919 2010-02-12 David S. Miller <davem@davemloft.net>
3920
3921 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3922 is_symbolless parameter.
3923 (Output_reloc<SHT_REL>::is_symbolless): New.
3924 (Output_reloc<SHT_REL>::is_symbolless_): New.
3925 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3926 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3927 (Output_reloc<SHT_RELA>::is_symbolless): New.
3928 (Output_data_reloc::add_global): Handle is_symbolless.
3929 (Output_data_reloc::add_global_relative): Likewise.
3930 (Output_data_reloc::add_local): Likewise.
3931 (Output_data_reloc::add_local_relative): Likewise.
3932 (Output_data_reloc::add_symbolless_global_addend): New.
3933 (Output_data_reloc::add_symbolless_local_addend): New.
3934 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3935 is_symbolless.
3936 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3937 instead of ->is_relative_
3938 (Output_reloc::write): Likewise.
3939 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3940 (Output_reloc::write_rel): Simplify.
3941
3942 * sparc.cc (Target_sparc::Scan::local): Use
3943 ->add_symbolless_local_addend as needed.
3944 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3945 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3946 based upon relocation offset.
3947
3948 2010-02-11 Doug Kwan <dougkwan@google.com>
3949
3950 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3951 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3952 beginning of function.
3953 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3954 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3955 parameter is_32bit in calls to should_apply_static_reloc.
3956 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3957 (check_DATA): Add arm_abs_global.stdout.
3958 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3959 arm_abs_global.stdout): New rules.
3960 (MOSTLLYCLEANFILES): Add arm_abs_global
3961 * Makefile.in: Regenerate.
3962 * testsuite/arm_abs_global.s: New file.
3963 * testsuite/arm_abs_global.sh: Ditto.
3964 * testsuite/arm_abs_lib.s: Ditto.
3965
3966 2010-02-11 Ian Lance Taylor <iant@google.com>
3967
3968 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3969 Read_relocs task.
3970 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3971 Allocate_commons_task first.
3972 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3973 task, rather than symtab_lock_.
3974 (Gc_process_relocs::~Gc_process_relocs): New function.
3975 (Gc_process_relocs::is_runnable): Check this_blocker_.
3976 (Gc_process_relocs::locks): Use next_blocker_ rather than
3977 blocker_.
3978 (Scan_relocs::~Scan_relocs): New function.
3979 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3980 symtab_lock_.
3981 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3982 next_blocker_.
3983 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3984 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3985 constructor accordingly.
3986 (class Gc_process_relocs): Likewise.
3987 (class Scan_relocs): Likewise.
3988 * common.h (class Allocate_commons_task): Remove symtab_lock_
3989 field, and corresponding constructor parameter.
3990 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3991 symtab_lock_.
3992 (Allocate_commons_task::locks): Likewise.
3993
3994 2010-02-11 Ian Lance Taylor <iant@google.com>
3995
3996 * gold-threads.h (class Once): Define.
3997 (class Initialize_lock): Rewrite as child of Once.
3998 * gold-threads.cc (class Once_initialize): Define.
3999 (once_pointer_control): New static variable.
4000 (once_pointer, once_arg): New static variables.
4001 (c_run_once): New static function.
4002 (Once::Once, Once::run_once, Once::internal_run): New functions.
4003 (class Initialize_lock_once): Remove.
4004 (initialize_lock_control): Remove.
4005 (initialize_lock_pointer): Remove.
4006 (initialize_lock_once): Remove.
4007 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4008 (Initialize_lock::initialize): Rewrite.
4009 (Initialize_lock::do_run_once): New function.
4010 * archive.cc (Archive::interpret_header): Only clear name if it is
4011 not already empty.
4012 * fileread.cc: Include "gold-threads.h"
4013 (file_counts_lock): New static variable.
4014 (file_counts_initialize_lock): Likewise.
4015 (File_read::release): Only increment counts when using --stats.
4016 Use a lock around the increment.
4017 * parameters.cc (class Set_parameters_target_once): Define.
4018 (set_parameters_target_once): New static variable.
4019 (Parameters::Parameters): Move here from parameters.h.
4020 (Parameters::set_target): Rewrite.
4021 (Parameters::set_target_once): New function.
4022 (Parameters::clear_target): Move here and rewrite.
4023 * parameters.h (class Parameters): Update declarations. Add
4024 set_parameters_target_once_ field.
4025 (Parameters::Parameters): Move to parameters.cc.
4026 (Parameters::clear_target): Likewise.
4027 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4028 task.
4029 (Start_group::~Start_group): New function.
4030 (Start_group::is_runnable): New function.
4031 (Start_group::locks, Start_group::run): New functions.
4032 (Finish_group::run): Change saw_undefined to size_t.
4033 * readsyms.h (class Start_group): Define.
4034 (class Finish_group): Change saw_undefined_ field to size_t.
4035 (Finish_group::Finish_group): Remove saw_undefined and
4036 this_blocker parameters. Change all callers.
4037 (Finish_group::set_saw_undefined): New function.
4038 (Finish_group::set_blocker): New function.
4039 * symtab.h (class Symbol_table): Change saw_undefined to return
4040 size_t. Change saw_undefined_ field to size_t.
4041 * target-select.cc (Set_target_once::do_run_once): New function.
4042 (Target_selector::Target_selector): Initialize set_target_once_
4043 field. Don't initialize lock_ and initialize_lock_ fields.
4044 (Target_selector::instantiate_target): Rewrite.
4045 (Target_selector::set_target): New function.
4046 * target-select.h (class Set_target_once): Define.
4047 (class Target_selector): Update declarations. Make
4048 Set_target_once a friend. Remove lock_ and initialize_lock_
4049 fields. Add set_target_once_ field.
4050
4051 2010-02-10 Ian Lance Taylor <iant@google.com>
4052
4053 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4054 queueing any tasks.
4055 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4056 (queue_middle_tasks): Add all blockers before queueing any tasks.
4057 (queue_final_tasks): Likewise.
4058 * token.h (Task_token::add_blockers): New function.
4059 * object.h (Input_objects::number_of_relobjs): New function.
4060
4061 2010-02-10 Ian Lance Taylor <iant@google.com>
4062
4063 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4064 shared, not if not position independent.
4065 * x86_64.cc (Relocate::relocate_tls): Likewise.
4066 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4067 (tls_pie_pic_test): New target.
4068 * testsuite/Makefile.in: Rebuild.
4069
4070 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4071 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4072 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4073 * testsuite/Makefile.in: Rebuild.
4074
4075 2010-02-09 David S. Miller <davem@davemloft.net>
4076
4077 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4078 R_SPARC_RELATIVE using ->add_local_relative().
4079 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4080
4081 * output.h (Output_data_dynamic::add_section_size): New method
4082 that takes two Output_data objects.
4083 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4084 entry param. Handle it in initializers.
4085 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4086 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4087 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4088 arg.
4089 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4090 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4091 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4092 for dynrel_includes_plt.
4093 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4094 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4095 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4096 before .rela.plt
4097 (Target_sparc::do_finalize_sections): Update to pass true for
4098 dynrel_includes_plt.
4099 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4100 output before .rela.plt
4101 (Target_powerpc::do_finalize_sections): Update to pass true for
4102 dynrel_includes_plt when 32-bit.
4103
4104 2010-02-08 Doug Kwan <dougkwan@google.com>
4105
4106 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4107 method.
4108 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4109 Arm_relobj::scan_section_for_cortex_a8_stubs,
4110 Arm_relobj::do_relocation_section): Instead of calling
4111 Output_section::output_address, use faster
4112 Arm_relobj::simple_input_section_output_address.
4113
4114 2010-02-08 David S. Miller <davem@davemloft.net>
4115
4116 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4117 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4118 relocation helper function.
4119
4120 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4121 just like R_SPARC_GOT{10,13,22}.
4122 (Target_sparc::Scan::local): Likewise.
4123 (Target_sparc::Relocate:relocate): Likewise.
4124
4125 2010-02-06 Ian Lance Taylor <iant@google.com>
4126
4127 * configure.ac: Rewrite targetobjs duplicate removal code to use
4128 only shell constructs.
4129 * configure: Rebuild.
4130
4131 2010-02-05 Doug Kwan <dougkwan@google.com>
4132
4133 PR 11247
4134 * arm.cc (Arm_relobj::section_is_scannable): New method.
4135 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4136 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4137
4138 2010-02-04 Doug Kwan <dougkwan@google.com>
4139
4140 PR 11247
4141 * arm-reloc-property.cc (cstdio): Include.
4142 * configure.ac (targetobjs): Remove duplicates.
4143 * configure: Regenerate.
4144 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4145 big and little endian version for a given address size.
4146
4147 2010-02-03 Doug Kwan <dougkwan@google.com>
4148
4149 * arm-reloc-property.cc
4150 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4151 definition.
4152 * arm-reloc-property.h
4153 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4154 New method definition.
4155 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4156 declaration.
4157 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4158 overflow to N.
4159 (GOT_PREL): Change implemented to Y.
4160 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4161 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4162 (Arm_relocate_functions::movw_abs_nc): Remove method.
4163 (Arm_relocate_functions::movt_abs): Ditto.
4164 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4165 (Arm_relocate_functions::thm_movt_abs): Ditto.
4166 (Arm_relocate_functions::movw_rel_nc): Ditto.
4167 (Arm_relocate_functions::movw_rel): Ditto.
4168 (Arm_relocate_functions::movt_rel): Ditto.
4169 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4170 (Arm_relocate_functions:thm_movw_rel): Ditto.
4171 (Arm_relocate_functions:thm_movt_rel): Ditto.
4172 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4173 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4174 New method definitions.
4175 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4176 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4177 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4178 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4179 (Target_arm::Relocate::relocate): Check for non-static or
4180 unimplemented relocation code and exit early. Change calls to
4181 Target_arm::reloc_uses_thumb_bit and
4182 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4183 instead. Refactor code to handle similar relocations to increase
4184 code sharing. Remove check for unsupported relocation code in switch
4185 statement.
4186 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4187 relocation property table to find out size. Change error message to
4188 print out the name of a relocation code instead of the numeric value.
4189 (Target_arm::scan_reloc_for_stub): Use relocation property table
4190 instead of calling Target_arm::reloc_uses_thumb_bit().
4191
4192 2010-02-02 Doug Kwan <dougkwan@google.com>
4193
4194 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4195 types of relaxed input section.
4196
4197 2010-02-02 Doug Kwan <dougkwan@google.com>
4198
4199 * Makefile.am (HFILES): Add arm-reloc-property.h.
4200 (DEFFILES): New.
4201 (TARGETSOURCES): Add arm-reloc-property.cc
4202 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4203 (libgold_a_SOURCES): $(DEFFILES)
4204 * Makefile.in: Regenerate.
4205 * arm-reloc-property.cc: New file.
4206 * arm-reloc-property.h: New file.
4207 * arm-reloc.def: New file.
4208 * arm.cc: Update comments.
4209 (arm-reloc-property.h): New included header.
4210 (arm_reloc_property_table): New global variable.
4211 (Target_arm::do_select_as_default_target): New method definition.
4212 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4213 arm-reloc-property to targ_extra_obj.
4214 * parameters.cc (set_parameters_target): Call
4215 Target::select_as_default_target().
4216 * target.h (Target::select_as_default_target): New method definition.
4217 (Target::do_select_as_default_target): Same.
4218
4219 2010-02-01 Doug Kwan <dougkwan@google.com>
4220
4221 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4222 first_output_text_section_.
4223 (Arm_exidx_fixup::first_output_text_section): New method definition.
4224 (Arm_exidx_fixup::first_output_text_section_): New data member.
4225 (Arm_exidx_fixup::process_exidx_section): Record the first text
4226 output section seen.
4227 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4228 and entsize in output section header.
4229
4230 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4231
4232 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4233 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4234 (Arm_relocate_functions::thm_alu11): New Method.
4235 (Arm_relocate_functions::thm_pc8): New Method.
4236 (Arm_relocate_functions::thm_pc12): New Method.
4237 (Target_arm::Scan::local): Handle the relocations.
4238 (Target_arm::Scan::global): Likewise.
4239 (Target_arm::Relocate::relocate): Likewise.
4240 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4241
4242 2010-01-29 Doug Kwan <dougkwan@google.com>
4243
4244 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4245 of relocation types as ld.
4246
4247 2010-01-29 Doug Kwan <dougkwan@google.com>
4248
4249 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4250 to public.
4251 (Arm_relocate_functions::thumb_branch_common): Ditto.
4252 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4253 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4254 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4255 Arm_relocate_functions::jump24): Remove.
4256 (Target_arm::Relocate::relocate): Adjust code to call
4257 Arm_relocation_functions::arm_branch_common and
4258 Arm_relocation_functions::thumb_branch_common instead of their removed
4259 wrappers. Merge switch-cases together to reduce source code size.
4260
4261 2010-01-29 Doug Kwan <dougkwan@google.com>
4262
4263 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4264 output_local_symbol_count_needs_update_.
4265 (Arm_relobj::output_local_symbol_count_needs_update,
4266 Arm_relobj::set_output_local_symbol_count_needs_update,
4267 Arm_relobj::update_output_local_symbol_count): New methods.
4268 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4269 member.
4270 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4271 of pointed function as in a R_ARM_PREL31 relocation.
4272 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4273 for output local symbol count updating.
4274 (Target_arm::do_relax): Update output local symbol counts in objects
4275 if necessary.
4276 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4277
4278 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4279
4280 * arm.cc: Added support for the ARM relocations:
4281 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4282 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4283 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4284 movw_prel_nc).
4285 (Arm_relocate_functions::movw_rel): New method.
4286 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4287 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4288 thm_movw_prel_nc).
4289 (Arm_relocate_functions::thm_movw_rel): New method.
4290 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4291 thm_movt_prel).
4292 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4293 relocations.
4294 (Target_arm::Scan::global): Likewise.
4295 (Target_arm::Relocate::relocate): Likewise.
4296 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4297 Likewise.
4298
4299 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4300
4301 * arm.cc: Added support for ARM group relocations.
4302 (Target_arm::reloc_needs_sym_origin): New method.
4303 (Arm_relocate_functions::calc_grp_kn): New method.
4304 (Arm_relocate_functions::calc_grp_residual): New method.
4305 (Arm_relocate_functions::calc_grp_gn): New method.
4306 (Arm_relocate_functions::arm_grp_alu): New Method.
4307 (Arm_relocate_functions::arm_grp_ldr): New Method.
4308 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4309 (Arm_relocate_functions::arm_grp_ldc): New Method.
4310 (Target_arm::Scan::local): Handle the ARM group relocations.
4311 (Target_arm::Scan::global): Likewise.
4312 (Target_arm::Relocate::relocate): Likewise.
4313 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4314 Likewise.
4315
4316 2010-01-26 Doug Kwan <dougkwan@google.com>
4317
4318 * arm.cc (set): Include.
4319 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4320 pointer type.
4321 (Arm_output_section::Text_section_list): New type.
4322 (Arm_output_section::append_text_sections_to_list): New method.
4323 (Arm_output_section::fix_exidx_coverage): Ditto.
4324 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4325 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4326 Relobj::set_section_offset() instead of
4327 Sized_relobj::invalidate_section_offset().
4328 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4329 parameter for section headers. Ignore relocation sections for
4330 unallocated sections and EXIDX sections.
4331 (Target_arm::fix_exidx_coverage): New method.
4332 (Target_arm::output_section_address_less_than): New type.
4333 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4334 linked text section instead of the EXIDX section.
4335 (Arm_output_section::create_stub_group): Add an assertion to check
4336 that this is not an EXIDX output section.
4337 (Arm_output_section::append_text_sections_to_list): New method.
4338 (Arm_output_section::fix_exidx_coverage): Ditto.
4339 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4340 Arm_relobj::section_needs_reloc_stub_scanning.
4341 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4342 first pass.
4343 (Target_arm::fix_exidx_coverage): New method.
4344 * object.h (Relobj::set_output_section): New method.
4345 (Sized_relobj::invalidate_section_offset): Remove method.
4346 (Sized_relobj::do_invalidate_section_offset): Remove method.
4347 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4348
4349 2010-01-25 Doug Kwan <dougkwan@google.com>
4350
4351 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4352 Fix warning due to signed and unsigned comparison on a 32-bit host.
4353
4354 2010-01-22 Doug Kwan <dougkwan@google.com>
4355
4356 * arm.cc (Target_arm::do_relax): Record an output section for section
4357 offset adjustment it contains any stub table that has changed.
4358 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4359 offsets in an output section if necessary.
4360 * output.cc (Output_section::Output_section): Initialize
4361 section_offsets_need_adjustments_.
4362 (Output_section::add_input_section_for_script): Renamed to
4363 Output_section::add_simple_input_section.
4364 (Output_section::save_states): Add a comment.
4365 (Output_section::discard_states): New method defintion.
4366 (Output_section::adjust_section_offsets): Same.
4367 * output.h (Output_section::add_input_section_for_script): Renamed to
4368 Output_section::add_simple_input_section.
4369 (Output_section::discard_states): New method declaration.
4370 (Output_section::adjust_section_offsets): Same.
4371 (Output_section::section_offsets_need_adjustment,
4372 Output_section::set_section_offsets_need_adjustment): New method
4373 definitions.
4374 (Output_section::section_offsets_need_adjustment_): New data member.
4375 * script-sections.cc
4376 (Output_section_element_input::set_section_address): Adjust code for
4377 renaming of Output_section::add_input_section_for_script.
4378 (Orphan_output_section::set_section_address): Same.
4379
4380 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4381
4382 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4383 Fix_v4bx enum values .
4384 * gold/options.h (General_options): New option definitions.
4385 (General_options::fix_v4bx): New method.
4386 (General_options::Fix_v4bx): New enum.
4387 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4388 (General_options::parse_fix_v4bx_interworking): New method.
4389
4390 2010-01-22 Doug Kwan <dougkwan@google.com>
4391
4392 * arm.cc (Arm_exidx_fixup): New class.
4393
4394 2010-01-21 Doug Kwan <dougkwan@google.com>
4395
4396 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4397 classes.
4398 (Arm_exidx_section_offset_map): New type.
4399
4400 2010-01-21 Doug Kwan <dougkwan@google.com>
4401
4402 * arm.cc (Arm_exidx_input_section): New class.
4403 (Arm_relobj::exidx_input_section_by_link,
4404 Arm_relobj::exidx_input_section_by_shndx,
4405 Arm_relobj::make_exidx_input_section): New methods.
4406 (read_arm_attributes_section): Remove.
4407 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4408 information about them.
4409 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4410 to here.
4411
4412 2010-01-20 Doug Kwan <dougkwan@google.com>
4413
4414 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4415 Input_section_specifier to Section_id.
4416 (Target_arm::new_arm_input_section: Adjust code for change of key
4417 type.
4418 (Target_arm::find_arm_input_section): Ditto.
4419 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4420 (Section_id): Remove.
4421 (Garbage_collection::Section_id_hash): Remove.
4422 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4423 (Section_id): Remove.
4424 (Icf::Section_id_hash): Remove.
4425 * object.h (Section_id, Const_section_id, Section_id_hash,
4426 Const_section_id_hash): New type definitions.
4427 * output.cc (Output_section::add_relaxed_input_section): Change to
4428 use Const_section_id instead of Input_section_specifier as key type.
4429 (Output_section::add_merge_input_section): Ditto.
4430 (Output_section::build_relaxation_map): Change to use Section_id
4431 instead of Input_section_specifier as key type.
4432 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4433 Ditto.
4434 (Output_section::convert_input_sections_to_relaxed_sections): Change
4435 to use Const_section_id instead of Input_section_specifier as key type.
4436 (Output_section::find_merge_section): Ditto.
4437 (Output_section::find_relaxed_input_section): Ditto.
4438 * output.h (Input_section_specifier): Remove class.
4439 (Output_section::Output_section_data_by_input_section_map): Change
4440 key type to Const_section_id.
4441 (Output_section::Output_relaxed_input_section_by_input_section_map):
4442 Ditto.
4443 (Output_section::Relaxation_map): Change key type to Section_id.
4444
4445 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4446
4447 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4448 (class Arm_v4bx_stub): New class.
4449 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4450 (Stub_factory::make_arm_v4bx_stub): New method.
4451 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4452 (Stub_table::empty): Handle v4bx stubs.
4453 (Stub_table::add_arm_v4bx_stub): New method.
4454 (Stub_table::find_arm_v4bx_stub): New method.
4455 (Arm_relocate_functions::v4bx): New method.
4456 (Target_arm::fix_v4bx): New method.
4457 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4458 (Stub_table::relocate_stubs): Likewise.
4459 (Stub_table::do_write): Likewise.
4460 (Stub_table::update_data_size_and_addralign): Likewise.
4461 (Stub_table::finalize_stubs): Likewise.
4462 (Target_arm::Scan::local): Likewise.
4463 (Target_arm::Scan::global): Likewise.
4464 (Target_arm::do_finalize_sections): Likewise.
4465 (Target_arm::Relocate::relocate): Likewise.
4466 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4467 Likewise.
4468 (Target_arm::scan_reloc_for_stub): Likewise.
4469 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4470
4471 2010-01-19 Ian Lance Taylor <iant@google.com>
4472
4473 * output.cc (Output_section_headers::do_sized_write): Write large
4474 segment count to sh_info field.
4475 (Output_file_header::do_sized_write): For large segment count,
4476 write PN_XNUM to e_phnum field.
4477
4478 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4479
4480 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4481 (Arm_relocate_functions::thm_jump8): New function.
4482 (Arm_relocate_functions::thm_jump11): New function.
4483 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4484 R_ARM_THM_JUMP11.
4485 (Target_arm::Scan::global): Likewise.
4486 (Target_arm::Relocate::relocate): Likewise.
4487 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4488 Likewise.
4489
4490 2010-01-14 Doug Kwan <dougkwan@google.com>
4491
4492 * arm.cc (map, utility): Include headers.
4493 (Target_arm::apply_cortex_a8_workaround): New method.
4494 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4495 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4496 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4497 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4498 the --[no-]fix-cortex-a8 command line options.
4499 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4500 (Target_arm::relocate_stub): Use addend in instruction template.
4501 * options.h (DEFINE_bool): Set the user-set flag.
4502 (General_options): Add --[no-]-fix-cortex options.
4503 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4504 : Update fast look-up map after conversion.
4505
4506 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4507
4508 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4509 in the first pass of do_layout.
4510
4511 2010-01-13 Doug Kwan <dougkwan@google.com>
4512
4513 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4514 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4515 apparent compiler problem of not folding static constant integral
4516 data members of elfcpp::Elf_sizes<32>.
4517
4518 2010-01-13 Doug Kwan <dougkwan@google.com>
4519
4520 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4521 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4522 Arm_relobj::scan_section_for_cortex_a8_erratum,
4523 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4524 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4525 sections to scan for relocation stubs into a new method
4526 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4527 relocation and Cortex-A8 stub scanning.
4528 (Target_arm::do_relax): Force stubs to be after stubbed sections
4529 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4530 the beginning of a new relaxation pass. Update a comment.
4531 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4532
4533 2010-01-12 Ian Lance Taylor <iant@google.com>
4534
4535 * target-reloc.h (visibility_error): New inline function.
4536 (relocate_section): Call visibility_error.
4537 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4538 (MOSTLYCLEANFILES): Likewise.
4539 (protected_4_pic.o, protected_3.err): New targets.
4540 * testsuite/protected_4.cc: New file.
4541
4542 2010-01-12 Doug Kwan <dougkwan@google.com>
4543
4544 * arm.cc (Cortex_a8_reloc): New class.
4545 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4546 and cortex_a8_relocs_info_.
4547 (Target_arm::fix_cortex_a8): New method definition.
4548 (Target_arm::Cortex_a8_relocs_info): New type.
4549 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4550 New data member declarations.
4551 (Target_arm::scan_reloc_for_stub): Record information about
4552 relocations for THUMB branches that might be exempted from the
4553 Cortex-A8 workaround.
4554 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4555 at the beginning of a relaxation pass.
4556
4557 2010-01-12 Doug Kwan <dougkwan@google.com>
4558
4559 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4560 (Arm_relobj::Mapping_symbol_position,
4561 Arm_reloj::Mapping_symbol_position_less,
4562 Arm_relobj::Mapping_symbols_info): New types.
4563 (Target_arm::is_mapping_symbol_name): New method definition.
4564 (Arm_relobj::do_count_local_symbols): Save information about mapping
4565 symbols.
4566
4567 2010-01-11 Doug Kwan <dougkwan@google.com>
4568
4569 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4570 Arm_relocate_functions::thumb32_branch_upper,
4571 Arm_relocate_functions::thumb32_branch_lower,
4572 Arm_relocate_functions::thumb32_cond_branch_offset,
4573 Arm_relocate_functions::thumb32_cond_branch_upper,
4574 Arm_relocate_functions::thumb32_cond_branch_lower,
4575 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4576 branch offset encoding.
4577 (Arm_relocate_functions::thumb_branch_common): Use new branch
4578 offset encoding methods to avoid code duplication.
4579 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4580 (Stub_addend_reader::operator()): Use new branch encoding method
4581 to avoid code duplication.
4582
4583 2010-01-11 Doug Kwan <dougkwan@google.com>
4584
4585 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4586 (Target_arm::do_finalize_sections): Define special EXIDX section
4587 symbols only if referenced.
4588 * gc.h (Garbage_collection::add_reference): New method.
4589 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4590 code duplication.
4591
4592 2010-01-11 Ian Lance Taylor <iant@google.com>
4593
4594 * script.cc (Version_script_info::build_expression_list_lookup):
4595 Change complaing about duplicate wildcard match from error to
4596 warning.
4597
4598 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4599 of 2009-12-30.
4600 (Version_script_info::Version_script_info): Initialize globs_,
4601 default_version_, default_is_global_, and exact_. Don't
4602 initialize globals_ or locals_.
4603 (Version_script_info::build_lookup_tables): Build local symbols
4604 first.
4605 (Version_script_info::unquote): New function.
4606 (Version_script_info::add_exact_match): New function.
4607 (Version_script_info::build_expression_list_lookup): Remove lookup
4608 parameter. Add is_global parameter. Change all callers. Handle
4609 wildcard pattern specially. Unquote pattern. Call
4610 add_exact_match.
4611 (Version_script_info::get_name_to_match): New function.
4612 (Version_script_info::get_symbol_version): New function.
4613 (Version_script_info::get_symbol_version_helper): Remove.
4614 (Version_script_info::check_unmatched_names): Call unquote.
4615 * script.h (class Version_script_info): Change get_symbol_version
4616 to be non-inline and add is_global parameter; change all callers.
4617 Rewrite symbol_is_local. Update declarations. Define struct
4618 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4619 Remove globals_ and locals_ members. Add exact_, globs_,
4620 default_version_, is_global_.
4621 (Version_script_info::Glob): Remove pattern, add expression and
4622 is_global. Update constructor. Change all callers.
4623 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4624 default version.
4625 (Versions::symbol_section_contents): If a symbol is undefined, or
4626 defined in a dynamic object, set the version index to
4627 VER_NDX_LOCAL.
4628 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4629 symbol_is_local.
4630 (Symbol_table::add_from_pluginobj): Likewise.
4631 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4632
4633 2010-01-11 Doug Kwan <dougkwan@google.com>
4634
4635 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4636 (incremental_dump_LDADD): Add linking option for libintl.
4637 * Makefile.in: Regenerate.
4638
4639 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4640
4641 PR gold/11144
4642 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4643 instead of -Ds.
4644 * testsuite/Makefile.in: Regenerated.
4645
4646 2010-01-10 Doug Kwan <dougkwan@google.com>
4647
4648 * options.h (DEFINE_var): Use parentheses around argument varname__
4649 in macro body to avoid any unintended subsequent substitutions.
4650
4651 2010-01-10 Ian Lance Taylor <iant@google.com>
4652
4653 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4654 candidates before doing symbol resolution.
4655
4656 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4657 ODR candidates if only one is weak.
4658
4659 2010-01-08 Ian Lance Taylor <iant@google.com>
4660
4661 * script.cc (Version_script_info::build_expression_list_lookup):
4662 Don't warn about ambiguous version, just record the ambiguity.
4663 (Version_script_info::get_symbol_version_helper): Give error if
4664 version is ambiguous.
4665
4666 2010-01-08 Doug Kwan <dougkwan@google.com>
4667
4668 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4669 prev_data_size_ and prev_addralign_. Remove initializer for
4670 deleted data member has_been_changed_.
4671 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4672 to determine if the table is empty.
4673 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4674 Remove.
4675 (Stub_table::add_reloc_stub): Define method in class definition
4676 instead of just declaring it there.
4677 (Stub_table::add_cortex_a8_stub): New method definition.
4678 (Stub_table::update_data_size_and_addralign): Ditto.
4679 (Stub_table::finalize_stubs): Ditto.
4680 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4681 (Stub_table::do_addralign_): Return address alignment in the
4682 (Stub_table::do_reset_address_and_file_offset): Define method in
4683 class definition instead of declaring it there. Set current data
4684 size to be the data size of the previous pass.
4685 (Stub_table::set_final_data_size): Use current data size as the
4686 final data size.
4687 (Stub_table::relocate_stub): Change parameter type of stub from
4688 Reloc_stub pointer to Stub pointer.
4689 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4690 (Stub_table::Cortex_a8_stub_list): New typedef.
4691 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4692 Stub_table::prev_addralign_): New data member.
4693 (Arm_relobj::Arm_relobj): Initialize data member
4694 section_has_cortex_a8_workaround_.
4695 (Arm_relobj::section_has_cortex_a8_workaround,
4696 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4697 definitions.
4698 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4699 declarations.
4700 (Target_arm::relocate_stub): Change parameter type of stub from
4701 Reloc_stub pointer to Stub pointer.
4702 (Insn_template::size, Insn_template::alignment): Handle
4703 THUMB16_SPECIAL_TYPE.
4704 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4705 Stub_table::update_data_size_and_addralign,
4706 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4707 definitions.
4708 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4709 (Stub_table::do_write): Ditto.
4710 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4711
4712 2010-01-08 Ian Lance Taylor <iant@google.com>
4713
4714 PR 11108
4715 * symtab.h (class Symbol): Remove fields is_target_special_ and
4716 has_plt_offset_. Add field is_defined_in_discarded_section_.
4717 (Symbol::is_defined_in_discarded_section): New function.
4718 (Symbol::set_is_defined_in_discarded_section): New function.
4719 (Symbol::has_plt_offset): Rewrite.
4720 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4721 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4722 Don't initialize is_target_special_ or has_plt_offset_.
4723 Initialize is_defined_in_discarded_section_.
4724 (Symbol_table::add_from_relobj): If appropriate, set
4725 is_defined_in_discarded_section.
4726 * resolve.cc (Symbol::override_base_with_special): Don't test
4727 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4728 * target-reloc.h (relocate_section): Do special handling for
4729 symbols defined in discarded sections for global symbols as well
4730 as local symbols.
4731
4732 2010-01-08 Ian Lance Taylor <iant@google.com>
4733
4734 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4735 the SHT_SYMTAB case.
4736
4737 2010-01-08 Ian Lance Taylor <iant@google.com>
4738
4739 * object.cc (Sized_relobj::do_layout): Don't get confused if
4740 layout_eh_frame returns NULL.
4741
4742 2010-01-08 Ian Lance Taylor <iant@google.com>
4743
4744 PR 11084
4745 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4746 dynamic symbol table, use the normal symbol table.
4747 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4748 symbol table.
4749
4750 2010-01-08 Ian Lance Taylor <iant@google.com>
4751
4752 PR 11072
4753 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4754 sections.
4755
4756 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4757
4758 * version.cc (print_version): Change to "Copyright 2010".
4759
4760 2010-01-08 Ian Lance Taylor <iant@google.com>
4761
4762 PR 10287
4763 PR 11063
4764 * i386.cc (class Target_i386): Change return type of plt_section
4765 to be non-const.
4766 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4767 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4768 tls_desc_rel_ field.
4769 (Output_data_plt_i386::rel_tls_desc): New function.
4770 (Target_i386::rel_tls_desc_section): New function.
4771 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4772 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4773 R_386_TLS_DESC reloc in rel_tls_desc_section.
4774 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4775 Define struct Tlsdesc_info.
4776 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4777 (Target_x86_64::do_reloc_symbol_index): New function.
4778 (Target_x86_64::add_tlsdesc_info): New function.
4779 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4780 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4781 tlsdesc_rel_ field.
4782 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4783 all callers.
4784 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4785 (Target_x86_64::rela_tlsdesc_section): New function.
4786 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4787 handling.
4788 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4789 (Target_x86_64::do_reloc_addend): New function.
4790 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4791 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4792 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4793 (Output_reloc::type): New function.
4794 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4795 (Output_reloc::is_target_specific): New function.
4796 (Output_reloc::target_arg): New function.
4797 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4798 absolute relocs and target specific relocs.
4799 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4800 add_target_specific.
4801 (class Output_data_reloc) [SHT_RELA]: Likewise.
4802 * output.cc (Output_reloc::Output_reloc): Add four new versions
4803 for absolute relocs and target specific relocs.
4804 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4805 (Output_reloc::get_symbol_index): Likewise.
4806 (Output_reloc::local_section_offset): Check that local_sym_index_
4807 is not TARGET_CODE or 0.
4808 (Output_reloc::symbol_value): Likewise.
4809 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4810 reloc.
4811 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4812 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4813 functions.
4814 * layout.cc (add_target_dynamic_tags): Use output section for
4815 DT_PLTRELSZ and DT_JMPREL.
4816
4817 2010-01-07 Ian Lance Taylor <iant@google.com>
4818
4819 PR 11061
4820 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4821 function.
4822 (class Output_data_reloc_generic): Define.
4823 (class Output_data_reloc_base): Change base class to
4824 Output_data_reloc_generic. Change add() method to call
4825 bump_relative_reloc_count for a relative reloc. Remove
4826 sort_relocs_ field.
4827 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4828 to sort_relocs().
4829 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4830 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4831 appropriate.
4832 * layout.h (class Layout): Update declaration.
4833
4834 2010-01-07 Ian Lance Taylor <iant@google.com>
4835
4836 * output.h (class Output_data): Add const version of
4837 output_section and do_output_section.
4838 (class Output_section_data): Add const version of
4839 do_output_section.
4840 (class Output_section): Likewise.
4841 * layout.cc (Layout::add_target_dynamic_tags): New function.
4842 * layout.h (class Layout): Update declarations.
4843 * arm.cc (Target_arm::do_finalize_sections): Use
4844 add_target_dynamic_tags.
4845 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4846 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4847 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4848 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4849
4850 2010-01-07 Ian Lance Taylor <iant@google.com>
4851
4852 PR 11042
4853 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4854 object as needed.
4855
4856 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4857 Ian Lance Taylor <iant@google.com>
4858
4859 PR 11019
4860 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4861 Xindex::read_symtab_xindex.
4862
4863 2010-01-07 Doug Kwan <dougkwan@google.com>
4864
4865 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4866 (Insn_template::thumb16_bcond_insn): New method declaration.
4867 (Insn_template): Fix spelling.
4868 (Stub::thumb16_special): New method declaration.
4869 (Stub::do_write): Define virtual method which was previously pure
4870 virtual.
4871 (Stub::do_thumb16_special): New method declaration.
4872 (Stub::do_fixed_endian_write): New template member.
4873 (Reloc_stub::do_write): Remove.
4874 (Reloc_stub::do_fixed_endian_write): Remove.
4875 (Cortex_a8_stub): New class definition.
4876 (Stub_factory::make_cortex_a8_stub): New method definition.
4877 (Stub_factory::Stub_factory): Add missing static storage class
4878 qualifier for elf32_arm_stub_a8_veneer_blx.
4879
4880 2010-01-07 Ian Lance Taylor <iant@google.com>
4881
4882 PR 10980
4883 * options.h (class General_options): Add --warn-unresolved-symbols
4884 and --error-unresolved-symbols.
4885 * errors.cc (Errors::undefined_symbol): Implement
4886 --warn-unresolved-symbols.
4887
4888 * options.h (class General_options): Add -z text and -z textoff.
4889 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4890
4891 2010-01-06 Sriraman Tallam <tmsriram@google.com>
4892
4893 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4894 (Garbage_collection::cident_sections): New function.
4895 (Garbage_collection::add_cident_section): New function.
4896 (Garbage_collection::cident_sections_): New member.
4897 (gc_process_relocs): Add references to sections whose names are C
4898 identifiers.
4899 * gold.h (cident_section_start_prefix): New constant.
4900 (cident_section_stop_prefix): New constant.
4901 (is_cident): New function.
4902 * layout.cc (Layout::define_section_symbols): Replace string constants
4903 with the newly defined constants.
4904 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4905 C identifiers.
4906 * testsuite/Makefile.am: Add gc_orphan_section_test.
4907 * testsuite/Makefile.in: Regenerate.
4908 * testsuite/gc_orphan_section_test.cc: New file.
4909 * testsuite/gc_orphan_section_test.sh: New file.
4910
4911 2010-01-06 Ian Lance Taylor <iant@google.com>
4912
4913 PR 10980
4914 * options.h (class General_options): Add --warn-shared-textrel.
4915 * layout.cc (Layout::finish_dynamic_section): Implement
4916 --warn-shared-textrel.
4917
4918 PR 10980
4919 * options.h (class General_options): Add --warn-multiple-gp.
4920
4921 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4922
4923 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4924 $(THREADSLIB) and $(LIBDL).
4925 * Makefile.in: Rebuild.
4926
4927 2010-01-06 Ian Lance Taylor <iant@google.com>
4928
4929 PR 10980
4930 * options.cc (General_options::parse_section_start): New function.
4931 (General_options::section_start): New function.
4932 (General_options::General_options): Initialize all members.
4933 * options.h: Include <map>
4934 (class General_options): Add --section-start. Add section_starts_
4935 member.
4936 * layout.cc (Layout::attach_allocated_section_to_segment): If
4937 --section-start was used, set the address of the segment. Remove
4938 local sort_sections.
4939 (Layout::relaxation_loop_body): If the address of the load segment
4940 has been set by --section-start, don't use it.
4941 * output.h (Output_segment::update_flags_for_output_section): New
4942 function.
4943 * output.cc (Output_segment::add_output_section): Call
4944 update_flags_for_output_section.
4945
4946 2010-01-05 Ian Lance Taylor <iant@google.com>
4947
4948 PR 10980
4949 * options.h (class General_options): Add --undefined-version.
4950 * script.cc (struct Version_expression): Add was_matched_by_symbol
4951 field.
4952 (Version_script_info::matched_symbol): New function.
4953 (Version_script_info::get_symbol_version_helper): Call
4954 matched_symbol.
4955 (Version_script_info::check_unmatched_names): New function.
4956 * script.h (class Version_script_info): Update declarations.
4957 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4958
4959 * options.h (class General_options): Use DEFINE_bool_alias for
4960 allow_multiple_definition.
4961 * resolve.cc (Symbol_table::should_override): Don't test
4962 allow_multiple_definition.
4963
4964 PR 10980
4965 * options.h (class General_options): Add --cref.
4966 * main.cc (main): Print cref table if --cref. Don't close mapfile
4967 until after printing cref table.
4968 * cref.cc: Include "symtab.h".
4969 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4970 (Cref_table_compare::operator()): New function.
4971 (Cref_inputs::gather_cref): New function.
4972 (filecol): New static const.
4973 (Cref_inputs::print_cref): New function.
4974 (Cref::print_cref): New function.
4975 * cref.h: Include <cstdio>.
4976 (class Cref): Update declarations.
4977 * mapfile.h (Mapfile::file): New function.
4978 * object.h (class Object): Define Symbols. Declare virtual
4979 do_get_global_symbols.
4980 (Object::get_global_symbols): New function.
4981 * object.cc (Input_objects::add_object): Pass object to cref_ if
4982 --cref.
4983 (Input_objects::archive_start): Likewise.
4984 (Input_objects::archive_stop): Likewise.
4985 (Input_objects::print_cref): New function.
4986 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4987 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4988 --cref.
4989 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4990 function.
4991 * plugin.h (class Sized_pluginobj): Update declarations.
4992
4993 2010-01-05 Ian Lance Taylor <iant@google.com>
4994
4995 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4996 to is_default_version. Rename insdef to insdefault.
4997 (Symbol_table::add_from_relobj): Rename def to is_default_version
4998 and local to is_forced_local.
4999 (Symbol_table::add_from_pluginobj): Likewise.
5000 (Symbol_table::add_from_dynobj): Likewise.
5001 (Symbol_table::define_special_symbol): Rename insdef to
5002 insdefault.
5003
5004 2010-01-04 Ian Lance Taylor <iant@google.com>
5005
5006 PR 10980
5007 * options.h (class General_options): Add
5008 --allow-multiple-definition and -z muldefs.
5009 * resolve.cc (Symbol_table::should_override): Don't warn about a
5010 multiple symbol definition if --allow-multiple-definition or -z
5011 muldefs.
5012
5013 PR 10980
5014 * options.h (class General_options): Add --add-needed and
5015 --copy-dt-needed-entries. Tweak --as-needed help entry.
5016 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5017 error if --copy-dt-needed-entries aka --add-needed is used and
5018 would cause a change in behaviour.
5019
5020 PR 10980
5021 * options.h (class General_options): Add -G as a short version of
5022 --shared. Add no-op options -assert, -g, and -i.
5023
5024 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5025
5026 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5027 check for .text or .gnu.linkonce.t sections.
5028 * icf.cc (Icf::find_identical_sections): Ditto.
5029 Change the detection for mangled function name within the section
5030 name.
5031 * icf.h (is_section_foldable_candidate): New function.
5032
5033 2009-12-30 Ian Lance Taylor <iant@google.com>
5034
5035 PR 10980
5036 * options.h (class General_options): Permit two dashes with
5037 --retain-symbols-file.
5038
5039 2009-12-30 Ian Lance Taylor <iant@google.com>
5040
5041 PR 10979
5042 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5043 don't put the file header and segment headers in the text
5044 segment.
5045
5046 PR 10979
5047 * common.cc (Sort_commons::operator()): Stabilize sort when both
5048 entries are NULL.
5049 (Symbol_table::do_allocate_commons_list): When allocating common
5050 symbols, skip a symbol which is no longer common.
5051 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5052 an object before checking its type.
5053 * testsuite/common_test_2.c: New file.
5054 * testsuite/common_test_3.c: New file.
5055 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5056 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5057 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5058 (common_test_2_pic.o, common_test_2.so): New targets.
5059 (common_test_3_pic.o, common_test_3.so): New targets.
5060 * testsuite/Makefile.in: Rebuild.
5061
5062 PR 10979
5063 * script.cc (read_input_script): If we see a new SECTIONS clause,
5064 and we have added an input section, give an error.
5065 * layout.h (class Layout): Add have_added_input_section function.
5066 Add have_added_input_section_ field.
5067 * layout.cc (Layout::Layout): Initialize
5068 have_added_input_section_.
5069 (Layout::layout): Set have_added_input_section_.
5070 (Layout::layout_eh_frame): Likewise.
5071
5072 2009-12-30 Ian Lance Taylor <iant@google.com>
5073
5074 PR 10931
5075 * options.h (class General_options): Add --sort-common option.
5076 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5077 * common.cc (Sort_common): Add sort_order parameter to
5078 constructor. Add sort_order_ field.
5079 (Sort_commons::operator): Check sort_order_.
5080 (Symbol_table::allocate_commons): Determine the sort order.
5081 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5082 Change all callers.
5083 (Symbol_table::do_allocate_commons_list): Likewise.
5084
5085 2009-12-30 Ian Lance Taylor <iant@google.com>
5086
5087 PR 10916
5088 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5089 symbols from this object, don't change the visibility of an
5090 undefined symbol.
5091 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5092
5093 2009-12-30 Ian Lance Taylor <iant@google.com>
5094
5095 PR 10861
5096 * script.h (class Version_script_info): Define Language enum.
5097 Update declarations. Define Glob, Exact, and Lookup types. Add
5098 new fields globals_, locals_, and is_finalized_.
5099 * script.cc: Various formatting fixes.
5100 (class Parser_closure): Change language_stack_ from a vector of
5101 std::string to one of Version_script_info::Language. Adjust all
5102 uses accordingly.
5103 (class Lazy_demangler): Remove.
5104 (struct Version_expression): Change language from std::string to
5105 Version_script_info::Language.
5106 (Version_script_info::Version_script_info): New function.
5107 (Version_script_info::~Version_script_info): Don't call clear.
5108 (Version_script_info::finalize): New function.
5109 (Version_script_info::build_lookup_tables): New function.
5110 (Version_script_info::build_expression_list_lookup): New
5111 function.
5112 (Version_script_info::get_symbol_version_helper): Rewrite to use
5113 lookup tables.
5114 (Version_script_info::print_expression_list): Adjust to use
5115 Version_script_info::Language.
5116 (script_push_lex_into_version_mode): Check that the version script
5117 has not been finalized.
5118 (version_script_push_lang): Change language string to
5119 Version_script_info::Language.
5120 * options.cc (Command_line::version_script): New function.
5121 * options.h (class General_options): Add finalize_dynamic_list
5122 function. Change version_script from declaration to definition.
5123 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5124 * testsuite/version_script.map: Remove duplicate def of foo.
5125 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5126 version_script.map.
5127 * testsuite/Makefile.in: Rebuild.
5128
5129 2009-12-30 Ian Lance Taylor <iant@google.com>
5130
5131 PR 10843
5132 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5133 if the input symbol index is 0, make the output symbol index 0.
5134
5135 2009-12-30 Ian Lance Taylor <iant@google.com>
5136
5137 PR 10670
5138 * options.h (class General_options): Add -x/--discard-all.
5139 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5140 --discard-all. If the local symbol needs a dynamic entry, check
5141 that before handling --discard-locals.
5142
5143 2009-12-30 Ian Lance Taylor <iant@google.com>
5144
5145 PR 10450
5146 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5147 flags to PF_R.
5148 (Output_segment::add_output_section): Don't change the flags if
5149 the type is PT_TLS.
5150
5151 PR 10450
5152 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5153 GNU hash table if they need a dynamic value. Otherwise, don't add
5154 them if they are defined in a dynamic object or are forced local.
5155
5156 2009-12-29 Ian Lance Taylor <iant@google.com>
5157
5158 PR 10450
5159 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5160 .gnu.hash table for a 32-bit target.
5161
5162 PR 10450
5163 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5164 regular and a dynamic object only needs a dynamic symbol table
5165 entry if it is externally visible.
5166
5167 PR 10450
5168 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5169 constructor. Add global_offset_table_ field.
5170 (Target_i386::got_section): Set global_offset_table_.
5171 (Target_i386::do_finalize_sections): Set global_offset_table_
5172 size.
5173 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5174 in constructor. Add global_offset_table_ field.
5175 (Target_x86_64::got_section): Set global_offset_table_.
5176 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5177 size.
5178
5179 * layout.cc (Layout::Layout): Initialize increase_relro_.
5180 (Layout::get_output_section): Add is_relro, is_last_relro, and
5181 is_first_non_relro parameters. Change all callers.
5182 (Layout::choose_output_section): Likewise.
5183 (Layout::add_output_section_data): Likewise.
5184 (Layout::make_output_section): Likewise.
5185 (Layout::set_segment_offsets): Clear increase_relro when using a
5186 linker script.
5187 * layout.h (class Layout): Add increase_relro method. Add
5188 increase_relro_ field. Update declarations.
5189 * output.cc (Output_section::Output_section): Initialize
5190 is_last_relro_ and is_first_non_relro_.
5191 (Output_segment::add_output_section): Group relro sections is
5192 do_sort is true. Handle is_last_relro and is_first_non_relro.
5193 (Output_segment::maximum_alignment): Remove relro handling.
5194 (Output_segment::set_section_addresses): Add increase_relro
5195 parameter. Change all callers. Add initial alignment to align
5196 relro sections on separate page. Remove old relro handling.
5197 (Output_segment::set_section_list_addresses): Remove in_relro
5198 parameter. Change all callers.
5199 (Output_segment::set_offset): Add increase parameter. Change all
5200 callers. Remove old relro handling.
5201 * output.h (class Output_section): Add new methods: is_last_relro,
5202 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5203 Add is_last_relro_ and is_first_non_relro_ fields.
5204 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5205 Create separate .got.plt section. Call increase_relro.
5206 * x86_64.cc (Target_x86_64::got_section): Likewise.
5207 * testsuite/relro_script_test.t: Add .got.plt.
5208
5209 PR 10450
5210 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5211 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5212 (Layout::finalize): Call set_dynamic_symbol_size.
5213 (Layout::set_dynamic_symbol_size): New function.
5214 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5215 set_dynamic_symbol_size.
5216
5217 PR 10450
5218 * output.h (class Output_section): Add is_entsize_zero_ field.
5219 * output.cc (Output_section::Output_section): Initialize
5220 is_entsize_zero_.
5221 (Output_section::set_entsize): If two different entsizes are
5222 requested, force it to zero.
5223 (Output_section::add_input_section): Set flags for .debug_str
5224 before updating section flags. Set entsize.
5225 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5226 and SHF_STRING if all input sections have those flags.
5227
5228 2009-12-29 Rafael Espindola <espindola@google.com>
5229
5230 * main.cc (main): Fix the sys time reporting.
5231 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5232 reporting.
5233
5234 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5235
5236 * options.cc (General_options::parse_version): Allow -v to exit
5237 without an error if there is nothing to link.
5238
5239 2009-12-29 Ian Lance Taylor <iant@google.com>
5240
5241 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5242 using a version of gcc before 4.1.
5243 * configure: Rebuild.
5244
5245 2009-12-28 Chris Demetriou <cgd@google.com>
5246
5247 * attributes.cc (Output_attributes_section_data::do_write): Use
5248 std::vector::front rather than std::vector::data.
5249
5250 2009-12-28 Ian Lance Taylor <iant@google.com>
5251
5252 * symtab.h (class Symbol_table): Add enum Defined.
5253 * resolve.cc (Symbol_table::should_override): Add defined
5254 parameter. Change all callers. Test whether object is NULL
5255 before calling a method on it.
5256 (Symbol_table::report_resolve_problem): Add defined parameter.
5257 Change all callers.
5258 (Symbol_table::should_override_with_special): Likewise.
5259 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5260 parameter. Change all callers.
5261 (Symbol_table::do_define_in_output_data): Likewise.
5262 (Symbol_table::define_in_output_segment): Likewise.
5263 (Symbol_table::do_define_in_output_segment): Likewise.
5264 (Symbol_table::define_as_constant): Likewise.
5265 (Symbol_table::do_define_as_constant): Likewise.
5266 * script.h (class Symbol_assignment): Add is_defsym parameter to
5267 constructor; change all callers.
5268 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5269 parameter. Change all callers. Add is_defsym_ field.
5270 (class Parser_closure): Add parsing_defsym parameter to
5271 constructor; change all callers. Add parsing_defsym accessor
5272 function. Add parsing_defsym_ field.
5273
5274 2009-12-28 Ian Lance Taylor <iant@google.com>
5275
5276 * gold.cc (queue_middle_tasks): Fix formatting.
5277 * object.cc (Relobj::is_section_name_included): Likewise.
5278
5279 2009-12-23 Ian Lance Taylor <iant@google.com>
5280
5281 * i386.cc (Target_i386::do_calls_non_split): Recognize
5282 -fsplit-stack prologue for a function with a static chain.
5283 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5284 -fsplit-stack prologue when using %r11.
5285
5286 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5287
5288 * options.cc (General_options::parse_version): Make -v continue and do
5289 the link like GNU ld does.
5290
5291 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5292
5293 * Makefile.am (CCFILES): Add timer.cc.
5294 (HFILES): Add timer.h.
5295 * configure.ac: Check for sysconf and times.
5296 * main.cc: include timer.h.
5297 (main): Use Timer instead of get_run_time.
5298 * timer.cc: New.
5299 * timer.h: New.
5300 * workqueue.cc: include timer.h.
5301 (Workqueue::find_and_run_task):
5302 Report user, sys and wall time.
5303 * Makefile.in: Regenerate.
5304 * config.in: Regenerate.
5305 * configure: Regenerate.
5306
5307 2009-12-16 Doug Kwan <dougkwan@google.com>
5308
5309 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5310 sections.
5311 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5312 relaxed input sections.
5313 * output.cc (Output_section::find_relaxed_input_section): Change
5314 return type to Output_relaxed_input_section pointer. Adjust code
5315 for new type of relaxed_input_section_map_.
5316 * output.h (Output_section::find_relaxed_input_section): Change
5317 return type to Output_relaxed_input_section pointer.
5318 (Output_section::Output_relaxed_input_section_by_input_section_map):
5319 New type.
5320 (Output_section::relaxed_input_section_map_): Change type to
5321 Output_section::Output_relaxed_input_section_by_input_section_map.
5322 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5323 input section.
5324
5325 2009-12-15 Ian Lance Taylor <iant@google.com>
5326
5327 * layout.cc (Layout::create_shstrtab): Only write out after input
5328 sections if we are compressing debug sections.
5329
5330 2009-12-15 Ian Lance Taylor <iant@google.com>
5331
5332 * archive.cc (Archive::add_symbols): Only look up a symbol without
5333 a version if there is, in fact, a version.
5334
5335 2009-12-14 Ian Lance Taylor <iant@google.com>
5336
5337 Revert -Wshadow changes, all changes from:
5338 2009-12-11 Doug Kwan <dougkwan@google.com>
5339 2009-12-11 Nick Clifton <nickc@redhat.com>
5340 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5341
5342 2009-12-11 Doug Kwan <dougkwan@google.com>
5343
5344 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5345 due to -Wshadow.
5346 * attributes.cc (Object_attribute::size): Ditto.
5347 (Attributes_section_data::size): Ditto.
5348 (Attributes_section_data::Attributes_section_data): Ditto.
5349 (Output_attributes_section_data::do_write): Ditto.
5350 * attributes.h (Object_attribute::set_type): Ditto.
5351 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5352
5353 2009-12-11 Nick Clifton <nickc@redhat.com>
5354
5355 * archive.cc: Fix shadowed variable warnings.
5356 * arm.cc: Likewise.
5357 * compressed_output.cc: Likewise.
5358 * compressed_output.h: Likewise.
5359 * configure: Likewise.
5360 * dwarf_reader.cc: Likewise.
5361 * dynobj.cc: Likewise.
5362 * dynobj.h: Likewise.
5363 * ehframe.cc: Likewise.
5364 * ehframe.h: Likewise.
5365 * errors.cc: Likewise.
5366 * expression.cc: Likewise.
5367 * fileread.cc: Likewise.
5368 * fileread.h: Likewise.
5369 * freebsd.h: Likewise.
5370 * i386.cc: Likewise.
5371 * icf.cc: Likewise.
5372 * incremental.h: Likewise.
5373 * layout.cc: Likewise.
5374 * layout.h: Likewise.
5375 * mapfile.cc: Likewise.
5376 * merge.cc: Likewise.
5377 * merge.h: Likewise.
5378 * object.cc: Likewise.
5379 * object.h: Likewise.
5380 * options.h: Likewise.
5381 * output.cc: Likewise.
5382 * output.h: Likewise.
5383 * parameters.cc: Likewise.
5384 * plugin.cc: Likewise.
5385 * powerpc.cc: Likewise.
5386 * reduced_debug_output.cc: Likewise.
5387 * reduced_debug_output.h: Likewise.
5388 * reloc.cc: Likewise.
5389 * reloc.h: Likewise.
5390 * resolve.cc: Likewise.
5391 * script-sections.cc: Likewise.
5392 * script.cc: Likewise.
5393 * script.h: Likewise.
5394 * sparc.cc: Likewise.
5395 * symtab.cc: Likewise.
5396 * symtab.h: Likewise.
5397 * target-select.cc: Likewise.
5398 * target-select.h: Likewise.
5399 * token.h: Likewise.
5400 * workqueue.cc: Likewise.
5401 * workqueue.h: Likewise.
5402 * x86_64.cc: Likewise.
5403
5404 2009-12-10 Doug Kwan <dougkwan@google.com>
5405
5406 * arm.cc (attributes.h): New include.
5407 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5408 (Arm_relobj::~Arm_relobj): Delete object pointed by
5409 attributes_section_data_.
5410 (Arm_relobj::attributes_section_data): New method definition.
5411 (Arm_relobj::attributes_section_data_): New data member declaration.
5412 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5413 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5414 attributes_section_data_.
5415 (Arm_dynobj::attributes_section_data): New method definition.
5416 (Arm_dynobj::attributes_section_data_): New data member declaration.
5417 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5418 initialization value of may_use_blx_ to false.
5419 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5420 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5421 object attributes to compute results instead of hard-coding.
5422 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5423 Target_arm::get_secondary_compatible_arch,
5424 Target_arm::set_secondary_compatible_arch
5425 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5426 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5427 New method declarations.
5428 (Target_arm::get_aeabi_object_attribute): New method definition.
5429 (Target_arm::attributes_section_data_): New data member declaration.
5430 (read_arm_attributes_section): New template definition.
5431 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5432 (Arm_dynobj::do_read_symbols): Ditto.
5433 (Target_arm::do_finalize_sections): Merge attributes sections from
5434 input. Check for BLX use after attributes section merging.
5435 Fix __exidx_start and __exidx_end visibility. Create an
5436 .ARM.attributes section if necessary.
5437 (Target_arm::get_secondary_compatible_arch,
5438 Target_arm::set_secondary_compatible_arch,
5439 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5440 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5441 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5442 New method definitions.
5443
5444 2009-12-09 Ian Lance Taylor <iant@google.com>
5445
5446 * plugin.cc (Plugin::load): Don't cast from void* to a function
5447 pointer.
5448
5449 2009-12-09 Ian Lance Taylor <iant@google.com>
5450
5451 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5452 information fields.
5453
5454 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5455
5456 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5457 Replace two_file_shared_1.so with two_file_shared_2.so.
5458 * testsuite/Makefile.in: Regenerated.
5459
5460 2009-12-08 Doug Kwan <dougkwan@google.com>
5461
5462 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5463 (HFILES): Add attributes.h and int_encoding.h.
5464 * Makefile.in: Regenerate.
5465 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5466 function definitions to int_encoding.cc
5467 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5468 prototypes to int_encoding.h
5469 * reduced_debug_output.cc (int_encoding.h): New include.
5470 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5471 function definitions to int_encoding.cc
5472 (insert_into_vector, read_from_pointer): Move template definitions to
5473 int_encoding.h
5474 * attributes.cc: New file.
5475 * attributes.h: New file.
5476 * int_encoding.cc: New file.
5477 * int_encoding.h: New file.
5478
5479 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5480
5481 PR gold/11055
5482 * incremental-dump.cc (dump_incremental_inputs): New.
5483 (main): Use dump_incremental_inputs.
5484
5485 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5486
5487 PR gold/10893
5488 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5489 checking elfcpp::STT_FUNC.
5490 (Target_i386::Relocate::relocate): Likewise.
5491 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5492
5493 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5494 symbols from shared libraries into normal FUNC symbols.
5495
5496 * symtab.h (Symbol): Add is_func and use it.
5497
5498 2009-12-05 Doug Kwan <dougkwan@google.com>
5499
5500 * arm.cc (Target_arm::arm_info): Initialize new fields
5501 attributes_section and attributes_vendor.
5502 * i386.cc (Target_i386::i386_info): Same.
5503 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5504 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5505 fields attributes_section and attributes_vendor.
5506 * sparc.cc (Target_sparc::sparc_info): Same.
5507 * target.h (Target::attributes_section, Target::attributes_vendor,
5508 Target::is_attributes_section, Target::attribute_arg_type,
5509 Target::attributes_order): New method definitions.
5510 (Target::Target_info::attributes_section,
5511 Target::Target_info::attributes_vendor): New fields.
5512 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5513 virtual method definitions.
5514 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5515 attributes_section and attributes_vendor.
5516 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5517
5518 2009-12-05 Doug Kwan <dougkwan@google.com>
5519
5520 * arm.cc: Update comments about interworking and stub generation.
5521 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5522 considered as non-PIC.
5523 (Arm_relocate_functions::base_abs): Fix formatting.
5524 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5525 of function to use GOT entry address instead of offset.
5526 (Target_arm::Scan::global): Issue an error if a symbol would need a
5527 PLT does not get one because it is untyped. Remove code to create
5528 dynamic symbols for relative branches.
5529 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5530 takes unsigned integer instead of boolean.
5531
5532 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5533
5534 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5535 (two_file_test_LDADD): Likewise.
5536 (common_test_1_LDADD): Likewise.
5537 (exception_test_LDADD) Likewise.
5538 (weak_test_LDADD): Likewise.
5539 (many_sections_test_LDADD): Likewise.
5540 (initpri1_LDADD): Likewise.
5541 (script_test_1_LDADD): Likewise.
5542 (script_test_2_LDADD): Likewise.
5543 (justsyms_LDADD): Likewise.
5544 (binary_test_LDADD): Likewise.
5545 (large_LDADD): Likewise.
5546 * testsuite/Makefile.in: Regenerated.
5547
5548 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5549
5550 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5551 (Symbol_table::override_with_special): Likewise.
5552 (Symbol_table::add_from_object): Likewise.
5553
5554 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5555
5556 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5557 Don't set the data_offset twice.
5558
5559 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5560
5561 * testsuite/Makefile.in: Regenerate.
5562
5563 2009-12-03 Doug Kwan <dougkwan@google.com>
5564
5565 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5566 (Target_arm::do_finalize_sections): Add parameter for symbol table
5567 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5568 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5569 parameter for symbol table pointer.
5570 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5571 an additional parameter for a pointer to symbol table.
5572 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5573 parameter for a symbol table pointer.
5574 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5575 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5576 Ditto.
5577 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5578 parameter for a symbol table pointer.
5579
5580 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5581
5582 * incremental.cc (Incremental_inputs_header)
5583 (Incremental_inputs_header_write, Incremental_inputs_entry)
5584 (Incremental_inputs_entry_write): Move ...
5585 * incremental.h (Incremental_inputs_header)
5586 (Incremental_inputs_header_write, Incremental_inputs_entry)
5587 (Incremental_inputs_entry_write): here.
5588
5589 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5590
5591 * incremental.cc (make_sized_incremental_binary): Set the target.
5592 Error if it is incompatible.
5593 * output.h (Output_file): Add filename method.
5594
5595 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5596
5597 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5598 from the get_* methods.
5599
5600 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5601
5602 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5603 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5604 Write 0 for the data_offset of scripts.
5605
5606 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5607
5608 * testsuite/Makefile.am: Add the incremental_test.sh test.
5609 * testsuite/incremental_test.sh: New.
5610 * testsuite/incremental_test_1.c: New.
5611 * testsuite/incremental_test_2.c: New.
5612
5613 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5614
5615 * incremental-dump.cc (main): Fix typos.
5616
5617 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5618
5619 PR gold/11025
5620 * incremental-dump.cc (main): Use llu to print 64 bit values.
5621
5622 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5623 H.J. Lu <hongjiu.lu@intel.com>
5624
5625 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5626 $(LIBDL).
5627 (incremental_dump_LDADD): Likewise.
5628 * Makefile.in: Regenerated.
5629
5630 2009-11-25 Doug Kwan <dougkwan@google.com>
5631
5632 Revert:
5633
5634 2009-11-25 Doug Kwan <dougkwan@google.com>
5635
5636 * arm.cc (Target_arm::Target_arm): Move method definition
5637 outside of class definition. Add code to handle
5638 --target1-rel, --target1-abs and --target2= options.
5639 (Target_arm::get_reloc_reloc_type): Change method to be
5640 non-static and const.
5641 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5642 New data member declaration.
5643 (Target_arm::Scan::local, Target_arm::Scan::global,
5644 Target_arm::Relocate::relocate,
5645 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5646 Adjust call to Target_arm::get_real_reloc_type.
5647 (Target_arm::get_real_reloc_type): Use command line options
5648 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5649 * options.h (--target1-rel, --target1-abs, --target2): New
5650 ARM-only options.
5651
5652 2009-11-25 Doug Kwan <dougkwan@google.com>
5653
5654 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5655 class definition. Add code to handle --target1-rel, --target1-abs
5656 and --target2= options.
5657 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5658 and const.
5659 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5660 member declaration.
5661 (Target_arm::Scan::local, Target_arm::Scan::global,
5662 Target_arm::Relocate::relocate,
5663 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5664 call to Target_arm::get_real_reloc_type.
5665 (Target_arm::get_real_reloc_type): Use command line options to
5666 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5667 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5668 options.
5669
5670 2009-11-25 Doug Kwan <dougkwan@google.com>
5671
5672 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5673 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5674 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5675 formatting.
5676 (Arm_relocate_functions::thm_call): Replace body with a call to
5677 Arm_relocate_functions::thumb_branch_common.
5678 (Arm_relocate_functions::thm_jump24,
5679 Arm_relocate_functions::thm_xpc22): New method definitions.
5680 (Arm_relocate_functions::thumb_branch_common): New method definition.
5681 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5682 operator.
5683 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5684 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5685
5686 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5687
5688 * Makefile.am: Build incremental-dump
5689 * Makefile.in: Regenerate.
5690 * incremental-dump.cc: New.
5691 * incremental.cc (Incremental_inputs_header_data,
5692 Incremental_inputs_entry_data): Move to incremental.h
5693 * incremental.h: (Incremental_inputs_header_data,
5694 Incremental_inputs_entry_data): Move from incremental.cc
5695
5696 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5697
5698 * incremental.cc (Incremental_inputs_header,
5699 Incremental_inputs_header_write, Incremental_inputs_entry,
5700 Incremental_inputs_entry_write): Add a typedef with the data type.
5701
5702 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5703
5704 * incremental.cc (Incremental_inputs_header,
5705 Incremental_inputs_header_write, Incremental_inputs_entry,
5706 Incremental_inputs_entry_write): Update comment about which
5707 type has the filed descriptions.
5708
5709 2009-11-15 Doug Kwan <dougkwan@google.com>
5710
5711 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5712 (Arm_relocate_functions::arm_branch_common): Change method defintion
5713 in class definition to a method declaration and update list of formal
5714 parameters.
5715 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5716 Arm_relocation_functions::jump24): Adjust call to
5717 Arm_relocate_functions::arm_branch_common. Update list of formal
5718 parameters.
5719 (Arm_relocate_functions::xpc25): New method definition.
5720 (Arm_relocate_functions::arm_branch_common): Move method defintion
5721 out from class definition. Use stubs for mode-switching and extending
5722 branch ranges.
5723 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5724 specially. Change code to enable use of stubs in ARM branches.
5725
5726 2009-11-10 Doug Kwan <dougkwan@google.com>
5727
5728 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5729 in method declaration.
5730 (Target_arm::relocate_stub): New method declaration.
5731 (Target_arm::default_target): Change to return a pointer instead of
5732 a const reference.
5733 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5734 Target_arm::default_target.
5735 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5736 method definition.
5737 (Target_arm::relocate_section): Adjust view.
5738 (Target_arm::relocate_stub): New method definition.
5739
5740 2009-11-10 Doug Kwan <dougkwan@google.com>
5741
5742 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5743 a format warning.
5744 * incremental.cc (open_incremental_binary): Initialized local
5745 variables to avoid warnings.
5746 * object.cc (make_elf_object): Ditto.
5747 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5748 a format warning.
5749
5750 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5751
5752 PR gold/10930
5753 * testsuite/plugin_test.c: Include "config.h".
5754
5755 2009-11-09 Doug Kwan <dougkwan@google.com>
5756
5757 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5758 (arm_symbol_value): Remove.
5759 (Arm_relocate_functions::arm_branch_common,
5760 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5761 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5762 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5763 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5764 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5765 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5766 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5767 Arm_relocate_functions::thm_mobw_abs_nc,
5768 Arm_relocate_functions::thm_mov_abs,
5769 Arm_relocate_functions::movw_prel_nc,
5770 Arm_relocate_functions::thm_movt_abs,
5771 Arm_relocate_functions::movt_prel,
5772 Arm_relocate_functions::thm_movw_prel_nc,
5773 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5774 (Target_arm::Relocate::relocate): Only decompose address into two
5775 parts if relocation type uses the thumb-bit and pass the actual
5776 bit instead of a flag indicating that the thumb-bit is used. Adjust
5777 calls to methods in Arm_relocate_functions for this change.
5778
5779 2009-11-08 Ian Lance Taylor <iant@google.com>
5780
5781 PR 10925
5782 * reloc.cc: Instantiate
5783 Sized_relobj::initialize_input_to_output_maps and
5784 Sized_relobj:free_input_to_output_maps.
5785
5786 2009-11-06 Ian Lance Taylor <iant@google.com>
5787
5788 PR 10876
5789 * defstd.cc (in_segment): Set only_if_ref true for "end".
5790
5791 2009-11-06 Doug Kwan <dougkwan@google.com>
5792
5793 * arm.cc (class Reloc_stub): Correct a comment.
5794 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5795 (Target_arm::scan_section_for_stubs): New method declaration.
5796 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5797 Change methods from private to protected.
5798 (Target_arm::do_may_relax): New method definition.
5799 (Target_arm::do_relax, Target_arm::group_sections,
5800 Target_arm::scan_reloc_for_stub,
5801 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5802 (Target_arm::arm_input_section_map_): New data member declaration.
5803 (Target_arm::scan_reloc_for_stub,
5804 Target_arm::scan_reloc_section_for_stubs,
5805 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5806 Target_arm::do_relax): New method definitions.
5807
5808 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5809
5810 * configure.ac: Check for (struct stat)::st_mtim
5811 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5812 * config.in: Regenerate.
5813 * configure: Regenerate.
5814
5815 2009-11-05 Ian Lance Taylor <iant@google.com>
5816
5817 PR 10910
5818 * output.cc (Output_segment::add_output_section): Add missing
5819 return statement.
5820
5821 2009-11-04 Ian Lance Taylor <iant@google.com>
5822
5823 PR 10880
5824 * object.h (class Object): Add is_needed and set_is_needed
5825 methods. Add is_needed_ field. Make bool fields into bitfields.
5826 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5827 defined in a dynamic object and referenced by a regular object,
5828 set is_needed for the dynamic object.
5829 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5830 if the file is marked with as_needed and it is not needed.
5831
5832 2009-11-04 Ian Lance Taylor <iant@google.com>
5833
5834 PR 10887
5835 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5836 tags if data is discarded by linker script.
5837 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5838 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5839 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5840 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5841
5842 2009-11-04 Ian Lance Taylor <iant@google.com>
5843
5844 * layout.cc (Layout::get_output_section): Add is_interp and
5845 is_dynamic_linker_section parameters. Change all callers.
5846 (Layout::choose_output_section): Likewise.
5847 (Layout::make_output_section): Likewise.
5848 (Layout::add_output_section_data): Add is_dynamic_linker_section
5849 parameter. Change all callers.
5850 * layout.h (class Layout): Update declarations.
5851 * output.h (class Output_section): Add is_interp, set_is_interp,
5852 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5853 Add is_interp_, is_dynamic_linker_section_ fields. Change
5854 generate_code_fills_at_write_ to a bitfield.
5855 * output.cc (Output_section::Output_sections): Initialize new
5856 fields.
5857 (Output_segment::add_output_section): Add do_sort parameter.
5858 Change all callers.
5859
5860 2009-11-03 Ian Lance Taylor <iant@google.com>
5861
5862 PR 10860
5863 * options.h (class General_options): Add --warn-common.
5864 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5865 merging two common symbols.
5866 (Symbol_table::should_override): Handle --warn-common when merging
5867 a common symbol with a defined symbol. Use report_resolve_problem
5868 for multiple definitions.
5869 (Symbol_table::report_resolve_problem): New function.
5870 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5871
5872 2009-11-03 Doug Kwan <dougkwan@google.com>
5873
5874 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5875 stub_factory_.
5876 (Target_arm::stub_factory): New method definition.
5877 (Target_arm::new_arm_input_section,
5878 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5879 Target_arm::reloc_uses_thumb_bit): New method declarations.
5880 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5881 New type definitions.
5882 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5883 member declarations.
5884 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5885 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5886 New method definitions.
5887
5888 2009-11-03 Ian Lance Taylor <iant@google.com>
5889
5890 * options.h (class General_options): Add --warn_constructors.
5891
5892 2009-11-03 Ian Lance Taylor <iant@google.com>
5893
5894 PR 10893
5895 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5896 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5897
5898 2009-11-03 Ian Lance Taylor <iant@google.com>
5899
5900 PR 10895
5901 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5902 --msgid-bugs-address.
5903 (install-pdf): New target.
5904 (install-data_yes): Look up one directory to find mkinstalldirs.
5905
5906 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5907
5908 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5909 tree.
5910
5911 2009-10-30 Doug Kwan <dougkwan@google.com>
5912
5913 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5914
5915 2009-10-30 Doug Kwan <dougkwan@google.com>
5916
5917 * arm.cc (Stub_addend_reader): New struct template definition
5918 and partial specializations.
5919 (Stub_addend_reader::operator()): New method definition for a
5920 partially specialized template.
5921
5922 2009-10-30 Doug Kwan <dougkwan@google.com>
5923
5924 * arm.cc (Arm_relobj::processor_specific_flags): New method
5925 definition.
5926 (Arm_relobj::do_read_symbols): New method declaration.
5927 (Arm_relobj::processor_specific_flags_): New data member declaration.
5928 (Arm_dynobj): New class definition.
5929 (Target_arm::do_finalize_sections): Add input_objects parameter.
5930 (Target_arm::do_adjust_elf_header): New method declaration.
5931 (Target_arm::are_eabi_versions_compatible,
5932 (Target_arm::merge_processor_specific_flags): New method declaration.
5933 (Target_arm::do_make_elf_object): New overloaded method definitions
5934 and declaration.
5935 (Arm_relobj::do_read_symbols): New method definition.
5936 (Arm_dynobj::do_read_symbols): Ditto.
5937 (Target_arm::do_finalize_sections): Add input_objects parameters.
5938 Merge processor-specific flags from all input objects.
5939 (Target_arm::are_eabi_versions_compatible,
5940 Target_arm::merge_processor_specific_flags,
5941 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5942 New method definitions.
5943 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5944 Input_objects pointer type parameter.
5945 * layout.cc (Layout::finalize): Pass input objects to target's.
5946 finalize_sections function.
5947 * output.cc (Output_file_header::do_sized_write): Set ELF file
5948 header's processor-specific flags.
5949 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5950 Input_objects pointer type parameter.
5951 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5952 * target.h (Input_objects): New forward class declaration.
5953 (Target::processor_specific_flags,
5954 Target::are_processor_specific_flags_sect): New method definitions.
5955 (Target::finalize_sections): Add input_objects parameter.
5956 (Target::Target): Initialize processor_specific_flags_ and
5957 are_processor_specific_flags_set_.
5958 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5959 parameter.
5960 (Target::set_processor_specific_flags): New method definition.
5961 (Target::processor_specific_flags_,
5962 Target::are_processor_specific_flags_set_): New data member
5963 declarations.
5964 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5965 Input_objects pointer type parameter.
5966
5967 2009-10-30 Doug Kwan <dougkwan@google.com>
5968
5969 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5970
5971 2009-10-28 Ian Lance Taylor <iant@google.com>
5972
5973 * object.h (class Relobj): Drop options parameter from
5974 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5975 do_scan_relocs, do_relocate. Change all callers.
5976 (class Sized_relobj): Drop options parameters from
5977 do_gc_process_relocs, do_scan_relocs, do_relocate,
5978 do_relocate_sections, relocate_sections, emit_relocs_scan,
5979 emit_relocs_scan_reltype. Change all callers.
5980 (struct Relocate_info): Remove options field and all references to
5981 it.
5982 * reloc.h (class Read_relocs): Remove options constructor
5983 parameter and options_ field. Change all callers.
5984 (class Gc_process_relocs, class Scan_relocs): Likewise.
5985 (class Relocate_task): Likewise.
5986 * target-reloc.h (scan_relocs): Remove options parameter. Change
5987 all callers.
5988 (scan_relocatable_relocs): Likewise.
5989 * target.h (class Sized_target): Remove options parameter from
5990 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5991 all callers.
5992 * gc.h (gc_process_relocs): Remove options parameter. Change all
5993 callers.
5994 * arm.cc: Update functions to remove options parameters.
5995 * i386.cc: Likewise.
5996 * powerpc.cc: Likewise.
5997 * sparc.cc: Likewise.
5998 * x86_64.cc: Likewise.
5999 * testsuite/testfile.cc: Likewise.
6000
6001 2009-10-28 Doug Kwan <dougkwan@google.com>
6002
6003 * arm.cc (Arm_relobj): New class definition.
6004 (Arm_relobj::scan_sections_for_stubs,
6005 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6006 New method definitions.
6007
6008 2009-10-28 Cary Coutant <ccoutant@google.com>
6009
6010 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6011 (Plugin::cleanup_done_): New member.
6012 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6013 (Plugin_manager::cleanup_done_): Remove.
6014 (Plugin_manager::add_input_file): Edit error message.
6015 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6016 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6017
6018 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6019
6020 * fileread.cc: (File_read::View::~View): Use the new
6021 data_ownership_ filed.
6022 (File_read::~File_read): Dispose the new whole_file_view_.
6023 (File_read::open): Mmap the whole file if needed.
6024 (File_read::open): Use whole_file_view_ instead of contents_.
6025 (File_read::find_view): Use whole_file_view_ if applicable.
6026 (File_read::do_read): Use whole_file_view_ instead of contents_.
6027 (File_read::make_view): Use whole_file_view_ instead of contents_,
6028 update File_read::View::View call.
6029 (File_read::find_or_make_view): Update File_read::View::View
6030 call.
6031 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6032 remove contents_
6033 (File_read::View::Data_ownership): New enum.
6034 (File_read::View::View): Replace bool mapped_ with Data_ownership
6035 argument.
6036 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6037 (File_read::View::data_ownership_): New field.
6038 (File_read::contents_): Remove (replaced by whole_file_view_).
6039 (File_read::whole_file_view_): New field.
6040 * options.h (class General_options): Add --keep-files-mapped.
6041
6042 2009-10-27 Cary Coutant <ccoutant@google.com>
6043
6044 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6045 * testsuite/Makefile.am (plugin_test_5): New test case.
6046 * testsuite/Makefile.in: Regenerate.
6047
6048 2009-10-25 Doug Kwan <dougkwan@google.com>
6049
6050 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6051 from private to protected to allow access by child class.
6052 (Sized_relobj::do_relocate_sections): New method declaration.
6053 (Sized_relobj::relocate_sections): Virtualize.
6054 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6055 Sized_relobj::relocate_sections. Instantiate template explicitly
6056 for different target sizes and endianity.
6057
6058 2009-10-24 Doug Kwan <dougkwan@google.com>
6059
6060 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6061 (Arm_input_section::as_arm_input_section): New method.
6062 (Arm_output_section): New class definition.
6063 (Arm_output_section::create_stub_group,
6064 Arm_output_section::group_sections): New method definitions.
6065
6066 2009-10-22 Doug Kwan <dougkwan@google.com>
6067
6068 * arm.cc (Arm_input_section): New class definition.
6069 (Arm_input_section::init, Arm_input_section:do_write,
6070 Arm_input_section::set_final_data_size,
6071 Arm_input_section::do_reset_address_and_file_offset): New method
6072 definitions.
6073
6074 2009-10-21 Doug Kwan <dougkwan@google.com>
6075
6076 * arm.cc (Stub_table, Arm_input_section): New forward class
6077 declarations.
6078 (Stub_table): New class defintion.
6079 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6080 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6081 New method definition.
6082
6083 2009-10-21 Doug Kwan <dougkwan@google.com>
6084
6085 * arm.cc: Update copyright comments.
6086 (Target_arm): New forward class template declaration.
6087 (Arm_address): New type.
6088 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6089 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6090 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6091 constants.
6092 (Insn_template): Same.
6093 (DEF_STUBS): New macro.
6094 (Stub_type): New enum type.
6095 (Stub_template): New class definition.
6096 (Stub): Same.
6097 (Reloc_stub): Same.
6098 (Stub_factory): Same.
6099 (Target_arm::Target_arm): Initialize may_use_blx_ and
6100 should_force_pic_veneer_.
6101 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6102 Target_arm::should_force_pic_veneer,
6103 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6104 Target_arm::using_thumb_only, Target_arm:;default_target): New
6105 method defintions.
6106 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6107 New data member declarations.
6108 (Insn_template::size, Insn_template::alignment): New method defintions.
6109 (Stub_template::Stub_template): New method definition.
6110 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6111 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6112 (Stub_factory::Stub_factory): New method definition.
6113 * gold.h (string_hash): New template.
6114 * output.h (Input_section_specifier::hash_value): Use
6115 gold::string_hash.
6116 (Input_section_specifier::string_hash): Remove.
6117 * stringpool.cc (Stringpool_template::string_hash): Use
6118 gold::string_hash.
6119
6120 2009-10-20 Doug Kwan <dougkwan@google.com>
6121
6122 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6123 symbols of relaxed input sections.
6124 * output.h (Output_section::find_relaxed_input_section): Make
6125 method public.
6126
6127 2009-10-16 Doug Kwan <dougkwan@google.com>
6128
6129 * dynobj.cc (Versions::Versions): Initialize version_script_.
6130 Only insert base version symbol definition for a shared object
6131 if version script defines any version versions.
6132 (Versions::define_base_version): New method definition.
6133 (Versions::add_def): Check that base version is not needed.
6134 (Versions::add_need): Define base version lazily.
6135 * dynobj.h (Versions::define_base_version): New method declaration.
6136 (Versions::needs_base_version_): New data member declaration.
6137 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6138 (check_DATA): Add no_version_test.stdout.
6139 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6140 New make rules.
6141 * testsuite/Makefile.in: Regenerate.
6142 * testsuite/no_version_test.c: New file.
6143 * testsuite/no_version_test.sh: Ditto.
6144
6145 2009-10-16 Doug Kwan <dougkwan@google.com>
6146
6147 * expression.cc (class Segment_start_expression): New class definition.
6148 (Segment_start_expression::value): New method definition.
6149 (script_exp_function_segment_start): Return a new
6150 Segment_start_expression.
6151 * gold/script-c.h (script_saw_segment_start_expression): New function
6152 prototype.
6153 * script-sections.cc (Script_sections::Script_sections): Initialize
6154 SAW_SEGMENT_START_EXPRESSION_ to false.
6155 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6156 and -Tbbs options to specify section addresses if given in
6157 command line and no SEGMENT_START expression is seen in a script.
6158 * script-sections.h (Script_sections::saw_segment_start_expression,
6159 Script_sections::set_saw_segment_start_expression): New method
6160 definition.
6161 (Script_sections::saw_segment_start_expression_): New data member
6162 declaration.
6163 * script.cc (script_saw_segment_start_expression): New function.
6164 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6165 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6166 script_test_7.sh and script_test_8.sh.
6167 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6168 script_test_8.stdout.
6169 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6170 (script_test_6, script_test_6.stdout, script_test_7,
6171 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6172 * Makefile.in: Regenerate.
6173 * testsuite/script_test_6.sh: New file.
6174 * testsuite/script_test_6.t: Same.
6175 * testsuite/script_test_7.sh: Same.
6176 * testsuite/script_test_7.t: Same.
6177 * testsuite/script_test_8.sh: Same.
6178
6179 2009-10-16 Doug Kwan <dougkwan@google.com>
6180
6181 * output.cc (Output_segment::set_section_list_address): Cast
6182 expressions to unsigned long long type to avoid format warnings.
6183
6184 2009-10-15 Ian Lance Taylor <iant@google.com>
6185
6186 * script.cc (Script_options::add_symbol_assignment): Always add a
6187 dot assignment to script_sections_.
6188 * script-sections.cc (Script_sections::add_dot_assignment):
6189 Initialize if necessary.
6190
6191 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6192 program headers with no load segment if there is a linker script.
6193
6194 * layout.cc (Layout::set_segment_offsets): Align the file offset
6195 to the segment aligment for -N or -n with no load segment.
6196 * output.cc (Output_segment::add_output_section): Don't crash if
6197 the first section is a TLS section.
6198 (Output_segment::set_section_list_addresses): Print an error
6199 message if the address moves backward in a linker script.
6200 * script-sections.cc
6201 (Output_section_element_input::set_section_addresses): Don't
6202 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6203 (Orphan_output_section::set_section_addresses): Likewise.
6204
6205 2009-10-15 Doug Kwan <dougkwan@google.com>
6206
6207 * layout.cc (Layout::finish_dynamic_section): Generate tags
6208 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6209 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6210 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6211
6212 2009-10-14 Ian Lance Taylor <iant@google.com>
6213
6214 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6215 fields.
6216 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6217 data_shdr fields of relinfo.
6218 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6219 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6220 R_386_TLS_LDO_32, adjust based on section flags.
6221 (Target_i386::Relocate::fix_up_ldo): Remove.
6222
6223 2009-10-13 Ian Lance Taylor <iant@google.com>
6224
6225 Add support for -pie.
6226 * options.h (class General_options): Add -pie and
6227 --pic-executable.
6228 (General_options::output_is_position_independent): Test -pie.
6229 (General_options::output_is_executable): Return true if not shared
6230 and not relocatable.
6231 (General_options::output_is_pie): Remove.
6232 * options.cc (General_options::finalize): Reject incompatible uses
6233 of -pie.
6234 * gold.cc (queue_middle_tasks): A -pie link is not static.
6235 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6236 * symtab.cc (Symbol::final_value_is_known): Return false if
6237 output_is_position_independent.
6238 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6239 output_is_position_independent.
6240 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6241 output_is_position_independent.
6242 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6243 output_is_position_independent.
6244 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6245 two_file_pie_test.
6246 (basic_pie_test.o, basic_pie_test): New targets.
6247 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6248 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6249 (two_file_pie_test): New target.
6250 * testsuite/Makefile.in: Rebuild.
6251 * README: Remove note saying that -pie is not supported.
6252
6253 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6254
6255 * options.h (class General_options): Add -init and -fini.
6256 * layout.cc (Layout::finish_dynamic_section): Emit
6257 given init and fini functions.
6258
6259 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6260
6261 * gc.h (gc_process_relocs): Check if icf is enabled using new
6262 function.
6263 * gold.cc (queue_initial_tasks): Likewise.
6264 (queue_middle_tasks): Likewise.
6265 * object.cc (do_layout): Likewise.
6266 * symtab.cc (is_section_folded): Likewise.
6267 * main.cc (main): Likewise.
6268 * reloc.cc (Read_relocs::run): Likewise.
6269 (Sized_relobj::do_scan_relocs): Likewise.
6270 * icf.cc (is_function_ctor_or_dtor): New function.
6271 (Icf::find_identical_sections): Check if function is ctor or dtor when
6272 safe icf is chosen.
6273 * options.h (General_options::icf): Change option to be an enum.
6274 (Icf_status): New enum.
6275 (icf_enabled): New method.
6276 (icf_safe_folding): New method.
6277 (set_icf_status): New method.
6278 (icf_status_): New variable.
6279 * (options.cc) (General_options::finalize): Set icf_status_.
6280 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6281 icf_test and icf_keep_unique_test to use the --icf enum flag.
6282 * testsuite/icf_safe_test.sh: New file.
6283 * testsuite/icf_safe_test.cc: New file.
6284
6285 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6286
6287 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6288 includes to gc.h and icf.h.
6289 * arm.cc: Include gc.h.
6290 * gold.cc: Likewise.
6291 * i386.cc: Likewise.
6292 * powerpc.cc: Likewise.
6293 * sparc.cc: Likewise.
6294 * x86_64.cc: Likewise.
6295 * gc.h: Include icf.h.
6296
6297 2009-10-11 Ian Lance Taylor <iant@google.com>
6298
6299 * plugin.cc: Include "gold.h" before other header files.
6300
6301 2009-10-10 Chris Demetriou <cgd@google.com>
6302
6303 * options.h (Input_file_argument::Input_file_type): New enum.
6304 (Input_file_argument::is_lib_): Replace with...
6305 (Input_file_argument::type_): New member.
6306 (Input_file_argument::Input_file_argument): Take Input_file_type
6307 'type' rather than boolean 'is_lib' as second argument.
6308 (Input_file_argument::is_lib): Use type_.
6309 (Input_file_argument::is_searched_file): New function.
6310 (Input_file_argument::may_need_search): Handle is_searched_file.
6311 * options.cc (General_options::parse_library): Support -l:filename.
6312 (General_options::parse_just_symbols): Update for Input_file_argument
6313 changes.
6314 (Command_line::process): Likewise.
6315 * archive.cc (Archive::get_file_and_offset): Likewise.
6316 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6317 * script.cc (read_script_file, script_add_file): Likewise.
6318 * fileread.cc (Input_file::Input_file): Likewise.
6319 (Input_file::will_search_for): Handle is_searched_file.
6320 (Input_file::open): Likewise.
6321 * readsyms.cc (Read_symbols::get_name): Likewise.
6322 * testsuite/Makefile.am (searched_file_test): New test.
6323 * testsuite/Makefile.in: Regenerate.
6324 * testsuite/searched_file_test.cc: New file.
6325 * testsuite/searched_file_test_lib.cc: New file.
6326
6327 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6328 Ian Lance Taylor <iant@google.com>
6329
6330 * descriptor.cc: Include <cstdio> and "binary-io.h".
6331 (Descriptors::open): Open the files in binary mode always.
6332 * script.cc (Lex::get_token): Treat \r as whitespace.
6333
6334 2009-10-09 Ian Lance Taylor <iant@google.com>
6335
6336 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6337
6338 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6339 Ian Lance Taylor <iant@google.com>
6340
6341 * configure.ac: Check for readv function also.
6342 * fileread.cc (readv): Define if not HAVE_READV.
6343 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6344 does not exist.
6345 * config.in: Regenerate.
6346 * configure: Regenerate.
6347
6348 2009-10-09 Doug Kwan <dougkwan@google.com>
6349
6350 * layout.cc (Layout::make_output_section): Call target hook to make
6351 ordinary output section.
6352 (Layout::finalize): Adjust parameter list of call the
6353 Target::may_relax().
6354 * layout.h (class Layout::section_list): New method.
6355 * merge.h (Output_merge_base::entsize): Change visibility to public.
6356 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6357 New methods.
6358 (Output_merge_string::do_is_string): New method.
6359 * object.cc (Sized_relobj::do_setup): renamed from
6360 Sized_relobj::set_up.
6361 * object.h (Sized_relobj::adjust_shndx,
6362 Sized_relobj::initializ_input_to_output_maps,
6363 Sized_relobj::free_input_to_output_maps): Change visibilities to
6364 protected.
6365 (Sized_relobj::setup): Virtualize.
6366 (Sized_relobj::do_setup): New method declaration.
6367 (Sized_relobj::invalidate_section_offset,
6368 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6369 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6370 * options.cc (parse_int): New function.
6371 * options.h (parse_int): New declaration.
6372 (DEFINE_int): New macro.
6373 (stub_group_size): New option.
6374 * output.cc (Output_section::Output_section): Initialize memebers
6375 merge_section_map_, merge_section_by_properties_map_,
6376 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6377 (Output_section::add_input_section): Handled deferred code-fill
6378 generation and remove an old comment.
6379 (Output_section::add_relaxed_input_section): New method definition.
6380 (Output_section::add_merge_input_section): Use merge section by
6381 properties map to speed to search. Update merge section maps
6382 as appropriate.
6383 (Output_section::build_relaxation_map): New method definition.
6384 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6385 Same.
6386 (Output_section::relax_input_section): Renamed to
6387 Output_section::convert_input_sections_to_relaxed_sections and change
6388 interface to take a vector of pointers to relaxed sections.
6389 (Output_section::find_merge_section,
6390 Output_section::find_relaxed_input_section): New method definitions.
6391 (Output_section::is_input_address_mapped,
6392 Output_section::output_offset, Output_section::output_address):
6393 Use output section data maps to speed up searching.
6394 (Output_section::find_starting_output_address): Add comments.
6395 (Output_section::do_write,
6396 Output_section::write_to_postprocessing_buffer): Do code-fill
6397 generation as appropriate.
6398 (Output_section::get_input_sections): Invalidate relaxed input section
6399 map.
6400 (Output_section::restore_states): Adjust type of checkpoint .
6401 Invalidate relaxed input section map.
6402 * output.h (Output_merge_base): New class declaration.
6403 (Input_section_specifier): New class defintion.
6404 (class Output_relaxed_input_section) Change base class to
6405 Output_section_data_build.
6406 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6407 base class initializer.
6408 (Output_section::add_relaxed_input_section): New method declaration.
6409 (Output_section::Input_section): Change visibility to protected.
6410 (Output_section::Input_section::relobj,
6411 Output_section::Input_section::shndx): Handle relaxed input sections.
6412 Output_section::input_sections) Change visibility to protected. Also
6413 define overload to return a non-const pointer.
6414 (Output_section::Merge_section_properties): New class defintion.
6415 (Output_section::Merge_section_by_properties_map,
6416 Output_section::Output_section_data_by_input_section_map,
6417 Output_section::Relaxation_map): New types.
6418 (Output_section::relax_input_section): Rename method to
6419 Output_section::convert_input_sections_to_relaxed_sections and change
6420 interface to take a vector of relaxed section pointers.
6421 (Output_section::find_merge_section,
6422 Output_section::find_relaxed_input_section,
6423 Output_section::build_relaxation_map,
6424 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6425 New method declarations.
6426 (Output_section::merge_section_map_
6427 Output_section::merge_section_by_properties_map_,
6428 Output_section::relaxed_input_section_map_,
6429 Output_section::is_relaxed_input_section_map_valid_,
6430 Output_section::generate_code_fills_at_write_): New data members.
6431 * script-sections.cc
6432 (Output_section_element_input::set_section_addresses): Call
6433 current_data_size and addralign methods of relaxed input sections.
6434 (Orphan_output_section::set_section_addresses): Call current_data_size
6435 and addralign methods of relaxed input sections.
6436 * symtab.cc (Symbol_table::compute_final_value): Extract template
6437 from the body of Symbol_table::sized_finalize_symbol.
6438 (Symbol_table::sized_finalized_symbol): Call
6439 Symbol_table::compute_final_value.
6440 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6441 (Symbol_table::compute_final_value): New templated method declaration.
6442 * target.cc (Target::do_make_output_section): New method defintion.
6443 * target.h (Target::make_output_section): New method declaration.
6444 (Target::relax): Add more parameters for input objects, symbol table
6445 and layout. Adjust call to do_relax.
6446 (Target::do_make_output_section): New method declaration.
6447 (Target::do_relax): Add parameters for input objects, symbol table
6448 and layout.
6449
6450 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6451
6452 * pread.c: Include stdio.h.
6453
6454 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6455
6456 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6457 defined.
6458
6459 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6460
6461 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6462 Change read_shndx type to unsigned int.
6463 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6464 int.
6465 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6466 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6467 Change read_shndx type to unsigned int.
6468 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6469 int.
6470 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6471 * layout.cc (Layout::create_symtab_sections): Cast the result of
6472 local_symcount * symsize to off_t in the gold_assert.
6473
6474 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6475
6476 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6477 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6478 R_ARM_BASE_ABS.
6479 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6480 (Arm_relocate_functions::thm_abs5): New function.
6481 (Arm_relocate_functions::abs12): New function.
6482 (Arm_relocate_functions::abs16): New function.
6483 (Arm_relocate_functions::base_abs): New function.
6484 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6485 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6486 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6487 R_ARM_BASE_ABS.
6488 (Scan::global): Likewise.
6489 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6490 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6491 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6492 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6493 R_ARM_BASE_ABS.
6494
6495 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6496
6497 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6498 (Arm_relocate_functions::movt_prel): New function.
6499 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6500 (Arm_relocate_functions::thm_movt_prel): New function.
6501 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6502 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6503 (Scan::global, Relocate::relocate): Likewise.
6504 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6505
6506 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6507
6508 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6509 Incremental_checker.
6510 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6511 unsigned int.
6512 (class Incremental_inputs_header): New class.
6513 (Incremental_inputs_header_writer): Edit comment.
6514 (Incremental_inputs_entry): New class.
6515 (Incremental_inputs_entry_writer): Edit comment.
6516 (Sized_incremental_binary::do_find_incremental_inputs_section):
6517 Add *strtab_shndx parameter, fill it.
6518 (Sized_incremental_binary::do_check_inputs): New method.
6519 (Incremental_checker::can_incrementally_link_output_file): Use
6520 Sized_incremental_binary::check_inputs.
6521 (Incremental_inputs::report_command_line): Save command line in
6522 command_line_.
6523 * incremental.h:
6524 (Incremental_binary::find_incremental_inputs_section): New
6525 method.
6526 (Incremental_binary::do_find_incremental_inputs_section): Add
6527 strtab_shndx parameter.
6528 (Incremental_binary::do_check_inputs): New pure virtual method.
6529 (Sized_incremental_binary::do_check_inputs): Declare.
6530 (Incremental_checker::Incremental_checker): Add incremental_inputs
6531 parameter, use it to initialize incremental_inputs_.
6532 (Incremental_checker::incremental_inputs_): New field.
6533 (Incremental_checker::command_line): New method.
6534 (Incremental_checker::inputs): New method.
6535 (Incremental_checker::command_line_): New field.
6536
6537 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6538
6539 * incremental.cc: Include <cstdarg> and "target-select.h".
6540 (vexplain_no_incremental): New function.
6541 (explain_no_incremental): New function.
6542 (Incremental_binary::error): New method.
6543 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6544 method.
6545 (make_sized_incremental_binary): New function.
6546 (open_incremental_binary): New function.
6547 (can_incrementally_link_file): Add checks if output is ELF and has
6548 inputs section.
6549 * incremental.h: Include "elfcpp_file.h" and "output.h".
6550 (Incremental_binary): New class.
6551 (Sized_incremental_binary): New class.
6552 (open_incremental_binary): Declare.
6553 * object.cc (is_elf_object): Use
6554 elfcpp::Elf_recognizer::is_elf_file.
6555 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6556 * output.h (Output_file::filesize): New method.
6557
6558 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6559
6560 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6561 New function.
6562 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6563 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6564 function.
6565 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6566 function.
6567 (Arm_relocate_functions::movw_abs_nc): New function.
6568 (Arm_relocate_functions::movt_abs): New function.
6569 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6570 (Arm_relocate_functions::thm_movt_abs): New function.
6571 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6572 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6573 (Scan::global): Likewise.
6574 (Relocate::relocate): Likewise.
6575 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6576
6577 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6578
6579 * arm.cc (Arm_relocate_functions::got_prel) New function.
6580 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6581 (Relocate::relocate): Likewise.
6582 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6583
6584 2009-10-06 Ian Lance Taylor <iant@google.com>
6585
6586 * options.h (class General_options): Define
6587 split_stack_adjust_size parameter.
6588 * object.h (class Object): Add uses_split_stack_ and
6589 has_no_split_stack_ fields. Add uses_split_stack and
6590 has_no_split_stack accessor functions. Declare
6591 handle_split_stack_section.
6592 (class Reloc_symbol_changes): Define.
6593 (class Sized_relobj): Define Function_offsets. Declare
6594 split_stack_adjust, split_stack_adjust_reltype, and
6595 find_functions.
6596 * object.cc (Object::handle_split_stack_section): New function.
6597 (Sized_relobj::do_layout): Call handle_split_stack_section.
6598 * dynobj.cc (Sized_dynobj::do_layout): Call
6599 handle_split_stack_section.
6600 * reloc.cc (Sized_relobj::relocate_sections): Call
6601 split_stack_adjust for executable sections in split_stack
6602 objects. Pass reloc_map to relocate_section.
6603 (Sized_relobj::split_stack_adjust): New function.
6604 (Sized_relobj::split_stack_adjust_reltype): New function.
6605 (Sized_relobj::find_functions): New function.
6606 * target-reloc.h: Include "object.h".
6607 (relocate_section): Add reloc_symbol_changes parameter. Change
6608 all callers.
6609 * target.h (class Target): Add calls_non_split method. Declare
6610 do_calls_non_split virtual method. Declare match_view and
6611 set_view_to_nop.
6612 * target.cc: Include "elfcpp.h".
6613 (Target::do_calls_non_split): New function.
6614 (Target::match_view): New function.
6615 (Target::set_view_to_nop): New function.
6616 * gold.cc (queue_middle_tasks): Give an error if mixing
6617 split-stack and non-split-stack objects with -r.
6618 * i386.cc (Target_i386::relocate_section): Add
6619 reloc_symbol_changes parameter.
6620 (Target_i386::do_calls_non_split): New function.
6621 * x86_64.cc (Target_x86_64::relocate_section): Add
6622 reloc_symbol_changes parameter.
6623 (Target_x86_64::do_calls_non_split): New function.
6624 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6625 parameter.
6626 * powerpc.cc (Target_powerpc::relocate_section): Add
6627 reloc_symbol_changes parameter.
6628 * sparc.cc (Target_sparc::relocate_section): Add
6629 reloc_symbol_changes parameter.
6630 * configure.ac: Call AM_CONDITIONAL for the default target.
6631 * configure: Rebuild.
6632 * testsuite/Makefile.am (TEST_AS): New variable.
6633 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6634 (check_DATA): Add split_i386 and split_x86_64 files.
6635 (SPLIT_DEFSYMS): Define.
6636 (split_i386_[1234n].o): New targets.
6637 (split_i386_[124]): New targets.
6638 (split_i386_[1234r].stdout): New targets.
6639 (split_x86_64_[1234n].o): New targets.
6640 (split_x86_64_[124]): New targets.
6641 (split_x86_64_[1234r].stdout): New targets.
6642 (MOSTLYCLEANFILES): Add new executables.
6643 * testsuite/split_i386.sh: New file.
6644 * testsuite/split_x86_64.sh: New file.
6645 * testsuite/split_i386_1.s: New file.
6646 * testsuite/split_i386_2.s: New file.
6647 * testsuite/split_i386_3.s: New file.
6648 * testsuite/split_i386_4.s: New file.
6649 * testsuite/split_i386_n.s: New file.
6650 * testsuite/split_x86_64_1.s: New file.
6651 * testsuite/split_x86_64_2.s: New file.
6652 * testsuite/split_x86_64_3.s: New file.
6653 * testsuite/split_x86_64_4.s: New file.
6654 * testsuite/split_x86_64_n.s: New file.
6655 * testsuite/testfile.cc (Target_test): Update relocation_section
6656 function.
6657 * testsuite/Makefile.in: Rebuild.
6658
6659 2009-10-06 Ian Lance Taylor <iant@google.com>
6660
6661 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6662 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6663 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6664 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6665 the address on ldo_addrs_.
6666 (Target_i386::Relocate::fix_up_ldo): New function.
6667
6668 2009-10-06 Rafael Espindola <espindola@google.com>
6669
6670 * plugin.cc (add_input_library): New.
6671 (Plugin::load): Add add_input_library to tv.
6672 (Plugin_manager::add_input_file): Add the is_lib argument.
6673 (add_input_file): Update call to Plugin_manager::add_input_file.
6674 (add_input_library): New.
6675 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6676
6677 2009-09-30 Doug Kwan <dougkwan@google.com>
6678
6679 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6680 symbol and call Symbol::may_need_copy_reloc to determine if
6681 a copy reloc is needed.
6682 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6683 nocopyreloc is given in command line.
6684 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6685 given in command line.
6686 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6687 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6688 of the removed Target_i386::may_need_copy_reloc.
6689 * options.h (copyreloc): New option with default value false.
6690 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6691 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6692 instead of the removed Target_powerpc::may_need_copy_reloc.
6693 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6694 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6695 instead of the removed Target_sparc::may_need_copy_reloc.
6696 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6697 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6698 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6699 instead of the removed Target_x86_64::may_need_copy_reloc.
6700
6701 2009-09-30 Ian Lance Taylor <iant@google.com>
6702
6703 * object.h (class Object): Remove target_ field, and target,
6704 sized_target, and set_target methods.
6705 (Object::sized_target): Remove.
6706 (class Sized_relobj): Update declarations. Remove sized_target.
6707 * object.cc (Sized_relobj::setup): Remove target parameter.
6708 Change all callers.
6709 (Input_objects::add_object): Don't do anything with the target.
6710 (make_elf_sized_object): Add punconfigured parameter. Change all
6711 callers. Set or test parameter target.
6712 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6713 Change all callers.
6714 * parameters.cc (Parameters::set_target): Change parameter type to
6715 be non-const.
6716 (Parameters::default_target): Remove.
6717 (set_parameters_target): Change parameter type to be non-const.
6718 (parameters_force_valid_target): New function.
6719 (parameters_clear_target): New function.
6720 * parameters.h (class Parameters): Update declarations. Remove
6721 default_target method. Add sized_target and clear_target
6722 methods. Change target_ to be non-const.
6723 (set_parameters_target): Update declaration.
6724 (parameters_force_valid_target): Declare.
6725 (parameters_clear_target): Declare.
6726 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6727 as NULL if we aren't searching.
6728 (Add_symbols::run): Don't check for compatible target.
6729 * fileread.cc (Input_file::open_binary): Call
6730 parameters_force_valid_target.
6731 * gold.cc (queue_middle_tasks): Likewise.
6732 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6733 set_target on object.
6734 * dynobj.h (class Sized_dynobj): Update declarations.
6735 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6736 make_elf_object returns NULL.
6737 (Archive::include_member): Don't check whether object target is
6738 compatible.
6739 * output.cc (Output_section::add_input_section): Get target from
6740 parameters.
6741 (Output_section::relax_input_section): Likewise.
6742 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6743 parameters.
6744 (Sized_relobj::do_scan_relocs): Likewise.
6745 (Sized_relobj::relocate_sections): Likewise.
6746 * resolve.cc (Symbol_table::resolve): Likewise.
6747 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6748 parameter. Change all callers.
6749 (Symbol_table::add_from_object): Get target from parameters.
6750 (Symbol_table::add_from_relobj): Don't check object target.
6751 (Symbol_table::add_from_dynobj): Likewise.
6752 (Symbol_table::define_special_symbol): Get target from
6753 parameters.
6754 * symtab.h (class Symbol_table): Update declaration.
6755 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6756 parameter. Change all callers. Clear parameter target.
6757 (Binary_test): Test target here.
6758 * testsuite/object_unittest.cc (gold_testsuite): Remove
6759 target_test_pointer parameter. Change all callers.
6760 (Object_test): Test target here.
6761
6762 2009-09-26 Ian Lance Taylor <iant@google.com>
6763
6764 * testsuite/initpri1.c: Don't try to use constructor priorities if
6765 compiling with gcc before 4.3.
6766
6767 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6768
6769 * testsuite/retain_symbols_file_test.sh (check_present): Change
6770 output file name to retain_symbols_file_test.stdout.
6771 (check_absent): Likewise.
6772
6773 2009-09-18 Craig Silverstein <csilvers@google.com>
6774
6775 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6776 * options.cc: Include <cerrno> and <fstream>.
6777 (General_options::finalize): Parse -retain-symbols-file tag.
6778 * options.h: New flag.
6779 (General_options): New method should_retain_symbol, new
6780 variable symbols_to_retain.
6781 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6782 should_retain_symbol map.
6783 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6784 * testsuite/Makefile.in: Regenerate.
6785 * testsuite/retain_symbols_file_test.sh: New file.
6786
6787 2009-09-18 Nick Clifton <nickc@redhat.com>
6788
6789 * po/es.po: Updated Spanish translation.
6790
6791 2009-09-17 Doug Kwan <dougkwan@google.com>
6792
6793 * debug.h (DEBUG_RELAXATION): New constant.
6794 (DEBUG_ALL): Add DEBUG_RELAXATION.
6795 (debug_string_to_enum): Add relaxation debug option.
6796 * layout.cc
6797 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6798 Layout::Relaxation_debug_check::read_sections,
6799 Layout::Relaxation_debug_check::read_sections): New method definitions.
6800 (Layout::Layout): Initialize data members
6801 record_output_section_data_from_scrips_,
6802 script_output_section_data_list_ and relaxation_debug_check_.
6803 (Layout::save_segments, Layout::restore_segments,
6804 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6805 Layout::relaxation_loop_body): New method definitions.
6806 (Layout::finalize): Support relaxation. Move section layout code to
6807 Layout::relaxation_loop_body.
6808 (Layout::set_asection_address_from_script): Move code for orphan
6809 section placement out.
6810 (Layout::place_orphan_sections_in_script): New method definition.
6811 * layout.h (Output_segment_headers, Output_file_header):
6812 New forward class declarations.
6813 (Layout::~Layout): Define.
6814 (Layout::new_output_section_data_from_script): New method definition.
6815 (Layout::place_orphan_sections_in_script): New method declaration.
6816 (Layout::Segment_states): New type declaration.
6817 (Layout::save_segments, Layout::restore_segments,
6818 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6819 Layout::relaxation_loop_body): New method declarations.
6820 (Layout::Output_section_data_list): New type declaration.
6821 (Layout::Relaxation_debug_check): New class definition.
6822 (Layout::record_output_section_data_from_script_,
6823 Layout::script_output_section_data_list_, Layout::segment_states_,
6824 Layout::relaxation_debug_check_): New data members.
6825 * output.cc: (Output_section_headers::do_size): New method definition.
6826 (Output_section_headers::Output_section_headers): Move size
6827 computation to Output_section_headers::do_size.
6828 (Output_segment_headers::do_size): New method definition.
6829 (Output_file_header::Output_file_header): Move size computation to
6830 Output_file_header::do_size and call it.
6831 (Output_file_header::do_size): New method definition.
6832 (Output_data_group::Output_data_group): Adjust call to
6833 Output_section_data.
6834 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6835 (Output_symtab_xindex::do_write): Add array bound check.
6836 (Output_section::Input_section::print_to_mapfile): Handle
6837 RELAXED_INPUT_SECTION_CODE.
6838 (Output_section::Output_section): Initialize data member checkpoint_.
6839 (Output_section::~Output_section): Delete checkpoint object pointed
6840 by checkpoint_.
6841 (Output_section::add_input_section): Always add an Input_section if
6842 relaxing.
6843 (Output_section::add_merge_input_section): Add assert.
6844 (Output_section::relax_input_section): New method definition.
6845 (Output_section::set_final_data_size): Set load address to zero for
6846 an unallocated section.
6847 (Output_section::do_address_and_file_offset_have_reset_values):
6848 New method definition.
6849 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6850 Handle relaxed input section.
6851 (Output_section::sort_attached_input_sections): Checkpoint input
6852 section list lazily.
6853 (Output_section::get_input_sections): Change type of input_sections to
6854 list of Simple_input_section pointers. Checkpoint input section list
6855 lazily. Also handle relaxed input sections.
6856 (Output_section::add_input_section_for_script): Take a reference to
6857 a Simple_input_section object instead of Relobj pointer and section
6858 index as parameter. Handle relaxed input sections.
6859 (Output_section::save_states, Output_section::restore_states): New
6860 method definitions.
6861 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6862 (Output_data::is_data_size_fixed): New method definition.
6863 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6864 if it is fixed.
6865 (Output_data::address_and_file_offset_have_reset_values): New method
6866 definition.
6867 (Output_data::do_address_and_file_offset_have_reset_values): New method
6868 definition.
6869 (Output_data::set_data_size): Check that data size is not fixed.
6870 (Output_data::fix_data_size): New method definition.
6871 (Output_data::is_data_size_fixed_): New data member.
6872 (Output_section_headers::set_final_data_size): New method definition.
6873 (Output_section_headers::do_size): New method declaration.
6874 (Output_segment_headers::set_final_data_size): New method definition.
6875 (Output_segment_headers::do_size): New method declaration.
6876 (Output_file_header::set_final_data_size)::New method definition.
6877 (Output_file_header::do_size)::New method declaration.
6878 (Output_section_data::Output_section_data): Add new parameter
6879 is_data_size_fixed and use it to fix data size.
6880 (Output_data_const::Output_data_const): Adjust call to base class
6881 constructor and fix data size.
6882 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6883 base class constructor and fix data size.
6884 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6885 base class constructor and fix data size.
6886 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6887 class constructor and fix data size.
6888 (Output_data_group::set_final_data_size): New method definition.
6889 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6890 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6891 class constructor and fix data size.
6892 (Output_relaxed_input_section): New class definition.
6893 (Output_section::Simple_input_section): New class definition.
6894 (Output_section::get_input_sections): Adjust parameter list.
6895 (Output_section::add_input_section_for_script): Same.
6896 (Output_section::save_states, Output_section::restore_states,
6897 Output_section::do_address_and_file_offset_have_reset_values,
6898 (Output_section::Input_section::Input_section): Handle
6899 RELAXED_INPUT_SECTION_CODE. Add new overload for
6900 Output_relaxed_input_section.
6901 (Output_section::Input_section::is_input_section,
6902 Output_section::Input_section::set_output_section): Handle relaxed
6903 input section.
6904 (Output_section::Input_section::is_relaxed_input_section,
6905 Output_section::Input_section::output_section_data,
6906 Output_section::Input_section::relaxed_input_section): New method
6907 definitions.
6908 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6909 value.
6910 (Output_section::Input_section::u1_): Update comments.
6911 (Output_section::Input_section::u2_): Add new union member poris.
6912 (Output_section::Checkpoint_output_section): New classs definition.
6913 (Output_section::relax_input_section): New method declaration.
6914 (Output_section::checkpoint_): New data member.
6915 (Output_segment): Update comments.
6916 (Output_segment::Output_segment): Un-privatize copy constructor.
6917 (Output_segment::operator=): Un-privatize.
6918 * script-sections.cc (Output_section_element::Input_section_list):
6919 Change element type to Output_section::Simple_input_section.
6920 (Output_section_element_dot_assignment::set_section_addresses):
6921 Register output section data for relaxation clean up.
6922 (Output_data_exression::Output_data_expression): Adjust call to base
6923 constructor to fix data size.
6924 (Output_section_element_data::set_section_addresses): Register
6925 Output_data_expression object for relaxation clean up.
6926 (struct Input_section_info): Replace Relobj pointer and section index
6927 pair with Output_section::Simple_input_section and Convert struct to a
6928 class.
6929 (Input_section_sorter::operator()): Adjust access to
6930 Input_section_info data member to use accessors.
6931 (Output_section_element_input::set_section_addresses): Use layout
6932 parameter. Adjust code to use Output_section::Simple_input_section
6933 and Input_secction_info classes. Register filler for relaxation
6934 clean up.
6935 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6936 and section index pair with Output_section::Simple_input_section
6937 class. Adjust code accordingly.
6938 (Phdrs_element::release_segment): New method definition.
6939 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6940 segment list.
6941 (Script_sections::release_segments): New method definition.
6942 * gold/script-sections.h (Script_sections::release_segments): New
6943 method declaration.
6944 * gold/target.h (Target::may_relax, Target::relax,
6945 Target::do_may_relax, Target::do_relax): New method definitions.
6946
6947 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6948
6949 * arm.cc (has_signed_unsigned_overflow): New function.
6950 (Arm_relocate_functions::abs8): New function.
6951 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6952 (Target_arm::Scan::global): Likewise.
6953 (Target_arm::relocate::relocate): Likewise.
6954 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6955 Likewise.
6956
6957 2009-09-16 Cary Coutant <ccoutant@google.com>
6958
6959 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6960 * testsuite/Makefile.in: Regenerate.
6961
6962 2009-09-11 Nick Clifton <nickc@redhat.com>
6963
6964 * po/gold.pot: Updated by the Translation project.
6965
6966 2009-09-08 Cary Coutant <ccoutant@google.com>
6967
6968 * output.cc (Output_file::open): Add execute permission to empty file.
6969 * testsuite/Makefile.am (permission_test): New test.
6970 * testsuite/Makefile.in: Regenerate.
6971
6972 2009-09-02 Ian Lance Taylor <iant@google.com>
6973
6974 * output.cc (Output_file::resize): Call map_no_anonymous rather
6975 than map.
6976
6977 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
6978
6979 * gold.cc: Include "incremental.h".
6980 (queue_initial_tasks): Call Incremental_checker methods.
6981 * incremental.cc: Include "output.h".
6982 (Incremental_checker::can_incrementally_link_output_file): New
6983 method.
6984 * incremental.h (Incremental_checker): New class.
6985
6986 * output.cc (Output_file::open_for_modification): New method.
6987 (Output_file::map_anonymous): Changed return type to bool. Record
6988 map in base_ field.
6989 (Output_file::map_no_anonymous): New method, broken out of map.
6990 (Output_file::map): Use map_no_anonymous and map_anonymous.
6991 * output.h (class Output_file): Update declarations.
6992
6993 2009-08-24 Cary Coutant <ccoutant@google.com>
6994
6995 * options.h (Command_line::Pre_options): New class.
6996 (Command_line::pre_options): New member.
6997 * options.cc (gold::options::ready_to_register): New variable.
6998 (One_option::register_option): Do nothing if not registering options.
6999 Assert if same short option registered twice.
7000 (General_options::General_options): Turn off option registration when
7001 done constructing.
7002 (Command_line::Pre_options::Pre_options): New constructor.
7003
7004 2009-08-24 Cary Coutant <ccoutant@google.com>
7005
7006 * options.h (General_options::no_keep_memory): Remove incorrect
7007 short option.
7008
7009 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7010
7011 * Makefile.am (am__skiplex, am__skipyacc): New.
7012 * Makefile.in: Regenerate.
7013
7014 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7015
7016 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7017 (INCLUDES): ... this.
7018 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7019 (AM_CPPFLAGS): Renamed from ...
7020 (INCLUDE): ... this.
7021 * Makefile.in, testsuite/Makefile.in: Regenerate.
7022
7023 * Makefile.in: Regenerate.
7024 * aclocal.m4: Likewise.
7025 * config.in: Likewise.
7026 * configure: Likewise.
7027 * testsuite/Makefile.in: Likewise.
7028
7029 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7030 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7031 * Makefile.in: Regenerate.
7032 * testsuite/Makefile.in: Regenerate.
7033
7034 2009-08-19 Cary Coutant <ccoutant@google.com>
7035
7036 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7037 symbols in shared libraries overridden by hidden or internal symbols
7038 in the main program.
7039
7040 2009-08-19 Chris Demetriou <cgd@google.com>
7041
7042 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7043 checking source file names in error messages.
7044
7045 2009-08-18 Doug Kwan <dougkwan@google.com>
7046
7047 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7048 an elcpp::Ehdr as parameter. Adjust call to set_target.
7049 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7050 an elfcpp::Ehdr as parameter.
7051 * object.cc (Object::set_target): Remove the version that looks up
7052 a target and sets it.
7053 (Sized_relobj::setup): Take a Target object instead of
7054 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7055 (make_elf_sized_object): Find target and ask target to
7056 make an ELF object.
7057 * object.h: (Object::set_target): Remove the version that looks up
7058 a target and sets it.
7059 (Sized_relobj::setup): Take a Target object instead of
7060 an elfcpp:Ehdr as parameter.
7061 * target.cc: Include dynobj.h.
7062 (Target::do_make_elf_object_implementation): New.
7063 (Target::do_make_elf_object): New.
7064 * target.h (Target::make_elf_object): New template declaration.
7065 (Target::do_make_elf_object): New method declarations.
7066 (Target::do_make_elf_object_implementation): New template declaration.
7067
7068 2009-08-14 Ian Lance Taylor <iant@google.com>
7069
7070 * gold.h (FUNCTION_NAME): Define.
7071 (gold_unreachable): Use FUNCTION_NAME.
7072
7073 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7074
7075 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7076 symbol in the --keep-unique list is not found.
7077
7078 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7079
7080 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7081 been maked as --keep-unique.
7082 (Icf::unfold_section): New function.
7083 * icf.h (Icf::unfold_section): New function.
7084 * options.h (General_options::keep_unique): New option.
7085 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7086 * testsuite/Makefile.in: Regenerate.
7087 * testsuite/icf_keep_unique_test.sh: New file.
7088 * testsuite/icf_keep_unique_test.cc: New file.
7089
7090 2009-08-12 Cary Coutant <ccoutant@google.com>
7091
7092 PR 10471
7093 * resolve.cc (Symbol_table::resolve): Check for references from
7094 dynamic objects to hidden and internal symbols.
7095 * testsuite/Makefile.am (hidden_test.sh): New test.
7096 * testsuite/Makefile.in: Regenerate.
7097 * testsuite/hidden_test.sh: New script.
7098 * testsuite/hidden_test_1.c: New test source.
7099 * testsuite/hidden_test_main.c: New test source.
7100
7101 2009-08-11 Doug Kwan <dougkwan@google.com>
7102
7103 * arm.cc: Update comments.
7104 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7105 segment to locate the .ARM.exidx section if present.
7106
7107 2009-08-09 Doug Kwan <dougkwan@google.com>
7108
7109 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7110 patch.
7111
7112 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7113 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7114 compiler warnings.
7115
7116 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7117
7118 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7119 valid tls_segment only for non-debug-section relocations.
7120 * testsuite/Makefile.am: Add gc_tls_test.
7121 * testsuite/Makefile.in: Regenerate.
7122 * testsuite/gc_tls_test.cc: New file.
7123 * testsuite/gc_tls_test.sh: New file.
7124
7125 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7126
7127 * icf.cc: New file.
7128 * icf.h: New file.
7129 * Makefile.am (CCFILES): Add icf.cc.
7130 (HFILES): Add icf.h
7131 * Makefile.in: Regenerate.
7132 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7133 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7134 section, symbol and addend information for the relocs.
7135 * gold.cc (queue_middle_tasks): Call identical code folding.
7136 * gold.h: Add defines for multimap.
7137 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7138 to the call of finalize_local_symbols.
7139 * main.cc (main): Create object of class Icf.
7140 * object.cc (Sized_relobj::do_layout): Allow this function to be
7141 called twice during icf.
7142 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7143 to sections marked as identical by icf.
7144 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7145 when available.
7146 (Sized_relobj::do_section_entsize): New function.
7147 * object.h (Object::section_entsize): New function.
7148 (Object::do_section_entsize): New pure virtual function.
7149 (Relobj::finalize_local_symbols): Add new parameter.
7150 (Relobj::do_section_entsize): New function.
7151 * options.h (General_options::icf): New option.
7152 (General_options::icf_iterations): New option.
7153 (General_options::print_icf_sections): New option.
7154 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7155 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7156 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7157 icf.
7158 * symtab.cc (Symbol_table::is_section_folded): New function.
7159 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7160 to sections marked as identical by icf.
7161 * symtab.h (Symbol_table::set_icf): New function.
7162 (Symbol_table::icf): New function.
7163 (Symbol_table::is_section_folded): New function.
7164 (Symbol_table::icf_): New data member.
7165 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7166 * testsuite/Makefile.am: Add commands to build icf_test.
7167 * testsuite/Makefile.in: Regenerate.
7168 * testsuite/icf_test.sh: New file.
7169 * testsuite/icf_test.cc: New file.
7170
7171 2009-07-24 Chris Demetriou <cgd@google.com>
7172
7173 * layout.cc (is_compressible_debug_section): Fix incorrect
7174 comment about compressed section names.
7175
7176 2009-07-20 Ian Lance Taylor <ian@airs.com>
7177
7178 PR 10419
7179 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7180
7181 2009-07-16 Ian Lance Taylor <iant@google.com>
7182
7183 PR 10400
7184 * layout.h: #include <map>.
7185 (class Kept_section): Change from struct to class. Add accessors
7186 and setters. Add section size to Comdat_group mapping. Change
7187 Comdat_group to std::map. Add is_comdat_ field. Add
7188 linkonce_size field in union.
7189 (class Layout): Update declaration of find_or_add_kept_section.
7190 Don't declare find_kept_object.
7191 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7192 parameter. Add object, shndx, is_comdat, and is_group_name
7193 parameters. Change all callers. Adjust for new Kept_section.
7194 (Layout::find_kept_object): Remove.
7195 * object.cc (Sized_relobj::include_section_group): Update use of
7196 Kept_section. Rename secnum to shndx. Only record
7197 Kept_comdat_section if sections are the same size.
7198 (Sized_relobj::include_linkonce_section): Update use of
7199 Kept_section. Only record Kept_comdat_section if sections are the
7200 same size. Set size of linkonce section.
7201 (Sized_relobj::map_to_kept_section): Update call to
7202 get_kept_comdat_section.
7203 * object.h (class Sized_relobj): Rename fields in
7204 Kept_comdat_section to drop trailing underscores; change object
7205 field to Relobj*. Change Kept_comdat_section_table to store
7206 struct rather than pointer.
7207 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7208 Add kept_object and kept_shndx parameters. Change all callers.
7209 (Sized_relobj::get_kept_comdat_section): Change return type to
7210 bool. Add kept_object and kept_shndx parameters. Change all
7211 callers.
7212 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7213 Layout::find_or_add_kept_section.
7214
7215 2009-07-09 Ian Lance Taylor <iant@google.com>
7216
7217 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7218 Reserve space in the hash table.
7219
7220 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7221
7222 * fileread.cc (File_read::get_mtime): New method.
7223 * fileread.h (Timespec): New structure.
7224 (File_read::get_mtime): New method.
7225 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7226 Renamed from timestamp_nsec.
7227 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7228 Elf_Xword.
7229 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7230 timestamp_nsec.
7231 (Incremental_inputs::report_archive): Save mtime; style fix.
7232 (Incremental_inputs::report_obejct): Save mtime; style fix.
7233 (Incremental_inputs::report_script): Save mtime; style fix.
7234 (Incremental_inputs::finalize_inputs): Style fix.
7235 (Incremental_inputs::finalize): Style fix.
7236 (Incremental_inputs::create_input_section_data): Store inputs
7237 mtime.
7238 * incremental.h (Incremental_inputs::report_script): Add mtime
7239 argument.
7240 (Incremental_inputs::Input_info::Input_info): Intialize only one
7241 union member.
7242 (Incremental_inputs::Input_info::archive): Move to nameless
7243 union.
7244 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7245 (Incremental_inputs::Input_info::script): Move to nameless union.
7246 (Incremental_inputs::mtime): New field.
7247 * script.cc (read_input_script): Pass file mtime to
7248 Incremental_input.
7249 * script.h (Script_info::inputs): Style fix.
7250
7251 2009-07-01 Ian Lance Taylor <ian@airs.com>
7252
7253 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7254 instead of 32.
7255
7256 2009-06-24 Ian Lance Taylor <iant@google.com>
7257
7258 PR 10156
7259 * layout.cc (Layout::choose_output_section): If we find an
7260 existing section, update the flags.
7261 (Layout::create_notes): New function, broken out of
7262 Layout::finalize.
7263 (Layout::finalize): Don't create note sections.
7264 (Layout::create_note): Don't crash if linker script discards
7265 section.
7266 (Layout::create_gold_note): Likewise.
7267 (Layout::create_build_id): Likewise. Don't set
7268 after_input_sections on the section.
7269 (Layout::create_executable_stack_info): Remove target parameter.
7270 Change caller.
7271 * layout.h (class Layout): Declare create_notes. Update
7272 declaration of create_executable_stack_info.
7273 * gold.cc (queue_middle_tasks): Call create_notes.
7274 * output.cc (Output_section::update_flags_for_input_section): Move
7275 here from output.h. If SHF_ALLOC flag is newly set, mark address
7276 invalid.
7277 * output.h (Output_data::mark_address_invalid): New function.
7278 (class Output_section): Only declare, not define,
7279 update_flags_for_input_section. Remove set_flags.
7280
7281 2009-06-24 Ian Lance Taylor <iant@google.com>
7282
7283 * script-sections.cc (Output_section_definition::
7284 set_section_addresses): Rename shadowing local load_address to
7285 laddr.
7286
7287 2009-06-24 Ian Lance Taylor <iant@google.com>
7288
7289 PR 10244
7290 * reloc.cc (relocate_sections): Skip empty relocation sections.
7291
7292 2009-06-23 Ian Lance Taylor <iant@google.com>
7293
7294 PR 10156
7295 * layout.cc (Layout::create_note): Use choose_output_section
7296 rather than make_output_section.
7297
7298 2009-06-23 Ian Lance Taylor <iant@google.com>
7299
7300 PR 10237
7301 * options.cc (General_options::parse_V): Set printed_version_.
7302 (General_options::General_options): Initialize printed_version_.
7303 * options.h (class General_options): Add printed_version_ field.
7304 * gold.cc (queue_initial_tasks): If there are no input files,
7305 don't give a fatal error if we printed the version information.
7306 (queue_middle_tasks): If using -r with a shared object, give a
7307 fatal error rather than an ordinary error.
7308
7309 2009-06-23 Ian Lance Taylor <iant@google.com>
7310
7311 PR 10219
7312 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7313 (Layout::make_output_section): Set have_stabstr_section_ if we see
7314 a .stab*str section.
7315 (Layout::finalize): Call link_stabs_sections.
7316 (Layout::link_stabs_sections): New file.
7317 * layout.h (class Layout): Add have_stabstr_section_ field.
7318 Declare link_stabs_sections.
7319
7320 2009-06-23 Doug Kwan <dougkwan@google.com>
7321
7322 * Makefile.am (libgold_a_LIBADD): New.
7323 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7324 * Makefile.in: Regenerate.
7325 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7326 * configure: Regenerate.
7327 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7328 * fileread.cc: Include sys/state.h
7329 * gold.h: Declare memmem and strndup if found missing.
7330 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7331
7332 2009-06-23 Ian Lance Taylor <iant@google.com>
7333
7334 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7335 * configure: Rebuild.
7336
7337 2009-06-23 Ian Lance Taylor <iant@google.com>
7338
7339 PR 10147
7340 * object.cc (Object::section_contents): Don't try to get a view if
7341 the section has length zero.
7342 (Object::handle_gnu_warning_section): If the section is empty, use
7343 the name of the section as the warning.
7344
7345 2009-06-23 Ian Lance Taylor <iant@google.com>
7346
7347 PR 10133
7348 * stringpool.h (class Stringpool_template): Add optimize_ field.
7349 (Stringpool_template::set_optimize): New function.
7350 * stringpool.cc (Stringpool_template::Stringpool_template):
7351 Initialize optimize_ field.
7352 (Stringpool_template::set_string_offsets): Test local optimize
7353 fild rather than parameter.
7354 * layout.cc (Layout::Layout): Call set_optimize on the section
7355 name stringpool.
7356
7357 2009-06-22 Ian Lance Taylor <iant@google.com>
7358
7359 PR 10030
7360 * yyscript.y: Parse TARGET.
7361 * script.cc (script_set_target): New function.
7362 * script-c.h (script_set_target): Declare.
7363 * options.cc (General_options::string_to_object_format): Rename
7364 from string_to_object_format in anonymous namespace. Change
7365 callers.
7366 * options.h (class General_options): Declare
7367 string_to_object_format.
7368
7369 2009-06-22 Ian Lance Taylor <iant@google.com>
7370
7371 * script-sections.cc (Script_sections::create_segments): Don't put
7372 program headers in a PT_LOAD segment if -n or -N.
7373
7374 2009-06-22 Ian Lance Taylor <iant@google.com>
7375
7376 PR 10141
7377 * options.h (class General_options): Add -z lazy and -z now. Sort
7378 -z options into alphabetical order.
7379 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7380
7381 2009-06-21 Ian Lance Taylor <iant@google.com>
7382
7383 * layout.cc (Layout::make_output_section): Call
7384 Target::new_output_section.
7385 (Layout::attach_allocated_section_to_segment): Put large section
7386 sections in a separate load segment with the large segment flag
7387 set.
7388 (Layout::segment_precedes): Sort large data segments after other
7389 load segments.
7390 (align_file_offset): New static function.
7391 (Layout::set_segment_offsets): Use align_file_offset.
7392 * output.h (class Output_section): Add is_small_section_ and
7393 is_large_section_ fields.
7394 (Output_section::is_small_section): New function.
7395 (Output_section::set_is_small_section): New function.
7396 (Output_section::is_large_section): New function.
7397 (Output_section::set_is_large_section): New function.
7398 (Output_section::is_large_data_section): New function.
7399 (class Output_segment): Add is_large_data_segment_ field.
7400 (Output_segment::is_large_data_segment): New function.
7401 (Output_segment::set_is_large_data_segment): New function.
7402 * output.cc (Output_section::Output_section): Initialize new
7403 fields.
7404 (Output_segment::Output_segment): Likewise.
7405 (Output_segment::add_output_section): Add assertion that large
7406 data sections always go in large data segments. Force small data
7407 sections to the end of the list of data sections. Force small BSS
7408 sections to the start of the list of BSS sections. For large BSS
7409 sections to the end of the list of BSS sections.
7410 * symtab.h (class Symbol): Declare is_common_shndx.
7411 (Symbol::is_defined): Check Symbol::is_common_shndx.
7412 (Symbol::is_common): Likewise.
7413 (class Symbol_table): Define enum Commons_section_type. Update
7414 declarations. Add small_commons_ and large_commons_ fields.
7415 * symtab.cc (Symbol::is_common_shndx): New function.
7416 (Symbol_table::Symbol_table): Initialize new fields.
7417 (Symbol_table::add_from_object): Put small and large common
7418 symbols in the right list.
7419 (Symbol_table::sized_finalized_symbol): Check
7420 Symbol::is_common_shndx.
7421 (Symbol_table::sized_write_globals): Likewise.
7422 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7423 common symbol lists. Don't call do_allocate_commons_list if the
7424 list is empty.
7425 (Symbol_table::do_allocate_commons_list): Remove is_tls
7426 parameter. Add comons_section_type parameter. Change all
7427 callers. Handle small and large common symbols.
7428 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7429 Symbol::is_common_shndx.
7430 * resolve.cc (symbol_to_bits): Likewise.
7431 * target.h (Target::small_common_shndx): New function.
7432 (Target::small_common_section_flags): New function.
7433 (Target::large_common_shndx): New function.
7434 (Target::large_common_section_flags): New function.
7435 (Target::new_output_section): New function.
7436 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7437 small_common_section_flags, and large_common_section_flags
7438 fields.
7439 (Target::do_new_output_section): New virtual function.
7440 * arm.cc (Target_arm::arm_info): Initialize new fields.
7441 * i386.cc (Target_i386::i386_info): Likewise.
7442 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7443 Likewise.
7444 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7445 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7446 (Target_x86_64::do_new_output_section): New function.
7447 * configure.ac: Define conditional MCMODEL_MEDIUM.
7448 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7449 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7450 (large_LDFLAGS): Define.
7451 * testsuite/large.c: New file.
7452 * testsuite/testfile.cc (Target_test::test_target_info):
7453 Initialize new fields.
7454 * configure, testsuite/Makefile.in: Rebuild.
7455
7456 2009-06-05 Doug Kwan <dougkwan@google.com>
7457
7458 * Makefile.am (CCFILES): Add target.cc.
7459 * Makefile.in: Regenerate.
7460 * i386.cc (class Target_i386): Define new virtual method to
7461 override do_is_local_label_name in parent.
7462 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7463 local symbols if --discard-locals or -X is given.
7464 * options.h (class General_options): Declare new options
7465 '--discard-locals' and '-X' for discarding locals.
7466 * target.h (class Target): Define new methods is_local_label_name.
7467 Declare new virtual method do_is_local_label_name.
7468 * target.cc: New file.
7469 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7470 (check_SCRIPTS): Add discard_locals_test.sh.
7471 (check_DATA): Add discard_local_tests.syms.
7472 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7473 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7474 * testsuite/Makefile.in: Regenerate.
7475 * testsuite/discard_locals_test.c: New file.
7476 * testsuite/discard_locals_test.sh: Same.
7477
7478 2009-06-05 Doug Kwan <dougkwan@google.com>
7479
7480 * object.cc (Sized_relobj::Sized_relobj): Initialize
7481 discarded_eh_frame_shndx_ to -1U.
7482 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7483 section.
7484 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7485 a discarded .eh_frame section.
7486 (Sized_relobj::do_finalize_local_symbols): Ditto.
7487 * object.h (class Sized_relobj): Declare new member
7488 discarded_eh_frame_shndx_.
7489 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7490 (local_labels_test.o, local_labels_test): New rules.
7491 * testsuite/Makefile.in: Regenerate.
7492
7493 2009-06-04 Doug Kwan <dougkwan@google.com>
7494
7495 * layout.cc (Layout::section_name_mapping): Add mapping for
7496 special ARM sections.
7497
7498 2009-06-03 Doug Kwan <dougkwan@google.com>
7499
7500 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7501 (utils::has_overflow): Same.
7502
7503 2009-06-03 Ian Lance Taylor <iant@google.com>
7504
7505 * layout.cc (Layout::section_name_mapping): New array, replacing
7506 Layout::linkonce_mapping.
7507 (Layout::section_name_mapping_count): New variable, replacing
7508 Layout::linkonce_mapping_count.
7509 (Layout::linkonce_output_name): Remove.
7510 (Layout::output_section_name): Rewrite.
7511 * layout.h (class Layout): Rename Linkonce_mapping to
7512 Section_name_mapping, linkonce_mapping to section_name_mapping,
7513 linkonce_mapping_count to section_name_mapping_count. Don't
7514 declare linkonce_output_name.
7515
7516 2009-06-03 Doug Kwan <dougkwan@google.com>
7517
7518 * gold/arm.cc (namespace utils): New.
7519 (Target_arm::reloc_is_non_pic): Define new method.
7520 (class Arm_relocate_functions): New.
7521 (Target_arm::Relocate::relocate): Handle relocation types used by
7522 Android.
7523
7524 2009-06-03 Ian Lance Taylor <iant@google.com>
7525
7526 * arm.cc (Target_arm::scan::global): Use || instead of |.
7527
7528 2009-06-02 Doug Kwan <dougkwan@google.com>
7529
7530 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7531 issued_non_pic_error_.
7532 (class Target_arm::Scan): Declare new method check_non_pic.
7533 Define new method symbol_needs_plt_entry.
7534 Declare new data member issued_non_pic_error_.
7535 (class Target_arm::Relocate): Declare new method
7536 should_apply_static_reloc.
7537 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7538 (Target_arm::Scan::check_non_pic): Define new method.
7539 (Target_arm::Scan::local): Handle a small subset of reloc types used
7540 by Android.
7541 (Target_arm::Scan::local): Same.
7542 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7543
7544 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7545
7546 * incremental.cc (Incremental_inputs::report_command_line): Filter
7547 out --incremental-* options.
7548
7549 2009-05-29 Doug Kwan <dougkwan@google.com>
7550
7551 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7552 template class.
7553 (class Target_arm): Update comment.
7554 (Target_arm::Target_arm): Initialize new data members GOT_,
7555 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7556 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7557 and Target_arm::rel_dyn_section.
7558 Declare new_enum Target_arm::Got_type.
7559 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7560 and DYNBSS_.
7561 Update commments for member do_dynsym_value.
7562 (Target_arm::got_size, Target_arm::plt_section,
7563 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7564 new methods inside class defintion.
7565 (Target_arm::got_section): Define new method.
7566 (Target_arm::rel_dyn_section): Same.
7567 (Output_data_plt_arm): New template class.
7568 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7569 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7570 (Output_data_plt_arm::add_entry): Same.
7571 (Output_data_plt_arm::first_plt_entry): Define new
7572 static data member for PLT instruction template.
7573 (Output_data_plt_arm::plt_entry): Same.
7574 (Output_data_plt_arm::do_write): Define new method.
7575 (Target_arm::make_plt_entry): Same.
7576 (Target_arm::do_finalize_sections): Same.
7577 (Target_arm::do_dynsym_value): Same.
7578
7579 2009-05-28 Doug Kwan <dougkwan@google.com>
7580
7581 * Makefile.am (TARGETSOURCES): Add arm.cc.
7582 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7583 * Makefile.in: Regenerate.
7584 * arm.cc: New file.
7585 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7586
7587 2009-05-26 Doug Kwan <dougkwan@google.com>
7588
7589 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7590 (General_options::check_excluded_libs): Strip off directories in
7591 archive name before matching like GNU ld does.
7592 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7593 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7594 (exclude_libs_test_LDFLAGS): Add linker option
7595 -Wl,--exclude-libs,libexclude_libs_test_3
7596 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7597 an explicit archive without using -l.
7598 (alt/libexclude_libs_test_3.a): New make rule.
7599 * testsuite/Makefile.in: Regenerate.
7600 * testsuite/exclude_libs_test.c : Declare lib3_default().
7601 (main): Call it.
7602 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7603 * exclude_libs_test_3.c: New file.
7604
7605 2009-05-26 Nick Clifton <nickc@redhat.com>
7606
7607 * po/id.po: New Indonesian translation.
7608 * po/gold.pot: Updated template file.
7609
7610 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7611
7612 * testsuite/Makefile.am: Add -ffunction-sections to compile
7613 gc_comdat_test files. Add -Wl,--gc-sections to build
7614 gc_comdat_test.
7615 * testsuite/Makefile.in: Regenerate.
7616 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7617
7618 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7619
7620 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7621 kept comdat section was garbage collected.
7622 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7623 * testsuite/Makefile.in: Regenerate.
7624 * testsuite/gc_comdat_test.sh: New file.
7625 * testsuite/gc_comdat_test_1.cc: New file.
7626 * testsuite/gc_comdat_test_2.cc: New file.
7627
7628 2009-05-19 Doug Kwan <dougkwan@google.com>
7629
7630 * archive.cc (Archive::Archive): Move constructor from archive.h
7631 to here. Initialize no_export_.
7632 (Archive::get_elf_object_for_member): Set no_export flag of object.
7633 * archive.h (Archive::Archive): Move constructor body to
7634 archive.cc.
7635 (Archive::no_export): New method.
7636 (Archive::no_export_): New field.
7637 * object.h (Object::Object): Initialize no_export_ to false.
7638 (Object::no_export, Object::set_no_export): New methods.
7639 (Object::no_export_): New field.
7640 * options.cc (General_options::parse_exclude_libs): New method.
7641 (General_options::check_excluded_libs) Same.
7642 * options.h (exclude_libs): New option.
7643 (General_options::check_excluded_libs): New method declaration.
7644 (General_options::excluded_libs_): New field.
7645 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7646 default or protected visibility if an object has no-export flag set.
7647 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7648 (check_SCRIPTS): Add exclude_libs_test.sh.
7649 (check_DATA): Add exclude_libs_test.syms.
7650 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7651 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7652 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7653 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7654 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7655 libexclude_libs_test_2.a): New rules.
7656 * testsuite/Makefile.in: Regenerate.
7657 * testsuite/exclude_libs_test.c: New file.
7658 * testsuite/exclude_libs_test.sh: Ditto.
7659 * testsuite/exclude_libs_test_1.c: Ditto.
7660 * testsuite/exclude_libs_test_2.c: Ditto.
7661
7662 2009-05-15 Ian Lance Taylor <iant@google.com>
7663
7664 * configure.ac: Check for declarations for cases where libiberty.h
7665 checks HAVE_DECL_xxx.
7666 * configure, config.in: Rebuild.
7667
7668 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7669
7670 * gold.h (Incremental_argument_list): Remove (invalid) forward
7671 declaration.
7672 * incremental.cc (Incremental_inputs::report_achive): New method.
7673 (Incremental_inputs::report_object): New method.
7674 (Incremental_inputs::report_script): New method.
7675 (Incremental_inputs::finalize_inputs): New method.
7676 (Incremental_inputs::finalize): Call finalize_inputs().
7677 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7678 Create inputs entries.
7679 * incremental.h (Incremental_input_type): New enum.
7680 (Incremental_inputs::Incremental_input): Initialize new fields.
7681 (Incremental_inputs::report_inputs): New method.
7682 (Incremental_inputs::report_achive): New method.
7683 (Incremental_inputs::report_object): New method.
7684 (Incremental_inputs::report_script): New method.
7685 (Incremental_inputs::finalize_inputs): New method.
7686 (Incremental_inputs::Input_info): New struct.
7687 (Incremental_inputs::Input_info_map): New typedef.
7688 (Incremental_inputs::lock_): New field.
7689 (Incremental_inputs::Inputs_): New field.
7690 (Incremental_inputs::Inputs_map): New field.
7691 * main.cc (main): Call Incremental_input::report_inputs.
7692 * options.h (Input_argument_list): Typedef moved from
7693 Input_arguments.
7694 (Input_file_group::Files): Remove, use ::Input_argument_list.
7695 (Input_file_group::Input_argument_list): Remove, use
7696 ::Input_argument_list.
7697 * plugin.cc (Plugin_manager::add_input_file): Add error in
7698 incremental build.
7699 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7700 functions.
7701 * script.cc (read_input_script): Call
7702 Incremental_input::report_script.
7703 * script.h (Script_info): New class.
7704
7705 2009-04-27 Ian Lance Taylor <iant@google.com>
7706
7707 * x86_64.cc (do_adjust_output_section): Set entsize to
7708 plt_entry_size.
7709
7710 2009-04-23 Elliott Hughes <enh@google.com>
7711
7712 * output.cc (Output_file::close): After short writes, continue
7713 writing from the correct offset in the buffer being written.
7714
7715 2009-04-23 Chris Demetriou <cgd@google.com>
7716
7717 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7718 * configure: Regenerate.
7719 * config.in: Regenerate.
7720 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7721 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7722
7723 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7724
7725 * incremental.cc (Incremental_inputs_header_data): Renamed from
7726 Incremental_input_header_data.
7727 (Incremental_inputs_header_data::data_size): New field.
7728 (Incremental_inputs_header_data::put_input_file_count): Renamed
7729 from input_file_count.
7730 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7731 from command_line_offset.
7732 (Incremental_inputs_header_data::put_reserved): Renamed from
7733 put_reserved.
7734 (Incremental_inputs_entry_data): Renamed from
7735 Incremental_input_entry_data.
7736 (Incremental_inputs_entry_data::data_size): New field.
7737 (Incremental_inputs::report_command_line): New method.
7738 (Incremental_inputs::finalize): New method.
7739 (Incremental_inputs::create_incremental_inputs_data): New method.
7740 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7741 * incremental.h: New file.
7742 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7743 (Layout::finalize): Create incremental inputs section in
7744 incremental builds.
7745 (Layout::create_incremental_info_sections): New method.
7746 * layout.h (Layout::incremental_inputs): New method.
7747 (Layout::create_incremental_info_sections): New method.
7748 (Layout::incremental_inputs_): New field.
7749 * main.cc (main): Notify Incremental_input of the command line.
7750
7751 2009-04-01 Ian Lance Taylor <iant@google.com>
7752 Mikolaj Zalewski <mikolajz@google.com>
7753
7754 * gold.h (reserve_unordered_map): Define, three versions, one for
7755 each version of Unordered_map.
7756 * layout.cc (Layout::Layout): Remove options parameter. Add
7757 number_of_input_files parameter. Don't initialize options_.
7758 Initialize number_of_input_files_ and resized_signatures_. Move
7759 sections_are_attached_.
7760 (Layout::layout_group): Reserve space for group_signatures_.
7761 (Layout::find_or_add_kept_section): Change name parameter to be a
7762 reference. Resize signatures_ map when it gets large enough.
7763 (Layout::layout_eh_frame): Use parameters->options() instead of
7764 this->options_.
7765 (Layout::make_output_section): Likewise.
7766 (Layout::attach_allocated_section_to_segment): Likewise.
7767 (Layout::finalize, Layout::create_executable_stack): Likewise.
7768 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7769 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7770 * layout.h (class Layout): Update declarations. Remove options_
7771 field. Add number_of_input_files_ and resized_signatures_
7772 fields. Move sections_are_attached_ field.
7773 * main.cc (main): Pass number of input files to Layout
7774 constructor. Don't pass options.
7775
7776 2009-03-30 Ian Lance Taylor <iant@google.com>
7777
7778 * ffsll.c (ffsll): Correct implementation.
7779
7780 2009-03-27 Ian Lance Taylor <iant@google.com>
7781
7782 * ffsll.c: New file.
7783 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7784 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7785 * ftruncate.c (ftruncate): Declare before definition.
7786 * mremap.c (mremap): Likewise.
7787 * pread.c (pread): Likewise.
7788 * configure, Makefile.in, config.in: Rebuild.
7789
7790 * mremap.c: New file.
7791 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7792 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7793 (mremap): Declare if HAVE_MREMAP is not defined.
7794 * configure, Makefile.in, config.in: Rebuild.
7795
7796 2009-03-27 Cary Coutant <ccoutant@google.com>
7797
7798 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7799 position independent.
7800 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7801 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7802
7803 2009-03-24 Cary Coutant <ccoutant@google.com>
7804
7805 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7806 an executable.
7807 (needs_dynamic_reloc): Likewise.
7808
7809 2009-03-24 Ian Lance Taylor <iant@google.com>
7810
7811 * yyscript.y (file_cmd): Recognize EXTERN.
7812 (extern_name_list, extern_name_list_body): New nonterminals.
7813 * script.cc (script_add_extern): Define.
7814 * script-c.h (script_add_extern): Declare.
7815
7816 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
7817
7818 * object.cc (is_elf_object): Define.
7819 * object.h (is_elf_object): Declare.
7820 * archive.cc (Archive::get_elf_object_for_member): Call
7821 is_elf_object.
7822 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7823
7824 2009-03-24 Elliott Hughes <enh@google.com>
7825
7826 * output.cc (Output_file::map_anonymous): Define.
7827 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7828 try an anonymous one. Report the size if the mmap fails.
7829 * output.h (class Output_file): Declare map_anonymous.
7830
7831 2009-03-24 Ian Lance Taylor <iant@google.com>
7832
7833 * target-select.cc (instantiate_target): Don't acquire the lock if
7834 the instantiated_target_ field has already been set.
7835
7836 2009-03-23 Ian Lance Taylor <iant@google.com>
7837
7838 * gold-threads.h (class Initialize_lock): Define.
7839 * gold-threads.cc (class Initialize_lock_once): Define.
7840 (initialize_lock_control): New static variable.
7841 (initialize_lock_pointer): New static variable.
7842 (initialize_lock_once): New static function.
7843 (Initialize_lock::Initialize_lock): Define.
7844 (Initialize_lock::initialize): Define.
7845 * target-select.h: Include "gold-threads.h".
7846 (class Target_selector): Add lock_ and initialize_lock_ fields.
7847 Don't define instantiate_target, just declare it.
7848 * target-select.cc (Target_selector::Target_selector): Initialize
7849 new fields.
7850 (Target_selector::instantiate_target): Define.
7851 * descriptors.h: Include "gold-threads.h".
7852 (class Descriptors): Add initialize_lock_ field.
7853 * descriptors.cc (Descriptors::Descriptors): Initialize new
7854 field.
7855 (Descriptors::open): Use initialize_lock_ field
7856 * errors.h (class Errors): Add initialize_lock_ field.
7857 * errors.cc (Errors::Errors): Initialize new field.
7858 (Errors::initialize_lock): Use initialize_lock_ field.
7859 * powerpc.cc (class Target_selector_powerpc): Remove
7860 instantiated_target_ field. In do_recognize call
7861 instantiate_target rather than do_instantiate_target. In
7862 do_instantiate_target just allocate a new target.
7863 * sparc.cc (class Target_selector_sparc): Likewise.
7864
7865 * freebsd.h: New file.
7866 * i386.cc: Include "freebsd.h".
7867 (Target_i386): Derive from Target_freebsd rather than
7868 Sized_target.
7869 (Target_selector_i386): Derive from Target_selector_freebsd rather
7870 than Target_selector.
7871 * x86_64.cc: Include "freebsd.h".
7872 (Target_x86_64): Derive from Target_freebsd rather than
7873 Sized_target.
7874 (Target_selector_x86_64): Derive from Target_selector_freebsd
7875 rather than Target_selector.
7876 * target.h (class Target): Add adjust_elf_header and
7877 do_adjust_elf_header.
7878 * output.cc (Output_file_header:: do_sized_write): Call target
7879 adjust_elf_header routine.
7880 * configure.tgt: Set targ_osabi.
7881 * configure.ac: Define GOLD_DEFAULT_OSABI.
7882 * parameters.cc (Parameters::default_target): Pass
7883 GOLD_DEFAULT_OSABI to select_target.
7884 * target-select.h (class Target_selector): Make instantiate_target
7885 protected rather than private.
7886 * Makefile.am (HFILES): Add freebsd.h.
7887 * configure, Makefile.in, config.in: Rebuild.
7888
7889 * merge.cc (do_add_input_section): Correct pend value. Change
7890 message about last entry not being null terminated from error to
7891 warning.
7892
7893 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7894
7895 * incremental.cc: New file.
7896 * Makefile.am (CCFILES): Add incremental.cc.
7897 * Makefile.in: Rebuild.
7898
7899 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7900
7901 * layout.cc (Layout::output_section_name): Preserve names
7902 of '.note.' sections.
7903
7904 2009-03-19 Ian Lance Taylor <iant@google.com>
7905
7906 * descriptors.cc (Descriptors::open): Check that the options are
7907 valid before using them.
7908
7909 2009-03-18 Ian Lance Taylor <iant@google.com>
7910
7911 * script-sections.h: Include <list>.
7912 (class Script_sections): Change Sections_elements from std::vector
7913 to std::list. Typedef public Elements_iterator. Add
7914 orphan_section_placement_, data_segment_align_start_, and
7915 saw_data_segment_align_ fields. Remove data_segment_align_index_
7916 field.
7917 * script-sections.cc (class Orphan_section_placement): New class.
7918 (class Sections_element): Add virtual functions is_relro and
7919 orphan_section_init. Remove virtual function place_orphan_here.
7920 (class Output_section_definition): Add is_relro and
7921 orphan_section_init. Remove place_orphan_here.
7922 (class Orphan_output_section): Likewise.
7923 (Script_sections::Script_sections): Update for field changes.
7924 (Script_sections::data_segment_align): Set saw_data_segment_align_
7925 and data_segment_align_start_, not data_segment_align_index.
7926 (Script_sections::data_segment_relro_end): Check
7927 saw_data_segment_align_. Use data_segment_align_start_ rather
7928 than data_segment_align_index_.
7929 (Script_sections::place_orphan): Rewrite to use
7930 Orphan_section_placement.
7931
7932 2009-03-17 Ian Lance Taylor <iant@google.com>
7933
7934 * archive.cc (Archive::add_symbols): Check for a version attached
7935 to the symbol name in the archive map.
7936 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7937 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7938 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7939 (ver_test_11.a): New target.
7940 * testsuite/Makefile.in: Rebuild.
7941
7942 * configure.ac: Check for chsize and posix_fallocate. Replace
7943 ftruncate.
7944 * ftruncate.c: New file, from gnulib.
7945 * output.cc (posix_fallocate): Define dummy version if not
7946 HAVE_POSIX_FALLOCATE.
7947 (Output_file::map): Call posix_fallocate rather than lseek and
7948 write.
7949 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7950 * configure, Makefile.in, config.in: Rebuild.
7951
7952 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
7953
7954 * layout.h (Layout::create_note): Add section_name parameter.
7955 * layout.cc (Layout::create_note): Likewise.
7956 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7957
7958 2009-03-17 Ian Lance Taylor <iant@google.com>
7959
7960 * descriptors.cc: Include "options.h".
7961 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7962 (Descriptors::open): Always use O_CLOEXEC when opening a new
7963 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7964 then set FD_CLOEXEC.
7965
7966 * sparc.cc (class Target_sparc): Add has_got_section.
7967 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7968 make sure we have a GOT section.
7969
7970 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7971 (Target_sparc::Scan::local): Likewise.
7972 (Target_sparc::Scan::global): Likewise.
7973 (Target_sparc::Relocate::relocate): Likewise.
7974 (Target_sparc::Relocate::relocate_tls): Likewise.
7975
7976 * symtab.cc (Symbol_table::define_default_version): New function,
7977 broken out of add_from_object.
7978 (Symbol_table::add_from_object): Call define_default_version.
7979 (Symbol_table::define_special_symbol): Add resolve_oldsym
7980 parameter. Change all callers. If the version for a symbol comes
7981 from a version script, resolve it with the symbol with the same
7982 name with no version. Also add the symbol without a version if
7983 appropriate.
7984 (do_define_in_output_data): If resolving with oldsym, don't delete
7985 sym.
7986 (do_define_in_output_segment): Likewise.
7987 (do_define_as_constant): Likewise.
7988 * symtab.h (class Symbol_table): Update declarations.
7989
7990 2009-03-13 Ian Lance Taylor <iant@google.com>
7991
7992 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7993 (Read_symbols::requeue): New function.
7994 (Read_symbols::do_read_symbols): If make_elf_object fails because
7995 the target type is not configured, and the file was searched for,
7996 issue a warning and retry with the next directory.
7997 (Add_symbols::run): If the file has an incompatible format, and
7998 it was searched for, requeue the Read_symbols task. On error,
7999 release the object.
8000 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8001 dirindex parameter to constructor. Change all callers. Declare
8002 incompatible_warning and requeue.
8003 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8004 input_argument_ and input_group_ fields. Add them to
8005 constructor. Change all callers.
8006 (class Read_script): Add dirindex_ field. Add it to constructor.
8007 Change all callers.
8008 * archive.cc (Archive::setup): Remove input_objects parameter.
8009 Change all callers.
8010 (Archive::get_file_and_offset): Likewise.
8011 (Archive::read_all_symbols): Likewise.
8012 (Archive::read_symbols): Likewise.
8013 (Archive::get_elf_object_for_member): Remove input_objects
8014 parameter. Add punconfigured parameter. Change all callers.
8015 (Archive::add_symbols): Change return type to bool. Check return
8016 value of include_member.
8017 (Archive::include_all_members): Likewise.
8018 (Archive::include_member): Change return type to bool. Return
8019 false if first included object has incompatible target. Set
8020 included_member_ field.
8021 (Add_archive_symbols::run): If add_symbols returns false, requeue
8022 Read_symbols task.
8023 * archive.h (class Archive): Add included_member_ field.
8024 Initialize it in constructor. Add input_file and searched_for
8025 methods. Update declarations.
8026 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8027 input_argument_ fields. Add them to constructor. Change all
8028 callers.
8029 * script.cc: Include "target-select.h".
8030 (class Parser_closure): Add skip_on_incompatible_target_ and
8031 found_incompatible_target_ fields. Add
8032 skip_on_incompatible_target parameter to constructor. Change all
8033 callers. Add methods skip_on_incompatible_target,
8034 clear_skip_on_incompatible_target, found_incompatible_target, and
8035 set_found_incompatible_target.
8036 (read_input_script): Add dirindex parameter. Change all callers.
8037 If parser finds an incompatible target, requeue Read_symbols
8038 task.
8039 (script_set_symbol): Clear skip_on_incompatible_target in
8040 closure.
8041 (script_add_assertion, script_parse_option): Likewise.
8042 (script_start_sections, script_add_phdr): Likewise.
8043 (script_check_output_format): New function.
8044 * script.h (read_input_script): Update declaration.
8045 * script-c.h (script_check_output_format): Declare.
8046 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8047 (ignore_cmd): Remove OUTPUT_FORMAT.
8048 * fileread.cc (Input_file::Input_file): Add explicit this.
8049 (Input_file::will_search_for): New function.
8050 (Input_file::open): Add pindex parameter. Change all callers.
8051 * fileread.h (class Input_file): Add input_file_argument method.
8052 Declare will_search_for. Update declarations.
8053 * object.cc (make_elf_object): Add punconfigured parameter.
8054 Change all callers.
8055 * object.h (class Object): Make input_file public. Add
8056 searched_for method.
8057 (make_elf_object): Update declaration.
8058 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8059 restart search.
8060 * dirsearch.h (class Dirsearch): Update declaration.
8061 * options.h (class General_options): Add --warn-search-mismatch.
8062 * parameters.cc (Parameters::is_compatible_target): New function.
8063 * parameters.h (class Parameters): Declare is_compatible_target.
8064 * workqueue.cc (Workqueue::add_blocker): New function.
8065 * workqueue.h (class Workqueue): Declare add_blocker.
8066
8067 * fileread.cc (Input_file::open): Remove options parameter.
8068 Change all callers.
8069 (Input_file::open_binary): Likewise.
8070 * script.cc (read_input_script): Likewise.
8071 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8072 options parameter from constructor. Change all callers.
8073 (class Read_script): Likewise.
8074 * fileread.h (class Input_file): Update declarations.
8075 * script.h (read_input_script): Update declaration.
8076
8077 2009-03-10 Nick Clifton <nickc@redhat.com>
8078
8079 * po/es.po: New Spanish translation.
8080
8081 2009-03-06 Cary Coutant <ccoutant@google.com>
8082
8083 * options.cc (parse_short_option): Keep dash_z from registering itself.
8084
8085 2009-03-03 Ian Lance Taylor <iant@google.com>
8086
8087 PR 9918
8088 * target-reloc.h (relocate_section): Pass output_section to
8089 relocate.
8090 * i386.cc (Target_i386::should_apply_static_reloc): Add
8091 output_section parameter. Change all callers.
8092 (Target_i386::Relocate::relocate): Add output_section parameter.
8093 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8094 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8095 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8096 * testsuite/two_file_shared.sh: New script.
8097 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8098 (check_DATA): Add two_file_shared.dbg.
8099 (two_file_shared.dbg): New target.
8100 * testsuite/Makefile.in: Rebuild.
8101
8102 2009-03-01 Ian Lance Taylor <iant@google.com>
8103
8104 * configure.ac: Check for byteswap.h.
8105 * configure: Rebuild.
8106 * config.in: Rebuild.
8107
8108 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8109
8110 * layout.cc (Layout::find_or_add_kept_section): New function.
8111 (Layout::add_comdat): Removed.
8112 * layout.h (struct Kept_section): Move out of class Layout.
8113 Remove trailing underscores from field names. Add group_sections
8114 field. Rename group_ field to is_group. Change all uses.
8115 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8116 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8117 comdat_groups_ field.
8118 (Sized_relobj::include_section_group): Use
8119 find_or_add_kept_section and Kept_section::group_sections.
8120 (Sized_relobj::include_linkonce_section): Likewise.
8121 * object.cc (class Sized_relobj): Don't define Comdat_group or
8122 Comdat_group_table. Remove find_comdat_group and
8123 add_comdat_group. Remove comdat_groups_ field.
8124 * plugin.cc (include_comdat_group): Use
8125 Layout::find_or_add_kept_section.
8126
8127 2009-02-28 Ian Lance Taylor <iant@google.com>
8128
8129 * README: --gc-sections and map files are now supported. Document
8130 some build requirements.
8131
8132 PR 6992
8133 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8134 relocatable link set the value of the section symbol to zero.
8135 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8136 relocatable link don't include the section address in the local
8137 symbol value.
8138
8139 2009-02-27 Ian Lance Taylor <iant@google.com>
8140
8141 PR 6811
8142 * options.h (class Search_directory): Add is_system_directory.
8143 (class General_options): Declare is_in_system_directory.
8144 * options.cc (get_relative_sysroot): Make static.
8145 (get_default_sysroot): Make static.
8146 (General_optoins::is_in_system_directory): New function.
8147 * fileread.cc (Input_file::is_in_system_directory): New function.
8148 * fileread.h (class Input_file): Declare is_in_system_directory.
8149 * object.h (class Object): Add is_in_system_directory.
8150 (class Input_objects): Remove system_library_directory_ field.
8151 * object.cc (Input_objects::add_object): Don't set
8152 system_library_directory_.
8153 (input_objects::found_in_system_library_directory): Remove.
8154 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8155 parameter. Change all callers.
8156 (Symbol_table::sized_write_globals): Likewise.
8157 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8158 Call Object::is_in_system_directory.
8159 * symtab.h (class Symbol_table): Update declarations.
8160
8161 PR 5990
8162 * descriptors.h (Open_descriptor): Add is_on_stack field.
8163 * descriptors.cc (Descriptors::open): If the descriptor is on the
8164 top of the stack, remove it. Initialize is_on_stack field.
8165 (Descriptors::release): Only add pod to stack if it is not on the
8166 stack already.
8167 (Descriptors::close_some_descriptor): Clear stack_next and
8168 is_on_stack fields.
8169
8170 PR 7091
8171 * output.cc (Output_section::find_starting_output_address): Rename
8172 from starting_output_address; add PADDR parameter; change return
8173 type.
8174 * output.h (class Output_section): Declare
8175 find_starting_output_address instead of starting_output_address.
8176 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8177 section symbol for which we can't find a merge section.
8178
8179 PR 9836
8180 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8181 hidden or internal, force the symbol to be local.
8182 * resolve.cc (Symbol::override_visibility): Define.
8183 (Symbol::override_base): Use override_visibility.
8184 (Symbol_table::resolve): Likewise.
8185 (Symbol::override_base_with_special): Likewise.
8186 (Symbol_table::override_with_special): If the visibility is hidden
8187 or internal, force the symbol to be local.
8188 * symtab.h (class Symbol): Add set_visibility and
8189 override_visibility.
8190 * testsuite/ver_test_1.sh: New file.
8191 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8192 (check_DATA): Add ver_test_1.syms.
8193 (ver_test_1.syms): New target.
8194 * testsuite/Makefile.in: Rebuild.
8195
8196 2009-02-25 Cary Coutant <ccoutant@google.com>
8197
8198 * layout.cc (Layout::choose_output_section): Don't rename sections
8199 when using a linker script that has a SECTIONS clause.
8200 * Makefile.in: Regenerate.
8201
8202 * testsuite/Makefile.am (script_test_5.sh): New test case.
8203 * testsuite/Makefile.in: Regenerate.
8204 * testsuite/script_test_5.cc: New file.
8205 * testsuite/script_test_5.sh: New file.
8206 * testsuite/script_test_5.t: New file.
8207
8208 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8209
8210 * archive.cc (Archive::include_member): Update calls to add_symbols.
8211 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8212 the Layout argument.
8213 * dynobj.h (do_add_symbols): Add the Layout argument.
8214 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8215 Layout argument.
8216 * object.h (Object::add_symbols): Add the Layout argument.
8217 (Object::do_add_symbols): Add the Layout argument.
8218 (Sized_relobj::do_add_symbols): Add the Layout argument.
8219 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8220 Unify the two versions.
8221 (Add_plugin_symbols): Remove.
8222 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8223 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8224 (Add_plugin_symbols): Remove.
8225 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8226 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8227 (Add_symbols::run): Make it work with Pulginobj.
8228
8229 2009-02-06 Ian Lance Taylor <iant@google.com>
8230
8231 * object.cc (Sized_relobj::do_layout): Make info message start
8232 with lower case letter.
8233
8234 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8235
8236 * binary.cc: Fix file comment.
8237
8238 * options.h (enum Incremental_disposition): Define.
8239 (class General_options): Add new options: --incremental,
8240 --incremental_changed, --incremental_unchanged,
8241 --incremental_unknown. Add incremental_disposition_ and
8242 implicit_incremental_ fields.
8243 (General_options::incremental_disposition): New function.
8244 (class Position_dependent_options): Add incremental_disposition
8245 option.
8246 (Position_dependent_options::copy_from_options): Set incremental
8247 dispositions.
8248 * options.cc (General_options::parse_incremental_changed): New
8249 function.
8250 (General_options::parse_incremental_unchanged): New function.
8251 (General_options::parse_incremental_unknown): New function.
8252 (General_options::General_options): Initialize new fields
8253 incremental_disposition_ and implicit_incremental_.
8254 (General_options::finalize): Check for uasge of --incremental-*
8255 without --incremental.
8256
8257 2009-02-06 Chris Demetriou <cgd@google.com>
8258
8259 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8260 pointer and to report location as the file name associated with
8261 the symbol.
8262 (gold_undefined_symbol_at_location): New function to replace the
8263 old gold_undefined_symbol functionality.
8264 * target-reloc.h (relocate_section): Update to use
8265 gold_undefined_symbol_at_location.
8266 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8267 Call gold_undefined_symbol function rather than gold_error.
8268 * errors.h (Errors::undefined_symbol): Take location as a
8269 string, rather than calculating it from a relocation.
8270 * errors.cc (Errors::fatal): Print "fatal error:" before the
8271 formatted message.
8272 (Errors::error, Errors::error_at_location): Print "error: "
8273 before the formatted message.
8274 (Errors::undefined_symbol): Take location as a string, rather
8275 than calculating it from a relocation.
8276 (gold_undefined_symbol_at_location): New function akin to
8277 old gold_undefined_symbol, calculates location from relocation.
8278 (gold_undefined_symbol): Change to take only a Symbol pointer
8279 and to report location as the file name associated with the symbol.
8280 * testsuite/debug_msg.sh: Update for changed error messages.
8281 * testsuite/undef_symbol.sh: Likewise.
8282
8283 2009-02-04 Duncan Sands <baldrick@free.fr>
8284
8285 PR 9812
8286 * reduced_debug_output.h
8287 (Output_reduced_debug_abbrev_section::failed): Use format for
8288 gold_warning.
8289 (Output_reduced_debug_info_section::faild): Likewise.
8290
8291 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8292
8293 * script.cc (Lazy_demangler): New class.
8294 (Version_script_info::get_symbol_version_helper): Demangle a
8295 symbol only once.
8296
8297 2009-01-29 Cary Coutant <ccoutant@google.com>
8298
8299 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8300 to __tls_get_addr.
8301 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8302
8303 2009-01-28 Ian Lance Taylor <iant@google.com>
8304
8305 * version.cc (version_string): Bump to 1.9.
8306
8307 * gold.h: Include <cstring> and <stdint.h>.
8308 * version.cc: Include <cstdio>.
8309 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8310 warning.
8311 * reduced_debug_output.cc (insert_into_vector): Rename from
8312 Insert_into_vector; change all callers. Use Swap_unaligned to
8313 avoid aliasing issue; remove union since it is unnecessary.
8314
8315 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8316
8317 * Makefile.am (CCFILES): Add gc.cc.
8318 (HFILES): Add gc.h.
8319 * Makefile.in: Regenerate.
8320 * gold.cc (Gc_runner): New class.
8321 (queue_initial_tasks): Call garbage collection related tasks
8322 when corresponding options are invoked.
8323 (queue_middle_gc_tasks): New function.
8324 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8325 processed early before laying out sections during garbage collection.
8326 * gold.h (queue_middle_gc_tasks): New function.
8327 (is_prefix_of): Move from "layout.cc".
8328 * i386.cc (Target_i386::gc_process_relocs): New function.
8329 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8330 * main.cc (main): Create object of class "Garbage_collection".
8331 * object.cc (Relobj::copy_symbols_data): New function.
8332 (Relobj::is_section_name_included): New function.
8333 (Sized_relobj::do_layout): Allow this function to be called twice
8334 during garbage collection and defer layout of section during the
8335 first call.
8336 * object.h (Relobj::get_symbols_data): New function.
8337 (Relobj::is_section_name_included): New function.
8338 (Relobj::copy_symbols_data): New function.
8339 (Relobj::set_symbols_data): New function.
8340 (Relobj::get_relocs_data): New function.
8341 (Relobj::set_relocs_data): New function.
8342 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8343 (Relobj::gc_process_relocs): New function.
8344 (Relobj::do_gc_process_relocs): New pure virtual function.
8345 (Relobj::sd_): New data member.
8346 (Sized_relobj::is_output_section_offset_invalid): New function.
8347 (Sized_relobj::do_gc_process_relocs): New function.
8348 * options.h (General_options::gc_sections): Modify to not be a no-op.
8349 (General_options::print_gc_sections): New option.
8350 * plugin.cc (Plugin_finish::run): Remove function call to
8351 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8352 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8353 * reloc.cc (Read_relocs::run): Add task to process relocs and
8354 determine unreferenced sections when doing garbage collection.
8355 (Gc_process_relocs): New class.
8356 (Sized_relobj::do_gc_process_relocs): New function.
8357 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8358 sections that are garbage collected.
8359 * reloc.h (Gc_process_relocs): New class.
8360 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8361 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8362 symbols whose corresponding sections are garbage collected.
8363 (Symbol_table::Symbol_table): Add new parameter for the garbage
8364 collection object.
8365 (Symbol_table::gc_mark_undef_symbols): New function.
8366 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8367 (Symbol_table::gc_mark_dyn_syms): New function.
8368 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8369 as garbage.
8370 (Symbol_table::add_from_object): Likewise.
8371 (Symbol_table::add_from_relobj): When building shared objects, do not
8372 treat externally visible symbols as garbage.
8373 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8374 table information for static and relocatable links.
8375 * symtab.h (Symbol_table::set_gc): New function.
8376 (Symbol_table::gc): New function.
8377 (Symbol_table::gc_mark_undef_symbols): New function.
8378 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8379 (Symbol_table::gc_mark_dyn_syms): New function.
8380 (Symbol_table::gc_): New data member.
8381 * target.h (Sized_target::gc_process_relocs): New pure virtual
8382 function.
8383 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8384 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8385
8386 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8387
8388 * options.h (General_options::gc_sections): Define as a no-op for now.
8389 (General_options::no_keep_memory): Ditto.
8390 (General_options::Bshareable): Define.
8391 * options.cc (General_options::finalize): Honor -Bshareable.
8392
8393 2009-01-20 Andreas Schwab <schwab@suse.de>
8394
8395 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8396 read the value in the contents, since we don't use it. Use the
8397 template endianness when writing.
8398 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8399
8400 2009-01-19 Andreas Schwab <schwab@suse.de>
8401
8402 * configure.tgt (powerpc64-*): Fix targ_obj.
8403
8404 2009-01-15 Ian Lance Taylor <iant@google.com>
8405
8406 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8407 local symbols when stripping all symbols.
8408
8409 2009-01-14 Cary Coutant <ccoutant@google.com>
8410
8411 * output.cc (Output_reloc): Add explicit instantiations.
8412
8413 2009-01-14 Cary Coutant <ccoutant@google.com>
8414
8415 * archive.cc (Archive::get_elf_object_for_member): Remove call
8416 to File_read::claim_for_plugin.
8417 * descriptors.cc (Descriptors::open): Remove reference to
8418 is_claimed.
8419 (Descriptors::claim_for_plugin): Remove.
8420 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8421 (Descriptors::is_claimed): Remove.
8422 (claim_descriptor_for_plugin): Remove.
8423 * fileread.cc (File_read::claim_for_plugin): Remove.
8424 * fileread.h (File_read::claim_for_plugin): Remove.
8425 (File_read::descriptor): Reopen descriptor if necessary.
8426 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8427 (Plugin_manager::all_symbols_read): Add task parameter. Change
8428 all callers.
8429 (Plugin_manager::get_input_file): New function.
8430 (Plugin_manager::release_input_file): New function.
8431 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8432 corresponding data member.
8433 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8434 and pass to base constructor. Change all callers.
8435 (get_input_file, release_input_file): New functions.
8436 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8437 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8438 (Plugin_manager::all_symbols_read): Add task parameter.
8439 (Plugin_manager::get_input_file): New function.
8440 (Plugin_manager::release_input_file): New function.
8441 (Plugin_manager::task_): New data member.
8442 (Pluginobj::Pluginobj): Add filesize parameter.
8443 (Pluginobj::filename): New function.
8444 (Pluginobj::descriptor): New function.
8445 (Pluginobj::filesize): New function.
8446 (Pluginobj::filesize_): New data member.
8447 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8448 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8449 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8450
8451 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8452 with archive libraries.
8453 * testsuite/Makefile.in: Regenerate.
8454 * testsuite/plugin_test.c (struct sym_info): New type.
8455 (get_input_file, release_input_file): New static variables.
8456 (onload): Capture new transfer vector entries.
8457 (claim_file_hook): Stop reading at end of file according to filesize.
8458 Factor out parsing of readelf output into separate function.
8459 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8460 APIs and get the source file name from the symbol table. Convert
8461 source file name to corresponding object file name. Print info
8462 message when adding new input files.
8463 (parse_readelf_line): New function.
8464 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8465 * testsuite/plugin_test_2.sh: Likewise.
8466 * testsuite/plugin_test_3.sh: Likewise.
8467 * testsuite/plugin_test_4.sh: New test case.
8468
8469 2009-01-07 Ian Lance Taylor <iant@google.com>
8470
8471 * version.cc (version_string): Bump to 1.8.
8472
8473 2008-12-23 Cary Coutant <ccoutant@google.com>
8474
8475 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8476 * plugin.cc (Plugin_manager::finish): Rename as
8477 layout_deferred_objects. Move cleanup to separate function.
8478 (Plugin_manager::cleanup): New function.
8479 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8480 separately.
8481 * plugin.h (Plugin_manager::finish): Rename as
8482 layout_deferred_objects.
8483 (Plugin_manager::cleanup): New function.
8484 (Plugin_manager::cleanup_done): New field.
8485
8486 2008-12-23 Cary Coutant <ccoutant@google.com>
8487
8488 * plugin.cc (is_visible_from_outside): New function.
8489 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8490 so we don't return "IR only" status for exported symbols or -r links.
8491
8492 * testsuite/Makefile.am (plugin_test_3): New test case.
8493 * testsuite/Makefile.in: Regenerate.
8494 * testsuite/plugin_test_3.sh: New file.
8495
8496 2008-12-22 Cary Coutant <ccoutant@google.com>
8497
8498 * object.cc (Sized_relobj::layout_section): New function.
8499 (Sized_relobj::do_layout): Defer layout of input sections until after
8500 plugin has provided replacement files.
8501 (Sized_relobj::do_layout_deferred_sections): New function.
8502 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8503 (Relobj::layout_deferred_sections): New function.
8504 (Relobj::do_layout_deferred_sections): New function.
8505 (Sized_relobj::do_layout_deferred_sections): New function.
8506 (Sized_relobj::layout_section): New function.
8507 (Sized_relobj::Deferred_layout): New structure.
8508 (Sized_relobj::deferred_layout_): New field.
8509 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8510 Change all callers. Layout deferred sections.
8511 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8512 references.
8513 (Plugin_hook::run): Move code from do_plugin_hook inline.
8514 (Plugin_hook::do_plugin_hook): Remove.
8515 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8516 (Plugin_manager::finish): Renamed, was cleanup.
8517 (Plugin_manager::should_defer_layout): New function.
8518 (Plugin_manager::add_deferred_layout_object): New function.
8519 (Plugin_manager::Deferred_layout_list): New type.
8520 (Plugin_manager::deferred_layout_objects_): New field.
8521 (Plugin_hook::do_plugin_hook): Remove.
8522
8523 2008-12-17 Ian Lance Taylor <iant@google.com>
8524
8525 * options.h (class General_options): Add --no case for
8526 --export-dynamic.
8527
8528 2008-12-16 Cary Coutant <ccoutant@google.com>
8529
8530 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8531 vector.
8532 (Plugin_manager::claim_file): Create plugin object even if
8533 plugin did not call the add_symbols callback.
8534 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8535 asking for more symbols than were added.
8536 * testsuite/Makefile.am (plugin_test_1): Add test case with
8537 no global symbols.
8538 (empty.syms): New target.
8539 * testsuite/Makefile.in: Regenerate.
8540 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8541 message. Don't call add_symbols if no globals.
8542 (all_symbols_read_hook): Don't provide replacement for empty
8543 claimed file.
8544
8545 2008-12-12 Ian Lance Taylor <iant@google.com>
8546
8547 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8548 r_type == 0 for a local symbol with r_sym == 0.
8549 (scan_relocatable_relocs): Pass r_sym to
8550 local_non_section_strategy.
8551 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8552 r_sym parameter.
8553
8554 * configure.ac: Update test for TLS descriptors: they are
8555 supported as of glibc 2.9.
8556 * configure: Rebuild.
8557
8558 2008-12-11 Ian Lance Taylor <iant@google.com>
8559
8560 PR 7091
8561 * target-reloc.h (Default_scan_relocatable_relocs): For each
8562 function, map r_type == 0 to RELOC_DISCARD.
8563
8564 2008-12-10 Cary Coutant <ccoutant@google.com>
8565
8566 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8567 object to override a kept COMDAT group from a plugin object.
8568
8569 2008-12-09 Ian Lance Taylor <iant@google.com>
8570
8571 PR 7088
8572 * yyscript.y (file_cmd): Handle INPUT.
8573
8574 * testsuite/initpri1.c: Change all declarations to be full
8575 prototypes by adding void, to avoid compiler warnings.
8576
8577 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8578
8579 * options.cc (General_options::parse_plugin_opt): New.
8580 (General_options::add_plugin): The argument now is just the filename.
8581 (General_options::add_plugin_option): New.
8582 * options.h (plugin_opt): New.
8583 (add_plugin): Change argument name.
8584 (add_plugin_option): New.
8585 * plugin.cc (Plugin::load): Don't parse the plugin option.
8586 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8587 (Plugin::add_option): New.
8588 (Plugin::args_): Change type.
8589 (Plugin::filename_): New.
8590 (Plugin_manager::add_plugin_option): New.
8591 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8592 * testsuite/Makefile.in: Regenerate.
8593
8594 2008-12-05 Cary Coutant <ccoutant@google.com>
8595
8596 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8597 Handle --strip-lto-sections option.
8598 * options.h (strip_lto_sections): New option.
8599
8600 2008-12-01 Cary Coutant <ccoutant@google.com>
8601
8602 * plugin.cc (ld_plugin_message): Change format parameter to const.
8603 Fix mismatch between new[] and delete.
8604
8605 2008-11-14 Cary Coutant <ccoutant@google.com>
8606
8607 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8608 instead of -1U.
8609
8610 2008-11-05 Craig Silverstein <csilvers@google.com>
8611
8612 * options.cc (General_options::parse_dynamic_list): New function.
8613 * options.h (General_options): New flags dynamic_list,
8614 dynamic_list_data, dynamic_list_cpp_new, and
8615 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8616 (General_options::in_dynamic_list): New function.
8617 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8618 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8619 (Lex::can_continue_name): Likewise.
8620 (yylex): Likewise.
8621 (read_script_file): New parameter script_options.
8622 (read_dynamic_list): New function.
8623 (Script_options::define_dynamic_list): New function.
8624 (dynamic_list_keyword_parsecodes): New variable.
8625 (dynamic_list_keywords): New variable.
8626 * script.h (Script_options::define_dynamic_list): New function
8627 prototype.
8628 (read_dynamic_list): New function prototype.
8629 * symtab.cc (strprefix): New macro.
8630 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8631 dynamic_list_data, dynamic_list_cpp_new, and
8632 dynamic_list_cpp_typeinfo.
8633 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8634 (dynamic_list_expr): New rule.
8635 (dynamic_list_nodes): Likewise.
8636 (dynamic_list_node): Likewise.
8637 * testsuite/Makefile.am (dynamic_list): New test.
8638 * testsuite/Makefile.in: Regenerated.
8639 * testsuite/dynamic_list.t: New file.
8640 * testsuite/dynamic_list.sh: New file.
8641
8642 2008-11-05 Craig Silverstein <csilvers@google.com>
8643
8644 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8645 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8646 (t11_last): Likewise.
8647 * testsuite/ver_test_6.c (main): Likewise.
8648
8649 2008-10-07 Cary Coutant <ccoutant@google.com>
8650
8651 * options.c (General_options::finalize): Add check for -static and
8652 -shared.
8653 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8654 is not empty.
8655
8656 2008-10-02 Cary Coutant <ccoutant@google.com>
8657
8658 * plugin.cc (make_sized_plugin_object): Fix conditional
8659 compilation to work when not all targets are enabled.
8660
8661 2008-09-29 Cary Coutant <ccoutant@google.com>
8662
8663 * archive.cc (Archive::get_file_and_offset): Use filename instead
8664 of name to get library path.
8665 (Archive::include_member): Unlock external member of a thin archive.
8666
8667 * testsuite/Makefile.am (TEST_AR): New variable.
8668 (thin_archive_test_1): New test.
8669 (thin_archive_test_2): New test.
8670 * testsuite/Makefile.in: Regenerate.
8671 * testsuite/thin_archive_main.cc: New file.
8672 * testsuite/thin_archive_test_1.cc: New file.
8673 * testsuite/thin_archive_test_2.cc: New file.
8674 * testsuite/thin_archive_test_3.cc: New file.
8675 * testsuite/thin_archive_test_4.cc: New file.
8676
8677 2008-09-29 Cary Coutant <ccoutant@google.com>
8678
8679 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8680 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8681 instead of -1U.
8682 (Sized_relobj::do_finalize_local_symbols): Likewise.
8683 (Sized_relobj::map_to_kept_section): Likewise.
8684 * object.h (Sized_relobj::invalid_address): New constant.
8685 (Sized_relobj::do_output_section_offset): Check for invalid_address
8686 and return -1ULL.
8687 * output.cc (Output_reloc::local_section_offset): Use constant
8688 invalid_address instead of -1U.
8689 (Output_reloc::get_address): Likewise.
8690 (Output_section::output_address): Change -1U to -1ULL.
8691 * output.h (Output_reloc::invalid_address): New constant.
8692 * reloc.cc (Sized_relobj::write_sections): Use constant
8693 invalid_address instead of -1U.
8694 (Sized_relobj::relocate_sections): Likewise.
8695 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8696 values for merge sections.
8697 * target-reloc.h (relocate_for_relocatable): Use constant
8698 invalid_address instead of -1U.
8699
8700 2008-09-19 Cary Coutant <ccoutant@google.com>
8701
8702 Add plugin functionality for link-time optimization (LTO).
8703 * configure.ac (plugins): Add --enable-plugins option.
8704 * configure: Regenerate.
8705 * config.in: Regenerate.
8706 * Makefile.am (LIBDL): New variable.
8707 (CCFILES): Add plugin.cc.
8708 (HFILES): Add plugin.h.
8709 (ldadd_var): Add LIBDL.
8710 * Makefile.in: Regenerate.
8711
8712 * archive.cc: Include "plugin.h".
8713 (Archive::setup): Don't preread archive symbols when using a plugin.
8714 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8715 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8716 files.
8717 (Archive::include_member): Add symbols from plugin objects.
8718 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8719 * descriptors.cc (Descriptors::open): Check for file descriptors
8720 abandoned by plugins.
8721 (Descriptors::claim_for_plugin): New function.
8722 * descriptors.h (Descriptors::claim_for_plugin): New function.
8723 (Open_descriptor::is_claimed): New field.
8724 (claim_descriptor_for_plugin): New function.
8725 * fileread.cc (File_read::claim_for_plugin): New function.
8726 * fileread.h (File_read::claim_for_plugin): New function.
8727 (File_read::descriptor): New function.
8728 * gold.cc: Include "plugin.h".
8729 (queue_initial_tasks): Add task to call plugin hooks for generating
8730 new object files.
8731 * main.cc: Include "plugin.h".
8732 (main): Load plugin libraries.
8733 * object.h (Pluginobj): Declare.
8734 (Object::pluginobj): New function.
8735 (Object::do_pluginobj): New function.
8736 (Object::set_target): New function.
8737 * options.cc: Include "plugin.h".
8738 (General_options::parse_plugin): New function.
8739 (General_options::General_options): Initialize plugins_ field.
8740 (General_options::add_plugin): New function.
8741 * options.h (Plugin_manager): Declare.
8742 (General_options): Add --plugin option.
8743 (General_options::has_plugins): New function.
8744 (General_options::plugins): New function.
8745 (General_options::add_plugin): New function.
8746 (General_options::plugins_): New field.
8747 * plugin.cc: New file.
8748 * plugin.h: New file.
8749 * readsyms.cc: Include "plugin.h".
8750 (Read_symbols::do_read_symbols): Check for archive before checking
8751 for ELF file. Call plugin hooks to claim files.
8752 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8753 from a real object file; force override when processing replacement
8754 files.
8755 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8756 (Symbol::init_base_object): Likewise.
8757 (Symbol::init_base_output_data): Likewise.
8758 (Symbol::init_base_output_segment): Likewise.
8759 (Symbol::init_base_constant): Likewise.
8760 (Symbol::init_base_undefined): Likewise.
8761 (Symbol::output_section): Assert that object is not a plugin.
8762 (Symbol_table::add_from_pluginobj): New function.
8763 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8764 undefined.
8765 (Symbol_table::sized_write_globals): Likewise.
8766 (Symbol_table::add_from_pluginobj): Instantiate template.
8767 * symtab.h (Sized_pluginobj): Declare.
8768 (Symbol::in_real_elf): New function.
8769 (Symbol::set_in_real_elf): New function.
8770 (Symbol::in_real_elf_): New field.
8771 (Symbol_table::add_from_pluginobj): New function.
8772
8773 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8774 (LIBDL): New variable.
8775 (LDADD): Add LIBDL.
8776 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8777 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8778 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8779 (MOSTLYCLEANFILES): Likewise.
8780 * testsuite/Makefile.in: Regenerate.
8781 * testsuite/plugin_test.c: New file.
8782 * testsuite/plugin_test_1.sh: New file.
8783 * testsuite/plugin_test_2.sh: New file.
8784
8785 2008-09-16 Ian Lance Taylor <iant@google.com>
8786
8787 * target-reloc.h (relocate_section): Check whether a symbol is
8788 defined by the ABI before reporting an undefined symbol error.
8789 * target.h (Target::is_defined_by_abi): Make parameter const.
8790 (Target::do_is_defined_by_abi): Likewise.
8791 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8792 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8793 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8794 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8795 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8796 * testsuite/Makefile.in: Rebuild.
8797
8798 * fileread.cc (make_view): Add casts to avoid warning.
8799
8800 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8801
8802 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8803 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8804
8805 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8806
8807 * options.h (General_options::output_is_executable): New.
8808 (General_options::output_is_pie): New.
8809 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8810 for shared libraries.
8811 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8812
8813 2008-09-11 Chris Demetriou <cgd@google.com>
8814
8815 * options.h (origin): New -z option.
8816 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8817 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8818 in DT_FLAGS_1.
8819
8820 2008-09-05 Cary Coutant <ccoutant@google.com>
8821
8822 * fileread.cc (File_read::make_view): Add check for attempt to map
8823 beyond end of file.
8824
8825 2008-09-05 Cary Coutant <ccoutant@google.com>
8826
8827 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8828 explicit instantiations.
8829
8830 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8831
8832 PR gold/6858
8833 * options.cc (General_options::finalize): Allow undefined symbols
8834 in shlibs if linking -shared.
8835
8836 PR gold/6859
8837 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8838 symbols as not needing a dynsym entry.
8839
8840 2008-08-20 Craig Silverstein <csilvers@google.com>
8841
8842 * fileread.cc (File_read::open): Do not lock the file unless it
8843 was successfully opened.
8844
8845 2008-08-14 Cary Coutant <ccoutant@google.com>
8846
8847 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8848 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8849 * testsuite/tls_test.cc (struct int128): 128-bit struct
8850 for testing TLS relocs with non-zero addend.
8851 (v12): New TLS variable.
8852 (t12): New test.
8853 (t_last): Add check for v12.
8854 * testsuite/tls_test.h (t12): New function.
8855 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8856
8857 2008-08-13 Ian Lance Taylor <iant@google.com>
8858
8859 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8860 set tls_segment_ or relro_segment_.
8861 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8862 when appropriate.
8863 * output.h (Output_section::clear_is_relro): New function.
8864 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8865 sections specially even when output_data_ is empty.
8866 (Output_segment::maximum_alignment): When first section is relro,
8867 only force alignment for PT_LOAD segments.
8868 * script.cc (script_data_segment_align): New function.
8869 (script_data_segment_relro_end): New function.
8870 * script-c.h (script_data_segment_align): Declare.
8871 (script_data_segment_relro_end): Declare.
8872 * script-sections.h (class Script_sections): Declare
8873 data_segment_align and data_segment_relro_end. Add fields
8874 segment_align_index_ and saw_relro_end_.
8875 * script-sections.cc (class Sections_element): Add set_is_relro
8876 virtual function. Add new bool* parameter to place_orphan_here.
8877 Add get_output_section virtual function.
8878 (class Output_section_definition): Add set_is_relro. Add new
8879 bool* parameter to place_orphan_here. Add get_output_section.
8880 Add is_relro_ field.
8881 (Output_section_definition::Output_section_definition): Initialize
8882 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8883 and is_relro_ fields.
8884 (Output_section_definition::place_orphan_here): Add is_relro
8885 parameter.
8886 (Output_section_definition::set_section_addresses): Set relro for
8887 output section.
8888 (Output_section_definition::alternate_constraint): Likewise.
8889 (class Orphan_output_section): Add new bool* parameter to
8890 place_orphan_here. Add get_output_section.
8891 (Orphan_output_section::place_orphan_here): Add is_relro
8892 parameter.
8893 (Script_sections::Script_sections): Initialize
8894 data_segment_align_index_ and saw_relro_end_.
8895 (Script_sections::data_segment_align): New function.
8896 (Script_sections::data_segment_relro_end): New function.
8897 (Script_sections::place_orphan): Set or clear is_relro.
8898 (Script_sections::set_section_addresses): Force alignment of first
8899 TLS section.
8900 * yyscript.y (exp): Call script_data_segment_align and
8901 script_data_segment_relro_end.
8902 * testsuite/relro_script_test.t: New file.
8903 * testsuite/relro_test.cc (using_script): Declare.
8904 (t1, t2): Test using_script.
8905 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8906 (relro_script_test_SOURCES): Define.
8907 (relro_script_test_DEPENDENCIES): Define.
8908 (relro_script_test_LDFLAGS): Define.
8909 (relro_script_test_LDADD): Define.
8910 (relro_script_test.so): New target.
8911 * testsuite/Makefile.in: Rebuild.
8912
8913 2008-08-06 Cary Coutant <ccoutant@google.com>
8914
8915 * archive.cc (Archive::total_archives, Archive::total_members)
8916 (Archive::total_members_loaded): New variables.
8917 (Archive::setup): Add parameter. Add option to preread
8918 archive symbols.
8919 (Archive::read_armap): Add counter.
8920 (Archive::get_file_and_offset): New function.
8921 (Archive::get_elf_object_for_member): New function.
8922 (Archive::read_all_symbols): New function.
8923 (Archive::read_symbols): New function.
8924 (Archive::add_symbols): Add counters.
8925 (Archive::include_all_members): Use armap to find members if it's
8926 already built.
8927 (Archive::include_member): Skip reading symbols if already read.
8928 Factored code into Archive::get_file_and_offset and
8929 Archive::get_elf_object_for_member. Changed call to
8930 Mapfile::report_include_archive_member.
8931 (Archive::print_stats): New function.
8932 * archive.h: Declare Object and Read_symbols_data classes.
8933 (Archive::Archive): Add initializers for new members.
8934 (Archive::setup): Add parameter.
8935 (Archive::print_stats): New function.
8936 (Archive::total_archives, Archive::total_members)
8937 (Archive::total_members_loaded): New variables.
8938 (Archive::get_file_and_offset): New function.
8939 (Archive::get_elf_object_for_member): New function.
8940 (Archive::read_all_symbols): New function.
8941 (Archive::read_symbols): New function.
8942 (Archive::Archive_member): New class.
8943 (Archive::members_): New member.
8944 (Archive::num_members_): New member.
8945 * main.cc: Include archive.h.
8946 (main): Call Archive::print_stats.
8947 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8948 archive parameter; member_name is now the fully-decorated name.
8949 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8950 * options.h: (General_options): Add --preread-archive-symbols option.
8951 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8952 Archive::setup.
8953
8954 2008-08-04 Ian Lance Taylor <iant@google.com>
8955
8956 * symtab.h (Symbol::use_plt_offset): New function.
8957 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8958 * powerpc.cc (Relocate::relocate): Likewise.
8959 * sparc.cc (Relocate::relocate): Likewise.
8960 * x86_64.cc (Relocate::relocate): Likewise.
8961 * testsuite/weak_plt.sh: New test.
8962 * testsuite/weak_plt_main.cc: New test.
8963 * testsuite/weak_plt_shared.cc: New test.
8964 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8965 (check_PROGRAMS): Add weak_plt.
8966 (check_DATA): Add weak_plt_shared.so.
8967 (weak_plt_main_pic.o, weak_plt): New targets.
8968 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8969 * testsuite/Makefile.in: Rebuild.
8970
8971 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8972 gcctestdir/ld.
8973 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8974 * testsuite/Makefile.in: Rebuild.
8975
8976 2008-08-04 Alan Modra <amodra@bigpond.net.au>
8977
8978 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8979 * Makefile.in: Regenerate.
8980 * po/POTFILES.in: Regenerate.
8981
8982 2008-07-29 Ian Lance Taylor <iant@google.com>
8983
8984 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8985 symbols before other symbols.
8986 * testsuite/script_test_2.cc (test_addr): Declare.
8987 (test_addr_alias): Declare.
8988 (main): Check that test_addr and test_addr_alias have the right
8989 values.
8990 * testsuite/script_test_2.t: Define test_addr_alias and
8991 test_addr.
8992
8993 2008-07-24 Ian Lance Taylor <iant@google.com>
8994
8995 PR 5990
8996 * descriptors.cc: New file.
8997 * descriptors.h: New file.
8998 * gold-threads.h (class Hold_optional_lock): New class.
8999 * fileread.cc: Include "descriptors.h".
9000 (File_read::~File_read): Release descriptor rather than closing
9001 it.
9002 (File_read::open) [file]: Call open_descriptor rather than open.
9003 Set is_descriptor_opened_.
9004 (File_read::open) [memory]: Assert that descriptor is not open.
9005 (File_read::reopen_descriptor): New function.
9006 (File_read::release): Release descriptor.
9007 (File_read::do_read): Make non-const. Reopen descriptor.
9008 (File_read::read): Make non-const.
9009 (File_read::make_view): Reopen descriptor.
9010 (File_read::do_readv): Likewise.
9011 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9012 Update declarations.
9013 * layout.cc: Include "descriptors.h".
9014 (Layout::create_build_id): Use open_descriptor rather than open.
9015 * output.cc: Include "descriptors.h".
9016 (Output_file::open): Use open_descriptor rather than open.
9017 * archive.cc (Archive::const_iterator): Change Archive to be
9018 non-const.
9019 (Archive::begin, Archive::end): Make non-const.
9020 (Archive::count_members): Likewise.
9021 * archive.h (class Archive): Update declarations.
9022 * object.h (Object::read): Make non-const.
9023 * Makefile.am (CCFILES): Add descriptors.cc.
9024 (HFILES): Add descriptors.h.
9025 * Makefile.in: Rebuild.
9026
9027 PR 6716
9028 * gold.h: Always include <clocale>. Add Solaris workarounds
9029 following code in binutils/sysdep.h.
9030
9031 PR 6048
9032 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9033 this->eh_frame_hdr_ is NULL before using it.
9034
9035 * dynobj.cc (Versions::Versions): Update comment.
9036
9037 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9038 the base version name.
9039
9040 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9041 array size plus one.
9042 (Stringpool_template::set_string_offsets): Subtract one from key
9043 before using it as an array index.
9044 (Stringpool_template::get_offset_with_length): Likewise.
9045 (Stringpool_template::write_to_buffer): Likewise.
9046 * stringpool.h (Stringpool_template::get_offset_from_key):
9047 Likewise.
9048
9049 2008-07-23 Ian Lance Taylor <iant@google.com>
9050
9051 PR 6658
9052 * object.h (Merged_symbol_value::value): Do our best to handle a
9053 negative addend.
9054
9055 PR 6647
9056 * script.cc (Version_script_info::get_versions): Don't add empty
9057 version tag to return value.
9058 (Version_script_info::get_symbol_version_helper): Change return
9059 type to bool. Add pversion parameter. Change all callers.
9060 (script_register_vers_node): Don't require a non-NULL tag.
9061 * script.h (class Version_script_info): Update declarations.
9062 (Version_script_info::get_symbol_version): Change return type to
9063 bool. Add version parameter. Change all callers.
9064 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9065 handling. Handle an empty version from a version script.
9066 (Symbol_table::define_special_symbol): Likewise.
9067 * testsuite/ver_test_10.script: New file.
9068 * testsuite/ver_test_10.sh: New file.
9069 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9070 (check_DATA): Add ver_test_10.syms.
9071 (ver_test_10.syms, ver_test_10.so): New target.
9072 * testsuite/Makefile.in: Rebuild.
9073
9074 2008-07-23 Simon Baldwin <simonb@google.com>
9075
9076 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9077 to zero for undefined symbols from dynamic libraries.
9078
9079 2008-07-23 Ian Lance Taylor <iant@google.com>
9080
9081 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9082 Change all callers.
9083 * symtab.h (class Symbol_table): Update declaration.
9084 * testsuite/ver_test_9.cc: New file.
9085 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9086 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9087 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9088 (ver_test_9.so, ver_test_9.o): New targets.
9089 * testsuite/Makefile.in: Rebuild.
9090
9091 2008-07-22 Ian Lance Taylor <iant@google.com>
9092
9093 * options.h (class General_options): Define --check-sections.
9094 * layout.cc (Layout::set_segment_offsets): Handle
9095 --check-sections.
9096
9097 * options.h (class General_options): Define -n/--nmagic and
9098 -N/--omagic.
9099 * options.cc (General_options::finalize): For -n/--nmagic or
9100 -N/--omagic, set -static.
9101 * layout.cc (Layout::attach_allocated_section_to_segment): If
9102 -N/--omagic, don't put read-only and read-write sections in
9103 different segments.
9104 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9105 finding a read-only segment.
9106 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9107 don't set the minimum segment alignment to the common page size,
9108 and don't set the file offset to the address modulo the page size.
9109 * script-sections.cc (Script_sections::create_segments): If
9110 -n/--omagic, don't put read-only and read-write sections in
9111 different segments.
9112
9113 * cref.cc: New file.
9114 * cref.h: New file.
9115 * options.h (class General_options): Add --print-symbol-counts.
9116 * main.cc (main): Issue defined symbol report if requested.
9117 * archive.cc (Archive::interpret_header): Make into a const member
9118 function.
9119 (Archive::add_symbols): Call Input_objects::archive_start and
9120 archive_stop.
9121 (Archive::const_iterator): Define new class.
9122 (Archive::begin, Archive::end): New functions.
9123 (Archive::include_all_members): Rewrite to use iterator.
9124 (Archive::count_members): New function.
9125 * archive.h (class Archive): Update declarations.
9126 (Archive::filename): New function.
9127 * object.cc: Include "cref.h".
9128 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9129 (Sized_relobj::do_get_global_symbol_counts): New function.
9130 (Input_objects::add_object): Add object to cross-referencer.
9131 (Input_objects::archive_start): New function.
9132 (Input_objects::archive_stop): New function.
9133 (Input_objects::print_symbol_counts): New function.
9134 * object.h: Declare Cref and Archive.
9135 (Object::get_global_symbol_counts): New function.
9136 (Object::do_get_global_symbol_counts): New pure virtual function.
9137 (class Sized_relobj): Add defined_count_ field. Update
9138 declarations.
9139 (class Input_objects): Add cref_ field. Update constructor.
9140 Update declarations.
9141 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9142 defined_count_.
9143 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9144 symbol counts.
9145 (Sized_dynobj::do_get_global_symbol_counts): New function.
9146 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9147 defined_count_. Update declarations. Define Symbols typedef.
9148 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9149 parameter. Change all callers.
9150 (Symbol_table::add_from_dynobj): Add sympointers and defined
9151 parameters. Change all callers.
9152 * symtab.h (class Symbol_table): Update declarations.
9153 * Makefile.am (CCFILES): Add cref.cc.
9154 (HFILES): Add cref.h.
9155 * Makefile.in: Rebuild.
9156
9157 2008-07-22 Simon Baldwin <simonb@google.com>
9158
9159 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9160 to zero when writing undefined symbols.
9161
9162 2008-07-22 Ian Lance Taylor <iant@google.com>
9163
9164 * output.cc (Output_section::add_input_section): Don't try to
9165 merge empty merge sections.
9166
9167 2008-07-21 Craig Silverstein <csilvers@google.com>
9168
9169 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9170 Include symbol version in error message.
9171
9172 2008-07-20 Chris Demetriou <cgd@google.com>
9173
9174 * configure.ac (gold_cv_c_random_seed): New configured variable.
9175 (RANDOM_SEED_CFLAGS): New substituted variable.
9176 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9177 * configure: Rebuild.
9178 * Makefile.in: Likewise.
9179 * testsuite/Makefile.in: Likewise.
9180
9181 2008-07-18 Ian Lance Taylor <iant@google.com>
9182
9183 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9184 where we see NAME/NULL and NAME/VERSION as separate symbols.
9185 * testsuite/ver_test_main.cc (main): Call t4.
9186 (t4, t4_2a): Define.
9187 * testsuite/ver_test_2.cc (t4_2): Define.
9188 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9189 * testsuite/ver_test_4.cc (t4_2a): Define.
9190 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9191 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9192
9193 2008-07-17 Ian Lance Taylor <iant@google.com>
9194
9195 * dynobj.cc (Versions::add_def): If we give an error about a
9196 missing version, go ahead and create the version anyhow.
9197
9198 2008-07-10 Ian Lance Taylor <iant@google.com>
9199
9200 Handle output sections with more than 0x7fffffff bytes.
9201 * object.h (class Relobj): Change map_to_output_ to
9202 output_sections_, and just keep a section pointer. Change all
9203 uses. Move comdat group support to Sized_relobj.
9204 (Relobj::is_section_specially_mapped): Remove.
9205 (Relobj::output_section): Remove poff parameter. Change all
9206 callers.
9207 (Relobj::output_section_offset): New function.
9208 (Relobj::set_section_offset): Rewrite.
9209 (Relobj::map_to_output): Remove.
9210 (Relobj::output_sections): New function.
9211 (Relobj::do_output_section_offset): New pure virtual function.
9212 (Relobj::do_set_section_offset): Likewise.
9213 (class Sized_relobj): Add section_offsets_ field. Add comdat
9214 group support from Relobj. Update declarations.
9215 (Sized_relobj::get_output_section_offset): New function.
9216 (Sized_relobj::do_output_section_offset): New function.
9217 (Sized_relobj::do_set_section_offset): New function.
9218 * object.cc (Relobj::output_section_address): Remove.
9219 (Sized_relobj::Sized_relobj): Initialize new fields.
9220 (Sized_relobj::include_section_group): Cast find_kept_object to
9221 Sized_relobj.
9222 (Sized_relobj::include_linkonce_section): Likewise.
9223 (Sized_relobj::do_layout): Use separate arrays for output section
9224 and output offset.
9225 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9226 output_sections.
9227 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9228 output_sections and section_offsets.
9229 (Sized_relobj::write_local_symbols): Likewise.
9230 (map_to_kept_section): Compute output address directly.
9231 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9232 output_sections and section_offsets.
9233 (Sized_relobj::write_sections): Likewise.
9234 (Sized_relobj::relocate_sections): Likewise.
9235 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9236 * output.h (class Output_reloc): Update declarations. Change
9237 u2_.relobj to Sized_relobj*.
9238 (class Output_data_reloc): Change add functions to use
9239 Sized_relobj*.
9240 * output.cc (Output_reloc::Output_reloc): Change relobj to
9241 Sized_relobj*.
9242 (Output_reloc::local_section_offset): Change return type to
9243 Elf_Addr. Use get_output_section_offset.
9244 (Output_reloc::get_address): Likewise.
9245 (Output_section::is_input_address_mapped): Don't call
9246 is_section_specially_mapped.
9247 (Output_section::output_offset): Likewise.
9248 (Output_section::output_address): Likewise.
9249 (Output_section::starting_output_address): Likewise.
9250 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9251 parameter to Sized_relobj*.
9252 (Copy_relocs::need_copy_reloc): Likewise.
9253 (Copy_relocs::save): Likewise.
9254 * copy-relocs.h (class Copy_relocs): Update declarations.
9255 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9256 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9257 * target-reloc.h (relocate_for_relocatable): Change
9258 offset_in_output_section type to Elf_Addr. Change code that uses
9259 it as well.
9260 * layout.cc (Layout::layout): Always set *off.
9261 * mapfile.cc (Mapfile::print_input_section): Use
9262 output_section_offset.
9263 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9264 Sized_relobj*.
9265 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9266 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9267 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9268
9269 2008-07-03 Ian Lance Taylor <iant@google.com>
9270
9271 * layout.cc (Layout::include_section): Do not discard unrecognized
9272 SHT_STRTAB sections.
9273
9274 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9275
9276 * script.cc (Lex::can_continue_name): Make '?' allowable in
9277 version-script names.
9278 * testsuite/version_script.map: Change glob pattern to use '?'
9279
9280 2008-06-30 Manish Singh <yosh@gimp.org>
9281
9282 PR 6585
9283 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9284 Correct typo.
9285
9286 2008-06-30 Ian Lance Taylor <iant@google.com>
9287
9288 PR 6660
9289 PR 6682
9290 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9291 versions]: Don't try to read the value in the contents, since we
9292 don't use it. Use the template endianness when writing.
9293
9294 2008-06-25 Cary Coutant <ccoutant@google.com>
9295
9296 * fileread.cc (File_read::make_view): Assert on zero-length view.
9297 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9298 symbol table when there are no symbols to read.
9299
9300 2008-06-23 Craig Silverstein <csilvers@google.com>
9301
9302 * version.cc (version_string): Bump to 1.7
9303
9304 2008-06-18 Craig Silverstein <csilvers@google.com>
9305
9306 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9307 constant 0xFFFF to type Valtype.
9308 (Powerpc_relocate_functions::rel16_ha): Likewise.
9309
9310 2008-06-17 Ian Lance Taylor <iant@google.com>
9311
9312 * output.h (Output_section::Input_section): Initialize p2align_ to
9313 zero for Output_section_data constructors.
9314 (Output_section::Input_section::addralign): If not an input
9315 section, return the alignment of the Output_section_data.
9316 * testsuite/copy_test.cc: New file.
9317 * testsuite/copy_test_1.cc: New file.
9318 * testsuite/copy_test_2.cc: New file.
9319 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9320 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9321 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9322 (copy_test_1_pic.o, copy_test_1.so): New targets.
9323 (copy_test_2_pic.o, copy_test_2.so): New targets.
9324 * testsuite/Makefile.in: Rebuild.
9325
9326 * script-sections.cc (Script_sections::place_orphan): Initialize
9327 local variable exact.
9328
9329 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9330
9331 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9332
9333 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9334 David S. Miller <davem@davemloft.net>
9335
9336 * powerpc.cc: New file.
9337 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9338 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9339 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9340 * Makefile.in: Rebuild.
9341
9342 2008-06-09 Ian Lance Taylor <iant@google.com>
9343
9344 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9345 <exception>.
9346 (throwing, orig_terminate): New static variables.
9347 (terminate_handler): New static function.
9348 (t2): Set terminate handler.
9349
9350 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9351
9352 PR 6584
9353 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9354 alignment.
9355
9356 2008-05-30 Cary Coutant <ccoutant@google.com>
9357
9358 * archive.cc (Archive::include_all_members) Correct to step
9359 over symbol table and extended name table in thin archives.
9360
9361 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9362
9363 PR 6407
9364 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9365 calculation.
9366
9367 2008-05-28 Caleb Howe <cshowe@google.com>
9368
9369 * reduced_debug_output.cc: New file.
9370 * reduced_debug_output.h: New file.
9371 * options.h (class General_options): Add --strip-debug-non-line.
9372 * options.cc (General_options::finalize): Add strip_debug_non_line
9373 to the strip heirarchy.
9374 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9375 fields.
9376 * layout.cc: Include "reduced_debug_output.h".
9377 (Layout::Layout): Initialize new fields.
9378 (line_only_debug_sections): New static array.
9379 (is_lines_only_debug_sections): New static inline function.
9380 (Layout::include_section): Handle --strip-debug-non-line.
9381 (Layout::make_output_section): If --strip-debug-non-line, build
9382 new output sections for .debug_abbrev and .debug_info.
9383 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9384 gold. Warn about possible overflow.
9385 (read_signed_LEB_128): Likewise.
9386 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9387 (read_signed_LEB_128): Declare.
9388 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9389 (HFILES): Add reduced_debug_output.h.
9390 * Makefile.in: Rebuild.
9391
9392 2008-05-21 Ian Lance Taylor <iant@google.com>
9393
9394 * mapfile.cc: New file.
9395 * mapfile.h: New file.
9396 * options.h (class General_options): Add -M/--print-map and -Map.
9397 * options.cc (General_options::finalize): Make -M equivalent to
9398 -Map -.
9399 * main.cc: Include <cstdio> and "mapfile.h".
9400 (main): Open mapfile if requested.
9401 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9402 constructor. Change caller.
9403 (queue_initial_tasks): Add mapfile parameter. Change caller.
9404 (queue_middle_tasks): Likewise.
9405 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9406 declarations.
9407 * archive.cc: Include "mapfile.h".
9408 (Archive::add_symbols): Add mapfile parameter. Change all
9409 callers. Pass mapfile, symbol, and reason to include_member.
9410 (Archive::include_all_members): Add mapfile parameter. Change all
9411 callers.
9412 (Archive::include_member): Add mapfile, sym, and why parameters.
9413 Change all callers. Report inclusion to map file.
9414 * archive.h: Include "fileread.h".
9415 (class Archive): Update declarations.
9416 (Archive::file): New const method.
9417 (class Add_archive_symbols): Add mapfile_ field. Update
9418 constructor. Change all callers.
9419 * readsyms.h (class Read_symbols): Likewise.
9420 (class Finish_group): Likewise.
9421 (class Read_script): Likewise.
9422 * common.cc: Include "mapfile.h".
9423 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9424 all callers.
9425 (Symbol_table::do_allocate_commons): Likewise.
9426 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9427 symbol allocation to mapfile.
9428 * common.h (class Allocate_commons_task): Add mapfile_ field.
9429 Update constructor. Change all callers.
9430 * symtab.h (class Symbol_table): Update declarations.
9431 * layout.cc: Include "mapfile.h".
9432 (Layout_task_runner::run): Print information to mapfile.
9433 (Layout::create_gold_note): Change Output_data_fixed_space to
9434 Output_data_zero_fill.
9435 (Layout::create_build_id): Likewise.
9436 (Layout::print_to_mapfile): New function.
9437 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9438 constructor. Change caller.
9439 (class Layout): Declare print_to_mapfile.
9440 * output.cc (Output_section::Input_section::print_to_mapfile): New
9441 function.
9442 (Output_section::add_input_section): If producing a map, always
9443 add to input_sections_ list.
9444 (Output_section::do_print_to_mapfile): New function.
9445 (Output_segment::print_sections_to_mapfile): New function.
9446 (Output_segment::print_section_list_to_mapfile): New function.
9447 * output.h: Include "mapfile.h".
9448 (Output_data::print_to_mapfile): New function.
9449 (Output_data::do_print_to_mapfile): New virtual function.
9450 (Output_segment_headers::do_print_to_mapfile): New function.
9451 (Output_file_header::do_print_to_mapfile): New function.
9452 (Output_data_const::do_print_to_mapfile): New function.
9453 (class Output_data_const_buffer): Add map_name_ field. Update
9454 constructor. Change all callers. Add do_print_to_mapfile
9455 function.
9456 (class Output_data_fixed_space): Likewise.
9457 (class Output_data_space): Likewise.
9458 (class Output_data_zero_fill): New class.
9459 (Output_data_strtab::do_print_to_mapfile): New function.
9460 (Output_data_reloc_base::do_print_to_mapfile): New function.
9461 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9462 (Output_data_group::do_print_to_mapfile): New function.
9463 (Output_data_got::do_print_to_mapfile): New function.
9464 (Output_data_dynamic::do_print_to_mapfile): New function.
9465 (Output_symtab_xindex::do_print_to_mapfile): New function.
9466 (class Output_section): Declare do_print_to_mapflie. Declare
9467 print_to_mapfile in Input_section.
9468 (class Output_segment): Declare new functions.
9469 * object.h (Sized_relobj::symbol_count): New function.
9470 * script-sections.cc
9471 (Output_section_element_dot_assignment::set_section_addresses):
9472 Change Output_data_fixed_space to Output_data_zero_fill.
9473 (Output_data_expression::do_print_to_mapfile): New function.
9474 * script.cc (read_input_script): Add mapfile parameter. Change
9475 all callers.
9476 * script.h (read_input_script): Update declaration.
9477 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9478 (Eh_frame::do_print_to_mapfile): New function.
9479 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9480 (Output_merge_string::do_print_to_mapfile): New function.
9481 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9482 function.
9483 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9484 function.
9485 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9486 function.
9487 * Makefile.am (CCFILES): Add mapfile.cc.
9488 (HFILES): Add mapfile.h.
9489 * Makefile.in: Rebuild.
9490
9491 2008-05-19 Ian Lance Taylor <iant@google.com>
9492
9493 * options.h (class General_options): Add -z relro.
9494 * layout.cc (Layout::Layout): Initialize relro_segment_.
9495 (Layout::add_output_section_data): Return the output section.
9496 (Layout::make_output_section): Rcognize relro sections and mark
9497 them appropriately.
9498 (Layout::attach_allocated_section_to_segment): Put relro sections
9499 in a PT_GNU_RELRO segment.
9500 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9501 section as relro.
9502 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9503 PT_TLS segments.
9504 (Layout::linkonce_mapping): Map d.rel.ro.local to
9505 .data.rel.ro.local.
9506 (Layout::output_section_name): Us .data.rel.ro.local for any
9507 section which begins with that.
9508 * layout.h (class Layout): Update add_output_section_data
9509 declaration. Add relro_segment_ field.
9510 * output.cc (Output_section::Output_section): Initialize is_relro_
9511 and is_relro_local_ fields.
9512 (Output_segment::add_output_section): Group relro sections.
9513 (Output_segment::is_first_section_relro): New function.
9514 (Output_segment::maximum_alignment): If there is a relro section,
9515 align the segment to the common page size.
9516 (Output_segment::set_section_addresses): Track whether we are
9517 looking at relro sections. If the last section is a relro
9518 section, align to the common page size.
9519 (Output_segment::set_section_list_addresses): Add in_relro
9520 parameter. Change all callers. Align to the page size when
9521 moving from relro to non-relro section.
9522 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9523 segment.
9524 * output.h (class Output_section): Add is_relro_ and
9525 is_relro_local_ fields.
9526 (Output_section::is_relro): New function.
9527 (Output_section::set_is_relro): New function.
9528 (Output_section::is_relro_local): New function.
9529 (Output_section::set_is_relro_local): New function.
9530 (class Output_segment): Update declarations.
9531 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9532 * sparc.cc (Target_sparc::got_section): Likewise.
9533 * x86_64.cc (Target_x86_64::got_section): Likewise.
9534 * testsuite/relro_test_main.cc: New file.
9535 * testsuite/relro_test.cc: New file.
9536 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9537 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9538 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9539 (relro_test.so, relro_test_pic.o): New targets.
9540 * testsuite/Makefile.in: Rebuild.
9541
9542 2008-05-16 Ian Lance Taylor <iant@google.com>
9543
9544 * output.cc (Output_segment::add_output_section): Remove front
9545 parameter.
9546 * output.h (class Output_segment): Remove
9547 add_initial_output_section and overloaded add_output_section.
9548 Update declaration of remaining add_output_section.
9549 * layout.cc (Layout::create_interp): Call add_output_section
9550 rather than add_initial_output_section.
9551 (Layout::finish_dynamic_section): Likewise.
9552
9553 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9554 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9555 know the dynamic type.
9556 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9557 field. Initialize it in constructor.
9558 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9559 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9560 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9561 reloc.
9562
9563 * output.cc (Output_reloc::get_address): Change return type to
9564 Elf_Addr.
9565 * output.h (class Output_reloc): Update get_address declaration.
9566 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9567 for section addresses.
9568
9569 2008-05-09 Ian Lance Taylor <iant@google.com>
9570
9571 PR 6493
9572 * gold.cc (gold_nomem): Use return value of write.
9573
9574 2008-05-08 Ian Lance Taylor <iant@google.com>
9575
9576 * symtab.c (Symbol::init_base_output_data): Add version
9577 parameter. Change all callers.
9578 (Symbol::init_base_output_segment): Likewise.
9579 (Symbol::init_base_constant): Likewise.
9580 (Symbol::init_base_undefined): Likewise.
9581 (Sized_symbol::init_output_data): Likewise.
9582 (Sized_symbol::init_output_segment): Likewise.
9583 (Sized_symbol::init_constant): Likewise.
9584 (Sized_symbol::init_undefined): Likewise.
9585 (Symbol_table::do_define_in_output_data): If the new symbol has a
9586 version, mark it as the default.
9587 (Symbol_table::do_define_in_output_segment): Likewise.
9588 (Symbol_table::do_define_as_constant): Likewise.
9589 * symtab.h (class Symbol): Update declarations.
9590 (class Sized_symbol): Likewise.
9591 * resolve.cc (Symbol::override_version): New function.
9592 (Symbol::override_base): Call override_version.
9593 (Symbol::override_base_with_special): Likewise.
9594 * testsuite/ver_script_8.script: New file.
9595 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9596 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9597 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9598 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9599
9600 2008-05-06 Ian Lance Taylor <iant@google.com>
9601
9602 PR 6049
9603 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9604 functions.
9605 (class General_options): Remove existing --undefined, and add
9606 --no-undefined instead. Add new --undefined as synonym for -u.
9607 * archive.cc (Archive::add_symbols): Check whether symbol was
9608 named with -u.
9609 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9610 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9611 all uses. Add IS_UNDEFINED. Update declarations to split
9612 different versions of init_base. Declare init_base_undefined.
9613 (Symbol::is_defined): Handle IS_UNDEFINED.
9614 (Symbol::is_undefined): Likewise.
9615 (Symbol::is_weak_undefined): Call is_undefined.
9616 (Symbol::is_absolute): Handle IS_CONSTANT.
9617 (class Sized_symbol): Update declarations to split different
9618 versions of init. Declare init_undefined.
9619 (class Symbol_table): Declare new functions.
9620 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9621 Change all callers.
9622 (Symbol::init_base_output_data): Likewise.
9623 (Symbol::init_base_output_segment): Likewise.
9624 (Symbol::init_base_constant): Likewise.
9625 (Symbol::init_base_undefined): New function.
9626 (Sized_symbol::init_object): Rename from init. Change all
9627 callers.
9628 (Sized_symbol::init_output_data): Likewise.
9629 (Sized_symbol::init_output_segment): Likewise.
9630 (Sized_symbol::init_constant): Likewise.
9631 (Sized_symbol::init_undefined): New function.
9632 (Symbol_table::add_undefined_symbols_from_command_line): New
9633 function.
9634 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9635 function.
9636 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9637 (Symbol::output_section): Likewise.
9638 (Symbol::set_output_section): Likewise.
9639 (Symbol_table::sized_finalize_symbol): Likewise.
9640 (Symbol_table::sized_write_globals): Likewise.
9641 * resolve.cc (Symbol_table::should_override): Likewise.
9642 (Symbol::override_base_with_special): Likewise.
9643
9644 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9645 symbol, change it to have default visibility.
9646 * testsuite/protected_1.cc: New file.
9647 * testsuite/protected_2.cc: New file.
9648 * testsuite/protected_3.cc: New file.
9649 * testsuite/protected_main_1.cc: New file.
9650 * testsuite/protected_main_2.cc: New file.
9651 * testsuite/protected_main_3.cc: New file.
9652 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9653 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9654 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9655 (protected_1.so): New target.
9656 (protected_1_pic.o, protected_2_pic.o): New targets.
9657 (protected_3_pic.o): New target.
9658 (check_PROGRAMS): Add protected_2.
9659 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9660 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9661 * testsuite/Makefile.in: Rebuild.
9662
9663 * options.h (DEFINE_var): Add set_user_set_##varname__.
9664 (DEFINE_bool_alias): New macro.
9665 (class General_options): Define -Bstatic using DEFINE_bool_alias
9666 rather than DEFINE_special. Add --undefined as an alias for -z
9667 defs.
9668 * options.cc (General_options::parse_Bstatic): Remove.
9669
9670 * options.h (class General_options): Add --fatal-warnings.
9671 * main.cc (main): Implement --fatal-warnings.
9672 * errors.h (Errors::warning_count): New function.
9673
9674 * options.h (class General_options): Add -Bsymbolic-functions.
9675 * symtab.h (Symbol::is_preemptible): Check for
9676 -Bsymbolic-functions.
9677
9678 2008-05-05 Ian Lance Taylor <iant@google.com>
9679
9680 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9681 as noVARNAME rather than no-VARNAME.
9682 (class General_options): Add option -z combreloc.
9683 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9684 get_address.
9685 (Output_reloc::sort_before) [SHT_REL]: New function.
9686 (Output_reloc::sort_before) [SHT_RELA]: New function.
9687 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9688 Sort_relocs_comparison.
9689 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9690 parameter. Change all callers.
9691 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9692 sort_relocs parameter. Change all callers.
9693 * output.cc (Output_reloc::get_address): New function, broken out
9694 of write_rel.
9695 (Output_reloc::write_rel): Call it.
9696 (Output_reloc::compare): New function.
9697 (Output_data_reloc_base::do_write): Optionally sort relocs.
9698
9699 * configure.ac: If targ_extra_obj is set, link it in.
9700 * configure.tgt: Initialize all variables.
9701 (x86_64*): Set targ_extra_obj and targ_extra_size.
9702 * configure: Rebuild.
9703
9704 * object.cc (Sized_relobj::include_section_group): Adjust section
9705 indexes read from group data. Build vector to pass to
9706 layout_group.
9707 * layout.cc (Layout::layout_group): Add flags and shndxes
9708 parameters. Remove contents parameter. Change caller. Update
9709 explicit instantiations.
9710 * layout.h (class Layout): Update layout_group declaration.
9711 * output.cc (Output_data_group::Output_data_group): Add flags and
9712 input_shndxes parameters. Remove contents parameter. Change
9713 caller.
9714 (Output_data_group::do_write): Change input_sections_ to
9715 input_shndxes_.
9716 * output.h (class Output_data_group): Update constructor
9717 declaration. Rename input_sections_ to input_shndxes_.
9718 * testsuite/many_sections_test.cc: Add template.
9719
9720 2008-04-30 Cary Coutant <ccoutant@google.com>
9721
9722 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9723
9724 * layout.cc (Layout::include_section): Refactored check for debug
9725 info section.
9726 (Layout::add_comdat): Add new parameters. Change type
9727 of signature parameter. Add object and shndx to signatures table.
9728 (Layout::find_kept_object): New function.
9729 * layout.h: Include <cstring>.
9730 (Layout::is_debug_info_section): New function.
9731 (Layout::add_comdat): Add new parameters.
9732 (Layout::find_kept_object): New function.
9733 (Layout::Kept_section): New struct.
9734 (Layout::Signatures): Change type of map range.
9735 * object.cc (Relobj::output_section_address): New function.
9736 (Sized_relobj::include_section_group): Add new parameters. Change
9737 calls to Layout::add_comdat. Change to build table of kept comdat
9738 groups and table mapping discarded sections to kept sections.
9739 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9740 (Sized_relobj::do_layout): Change calls to include_section_group and
9741 include_linkonce_section.
9742 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9743 value to zero when section is discarded.
9744 (Sized_relobj::map_to_kept_section): New function.
9745 * object.h (Relobj::output_section_address): New function.
9746 (Relobj::Comdat_group): New type.
9747 (Relobj::find_comdat_group): New function.
9748 (Relobj::Comdat_group_table): New type.
9749 (Relobj::Kept_comdat_section): New type.
9750 (Relobj::Kept_comdat_section_table): New type.
9751 (Relobj::add_comdat_group): New function.
9752 (Relobj::set_kept_comdat_section): New function.
9753 (Relobj::get_kept_comdat_section): New function.
9754 (Relobj::comdat_groups_): New field.
9755 (Relobj::kept_comdat_sections_): New field.
9756 (Symbol_value::input_value): Update comment.
9757 (Sized_relobj::map_to_kept_section) New function.
9758 (Sized_relobj::include_linkonce_section): Add new parameter.
9759 * target-reloc.h (Comdat_behavior): New type.
9760 (get_comdat_behavior): New function.
9761 (relocate_section): Add code to map a discarded section to the
9762 corresponding kept section when applying a relocation.
9763
9764 2008-04-30 Craig Silverstein <csilvers@google.com>
9765
9766 * dwarf_reader.cc (next_generation_count): New static var.
9767 (Addr2line_cache_entry): New struct.
9768 (addr2line_cache): New static var.
9769 (Dwarf_line_info::one_addr2line): Added caching.
9770 (Dwarf_line_info::clear_addr2line_cache): New function.
9771 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9772 cache-size parameter.
9773 (Dwarf_line_info::one_addr2line_cache): New function.
9774 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9775 new cache-size argument to one_addr2line(), and clear cache.
9776
9777 2008-04-28 Cary Coutant <ccoutant@google.com>
9778
9779 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9780 R_386_PC8 relocations.
9781
9782 2008-04-23 Ian Lance Taylor <iant@google.com>
9783
9784 * object.cc (Sized_relobj::include_section_group): Check for
9785 invalid section group.
9786
9787 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9788 header size.
9789
9790 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9791 than read for file header.
9792 * archive.cc (Archive::include_member): Likewise.
9793
9794 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
9795
9796 * aclocal.m4: Regenerate.
9797 * configure: Regenerate.
9798
9799 2008-04-19 Ian Lance Taylor <iant@google.com>
9800
9801 * version.cc (version_string): Bump to 1.6.
9802
9803 * testsuite/Makefile.am (many_sections_r_test): New target.
9804 (many_sections_r_test_SOURCES): Remove.
9805 (many_sections_r_test_DEPENDENCIES): Remove.
9806 (many_sections_r_test_LDFLAGS): Remove.
9807 (many_sections_r_test_LDADD): Remove.
9808
9809 * object.cc (Sized_relobj::do_add_symbols): Always pass
9810 local_symbol_count_ to add_from_relobj.
9811
9812 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9813 every thousand variables.
9814 * testsuite/Makefile.in: Rebuild.
9815
9816 * object.cc (Xindex::initialize_symtab_xindex): New function.
9817 (Xindex::read_symtab_xindex): New function.
9818 (Xindex::sym_xindex_to_shndx): New function.
9819 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9820 available.
9821 (Sized_relobj::do_initialize_xindex): New function.
9822 (Sized_relobj::do_read_symbols): Adjust section links.
9823 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9824 parameter. Change all callers.
9825 (Sized_relobj::include_section_group): Adjust section links and
9826 symbol section indexes.
9827 (Sized_relobj::do_layout): Adjust section links.
9828 (Sized_relobj::do_count_local_symbols): Adjust section links and
9829 symbol section indexes.
9830 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9831 ordinary and special symbols.
9832 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9833 dynsym_xindex parameters. Change all callers. Adjust section
9834 links. Use SHN_XINDEX when needed.
9835 (Sized_relobj::get_symbol_location_info): Adjust section links.
9836 Don't get fooled by special symbols.
9837 * object.h (class Xindex): Define.
9838 (class Object): Add xindex_ parameter. Declare virtual functoin
9839 do_initialize_xindex.
9840 (Object::adjust_sym_shndx): New function.
9841 (Object::set_xindex): New protected function.
9842 (class Symbol_value): Add is_ordinary_shndx_ field.
9843 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9844 (Symbol_value::value): Assert ordinary section.
9845 (Symbol_value::initialize_input_to_output_map): Likewise.
9846 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9847 Change all callers.
9848 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9849 all callers.
9850 (class Sized_relobj): Update declarations.
9851 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9852 parameter. Change all callers.
9853 (Sized_relobj::adjust_shndx): New function.
9854 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9855 field.
9856 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9857 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9858 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9859 (Sized_dynobj::read_dynsym_section): Adjust section links.
9860 (Sized_dynobj::read_dynamic): Likewise.
9861 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9862 section links.
9863 (Sized_dynobj::do_initialize_xindex): New function.
9864 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9865 do_initialize_xindex.
9866 (Sized_dynobj::adjust_shndx): New function.
9867 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9868 dynsym_xindex_ fields.
9869 (Layout::finalize): Add a call to set_section_indexes before
9870 creating the symtab sections.
9871 (Layout::set_section_indexes): Don't do anything if the section
9872 already has a section index.
9873 (Layout::create_symtab_sections): Add shnum parameter. Change
9874 caller. Create .symtab_shndx section if needed.
9875 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9876 caller.
9877 (Layout::allocated_output_section_count): New function.
9878 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9879 needed.
9880 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9881 fields. Update declarations.
9882 (Layout::symtab_xindex): New function.
9883 (Layout::dynsym_xindex): New function.
9884 (class Write_symbols_task): Add layout_ field.
9885 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9886 Change caller.
9887 * output.cc (Output_section_headers::Output_section_headers): Add
9888 shstrtab_section parameter. Change all callers.
9889 (Output_section_headers::do_sized_write): Store overflow values
9890 for section count and section string table section index in
9891 section header zero.
9892 (Output_file_header::do_sized_write): Check for overflow of
9893 section count and section string table section index.
9894 (Output_symtab_xindex::do_write): New function.
9895 (Output_symtab_xindex::endian_do_write): New function.
9896 * output.h (class Output_section_headers): Add shstrtab_section_.
9897 Update declarations.
9898 (class Output_symtab_xindex): Define.
9899 (Output_section::has_out_shndx): New function.
9900 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9901 field.
9902 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9903 Change all callers.
9904 (Sized_symbol::init): Likewise.
9905 (Symbol::output_section): Check for ordinary symbol.
9906 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9907 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9908 callers.
9909 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9910 Change all callers. Simplify handling of symbols from sections
9911 not included in the link.
9912 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9913 distinction.
9914 (Weak_alias_sorter::operator()): Assert that symbols are
9915 ordinary.
9916 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9917 distinction.
9918 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9919 parameters. Change all callers.
9920 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9921 symbol distinction. Use SHN_XINDEX when needed.
9922 (Symbol_table::write_section_symbol): Add symtab_xindex
9923 parameter. Change all callers.
9924 (Symbol_table::sized_write_section_symbol): Likewise. Use
9925 SHN_XINDEX when needed.
9926 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9927 declarations.
9928 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9929 (Symbol::is_defined): Check is_ordinary.
9930 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9931 (Symbol::is_absolute, Symbol::is_common): Likewise.
9932 (class Sized_symbol): Update declarations.
9933 (class Symbol_table): Update declarations.
9934 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9935 parameters. Change all callers.
9936 (Sized_symbol::override): Likewise.
9937 (Symbol_table::override): Likewise.
9938 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9939 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9940 is_ordinary, and orig_st_shndx parameters. Change all callers.
9941 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9942 to be in an ordinary section.
9943 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9944 object and is_ordinary parameters. Change all callers.
9945 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9946 Change all callers. Don't add undefined or non-ordinary symbols
9947 to reloc_map_.
9948 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9949 Change all callers.
9950 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9951 declarations.
9952 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9953 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9954 (Sized_relobj::relocate_sections): Likewise.
9955 * target-reloc.h (scan_relocs): Adjust section symbol index.
9956 (scan_relocatable_relocs): Likewise.
9957 * i386.cc (Scan::local): Check for ordinary symbols.
9958 * sparc.cc (Scan::local): Likewise.
9959 * x86_64.cc (Scan::local): Likewise.
9960 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9961 to symbol_section_and_value.
9962 * testsuite/many_sections_test.cc: New file.
9963 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9964 (check_PROGRAMS): Add many_sections_test.
9965 (many_sections_test_SOURCES): Define.
9966 (many_sections_test_DEPENDENCIES): Define.
9967 (many_sections_test_LDFLAGS): Define.
9968 (BUILT_SOURCES): Add many_sections_define.h.
9969 (many_sections_define.h): New target.
9970 (BUILT_SOURCES): Add many_sections_check.h.
9971 (many_sections_check.h): New target.
9972 (check_PROGRAMS): Add many_sections_r_test.
9973 (many_sections_r_test_SOURCES): Define.
9974 (many_sections_r_test_DEPENDENCIES): Define.
9975 (many_sections_r_test_LDFLAGS): Define.
9976 (many_sections_r_test_LDADD): Define.
9977 (many_sections_r_test.o): New target.
9978 * testsuite/Makefile.in: Rebuild.
9979
9980 2008-04-17 Cary Coutant <ccoutant@google.com>
9981
9982 * errors.cc (Errors::info): New function.
9983 (gold_info): New function.
9984 * errors.h (Errors::info): New function.
9985 * gold.h (gold_info): New function.
9986 * object.cc (Input_objects::add_object): Print trace output.
9987 * options.cc (options::parse_set): New function.
9988 (General_options::parse_wrap): Deleted.
9989 (General_options::General_options): Deleted initializer.
9990 * options.h (options::String_set): New typedef.
9991 (options::parse_set): New function.
9992 (DEFINE_set): New macro.
9993 (General_options::wrap): Changed to use DEFINE_set. Changed
9994 callers of any_wrap_symbols and is_wrap_symbol.
9995 (General_options::trace, General_options::trace_symbol):
9996 New options.
9997 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9998 (General_options::wrap_symbols_): Deleted.
9999 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10000
10001 2008-04-17 David S. Miller <davem@davemloft.net>
10002
10003 * options.cc (General_options::parse_V): New function.
10004 * options.h: Add entries for -V and -Qy.
10005
10006 2008-04-17 Ian Lance Taylor <iant@google.com>
10007
10008 * common.cc (Symbol_table::allocate_commons): Remove options
10009 parameter. Change caller.
10010 (Symbol_table::do_allocate_commons): Remove options parameter.
10011 Change caller. Just call do_allocate_commons_list twice.
10012 (Symbol_table::do_allocate_commons_list): New function, broken out
10013 of do_allocate_commons.
10014 * common.h (class Allocate_commons_task): Remove options_ field.
10015 Update constructor.
10016 * symtab.cc (Symbol_table::Symbol_table): Initialize
10017 tls_commons_.
10018 (Symbol_table::add_from_object): Put TLS common symbols on
10019 tls_commons_ list.
10020 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10021 which are IN_OUTPUT_DATA.
10022 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10023 allocate_commons and do_allocate_commons declarations. Declare
10024 do_allocate_commons_list.
10025 * gold.cc (queue_middle_tasks): Update creation of
10026 Allocate_commons_task to not pass options.
10027 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10028 (TLS_TEST_C_FLAGS): New variable.
10029 (tls_test_c_pic.o): New target.
10030 (tls_test_shared.so): Link in tls_test_c_pic.o.
10031 (tls_test_c_pic_ie.o): New target.
10032 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10033 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10034 (tls_test_c.o): New target.
10035 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10036 (tls_pic_test_LDADD): Likewise.
10037 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10038 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10039 (tls_test_c_gnu2.o): New target.
10040 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10041 tls_test_c_gnu2.o.
10042 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10043 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10044 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10045 * testsuite/tls_test.cc: Include "config.h".
10046 (t_last): Call t11_last.
10047 * testsuite/tls_test.h (t11, t11_last): Declare.
10048 * testsuite/tls_test_c.c: New file.
10049 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10050 * configure.ac: Check for OpenMP support.
10051 * configure, config.in, Makefile.in: Rebuild.
10052 * testsuite/Makefile.in: Rebuild.
10053
10054 2008-04-16 Cary Coutant <ccoutant@google.com>
10055
10056 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10057 (Target_i386::tls_base_symbol_defined_): New field.
10058 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10059 (Target_i386::Scan::global): Likewise.
10060 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10061 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10062 (Target_x86_64::tls_base_symbol_defined_): New field.
10063 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10064 (Target_x86_64::Scan::global): Likewise.
10065
10066 2008-04-16 Cary Coutant <ccoutant@google.com>
10067
10068 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10069 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10070 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10071 building shared libraries.
10072 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10073 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10074 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10075 * testsuite/Makefile.in: Rebuild.
10076 * testsuite/weak_undef.h: New file.
10077 * testsuite/weak_undef_file1.cc: Add extra test cases.
10078 * testsuite/weak_undef_file2.cc: Likewise.
10079 * testsuite/weak_undef_test.cc: Likewise.
10080
10081 2008-04-16 David S. Miller <davem@davemloft.net>
10082
10083 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10084 Add issued_non_pic_error_ field. Declare check_non_pic.
10085 (Target_sparc::Scan::check_non_pic): New function.
10086 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10087 (Target_sparc::Scan::global): Likewise.
10088
10089 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10090 * configure: Rebuild.
10091
10092 * options.h (DEFINE_enable): New macro.
10093 (new_dtags): New enable option.
10094 (initfirst, interpose, loadfltr, nodefaultlib,
10095 nodelete, nodlopen, nodump): New -z options.
10096 * layout.cc (Layout:finish_dynamic_section): If new
10097 dtags enabled, emit DT_RUNPATH. Also, emit a
10098 DT_FLAGS_1 containing any specified -z flags.
10099
10100 2008-04-16 Ian Lance Taylor <iant@google.com>
10101
10102 * copy-relocs.cc: New file.
10103 * copy-relocs.h: New file.
10104 * reloc.cc: Remove Copy_relocs code.
10105 * reloc.h: Likewise.
10106 * reloc-types.h (struct Reloc_types) [both versions]: Add
10107 get_reloc_addend_noerror.
10108 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10109 variants of add_global which take an addend which must be zero.
10110 * i386.cc: Include "copy-relocs.h".
10111 (class Target_i386): Change type of copy_relocs_ to variable,
10112 update initializer.
10113 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10114 Change all callers.
10115 (Target_i386::do_finalize_sections): Change handling of
10116 copy_relocs_.
10117 * sparc.cc: Include "copy-relocs.h".
10118 (class Target_sparc): Change type of copy_relocs_ to variable,
10119 update initializer.
10120 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10121 Change all callers.
10122 (Target_sparc::do_finalize_sections): Change handling of
10123 copy_relocs_.
10124 * x86_64.cc: Include "copy-relocs.h".
10125 (class Target_x86_64): Change type of copy_relocs_ to variable,
10126 update initializer.
10127 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10128 class. Change all callers.
10129 (Target_x86_64::do_finalize_sections): Change handling of
10130 copy_relocs_.
10131 * Makefile.am (CCFILES): Add copy-relocs.cc.
10132 (HFILES): Add copy-relocs.h.
10133
10134 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10135
10136 * testsuite/script_test_4.sh: Permit leading zeroes.
10137
10138 2008-04-15 Ian Lance Taylor <iant@google.com>
10139
10140 * script-sections.cc (Script_sections::create_segments): Use
10141 header_size_adjustment even when there is enough room for the
10142 headers.
10143 * testsuite/script_test_4.sh: New file.
10144 * testsuite/script_test_4.t: New file.
10145 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10146 (check_DATA): Add script_test_4.stdout.
10147 (MOSTLYCLEANFILES): Likewise.
10148 (script_test_4): New target.
10149 (script_test_4.stdout): New target.
10150 * testsuite/Makefile.in: Rebuild.
10151
10152 * sparc.cc: Add definitions for Output_data_plt_sparc class
10153 constants.
10154
10155 2008-04-14 David S. Miller <davem@davemloft.net>
10156
10157 * sparc.cc: New file.
10158 * Makefile.am (TARGETSOURCES): Add sparc.cc
10159 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10160 * configure.tgt: Document targ_extra_size and
10161 targ_extra_big_endian. Add entries for sparc-* and
10162 sparc64-*.
10163 * configure.ac: Handle targ_extra_size and
10164 targ_extra_big_endian.
10165 * Makefile.in: Rebuild.
10166 * configure: Likewise.
10167 * po/POTFILES.in: Likewise.
10168 * po/gold.pot: Likewise.
10169
10170 2008-04-14 Ian Lance Taylor <iant@google.com>
10171
10172 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10173 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10174 in the name/type/flags to section mapping. Don't call
10175 allocate_output_section.
10176 (Layout::choose_output_section): Change parameter from adjust_name
10177 to is_input_section. Don't permit input sections after sections
10178 are attached to segments. Don't call allocate_output_section.
10179 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10180 not write_enable_output_section.
10181 (Layout::make_output_section): Don't push to
10182 unattached_section_list_ nor call attach_to_segment. Call
10183 attach_section_to_segment if sections are attached.
10184 (Layout::attach_sections_to_segments): New function.
10185 (Layout::attach_section_to_segment): New function.
10186 (Layout::attach_allocated_section_to_segment): Rename from
10187 attach_to_segment. Remove flags parameter.
10188 (Layout::allocate_output_section): Remove function.
10189 (Layout::write_enable_output_section): Remove function.
10190 * layout.h (class Layout): Update for above changes. Add new
10191 field sections_are_attached_.
10192 * output.h (Output_section::update_flags_for_input_section): New
10193 function.
10194 * output.cc (Output_section::add_input_section): Call
10195 update_flags_for_input_section.
10196 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10197
10198 2008-04-11 Cary Coutant <ccoutant@google.com>
10199
10200 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10201 thought unnecessary.
10202 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10203
10204 2008-04-11 Ian Lance Taylor <iant@google.com>
10205
10206 * output.h (class Output_section_data): Remove inline definition
10207 of set_addralign.
10208 * output.cc (Output_section_data::set_addralign): New function.
10209
10210 2008-04-11 Cary Coutant <ccoutant@google.com>
10211
10212 Add support for TLS descriptors for i386 and x86_64.
10213 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10214 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10215 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10216 GOT_TYPE_TLS_DESC.
10217 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10218 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10219 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10220 relocations.
10221 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10222 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10223 Fix problem with initial-exec relocations.
10224 (Target_i386::Relocate::relocate_tls): Likewise.
10225 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10226 relaxation.
10227 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10228 support for section-plus-offset dynamic table entries.
10229 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10230 (Output_data_dynamic::Dynamic_entry): Add support for
10231 section-plus-offset dynamic table entries.
10232 (Output_data_dynamic::Classification): Likewise.
10233 (Output_data_dynamic::classification_): Renamed offset_.
10234 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10235 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10236 (Target_x86_64::make_plt_section): New function.
10237 (Target_x86_64::reserve_tlsdesc_entries): New function.
10238 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10239 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10240 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10241 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10242 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10243 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10244 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10245 add extra PLT entry for TLS descriptors.
10246 (Output_data_plt_x86_64::got_): New field.
10247 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10248 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10249 fields.
10250 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10251 descriptors.
10252 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10253 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10254 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10255 R_386_TLS_DESC_CALL relocations.
10256 (Target_x86_64::Scan::global): Likewise.
10257 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10258 for TLS descriptors.
10259 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10260 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10261 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10262 GD-to-IE relaxation.
10263 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10264 and TLS_DESCRIPTORS.
10265 * Makefile.in: Rebuild.
10266 * configure: Rebuild.
10267 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10268 (tls_test_shared2.so): New target.
10269 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10270 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10271 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10272 (tls_shared_gd_to_ie_test_LDADD): New variable.
10273 (tls_shared_gnu2_gd_to_ie_test): New target.
10274 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10275 New targets.
10276 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10277 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10278 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10279 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10280 (tls_shared_gnu2_test): New target.
10281 (tls_test_gnu2_shared.so): New target.
10282 (tls_shared_gnu2_test_SOURCES): New variable.
10283 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10284 (tls_shared_gnu2_test_LDFLAGS): New variable.
10285 (tls_shared_gnu2_test_LDADD): New variable.
10286 * testsuite/Makefile.in: Rebuild.
10287 * testsuite/Makefile.
10288
10289 2008-04-11 Ian Lance Taylor <iant@google.com>
10290
10291 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10292 justsyms.t.
10293 * testsuite/Makefile.in: Rebuild.
10294
10295 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10296 long.
10297 * testsuite/script_test_2.cc (main): Adjust test.
10298
10299 2008-04-11 David S. Miller <davem@davemloft.net>
10300 Ian Lance Taylor <iant@google.com>
10301
10302 * options.h (General_options): Add entries for '-Y' and
10303 '-relax'.
10304 * options.cc (General_options:finalize): If -Y was used, add those
10305 entries to the library path instead of the default "/lib" and
10306 "/usr/lib".
10307
10308 2008-04-11 David S. Miller <davem@davemloft.net>
10309
10310 * testsuite/justsyms.t: Start at 0x100.
10311 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10312 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10313 long.
10314 * testsuite/script_test_2.cc: Adjust string and section length
10315 checks.
10316
10317 2008-04-09 Ian Lance Taylor <iant@google.com>
10318
10319 PR gold/5996
10320 * script-sections.cc (Sections_element::allocate_to_segment): Add
10321 orphan parameter.
10322 (Output_section_definition::allocate_to_segment): Likewise.
10323 (Orphan_output_section::allocate_to_segment): Likewise.
10324 (Script_sections::attach_sections_using_phdrs_clause): Don't
10325 propagate non-PT_LOAD segments to orphan sections.
10326 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10327 readelf rather than objdump.
10328 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10329 .interp section and PT_INTERP segment are the same size.
10330 * testsuite/Makefile.in: Rebuild.
10331
10332 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10333 aliases for symbols defined in the same object.
10334 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10335 (weak_alias_test_SOURCES): New variable.
10336 (weak_alias_test_DEPENDENCIES): New variable.
10337 (weak_alias_test_LDFLAGS): New variable.
10338 (weak_alias_test_LDADD): New variable.
10339 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10340 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10341 (weak_alias_test_3.o): New target.
10342 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10343 * testsuite/weak_alias_test_main.cc: New file.
10344 * testsuite/weak_alias_test_1.cc: New file.
10345 * testsuite/weak_alias_test_2.cc: New file.
10346 * testsuite/weak_alias_test_3.cc: New file.
10347
10348 2008-04-08 Ian Lance Taylor <iant@google.com>
10349
10350 * options.h (class General_options): Add --noinhibit-exec option.
10351 * main.cc (main): Check --noinhibit-exec.
10352
10353 * options.h (class General_options): Define --wrap as a special
10354 option. Add wrap_symbols_ field.
10355 (General_options::any_wrap_symbols): New function.
10356 (General_options::is_wrap_symbol): New function.
10357 * options.cc (General_options::parse_wrap): New function.
10358 (General_options::General_options): Initialize wrap_symbols_.
10359 * symtab.cc (Symbol_table::wrap_symbol): New function.
10360 (Symbol_table::add_from_object): Handle --wrap.
10361 * symtab.h (class Symbol_table): Declare wrap_symbol.
10362 * target.h (Target::wrap_char): New function.
10363 (Target::Target_info): Add wrap_char field.
10364 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10365 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10366 * testsuite/testfile.cc (Target_test::test_target_info):
10367 Likewise.
10368
10369 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10370 there is one.
10371
10372 * layout.h (class Layout): Add added_eh_frame_data_ field.
10373 * layout.cc (Layout::Layout): Initialize new field.
10374 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10375 output section until we find a section we merged successfully.
10376 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10377 that the size be non-zero.
10378
10379 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10380 qualifier.
10381
10382 2008-04-08 Craig Silverstein <csilvers@google.com>
10383
10384 * configure.ac: Export new conditional variable HAVE_ZLIB.
10385 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10386 on HAVE_ZLIB.
10387 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10388 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10389
10390 2008-04-07 Ian Lance Taylor <iant@google.com>
10391
10392 * version.cc (version_string): Set to "1.5".
10393
10394 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10395 Add issued_non_pic_error_ field. Declare check_non_pic.
10396 (Target_x86_64::Scan::check_non_pic): New function.
10397 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10398 (Target_x86_64::Scan::global): Likewise.
10399
10400 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10401 addend parameter. Change caller. Handle merge sections.
10402 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10403 Address to Addend. Don't add in the result of
10404 local_section_offset, pass down the addend and use the returned
10405 value.
10406 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10407 Update declarations of local_section_offset and symbol_value.
10408 * testsuite/two_file_test_1.cc (t18): New function.
10409 * testsuite/two_file_test_2.cc (f18): New function.
10410 * testsuite/two_file_test_main.cc (main): Call t18.
10411 * testsuite/two_file_test.h (t18, f18): Declare.
10412
10413 * configure.ac: Don't test for objdump, c++filt, or readelf.
10414 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10415 conditionals.
10416 (TEST_READELF): New variable.
10417 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10418 (check_PROGRAMS): Add two_file_strip_test.
10419 (two_file_strip_test): New target.
10420 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10421 (two_file_same_shared_strip_test_SOURCES): New variable.
10422 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10423 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10424 (two_file_same_shared_strip_test_LDADD): New variable.
10425 (two_file_shared_strip.so): New target.
10426 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10427 (ver_test_5.syms, ver_test_7.syms): Likewise.
10428 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10429 (strip_test_3.stdout): Use TEST_OBJDUMP.
10430 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10431
10432 2008-04-04 Cary Coutant <ccoutant@google.com>
10433
10434 * symtab.h (Symbol::is_weak_undefined): New function.
10435 (Symbol::is_strong_undefined): New function.
10436 (Symbol::is_absolute): New function.
10437 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10438 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10439 absolute symbols.
10440 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10441 (weak_undef_test): New target.
10442 * testsuite/Makefile.in: Rebuild.
10443 * testsuite/weak_undef_file1.cc: New file.
10444 * testsuite/weak_undef_file2.cc: New file.
10445 * testsuite/weak_undef_test.cc: New file.
10446
10447 2008-04-03 Craig Silverstein <csilvers@google.com>
10448
10449 * compressed_output.h (class Output_compressed_section): Use
10450 unsigned buffer.
10451 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10452 add zlib header.
10453 (zlib_compressed_suffix): Removed.
10454 (Output_compressed_section::set_final_data_size): Use unsigned
10455 buffers.
10456 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10457 Fix linker invocation.
10458 (flagstest_o_specialfile_and_compress_debug_sections):
10459 Likewise.
10460 * testsuite/Makefile.in: Regenerated.
10461
10462 2008-04-02 David S. Miller <davem@davemloft.net>
10463
10464 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10465 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10466
10467 2008-04-02 Craig Silverstein <csilvers@google.com>
10468
10469 * TODO: New file.
10470
10471 2008-04-02 Ian Lance Taylor <iant@google.com>
10472
10473 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10474 parameters. Update for new key type to views_. Change all
10475 callers.
10476 (File_read::read): Adjust for byteshift in returned view.
10477 (File_read::add_view): New function, broken out of
10478 find_and_make_view.
10479 (File_read::make_view): New function, broken out of
10480 find_and_make_view.
10481 (File_read::find_or_make_view): Add offset and aligned
10482 parameters. Rewrite accordingly. Change all callers.
10483 (File_read::get_view): Add offset and aligned parameters. Adjust
10484 for byteshift in return value.
10485 (File_read::get_lasting_view): Likewise.
10486 * fileread.h (class File_read): Update declarations.
10487 (class File_read::View): Add byteshift_ field. Add byteshift to
10488 constructor. Add byteshift method.
10489 * archive.h (Archive::clear_uncached_views): New function.
10490 (Archive::get_view): Add aligned parameter. Change all callers.
10491 * object.h (Object::get_view): Add aligned parameter. Change all
10492 callers.
10493 (Object::get_lasting_view): Likewise.
10494
10495 * fileread.cc (File_read::release): Don't call clear_views if
10496 there are multiple objects.
10497 * fileread.h (File_read::clear_uncached_views): New function.
10498 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10499 on the archive.
10500
10501 2008-03-31 Cary Coutant <ccoutant@google.com>
10502
10503 Add thin archive support.
10504 * archive.cc (Archive::armagt): New const.
10505 (Archive::setup): Remove task parameter and calls to unlock.
10506 (Archive::unlock_nested_archives): New function.
10507 (Archive::read_header): Add nested_off parameter. Change
10508 all callers.
10509 (Archive::interpret_header): Likewise.
10510 (Archive::include_all_members): Change to handle thin
10511 archives.
10512 (Archive::include_member): Likewise.
10513 * archive.h (Archive::Archive): Add new parameters and
10514 initializers.
10515 (Archive::armagt): New const.
10516 (Archive::setup): Remove task parameter.
10517 (Archive::unlock_nested_archives): New function.
10518 (Archive::read_header): Add nested_off parameter.
10519 (Archive::interpret_header): Likewise.
10520 (Archive::Nested_archive_table): New typedef.
10521 (Archive::is_thin_archive_): New field.
10522 (Archive::nested_archives_): New field.
10523 (Archive::options_): New field.
10524 (Archive::dirpath_): New field.
10525 (Archive::task_): New field.
10526 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10527 for thin archives. Pass additional parameters to
10528 Archive::Archive. Unlock the archive file after calling
10529 Archive::setup.
10530
10531 2008-03-29 Ian Lance Taylor <iant@google.com>
10532
10533 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10534 version symbol to be local.
10535 * testsuite/ver_test_4.sh: New file.
10536 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10537 (check_DATA): Add ver_test_4.syms.
10538 (ver_test_4.syms): New target.
10539 * testsuite/Makefile.in: Rebuild.
10540
10541 * output.cc
10542 (Output_section::Input_section_sort_entry::has_priority): New
10543 function.
10544 (Output_section::Input_section_sort_entry::match_file_name): New
10545 function.
10546 (Output_section::Input_section_sort_entry::match_section_name):
10547 Remove.
10548 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10549 Remove.
10550 (Output_section::Input_section_sort_entry::match_section_file):
10551 Remove.
10552 (Output_section::Input_section_sort_compare::operator()): Rewrite
10553 using new Input_section_sort_entry functions. Sort crtbegin and
10554 crtend first. Sort sections with no priority before sections with
10555 a priority.
10556 * testsuite/initpri1.c (d3): Check j != 4.
10557 (cd5): New constructor/destructor function.
10558 (main): Check j != 2.
10559
10560 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10561 new symbol when resolving, don't call set_is_default.
10562 * testsuite/ver_test_7.cc: New file.
10563 * testsuite/ver_test_7.sh: New file.
10564 * testsuite/Makefile.am (ver_test_7.so): New target.
10565 (ver_test_7.o): New target.
10566 (check_SCRIPTS): Add ver_test_7.sh.
10567 (check_DATA): Add ver_test_7.syms.
10568 (ver_test_7.syms): New target.
10569
10570 2008-03-28 Ian Lance Taylor <iant@google.com>
10571
10572 * layout.cc (Layout::layout): If we see an input section with a
10573 name that needs sorting, set the must_sort flag for the output
10574 section.
10575 (Layout::make_output_section): If the name of the output section
10576 indicates that it might require sorting, set the may_sort flag.
10577 * output.h (Output_section::may_sort_attached_input_sections): New
10578 function.
10579 (Output_section::set_may_sort_attached_input_sections): New
10580 function.
10581 (Output_section::must_sort_attached_input_sections): New
10582 function.
10583 (Output_section::set_must_sort_attached_input_sections): New
10584 function.
10585 (class Output_section): Declare Input_section_sort_entry. Define
10586 Input_section_sort_compare. Declare
10587 sort_attached_input_sections. Add new fields:
10588 may_sort_attached_input_sections_,
10589 must_sort_attached_input_sections_,
10590 attached_input_sections_are_sorted_.
10591 * output.cc (Output_section::Output_section): Initialize new
10592 fields.
10593 (Output_section::add_input_section): Add an entry to
10594 input_sections_ if may_sort or must_sort are true.
10595 (Output_section::set_final_data_size): Call
10596 sort_attached_input_sections if necessary.
10597 (Output_section::Input_section_sort_entry): Define new class.
10598 (Output_section::Input_section_sort_compare::operator()): New
10599 function.
10600 (Output_section::sort_attached_input_sections): New function.
10601 * configure.ac: Check whether the compiler supports constructor
10602 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10603 * testsuite/initpri1.c: New file.
10604 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10605 CONSTRUCTOR_PRIORITY.
10606 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10607 (initpri1_LDFLAGS): New variable.
10608 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10609
10610 2008-03-27 Ian Lance Taylor <iant@google.com>
10611
10612 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10613 * testsuite/common_test_1.c: New file.
10614 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10615 (common_test_1_SOURCES): New variable.
10616 (common_test_1_DEPENDENCIES): New variable.
10617 (common_test_1_LDFLAGS): New variable.
10618
10619 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10620 and commons_ correctly when NAME/VERSION does not override
10621 NAME/NULL.
10622 * testsuite/ver_test_6.c: New file.
10623 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10624 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10625 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10626
10627 2008-03-26 Ian Lance Taylor <iant@google.com>
10628
10629 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10630 of an undefined symbol from a version script.
10631 * testsuite/Makefile.am (ver_test_5.so): New target.
10632 (ver_test_5.o): New target.
10633 (check_SCRIPTS): Add ver_test_5.sh.
10634 (check_DATA): Add ver_test_5.syms.
10635 (ver_test_5.syms): New target.
10636 * testsuite/ver_test_5.cc: New file.
10637 * testsuite/ver_test_5.script: New file.
10638 * testsuite/ver_test_5.sh: New file.
10639 * Makefile.in, testsuite/Makefile.in: Rebuild.
10640
10641 PR gold/5986
10642 Fix problems building gold with gcc 4.3.0.
10643 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10644 (gold_error_at_location, gold_warning_at_location): Use it.
10645 * configure.ac: Check whether we can compile and use a template
10646 function with a printf attribute.
10647 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10648 when jumping over bytes.
10649 * object.cc: Instantiate Object::read_section_data.
10650 * debug.h: Include <cstring>
10651 * dwarf_reader.cc: Include <algorithm>
10652 * main.cc: Include <cstring>.
10653 * options.cc: Include <cstring>.
10654 * output.cc: Include <cstring>.
10655 * script.cc: Include <cstring>.
10656 * script.h: Include <string>.
10657 * symtab.cc: Include <cstring> and <algorithm>.
10658 * target-select.cc: Include <cstring>.
10659 * version.cc: Include <string>.
10660 * testsuite/testmain.cc: Include <cstdlib>.
10661 * configure, config.in: Rebuild.
10662
10663 2008-03-25 Ian Lance Taylor <iant@google.com>
10664
10665 * options.cc: Include "../bfd/bfdver.h".
10666 (options::help): Print bug reporting address.
10667
10668 * version.cc (print_version): Adjust output for current value of
10669 BFD_VERSION_STRING.
10670
10671 * NEWS: New file.
10672
10673 * options.cc (options::help): Print list of supported targets.
10674 * target-select.h: Include <vector>.
10675 (class Target_selector): Make machine_, size_, and is_big_endian_
10676 fields const. Add bfd_name_ and instantiated_target_ fields.
10677 (Target_selector::Target_selector): Add bfd_name parameter.
10678 (Target_selector::recognize): Make non-virtual, call
10679 do_recognize.
10680 (Target_selector::recognize_by_name): Make non-virtual, call
10681 do_recognize_by_name.
10682 (Target_selector::supported_names): New function.
10683 (Target_selector::bfd_name): New function.
10684 (Target_selector::do_instantiate_target): New pure virtual
10685 function.
10686 (Target_selector::do_recognize): New virtual function.
10687 (Target_selector::do_recognize_by_name): New virtual function.
10688 (Target_selector::instantiate_target): New private function.
10689 (supported_target_names): Declare.
10690 * target-select.cc (Target_selector::Target_selector): Update for
10691 new parameter and fields.
10692 (select_target_by_name): Check that the name matches before
10693 calling recognize_by_name.
10694 (supported_target_names): New function.
10695 * i386.cc (class Target_selector_i386): Update Target_selector
10696 constructor call. Remove recognize and recognize_by_name. Add
10697 do_instantiate_target.
10698 * x86_64.cc (class Target_selector_x86_64): Likewise.
10699 * testsuite/testfile.cc (class Target_selector_test): Update for
10700 changes to Target_selector.
10701
10702 * README: Rewrite, with some notes on unsupported features.
10703
10704 2008-03-24 Cary Coutant <ccoutant@google.com>
10705
10706 * i386.cc (Target_i386::Got_type): New enum declaration.
10707 (Target_i386::Scan::local): Updated callers of Output_data_got
10708 member functions.
10709 (Target_i386::Scan::global): Likewise.
10710 (Target_i386::Relocate::relocate): Likewise.
10711 (Target_i386::Relocate::relocate_tls): Likewise.
10712 * object.h (Got_offset_list): New class.
10713 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10714 (Sized_relobj::local_got_offset): Likewise.
10715 (Sized_relobj::set_local_got_offset): Likewise.
10716 (Sized_relobj::local_has_tls_got_offset): Removed.
10717 (Sized_relobj::local_tls_got_offset): Removed.
10718 (Sized_relobj::set_local_tls_got_offset): Removed.
10719 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10720 * output.cc (Output_data_got::add_global): Added got_type parameter.
10721 (Output_data_got::add_global_with_rel): Likewise.
10722 (Output_data_got::add_global_with_rela): Likewise.
10723 (Output_data_got::add_global_pair_with_rel): New function.
10724 (Output_data_got::add_global_pair_with_rela): New function.
10725 (Output_data_got::add_local): Added got_type parameter.
10726 (Output_data_got::add_local_with_rel): Likewise.
10727 (Output_data_got::add_local_with_rela): Likewise.
10728 (Output_data_got::add_local_pair_with_rel): New function.
10729 (Output_data_got::add_local_pair_with_rela): New function.
10730 (Output_data_got::add_global_tls): Removed.
10731 (Output_data_got::add_global_tls_with_rel): Removed.
10732 (Output_data_got::add_global_tls_with_rela): Removed.
10733 (Output_data_got::add_local_tls): Removed.
10734 (Output_data_got::add_local_tls_with_rel): Removed.
10735 (Output_data_got::add_local_tls_with_rela): Removed.
10736 * output.h (Output_data_got::add_global): Added got_type parameter.
10737 (Output_data_got::add_global_with_rel): Likewise.
10738 (Output_data_got::add_global_with_rela): Likewise.
10739 (Output_data_got::add_global_pair_with_rel): New function.
10740 (Output_data_got::add_global_pair_with_rela): New function.
10741 (Output_data_got::add_local): Added got_type parameter.
10742 (Output_data_got::add_local_with_rel): Likewise.
10743 (Output_data_got::add_local_with_rela): Likewise.
10744 (Output_data_got::add_local_pair_with_rel): New function.
10745 (Output_data_got::add_local_pair_with_rela): New function.
10746 (Output_data_got::add_global_tls): Removed.
10747 (Output_data_got::add_global_tls_with_rel): Removed.
10748 (Output_data_got::add_global_tls_with_rela): Removed.
10749 (Output_data_got::add_local_tls): Removed.
10750 (Output_data_got::add_local_tls_with_rel): Removed.
10751 (Output_data_got::add_local_tls_with_rela): Removed.
10752 * resolve.cc (Symbol::override_base_with_special): Removed
10753 reference to has_got_offset_ field.
10754 * symtab.cc (Symbol::init_fields): Replaced initialization
10755 of got_offset_ with got_offsets_. Removed initialization
10756 of has_got_offset_
10757 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10758 (Symbol::got_offset): Likewise.
10759 (Symbol::set_got_offset): Likewise.
10760 (Symbol::has_tls_got_offset): Removed.
10761 (Symbol::tls_got_offset): Removed.
10762 (Symbol::set_tls_got_offset): Removed.
10763 (Symbol::got_offset_): Removed.
10764 (Symbol::tls_mod_got_offset_): Removed.
10765 (Symbol::tls_pair_got_offset_): Removed.
10766 (Symbol::got_offsets_): New field.
10767 (Symbol::has_got_offset): Removed.
10768 (Symbol::has_tls_mod_got_offset): Removed.
10769 (Symbol::has_tls_pair_got_offset): Removed.
10770 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10771 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10772 member functions.
10773 (Target_x86_64::Scan::global): Likewise.
10774 (Target_x86_64::Relocate::relocate): Likewise.
10775 (Target_x86_64::Relocate::relocate_tls): Likewise.
10776
10777 2008-03-25 Ben Elliston <bje@au.ibm.com>
10778
10779 * yyscript.y: Fix spelling error in comment.
10780
10781 2008-03-24 Ian Lance Taylor <iant@google.com>
10782
10783 * options.h (class General_options): Define build_id option.
10784 * layout.h (class Layout): Declare write_build_id, create_note,
10785 create_build_id. Add build_id_note_ member.
10786 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10787 "libiberty.h", "md5.h", "sha1.h".
10788 (Layout::Layout): Initialize eh_frame_data_,
10789 eh_frame_hdr_section_, and build_id_note_.
10790 (Layout::finalize): Call create_build_id.
10791 (Layout::create_note): New function, broken out of
10792 Layout::create_gold_note.
10793 (Layout::create_gold_note): Call create_note.
10794 (Layout::create_build_id): New function.
10795 (Layout::write_build_id): New function.
10796 (Close_task_runner::run): Call write_build_id.
10797
10798 * x86_64.cc: Correct license to GPLv3.
10799
10800 2008-03-23 Ian Lance Taylor <iant@google.com>
10801
10802 * options.cc: Include "demangle.h".
10803 (parse_optional_string): New function.
10804 (parse_long_option): Handle takes_optional_argument.
10805 (parse_short_option): Update dash_z initializer. Handle
10806 takes_optional_argument.
10807 (General_options::General_options): Initialize do_demangle_.
10808 (General_options::finalize): Set do_demangle_. Handle demangling
10809 style.
10810 * options.h (parse_optional_string): Declare.
10811 (struct One_option): Add optional_arg field. Update constructor.
10812 Update call constructor calls. Add takes_optional_argument
10813 function.
10814 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10815 (DEFINE_optional_string): Define.
10816 (General_options::demangle): Change from DEFINE_bool to
10817 DEFINE_optional_string.
10818 (General_options::no_demangle): New function.
10819 (General_options::do_demangle): New function.
10820 (General_options::set_do_demangle): New function.
10821 (General_options::execstack_status_): Move definition to end of
10822 class definition.
10823 (General_options::static_): Likewise.
10824 (General_options::do_demangle_): New field.
10825 * object.cc (big_endian>::get_symbol_location_info): Call
10826 Options::do_demangle, not Options::demangle.
10827 * symtab.cc (demangle): Likewise.
10828
10829 2008-03-22 Ian Lance Taylor <iant@google.com>
10830
10831 * gold.h: Include <cstddef> and <sys/types.h>
10832 * options.h: Include <cstring>.
10833
10834 2008-03-21 Ian Lance Taylor <iant@google.com>
10835
10836 * Added source code to GNU binutils.
This page took 0.259622 seconds and 5 git commands to generate.