* dynobj.h (Dynobj::do_dynobj): New function.
[binutils-gdb.git] / gold / ChangeLog
1 2011-05-24 Cary Coutant <ccoutant@google.com>
2
3 * dynobj.h (Dynobj::do_dynobj): New function.
4 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5 flag and soname for shared objects.
6 * incremental.cc (Incremental_inputs::report_object): Make
7 either Incremental_object_entry or Incremental_dynobj_entry; add
8 soname to string table.
9 (Incremental_inputs::report_input_section): Add assertion.
10 (Output_section_incremental_inputs::set_final_data_size): Adjust
11 type of input file entry for shared libraries; adjust size of
12 shared library info entry.
13 (Output_section_incremental_inputs::write_input_files): Write
14 as_needed flag for shared libraries.
15 (Output_section_incremental_inputs::write_info_blocks): Adjust type
16 of input file entry for shared libraries; write soname.
17 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
18 soname from incremental info.
19 * incremental.h (enum Incremental_input_flags): Add
20 INCREMENTAL_INPUT_AS_NEEDED.
21 (Incremental_input_entry::Incremental_input_entry): Initialize new
22 data member.
23 (Incremental_input_entry::set_as_needed): New function.
24 (Incremental_input_entry::as_needed): New function.
25 (Incremental_input_entry::do_dynobj_entry): New function.
26 (Incremental_input_entry::as_needed_): New data member.
27 (Incremental_object_entry::Incremental_object_entry): Don't check
28 for shared library.
29 (Incremental_object_entry::do_type): Likewise.
30 (class Incremental_dynobj_entry): New class.
31 (Incremental_input_entry_reader::as_needed): New function.
32 (Incremental_input_entry_reader::get_soname): New function.
33 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
34 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
35 size of shared library info entry.
36 * layout.cc (Layout::finish_dynamic_section): Don't test for
37 incremental link when adding DT_NEEDED entries.
38 * object.h (Object::Object): Initialize new data member.
39 (Object::dynobj): New function.
40 (Object::set_as_needed): New function.
41 (Object::as_needed): New function.
42 (Object::do_dynobj): New function.
43 (Object::as_needed_): New data member.
44
45 2011-05-24 Cary Coutant <ccoutant@google.com>
46
47 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
48 info; adjust display of GOT entries.
49 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
50 vector of input objects; remove file_status_.
51 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
52 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
53 got_plt reader; call target hooks to reserve GOT entries.
54 (Output_section_incremental_inputs::set_final_data_size): Adjust size
55 of input file info header and GOT info entry.
56 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
57 relocation info.
58 (Got_plt_view_info::got_descriptor): Remove.
59 (Got_plt_view_info::sym_index): New data member.
60 (Got_plt_view_info::input_index): New data member.
61 (Local_got_offset_visitor::visit): Write input file index.
62 (Global_got_offset_visitor::visit): Write 0 for input file index.
63 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
64 with sym_index and input_index.
65 (Output_section_incremental_inputs::write_got_plt): Adjust size of
66 incremental info GOT entry; replace got_descriptor with input_index.
67 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
68 map from input file index to object.
69 (Sized_relobj_incr::do_layout): Replace direct data member reference
70 with accessor function.
71 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
72 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
73 Adjust size of input file info header.
74 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
75 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
76 (Incremental_input_entry_reader::get_input_section): Adjust size of
77 input file info header.
78 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
79 of incremental info GOT entry.
80 (Incremental_got_plt_reader::get_got_desc): Remove.
81 (Incremental_got_plt_reader::get_got_symndx): New function.
82 (Incremental_got_plt_reader::get_got_input_index): New function.
83 (Sized_incremental_binary::Sized_incremental_binary): Remove
84 file_status_; add input_objects_.
85 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
86 (Sized_incremental_binary::set_file_is_unchanged): Remove.
87 (Sized_incremental_binary::file_is_unchanged): Remove.
88 (Sized_incremental_binary::set_input_object): New function.
89 (Sized_incremental_binary::input_object): New function.
90 (Sized_incremental_binary::file_status_): Remove.
91 (Sized_incremental_binary::input_objects_): New data member.
92 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
93 references.
94 (Sized_relobj_incr::invalid_address): Move to base class.
95 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
96 class.
97 (Sized_relobj_incr::do_output_section_offset): Likewise.
98 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
99 (Sized_relobj_incr::section_offsets_): Likewise.
100 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
101 function.
102 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
103 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
104 with accessor function.
105 (Sized_relobj_file::do_layout): Likewise.
106 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
107 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
108 (Sized_relobj_file::compute_final_local_value): Replace refs to
109 section_offsets_ with accessor function.
110 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
111 * object.h (Relobj::Relobj): Initialize new data members.
112 (Relobj::add_dyn_reloc): New function.
113 (Relobj::first_dyn_reloc): New function.
114 (Relobj::dyn_reloc_count): New function.
115 (Relobj::first_dyn_reloc_): New data member.
116 (Relobj::dyn_reloc_count_): New data member.
117 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
118 references.
119 (Sized_relobj::Address): New typedef.
120 (Sized_relobj::invalid_address): Move here from child class.
121 (Sized_relobj::Sized_relobj): Initialize new data members.
122 (Sized_relobj::sized_relobj): New function.
123 (Sized_relobj::is_output_section_offset_invalid): Move here from
124 child class.
125 (Sized_relobj::get_output_section_offset): Likewise.
126 (Sized_relobj::local_has_got_offset): Likewise.
127 (Sized_relobj::local_got_offset): Likewise.
128 (Sized_relobj::set_local_got_offset): Likewise.
129 (Sized_relobj::do_for_all_local_got_entries): Likewise.
130 (Sized_relobj::clear_got_offsets): New function.
131 (Sized_relobj::section_offsets): Move here from child class.
132 (Sized_relobj::do_output_section_offset): Likewise.
133 (Sized_relobj::do_set_section_offset): Likewise.
134 (Sized_relobj::Local_got_offsets): Likewise.
135 (Sized_relobj::local_got_offsets_): Likewise.
136 (Sized_relobj::section_offsets_): Likewise.
137 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
138 references.
139 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
140 class.
141 (Sized_relobj_file::sized_relobj): New function
142 (Sized_relobj_file::local_has_got_offset): Move to base class.
143 (Sized_relobj_file::local_got_offset): Likewise.
144 (Sized_relobj_file::set_local_got_offset): Likewise.
145 (Sized_relobj_file::get_output_section_offset): Likewise.
146 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
147 (Sized_relobj_file::do_output_section_offset): Likewise.
148 (Sized_relobj_file::do_set_section_offset): Likewise.
149 (Sized_relobj_file::Local_got_offsets): Likewise.
150 (Sized_relobj_file::local_got_offsets_): Likewise.
151 (Sized_relobj_file::section_offsets_): Likewise.
152 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
153 (all constructors).
154 (set_needs_dynsym_index): Convert relobj to derived class pointer.
155 (Output_reloc::get_symbol_index): Likewise.
156 (Output_reloc::local_section_offset): Likewise.
157 (Output_reloc::get_address): Likewise.
158 (Output_reloc::symbol_value): Likewise.
159 (Output_data_got::reserve_slot): Move to class definition.
160 (Output_data_got::reserve_local): New function.
161 (Output_data_got::reserve_slot_for_global): Remove.
162 (Output_data_got::reserve_global): New function.
163 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
164 (all constructors, two instantiations).
165 (Output_reloc::get_relobj): New function (two instantiations).
166 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
167 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
168 (Output_data_reloc::add_global): Adjust type of relobj.
169 (Output_data_reloc::add_global_relative): Likewise.
170 (Output_data_reloc::add_symbolless_global_addend): Likewise.
171 (Output_data_reloc::add_local): Likewise.
172 (Output_data_reloc::add_local_relative): Likewise.
173 (Output_data_reloc::add_symbolless_local_addend): Likewise.
174 (Output_data_reloc::add_local_section): Likewise.
175 (Output_data_reloc::add_output_section): Likewise.
176 (Output_data_reloc::add_absolute): Likewise.
177 (Output_data_reloc::add_target_specific): Likewise.
178 (Output_data_got::reserve_slot): Move definition here.
179 (Output_data_got::reserve_local): New function.
180 (Output_data_got::reserve_global): New function.
181 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
182 section_offsets_ with accessor function.
183 (Sized_relobj_file::write_sections): Likewise.
184 (Sized_relobj_file::do_relocate_sections): Likewise.
185 * target.h (Sized_target::reserve_local_got_entry): New function.
186 (Sized_target::reserve_global_got_entry): New function.
187 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
188 (Target_x86_64::reserve_global_got_entry): New function.
189 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
190
191 2011-05-23 Cary Coutant <ccoutant@google.com>
192
193 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
194 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
195 bit when checking got_type.
196 * incremental.cc (Sized_incremental_binary::setup_readers):
197 Store symbol table and string table locations; initialize bit vector
198 of file status flags.
199 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
200 unchanged files.
201 (Sized_incremental_binary::do_process_got_plt): New function.
202 (Sized_incremental_binary::get_symtab_view): Use stored locations.
203 (Output_section_incremental_inputs::set_final_data_size): Record
204 file index for each input file.
205 (Output_section_incremental_inputs::write_got_plt): Store file index
206 instead of input entry offset for each GOT entry.
207 * incremental.h
208 (Incremental_input_entry::Incremental_input_entry): Initialize new
209 data member.
210 (Incremental_input_entry::set_offset): Store file index.
211 (Incremental_input_entry::get_file_index): New function.
212 (Incremental_input_entry::file_index_): New data member.
213 (Incremental_binary::process_got_plt): New function.
214 (Incremental_binary::do_process_got_plt): New function.
215 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
216 data members.
217 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
218 (Sized_incremental_binary::set_file_is_unchanged): New function.
219 (Sized_incremental_binary::file_is_unchanged): New function.
220 (Sized_incremental_binary::do_process_got_plt): New function.
221 (Sized_incremental_binary::file_status_): New data member.
222 (Sized_incremental_binary::main_symtab_loc_): New data member.
223 (Sized_incremental_binary::main_strtab_loc_): New data member.
224 * output.cc (Output_data_got::Got_entry::write): Add case
225 RESERVED_CODE.
226 (Output_data_got::add_global): Call add_got_entry.
227 (Output_data_got::add_global_plt): Likewise.
228 (Output_data_got::add_global_with_rel): Likewise.
229 (Output_data_got::add_global_with_rela): Likewise.
230 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
231 (Output_data_got::add_global_pair_with_rela): Likewise.
232 (Output_data_got::add_local): Call add_got_entry.
233 (Output_data_got::add_local_plt): Likewise.
234 (Output_data_got::add_local_with_rel): Likewise.
235 (Output_data_got::add_local_with_rela): Likewise.
236 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
237 (Output_data_got::add_local_pair_with_rela): Likewise.
238 (Output_data_got::reserve_slot): New function.
239 (Output_data_got::reserve_slot_for_global): New function.
240 (Output_data_got::add_got_entry): New function.
241 (Output_data_got::add_got_entry_pair): New function.
242 (Output_section::add_output_section_data): Edit FIXME.
243 * output.h
244 (Output_section_data_build::Output_section_data_build): New
245 constructor with size parameter.
246 (Output_data_space::Output_data_space): Likewise.
247 (Output_data_got::Output_data_got): Initialize new data member; new
248 constructor with size parameter.
249 (Output_data_got::add_constant): Call add_got_entry.
250 (Output_data_got::reserve_slot): New function.
251 (Output_data_got::reserve_slot_for_global): New function.
252 (class Output_data_got::Got_entry): Add RESERVED_CODE.
253 (Output_data_got::add_got_entry): New function.
254 (Output_data_got::add_got_entry_pair): New function.
255 (Output_data_got::free_list_): New data member.
256 * target.h (Sized_target::init_got_plt_for_update): New function.
257 (Sized_target::register_global_plt_entry): New function.
258 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
259 Initialize new data member; call init; add constructor with PLT count.
260 (Output_data_plt_x86_64::init): New function.
261 (Output_data_plt_x86_64::add_relocation): New function.
262 (Output_data_plt_x86_64::reserve_slot): New function.
263 (Output_data_plt_x86_64::free_list_): New data member.
264 (Target_x86_64::init_got_plt_for_update): New function.
265 (Target_x86_64::register_global_plt_entry): New function.
266 (Output_data_plt_x86_64::add_entry): Allocate from free list for
267 incremental updates.
268 (Output_data_plt_x86_64::add_relocation): New function.
269 * testsuite/object_unittest.cc (Object_test): Set default options.
270
271 2011-05-16 Ian Lance Taylor <iant@google.com>
272
273 * options.h (class General_options): Make -i a synonym for -r.
274
275 2011-05-16 Ian Lance Taylor <iant@google.com>
276
277 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
278
279 2011-05-10 Cary Coutant <ccoutant@google.com>
280
281 * object.cc (Sized_relobj::do_count_local_symbols): Check for
282 strip_all (-s).
283
284 2011-05-06 Ian Lance Taylor <iant@google.com>
285
286 * layout.cc (Layout::layout): If the output section flags change,
287 update the ordering.
288
289 2011-04-25 Cary Coutant <ccoutant@google.com>
290
291 * incremental-dump.cc (dump_incremental_inputs): Print local
292 symbol info for each input file.
293 * incremental.cc
294 (Output_section_incremental_inputs::set_final_data_size): Add local
295 symbol info to input file entries in incremental info.
296 (Output_section_incremental_inputs::write_info_blocks): Likewise.
297 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
298 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
299 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
300 implementation.
301 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
302 (Sized_incr_relobj::do_relocate): Write the local symbols.
303 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
304 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
305 Adjust size of input file header.
306 (Incremental_inputs_reader::get_local_symbol_offset): New function.
307 (Incremental_inputs_reader::get_local_symbol_count): New function.
308 (Incremental_inputs_reader::get_input_section): Adjust size of input
309 file header.
310 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
311 (Sized_incr_relobj::This): New typedef.
312 (Sized_incr_relobj::sym_size): New const data member.
313 (Sized_incr_relobj::Local_symbol): New struct.
314 (Sized_incr_relobj::do_output_local_symbol_count): New function.
315 (Sized_incr_relobj::do_local_symbol_offset): New function.
316 (Sized_incr_relobj::local_symbol_count_): New data member.
317 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
318 (Sized_incr_relobj::local_symbol_index_): New data member.
319 (Sized_incr_relobj::local_symbol_offset_): New data member.
320 (Sized_incr_relobj::local_dynsym_offset_): New data member.
321 (Sized_incr_relobj::local_symbols_): New data member.
322 * object.h (Relobj::output_local_symbol_count): New function.
323 (Relobj::local_symbol_offset): New function.
324 (Relobj::do_output_local_symbol_count): New function.
325 (Relobj::do_local_symbol_offset): New function.
326 (Sized_relobj::do_output_local_symbol_count): New function.
327 (Sized_relobj::do_local_symbol_offset): New function.
328
329 2011-04-22 Vladimir Simonov <sv@sw.ru>
330
331 * descriptors.cc (set_close_on_exec): New function.
332 (Descriptors::open): Use set_close_on_exec.
333 * output.cc (S_ISLNK): Define if not defined.
334
335 2011-04-22 Cary Coutant <ccoutant@google.com>
336
337 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
338 global symbol map.
339 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
340 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
341 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
342 relocations.
343 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
344 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
345 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
346 * incremental.h
347 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
348 function.
349 (Incremental_binary::apply_incremental_relocs): New function.
350 (Incremental_binary::do_apply_incremental_relocs): New function.
351 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
352 data member.
353 (Sized_incremental_binary::add_global_symbol): New function.
354 (Sized_incremental_binary::global_symbol): New function.
355 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
356 (Sized_incremental_binary::symbol_map_): New data member.
357 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
358 * target.h (Sized_target::apply_relocation): New function.
359 * target-reloc.h (apply_relocation): New function.
360 * x86_64.cc (Target_x86_64::apply_relocation): New function.
361
362 2011-04-22 Doug Kwan <dougkwan@google.com>
363
364 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
365 flag of a SHT_ARM_EXIDX section.
366 * testsuite/Makefile.am (arm_exidx_test): New test rules.
367 * testsuite/Makefile.in: Regenerate.
368 * testsuite/arm_exidx_test.s: New file.
369 * testsuite/arm_exidx_test.sh: Same.
370
371 2011-04-20 Cary Coutant <ccoutant@google.com>
372
373 PR gold/12689
374 * archive.h (Incremental_archive_entry::Archive_member):
375 Initialize arg_serial_ (second constructor).
376
377 2011-04-17 Ian Lance Taylor <iant@google.com>
378
379 * object.cc (Relocate_info::location): Simplify location string.
380 * errors.cc (Errors::error_at_location): Don't print program
381 name.
382 (Errors::warning_at_location): Likewise.
383 (Errors::undefined_symbol): Likewise.
384 * testsuite/debug_msg.sh: Update accordingly.
385
386 2011-04-14 Cary Coutant <ccoutant@google.com>
387
388 * gold/layout.cc (Layout::symtab_section_offset): New function.
389 * gold/layout.h (Layout::symtab_section_offset): New function.
390 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
391
392 2011-04-12 Ian Lance Taylor <iant@google.com>
393
394 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
395 with MREMAP_MAYMOVE.
396 * output.h (class Output_file): Add map_is_allocated_ field.
397 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
398 not available, provide stubs. If mremap is not available, #define
399 it to gold_mremap.
400 (MREMAP_MAYMOVE): Define if not defined.
401 (Output_file::Output_file): Initialize map_is_allocated_.
402 (Output_file::resize): Check map_is_allocated_.
403 (Output_file::map_anonymous): If mmap fails, use malloc.
404 (Output_file::unmap): Don't do anything for an anonymous map.
405 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
406 is not available, provide stubs.
407 (File_read::View::~View): Use free rather than delete[].
408 (File_read::make_view): Use malloc rather than new[]. If mmap
409 fails, use malloc.
410 (File_read::find_or_make_view): Use malloc rather than new[].
411 * gold.h: Remove HAVE_REMAP code.
412 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
413 exists. Rename mremap to gold_mremap. If mmap is not available
414 don't do anything.
415 * configure, config.in: Rebuild.
416
417 2011-04-11 Ian Lance Taylor <iant@google.com>
418
419 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
420 initialize local variable v.
421
422 2011-04-11 Cary Coutant <ccoutant@google.com>
423
424 * archive.cc (Archive::include_member): Adjust call to
425 report_object.
426 (Add_archive_symbols::run): Track argument serial numbers.
427 (Lib_group::include_member): Likewise.
428 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
429 * archive.h (Incremental_archive_entry::Archive_member):
430 Initialize arg_serial_.
431 (Archive_member::arg_serial_): New data member.
432 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
433 (Sized_dynobj::do_add_symbols): Track symbols when doing an
434 incremental link.
435 (Sized_dynobj::do_for_all_local_got_entries): New function.
436 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
437 function.
438 * fileread.cc (get_mtime): New function.
439 * fileread.h (get_mtime): New function.
440 * gold.cc (queue_initial_tasks): Check for incremental update.
441 (process_incremental_input): New function.
442 (queue_middle_tasks): Don't force valid target for incremental
443 update.
444 * incremental-dump.cc (find_input_containing_global): Adjust
445 size of symbol info entry.
446 (dump_incremental_inputs): Dump argument serial number and
447 in_system_directory flag; bias shndx by 1; print symbol names
448 when dumping per-file symbol lists; use new symbol info readers.
449 * incremental.cc
450 (Output_section_incremental_inputs:update_data_size): New function.
451 (Sized_incremental_binary::setup_readers): Setup input readers
452 for each input file; build maps for files added from libraries
453 and scripts.
454 (Sized_incremental_binary::check_input_args): New function.
455 (Sized_incremental_binary::do_check_inputs): Build map of argument
456 serial numbers to input arguments.
457 (Sized_incremental_binary::do_file_has_changed): Rename
458 do_file_is_unchanged to this; compare file modification times.
459 (Sized_incremental_binary::do_init_layout): New function.
460 (Sized_incremental_binary::do_reserve_layout): New function.
461 (Sized_incremental_binary::do_get_input_reader): Remove.
462 (Sized_incremental_binary::get_symtab_view): New function.
463 (Incremental_checker::can_incrementally_link_output_file): Remove.
464 (Incremental_inputs::report_command_line): Exclude --debug options.
465 (Incremental_inputs::report_archive_begin): Add parameter; track
466 argument serial numbers; don't put input file entry for archive
467 before archive members.
468 (Incremental_inputs::report_archive_end): Put input file entry
469 for archive after archive members.
470 (Incremental_inputs::report_object): Add parameter; track argument
471 serial numbers and in_system_directory flag.
472 (Incremental_inputs::report_script): Add parameter; track argument
473 serial numbers.
474 (Output_section_incremental_inputs::set_final_data_size): Adjust
475 size of symbol info entry; check for forwarding symbols.
476 (Output_section_incremental_inputs::write_input_files): Write
477 in_system_directory flag and argument serial number.
478 (Output_section_incremental_inputs::write_info_blocks): Map section
479 indices between incremental info and original input file; store
480 input section index for each symbol.
481 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
482 change operator() to visit().
483 (class Global_got_offset_visitor): Likewise.
484 (class Global_symbol_visitor_got_plt):
485 (Output_section_incremental_inputs::write_got_plt): Use new visitor
486 classes.
487 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
488 (Sized_incr_relobj::do_read_symbols): New function.
489 (Sized_incr_relobj::do_layout): New function.
490 (Sized_incr_relobj::do_layout_deferred_sections): New function.
491 (Sized_incr_relobj::do_add_symbols): New function.
492 (Sized_incr_relobj::do_should_include_member): New function.
493 (Sized_incr_relobj::do_for_all_global_symbols): New function.
494 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
495 (Sized_incr_relobj::do_section_size): New function.
496 (Sized_incr_relobj::do_section_name): New function.
497 (Sized_incr_relobj::do_section_contents): New function.
498 (Sized_incr_relobj::do_section_flags): New function.
499 (Sized_incr_relobj::do_section_entsize): New function.
500 (Sized_incr_relobj::do_section_address): New function.
501 (Sized_incr_relobj::do_section_type): New function.
502 (Sized_incr_relobj::do_section_link): New function.
503 (Sized_incr_relobj::do_section_info): New function.
504 (Sized_incr_relobj::do_section_addralign): New function.
505 (Sized_incr_relobj::do_initialize_xindex): New function.
506 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
507 (Sized_incr_relobj::do_read_relocs): New function.
508 (Sized_incr_relobj::do_gc_process_relocs): New function.
509 (Sized_incr_relobj::do_scan_relocs): New function.
510 (Sized_incr_relobj::do_count_local_symbols): New function.
511 (Sized_incr_relobj::do_finalize_local_symbols): New function.
512 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
513 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
514 (Sized_incr_relobj::do_relocate): New function.
515 (Sized_incr_relobj::do_set_section_offset): New function.
516 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
517 (Sized_incr_dynobj::do_read_symbols): New function.
518 (Sized_incr_dynobj::do_layout): New function.
519 (Sized_incr_dynobj::do_add_symbols): New function.
520 (Sized_incr_dynobj::do_should_include_member): New function.
521 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
522 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
523 (Sized_incr_dynobj::do_section_size): New function.
524 (Sized_incr_dynobj::do_section_name): New function.
525 (Sized_incr_dynobj::do_section_contents): New function.
526 (Sized_incr_dynobj::do_section_flags): New function.
527 (Sized_incr_dynobj::do_section_entsize): New function.
528 (Sized_incr_dynobj::do_section_address): New function.
529 (Sized_incr_dynobj::do_section_type): New function.
530 (Sized_incr_dynobj::do_section_link): New function.
531 (Sized_incr_dynobj::do_section_info): New function.
532 (Sized_incr_dynobj::do_section_addralign): New function.
533 (Sized_incr_dynobj::do_initialize_xindex): New function.
534 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
535 (make_sized_incremental_object): New function.
536 (Incremental_library::copy_unused_symbols): New function.
537 (Incremental_library::do_for_all_unused_symbols): New function.
538 * incremental.h (enum Incremental_input_flags): New type.
539 (class Incremental_checker): Remove.
540 (Incremental_input_entry::Incremental_input_entry): Add argument
541 serial number.
542 (Incremental_input_entry::arg_serial): New function.
543 (Incremental_input_entry::set_is_in_system_directory): New function.
544 (Incremental_input_entry::is_in_system_directory): New function.
545 (Incremental_input_entry::arg_serial_): New data member.
546 (Incremental_input_entry::is_in_system_directory_): New data member.
547 (class Script_info): Move here from script.h.
548 (Script_info::Script_info): Add filename parameter.
549 (Script_info::filename): New function.
550 (Script_info::filename_): New data member.
551 (Incremental_script_entry::Incremental_script_entry): Add argument
552 serial number.
553 (Incremental_object_entry::Incremental_object_entry): Likewise.
554 (Incremental_object_entry::add_input_section): Build list of input
555 sections with map to original shndx.
556 (Incremental_object_entry::get_input_section_index): New function.
557 (Incremental_object_entry::shndx_): New data member.
558 (Incremental_object_entry::name_key_): Rename; adjust all refs.
559 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
560 (Incremental_archive_entry::Incremental_archive_entry): Add argument
561 serial number.
562 (Incremental_inputs::report_archive_begin): Likewise.
563 (Incremental_inputs::report_object): Likewise.
564 (Incremental_inputs::report_script): Likewise.
565 (class Incremental_global_symbol_reader): New class.
566 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
567 and store flags and input file type.
568 (Incremental_input_entry_reader::arg_serial): New function.
569 (Incremental_input_entry_reader::type): Extract type from flags.
570 (Incremental_input_entry_reader::is_in_system_directory): New function.
571 (Incremental_input_entry_reader::get_input_section_count): Call
572 accessor function for type.
573 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
574 function for type; adjust size of global symbol entry.
575 (Incremental_input_entry_reader::get_global_symbol_count): Call
576 accessor function for type.
577 (Incremental_input_entry_reader::get_object_count): Likewise.
578 (Incremental_input_entry_reader::get_object_offset): Likewise.
579 (Incremental_input_entry_reader::get_member_count): Likewise.
580 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
581 (Incremental_input_entry_reader::get_member_offset): Likewise.
582 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
583 (Incremental_input_entry_reader::Global_symbol_info): Remove.
584 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
585 (Incremental_input_entry_reader::get_global_symbol_reader): New
586 function.
587 (Incremental_input_entry_reader::get_output_symbol_index): New
588 function.
589 (Incremental_input_entry_reader::type_): Remove.
590 (Incremental_input_entry_reader::flags_): New data member.
591 (Incremental_inputs_reader::input_file_offset): New function.
592 (Incremental_inputs_reader::input_file_index): New function.
593 (Incremental_inputs_reader::input_file): Call input_file_offset.
594 (Incremental_inputs_reader::input_file_at_offset): New function.
595 (Incremental_relocs_reader::get_r_type): Reformat.
596 (Incremental_relocs_reader::get_r_shndx): Reformat.
597 (Incremental_relocs_reader::get_r_offset): Reformat.
598 (Incremental_relocs_reader::data): New function.
599 (Incremental_binary::Incremental_binary): Initialize new data members.
600 (Incremental_binary::check_inputs): Add cmdline parameter.
601 (Incremental_binary::file_is_unchanged): Remove.
602 (Input_reader::arg_serial): New function.
603 (Input_reader::get_unused_symbol_count): New function.
604 (Input_reader::get_unused_symbol): New function.
605 (Input_reader::do_arg_serial): New function.
606 (Input_reader::do_get_unused_symbol_count): New function.
607 (Input_reader::do_get_unused_symbol): New function.
608 (Incremental_binary::input_file_count): New function.
609 (Incremental_binary::get_input_reader): Change signature to use
610 index instead of filename.
611 (Incremental_binary::file_has_changed): New function.
612 (Incremental_binary::get_input_argument): New function.
613 (Incremental_binary::get_library): New function.
614 (Incremental_binary::get_script_info): New function.
615 (Incremental_binary::init_layout): New function.
616 (Incremental_binary::reserve_layout): New function.
617 (Incremental_binary::output_file): New function.
618 (Incremental_binary::do_check_inputs): New function.
619 (Incremental_binary::do_file_is_unchanged): Remove.
620 (Incremental_binary::do_file_has_changed): New function.
621 (Incremental_binary::do_init_layout): New function.
622 (Incremental_binary::do_reserve_layout): New function.
623 (Incremental_binary::do_input_file_count): New function.
624 (Incremental_binary::do_get_input_reader): Change signature.
625 (Incremental_binary::input_args_map_): New data member.
626 (Incremental_binary::library_map_): New data member.
627 (Incremental_binary::script_map_): New data member.
628 (Sized_incremental_binary::Sized_incremental_binary): Initialize
629 new data members.
630 (Sized_incremental_binary::output_section): New function.
631 (Sized_incremental_binary::inputs_reader): Add const.
632 (Sized_incremental_binary::symtab_reader): Add const.
633 (Sized_incremental_binary::relocs_reader): Add const.
634 (Sized_incremental_binary::got_plt_reader): Add const.
635 (Sized_incremental_binary::get_symtab_view): New function.
636 (Sized_incremental_binary::Inputs_reader): New typedef.
637 (Sized_incremental_binary::Input_entry_reader): New typedef.
638 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
639 (Sized_incremental_binary::do_file_is_unchanged): Remove.
640 (Sized_incremental_binary::do_file_has_changed): New function.
641 (Sized_incremental_binary::do_init_layout): New function.
642 (Sized_incremental_binary::do_reserve_layout): New function.
643 (Sized_input_reader::Inputs_reader): Remove.
644 (Sized_input_reader::Input_entry_reader): Remove.
645 (Sized_input_reader::do_arg_serial): New function.
646 (Sized_input_reader::do_get_unused_symbol_count): New function.
647 (Sized_input_reader::do_get_unused_symbol): New function.
648 (Sized_incremental_binary::do_input_file_count): New function.
649 (Sized_incremental_binary::do_get_input_reader): Change signature;
650 use index instead of filename.
651 (Sized_incremental_binary::section_map_): New data member.
652 (Sized_incremental_binary::input_entry_readers_): New data member.
653 (class Sized_incr_relobj): New class.
654 (class Sized_incr_dynobj): New class.
655 (make_sized_incremental_object): New function.
656 (class Incremental_library): New class.
657 * layout.cc (Free_list::num_lists): New static data member.
658 (Free_list::num_nodes): New static data member.
659 (Free_list::num_removes): New static data member.
660 (Free_list::num_remove_visits): New static data member.
661 (Free_list::num_allocates): New static data member.
662 (Free_list::num_allocate_visits): New static data member.
663 (Free_list::init): New function.
664 (Free_list::remove): New function.
665 (Free_list::allocate): New function.
666 (Free_list::dump): New function.
667 (Free_list::print_stats): New function.
668 (Layout_task_runner::run): Resize output file for incremental updates.
669 (Layout::Layout): Initialize new data members.
670 (Layout::set_incremental_base): New function.
671 (Layout::init_fixed_output_section): New function.
672 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
673 incremental updates.
674 (Layout::create_gold_note): Do not create gold note section for
675 incremental updates.
676 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
677 for incremental updates.
678 (Layout::set_section_offsets): For incremental updates, allocate space
679 from free list.
680 (Layout::create_symtab_sections): Layout with offsets relative to
681 start of section; for incremental updates, allocate space from free
682 list.
683 (Layout::create_shdrs): For incremental updates, allocate space from
684 free list.
685 (Layout::finish_dynamic_section): For incremental updates, do not
686 check --as-needed (fixed in subsequent patch).
687 * layout.h (class Free_list): New class.
688 (Layout::set_incremental_base): New function.
689 (Layout::incremental_base): New function.
690 (Layout::init_fixed_output_section): New function.
691 (Layout::allocate): New function.
692 (Layout::incremental_base_): New data member.
693 (Layout::free_list_): New data member.
694 * main.cc (main): Print Free_list statistics.
695 * object.cc (Relobj::finalize_incremental_relocs): Add
696 clear_counts parameter; clear counts only when clear_counts is set.
697 (Sized_relobj::Sized_relobj): Initialize new base class.
698 (Sized_relobj::do_layout): Don't report special sections.
699 (Sized_relobj::do_for_all_local_got_entries): New function.
700 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
701 symtab_off to all symbol table offsets.
702 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
703 * object.h (class Got_offset_list): Move to top of file.
704 (Object::Object): Allow case where input_file == NULL.
705 (Object::~Object): Likewise.
706 (Object::input_file): Assert that input_file != NULL.
707 (Object::lock): Allow case where input_file == NULL.
708 (Object::unlock): Likewise.
709 (Object::is_locked): Likewise.
710 (Object::token): Likewise.
711 (Object::release): Likewise.
712 (Object::is_incremental): New function.
713 (Object::get_mtime): New function.
714 (Object::for_all_local_got_entries): New function.
715 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
716 (Object::set_is_in_system_directory): New function.
717 (Object::is_in_system_directory): New function.
718 (Object::do_is_incremental): New function.
719 (Object::do_get_mtime): New function.
720 (Object::do_for_all_local_got_entries): New function.
721 (Object::is_in_system_directory_): New data member.
722 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
723 (class Sized_relobj_base): New class.
724 (class Sized_relobj): Derive from Sized_relobj_base.
725 (class Sized_relobj::Symbols): Redeclare from base class.
726 (class Sized_relobj::local_got_offset_list): Remove.
727 (class Sized_relobj::Output_sections): Redeclare from base class.
728 (class Sized_relobj::do_for_all_local_got_entries): New function.
729 (class Sized_relobj::write_local_symbols): Add offset parameter.
730 (class Sized_relobj::local_symbol_offset_): Update comment.
731 (class Sized_relobj::local_dynsym_offset_): Update comment.
732 * options.cc (Input_arguments::add_file): Remove const.
733 * options.h (Input_file_argument::Input_file_argument):
734 Initialize arg_serial_ (all constructors).
735 (Input_file_argument::set_arg_serial): New function.
736 (Input_file_argument::arg_serial): New function.
737 (Input_file_argument::arg_serial_): New data member.
738 (Input_arguments::Input_arguments): Initialize file_count_.
739 (Input_arguments::add_file): Remove const.
740 (Input_arguments::number_of_input_files): New function.
741 (Input_arguments::file_count_): New data member.
742 (Command_line::number_of_input_files): Call
743 Input_arguments::number_of_input_files.
744 * output.cc (Output_segment_headers::Output_segment_headers):
745 Set current size.
746 (Output_section::Input_section::current_data_size): New function.
747 (Output_section::Output_section): Initialize new data members.
748 (Output_section::add_input_section): Don't do merge sections for
749 an incremental link; allocate space from free list for an
750 incremental update.
751 (Output_section::add_output_section_data): Allocate space from
752 free list for an incremental update.
753 (Output_section::update_data_size): New function.
754 (Output_section::set_fixed_layout): New function.
755 (Output_section::reserve): New function.
756 (Output_segment::set_section_addresses): Remove const.
757 (Output_segment::set_section_list_addresses): Remove const; allocate
758 space from free list for an incremental update.
759 (Output_segment::set_offset): Adjust size of RELRO segment for an
760 incremental update.
761 * output.h (Output_data::current_data_size): Move here from
762 child classes.
763 (Output_data::pre_finalize_data_size): New function.
764 (Output_data::update_data_size): New function.
765 (Output_section_headers::update_data_size): new function.
766 (Output_section_data_build::current_data_size): Move to Output_data.
767 (Output_data_strtab::update_data_size): New function.
768 (Output_section::current_data_size): Move to Output_data.
769 (Output_section::set_fixed_layout): New function.
770 (Output_section::has_fixed_layout): New function.
771 (Output_section::reserve): New function.
772 (Output_section::update_data_size): New function.
773 (Output_section::has_fixed_layout_): New data member.
774 (Output_section::free_list_): New data member.
775 (Output_segment::set_section_addresses): Remove const.
776 (Output_segment::set_section_list_addresses): Remove const.
777 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
778 New function.
779 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
780 New function.
781 * readsyms.cc (Read_symbols::do_read_symbols): Add library
782 parameter when calling Add_symbols constructor; store argument
783 serial number for members of a lib group.
784 (Add_symbols::locks): Allow case where token == NULL.
785 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
786 (Read_member::~Read_member): New function.
787 (Read_member::is_runnable): New function.
788 (Read_member::locks): New function.
789 (Read_member::run): New function.
790 (Check_script::~Check_script): New function.
791 (Check_script::is_runnable): New function.
792 (Check_script::locks): New function.
793 (Check_script::run): New function.
794 (Check_library::~Check_library): New function.
795 (Check_library::is_runnable): New function.
796 (Check_library::locks): New function.
797 (Check_library::run): New function.
798 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
799 (Add_symbols::library_): New data member.
800 (class Read_member): New class.
801 (class Check_script): New class.
802 (class Check_library): New class.
803 * reloc.cc (Read_relocs::is_runnable): Allow case where
804 token == NULL.
805 (Read_relocs::locks): Likewise.
806 (Scan_relocs::locks): Likewise.
807 (Relocate_task::locks): Likewise.
808 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
809 to clear counters.
810 (Sized_relobj::incremental_relocs_scan): Fix comment.
811 (Sized_relobj::do_relocate): Pass output file offset to
812 write_local_symbols.
813 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
814 from class declaration.
815 * script.cc (read_input_script): Allocate Script_info; pass
816 argument serial number to report_script.
817 * script.h (class Script_info): Move to incremental.h.
818 * symtab.cc (Symbol_table::add_from_incrobj): New function.
819 * symtab.h (Symbol_table::add_from_incrobj): New function.
820 (Symbol_table::set_file_offset): New function.
821
822 2011-04-05 Cary Coutant <ccoutant@google.com>
823
824 * incremental-dump.cc (dump_incremental_inputs): Change signature
825 to take a Sized_incremental_binary; change caller. Use readers
826 in Sized_incremental_binary.
827 * incremental.cc
828 (Sized_incremental_binary::find_incremental_inputs_sections):
829 Rename do_find_incremental_inputs_sections to this.
830 (Sized_incremental_binary::setup_readers): New function.
831 (Sized_incremental_binary::do_check_inputs): Check
832 has_incremental_info_ flag; move setup code to setup_readers;
833 use input readers.
834 (Sized_incremental_binary::do_file_is_unchanged): New function.
835 (Sized_incremental_binary::do_get_input_reader): New function.
836 * incremental.h (class Incremental_binary): Move to end of file.
837 (Incremental_binary::file_is_unchanged): New function.
838 (Incremental_binary::do_file_is_unchanged): New function.
839 (Incremental_binary::Input_reader): New class.
840 (Incremental_binary::get_input_reader): New function.
841 (class Sized_incremental_binary): Move to end of file.
842 (Sized_incremental_binary::Sized_incremental_binary): Setup the
843 input section reader classes.
844 (Sized_incremental_binary::has_incremental_info): New function.
845 (Sized_incremental_binary::inputs_reader): New function.
846 (Sized_incremental_binary::symtab_reader): New function.
847 (Sized_incremental_binary::relocs_reader): New function.
848 (Sized_incremental_binary::got_plt_reader): New function.
849 (Sized_incremental_binary::do_file_is_unchanged): New function.
850 (Sized_incremental_binary::Sized_input_reader): New class.
851 (Sized_incremental_binary::get_input_reader): New function.
852 (Sized_incremental_binary::find_incremental_inputs_sections):
853 Rename do_find_incremental_inputs_sections to this.
854 (Sized_incremental_binary::setup_readers): New function.
855 (Sized_incremental_binary::has_incremental_info_): New data member.
856 (Sized_incremental_binary::inputs_reader_): New data member.
857 (Sized_incremental_binary::symtab_reader_): New data member.
858 (Sized_incremental_binary::relocs_reader_): New data member.
859 (Sized_incremental_binary::got_plt_reader_): New data member.
860 (Sized_incremental_binary::current_input_file_): New data member.
861
862 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
863
864 PR gold/12640
865 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
866 violation.
867
868 2011-03-30 Cary Coutant <ccoutant@google.com>
869
870 * archive.cc (Archive::include_member): Adjust call to report_object.
871 (Add_archive_symbols::run): Add script_info to call to
872 report_archive_begin.
873 (Lib_group::include_member): Adjust call to report_object.
874 (Add_lib_group_symbols::run): Adjust call to report_object.
875 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
876 blocks. Add object count for script input files.
877 * incremental.cc (Incremental_inputs::report_archive_begin): Add
878 script_info parameter; change all callers.
879 (Incremental_inputs::report_object): Add script_info parameter;
880 change all callers.
881 (Incremental_inputs::report_script): Store backpointer to
882 incremental info entry.
883 (Output_section_incremental_inputs::set_final_data_size): Record
884 additional information for scripts.
885 (Output_section_incremental_inputs::write_info_blocks): Likewise.
886 * incremental.h (Incremental_script_entry::add_object): New function.
887 (Incremental_script_entry::get_object_count): New function.
888 (Incremental_script_entry::get_object): New function.
889 (Incremental_script_entry::objects_): New data member; adjust
890 constructor.
891 (Incremental_inputs::report_archive_begin): Add script_info parameter.
892 (Incremental_inputs::report_object): Add script_info parameter.
893 (Incremental_inputs_reader::get_object_count): New function.
894 (Incremental_inputs_reader::get_object_offset): New function.
895 * options.cc (Input_arguments::add_file): Return reference to
896 new input argument.
897 * options.h (Input_argument::set_script_info): New function.
898 (Input_argument::script_info): New function.
899 (Input_argument::script_info_): New data member; adjust all
900 constructors.
901 (Input_file_group::add_file): Return reference to new input argument.
902 (Input_file_lib::add_file): Likewise.
903 (Input_arguments::add_file): Likewise.
904 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
905 * script.cc (Parser_closure::Parser_closure): Add script_info
906 parameter; adjust all callers.
907 (Parser_closure::script_info): New function.
908 (Parser_closure::script_info_): New data member.
909 (read_input_script): Report scripts earlier to incremental info.
910 (script_add_file): Set script_info in Input_argument.
911 (script_add_library): Likewise.
912 * script.h (Script_options::Script_info): Rewrite class.
913
914 2011-03-29 Cary Coutant <ccoutant@google.com>
915
916 * archive.cc (Library_base::should_include_member): Move
917 method here from class Archive.
918 (Archive::Archive): Initialize base class.
919 (Archive::should_include_member): Move to base class.
920 (Archive::do_for_all_unused_symbols): New function.
921 (Add_archive_symbols::run): Remove redundant access to
922 incremental_inputs.
923 (Lib_group::Lib_group): Initialize base class.
924 (Lib_group::do_filename): New function.
925 (Lib_group::include_member): Pass pointer to Lib_group to
926 report_object.
927 (Lib_group::do_for_all_unused_symbols): New function.
928 (Add_lib_group_symbols::run): Report archive information for
929 incremental links.
930 * archive.h (class Library_base): New base class.
931 (class Archive): Derive from Library_base.
932 (Archive::filename): Move to base class.
933 (Archive::set_incremental_info): Likewise.
934 (Archive::incremental_info): Likewise.
935 (Archive::Should_include): Likewise.
936 (Archive::should_include_member): Likewise.
937 (Archive::Armap_entry): Remove.
938 (Archive::Unused_symbol_iterator): Remove.
939 (Archive::unused_symbols_begin): Remove.
940 (Archive::unused_symbols_end): Remove.
941 (Archive::do_filename): New function.
942 (Archive::do_get_mtime): New function.
943 (Archive::do_for_all_unused_symbols): New function.
944 (Archive::task_): Move to base class.
945 (Archive::incremental_info_): Likewise.
946 (class Lib_group): Derive from Library_base.
947 (Lib_group::do_filename): New function.
948 (Lib_group::do_get_mtime): New function.
949 (Lib_group::do_for_all_unused_symbols): New function.
950 (Lib_group::task_): Move to base class.
951 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
952 function.
953 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
954 function.
955 * incremental.cc (Incremental_inputs::report_archive_begin):
956 Use Library_base; call library's get_mtime; add incremental inputs
957 entry before members.
958 (class Unused_symbol_visitor): New class.
959 (Incremental_inputs::report_archive_end): Use Library_base; use
960 visitor class to record unused symbols; don't add incremental inputs
961 entry after members.
962 (Incremental_inputs::report_object): Use Library_base.
963 * incremental.h
964 (Incremental_archive_entry::Incremental_archive_entry): Remove
965 unused Archive parameter.
966 (Incremental_inputs::report_archive_begin): Use Library_base.
967 (Incremental_inputs::report_archive_end): Likewise.
968 (Incremental_inputs::report_object): Likewise.
969 * object.cc (Sized_relobj::do_for_all_global_symbols): New
970 function.
971 * object.h (Object::for_all_global_symbols): New function.
972 (Object::do_for_all_global_symbols): New function.
973 (Sized_relobj::do_for_all_global_symbols): New function.
974 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
975 function.
976 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
977 function.
978
979 2011-03-27 Ian Lance Taylor <iant@google.com>
980
981 * archive.cc (Archive::interpret_header): Return -1 if something
982 goes wrong. Change callers accordingly.
983
984 2011-03-25 Cary Coutant <ccoutant@google.com>
985
986 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
987 * testsuite/Makefile.in: Regenerate.
988
989 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
990
991 * plugin.cc (get_view): New.
992 (Plugin::load): Pass get_view to the plugin.
993 (Plugin_manager::get_view): New.
994
995 2011-03-21 Ian Lance Taylor <iant@google.com>
996
997 * testsuite/final_layout.sh: Rewrite to not use dc.
998 * testsuite/relro_test.sh: Fail if dc is not present.
999
1000 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1001
1002 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1003 Change == to -eq.
1004 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1005 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1006 Change == to -eq.
1007 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1008 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1009
1010 2011-03-14 Ian Lance Taylor <iant@google.com>
1011
1012 * script-sections.cc (Sort_output_sections::script_compare):
1013 Rename from is_before, change return type.
1014 (Sort_output_sections::operator()): Adjust accordingly.
1015
1016 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1017
1018 PR gold/12572
1019 * testsuite/odr_violation2.cc: Add comment to make all error line
1020 numbers double digits.
1021 * testsuite/debug_msg.sh: Adjust expected errors.
1022
1023 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1024
1025 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1026 but mark earlier ones as non-canonical
1027 (offset_to_iterator): Update search target and example
1028 (do_addr2line): Return extra lines in a vector*
1029 (format_file_lineno): Extract from do_addr2line
1030 (one_addr2line): Add vector* out-param
1031 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1032 when a lineno entry appeared last for its instruction
1033 (Dwarf_line_info): Add vector* out-param
1034 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1035 * symtab.cc (Odr_violation_compare): Include the lineno in the
1036 comparison again.
1037 (linenos_from_loc): New. Combine the canonical line for an
1038 address with its other lines.
1039 (True_if_intersect): New. Helper functor to make
1040 std::set_intersection a query.
1041 (detect_odr_violations): Compare sets of lines instead of just
1042 one line for each function. This became less deterministic, but
1043 has fewer false positives.
1044 * symtab.h: Declarations.
1045 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1046 mix an optimized and non-optimized object in the same binary
1047 (odr_violation2.so): Same.
1048 * testsuite/Makefile.in: Regenerate from Makefile.am.
1049 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1050 * testsuite/debug_msg.sh: Update line numbers and add
1051 assertions.
1052 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1053 non-optimized context.
1054 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1055 isn't inlined, and use OdrDerived in an optimized context.
1056 * testsuite/odr_header1.h: Defines OdrDerived, where
1057 optimization will change the
1058 first-instruction-in-the-destructor's file and line number.
1059 * testsuite/odr_header2.h: Defines OdrBase.
1060
1061 2011-03-09 Ian Lance Taylor <iant@google.com>
1062
1063 * fileread.cc (File_read::clear_views): Don't delete the whole
1064 file view.
1065
1066 2011-03-08 Ian Lance Taylor <iant@google.com>
1067
1068 PR gold/12525
1069 * fileread.cc: #include <climits>.
1070 (GOLD_IOV_MAX): Define.
1071 (File_read::read_multiple): Limit number of entries by iov_max.
1072 * fileread.h (class File_read): Always set max_readv_entries to
1073 128.
1074
1075 2011-03-07 Ian Lance Taylor <iant@google.com>
1076
1077 PR gold/12525
1078 * options.h (class General_options): Add -dy and -dn.
1079
1080 2011-03-02 Cary Coutant <ccoutant@google.com>
1081
1082 * testsuite/script_test_9.t: Add TLS segment.
1083
1084 2011-03-02 Simon Baldwin <simonb@google.com>
1085
1086 * configure.ac: Add check for gnu_indirect_function support in
1087 the toolchain building binutils.
1088 * configure: Rebuild.
1089
1090 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1091
1092 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1093 plugin only symbols.
1094 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1095 in plugin files as not needed in the symbol table.
1096
1097 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1098
1099 * output.cc (Output_section::add_input_section): Delay fill
1100 generation for section ordering.
1101
1102 2011-02-09 Ian Lance Taylor <iant@google.com>
1103
1104 PR gold/12316
1105 * object.h (class Sized_relobj): Remove clear_local_symbols.
1106 * reloc.cc (Sized_relobj::do_relocate): Don't call
1107 clear_local_symbols.
1108
1109 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1110
1111 * plugin.cc (is_visible_from_outside): Return true for symbols
1112 in the -u option.
1113
1114 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1115
1116 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1117 filename.
1118
1119 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1120
1121 * icf.h (is_section_foldable_candidate): Change type of parameter
1122 to std::string.
1123 * icf.cc (Icf::find_identical_sections): Change type of local variable
1124 section_name to be std::string.
1125 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1126
1127 2011-01-25 Ian Lance Taylor <iant@google.com>
1128
1129 * script.cc (script_add_extern): Rewrite to use
1130 add_symbol_reference.
1131
1132 2011-01-25 Doug Kwan <dougkwan@google.com>
1133
1134 * icf.cc (get_section_contents): Always lock section's object.
1135
1136 2011-01-24 Ian Lance Taylor <iant@google.com>
1137
1138 * options.h (class General_options): Accept
1139 --no-detect-odr-violations.
1140
1141 2011-01-24 Ian Lance Taylor <iant@google.com>
1142
1143 * version.cc (version_string): Bump to 1.11.
1144
1145 2011-01-24 Ian Lance Taylor <iant@google.com>
1146
1147 * plugin.cc (class Plugin_rescan): Define new class.
1148 (Plugin_manager::claim_file): Set any_claimed_.
1149 (Plugin_manager::save_archive): New function.
1150 (Plugin_manager::save_input_group): New function.
1151 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1152 necessary.
1153 (Plugin_manager::new_undefined_symbol): New function.
1154 (Plugin_manager::rescan): New function.
1155 (Plugin_manager::rescannable_defines): New function.
1156 (Plugin_manager::add_input_file): Set any_added_.
1157 * plugin.h (class Plugin_manager): define new fields rescannable_,
1158 undefined_symbols_, any_claimed_, and any_added_. Declare
1159 Plugin_rescan as friend. Declare new functions.
1160 (Plugin_manager::Rescannable): Define type.
1161 (Plugin_manager::Rescannable_list): Define type.
1162 (Plugin_manager::Undefined_symbol_list): Define type.
1163 (Plugin_manager::Plugin_manager): Initialize new fields.
1164 * archive.cc (Archive::defines_symbol): New function.
1165 (Add_archive_symbols::run): Pass archive to plugins if any.
1166 * archive.h (class Archive): Declare defines_symbol.
1167 * readsyms.cc (Input_group::~Input_group): New function.
1168 (Finish_group::run): Pass input_group to plugins if any.
1169 * readsyms.h (class Input_group): Declare destructor.
1170 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1171 any.
1172
1173 2011-01-10 Ian Lance Taylor <iant@google.com>
1174
1175 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1176 section as relro.
1177 (Layout::set_segment_offsets): Reset increase_relro before calling
1178 set_section_addresses a second time.
1179
1180 2011-01-04 Cary Coutant <ccoutant@google.com>
1181
1182 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1183 sections before NOBITS sections.
1184
1185 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1186
1187 * version.cc (print_version): Update copyright to 2011.
1188
1189 2010-12-23 Cary Coutant <ccoutant@google.com>
1190
1191 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1192 of OS to this->add. Add OD parameter to second form of the function.
1193
1194 2010-12-20 Ian Lance Taylor <iant@google.com>
1195
1196 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1197 second of two consecutive entries with same offset.
1198
1199 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1200
1201 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1202 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1203 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1204 to avoid unneeded links against $(LDADD).
1205 * testsuite/Makefile.in: Regenerate.
1206
1207 2010-12-15 Ian Lance Taylor <iant@google.com>
1208
1209 PR gold/12324
1210 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1211 for R_X86_64_32 and R_X86_64_PC32.
1212 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1213 ver_matching_def_pic.o.
1214 (ver_matching_def_pic.o): New target.
1215
1216 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1217
1218 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1219 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1220 Move definition before File_read::View member definitions.
1221 (File_read::View::~View): Initialize and hold lock before
1222 updating current_mapped_bytes.
1223
1224 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1225
1226 * dwarf_reader.cc: Remove outdated comment.
1227 * gold-threads.cc: Fix typo in error message.
1228 * archive.cc: Fix typos in comments.
1229 * archive.h: Likewise.
1230 * arm-reloc-property.cc: Likewise.
1231 * arm-reloc-property.h: Likewise.
1232 * arm-reloc.def: Likewise.
1233 * arm.cc: Likewise.
1234 * attributes.h: Likewise.
1235 * cref.cc: Likewise.
1236 * ehframe.cc: Likewise.
1237 * fileread.h: Likewise.
1238 * gold.h: Likewise.
1239 * i386.cc: Likewise.
1240 * icf.cc: Likewise.
1241 * incremental.h: Likewise.
1242 * int_encoding.cc: Likewise.
1243 * layout.h: Likewise.
1244 * main.cc: Likewise.
1245 * merge.h: Likewise.
1246 * object.cc: Likewise.
1247 * object.h: Likewise.
1248 * options.cc: Likewise.
1249 * readsyms.cc: Likewise.
1250 * reduced_debug_output.cc: Likewise.
1251 * reloc.cc: Likewise.
1252 * script-sections.cc: Likewise.
1253 * sparc.cc: Likewise.
1254 * symtab.h: Likewise.
1255 * target-reloc.h: Likewise.
1256 * target.cc: Likewise.
1257 * target.h: Likewise.
1258 * timer.cc: Likewise.
1259 * timer.h: Likewise.
1260 * x86_64.cc: Likewise.
1261
1262 2010-12-09 Cary Coutant <ccoutant@google.com>
1263
1264 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1265 stack.
1266 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1267 parameter; change all callers.
1268 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1269 * options.h (warn_execstack): New option.
1270
1271 2010-12-07 Doug Kwan <dougkwan@google.com>
1272
1273 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1274 like function call relocations.
1275
1276 2010-12-07 Ian Lance Taylor <iant@google.com>
1277
1278 * archive.cc (Archive::get_elf_object_for_member): Permit
1279 punconfigured to be NULL.
1280 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1281 (Archive::include_member): Pass NULL to get_elf_object_for_member
1282 if we searched for the archive and this is the first included
1283 object.
1284
1285 2010-12-01 Ian Lance Taylor <iant@google.com>
1286
1287 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1288 track_relocs_type_ field.
1289 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1290 Set track_relocs_type_.
1291 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1292 contents when using RELA relocs.
1293 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1294 reloc_map_.
1295 * reloc.cc (Track_relocs::next_addend): New function.
1296 * reloc.h (class Track_relocs): Declare next_addend.
1297
1298 2010-12-01 Ian Lance Taylor <iant@google.com>
1299
1300 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1301 virtual destructor.
1302
1303 2010-12-01 Ian Lance Taylor <iant@google.com>
1304
1305 * README: Update compilers known to work and fail.
1306
1307 2010-11-23 Matthias Klose <doko@ubuntu.com>
1308
1309 * configure.in: For --enable-gold, handle value `default' instead of
1310 `both*'. Always install ld as ld.bfd, install as ld if gold is
1311 not the default.
1312 * configure: Regenerate.
1313
1314 2010-11-18 Doug Kwan <dougkwan@google.com>
1315
1316 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1317 and right_alignment to be zero. Store result alignment only if it is
1318 greater than existing alignment.
1319
1320 2010-11-16 Cary Coutant <ccoutant@google.com>
1321
1322 PR gold/12220
1323 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1324 Check for ".zdebug_line".
1325
1326 2010-11-16 Doug Kwan <dougkwan@google.com>
1327 Cary Coutant <ccoutant@google.com>
1328
1329 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1330 by reference; adjust all callers.
1331 * output.cc (Output_segment::set_section_addresses): Adjust references
1332 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1333 list is empty.
1334 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1335 end at page boundary.
1336
1337 2010-11-16 Cary Coutant <ccoutant@google.com>
1338
1339 PR gold/12220
1340 * layout.cc (Layout::choose_output_section): Transform names of
1341 compressed sections even when using a script with a SECTIONS clause.
1342 (Layout::output_section_name): Remove code to transform
1343 compressed debug section names.
1344 * output.cc (Output_section::add_input_section): Use uncompressed
1345 section size when tracking input sections.
1346
1347 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1348
1349 * symtab.h (Symbol::NON_PIC_REF): Remove.
1350 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1351 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1352 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1353 (Symbol::use_plt_offset): Take a flags argument and pass it
1354 directly to needs_dynamic_reloc. Restrict check for undefined
1355 weak symbols to function calls.
1356 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1357 (Target_arm::Scan::global): Use it.
1358 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1359 (Target_arm::Relocate::relocate): Likewise.
1360 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1361 parameter with an r_type parameter. Use get_reference_flags
1362 to get the flags.
1363 (Target_arm::Relocate::relocate): Update accordingly.
1364 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1365 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1366 (Target_i386::Scan::global): Likewise.
1367 (Target_i386::Relocate::relocate): Likewise.
1368 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1369 parameter with an r_type parameter. Use get_reference_flags
1370 to get the flags.
1371 (Target_i386::Relocate::relocate): Update accordingly.
1372 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1373 (Target_powerpc::Scan::global): Use it.
1374 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1375 (Target_powerpc::Relocate::relocate): Likewise.
1376 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1377 (Target_sparc::Scan::global): Use it.
1378 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1379 (Target_sparc::Relocate::relocate): Likewise.
1380 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1381 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1382 (Target_x86_64::Scan::global): Likewise.
1383 (Target_x86_64::Relocate::relocate): Likewise.
1384
1385 2010-11-08 Doug Kwan <dougkwan@google.com>
1386 Cary Coutant <ccoutant@google.com>
1387
1388 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1389 (Arm_exidx_merge_section::section_contents_): New data member.
1390 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1391 (Arm_input_section::~Arm_input_section): De-allocate memory.
1392 (Arm_input_section::original_contents_): New data member.
1393 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1394 in parameters instead of calling Object::section_contents without
1395 locking.
1396 (Arm_output_section::group_section): New parameter TASK. Pass it
1397 to callees that need locking objects.
1398 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1399 to lock EXIDX input sections. Fix a formatting issue. Call
1400 Arm_exidx_merged_section::build_contents to create merged section
1401 contents.
1402 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1403 to lock object of stub table owner.
1404 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1405 TEXT_SIZE to initialize data member TEXT_SIZE_.
1406 (Arm_exidx_input_section::addralign): Fix typo in comment.
1407 (Arm_exidx_input_section::text_size): New method.
1408 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1409 that require locking objects. Lock objects before scanning for stubs
1410 and updating local symbols.
1411 (Arm_input_section<big_endian>::init): Copy contents of original
1412 input section.
1413 (Arm_input_section<big_endian>::do_write): Use saved contents of
1414 original input section instead of calling Object::section_contents
1415 without locking.
1416 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1417 size without calling Object::section_size().
1418 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1419 for size. Allocate a buffer for merged EXIDX entries.
1420 (Arm_exidx_merged_section::build_contents): New method.
1421 (Arm_exidx_merged_section::do_write): Move merge section contents
1422 building code to Arm_exidx_merged_section::build_contetns. Write
1423 out contetns in buffer instead of building it on the fly.
1424 (Arm_relobj::make_exidx_input_section): Also pass text section size
1425 to Arm_exidx_input_section constructor.
1426 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1427 (Arm_dynobj::do_read_symbols): Fix memory leak.
1428 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1429 * target.h: (class Task): Add forward declaration.
1430 (Target::relax): Add new parameter TASK and pass it to
1431 Target::do_relax().
1432 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1433
1434 2010-11-05 Cary Coutant <ccoutant@google.com>
1435
1436 PR gold/10708
1437 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1438 object when reading from the file.
1439 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1440 second layout pass.
1441 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1442 when reading section contents.
1443 (get_section_contents): Likewise.
1444 (icf::find_identical_sections): Likewise.
1445 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1446 object when reading from the file.
1447 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1448 the object when doing deferred section layout.
1449
1450 2010-11-03 Nick Clifton <nickc@redhat.com>
1451
1452 PR gold/12001
1453 * script.h (class Symbol_assignment: name): New member. Returns
1454 the name of the symbol.
1455 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1456 Returns true if the given symbol name is on the list of
1457 assignments wating to be processed.
1458 * archive.cc (should_incldue_member): If the symbol is undefined,
1459 check to see if it is on the list of symbols pending assignment.
1460
1461 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1462
1463 * script-sections.cc (Script_sections::find_memory_region): Check
1464 for a NULL output section pointer.
1465
1466 2010-10-29 Doug Kwan <dougkwan@google.com>
1467
1468 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1469 Output_section::add_relaxed_input_section.
1470 * output.cc (Output_section::add_relaxed_input_section): Add new
1471 arguments LAYOUT and NAME. Set section order index.
1472 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1473 Copy section order index.
1474 * output.h (Output_section::add_relaxed_input_section): Add new
1475 arguments LAYOUT and NAME.
1476
1477 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1478
1479 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1480 NATIVE_OR_CROSS_LINKER.
1481 * testsuite/Makefile.in: Regenerate.
1482
1483 2010-10-20 Doug Kwan <dougkwan@google.com>
1484
1485 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1486 without SHF_LINK_ORDER flags.
1487 * layout.cc (Layout::choose_output_section): Do not filter
1488 SHF_LINK_ORDER flag in a relocatable link.
1489
1490 2010-10-17 Cary Coutant <ccoutant@google.com>
1491
1492 * output.h (Output_segment::set_section_addresses): Change function
1493 signature. Update all callers.
1494 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1495 sections.
1496 (Output_segment::set_section_addresses): Align after last TLS
1497 section. Add padding before last relro section instead of after.
1498
1499 2010-10-17 Doug Kwan <dougkwan@google.com>
1500
1501 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1502 GOT output section to be writable.
1503
1504 2010-10-14 Cary Coutant <ccoutant@google.com>
1505
1506 * debug.h (DEBUG_INCREMENTAL): New flag.
1507 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1508 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1509 mode.
1510 * incremental.cc (report_command_line): Ignore all forms of
1511 --incremental.
1512 * layout.cc (Layout::Layout): Check parameters for incremental link
1513 mode.
1514 * options.cc (General_options::parse_incremental): New function.
1515 (General_options::parse_no_incremental): New function.
1516 (General_options::parse_incremental_full): New function.
1517 (General_options::parse_incremental_update): New function.
1518 (General_options::incremental_mode_): New data member.
1519 (General_options::finalize): Check incremental_mode_.
1520 * options.h (General_options): Update help text for --incremental.
1521 Add --no-incremental, --incremental-full, --incremental-update.
1522 (General_options::Incremental_mode): New enum type.
1523 (General_options::incremental_mode): New function.
1524 (General_options::incremental_mode_): New data member.
1525 * parameters.cc (Parameters::incremental_mode_): New data member.
1526 (Parameters::set_options): Set incremental_mode_.
1527 (Parameters::set_incremental_full): New function.
1528 (Parameters::incremental): New function.
1529 (Parameters::incremental_update): New function.
1530 (set_parameters_incremental_full): New function.
1531 * parameters.h (Parameters::set_incremental_full): New function.
1532 (Parameters::incremental): New function.
1533 (Parameters::incremental_update): New function.
1534 (Parameters::incremental_mode_): New data member.
1535 (set_parameters_incremental_full): New function.
1536 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1537 incremental link mode.
1538 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1539 (Sized_relobj::do_relocate_sections): Likewise.
1540 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1541 option.
1542 * testsuite/Makefile.in: Regenerate.
1543 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1544
1545 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1546
1547 * script-sections.h (class Script_sections): Make
1548 Sections_elements typedef public.
1549 * script-sections.cc (class Sort_output_sections): Add elements_
1550 field. Add constructor which sets it; change all callers.
1551 (Sort_output_sections::is_before): New function.
1552 (Sort_output_sections::operator()): Call is_before.
1553 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1554 conditional.
1555 * testsuite/script_test_10.sh: New test. Test script section
1556 order.
1557 * testsuite/script_test_10.t: Likewise.
1558 * testsuite/script_test_10.s: Likewise.
1559 * testsuite/Makefile.am: Wrap the cross linker tests and the
1560 common tests into NATIVE_OR_CROSS_LINKER.
1561 (check_SCRIPTS): Add script_test_10.sh.
1562 (check_DATA): Add script_test_10.stdout.
1563 (script_test_10.o, script_test_10): New targets.
1564 (script_test_10.stdout): New target.
1565 * configure, testsuite/Makefile.in: Regenerate.
1566
1567 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1568
1569 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1570 error for the deprecated relocations.
1571 (Target_arm::Scan::global): Likewise.
1572 (Target_arm::Relocate::relocate): Likewise.
1573
1574 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1575
1576 * fileread.cc (Input_file::find_file): Initialize *found_name
1577 and *namep when using the fallback search for case 4.
1578
1579 2010-10-11 Cary Coutant <ccoutant@google.com>
1580
1581 * options.h (class General_options): Redefine -z lazy as an alias for
1582 the negation of -z now.
1583
1584 2010-10-11 Ian Lance Taylor <iant@google.com>
1585
1586 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1587 binding.
1588
1589 2010-10-06 Nick Clifton <nickc@redhat.com>
1590
1591 * script-sections.cc(class Memory_region): Remove
1592 current_lma_offset_ field. Rename current_vma_offset_ to
1593 current_offset_. Add last_section_ field.
1594 (Memory_region::get_current_vma_address): Rename to
1595 get_current_address.
1596 (Memory_region::get_current_lma_address): Delete.
1597 (Memory_region::increment_vma_offset): Rename to
1598 increment_offset.
1599 (Memory_region::increment_lma_offset): Delete.
1600 (Memory_region::attributes_compatible): New method. Returns
1601 true if the provided section is compatible with the region.
1602 (Memory_region::get_last_section): New method. Returns the last
1603 section to use the region.
1604 (Memory_region::set_last_section): New method. Stores the last
1605 section to use the region.
1606 (Script_sections::block_in_region): New method. Returns true if
1607 a block of memory is contained within a region.
1608 (Script_sections::find_memory_region): New method. Locates a
1609 memory region to be used to set a VMA or LMA address.
1610 (Output_section_definition::set_section_addresses): Add code to
1611 check for addresses set by memory regions.
1612 (Output_segment::set_section_addresses): Remove memory region
1613 walking code.
1614 (Script_sections::create_segment): Add a warning if a header
1615 segment is created outside of any region.
1616 * script-sections.h (class Script_sections): Add prototypes for
1617 find_memory_region and block_in_region methods.
1618 * testsuite/memory_test.s: Use .long instead of .word.
1619 * testsuite/memory_test.t: Add some more output sections.
1620 * testsuite/memory_test.sh: Update expected output.
1621
1622 2010-10-02 Doug Kwan <dougkwan@google.com>
1623
1624 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1625 defintion to symtab.h
1626 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1627 declaration to defintion.
1628
1629 2010-10-01 Nick Clifton <nickc@redhat.com>
1630
1631 * expression.cc (eval): Replace dummy argument with NULL.
1632 (eval_maybe_dot): Check for a NULL result section pointer.
1633 (Symbol_expression::value): Likewise.
1634 (Dot_expression::value): Likewise.
1635 (BINARY_EXPRESSION): Likewise.
1636 (Max_expression::value): Likewise.
1637 (Min_expression::value): Likewise.
1638 (Absolute_expression::value): Likewise.
1639 (Addr_expression::value_from_output_section): Likewise.
1640 (Loaddddr_expression::value_from_output_section): Likewise.
1641 (Segment_start_expression::value): Likewise.
1642 * script-sections.cc
1643 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1644 argument with NULL.
1645 (Sections_elememt_dot_assignment::set_section_addresses):
1646 Likewise.
1647 (Output_data_expression::do_write_to_buffer): Likewise.
1648 (Output_section_definition::finalize_symbols): Likewise.
1649 (Output_section_definition::set_section_addresses): Likewise.
1650
1651 2010-09-30 Doug Kwan <dougkwan@google.com>
1652
1653 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1654
1655 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1656
1657 * target.h (Target::can_icf_inline_merge_sections): New virtual
1658 function.
1659 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1660 virtual function.
1661 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1662 virtual function.
1663 * icf.cc (get_section_contents): Inline merge sections only when
1664 target allows it.
1665
1666 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1667
1668 * configure: Regenerate.
1669
1670 2010-09-17 Ian Lance Taylor <iant@google.com>
1671
1672 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1673 * testsuite/Makefile.am (memory_test.o): New target.
1674 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1675 memory_test.t.
1676 * testsuite/Makefile.in: Rebuild.
1677
1678 2010-09-17 Doug Kwan <dougkwan@google.com>
1679
1680 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1681 defintion if relocation uses GOT entries of the symbol.
1682 * testsuite/icf_safe_test.sh: Fix test.
1683 * testsuite/icf_safe_so_test.sh: Fix test.
1684
1685 2010-09-16 Cary Coutant <ccoutant@google.com>
1686
1687 * script_sections.cc (class Memory_region): Remove "NULL" from
1688 vector initializations.
1689
1690 2010-09-15 Cary Coutant <ccoutant@google.com>
1691
1692 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1693 Resolve forwarding symbols.
1694
1695 2010-09-15 Doug Kwan <dougkwan@google.com>
1696
1697 * gold/testsuite/script_test_3.t: Add ARM special sections.
1698 * gold/testsuite/script_test_4.t: Same.
1699 * gold/testsuite/script_test_5.t: Same.
1700 * gold/testsuite/script_test_6.t: Same.
1701 * gold/testsuite/script_test_7.t: Same.
1702 * gold/testsuite/script_test_7.t: Same.
1703 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1704
1705 2010-09-14 Cary Coutant <ccoutant@google.com>
1706
1707 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1708 (Target_x86_64::Relocate::relocate_tls): Replace check for
1709 saw_tls_block_reloc_ with test for executable section.
1710
1711 2010-09-12 Cary Coutant <ccoutant@google.com>
1712
1713 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1714 position-independent executables to shared libraries need dynamic
1715 relocations.
1716 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1717 position-independent executables.
1718 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1719 * testsuite/Makefile.in: Regenerate.
1720
1721 2010-09-10 Nick Clifton <nickc@redhat.com>
1722
1723 PR gold/11997
1724 * testsuite/memory_test.t: Discard any sections that are not
1725 needed.
1726
1727 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1728
1729 PR gold/11996
1730 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1731 "This::" to work around a bug in gcc 4.2.
1732
1733 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1734
1735 2010-09-09 Rafael Espindola <espindola@google.com>
1736
1737 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1738 sections with different PF_X flags in the same segment.
1739 (Layout::find_first_load_seg): Search all segments to find the first
1740 one.
1741 * options.h (rosegment): New.
1742
1743 2010-09-08 Rafael Espindola <espindola@google.com>
1744
1745 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1746
1747 2010-09-08 Doug Kwan <dougkwan@google.com>
1748
1749 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1750 (Arm_relobj::do_relocate_sections): Add new parameter for output
1751 file to match the parent.
1752 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1753 of local symbols instead of input values. Update code to track
1754 changes in gold::relocate_section.
1755 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1756 (Sized_relobj::compute_final_local_value_internal): New methods.
1757 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1758 body into private version of Sized_relobj::compute_final_local_value.
1759 Call the inline method.
1760 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1761 merged symbol value if there is one.
1762 (Symbol_value::has_output_value): New method defintiion.
1763 (Sized_relobj::Compute_final_local_value_status): New enum type.
1764 (Sized_relobj::compute_final_local_value): New methods.
1765 (Sized_relobj::compute_final_local_value_internal): New methods.
1766 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1767 and arm_cortex_a8.sh.
1768 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1769 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1770 New tests.
1771 * Makefile.in: Regenerate.
1772 * testsuite/arm_bl_out_of_range.s: Update test.
1773 * testsuite/thumb_bl_out_of_range.s: Ditto.
1774 * testsuite/thumb_blx_out_of_range.s: Ditto.
1775 * testsuite/arm_branch_out_of_range.sh: New file.
1776 * testsuite/arm_cortex_a8.sh: Ditto.
1777 * testsuite/arm_cortex_a8_b.s: Ditto.
1778 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1779 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1780 * testsuite/arm_cortex_a8_bl.s: Ditto.
1781 * testsuite/arm_cortex_a8_blx.s: Ditto.
1782 * testsuite/arm_cortex_a8_local.s: Ditto.
1783 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1784 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1785
1786 2010-09-08 Rafael Espindola <espindola@google.com>
1787
1788 * Makefile.am (memory_test.stdout): Run readelf with -W.
1789 * Makefile.in: Regenerate.
1790 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1791 64 bit output.
1792
1793 2010-09-08 Rafael Espindola <espindola@google.com>
1794
1795 * script-sections.cc (Script_sections::add_memory_region): Convert
1796 field precision to int.
1797 * script.cc (script_set_section_region, script_set_section_region):
1798 Convert field precision to int.
1799
1800 2010-09-08 Rafael Espindola <espindola@google.com>
1801
1802 * arm.cc (do_finalize_sections): Create the __exidx_start and
1803 __exdix_end symbols even when the section is missing.
1804
1805 2010-09-08 Nick Clifton <nickc@redhat.com>
1806
1807 * README: Remove claim that MEMORY is not supported.
1808 * expression.cc (script_exp_function_origin)
1809 (script_exp_function_length): Move from here to ...
1810 * script.cc: ... here.
1811 (script_set_section_region, script_add_memory)
1812 (script_parse_memory_attr, script_include_directive): New
1813 functions.
1814 * script-sections.cc
1815 (class Memory_region): New class.
1816 (class Output_section_definition): Add set_memory_region,
1817 set_section_vma, set_section_lma and get_section_name methods.
1818 (class Script_Sections): Add add_memory_region,
1819 find_memory_region, find_memory_region_origin,
1820 find_memory_region_length and set_memory_region methods.
1821 Have set_section_addresses method walk the list of set memory
1822 regions.
1823 Extend the print methos to display memory regions.
1824 * script-sections.h: Add prototypes for new methods.
1825 Add enum for MEMORY region attributes.
1826 * yyscript.y: Add support for parsing MEMORY regions.
1827 * script-c.h: Add prototypes for new functions.
1828 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1829 * testsuite/Makefile.in: Regenerate.
1830 * testsuite/memory_test.sh: New script.
1831 * testsuite/memory_test.s: New assembler source file.
1832 * testsuite/memory_test.t: New linker script.
1833
1834 2010-08-27 Doug Kwan <dougkwan@google.com>
1835
1836 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1837 reference override an existing dynamic weak reference.
1838 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1839 * testsuite/Makefile.in: Regenerate.
1840 * testsuite/dyn_weak_ref.sh: New file.
1841 * testsuite/dyn_weak_ref_1.c: Ditto.
1842 * testsuite/dyn_weak_ref_2.c: Ditto.
1843
1844 2010-08-27 Ian Lance Taylor <iant@google.com>
1845
1846 * incremental.h (class Incremental_input_entry): Add virtual
1847 destructor.
1848
1849 2010-08-27 Ian Lance Taylor <iant@google.com>
1850
1851 * testsuite/start_lib_test_3.c: Mark t3 as used.
1852
1853 2010-08-27 Nick Clifton <nickc@redhat.com>
1854
1855 * options.cc (version_script): Fix small typo in previous
1856 whitespace tidyup.
1857
1858 2010-08-25 Nick Clifton <nickc@redhat.com>
1859
1860 * archive.cc: Formatting fixes: Remove whitespace between
1861 typename and following asterisk. Remove whitespace between
1862 function name and opening parenthesis.
1863 * archive.h: Likewise.
1864 * arm.cc: Likewise.
1865 * attributes.cc: Likewise.
1866 * attributes.h: Likewise.
1867 * common.cc: Likewise.
1868 * copy-relocs.cc: Likewise.
1869 * dirsearch.h: Likewise.
1870 * dynobj.cc: Likewise.
1871 * ehframe.cc: Likewise.
1872 * ehframe.h: Likewise.
1873 * expression.cc: Likewise.
1874 * fileread.cc: Likewise.
1875 * fileread.h: Likewise.
1876 * gc.h: Likewise.
1877 * gold-threads.cc: Likewise.
1878 * gold.cc: Likewise.
1879 * i386.cc: Likewise.
1880 * icf.h: Likewise.
1881 * incremental-dump.cc: Likewise.
1882 * incremental.cc: Likewise.
1883 * layout.cc: Likewise.
1884 * layout.h: Likewise.
1885 * main.cc: Likewise.
1886 * merge.cc: Likewise.
1887 * merge.h: Likewise.
1888 * object.cc: Likewise.
1889 * object.h: Likewise.
1890 * options.cc: Likewise.
1891 * options.h: Likewise.
1892 * output.cc: Likewise.
1893 * output.h: Likewise.
1894 * plugin.cc: Likewise.
1895 * plugin.h: Likewise.
1896 * powerpc.cc: Likewise.
1897 * reloc.cc: Likewise.
1898 * script-c.h: Likewise.
1899 * script-sections.cc: Likewise.
1900 * script.cc: Likewise.
1901 * stringpool.cc: Likewise.
1902 * symtab.cc: Likewise.
1903 * symtab.h: Likewise.
1904 * target.cc: Likewise.
1905 * timer.cc: Likewise.
1906 * timer.h: Likewise.
1907 * version.cc: Likewise.
1908 * x86_64.cc: Likewise.
1909
1910 2010-08-24 Nick Clifton <nickc@redhat.com>
1911
1912 PR 11899
1913 * layout.cc (segment_precedes): Sort segments by their physical
1914 addresses, if they have been set.
1915
1916 2010-08-23 Cary Coutant <ccoutant@google.com>
1917
1918 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1919 symbols data.
1920 (Lib_group::include_member): Unlock object after deleting its
1921 symbols data.
1922 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1923 the bug fixed here.
1924
1925 2010-08-19 Neil Vachharajani <nvachhar@google.com>
1926 Cary Coutant <ccoutant@google.com>
1927
1928 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1929 constructor, and set_blocker.
1930 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1931 readsyms_blocker_.
1932 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1933 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1934 * testsuite/Makefile.am (start_lib_test): New test case.
1935 * testsuite/Makefile.in: Regenerate.
1936 * testsuite/start_lib_test_main.c: New file.
1937 * testsuite/start_lib_test_1.c: New file.
1938 * testsuite/start_lib_test_2.c: New file.
1939 * testsuite/start_lib_test_3.c: New file.
1940
1941 2010-08-19 Ian Lance Taylor <iant@google.com>
1942
1943 * Makefile.in: Rebuild with automake 1.11.1.
1944 * aclocal.m4: Likewise.
1945 * testsuite/Makefile.in: Likewise.
1946
1947 2010-08-19 Ian Lance Taylor <iant@google.com>
1948
1949 PR 10893
1950 * i386.cc (class Output_data_plt_i386): Update declarations.
1951 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1952 local_ifuncs_ fields.
1953 (Target_i386::do_plt_section_for_global): New function.
1954 (Target_i386::do_plt_section_for_local): New function.
1955 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1956 parameter; change all callers. Initialize global_ifuncs_ and
1957 local_ifuncs_. If doing a static link define __rel_iplt_start and
1958 __rel_iplt_end.
1959 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1960 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1961 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1962 symbols.
1963 (Target_i386::make_plt_section): New function, broken out of
1964 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1965 (Target_i386::make_plt_entry): Call make_plt_section.
1966 (Target_i386::make_local_ifunc_plt_entry): New function.
1967 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1968 (Target_i386::Scan::local): Handle IFUNC symbols. Add
1969 R_386_IRELATIVE to switch.
1970 (Target_i386::Scan::global): Likewise.
1971 (Target_i386::Relocate::relocate): Likewise.
1972 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1973 switch.
1974 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1975 (Target_x86_64::do_plt_section_for_global): New function.
1976 (Target_x86_64::do_plt_section_for_local): New function.
1977 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1978 parameter; change all callers. If doing a static link define
1979 __rela_iplt_start and __rela_iplt_end.
1980 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1981 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1982 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1983 to point to .plt.
1984 (Target_x86_64::make_local_ifunc_plt_entry): New function.
1985 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1986 switch.
1987 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1988 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
1989 R_X86_64_IRELATIVE to switch.
1990 (Target_x86_64::Scan::global): Likewise.
1991 (Target_x86_64::Relocate::relocate): Likewise.
1992 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1993 switch.
1994 * target.h (class Target): Add plt_section_for_global and
1995 plt_section_for_local functions. Add do_plt_section_for_global
1996 and do_plt_section_for_local virtual functions.
1997 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
1998 clarifying comments.
1999 (Symbol::use_plt_offset): Handle IFUNC symbol.
2000 * object.cc (Sized_relobj::Sized_relobj): Initialize
2001 local_plt_offsets_.
2002 (Sized_relobj::local_has_plt_offset): New function.
2003 (Sized_relobj::local_plt_offset): New function.
2004 (Sized_relobj::set_local_plt_offset): New function.
2005 (Sized_relobj::do_count): Handle IFUNC symbol.
2006 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2007 a bit away from input_shndx_ field. Add set_is_func_symbol and
2008 is_ifunc_symbol functions.
2009 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2010 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2011 local_plt_offsets_ field.
2012 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2013 * output.h (class Output_section_data): Add non-const
2014 output_section function.
2015 (class Output_data_got): Update declarations.
2016 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2017 Add use_plt_offset parameter to global and local constructors.
2018 Change all callers. Change local_sym_index_ field to 31 bits.
2019 Change GSYM_CODE and CONSTANT_CODE accordingly.
2020 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2021 doing a static link don't set sh_link field.
2022 (Output_data_got::Got_entry::write): Use PLT offset if
2023 appropriate.
2024 (Output_data_got::add_global_plt): New function.
2025 (Output_data_got::add_local_plt): New function.
2026 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2027 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2028 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2029 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2030 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2031 IFUNC conditional.
2032 * testsuite/ifunc-sel.h: New file.
2033 * testsuite/ifuncmain1.c: New file.
2034 * testsuite/ifuncmain1vis.c: New file.
2035 * testsuite/ifuncmod1.c: New file.
2036 * testsuite/ifuncdep2.c: New file.
2037 * testsuite/ifuncmain2.c: New file.
2038 * testsuite/ifuncmain3.c: New file.
2039 * testsuite/ifuncmod3.c: New file.
2040 * testsuite/ifuncmain4.c: New file.
2041 * testsuite/ifuncmain5.c: New file.
2042 * testsuite/ifuncmod5.c: New file.
2043 * testsuite/ifuncmain6pie.c: New file.
2044 * testsuite/ifuncmod6.c: New file.
2045 * testsuite/ifuncmain7.c: New file.
2046 * configure, testsuite/Makefile.in: Rebuild.
2047
2048 2010-08-18 Ian Lance Taylor <iant@google.com>
2049
2050 * incremental.cc
2051 (Output_section_incremental_inputs::write_input_files): Add cast
2052 to avoid signed/unsigned comparison warning.
2053 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2054
2055 2010-08-12 Cary Coutant <ccoutant@google.com>
2056
2057 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2058
2059 2010-08-13 Ian Lance Taylor <iant@google.com>
2060
2061 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2062
2063 2010-08-12 Cary Coutant <ccoutant@google.com>
2064 Doug Kwan <dougkwan@google.com>
2065
2066 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2067 defintion overrides non-weak undef, remember that the original undef
2068 is not weak.
2069 * symtab.cc (Symbol_table::sized_write_global): For undef without
2070 an original weak binding, set binding to global in output.
2071 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2072 * testsuite/Makefile.in: Regenerate.
2073 * testsuite/strong_ref_weak_def.sh: New file.
2074 * testsuite/strong_ref_weak_def_1.c: Ditto.
2075 * testsuite/strong_ref_weak_def_2.c: Ditto.
2076
2077 2010-08-12 Cary Coutant <ccoutant@google.com>
2078
2079 * testsuite/incremental_test.sh: Rewrite.
2080 * testsuite/incremental_test_1.c: Rewrite.
2081 * testsuite/incremental_test_2.c: Rewrite.
2082
2083 2010-08-12 Cary Coutant <ccoutant@google.com>
2084
2085 * arm.cc (Target_arm::got_size): Add const.
2086 (Target_arm::got_entry_count): New function.
2087 (Target_arm::plt_entry_count): New function.
2088 (Target_arm::first_plt_entry_offset): New function.
2089 (Target_arm::plt_entry_size): New function.
2090 (Output_data_plt_arm::entry_count): New function.
2091 (Output_data_plt_arm::first_plt_entry_offset): New function.
2092 (Output_data_plt_arm::get_plt_entry_size): New function.
2093 * i386.cc (Target_i386::got_size): Add const.
2094 (Target_i386::got_entry_count): New function.
2095 (Target_i386::plt_entry_count): New function.
2096 (Target_i386::first_plt_entry_offset): New function.
2097 (Target_i386::plt_entry_size): New function.
2098 (Output_data_plt_i386::entry_count): New function.
2099 (Output_data_plt_i386::first_plt_entry_offset): New function.
2100 (Output_data_plt_i386::get_plt_entry_size): New function.
2101 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2102 find_incremental_inputs_sections. Dump incremental_got_plt section.
2103 * incremental.cc: Include target.h.
2104 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2105 parameter. Adjust all callers. Find incremental_got_plt section.
2106 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2107 section.
2108 (Output_section_incremental_inputs::set_final_data_size): Calculate
2109 size of incremental_got_plt section.
2110 (Output_section_incremental_inputs::do_write): Write the
2111 incremental_got_plt section.
2112 (Got_plt_view_info): New struct.
2113 (Local_got_offset_visitor): New class.
2114 (Global_got_offset_visitor): New class.
2115 (Global_symbol_visitor_got_plt): New class.
2116 (Output_section_incremental_inputs::write_got_plt): New function.
2117 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2118 Add parameter. Adjust all callers.
2119 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2120 (Incremental_inputs::got_plt_section): New function.
2121 (Incremental_inputs::got_plt_section_): New data member.
2122 (Incremental_got_plt_reader): New class.
2123 * layout.cc (Layout::create_incremental_info_sections): Add the
2124 incremental_got_plt section.
2125 * object.h (Got_offset_list::get_list): New function.
2126 (Got offset_list::for_all_got_offsets): New function.
2127 (Sized_relobj::local_got_offset_list): New function.
2128 * powerpc.cc (Target_powerpc::got_size): Add const.
2129 (Target_powerpc::got_entry_count): New function.
2130 (Target_powerpc::plt_entry_count): New function.
2131 (Target_powerpc::first_plt_entry_offset): New function.
2132 (Target_powerpc::plt_entry_size): New function.
2133 (Output_data_plt_powerpc::entry_count): New function.
2134 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2135 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2136 * sparc.cc (Target_sparc::got_size): Add const.
2137 (Target_sparc::got_entry_count): New function.
2138 (Target_sparc::plt_entry_count): New function.
2139 (Target_sparc::first_plt_entry_offset): New function.
2140 (Target_sparc::plt_entry_size): New function.
2141 (Output_data_plt_sparc::entry_count): New function.
2142 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2143 (Output_data_plt_sparc::get_plt_entry_size): New function.
2144 * symtab.h (Symbol::got_offset_list): New function.
2145 (Symbol_table::for_all_symbols): New function.
2146 * target.h (Sized_target::got_entry_count): New function.
2147 (Sized_target::plt_entry_count): New function.
2148 (Sized_target::plt_entry_size): New function.
2149 * x86_64.cc (Target_x86_64::got_size): Add const.
2150 (Target_x86_64::got_entry_count): New function.
2151 (Target_x86_64::plt_entry_count): New function.
2152 (Target_x86_64::first_plt_entry_offset): New function.
2153 (Target_x86_64::plt_entry_size): New function.
2154 (Output_data_plt_x86_64::entry_count): New function.
2155 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2156 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2157
2158 2010-08-12 Cary Coutant <ccoutant@google.com>
2159
2160 * archive.cc: Include incremental.h.
2161 (Archive::Archive): Initialize incremental_info_.
2162 (Archive::include_member): Record archive members in incremental info.
2163 (Add_archive_symbols::run): Record begin and end of an archive in
2164 incremental info.
2165 (Lib_group::include_member): Record objects in incremental info.
2166 * archive.h (Incremental_archive_entry): Forward declaration.
2167 (Archive::set_incremental_info): New member function.
2168 (Archive::incremental_info): New member function.
2169 (Archive::Unused_symbol_iterator): New class.
2170 (Archive::unused_symbols_begin): New member function.
2171 (Archive::unused_symbols_end): New member function.
2172 (Archive::incremental_info_): New data member.
2173 * incremental-dump.cc (find_input_containing_global): New function.
2174 (dump_incremental_inputs): Dump new incremental info sections.
2175 * incremental.cc: Include symtab.h.
2176 (Output_section_incremental_inputs): New class.
2177 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2178 new incremental info sections.
2179 (Sized_incremental_binary::do_check_inputs): Likewise.
2180 (Incremental_inputs::report_archive): Remove.
2181 (Incremental_inputs::report_archive_begin): New function.
2182 (Incremental_inputs::report_archive_end): New function.
2183 (Incremental_inputs::report_object): New function.
2184 (Incremental_inputs::finalize_inputs): Remove.
2185 (Incremental_inputs::report_input_section): New function.
2186 (Incremental_inputs::report_script): Rewrite.
2187 (Incremental_inputs::finalize): Do nothing but finalize string table.
2188 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2189 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2190 (Incremental_inputs::create_data_sections): New function.
2191 (Incremental_inputs::relocs_entsize): New function.
2192 (Output_section_incremental_inputs::set_final_data_size): New function.
2193 (Output_section_incremental_inputs::do_write): New function.
2194 (Output_section_incremental_inputs::write_header): New function.
2195 (Output_section_incremental_inputs::write_input_files): New function.
2196 (Output_section_incremental_inputs::write_info_blocks): New function.
2197 (Output_section_incremental_inputs::write_symtab): New function.
2198 * incremental.h (Incremental_script_entry): Forward declaration.
2199 (Incremental_object_entry): Forward declaration.
2200 (Incremental_archive_entry): Forward declaration.
2201 (Incremental_inputs): Forward declaration.
2202 (Incremental_inputs_header_data): Remove.
2203 (Incremental_inputs_header): Remove.
2204 (Incremental_inputs_header_write): Remove.
2205 (Incremental_inputs_entry_data): Remove.
2206 (Incremental_inputs_entry): Remove.
2207 (Incremental_inputs_entry_write): Remove.
2208 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2209 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2210 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2211 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2212 Likewise.
2213 (Incremental_input_entry): New class.
2214 (Incremental_script_entry): New class.
2215 (Incremental_object_entry): New class.
2216 (Incremental_archive_entry): New class.
2217 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2218 (Incremental_inputs::report_inputs): Remove.
2219 (Incremental_inputs::report_archive): Remove.
2220 (Incremental_inputs::report_archive_begin): New function.
2221 (Incremental_inputs::report_archive_end): New function.
2222 (Incremental_inputs::report_object): Change prototype.
2223 (Incremental_inputs::report_input_section): New function.
2224 (Incremental_inputs::report_script): Change prototype.
2225 (Incremental_inputs::get_reloc_count): New function.
2226 (Incremental_inputs::set_reloc_count): New function.
2227 (Incremental_inputs::create_data_sections): New function.
2228 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2229 (Incremental_inputs::inputs_section): New function.
2230 (Incremental_inputs::symtab_section): New function.
2231 (Incremental_inputs::relocs_section): New function.
2232 (Incremental_inputs::get_stringpool): Add const.
2233 (Incremental_inputs::command_line): Add const.
2234 (Incremental_inputs::inputs): Remove.
2235 (Incremental_inputs::command_line_key): New function.
2236 (Incremental_inputs::input_file_count): New function.
2237 (Incremental_inputs::input_files): New function.
2238 (Incremental_inputs::relocs_entsize): New function.
2239 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2240 (Incremental_inputs::finalize_inputs): Remove.
2241 (Incremental_inputs::Input_info): Remove.
2242 (Incremental_inputs::lock_): Remove.
2243 (Incremental_inputs::inputs_): Change type.
2244 (Incremental_inputs::inputs_map_): Remove.
2245 (Incremental_inputs::current_object_entry_): New data member.
2246 (Incremental_inputs::inputs_section_): New data member.
2247 (Incremental_inputs::symtab_section_): New data member.
2248 (Incremental_inputs::relocs_section_): New data member.
2249 (Incremental_inputs::reloc_count_): New data member.
2250 (Incremental_inputs_reader): New class.
2251 (Incremental_symtab_reader): New class.
2252 (Incremental_relocs_reader): New class.
2253 * layout.cc (Layout::finalize): Move finalization of incremental info
2254 and creation of incremental info sections to follow finalization of
2255 symbol table. Set offsets for postprocessing sections.
2256 (Layout::create_incremental_info_sections): Call
2257 Incremental_inputs::create_data_sections. Add incremental symtab
2258 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2259 sections to layout after input sections.
2260 * layout.h (struct Timespec): Forward declaration.
2261 (Layout::incremental_inputs): Add const.
2262 (Layout::create_incremental_info_sections): Add parameter.
2263 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2264 * object.cc: Include incremental.h.
2265 (Relobj::finalize_incremental_relocs): New function.
2266 (Sized_relobj::do_layout): Record input sections in incremental info.
2267 * object.h (Object::output_section): New function.
2268 (Object::output_section_offset): Moved from Relobj.
2269 (Object::get_incremental_reloc_base): New function.
2270 (Object::get_incremental_reloc_count): New function.
2271 (Object::do_output_section): New function.
2272 (Object::do_output_section_offset): Moved from Relobj.
2273 (Object::do_get_incremental_reloc_base): New function.
2274 (Object::do_get_incremental_reloc_count): New function.
2275 (Object::Object): Initialize new data members.
2276 (Relobj::output_section): Renamed do_output_section and moved to
2277 protected.
2278 (Relobj::output_section_offset): Moved to Object.
2279 (Relobj::do_get_incremental_reloc_base): New function.
2280 (Relobj::do_get_incremental_reloc_count): New function.
2281 (Relobj::allocate_incremental_reloc_counts): New function.
2282 (Relobj::count_incremental_reloc): New function.
2283 (Relobj::finalize_incremental_relocs): New function.
2284 (Relobj::next_incremental_reloc_index): New function.
2285 (Relobj::reloc_counts_): New data member.
2286 (Relobj::reloc_bases_): New data member.
2287 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2288 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2289 (Sized_relobj::incremental_relocs_scan): New function.
2290 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2291 (Sized_relobj::incremental_relocs_write): New function.
2292 (Sized_relobj::incremental_relocs_write_reltype): New function.
2293 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2294 incremental link.
2295 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2296 archives and object files elsewhere.
2297 (Add_symbols::run): Report object files here.
2298 (Finish_group::run): Report end of archive at end of group.
2299 * reloc.cc: Include layout.h, incremental.h.
2300 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2301 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2302 (Sized_relobj::incremental_relocs_scan): New function.
2303 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2304 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2305 (Sized_relobj::incremental_relocs_write): New function.
2306 (Sized_relobj::incremental_relocs_write_reltype): New function.
2307 * script.cc (read_input_script): Rewrite test for incremental link.
2308 Change call to Incremental_inputs::report_script.
2309 * symtab.h (Symbol_table::first_global_index): New function.
2310 (Symbol_table::output_count): New function.
2311
2312 2010-08-12 Doug Kwan <dougkwan@google.com>
2313
2314 * arm.cc (Target_arm::merge_object_attributes): Check command line
2315 options --no-wchar-size-warning and --no-enum-size-warning.
2316 * options.h (General_options): Add ld-compatible options
2317 --no-enum-size-warning and --no-wchar-size-warning.
2318
2319 2010-08-04 Ian Lance Taylor <iant@google.com>
2320
2321 * x86_64.cc (Target_x86_64::Scan::local): Use
2322 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2323 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2324 (Target_x86_64::Scan::global): Likewise.
2325 (Target_x86_64::Relocate::relocate): Likewise.
2326 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2327 Likewise.
2328
2329 2010-08-03 Cary Coutant <ccoutant@google.com>
2330
2331 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2332 to reserve space in merged_strings vector. Keep total input size
2333 for stats.
2334 (Output_merge_string::do_print_merge_stats): Print total input size.
2335 * merge.h (Output_merge_string): Add input_size_ field.
2336 * stringpool.cc (Stringpool_template::string_length): Move
2337 implementations out of Stringpool_template class and place in
2338 stringpool.h.
2339 * stringpool.h (string_length): Move out of Stringpool_template.
2340
2341 2010-08-03 Ian Lance Taylor <iant@google.com>
2342
2343 PR 11712
2344 * layout.cc (relaxation_loop_body): If address of load segment is
2345 set, adjust address to include headers if possible.
2346
2347 2010-08-03 Ian Lance Taylor <iant@google.com>
2348
2349 * version.cc (version_string): Bump to 1.10.
2350
2351 2010-08-03 Ian Lance Taylor <iant@google.com>
2352
2353 PR 11805
2354 * layout.h (enum Output_section_order): Define.
2355 (class Layout): Update declarations.
2356 * layout.cc (Layout::get_output_section): Add order parameter.
2357 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2358 is_first_non_relro parameters. Change all callers.
2359 (Layout::choose_output_section): Likewise.
2360 (Layout::add_output_section_data): Likewise.
2361 (Layout::make_output_section): Likewise. Set order.
2362 (Layout::default_section_order): New function.
2363 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2364 * output.cc (Output_section::Output_section): Initialize order_.
2365 Don't initialize deleted fields.
2366 (Output_segment::Output_segment): Don't initialize deleted
2367 fields.
2368 (Output_segment::add_output_section_to_load): New function
2369 replacing add_output_section. Change all callers to call this or
2370 add_output_section_to_nonload.
2371 (Output_segment::add_output_section_to_nonload): New function.
2372 (Output_segment::remove_output_section): Rewrite.
2373 (Output_segment::add_initial_output_data): Likewise.
2374 (Output_segment::has_any_data_sections): Likewise.
2375 (Output_segment::is_first_section_relro): Likewise.
2376 (Output_segment::maximum_alignment): Likewise.
2377 (Output_segment::has_dynamic_reloc): New function replacing
2378 dynamic_reloc_count. Change all callers.
2379 (Output_segment::has_dynamic_reloc_list): New function replacing
2380 dynamic_reloc_count_list. Change all callers.
2381 (Output_segment::set_section_addresses): Rewrite.
2382 (Output_segment::set_offset): Rewrite.
2383 (Output_segment::find_first_and_last_list): Remove.
2384 (Output_segment::set_tls_offsets): Rewrite.
2385 (Output_segment::first_section_load_address): Likewise.
2386 (Output_segment::output_section_count): Likewise.
2387 (Output_segment::section_with_lowest_load_address): Likewise.
2388 (Output_segment::write_section_headers): Likewise.
2389 (Output_segment::print_sections_to_map): Likewise.
2390 * output.h (class Output_data): Remove dynamic_reloc_count_
2391 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2392 (Output_data::add_dynamic_reloc): Rewrite.
2393 (Output_data::has_dynamic_reloc): New function.
2394 (Output_data::dynamic_reloc_count): Remove.
2395 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2396 is_last_relro_, is_first_non_relro_, is_interp_,
2397 is_dynamic_linker_section_ fields. Add order and set_order
2398 functions. Remove is_relro_local, set_is_relro_local,
2399 is_last_relro, set_is_last_relro, is_first_non_relro,
2400 set_is_first_non_relro functions, is_interp, set_is_interp,
2401 is_dynamic_linker_section, and set_is_dynamic_linker_section
2402 functions.
2403 (class Output_segment): Change Output_data_list from std::list to
2404 std:;vector. Add output_lists_ field. Remove output_data_ and
2405 output_bss_ fields. Update declarations.
2406
2407 2010-08-02 Ian Lance Taylor <iant@google.com>
2408
2409 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2410 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2411 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2412
2413 2010-08-02 Ian Lance Taylor <iant@google.com>
2414
2415 PR 11855
2416 * script.cc (Script_options::Script_options): Initialize
2417 symbol_definitions_ and symbol_references_.
2418 (Script_options::add_symbol_assignment): Update
2419 symbol_definitions_ and symbol_references_.
2420 (Script_options::add_symbol_reference): New function.
2421 (script_symbol): New function.
2422 * script.h (class Script_options): Add symbol_definitions_ and
2423 symbol_references_ fields.
2424 (Script_options::referenced_const_iterator): New type.
2425 (Script_options::referenced_begin): New function.
2426 (Script_options::referenced_end): New function.
2427 (Script_options::is_referenced): New function.
2428 (Script_options::any_unreferenced): New function.
2429 * script-c.h (script_symbol): Declare.
2430 * yyscript.y (exp): Call script_symbol.
2431 * symtab.cc: Include "script.h".
2432 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2433 Change all callers. Check symbols referenced by scripts.
2434 (Symbol_table::add_undefined_symbols_from_command_line): Add
2435 layout parameter. Change all callers.
2436 (Symbol_table::do_add_undefined_symbols_from_command_line):
2437 Likewise. Break out loop body. Check symbols referenced by
2438 scripts.
2439 (Symbol_table::add_undefined_symbol_from_command_line): New
2440 function broken out of
2441 do_add_undefined_symbols_from_command_line.
2442 * symtab.h (class Symbol_table): Update declarations.
2443 * archive.cc: Include "layout.h".
2444 (Archive::should_include_member): Add layout parameter. Change
2445 all callers. Check for symbol mentioned in expression.
2446 * archive.h (class Archive): Update declaration.
2447 * object.cc (Sized_relobj::do_should_include_member): Add layout
2448 parameter.
2449 * object.h (Object::should_include_member): Add layout parameter.
2450 Change all callers.
2451 (Object::do_should_include_member): Add layout parameter.
2452 (class Sized_relobj): Update declaration.
2453 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2454 parameter.
2455 * dynobj.h (class Sized_dynobj): Update declaration.
2456 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2457 layout parameter.
2458 * plugin.h (class Sized_pluginobj): Update declaration.
2459
2460 2010-08-02 Ian Lance Taylor <iant@google.com>
2461
2462 PR 11866
2463 * output.cc (Output_segment::set_offset): Search for the first and
2464 last sections rather than assuming that the list is in order.
2465 (Output_segment::find_first_and_last_list): New function.
2466 * output.h (class Output_segment): Update declarations.
2467 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2468 (relro_strip_test_SOURCES): New variable.
2469 (relro_strip_test_DEPENDENCIES): New variable.
2470 (relro_strip_test_LDFLAGS): New variable.
2471 (relro_strip_test_LDADD): New variable.
2472 (relro_strip_test.so): New target.
2473
2474 2010-08-02 Ian Lance Taylor <iant@google.com>
2475
2476 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2477 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2478 (Target_i386::got_tlsdesc_section): New function.
2479 (Target_i386::got_section): Create space for GOT entries for
2480 TLSDESC relocations.
2481 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2482 R_386_TLS_GOTDESC.
2483 (Target_i386::Scan::global): Likewise.
2484 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2485 using TLSDESC GOT.
2486 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2487 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2488 (Target_x86_64::got_tlsdesc_section): New function.
2489 (Target_x86_64::got_section): Create space for GOT entries for
2490 TLSDESC relocations.
2491 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2492 R_386_TLS_GOTDESC.
2493 (Target_x86_64::Scan::global): Likewise.
2494 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2495 using TLSDESC GOT.
2496
2497 2010-08-02 Ian Lance Taylor <iant@google.com>
2498
2499 * testsuite/final_layout.sh: Use dc to convert from hex to
2500 decimal.
2501
2502 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2503
2504 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2505 paramter to the call to gold::gc_process_relocs.
2506 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2507 paramter to the call to gold::gc_process_relocs.
2508 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2509 parameter to the call to gold::gc_process_relocs.
2510 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2511 template parameter to the call to gold::gc_process_relocs.
2512 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2513 paramter to the call to gold::gc_process_relocs.
2514 * gc.h (get_embedded_addend_size): New function.
2515 (gc_process_relocs): Save the size of the reloc for use by ICF.
2516 * icf.cc (get_section_contents): Get the addend from the text section
2517 for SHT_REL relocation sections.
2518 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2519 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2520 * int_encoding.h (read_from_pointer): New overloaded function.
2521 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2522 * testsuite/icf_sht_rel_addend_test.sh: New file.
2523 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2524 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2525
2526 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2527
2528 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2529 * Makefile.in: Regenerate.
2530 * testsuite/Makefile.in: Regenerate.
2531
2532 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2533
2534 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2535 * gold/testsuite/debug_msg.cc: Likewise.
2536 * gold/testsuite/odr_violation1.cc
2537 * gold/testsuite/odr_violation2.cc
2538
2539 2010-07-21 Cary Coutant <ccoutant@google.com>
2540
2541 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2542 string, and length fields.
2543 (Output_merge_string::Merged_strings_list): New type.
2544 (Output_merge_string::Merged_strings_lists): New typedef.
2545 (Output_merge_string): Replace merged_strings_ with
2546 merged_strings_lists_.
2547 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2548 Merged_strings_list per input object and section. Don't store pointer
2549 to the string. Don't store length with each merged string entry.
2550 (Output_merge_string::finalize_merged_data): Loop over list of merged
2551 strings lists. Recompute length of each merged string.
2552
2553 2010-07-15 Cary Coutant <ccoutant@google.com>
2554
2555 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2556 here.
2557
2558 2010-07-14 Ian Lance Taylor <iant@google.com>
2559
2560 * descriptors.cc (Descriptors::open): Report correct name in error
2561 message.
2562
2563 2010-07-13 Doug Kwan <dougkwan@google.com>
2564
2565 * arm.cc (Arm_input_section::Arm_input_section): For a
2566 SHT_ARM_EXIDX section, always keeps the input sections.
2567 (Arm_input_section::set_exidx_section_link): New method.
2568 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2569 has_errors_ to false.
2570 (Arm_exidx_input_section::has_errors,
2571 Arm_exidx_input_section::set_has_errors): New methods.
2572 (Arm_exidx_input_section::has_errors_): New data member.
2573 (Arm_relobj::get_exidx_shndx_list): New method.
2574 (Arm_output_section::append_text_sections_to_list): Do not skip
2575 section without SHF_EXECINSTR.
2576 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2577 errors.
2578 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2579 section header. Make error messages more verbose. Check for
2580 a non-executable section linked to an EXIDX section.
2581 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2582 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2583 check that there is no deferred EXIDX section if we exit early.
2584 Instead of not making an EXIDX section in case of an error, make one
2585 and set the has_errors flag of it.
2586 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2587 in a relocatable link.
2588 (Target_arm::do_relax): Look for the EXIDX output section instead of
2589 assuming that it is called .ARM.exidx.
2590 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2591 section list. Do not check for SHF_EXECINSTR section flags but
2592 skip any input section with errors.
2593 * output.cc (Output_section::Output_section): Initialize
2594 always_keeps_input_sections_ to false.
2595 (Output_section::add_input_section): Check for
2596 always_keeps_input_sections_.
2597 * output.h (Output_section::always_keeps_input_sections,
2598 Output_section::set_always_keeps_input_sections): New methods.
2599 (Output_section::always_keeps_input_sections): New data member.
2600
2601 2010-07-13 Rafael Espindola <espindola@google.com>
2602
2603 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2604 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2605
2606 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2607 Ian Lance Taylor <iant@google.com>
2608
2609 * output.h (Output_section_lookup_maps::add_merge_section):
2610 Correct check of whether value was inserted.
2611 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2612 (Output_section_lookup_maps::add_relaxed_input_section):
2613 Likewise.
2614 * arm.cc (Target_arm::got_section): Remove used local os.
2615 * i386.cc (Target_i386::got_section): Likewise.
2616 * x86_64.cc (Target_x86_64::got_section): Likewise.
2617 * sparc.cc (Target_sparc::got_section): Likewise.
2618 (Target_sparc::relocate): Remove unused local have_got_offset.
2619 * powerpc.cc (Target_powerpc::relocate): Likewise.
2620
2621 2010-07-13 Ian Lance Taylor <iant@google.com>
2622
2623 * compressed_output.cc (zlib_decompress): Fix signature in
2624 !HAVE_ZLIB_H case.
2625
2626 * archive.cc (Archive::include_member): Unlock an external member
2627 of a thin archive. Don't bother to delete an object we know is
2628 NULL.
2629
2630 2010-07-12 Cary Coutant <ccoutant@google.com>
2631
2632 * compressed_output.cc (zlib_decompress): New function.
2633 (get_uncompressed_size): New function.
2634 (decompress_input_section): New function.
2635 * compressed_output.h (get_uncompressed_size): New function.
2636 (decompress_input_section): New function.
2637 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2638 Handle compressed debug sections.
2639 * layout.cc (is_compressed_debug_section): New function.
2640 (Layout::output_section_name): Map compressed section names to
2641 canonical names.
2642 * layout.h (is_compressed_debug_section): New function.
2643 (is_debug_info_section): Recognize compressed debug sections.
2644 * merge.cc: Include compressed_output.h.
2645 (Output_merge_data::do_add_input_section): Handle compressed
2646 debug sections.
2647 (Output_merge_string::do_add_input_section): Handle compressed
2648 debug sections.
2649 * object.cc: Include compressed_output.h.
2650 (Sized_relobj::Sized_relobj): Initialize new data members.
2651 (build_compressed_section_map): New function.
2652 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2653 * object.h (Object::section_is_compressed): New method.
2654 (Object::do_section_is_compressed): New method.
2655 (Sized_relobj::Compressed_section_map): New type.
2656 (Sized_relobj::do_section_is_compressed): New method.
2657 (Sized_relobj::compressed_sections_): New data member.
2658 * output.cc (Output_section::add_input_section): Handle compressed
2659 debug sections.
2660 * reloc.cc: Include compressed_output.h.
2661 (Sized_relobj::write_sections): Handle compressed debug sections.
2662
2663 2010-07-08 Cary Coutant <ccoutant@google.com>
2664
2665 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2666 weak when resolving to a dynamic def.
2667 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2668 for weak undef/dynamic def cases. Adjust callers.
2669 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2670 undef_binding_weak_.
2671 (Symbol_table::sized_write_globals): Adjust symbol binding.
2672 (Symbol_table::sized_write_symbol): Add binding parameter.
2673 * symtab.h (Symbol::set_undef_binding): New method.
2674 (Symbol::is_undef_binding_weak): New method.
2675 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2676 (Symbol_table::should_override): Add new parameter.
2677 (Symbol_table::sized_write_symbol): Add new parameter.
2678
2679 * testsuite/weak_undef_file1.cc: Add new test case.
2680 * testsuite/weak_undef_file2.cc: Fix header comment.
2681 * testsuite/weak_undef_test.cc: Add new test case.
2682
2683 2010-06-29 Doug Kwan <dougkwan@google.com>
2684
2685 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2686 Initialize USE_SYMBOL_.
2687 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2688 definition.
2689 (Arm_reloc_property::uses_symbol_): New data member declaration.
2690 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2691 uses symbol value and symbol is undefined but not weakly undefined.
2692
2693 2010-06-28 Rafael Espindola <espindola@google.com>
2694
2695 * plugin.cc (Plugin::load): Use dlerror.
2696
2697 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2698
2699 * symtab.cc (detect_odr_violations): When reporting an ODR
2700 violation, report an object where the symbol is defined.
2701
2702 2010-06-25 Doug Kwan <dougkwan@google.com>
2703
2704 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2705 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2706 definition.
2707 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2708 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2709 target hook to detect function points.
2710 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2711 * icf.h (Icf::check_section_for_function_pointers): Change type of
2712 parameter SECTION_NAME to const reference to std::string. Use
2713 target hook to determine if section may have unsafe pointers.
2714 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2715 method definition.
2716
2717 2010-06-21 Rafael Espindola <espindola@google.com>
2718
2719 * fileread.cc (Input_file::find_fie): New
2720 (Input_file::open): Use Input_file::find_fie.
2721 * fileread.h (Input_file::find_fie): New
2722 * plugin.cc (set_extra_library_path): New.
2723 (Plugin::load): Add set_extra_library_path to the transfer vector.
2724 (Plugin_manager::set_extra_library_path): New.
2725 (Plugin_manager::add_input_file): Use the extra search path if set.
2726 (set_extra_library_path(): New.
2727 * plugin.h (Plugin_manager): Add set_extra_library_path and
2728 extra_search_path_.
2729
2730 2010-06-19 Cary Coutant <ccoutant@google.com>
2731
2732 * layout.cc (gdb_sections): Add .debug_types.
2733 (lines_only_debug_sections): Likewise.
2734
2735 2010-06-18 Rafael Espindola <espindola@google.com>
2736
2737 * plugin.cc (add_input_file,add_input_library)
2738 (Plugin_manager::add_input_file): Make filename arguments const.
2739 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2740 const.
2741
2742 2010-06-16 Doug Kwan <dougkwan@google.com>
2743
2744 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2745 .ARM.attributes section if we have not merged any input
2746 attributes sections.
2747
2748 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2749
2750 * arm.cc: Allow combining objects with no EABI version
2751 information.
2752
2753 2010-06-15 Rafael Espindola <espindola@google.com>
2754
2755 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2756
2757 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2758
2759 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2760 (struct iovec): Correct !HAVE_READV definition.
2761
2762 2010-06-10 Cary Coutant <ccoutant@google.com>
2763
2764 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2765 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2766 reloc sections.
2767 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2768
2769 PR 11683
2770 * symtab.h (Symbol::is_placeholder): New member function.
2771 * target-reloc.h (relocate_section): Check for placeholder symbols.
2772
2773 * testsuite/Makefile.am (plugin_test_8): New test.
2774 (plugin_test_9): New test.
2775 * testsuite/Makefile.in: Regenerate.
2776
2777 2010-06-09 Nick Clifton <nickc@redhat.com>
2778
2779 * yyscript.y (input_list_element): Allow strings prefixed with
2780 the '-' character. Treat these as libraries.
2781 * script.cc (script_add_library): New function. Adds a library
2782 specified by "-l<name>" found in an input script.
2783 * script-c.h: Add prototype for script_add_library.
2784
2785 2010-06-07 Doug Kwan <dougkwan@google.com>
2786
2787 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2788 Restrict stub-group size to be within long conditional branch
2789 range when working around cortex-A8 erratum.
2790
2791 2010-06-07 Damien Diederen <dd@crosstwine.com>
2792
2793 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2794 #ifdef typo.
2795
2796 2010-06-03 Sriraman Tallam <tmsriram@google.com>
2797
2798 PR gold/11658
2799 * output.cc
2800 (Output_section::Input_section_sort_entry::compare_section_ordering):
2801 Change to return non-zero correctly.
2802 (Output_section::Input_section_sort_section_order_index_compare
2803 ::operator()): Change to fix ambiguity in comparisons.
2804
2805 2010-06-01 Sriraman Tallam <tmsriram@google.com>
2806
2807 * gold.h (is_wildcard_string): New function.
2808 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2809 (Layout::layout_eh_frame): Ditto.
2810 (Layout::find_section_order_index): New method.
2811 (Layout::read_layout_from_file): New method.
2812 * layout.h (Layout::find_section_order_index): New method.
2813 (Layout::read_layout_from_file): New method.
2814 (Layout::input_section_position_): New private member.
2815 (Layout::input_section_glob_): New private member.
2816 * main.cc (main): Call read_layout_from_file here.
2817 * options.h (--section-ordering-file): New option.
2818 * output.cc (Output_section::input_section_order_specified_): New
2819 member.
2820 (Output_section::Output_section): Initialize new member.
2821 (Output_section::add_input_section): Add new parameter.
2822 Keep input sections when --section-ordering-file is used.
2823 (Output_section::set_final_data_size): Sort input sections when
2824 section ordering file is specified.
2825 (Output_section::Input_section_sort_entry): Add new parameter.
2826 Check sorting type.
2827 (Output_section::Input_section_sort_entry::compare_section_ordering):
2828 New method.
2829 (Output_section::Input_section_sort_compare::operator()): Change to
2830 consider section_order_index.
2831 (Output_section::Input_section_sort_init_fini_compare::operator()):
2832 Change to consider section_order_index.
2833 (Output_section::Input_section_sort_section_order_index_compare
2834 ::operator()): New method.
2835 (Output_section::sort_attached_input_sections): Change to sort
2836 according to section order when specified.
2837 (Output_section::add_input_section<32, true>): Add new parameter.
2838 (Output_section::add_input_section<64, true>): Add new parameter.
2839 (Output_section::add_input_section<32, false>): Add new parameter.
2840 (Output_section::add_input_section<64, false>): Add new parameter.
2841 * output.h (Output_section::add_input_section): Add new parameter.
2842 (Output_section::input_section_order_specified): New
2843 method.
2844 (Output_section::set_input_section_order_specified): New method.
2845 (Input_section::Input_section): Initialize section_order_index_.
2846 (Input_section::section_order_index): New method.
2847 (Input_section::set_section_order_index): New method.
2848 (Input_section::section_order_index_): New member.
2849 (Input_section::Input_section_sort_section_order_index_compare): New
2850 struct.
2851 (Output_section::input_section_order_specified_): New member.
2852 * script-sections.cc (is_wildcard_string): Delete and move modified
2853 method to gold.h.
2854 (Output_section_element_input::Output_section_element_input): Modify
2855 call to is_wildcard_string.
2856 (Output_section_element_input::Input_section_pattern
2857 ::Input_section_pattern): Ditto.
2858 (Output_section_element_input::Output_section_element_input): Ditto.
2859 * testsuite/Makefile.am (final_layout): New test case.
2860 * testsuite/Makefile.in: Regenerate.
2861 * testsuite/final_layout.cc: New file.
2862 * testsuite/final_layout.sh: New file.
2863
2864 2010-06-01 Rafael Espindola <espindola@google.com>
2865
2866 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2867
2868 2010-06-01 Rafael Espindola <espindola@google.com>
2869
2870 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2871 visibility of symbols.
2872
2873 2010-05-27 Doug Kwan <dougkwan@google.com>
2874
2875 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2876 from start of output section instead of address for a local symbol
2877 in a merged or relaxed section when doing a relocatable link.
2878
2879 2010-05-26 Rafael Espindola <espindola@google.com>
2880
2881 PR 11604
2882 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2883 adding sections the garbage collector removed.
2884 * gold/testsuite/Makefile.am: Add test.
2885 * gold/testsuite/Makefile.in: Regenerate.
2886 * gold/testsuite/plugin_test_7.sh: New.
2887 * gold/testsuite/plugin_test_7_1.c: New.
2888 * gold/testsuite/plugin_test_7_2.c: New.
2889
2890 2010-05-26 Rafael Espindola <espindola@google.com>
2891
2892 * script-sections.cc (Output_section_definition::set_section_addresses):
2893 Check for --section-start.
2894
2895 2010-05-26 Doug Kwan <dougkwan@google.com>
2896
2897 * arm.cc (Arm_scan_relocatable_relocs): New class.
2898 (Target_arm::relocate_special_relocatable): New method.
2899 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2900 (Arm_relocate_functions::thumb_branch_common): Same.
2901 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2902 instead of Default_scan_relocatable_relocs.
2903 * target-reloc.h (relocate_for_relocatable): Let target handle
2904 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2905 * target.h (Sized_target::relocate_special_relocatable): New method.
2906
2907 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2908
2909 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2910
2911 2010-05-23 Doug Kwan <dougkwan@google.com>
2912
2913 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2914 instead of a cast.
2915 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2916 with a direct branch, not a conditional branch, to a stub.
2917 * merge.cc (Output_merge_base::record_input_section): New method
2918 defintion.
2919 (Output_merge_data::do_add_input_section): Record input section if
2920 keeps-input-sections flag is set.
2921 (Output_merge_string::do_add_input_section): Ditto.
2922 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2923 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2924 INPUT_SECTIONS_.
2925 (Output_merge_base::keeps_input_sections,
2926 Output_merge_base::set_keeps_input_sections,
2927 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2928 method definitions.
2929 (Output_merge_base::Input_sections): New type declaration.
2930 (Output_merge_base::input_sections_begin,
2931 Output_merge_base::input_sections_end,
2932 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2933 (Output_merge_base::bool keeps_input_sections_,
2934 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2935 Output_merge_base::input_sections_): New data members.
2936 (Output_merge_data::do_set_keeps_input_sections): New method
2937 defintion.
2938 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2939 * output.cc (Output_section::Input_section::relobj): Move method
2940 defintion from class declaration to here and handle merge sections.
2941 (Output_section::Input_section::shndx): Ditto.
2942 (Output_section::Output_section): Remove initializations of removed
2943 data members and initialize new data member LOOKUP_MAPS_.
2944 (Output_section::add_input_section): Set keeps-input-sections flag
2945 for a newly created merge output section as appropriate. Adjust code
2946 to use Output_section_lookup_maps class.
2947 (Output_section::add_relaxed_input_section): Adjst code for lookup
2948 maps code refactoring.
2949 (Output_section::add_merge_input_section): Add a new parameter
2950 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2951 class. If adding input section to a newly created merge output
2952 section fails, remove the new merge section.
2953 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2954 Adjust code for use of the Output_section_lookup_maps class.
2955 (Output_section::find_merge_section): Ditto.
2956 (Output_section::build_lookup_maps): New method defintion.
2957 (Output_section::find_relaxed_input_section): Adjust code to use
2958 Output_section_lookup_maps class.
2959 (Output_section::get_input_sections): Export merge sections. Adjust
2960 code to use Output_section_lookup_maps class.
2961 (Output_section:::add_script_input_section): Adjust code to use
2962 Output_section_lookup_maps class. Update lookup maps for merge
2963 sections also.
2964 (Output_section::discard_states): Use Output_section_lookup_maps.
2965 (Output_section::restore_states): Same.
2966 * output.h (Merge_section_properties): Move class defintion out of
2967 Output_section.
2968 (Output_section_lookup_maps): New class.
2969 (Output_section::Input_section::is_merge_section): New method
2970 defintion.
2971 (Output_section::Input_section::relobj): Move defintion out of class
2972 defintion. Declare method only.
2973 (Output_section::Input_section::shndx): Ditto.
2974 (Output_section::Input_section::output_merge_base): New method defintion.
2975 (Output_section::Input_section::u2_.pomb): New union field.
2976 (Output_section::Merge_section_by_properties_map,
2977 Output_section::Output_section_data_by_input_section_map,
2978 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2979 Remove types.
2980 (Output_section::add_merge_input_section): Add new parameter
2981 KEEPS_INPUT_SECTIONS.
2982 (Output_section::build_lookup_maps): New method declaration.
2983 (Output_section::merge_section_map_,
2984 Output_section::merge_section_by_properties_map_,
2985 Output_section::relaxed_input_section_map_,
2986 Output_section::is_relaxed_input_section_map_valid_): Remove data
2987 members.
2988 (Output_section::lookup_maps_): New data member.
2989
2990 2010-05-21 Doug Kwan <dougkwan@google.com>
2991
2992 PR gold/11619
2993 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2994 avoid a compilation error.
2995
2996 2010-05-19 Rafael Espindola <espindola@google.com>
2997
2998 * script-sections.cc (Output_section_definition::allocate_to_segment):
2999 Update the phdrs_list even when the output section is NULL.
3000 * testsuite/Makefile.am: Add test.
3001 * testsuite/Makefile.in: Regenerate.
3002 * testsuite/script_test_9.cc: New.
3003 * testsuite/script_test_9.sh: New.
3004 * testsuite/script_test_9.t: New.
3005
3006 2010-05-19 Doug Kwan <dougkwan@google.com>
3007
3008 * arm.cc (Arm_input_section::original_size): New method.
3009 (Arm_input_section::do_addralign): Add a cast.
3010 (Arm_input_section::do_output_offset): Remove static cast.
3011 (Arm_input_section::original_addralign,
3012 Arm_input_section::original_size_): Change type to uint32_t.
3013 (Arm_input_section::init): Add safe casts for section alignment
3014 and size.
3015 (Arm_input_section::set_final_data_size): Do not set address and
3016 offset of stub table.
3017 (Arm_output_section::fix_exidx_coverage): Change use of of
3018 Output_section::Simple_input_section to that of
3019 Output_section::Input_section.
3020 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3021 except for the first pass.
3022 * output.cc (Output_section::get_input_sections): Change type of
3023 input_sections to std::list<Input_section>.
3024 (Output_section::add_script_input_section): Rename from
3025 Output_section::add_simple_input_section. Change type of SIS
3026 parameter from Simple_input_section to Input_section.
3027 * output.h (Output_section::Simple_input_section): Remove class.
3028 (Output_section::Input_section): Change class visibility to public.
3029 (Output_section::Input_section::addralign): Use stored alignments
3030 for special input sections if set.
3031 (Output_section::Input_section::set_addralign): New method.
3032 (Output_section::get_input_sections): Change parameter type from
3033 list of Simple_input_section to list of Input_section.
3034 (Output_section::add_script_input_section): Rename from
3035 Output_section::add_simple_input_section. Change first parameter's
3036 type from Simple_input_section to Input_section and remove the
3037 second and third parameters.
3038 * script-sections.cc (Input_section::Input_section_list): Change
3039 type to list of Output_section::Input_section/
3040 (Input_section_info::Input_section_info): Change parameter type of
3041 INPUT_SECTION to Output_section::Input_section.
3042 (Input_section_info::input_section): Change return type.
3043 (Input_section_info::input_section_): Change type to
3044 Output_section::Input_section.
3045 (Output_section_element_input::set_section_addresses): Adjust code
3046 to use Output_section::Input_section instead of
3047 Output_section::Simple_input_section. Adjust code for renaming
3048 of Output_section::add_simple_input_section.
3049 (Orphan_output_section::set_section_addresses): Ditto.
3050
3051 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3052
3053 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3054 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3055
3056 2010-05-18 Rafael Espindola <espindola@google.com>
3057
3058 * options.cc (General_options::finalize): Handle -nostdlib.
3059 * options.h (nostdlib): New option.
3060 * script.cc (script_add_search_dir): Handle -nostdlib.
3061
3062 2010-05-12 Doug Kwan <dougkwan@google.com>
3063
3064 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3065 attributes section only if there no attributes section after merging.
3066 (Target_arm::merge_object_attributes): Move value of
3067 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3068 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3069 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3070 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3071 and arm_attr_merge_7.stdout.
3072 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3073 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3074 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3075 arm_attr_merge_7b.o): New rules.
3076 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3077 arm_attr_merge_7
3078 * testsuite/Makefile.in: Regenerate.
3079 * testsuite/arm_attr_merge.sh: New file.
3080 * testsuite/arm_attr_merge_[67][ab].s: Same.
3081
3082 2010-05-05 Nick Clifton <nickc@redhat.com>
3083
3084 * po/es.po: Updated Spanish translation.
3085
3086 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3087
3088 * Makefile.am (install-exec-local): Properly install gold as
3089 default cross linker.
3090 * Makefile.in: Regenerated.
3091
3092 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3093 Nick Clifton <nickc@redhat.com>
3094
3095 * configure.ac (install_as_default): Define and set to false
3096 unless --enable-gold or --enable-gold=both/gold has been
3097 specified.
3098 * configure: Regenerate.
3099
3100 * Makefile.am (install-exec-local): Install the executable as
3101 'ld.gold'. If install_as_default is true then also install it as
3102 'ld'.
3103 * Makefile.in: Regenerated.
3104
3105 2010-04-24 Ian Lance Taylor <iant@google.com>
3106
3107 * layout.cc (Layout::layout_reloc): In relocatable link don't
3108 combine reloc sections for grouped sections.
3109
3110 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3111
3112 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3113 sections that are not ordinary to icf.
3114 * icf.cc (get_section_contents): Handle relocation pointing to section
3115 with no object or shndx information.
3116 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3117 * testsuite/Makefile.in: Regenerate.
3118 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3119 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3120
3121 2010-04-22 Ian Lance Taylor <iant@google.com>
3122
3123 * expression.cc (Expression::Expression_eval_info): Add
3124 result_alignment_pointer field.
3125 (Expression::eval_with_dot): Add result_alignment_pointer
3126 parameter. Change all callers.
3127 (Expression::eval_maybe_dot): Likewise.
3128 (class Binary_expression): Add alignment_pointer parameter to
3129 left_value and right_value. Change all callers.
3130 (BINARY_EXPRESSION): Set result alignment.
3131 (class Trinary_expression): Add alignment_pointer parameter to
3132 arg2_value and arg3_value. Change all callers.
3133 (Trinary_cond::value): Set result alignment.
3134 (Max_expression::value, Min_expression::value): Likewise.
3135 (Align_expression::value): Likewise.
3136 * script-sections.cc (class Sections_element): Add dot_alignment
3137 parameter to set_section_addresses virtual function. Update
3138 instantiations.
3139 (class Output_section_element): Likewise.
3140 (Script_sections::create_segments): Add dot_alignment parameter.
3141 Change all callers.
3142 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3143 (Script_sections::set_phdrs_clause_addresses): Likewise.
3144 * script-sections.h: Update declarations.
3145 * script.h: Update declarations.
3146 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3147 min_p_align.
3148 * testsuite/script_test_3.t: Set large alignment.
3149 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3150 segment has expected alignment.
3151
3152 2010-04-22 Nick Clifton <nickc@redhat.com>
3153
3154 * po/gold.pot: Updated by the Translation project.
3155 * po/vi.po: Updated Vietnamese translation.
3156
3157 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3158
3159 * testsuite/Makefile.am (check_PROGRAMS): Add
3160 icf_virtual_function_folding_test.
3161 * testsuite/Makefile.in: Regenerated.
3162
3163 2010-04-15 Andrew Haley <aph@redhat.com>
3164
3165 * options.h (merge_exidx_entries): New option.
3166 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3167 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3168 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3169 (Target_arm::merge_exidx_entries): New function.
3170 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3171 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3172 to Arm_exidx_fixup constructor.
3173 Add new arg, merge_exidx_entries.
3174 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3175 Arm_output_section::fix_exidx_coverage.
3176
3177 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3178
3179 * icf.cc (get_section_contents): Check for preemptible functions.
3180 Ignore addend when appropriate.
3181 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3182 section folded.
3183 (add_from_relobj): Check for section folded.
3184 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3185 * symtab.h (should_add_dynsym_entry): Add new parameter.
3186 * target-reloc.h (scan_relocs): Check for section folded.
3187 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3188 Check reloc types for function pointers in shared objects.
3189 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3190 case.
3191 (icf_preemptible_functions_test): New test case.
3192 (icf_string_merge_test): New test case.
3193 * testsuite.Makefile.in: Regenerate.
3194 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3195 bar_glob. Refactor code.
3196 * testsuite/icf_preemptible_functions_test.cc: New file.
3197 * testsuite/icf_preemptible_functions_test.sh: New file.
3198 * testsuite/icf_string_merge_test.cc: New file.
3199 * testsuite/icf_string_merge_test.sh: New file.
3200 * testsuite/icf_virtual_function_folding_test.cc: New file.
3201 * testsuite/icf_virtual_function_folding_test.sh: New file.
3202
3203 2010-04-14 Doug Kwan <dougkwan@google.com>
3204
3205 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3206 for local symbol recounting if we remove a section due to ICF.
3207 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3208 there are no regular objects in input.
3209
3210 2010-04-13 Doug Kwan <dougkwan@google.com>
3211
3212 * arm.cc (Arm_input_section::set_final_data_size): Compute
3213 accurate final data size instead of using current data size.
3214
3215 2010-04-09 Doug Kwan <dougkwan@google.com>
3216
3217 * layout.cc (Layout::choose_output_section): Handle script section
3218 types.
3219 (Layout::make_output_section_for_script): Add section type parameter.
3220 Handle script section types.
3221 * layout.h (Layout::make_output_section_for_script): Add section
3222 type parameter.
3223 * output.cc (Output_section::Output_section): Initialize data member
3224 is_noload_.
3225 (Output_section::do_reset_address_and_file_offset): Do not set address
3226 to 0 if section is a NOLOAD section.
3227 * output.h (Output_section::is_noload): New method.
3228 (Output_section::set_is_noload): Ditto.
3229 (Output_section::is_noload_): New data member.
3230 * script-c.h (Script_section_type): New enum type.
3231 (struct Parser_output_section_header): Add new file section_type.
3232 * script-sections.cc (Sections_element::output_section_name): Add
3233 parameter for returning script section type.
3234 (Output_section_definition::output_section_name): Ditto.
3235 (Output_section_definition::section_type)P; New method.
3236 (Output_section_definiton::script_section_type_name): Ditto.
3237 (Output_section_definition::script_section_type_): New data member.
3238 (Output_section_definition::Output_section_definition): Initialize
3239 data member Output_section_definition::script_section_type_.
3240 (Output_section_definition::create_sections): Pass script section type
3241 to Layout::make_output_section_for_script.
3242 (Output_section_definition::output_section_name): Return script
3243 section type to caller.
3244 (Output_section_definition::set_section_address): Do not advance
3245 dot value and load address if section type is NOLOAD. Set address
3246 of NOLOAD sections regardless of section flags.
3247 (Output_section_definition::print): Print section type if it is
3248 not SCRIPT_SECTION_TYPE_NONE.
3249 (Output_section_definition::section_type): New method.
3250 (Output_section_definition::script_section_type_name): Ditto.
3251 (Script_sections::output_section_name): Add new parameter
3252 PSECTION_TYPE for returning script section type. Pass it to
3253 section elements. Handle discard sections.
3254 (Sort_output_sections::operator()): Handle NOLOAD sections.
3255 * script-sections.h (Script_sections::Section_type): New enum type.
3256 (Script_sections::output_section_name): Add a new parameter for
3257 returning script section type.
3258 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3259 INFO and NOLOAD.
3260 * yyscript.y (union): Add new field SECTION_TYPE.
3261 (COPY, DSECT, INFO, NOLOAD): New tokens.
3262 (opt_address_and_section_type): Change type to output_section_header.
3263 (section_type): New non-terminal
3264 (section_header): Handle section type.
3265 (opt_address_and_section_type): Return section type value.
3266
3267 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3268
3269 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3270 * testsuite/plugin_common_test_2.c (foo): Likewise.
3271
3272 2010-04-08 Doug Kwan <dougkwan@google.com>
3273
3274 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3275 Output_merge_data.
3276 * output.cc (Output_section::add_merge_input_section): Simplify
3277 code and return status of Output_merge_base::add_input_section.
3278 Update merge section map only if Output_merge_base::add_input_section
3279 returns true.
3280
3281 2010-04-07 Doug Kwan <dougkwan@google.com>
3282
3283 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3284 if section is marked as containing instructions but has no mapping
3285 symbols.
3286 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3287 correct section index.
3288 (Arm_relobj::find_linked_text_section): Ditto.
3289
3290 2010-04-07 Cary Coutant <ccoutant@google.com>
3291
3292 * archive.cc (include_member): Destroy Read_symbols_data object before
3293 releasing file.
3294 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3295 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3296 (Read_symbols_data::~Read_symbols_data) New destructor.
3297 (Section_relocs::Section_relocs) New constructor.
3298 (Section_relocs::~Section_relocs) New destructor.
3299 (Read_relocs_data::Read_relocs_data) New constructor.
3300 (Read_relocs_data::~Read_relocs_data) New destructor.
3301 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3302 pointers to NULL after deleting.
3303
3304 2010-04-07 Doug Kwan <dougkwan@google.com>
3305
3306 * arm.cc: Replace "endianity" with "endianness" in comments.
3307 (Arm_exidx_cantunwind): Ditto.
3308 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3309 (Arm_relobj::merge_flags_and_attributes): New method.
3310 (Arm_relobj::merge_flags_and_attributes_): New data member.
3311 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3312 (Arm_relobj::scan_sections_for_stubs): Ditto.
3313 (Arm_relobj::do_read_symbols): Check to see if we really want to
3314 merge processor-specific flags and attributes. Exit early if
3315 an object is empty except for section names and the undefined symbol.
3316 (Target_arm::do_finalize_sections): Move check for ELF format to
3317 Arm_relobj::do_read_symbols. Merge processor specific flags and
3318 attributes from a regular object only when we have determined that
3319 it is aapropriate. Do not create an .ARM.attributes section in
3320 output if there is no regular input object.
3321 (Target_arm::merge_processor_specific_flags): Check
3322 --warn-mismatch before printing any error.
3323 (Target_arm::merge_object_attributes): Ditto.
3324 * gold.cc (queue_middle_tasks): Handle the case in which there is
3325 no regular object in input.
3326 * options.cc (General_options::parse_EB): New method.
3327 (General_options::parse_EL): Same.
3328 (General_options::General_options): Initialize endianness_.
3329 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3330 New options.
3331 (General_options::Endianness): New enum.
3332 (General_options::endianness): New method.
3333 (General_options::endianness_): New data member.
3334 * parameters.cc (Parameters::set_options): Check target endianness.
3335 (Parameters::set_target_once): Ditto.
3336 (Parameters::check_target_endianness): New method.
3337 (parameters_force_valid_target): If either -EL or -EB is specified,
3338 use it to define endianness of default target.
3339 * parameters.h (Parameters::check_target_endianness): New method
3340 declaration.
3341 * target.h (class Target): Change "endianity" to "endianness"
3342 in comments.
3343
3344 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3345
3346 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3347 * configure: Regenerate.
3348 * Makefile.in: Regenerate.
3349 * testsuite/Makefile.in: Regenerate.
3350
3351 2010-04-06 Cary Coutant <ccoutant@google.com>
3352
3353 gcc PR lto/42757
3354 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3355 prevailing definitions of common symbols.
3356 * testsuite/plugin_test_6.sh: New test case.
3357 * testsuite/plugin_common_test_1.c: New test case.
3358 * testsuite/plugin_common_test_2.c: New test case.
3359 * testsuite/Makefile.am (plugin_test_6): New test case.
3360 * testsuite/Makefile.in: Regenerate.
3361
3362 2010-04-06 Nick Clifton <nickc@redhat.com>
3363
3364 * po/vi.po: New Vietnamese translation.
3365
3366 2010-03-30 Doug Kwan <dougkwan@google.com>
3367
3368 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3369
3370 2010-03-25 Doug Kwan <dougkwan@google.com>
3371
3372 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3373 to avoid a conversion warning on a 32-bit host.
3374
3375 2010-03-24 Ian Lance Taylor <iant@google.com>
3376
3377 * testsuite/script_test_3.t: Add a TLS segment.
3378 * testsuite/Makefile.am (check_PROGRAMS): Add
3379 tls_phdrs_script_test.
3380 (tls_phdrs_script_test_SOURCES): Define.
3381 (tls_phdrs_script_test_DEPENDENCIES): Define.
3382 (tls_phdrs_script_test_LDFLAGS): Define.
3383 (tls_phdrs_script_test_LDADD): Define.
3384 * testsuite/Makefile.in: Rebuild.
3385
3386 2010-03-23 Cary Coutant <ccoutant@google.com>
3387
3388 * fileread.cc (find_or_make_view): Fix comment.
3389
3390 2010-03-23 Ian Lance Taylor <iant@google.com>
3391
3392 * script-sections.cc (class Orphan_section_placement): Define
3393 PLACE_TLS and PLACE_TLS_BSS.
3394 (Orphan_section_placement::Orphan_section_placement): Initialize
3395 new places.
3396 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3397 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3398 (tls_script_test_SOURCES): Define.
3399 (tls_script_test_DEPENDENCIES): Define.
3400 (tls_script_test_LDFLAGS): Define.
3401 (tls_script_test_LDADD): Define.
3402 * testsuite/Makefile.in: Rebuild.
3403
3404 2010-03-22 Doug Kwan <dougkwan@google.com>
3405
3406 * arm.cc (Arm_relocate_functions::abs8,
3407 Arm_relocate_functions::abs16): Use correct check for overflow
3408 specified in the ARM ELF specs.
3409 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3410 target of a BLX instruction specially.
3411 (Reloc_stub::stub_type_for_reloc): Ditto.
3412 (Relocate::relocate): Use symbolic names instead of numeric relocation
3413 codes to report error.
3414 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3415 workaround.
3416 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3417 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3418 thumb2_blx_out_of_range.stdout
3419 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3420 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3421 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3422 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3423 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3424 thumb2_blx_in_range, thumb2_blx_in_range.o,
3425 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3426 thumb2_blx_out_of_range.o): New rules.
3427 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3428 thumb2_blx_in_range and thumb2_blx_out_of_range.
3429 * testsuite/Makefile.in: Regenerate.
3430 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3431 * testsuite/thumb_blx_in_range.s: New file.
3432 * testsuite/thumb_blx_out_of_range.s: New file.
3433
3434 2010-03-22 Rafael Espindola <espindola@google.com>
3435
3436 * archive.cc (Should_include): Move to archive.h.
3437 (should_include_member): Make it a member of Archive.
3438 (Lib_group): New.
3439 (Add_lib_group_symbols): New.
3440 * archive.h: Include options.h.
3441 (Archive_member): Moved from Archive.
3442 (Should_include): Moved from archive.cc.
3443 (Lib_group): New.
3444 (Add_lib_group_symbols): New.
3445 * dynobj.cc (do_should_include_member): New.
3446 * dynobj.h (do_should_include_member): New.
3447 * gold.cc (queue_initial_tasks): Update call to queue.
3448 * main.cc (main): Print lib group stats.
3449 * object.cc (do_should_include_member): New.
3450 * object.h: Include archive.h.
3451 (Object::should_include_member): New.
3452 (Object::do_should_include_member): New.
3453 (Sized_relobj::do_should_include_member): New.
3454 * options.cc (General_options::parse_start_lib): New.
3455 (General_options::parse_end_lib): New.
3456 (Input_arguments::add_file): Handle lib groups.
3457 (Input_arguments::start_group): Check we are not in a lib.
3458 (Input_arguments::start_lib): New.
3459 (Input_arguments::end_lib): New.
3460 * options.h (General_options): Add start_lib and end_lib.
3461 (Input_argument::lib_): New.
3462 (Input_argument::lib): New.
3463 (Input_argument::is_lib): New.
3464 (Input_file_lib): New.
3465 (Input_arguments::in_lib_): New.
3466 (Input_arguments::in_lib): New.
3467 (Input_arguments::start_lib): New.
3468 (Input_arguments::end_lib_): New.
3469 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3470 in unused members as preempted.
3471 (Sized_pluginobj::do_should_include_member): New.
3472 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3473 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3474 return the blocker.
3475 (Read_symbols::do_whole_lib_group): New.
3476 (Read_symbols::do_lib_group): New.
3477 (Read_symbols::do_read_symbols): Handle lib groups.
3478 (Read_symbols::get_name): Handle lib groups.
3479 * readsyms.h (Read_symbols): Add an archive member pointer.
3480 (Read_symbols::do_whole_lib_group): New.
3481 (Read_symbols::do_lib_group): New.
3482 (Read_symbols::member_): New.
3483 * script.cc (read_input_script): Update call to queue_soon.
3484
3485 2010-03-19 Doug Kwan <dougkwan@google.com>
3486
3487 * arm.cc (Stub_table::Stub_table): Initialize new data members
3488 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3489 (Stub_table::add_reloc_stub): Assign stub offset and update
3490 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3491 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3492 New data members.
3493 (Stub_table::update_data_size_and_addralign): Use
3494 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3495 instead of going over all reloc stubs.
3496 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3497 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3498 Stringpool_template::offset_ to size of Stringpool_char.
3499 (Stringpool_template::new_key_offset): Remove code to initialize
3500 Stringpool_template::offset_.
3501 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3502 Stringpool_template::offset_ to zero.
3503
3504 2010-03-15 Doug Kwan <dougkwan@google.com>
3505
3506 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3507 offset_.
3508 (Stringpool_template::new_key_offset): New method.
3509 (Stringpool_template::add_string): Assign offsets when adding new
3510 strings.
3511 (Stringpool_template::set_string_offsets): Do not set string offsets
3512 when not optimizing.
3513 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3514 member size_.
3515 (Chunked_vector::clear): Clear size_.
3516 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3517 (Chunked_vector::size): Return size_.
3518 (Chunked_vector::push_back): Use size_ to find insert position.
3519 (Chunked_vector::size_): New data member.
3520 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3521 (Stringpool_template::new_key_offset): New method declaration.
3522 (Stringpool_template::offset_): New data member.
3523
3524 2010-03-15 Rafael Espindola <espindola@google.com>
3525
3526 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3527 Add_symbols' constructor.
3528 * readsyms.h (Add_symbols): Remove the input_group member.
3529
3530 2010-03-10 Ian Lance Taylor <iant@google.com>
3531
3532 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3533 target to ask whether a reference to a symbol requires a stack
3534 split.
3535 * target.h (Target::is_call_to_non_split): New function.
3536 (Target::do_is_call_to_non_split): Declare virtual function.
3537 * target.cc: Include "symtab.h".
3538 (Target::do_is_call_to_non_split): New function.
3539 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3540
3541 2010-03-10 Cary Coutant <ccoutant@google.com>
3542
3543 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3544 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3545 (File_read::open[2]): Add whole_file_view_ to list of views.
3546 (File_read::make_view): Remove test of whole_file_view_.
3547 (File_read::find_or_make_view): Create whole_file_view_ if
3548 necessary.
3549 (File_read::clear_views): Replace bool parameter with enum;
3550 adjust all callers. Don't delete views with permanent data;
3551 do delete cached views and views from archives if
3552 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3553 if clearing the corresponding view.
3554 * fileread.h (File_read::Clear_views_mode): New enum.
3555 (File_read::View::is_permanent_view): New method.
3556 (File_read::clear_views): Replace bool parameter
3557 with enum; adjust all callers.
3558 * options.h (General_options): Change keep_files_mapped option;
3559 add map_whole_files.
3560 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3561 releasing the file.
3562 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3563 the file.
3564
3565 2010-03-10 David S. Miller <davem@davemloft.net>
3566
3567 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3568
3569 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3570
3571 * icf.cc (get_section_contents): Add '@' marker after processing the
3572 merge reloc.
3573
3574 2010-03-08 Doug Kwan <dougkwan@google.com>
3575
3576 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3577 due to a conversion warning.
3578 (Arm_relobj::update_output_local_symbol_count): Check for local
3579 symbol with unset output index.
3580
3581 2010-03-05 Ian Lance Taylor <iant@google.com>
3582
3583 * options.h (class General_options): Add --spare-dynamic-tags.
3584 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3585 --spare-dynamic-tags.
3586
3587 2010-03-05 Ian Lance Taylor <iant@google.com>
3588
3589 * incremental.cc: Include "libiberty.h".
3590
3591 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3592
3593 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3594 function, is_info_ member.
3595 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3596 (Versions::Versions): Update caller.
3597 (Versions::define_base_version): Likewise.
3598 (Versions::add_def): Likewise.
3599
3600 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3601
3602 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3603 (Scan::possible_function_pointer_reloc): New function.
3604 (Scan::local_reloc_may_be_function_pointer): Change to call
3605 possible_function_pointer_reloc.
3606 (Scan::global_reloc_may_be_function_pointer): Ditto.
3607 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3608 relocations in ".data.rel.ro._ZTV" section.
3609 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3610 * testsuite/icf_safe_so_test.cc: Ditto.
3611 * testsuite/icf_safe_test.cc: Ditto.
3612 * testsuite/icf_safe_test.sh: Ditto.
3613
3614 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3615 Ian Lance Taylor <iant@google.com>
3616
3617 * target-reloc.h (relocate_section): Check the symbol table index
3618 for -1U before setting the local symbol index.
3619 (scan_relocatable_relocs): If copying the relocation, record that
3620 the local symbol is required.
3621 * object.h (Symbol_value::is_output_symtab_index_set): New
3622 function.
3623 (Symbol_value::may_be_discarded_from_output_symtab): New
3624 function.
3625 (Symbol_value::has_output_symtab_entry): New function.
3626 (Symbol_value::needs_output_symtab_entry): Remove.
3627 (Symbol_value::output_symtab_index): Make sure the symbol index is
3628 set.
3629 (Symbol_value::set_output_symtab_index): Make sure the symbol
3630 index is not set. Make sure the new index is valid.
3631 (Symbol_value::set_must_have_output_symtab_entry): New function.
3632 (Symbol_value::has_output_dynsym_entry): New function.
3633 (Symbol_value::set_output_dynsym_index): Make sure the new index
3634 is valid.
3635 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3636 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3637 local symbol if permitted.
3638 (Sized_relobj::do_finalize_local_symbols): Call
3639 is_output_symtab_index_set rather than needs_output_symtab_entry.
3640 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3641 rather than needs_output_symtab_entry. Call
3642 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3643 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3644 is_output_symtab_index_set rather than needs_output_symtab_entry.
3645 * testsuite/discard_locals_relocatable_test.c: New file.
3646 * testsuite/discard_locals_test.sh: Test -r.
3647 * testsuite/Makefile.am (check_DATA): Add
3648 discard_locals_relocatable_test1.syms,
3649 discard_local_relocatable_test2.syms.
3650 (MOSTLYCLEANFILES): Likewise. Also add
3651 discard_locals_relocatable_test1.lout and
3652 discard_locals_relocatable_test2.out.
3653 (discard_locals_relocatable_test1.syms): New target.
3654 (discard_locals_relocatable_test.o): New target.
3655 (discard_locals_relocatable_test1.out): New target.
3656 (discard_locals_relocatable_test2.syms): New target.
3657 (discard_locals_relocatable_test2.out): New target.
3658 (various): Add missing ../ld-new dependencies.
3659 * testsuite/Makefile.in: Rebuild.
3660
3661 2010-03-03 Nick Clifton <nickc@redhat.com>
3662
3663 * po/fi.po: New Finnish translation.
3664
3665 2010-03-01 Doug Kwan <dougkwan@google.com>
3666
3667 * layout.cc (Layout::Layout): Force section types of .init_array*,
3668 .preinit_array* and .fini_array* sections.
3669 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3670 Fix check of return value of std::string::find.().
3671 (Output_section::Input_section_sort_compare::operator()): Remove
3672 comment about .init_array.
3673 (Output_section::Input_section_sort_init_fini_compare::operator()):
3674 New method.
3675 (Output_section::sort_attached_input_sections): Handle .init_array
3676 and .fini_array specially.
3677 * output.h (Output_section::Inut_section_sort_compare): Update
3678 comment.
3679 (Output_section::Input_section_sort_init_fini_compare): New struct.
3680
3681 2010-02-26 Doug Kwan <dougkwan@google.com>
3682
3683 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3684 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3685 * testsuite/debug_msg.sh: Avoid matching source line number for
3686 use of global variable undef_int.
3687
3688 2010-02-26 Doug Kwan <dougkwan@google.com>
3689
3690 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3691 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3692 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3693 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3694 * options.cc (General_options::General_options): Initialize member
3695 fix_v4bx_.
3696 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3697 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3698 and rm_no_fix_v4bx.stdout
3699 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3700 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3701 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3702 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3703 and arm_no_fix_v4bx.
3704 * Makefile.in: Regenerate.
3705 * testsuite/arm_fix_v4bx.s: New file.
3706 * testsuite/arm_fix_v4bx.sh: Ditto.
3707
3708 2010-02-24 Doug Kwan <dougkwan@google.com>
3709
3710 * arm.cc (Target_arm::got_section): Make the .got section the first
3711 non RELRO section in the data segment.
3712 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3713 suffixes of section names.
3714
3715 2010-02-24 Doug Kwan <dougkwan@google.com>
3716
3717 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3718 flags and attributes merging if an input file is a binary file.
3719 * fileread.cc (Input_file::open): Record format of original file.
3720 * fileread.h (Input_file::Format): New enum type.
3721 (Input_file::Input_file): Initialize data member format_.
3722 (Input_file::format): New method definition.
3723 (Input_file::format_):: New data member.
3724
3725 2010-02-24 Doug Kwan <dougkwan@google.com>
3726
3727 * arm.cc (Arm_output_data_got): New class.
3728 (ARM_TCB_SIZE): New constant
3729 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3730 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3731 If user uses a script with a SECTIONS clause, issue only a warning
3732 for a misplaced EXIDX input section. Otherwise, issue an error.
3733 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3734 garbage collection.
3735 (Target_arm::got_mode_index_entry): Handle static linking.
3736 (Target_arm::Scan::local): Ditto.
3737 (Target_arm::Scan::global): Ditto.
3738 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3739 all incorrectly implemented relocations.
3740 (Target_arm::fix_exidx_coverage): Pass layout to
3741 Arm_output_section::fix_exidx_coverage.
3742 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3743 from ".ARM.exidx." and ".ARM.extab.".
3744
3745 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3746
3747 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3748 section if it does not already exist.
3749 * attributes.cc (Attributes_section_data::Attributes_section_data):
3750 Don't crash if size is zero.
3751
3752 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3753 Ian Lance Taylor <iant@google.com>
3754
3755 * gold.cc (queue_middle_tasks): If no input files were opened,
3756 exit.
3757 * workqueue.h (Task_function::Task_function): Assert that there is
3758 a blocker.
3759
3760 2010-02-22 Doug Kwan <dougkwan@google.com>
3761
3762 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3763 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3764 types to avoid warnings due to different uint64_t implementations
3765 on different hosts.
3766
3767 2010-02-21 Doug Kwan <dougkwan@google.com>
3768
3769 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3770 handling of the maximum backward branch offset.
3771 (Arm_relocate_functions::thumb_branch_common): Ditto.
3772 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3773 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3774 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3775 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3776 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3777 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3778 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3779 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3780 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3781 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3782 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3783 thumb2_bl_out_of_range.o): New rules.
3784 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3785 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3786 thumb2_bl_out_of_range
3787 * testsuite/Makefile.in: Regenerate.
3788 * testsuite/arm_bl_in_range.s: New file.
3789 * testsuite/arm_bl_out_of_range.s: Ditto.
3790 * testsuite/arm_branch_in_range.sh: Ditto.
3791 * testsuite/arm_branch_range.t: Ditto.
3792 * testsuite/thumb2_branch_range.t: Ditto.
3793 * testsuite/thumb_bl_in_range.s: Ditto.
3794 * testsuite/thumb_bl_out_of_range.s: Ditto.
3795 * testsuite/thumb_branch_range.t: Ditto.
3796
3797 2010-02-20 Sriraman Tallam <tmsriram@google.com>
3798
3799 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3800 Add reloc offset information.
3801 * icf.cc (get_section_contents): Change iterators to point to the new
3802 vectors. Add reloc offset information to the contents.
3803 * icf.h (Icf::Sections_reachable_info): New typedef.
3804 (Icf::Sections_reachable_list): New typedef.
3805 (Icf::Offset_info): New typedef.
3806 (Icf::Reloc_info): New struct typedef.
3807 (Icf::Reloc_info_list): New typedef.
3808 (Icf::symbol_reloc_list): Delete method.
3809 (Icf::addend_reloc_list): Delete method.
3810 (Icf::section_reloc_list): Delete method.
3811 (Icf::reloc_info_list): New method.
3812 (Icf::reloc_info_list_): New member.
3813
3814 2010-02-19 Doug Kwan <dougkwan@google.com>
3815
3816 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3817 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3818 * arm.cc (Arm_relocation_functions): New forward declaration.
3819 (Target_arm::Target_arm): Initialize new data members
3820 got_mod_index_offset_ and tls_base_symbol_defined_.
3821 (Target_arm::Relocate::relocate_tls): New method.
3822 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3823 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3824 New methods.
3825 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3826 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3827 (Target_arm::got_mod_index_offset_,
3828 Target_arm::tls_base_symbol_defined_): New data members.
3829 (Target_arm::Scan::local, Target::Scan::global,
3830 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3831 relocations.
3832
3833 2010-02-18 Doug Kwan <dougkwan@google.com>
3834
3835 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3836 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3837 text section as a parameter becuase some broken tools may not set
3838 the link in section header.
3839 (Target_arm::has_got_section): New method.
3840 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3841 without any mapping symbol as data only. Remove warning.
3842 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3843 link in its section header, try to discover the link by inspecting the
3844 REL31 relocation at the beginning of the section.
3845 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3846 in error message.
3847 (Target_arm::Scan::global): Treat any reference to the symbol
3848 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3849
3850 2010-02-12 Sriraman Tallam <tmsriram@google.com>
3851
3852 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3853 (Scan::global_reloc_may_be_function_pointer): New function.
3854 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3855 (Scan::global_reloc_may_be_function_pointer): New function.
3856 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3857 (Scan::global_reloc_may_be_function_pointer): New function.
3858 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3859 (Scan::global_reloc_may_be_function_pointer): New function.
3860 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3861 (Scan::global_reloc_may_be_function_pointer): New function.
3862 (Scan::possible_function_pointer_reloc): New function.
3863 (Target_x86_64::can_check_for_function_pointers): New function.
3864 * gc.h (gc_process_relocs): Scan relocation types to determine if
3865 function pointers were taken for targets that support it.
3866 * icf.cc (Icf::find_identical_sections): Include functions for
3867 folding in safe ICF whose pointer is not taken.
3868 * icf.h (Secn_fptr_taken_set): New typedef.
3869 (fptr_section_id_): New member.
3870 (section_has_function_pointers): New function.
3871 (set_section_has_function_pointers): New function.
3872 (check_section_for_function_pointers): New function.
3873 * options.h: Fix comment for safe ICF option.
3874 * target.h (can_check_for_function_pointers): New function.
3875 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3876 Modify icf_safe_test for X86-64.
3877 * testsuite/Makefile.in: Regenerate.
3878 * testsuite/icf_safe_so_test.cc: New file.
3879 * testsuite/icf_safe_so_test.sh: New file.
3880 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3881 (main): Change to take pointer to function kept_func_3.
3882 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3883 folding is done correctly for X86-64.
3884
3885 2010-02-12 David S. Miller <davem@davemloft.net>
3886
3887 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3888 is_symbolless parameter.
3889 (Output_reloc<SHT_REL>::is_symbolless): New.
3890 (Output_reloc<SHT_REL>::is_symbolless_): New.
3891 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3892 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3893 (Output_reloc<SHT_RELA>::is_symbolless): New.
3894 (Output_data_reloc::add_global): Handle is_symbolless.
3895 (Output_data_reloc::add_global_relative): Likewise.
3896 (Output_data_reloc::add_local): Likewise.
3897 (Output_data_reloc::add_local_relative): Likewise.
3898 (Output_data_reloc::add_symbolless_global_addend): New.
3899 (Output_data_reloc::add_symbolless_local_addend): New.
3900 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3901 is_symbolless.
3902 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3903 instead of ->is_relative_
3904 (Output_reloc::write): Likewise.
3905 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3906 (Output_reloc::write_rel): Simplify.
3907
3908 * sparc.cc (Target_sparc::Scan::local): Use
3909 ->add_symbolless_local_addend as needed.
3910 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3911 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3912 based upon relocation offset.
3913
3914 2010-02-11 Doug Kwan <dougkwan@google.com>
3915
3916 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3917 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3918 beginning of function.
3919 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3920 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3921 parameter is_32bit in calls to should_apply_static_reloc.
3922 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3923 (check_DATA): Add arm_abs_global.stdout.
3924 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3925 arm_abs_global.stdout): New rules.
3926 (MOSTLLYCLEANFILES): Add arm_abs_global
3927 * Makefile.in: Regenerate.
3928 * testsuite/arm_abs_global.s: New file.
3929 * testsuite/arm_abs_global.sh: Ditto.
3930 * testsuite/arm_abs_lib.s: Ditto.
3931
3932 2010-02-11 Ian Lance Taylor <iant@google.com>
3933
3934 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3935 Read_relocs task.
3936 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3937 Allocate_commons_task first.
3938 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3939 task, rather than symtab_lock_.
3940 (Gc_process_relocs::~Gc_process_relocs): New function.
3941 (Gc_process_relocs::is_runnable): Check this_blocker_.
3942 (Gc_process_relocs::locks): Use next_blocker_ rather than
3943 blocker_.
3944 (Scan_relocs::~Scan_relocs): New function.
3945 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3946 symtab_lock_.
3947 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3948 next_blocker_.
3949 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3950 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3951 constructor accordingly.
3952 (class Gc_process_relocs): Likewise.
3953 (class Scan_relocs): Likewise.
3954 * common.h (class Allocate_commons_task): Remove symtab_lock_
3955 field, and corresponding constructor parameter.
3956 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3957 symtab_lock_.
3958 (Allocate_commons_task::locks): Likewise.
3959
3960 2010-02-11 Ian Lance Taylor <iant@google.com>
3961
3962 * gold-threads.h (class Once): Define.
3963 (class Initialize_lock): Rewrite as child of Once.
3964 * gold-threads.cc (class Once_initialize): Define.
3965 (once_pointer_control): New static variable.
3966 (once_pointer, once_arg): New static variables.
3967 (c_run_once): New static function.
3968 (Once::Once, Once::run_once, Once::internal_run): New functions.
3969 (class Initialize_lock_once): Remove.
3970 (initialize_lock_control): Remove.
3971 (initialize_lock_pointer): Remove.
3972 (initialize_lock_once): Remove.
3973 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3974 (Initialize_lock::initialize): Rewrite.
3975 (Initialize_lock::do_run_once): New function.
3976 * archive.cc (Archive::interpret_header): Only clear name if it is
3977 not already empty.
3978 * fileread.cc: Include "gold-threads.h"
3979 (file_counts_lock): New static variable.
3980 (file_counts_initialize_lock): Likewise.
3981 (File_read::release): Only increment counts when using --stats.
3982 Use a lock around the increment.
3983 * parameters.cc (class Set_parameters_target_once): Define.
3984 (set_parameters_target_once): New static variable.
3985 (Parameters::Parameters): Move here from parameters.h.
3986 (Parameters::set_target): Rewrite.
3987 (Parameters::set_target_once): New function.
3988 (Parameters::clear_target): Move here and rewrite.
3989 * parameters.h (class Parameters): Update declarations. Add
3990 set_parameters_target_once_ field.
3991 (Parameters::Parameters): Move to parameters.cc.
3992 (Parameters::clear_target): Likewise.
3993 * readsyms.cc (Read_symbols::do_group): Create a Start_group
3994 task.
3995 (Start_group::~Start_group): New function.
3996 (Start_group::is_runnable): New function.
3997 (Start_group::locks, Start_group::run): New functions.
3998 (Finish_group::run): Change saw_undefined to size_t.
3999 * readsyms.h (class Start_group): Define.
4000 (class Finish_group): Change saw_undefined_ field to size_t.
4001 (Finish_group::Finish_group): Remove saw_undefined and
4002 this_blocker parameters. Change all callers.
4003 (Finish_group::set_saw_undefined): New function.
4004 (Finish_group::set_blocker): New function.
4005 * symtab.h (class Symbol_table): Change saw_undefined to return
4006 size_t. Change saw_undefined_ field to size_t.
4007 * target-select.cc (Set_target_once::do_run_once): New function.
4008 (Target_selector::Target_selector): Initialize set_target_once_
4009 field. Don't initialize lock_ and initialize_lock_ fields.
4010 (Target_selector::instantiate_target): Rewrite.
4011 (Target_selector::set_target): New function.
4012 * target-select.h (class Set_target_once): Define.
4013 (class Target_selector): Update declarations. Make
4014 Set_target_once a friend. Remove lock_ and initialize_lock_
4015 fields. Add set_target_once_ field.
4016
4017 2010-02-10 Ian Lance Taylor <iant@google.com>
4018
4019 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4020 queueing any tasks.
4021 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4022 (queue_middle_tasks): Add all blockers before queueing any tasks.
4023 (queue_final_tasks): Likewise.
4024 * token.h (Task_token::add_blockers): New function.
4025 * object.h (Input_objects::number_of_relobjs): New function.
4026
4027 2010-02-10 Ian Lance Taylor <iant@google.com>
4028
4029 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4030 shared, not if not position independent.
4031 * x86_64.cc (Relocate::relocate_tls): Likewise.
4032 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4033 (tls_pie_pic_test): New target.
4034 * testsuite/Makefile.in: Rebuild.
4035
4036 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4037 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4038 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4039 * testsuite/Makefile.in: Rebuild.
4040
4041 2010-02-09 David S. Miller <davem@davemloft.net>
4042
4043 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4044 R_SPARC_RELATIVE using ->add_local_relative().
4045 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4046
4047 * output.h (Output_data_dynamic::add_section_size): New method
4048 that takes two Output_data objects.
4049 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4050 entry param. Handle it in initializers.
4051 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4052 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4053 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4054 arg.
4055 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4056 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4057 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4058 for dynrel_includes_plt.
4059 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4060 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4061 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4062 before .rela.plt
4063 (Target_sparc::do_finalize_sections): Update to pass true for
4064 dynrel_includes_plt.
4065 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4066 output before .rela.plt
4067 (Target_powerpc::do_finalize_sections): Update to pass true for
4068 dynrel_includes_plt when 32-bit.
4069
4070 2010-02-08 Doug Kwan <dougkwan@google.com>
4071
4072 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4073 method.
4074 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4075 Arm_relobj::scan_section_for_cortex_a8_stubs,
4076 Arm_relobj::do_relocation_section): Instead of calling
4077 Output_section::output_address, use faster
4078 Arm_relobj::simple_input_section_output_address.
4079
4080 2010-02-08 David S. Miller <davem@davemloft.net>
4081
4082 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4083 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4084 relocation helper function.
4085
4086 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4087 just like R_SPARC_GOT{10,13,22}.
4088 (Target_sparc::Scan::local): Likewise.
4089 (Target_sparc::Relocate:relocate): Likewise.
4090
4091 2010-02-06 Ian Lance Taylor <iant@google.com>
4092
4093 * configure.ac: Rewrite targetobjs duplicate removal code to use
4094 only shell constructs.
4095 * configure: Rebuild.
4096
4097 2010-02-05 Doug Kwan <dougkwan@google.com>
4098
4099 PR 11247
4100 * arm.cc (Arm_relobj::section_is_scannable): New method.
4101 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4102 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4103
4104 2010-02-04 Doug Kwan <dougkwan@google.com>
4105
4106 PR 11247
4107 * arm-reloc-property.cc (cstdio): Include.
4108 * configure.ac (targetobjs): Remove duplicates.
4109 * configure: Regenerate.
4110 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4111 big and little endian version for a given address size.
4112
4113 2010-02-03 Doug Kwan <dougkwan@google.com>
4114
4115 * arm-reloc-property.cc
4116 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4117 definition.
4118 * arm-reloc-property.h
4119 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4120 New method definition.
4121 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4122 declaration.
4123 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4124 overflow to N.
4125 (GOT_PREL): Change implemented to Y.
4126 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4127 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4128 (Arm_relocate_functions::movw_abs_nc): Remove method.
4129 (Arm_relocate_functions::movt_abs): Ditto.
4130 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4131 (Arm_relocate_functions::thm_movt_abs): Ditto.
4132 (Arm_relocate_functions::movw_rel_nc): Ditto.
4133 (Arm_relocate_functions::movw_rel): Ditto.
4134 (Arm_relocate_functions::movt_rel): Ditto.
4135 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4136 (Arm_relocate_functions:thm_movw_rel): Ditto.
4137 (Arm_relocate_functions:thm_movt_rel): Ditto.
4138 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4139 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4140 New method definitions.
4141 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4142 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4143 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4144 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4145 (Target_arm::Relocate::relocate): Check for non-static or
4146 unimplemented relocation code and exit early. Change calls to
4147 Target_arm::reloc_uses_thumb_bit and
4148 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4149 instead. Refactor code to handle similar relocations to increase
4150 code sharing. Remove check for unsupported relocation code in switch
4151 statement.
4152 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4153 relocation property table to find out size. Change error message to
4154 print out the name of a relocation code instead of the numeric value.
4155 (Target_arm::scan_reloc_for_stub): Use relocation property table
4156 instead of calling Target_arm::reloc_uses_thumb_bit().
4157
4158 2010-02-02 Doug Kwan <dougkwan@google.com>
4159
4160 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4161 types of relaxed input section.
4162
4163 2010-02-02 Doug Kwan <dougkwan@google.com>
4164
4165 * Makefile.am (HFILES): Add arm-reloc-property.h.
4166 (DEFFILES): New.
4167 (TARGETSOURCES): Add arm-reloc-property.cc
4168 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4169 (libgold_a_SOURCES): $(DEFFILES)
4170 * Makefile.in: Regenerate.
4171 * arm-reloc-property.cc: New file.
4172 * arm-reloc-property.h: New file.
4173 * arm-reloc.def: New file.
4174 * arm.cc: Update comments.
4175 (arm-reloc-property.h): New included header.
4176 (arm_reloc_property_table): New global variable.
4177 (Target_arm::do_select_as_default_target): New method definition.
4178 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4179 arm-reloc-property to targ_extra_obj.
4180 * parameters.cc (set_parameters_target): Call
4181 Target::select_as_default_target().
4182 * target.h (Target::select_as_default_target): New method definition.
4183 (Target::do_select_as_default_target): Same.
4184
4185 2010-02-01 Doug Kwan <dougkwan@google.com>
4186
4187 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4188 first_output_text_section_.
4189 (Arm_exidx_fixup::first_output_text_section): New method definition.
4190 (Arm_exidx_fixup::first_output_text_section_): New data member.
4191 (Arm_exidx_fixup::process_exidx_section): Record the first text
4192 output section seen.
4193 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4194 and entsize in output section header.
4195
4196 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4197
4198 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4199 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4200 (Arm_relocate_functions::thm_alu11): New Method.
4201 (Arm_relocate_functions::thm_pc8): New Method.
4202 (Arm_relocate_functions::thm_pc12): New Method.
4203 (Target_arm::Scan::local): Handle the relocations.
4204 (Target_arm::Scan::global): Likewise.
4205 (Target_arm::Relocate::relocate): Likewise.
4206 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4207
4208 2010-01-29 Doug Kwan <dougkwan@google.com>
4209
4210 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4211 of relocation types as ld.
4212
4213 2010-01-29 Doug Kwan <dougkwan@google.com>
4214
4215 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4216 to public.
4217 (Arm_relocate_functions::thumb_branch_common): Ditto.
4218 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4219 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4220 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4221 Arm_relocate_functions::jump24): Remove.
4222 (Target_arm::Relocate::relocate): Adjust code to call
4223 Arm_relocation_functions::arm_branch_common and
4224 Arm_relocation_functions::thumb_branch_common instead of their removed
4225 wrappers. Merge switch-cases together to reduce source code size.
4226
4227 2010-01-29 Doug Kwan <dougkwan@google.com>
4228
4229 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4230 output_local_symbol_count_needs_update_.
4231 (Arm_relobj::output_local_symbol_count_needs_update,
4232 Arm_relobj::set_output_local_symbol_count_needs_update,
4233 Arm_relobj::update_output_local_symbol_count): New methods.
4234 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4235 member.
4236 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4237 of pointed function as in a R_ARM_PREL31 relocation.
4238 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4239 for output local symbol count updating.
4240 (Target_arm::do_relax): Update output local symbol counts in objects
4241 if necessary.
4242 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4243
4244 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4245
4246 * arm.cc: Added support for the ARM relocations:
4247 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4248 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4249 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4250 movw_prel_nc).
4251 (Arm_relocate_functions::movw_rel): New method.
4252 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4253 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4254 thm_movw_prel_nc).
4255 (Arm_relocate_functions::thm_movw_rel): New method.
4256 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4257 thm_movt_prel).
4258 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4259 relocations.
4260 (Target_arm::Scan::global): Likewise.
4261 (Target_arm::Relocate::relocate): Likewise.
4262 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4263 Likewise.
4264
4265 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4266
4267 * arm.cc: Added support for ARM group relocations.
4268 (Target_arm::reloc_needs_sym_origin): New method.
4269 (Arm_relocate_functions::calc_grp_kn): New method.
4270 (Arm_relocate_functions::calc_grp_residual): New method.
4271 (Arm_relocate_functions::calc_grp_gn): New method.
4272 (Arm_relocate_functions::arm_grp_alu): New Method.
4273 (Arm_relocate_functions::arm_grp_ldr): New Method.
4274 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4275 (Arm_relocate_functions::arm_grp_ldc): New Method.
4276 (Target_arm::Scan::local): Handle the ARM group relocations.
4277 (Target_arm::Scan::global): Likewise.
4278 (Target_arm::Relocate::relocate): Likewise.
4279 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4280 Likewise.
4281
4282 2010-01-26 Doug Kwan <dougkwan@google.com>
4283
4284 * arm.cc (set): Include.
4285 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4286 pointer type.
4287 (Arm_output_section::Text_section_list): New type.
4288 (Arm_output_section::append_text_sections_to_list): New method.
4289 (Arm_output_section::fix_exidx_coverage): Ditto.
4290 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4291 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4292 Relobj::set_section_offset() instead of
4293 Sized_relobj::invalidate_section_offset().
4294 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4295 parameter for section headers. Ignore relocation sections for
4296 unallocated sections and EXIDX sections.
4297 (Target_arm::fix_exidx_coverage): New method.
4298 (Target_arm::output_section_address_less_than): New type.
4299 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4300 linked text section instead of the EXIDX section.
4301 (Arm_output_section::create_stub_group): Add an assertion to check
4302 that this is not an EXIDX output section.
4303 (Arm_output_section::append_text_sections_to_list): New method.
4304 (Arm_output_section::fix_exidx_coverage): Ditto.
4305 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4306 Arm_relobj::section_needs_reloc_stub_scanning.
4307 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4308 first pass.
4309 (Target_arm::fix_exidx_coverage): New method.
4310 * object.h (Relobj::set_output_section): New method.
4311 (Sized_relobj::invalidate_section_offset): Remove method.
4312 (Sized_relobj::do_invalidate_section_offset): Remove method.
4313 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4314
4315 2010-01-25 Doug Kwan <dougkwan@google.com>
4316
4317 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4318 Fix warning due to signed and unsigned comparison on a 32-bit host.
4319
4320 2010-01-22 Doug Kwan <dougkwan@google.com>
4321
4322 * arm.cc (Target_arm::do_relax): Record an output section for section
4323 offset adjustment it contains any stub table that has changed.
4324 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4325 offsets in an output section if necessary.
4326 * output.cc (Output_section::Output_section): Initialize
4327 section_offsets_need_adjustments_.
4328 (Output_section::add_input_section_for_script): Renamed to
4329 Output_section::add_simple_input_section.
4330 (Output_section::save_states): Add a comment.
4331 (Output_section::discard_states): New method defintion.
4332 (Output_section::adjust_section_offsets): Same.
4333 * output.h (Output_section::add_input_section_for_script): Renamed to
4334 Output_section::add_simple_input_section.
4335 (Output_section::discard_states): New method declaration.
4336 (Output_section::adjust_section_offsets): Same.
4337 (Output_section::section_offsets_need_adjustment,
4338 Output_section::set_section_offsets_need_adjustment): New method
4339 definitions.
4340 (Output_section::section_offsets_need_adjustment_): New data member.
4341 * script-sections.cc
4342 (Output_section_element_input::set_section_address): Adjust code for
4343 renaming of Output_section::add_input_section_for_script.
4344 (Orphan_output_section::set_section_address): Same.
4345
4346 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4347
4348 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4349 Fix_v4bx enum values .
4350 * gold/options.h (General_options): New option definitions.
4351 (General_options::fix_v4bx): New method.
4352 (General_options::Fix_v4bx): New enum.
4353 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4354 (General_options::parse_fix_v4bx_interworking): New method.
4355
4356 2010-01-22 Doug Kwan <dougkwan@google.com>
4357
4358 * arm.cc (Arm_exidx_fixup): New class.
4359
4360 2010-01-21 Doug Kwan <dougkwan@google.com>
4361
4362 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4363 classes.
4364 (Arm_exidx_section_offset_map): New type.
4365
4366 2010-01-21 Doug Kwan <dougkwan@google.com>
4367
4368 * arm.cc (Arm_exidx_input_section): New class.
4369 (Arm_relobj::exidx_input_section_by_link,
4370 Arm_relobj::exidx_input_section_by_shndx,
4371 Arm_relobj::make_exidx_input_section): New methods.
4372 (read_arm_attributes_section): Remove.
4373 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4374 information about them.
4375 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4376 to here.
4377
4378 2010-01-20 Doug Kwan <dougkwan@google.com>
4379
4380 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4381 Input_section_specifier to Section_id.
4382 (Target_arm::new_arm_input_section: Adjust code for change of key
4383 type.
4384 (Target_arm::find_arm_input_section): Ditto.
4385 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4386 (Section_id): Remove.
4387 (Garbage_collection::Section_id_hash): Remove.
4388 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4389 (Section_id): Remove.
4390 (Icf::Section_id_hash): Remove.
4391 * object.h (Section_id, Const_section_id, Section_id_hash,
4392 Const_section_id_hash): New type definitions.
4393 * output.cc (Output_section::add_relaxed_input_section): Change to
4394 use Const_section_id instead of Input_section_specifier as key type.
4395 (Output_section::add_merge_input_section): Ditto.
4396 (Output_section::build_relaxation_map): Change to use Section_id
4397 instead of Input_section_specifier as key type.
4398 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4399 Ditto.
4400 (Output_section::convert_input_sections_to_relaxed_sections): Change
4401 to use Const_section_id instead of Input_section_specifier as key type.
4402 (Output_section::find_merge_section): Ditto.
4403 (Output_section::find_relaxed_input_section): Ditto.
4404 * output.h (Input_section_specifier): Remove class.
4405 (Output_section::Output_section_data_by_input_section_map): Change
4406 key type to Const_section_id.
4407 (Output_section::Output_relaxed_input_section_by_input_section_map):
4408 Ditto.
4409 (Output_section::Relaxation_map): Change key type to Section_id.
4410
4411 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4412
4413 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4414 (class Arm_v4bx_stub): New class.
4415 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4416 (Stub_factory::make_arm_v4bx_stub): New method.
4417 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4418 (Stub_table::empty): Handle v4bx stubs.
4419 (Stub_table::add_arm_v4bx_stub): New method.
4420 (Stub_table::find_arm_v4bx_stub): New method.
4421 (Arm_relocate_functions::v4bx): New method.
4422 (Target_arm::fix_v4bx): New method.
4423 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4424 (Stub_table::relocate_stubs): Likewise.
4425 (Stub_table::do_write): Likewise.
4426 (Stub_table::update_data_size_and_addralign): Likewise.
4427 (Stub_table::finalize_stubs): Likewise.
4428 (Target_arm::Scan::local): Likewise.
4429 (Target_arm::Scan::global): Likewise.
4430 (Target_arm::do_finalize_sections): Likewise.
4431 (Target_arm::Relocate::relocate): Likewise.
4432 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4433 Likewise.
4434 (Target_arm::scan_reloc_for_stub): Likewise.
4435 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4436
4437 2010-01-19 Ian Lance Taylor <iant@google.com>
4438
4439 * output.cc (Output_section_headers::do_sized_write): Write large
4440 segment count to sh_info field.
4441 (Output_file_header::do_sized_write): For large segment count,
4442 write PN_XNUM to e_phnum field.
4443
4444 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4445
4446 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4447 (Arm_relocate_functions::thm_jump8): New function.
4448 (Arm_relocate_functions::thm_jump11): New function.
4449 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4450 R_ARM_THM_JUMP11.
4451 (Target_arm::Scan::global): Likewise.
4452 (Target_arm::Relocate::relocate): Likewise.
4453 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4454 Likewise.
4455
4456 2010-01-14 Doug Kwan <dougkwan@google.com>
4457
4458 * arm.cc (map, utility): Include headers.
4459 (Target_arm::apply_cortex_a8_workaround): New method.
4460 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4461 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4462 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4463 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4464 the --[no-]fix-cortex-a8 command line options.
4465 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4466 (Target_arm::relocate_stub): Use addend in instruction template.
4467 * options.h (DEFINE_bool): Set the user-set flag.
4468 (General_options): Add --[no-]-fix-cortex options.
4469 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4470 : Update fast look-up map after conversion.
4471
4472 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4473
4474 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4475 in the first pass of do_layout.
4476
4477 2010-01-13 Doug Kwan <dougkwan@google.com>
4478
4479 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4480 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4481 apparent compiler problem of not folding static constant integral
4482 data members of elfcpp::Elf_sizes<32>.
4483
4484 2010-01-13 Doug Kwan <dougkwan@google.com>
4485
4486 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4487 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4488 Arm_relobj::scan_section_for_cortex_a8_erratum,
4489 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4490 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4491 sections to scan for relocation stubs into a new method
4492 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4493 relocation and Cortex-A8 stub scanning.
4494 (Target_arm::do_relax): Force stubs to be after stubbed sections
4495 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4496 the beginning of a new relaxation pass. Update a comment.
4497 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4498
4499 2010-01-12 Ian Lance Taylor <iant@google.com>
4500
4501 * target-reloc.h (visibility_error): New inline function.
4502 (relocate_section): Call visibility_error.
4503 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4504 (MOSTLYCLEANFILES): Likewise.
4505 (protected_4_pic.o, protected_3.err): New targets.
4506 * testsuite/protected_4.cc: New file.
4507
4508 2010-01-12 Doug Kwan <dougkwan@google.com>
4509
4510 * arm.cc (Cortex_a8_reloc): New class.
4511 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4512 and cortex_a8_relocs_info_.
4513 (Target_arm::fix_cortex_a8): New method definition.
4514 (Target_arm::Cortex_a8_relocs_info): New type.
4515 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4516 New data member declarations.
4517 (Target_arm::scan_reloc_for_stub): Record information about
4518 relocations for THUMB branches that might be exempted from the
4519 Cortex-A8 workaround.
4520 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4521 at the beginning of a relaxation pass.
4522
4523 2010-01-12 Doug Kwan <dougkwan@google.com>
4524
4525 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4526 (Arm_relobj::Mapping_symbol_position,
4527 Arm_reloj::Mapping_symbol_position_less,
4528 Arm_relobj::Mapping_symbols_info): New types.
4529 (Target_arm::is_mapping_symbol_name): New method definition.
4530 (Arm_relobj::do_count_local_symbols): Save information about mapping
4531 symbols.
4532
4533 2010-01-11 Doug Kwan <dougkwan@google.com>
4534
4535 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4536 Arm_relocate_functions::thumb32_branch_upper,
4537 Arm_relocate_functions::thumb32_branch_lower,
4538 Arm_relocate_functions::thumb32_cond_branch_offset,
4539 Arm_relocate_functions::thumb32_cond_branch_upper,
4540 Arm_relocate_functions::thumb32_cond_branch_lower,
4541 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4542 branch offset encoding.
4543 (Arm_relocate_functions::thumb_branch_common): Use new branch
4544 offset encoding methods to avoid code duplication.
4545 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4546 (Stub_addend_reader::operator()): Use new branch encoding method
4547 to avoid code duplication.
4548
4549 2010-01-11 Doug Kwan <dougkwan@google.com>
4550
4551 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4552 (Target_arm::do_finalize_sections): Define special EXIDX section
4553 symbols only if referenced.
4554 * gc.h (Garbage_collection::add_reference): New method.
4555 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4556 code duplication.
4557
4558 2010-01-11 Ian Lance Taylor <iant@google.com>
4559
4560 * script.cc (Version_script_info::build_expression_list_lookup):
4561 Change complaing about duplicate wildcard match from error to
4562 warning.
4563
4564 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4565 of 2009-12-30.
4566 (Version_script_info::Version_script_info): Initialize globs_,
4567 default_version_, default_is_global_, and exact_. Don't
4568 initialize globals_ or locals_.
4569 (Version_script_info::build_lookup_tables): Build local symbols
4570 first.
4571 (Version_script_info::unquote): New function.
4572 (Version_script_info::add_exact_match): New function.
4573 (Version_script_info::build_expression_list_lookup): Remove lookup
4574 parameter. Add is_global parameter. Change all callers. Handle
4575 wildcard pattern specially. Unquote pattern. Call
4576 add_exact_match.
4577 (Version_script_info::get_name_to_match): New function.
4578 (Version_script_info::get_symbol_version): New function.
4579 (Version_script_info::get_symbol_version_helper): Remove.
4580 (Version_script_info::check_unmatched_names): Call unquote.
4581 * script.h (class Version_script_info): Change get_symbol_version
4582 to be non-inline and add is_global parameter; change all callers.
4583 Rewrite symbol_is_local. Update declarations. Define struct
4584 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4585 Remove globals_ and locals_ members. Add exact_, globs_,
4586 default_version_, is_global_.
4587 (Version_script_info::Glob): Remove pattern, add expression and
4588 is_global. Update constructor. Change all callers.
4589 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4590 default version.
4591 (Versions::symbol_section_contents): If a symbol is undefined, or
4592 defined in a dynamic object, set the version index to
4593 VER_NDX_LOCAL.
4594 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4595 symbol_is_local.
4596 (Symbol_table::add_from_pluginobj): Likewise.
4597 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4598
4599 2010-01-11 Doug Kwan <dougkwan@google.com>
4600
4601 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4602 (incremental_dump_LDADD): Add linking option for libintl.
4603 * Makefile.in: Regenerate.
4604
4605 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4606
4607 PR gold/11144
4608 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4609 instead of -Ds.
4610 * testsuite/Makefile.in: Regenerated.
4611
4612 2010-01-10 Doug Kwan <dougkwan@google.com>
4613
4614 * options.h (DEFINE_var): Use parentheses around argument varname__
4615 in macro body to avoid any unintended subsequent substitutions.
4616
4617 2010-01-10 Ian Lance Taylor <iant@google.com>
4618
4619 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4620 candidates before doing symbol resolution.
4621
4622 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4623 ODR candidates if only one is weak.
4624
4625 2010-01-08 Ian Lance Taylor <iant@google.com>
4626
4627 * script.cc (Version_script_info::build_expression_list_lookup):
4628 Don't warn about ambiguous version, just record the ambiguity.
4629 (Version_script_info::get_symbol_version_helper): Give error if
4630 version is ambiguous.
4631
4632 2010-01-08 Doug Kwan <dougkwan@google.com>
4633
4634 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4635 prev_data_size_ and prev_addralign_. Remove initializer for
4636 deleted data member has_been_changed_.
4637 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4638 to determine if the table is empty.
4639 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4640 Remove.
4641 (Stub_table::add_reloc_stub): Define method in class definition
4642 instead of just declaring it there.
4643 (Stub_table::add_cortex_a8_stub): New method definition.
4644 (Stub_table::update_data_size_and_addralign): Ditto.
4645 (Stub_table::finalize_stubs): Ditto.
4646 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4647 (Stub_table::do_addralign_): Return address alignment in the
4648 (Stub_table::do_reset_address_and_file_offset): Define method in
4649 class definition instead of declaring it there. Set current data
4650 size to be the data size of the previous pass.
4651 (Stub_table::set_final_data_size): Use current data size as the
4652 final data size.
4653 (Stub_table::relocate_stub): Change parameter type of stub from
4654 Reloc_stub pointer to Stub pointer.
4655 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4656 (Stub_table::Cortex_a8_stub_list): New typedef.
4657 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4658 Stub_table::prev_addralign_): New data member.
4659 (Arm_relobj::Arm_relobj): Initialize data member
4660 section_has_cortex_a8_workaround_.
4661 (Arm_relobj::section_has_cortex_a8_workaround,
4662 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4663 definitions.
4664 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4665 declarations.
4666 (Target_arm::relocate_stub): Change parameter type of stub from
4667 Reloc_stub pointer to Stub pointer.
4668 (Insn_template::size, Insn_template::alignment): Handle
4669 THUMB16_SPECIAL_TYPE.
4670 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4671 Stub_table::update_data_size_and_addralign,
4672 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4673 definitions.
4674 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4675 (Stub_table::do_write): Ditto.
4676 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4677
4678 2010-01-08 Ian Lance Taylor <iant@google.com>
4679
4680 PR 11108
4681 * symtab.h (class Symbol): Remove fields is_target_special_ and
4682 has_plt_offset_. Add field is_defined_in_discarded_section_.
4683 (Symbol::is_defined_in_discarded_section): New function.
4684 (Symbol::set_is_defined_in_discarded_section): New function.
4685 (Symbol::has_plt_offset): Rewrite.
4686 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4687 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4688 Don't initialize is_target_special_ or has_plt_offset_.
4689 Initialize is_defined_in_discarded_section_.
4690 (Symbol_table::add_from_relobj): If appropriate, set
4691 is_defined_in_discarded_section.
4692 * resolve.cc (Symbol::override_base_with_special): Don't test
4693 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4694 * target-reloc.h (relocate_section): Do special handling for
4695 symbols defined in discarded sections for global symbols as well
4696 as local symbols.
4697
4698 2010-01-08 Ian Lance Taylor <iant@google.com>
4699
4700 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4701 the SHT_SYMTAB case.
4702
4703 2010-01-08 Ian Lance Taylor <iant@google.com>
4704
4705 * object.cc (Sized_relobj::do_layout): Don't get confused if
4706 layout_eh_frame returns NULL.
4707
4708 2010-01-08 Ian Lance Taylor <iant@google.com>
4709
4710 PR 11084
4711 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4712 dynamic symbol table, use the normal symbol table.
4713 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4714 symbol table.
4715
4716 2010-01-08 Ian Lance Taylor <iant@google.com>
4717
4718 PR 11072
4719 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4720 sections.
4721
4722 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4723
4724 * version.cc (print_version): Change to "Copyright 2010".
4725
4726 2010-01-08 Ian Lance Taylor <iant@google.com>
4727
4728 PR 10287
4729 PR 11063
4730 * i386.cc (class Target_i386): Change return type of plt_section
4731 to be non-const.
4732 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4733 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4734 tls_desc_rel_ field.
4735 (Output_data_plt_i386::rel_tls_desc): New function.
4736 (Target_i386::rel_tls_desc_section): New function.
4737 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4738 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4739 R_386_TLS_DESC reloc in rel_tls_desc_section.
4740 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4741 Define struct Tlsdesc_info.
4742 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4743 (Target_x86_64::do_reloc_symbol_index): New function.
4744 (Target_x86_64::add_tlsdesc_info): New function.
4745 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4746 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4747 tlsdesc_rel_ field.
4748 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4749 all callers.
4750 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4751 (Target_x86_64::rela_tlsdesc_section): New function.
4752 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4753 handling.
4754 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4755 (Target_x86_64::do_reloc_addend): New function.
4756 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4757 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4758 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4759 (Output_reloc::type): New function.
4760 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4761 (Output_reloc::is_target_specific): New function.
4762 (Output_reloc::target_arg): New function.
4763 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4764 absolute relocs and target specific relocs.
4765 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4766 add_target_specific.
4767 (class Output_data_reloc) [SHT_RELA]: Likewise.
4768 * output.cc (Output_reloc::Output_reloc): Add four new versions
4769 for absolute relocs and target specific relocs.
4770 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4771 (Output_reloc::get_symbol_index): Likewise.
4772 (Output_reloc::local_section_offset): Check that local_sym_index_
4773 is not TARGET_CODE or 0.
4774 (Output_reloc::symbol_value): Likewise.
4775 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4776 reloc.
4777 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4778 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4779 functions.
4780 * layout.cc (add_target_dynamic_tags): Use output section for
4781 DT_PLTRELSZ and DT_JMPREL.
4782
4783 2010-01-07 Ian Lance Taylor <iant@google.com>
4784
4785 PR 11061
4786 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4787 function.
4788 (class Output_data_reloc_generic): Define.
4789 (class Output_data_reloc_base): Change base class to
4790 Output_data_reloc_generic. Change add() method to call
4791 bump_relative_reloc_count for a relative reloc. Remove
4792 sort_relocs_ field.
4793 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4794 to sort_relocs().
4795 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4796 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4797 appropriate.
4798 * layout.h (class Layout): Update declaration.
4799
4800 2010-01-07 Ian Lance Taylor <iant@google.com>
4801
4802 * output.h (class Output_data): Add const version of
4803 output_section and do_output_section.
4804 (class Output_section_data): Add const version of
4805 do_output_section.
4806 (class Output_section): Likewise.
4807 * layout.cc (Layout::add_target_dynamic_tags): New function.
4808 * layout.h (class Layout): Update declarations.
4809 * arm.cc (Target_arm::do_finalize_sections): Use
4810 add_target_dynamic_tags.
4811 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4812 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4813 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4814 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4815
4816 2010-01-07 Ian Lance Taylor <iant@google.com>
4817
4818 PR 11042
4819 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4820 object as needed.
4821
4822 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4823 Ian Lance Taylor <iant@google.com>
4824
4825 PR 11019
4826 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4827 Xindex::read_symtab_xindex.
4828
4829 2010-01-07 Doug Kwan <dougkwan@google.com>
4830
4831 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4832 (Insn_template::thumb16_bcond_insn): New method declaration.
4833 (Insn_template): Fix spelling.
4834 (Stub::thumb16_special): New method declaration.
4835 (Stub::do_write): Define virtual method which was previously pure
4836 virtual.
4837 (Stub::do_thumb16_special): New method declaration.
4838 (Stub::do_fixed_endian_write): New template member.
4839 (Reloc_stub::do_write): Remove.
4840 (Reloc_stub::do_fixed_endian_write): Remove.
4841 (Cortex_a8_stub): New class definition.
4842 (Stub_factory::make_cortex_a8_stub): New method definition.
4843 (Stub_factory::Stub_factory): Add missing static storage class
4844 qualifier for elf32_arm_stub_a8_veneer_blx.
4845
4846 2010-01-07 Ian Lance Taylor <iant@google.com>
4847
4848 PR 10980
4849 * options.h (class General_options): Add --warn-unresolved-symbols
4850 and --error-unresolved-symbols.
4851 * errors.cc (Errors::undefined_symbol): Implement
4852 --warn-unresolved-symbols.
4853
4854 * options.h (class General_options): Add -z text and -z textoff.
4855 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4856
4857 2010-01-06 Sriraman Tallam <tmsriram@google.com>
4858
4859 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4860 (Garbage_collection::cident_sections): New function.
4861 (Garbage_collection::add_cident_section): New function.
4862 (Garbage_collection::cident_sections_): New member.
4863 (gc_process_relocs): Add references to sections whose names are C
4864 identifiers.
4865 * gold.h (cident_section_start_prefix): New constant.
4866 (cident_section_stop_prefix): New constant.
4867 (is_cident): New function.
4868 * layout.cc (Layout::define_section_symbols): Replace string constants
4869 with the newly defined constants.
4870 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4871 C identifiers.
4872 * testsuite/Makefile.am: Add gc_orphan_section_test.
4873 * testsuite/Makefile.in: Regenerate.
4874 * testsuite/gc_orphan_section_test.cc: New file.
4875 * testsuite/gc_orphan_section_test.sh: New file.
4876
4877 2010-01-06 Ian Lance Taylor <iant@google.com>
4878
4879 PR 10980
4880 * options.h (class General_options): Add --warn-shared-textrel.
4881 * layout.cc (Layout::finish_dynamic_section): Implement
4882 --warn-shared-textrel.
4883
4884 PR 10980
4885 * options.h (class General_options): Add --warn-multiple-gp.
4886
4887 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4888
4889 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4890 $(THREADSLIB) and $(LIBDL).
4891 * Makefile.in: Rebuild.
4892
4893 2010-01-06 Ian Lance Taylor <iant@google.com>
4894
4895 PR 10980
4896 * options.cc (General_options::parse_section_start): New function.
4897 (General_options::section_start): New function.
4898 (General_options::General_options): Initialize all members.
4899 * options.h: Include <map>
4900 (class General_options): Add --section-start. Add section_starts_
4901 member.
4902 * layout.cc (Layout::attach_allocated_section_to_segment): If
4903 --section-start was used, set the address of the segment. Remove
4904 local sort_sections.
4905 (Layout::relaxation_loop_body): If the address of the load segment
4906 has been set by --section-start, don't use it.
4907 * output.h (Output_segment::update_flags_for_output_section): New
4908 function.
4909 * output.cc (Output_segment::add_output_section): Call
4910 update_flags_for_output_section.
4911
4912 2010-01-05 Ian Lance Taylor <iant@google.com>
4913
4914 PR 10980
4915 * options.h (class General_options): Add --undefined-version.
4916 * script.cc (struct Version_expression): Add was_matched_by_symbol
4917 field.
4918 (Version_script_info::matched_symbol): New function.
4919 (Version_script_info::get_symbol_version_helper): Call
4920 matched_symbol.
4921 (Version_script_info::check_unmatched_names): New function.
4922 * script.h (class Version_script_info): Update declarations.
4923 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4924
4925 * options.h (class General_options): Use DEFINE_bool_alias for
4926 allow_multiple_definition.
4927 * resolve.cc (Symbol_table::should_override): Don't test
4928 allow_multiple_definition.
4929
4930 PR 10980
4931 * options.h (class General_options): Add --cref.
4932 * main.cc (main): Print cref table if --cref. Don't close mapfile
4933 until after printing cref table.
4934 * cref.cc: Include "symtab.h".
4935 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4936 (Cref_table_compare::operator()): New function.
4937 (Cref_inputs::gather_cref): New function.
4938 (filecol): New static const.
4939 (Cref_inputs::print_cref): New function.
4940 (Cref::print_cref): New function.
4941 * cref.h: Include <cstdio>.
4942 (class Cref): Update declarations.
4943 * mapfile.h (Mapfile::file): New function.
4944 * object.h (class Object): Define Symbols. Declare virtual
4945 do_get_global_symbols.
4946 (Object::get_global_symbols): New function.
4947 * object.cc (Input_objects::add_object): Pass object to cref_ if
4948 --cref.
4949 (Input_objects::archive_start): Likewise.
4950 (Input_objects::archive_stop): Likewise.
4951 (Input_objects::print_cref): New function.
4952 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4953 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4954 --cref.
4955 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4956 function.
4957 * plugin.h (class Sized_pluginobj): Update declarations.
4958
4959 2010-01-05 Ian Lance Taylor <iant@google.com>
4960
4961 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4962 to is_default_version. Rename insdef to insdefault.
4963 (Symbol_table::add_from_relobj): Rename def to is_default_version
4964 and local to is_forced_local.
4965 (Symbol_table::add_from_pluginobj): Likewise.
4966 (Symbol_table::add_from_dynobj): Likewise.
4967 (Symbol_table::define_special_symbol): Rename insdef to
4968 insdefault.
4969
4970 2010-01-04 Ian Lance Taylor <iant@google.com>
4971
4972 PR 10980
4973 * options.h (class General_options): Add
4974 --allow-multiple-definition and -z muldefs.
4975 * resolve.cc (Symbol_table::should_override): Don't warn about a
4976 multiple symbol definition if --allow-multiple-definition or -z
4977 muldefs.
4978
4979 PR 10980
4980 * options.h (class General_options): Add --add-needed and
4981 --copy-dt-needed-entries. Tweak --as-needed help entry.
4982 * object.cc (Input_objects::check_dynamic_dependencies): Give an
4983 error if --copy-dt-needed-entries aka --add-needed is used and
4984 would cause a change in behaviour.
4985
4986 PR 10980
4987 * options.h (class General_options): Add -G as a short version of
4988 --shared. Add no-op options -assert, -g, and -i.
4989
4990 2010-01-04 Sriraman Tallam <tmsriram@google.com>
4991
4992 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4993 check for .text or .gnu.linkonce.t sections.
4994 * icf.cc (Icf::find_identical_sections): Ditto.
4995 Change the detection for mangled function name within the section
4996 name.
4997 * icf.h (is_section_foldable_candidate): New function.
4998
4999 2009-12-30 Ian Lance Taylor <iant@google.com>
5000
5001 PR 10980
5002 * options.h (class General_options): Permit two dashes with
5003 --retain-symbols-file.
5004
5005 2009-12-30 Ian Lance Taylor <iant@google.com>
5006
5007 PR 10979
5008 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5009 don't put the file header and segment headers in the text
5010 segment.
5011
5012 PR 10979
5013 * common.cc (Sort_commons::operator()): Stabilize sort when both
5014 entries are NULL.
5015 (Symbol_table::do_allocate_commons_list): When allocating common
5016 symbols, skip a symbol which is no longer common.
5017 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5018 an object before checking its type.
5019 * testsuite/common_test_2.c: New file.
5020 * testsuite/common_test_3.c: New file.
5021 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5022 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5023 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5024 (common_test_2_pic.o, common_test_2.so): New targets.
5025 (common_test_3_pic.o, common_test_3.so): New targets.
5026 * testsuite/Makefile.in: Rebuild.
5027
5028 PR 10979
5029 * script.cc (read_input_script): If we see a new SECTIONS clause,
5030 and we have added an input section, give an error.
5031 * layout.h (class Layout): Add have_added_input_section function.
5032 Add have_added_input_section_ field.
5033 * layout.cc (Layout::Layout): Initialize
5034 have_added_input_section_.
5035 (Layout::layout): Set have_added_input_section_.
5036 (Layout::layout_eh_frame): Likewise.
5037
5038 2009-12-30 Ian Lance Taylor <iant@google.com>
5039
5040 PR 10931
5041 * options.h (class General_options): Add --sort-common option.
5042 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5043 * common.cc (Sort_common): Add sort_order parameter to
5044 constructor. Add sort_order_ field.
5045 (Sort_commons::operator): Check sort_order_.
5046 (Symbol_table::allocate_commons): Determine the sort order.
5047 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5048 Change all callers.
5049 (Symbol_table::do_allocate_commons_list): Likewise.
5050
5051 2009-12-30 Ian Lance Taylor <iant@google.com>
5052
5053 PR 10916
5054 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5055 symbols from this object, don't change the visibility of an
5056 undefined symbol.
5057 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5058
5059 2009-12-30 Ian Lance Taylor <iant@google.com>
5060
5061 PR 10861
5062 * script.h (class Version_script_info): Define Language enum.
5063 Update declarations. Define Glob, Exact, and Lookup types. Add
5064 new fields globals_, locals_, and is_finalized_.
5065 * script.cc: Various formatting fixes.
5066 (class Parser_closure): Change language_stack_ from a vector of
5067 std::string to one of Version_script_info::Language. Adjust all
5068 uses accordingly.
5069 (class Lazy_demangler): Remove.
5070 (struct Version_expression): Change language from std::string to
5071 Version_script_info::Language.
5072 (Version_script_info::Version_script_info): New function.
5073 (Version_script_info::~Version_script_info): Don't call clear.
5074 (Version_script_info::finalize): New function.
5075 (Version_script_info::build_lookup_tables): New function.
5076 (Version_script_info::build_expression_list_lookup): New
5077 function.
5078 (Version_script_info::get_symbol_version_helper): Rewrite to use
5079 lookup tables.
5080 (Version_script_info::print_expression_list): Adjust to use
5081 Version_script_info::Language.
5082 (script_push_lex_into_version_mode): Check that the version script
5083 has not been finalized.
5084 (version_script_push_lang): Change language string to
5085 Version_script_info::Language.
5086 * options.cc (Command_line::version_script): New function.
5087 * options.h (class General_options): Add finalize_dynamic_list
5088 function. Change version_script from declaration to definition.
5089 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5090 * testsuite/version_script.map: Remove duplicate def of foo.
5091 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5092 version_script.map.
5093 * testsuite/Makefile.in: Rebuild.
5094
5095 2009-12-30 Ian Lance Taylor <iant@google.com>
5096
5097 PR 10843
5098 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5099 if the input symbol index is 0, make the output symbol index 0.
5100
5101 2009-12-30 Ian Lance Taylor <iant@google.com>
5102
5103 PR 10670
5104 * options.h (class General_options): Add -x/--discard-all.
5105 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5106 --discard-all. If the local symbol needs a dynamic entry, check
5107 that before handling --discard-locals.
5108
5109 2009-12-30 Ian Lance Taylor <iant@google.com>
5110
5111 PR 10450
5112 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5113 flags to PF_R.
5114 (Output_segment::add_output_section): Don't change the flags if
5115 the type is PT_TLS.
5116
5117 PR 10450
5118 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5119 GNU hash table if they need a dynamic value. Otherwise, don't add
5120 them if they are defined in a dynamic object or are forced local.
5121
5122 2009-12-29 Ian Lance Taylor <iant@google.com>
5123
5124 PR 10450
5125 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5126 .gnu.hash table for a 32-bit target.
5127
5128 PR 10450
5129 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5130 regular and a dynamic object only needs a dynamic symbol table
5131 entry if it is externally visible.
5132
5133 PR 10450
5134 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5135 constructor. Add global_offset_table_ field.
5136 (Target_i386::got_section): Set global_offset_table_.
5137 (Target_i386::do_finalize_sections): Set global_offset_table_
5138 size.
5139 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5140 in constructor. Add global_offset_table_ field.
5141 (Target_x86_64::got_section): Set global_offset_table_.
5142 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5143 size.
5144
5145 * layout.cc (Layout::Layout): Initialize increase_relro_.
5146 (Layout::get_output_section): Add is_relro, is_last_relro, and
5147 is_first_non_relro parameters. Change all callers.
5148 (Layout::choose_output_section): Likewise.
5149 (Layout::add_output_section_data): Likewise.
5150 (Layout::make_output_section): Likewise.
5151 (Layout::set_segment_offsets): Clear increase_relro when using a
5152 linker script.
5153 * layout.h (class Layout): Add increase_relro method. Add
5154 increase_relro_ field. Update declarations.
5155 * output.cc (Output_section::Output_section): Initialize
5156 is_last_relro_ and is_first_non_relro_.
5157 (Output_segment::add_output_section): Group relro sections is
5158 do_sort is true. Handle is_last_relro and is_first_non_relro.
5159 (Output_segment::maximum_alignment): Remove relro handling.
5160 (Output_segment::set_section_addresses): Add increase_relro
5161 parameter. Change all callers. Add initial alignment to align
5162 relro sections on separate page. Remove old relro handling.
5163 (Output_segment::set_section_list_addresses): Remove in_relro
5164 parameter. Change all callers.
5165 (Output_segment::set_offset): Add increase parameter. Change all
5166 callers. Remove old relro handling.
5167 * output.h (class Output_section): Add new methods: is_last_relro,
5168 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5169 Add is_last_relro_ and is_first_non_relro_ fields.
5170 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5171 Create separate .got.plt section. Call increase_relro.
5172 * x86_64.cc (Target_x86_64::got_section): Likewise.
5173 * testsuite/relro_script_test.t: Add .got.plt.
5174
5175 PR 10450
5176 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5177 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5178 (Layout::finalize): Call set_dynamic_symbol_size.
5179 (Layout::set_dynamic_symbol_size): New function.
5180 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5181 set_dynamic_symbol_size.
5182
5183 PR 10450
5184 * output.h (class Output_section): Add is_entsize_zero_ field.
5185 * output.cc (Output_section::Output_section): Initialize
5186 is_entsize_zero_.
5187 (Output_section::set_entsize): If two different entsizes are
5188 requested, force it to zero.
5189 (Output_section::add_input_section): Set flags for .debug_str
5190 before updating section flags. Set entsize.
5191 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5192 and SHF_STRING if all input sections have those flags.
5193
5194 2009-12-29 Rafael Espindola <espindola@google.com>
5195
5196 * main.cc (main): Fix the sys time reporting.
5197 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5198 reporting.
5199
5200 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5201
5202 * options.cc (General_options::parse_version): Allow -v to exit
5203 without an error if there is nothing to link.
5204
5205 2009-12-29 Ian Lance Taylor <iant@google.com>
5206
5207 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5208 using a version of gcc before 4.1.
5209 * configure: Rebuild.
5210
5211 2009-12-28 Chris Demetriou <cgd@google.com>
5212
5213 * attributes.cc (Output_attributes_section_data::do_write): Use
5214 std::vector::front rather than std::vector::data.
5215
5216 2009-12-28 Ian Lance Taylor <iant@google.com>
5217
5218 * symtab.h (class Symbol_table): Add enum Defined.
5219 * resolve.cc (Symbol_table::should_override): Add defined
5220 parameter. Change all callers. Test whether object is NULL
5221 before calling a method on it.
5222 (Symbol_table::report_resolve_problem): Add defined parameter.
5223 Change all callers.
5224 (Symbol_table::should_override_with_special): Likewise.
5225 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5226 parameter. Change all callers.
5227 (Symbol_table::do_define_in_output_data): Likewise.
5228 (Symbol_table::define_in_output_segment): Likewise.
5229 (Symbol_table::do_define_in_output_segment): Likewise.
5230 (Symbol_table::define_as_constant): Likewise.
5231 (Symbol_table::do_define_as_constant): Likewise.
5232 * script.h (class Symbol_assignment): Add is_defsym parameter to
5233 constructor; change all callers.
5234 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5235 parameter. Change all callers. Add is_defsym_ field.
5236 (class Parser_closure): Add parsing_defsym parameter to
5237 constructor; change all callers. Add parsing_defsym accessor
5238 function. Add parsing_defsym_ field.
5239
5240 2009-12-28 Ian Lance Taylor <iant@google.com>
5241
5242 * gold.cc (queue_middle_tasks): Fix formatting.
5243 * object.cc (Relobj::is_section_name_included): Likewise.
5244
5245 2009-12-23 Ian Lance Taylor <iant@google.com>
5246
5247 * i386.cc (Target_i386::do_calls_non_split): Recognize
5248 -fsplit-stack prologue for a function with a static chain.
5249 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5250 -fsplit-stack prologue when using %r11.
5251
5252 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5253
5254 * options.cc (General_options::parse_version): Make -v continue and do
5255 the link like GNU ld does.
5256
5257 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5258
5259 * Makefile.am (CCFILES): Add timer.cc.
5260 (HFILES): Add timer.h.
5261 * configure.ac: Check for sysconf and times.
5262 * main.cc: include timer.h.
5263 (main): Use Timer instead of get_run_time.
5264 * timer.cc: New.
5265 * timer.h: New.
5266 * workqueue.cc: include timer.h.
5267 (Workqueue::find_and_run_task):
5268 Report user, sys and wall time.
5269 * Makefile.in: Regenerate.
5270 * config.in: Regenerate.
5271 * configure: Regenerate.
5272
5273 2009-12-16 Doug Kwan <dougkwan@google.com>
5274
5275 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5276 sections.
5277 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5278 relaxed input sections.
5279 * output.cc (Output_section::find_relaxed_input_section): Change
5280 return type to Output_relaxed_input_section pointer. Adjust code
5281 for new type of relaxed_input_section_map_.
5282 * output.h (Output_section::find_relaxed_input_section): Change
5283 return type to Output_relaxed_input_section pointer.
5284 (Output_section::Output_relaxed_input_section_by_input_section_map):
5285 New type.
5286 (Output_section::relaxed_input_section_map_): Change type to
5287 Output_section::Output_relaxed_input_section_by_input_section_map.
5288 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5289 input section.
5290
5291 2009-12-15 Ian Lance Taylor <iant@google.com>
5292
5293 * layout.cc (Layout::create_shstrtab): Only write out after input
5294 sections if we are compressing debug sections.
5295
5296 2009-12-15 Ian Lance Taylor <iant@google.com>
5297
5298 * archive.cc (Archive::add_symbols): Only look up a symbol without
5299 a version if there is, in fact, a version.
5300
5301 2009-12-14 Ian Lance Taylor <iant@google.com>
5302
5303 Revert -Wshadow changes, all changes from:
5304 2009-12-11 Doug Kwan <dougkwan@google.com>
5305 2009-12-11 Nick Clifton <nickc@redhat.com>
5306 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5307
5308 2009-12-11 Doug Kwan <dougkwan@google.com>
5309
5310 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5311 due to -Wshadow.
5312 * attributes.cc (Object_attribute::size): Ditto.
5313 (Attributes_section_data::size): Ditto.
5314 (Attributes_section_data::Attributes_section_data): Ditto.
5315 (Output_attributes_section_data::do_write): Ditto.
5316 * attributes.h (Object_attribute::set_type): Ditto.
5317 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5318
5319 2009-12-11 Nick Clifton <nickc@redhat.com>
5320
5321 * archive.cc: Fix shadowed variable warnings.
5322 * arm.cc: Likewise.
5323 * compressed_output.cc: Likewise.
5324 * compressed_output.h: Likewise.
5325 * configure: Likewise.
5326 * dwarf_reader.cc: Likewise.
5327 * dynobj.cc: Likewise.
5328 * dynobj.h: Likewise.
5329 * ehframe.cc: Likewise.
5330 * ehframe.h: Likewise.
5331 * errors.cc: Likewise.
5332 * expression.cc: Likewise.
5333 * fileread.cc: Likewise.
5334 * fileread.h: Likewise.
5335 * freebsd.h: Likewise.
5336 * i386.cc: Likewise.
5337 * icf.cc: Likewise.
5338 * incremental.h: Likewise.
5339 * layout.cc: Likewise.
5340 * layout.h: Likewise.
5341 * mapfile.cc: Likewise.
5342 * merge.cc: Likewise.
5343 * merge.h: Likewise.
5344 * object.cc: Likewise.
5345 * object.h: Likewise.
5346 * options.h: Likewise.
5347 * output.cc: Likewise.
5348 * output.h: Likewise.
5349 * parameters.cc: Likewise.
5350 * plugin.cc: Likewise.
5351 * powerpc.cc: Likewise.
5352 * reduced_debug_output.cc: Likewise.
5353 * reduced_debug_output.h: Likewise.
5354 * reloc.cc: Likewise.
5355 * reloc.h: Likewise.
5356 * resolve.cc: Likewise.
5357 * script-sections.cc: Likewise.
5358 * script.cc: Likewise.
5359 * script.h: Likewise.
5360 * sparc.cc: Likewise.
5361 * symtab.cc: Likewise.
5362 * symtab.h: Likewise.
5363 * target-select.cc: Likewise.
5364 * target-select.h: Likewise.
5365 * token.h: Likewise.
5366 * workqueue.cc: Likewise.
5367 * workqueue.h: Likewise.
5368 * x86_64.cc: Likewise.
5369
5370 2009-12-10 Doug Kwan <dougkwan@google.com>
5371
5372 * arm.cc (attributes.h): New include.
5373 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5374 (Arm_relobj::~Arm_relobj): Delete object pointed by
5375 attributes_section_data_.
5376 (Arm_relobj::attributes_section_data): New method definition.
5377 (Arm_relobj::attributes_section_data_): New data member declaration.
5378 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5379 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5380 attributes_section_data_.
5381 (Arm_dynobj::attributes_section_data): New method definition.
5382 (Arm_dynobj::attributes_section_data_): New data member declaration.
5383 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5384 initialization value of may_use_blx_ to false.
5385 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5386 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5387 object attributes to compute results instead of hard-coding.
5388 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5389 Target_arm::get_secondary_compatible_arch,
5390 Target_arm::set_secondary_compatible_arch
5391 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5392 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5393 New method declarations.
5394 (Target_arm::get_aeabi_object_attribute): New method definition.
5395 (Target_arm::attributes_section_data_): New data member declaration.
5396 (read_arm_attributes_section): New template definition.
5397 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5398 (Arm_dynobj::do_read_symbols): Ditto.
5399 (Target_arm::do_finalize_sections): Merge attributes sections from
5400 input. Check for BLX use after attributes section merging.
5401 Fix __exidx_start and __exidx_end visibility. Create an
5402 .ARM.attributes section if necessary.
5403 (Target_arm::get_secondary_compatible_arch,
5404 Target_arm::set_secondary_compatible_arch,
5405 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5406 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5407 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5408 New method definitions.
5409
5410 2009-12-09 Ian Lance Taylor <iant@google.com>
5411
5412 * plugin.cc (Plugin::load): Don't cast from void* to a function
5413 pointer.
5414
5415 2009-12-09 Ian Lance Taylor <iant@google.com>
5416
5417 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5418 information fields.
5419
5420 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5421
5422 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5423 Replace two_file_shared_1.so with two_file_shared_2.so.
5424 * testsuite/Makefile.in: Regenerated.
5425
5426 2009-12-08 Doug Kwan <dougkwan@google.com>
5427
5428 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5429 (HFILES): Add attributes.h and int_encoding.h.
5430 * Makefile.in: Regenerate.
5431 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5432 function definitions to int_encoding.cc
5433 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5434 prototypes to int_encoding.h
5435 * reduced_debug_output.cc (int_encoding.h): New include.
5436 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5437 function definitions to int_encoding.cc
5438 (insert_into_vector, read_from_pointer): Move template definitions to
5439 int_encoding.h
5440 * attributes.cc: New file.
5441 * attributes.h: New file.
5442 * int_encoding.cc: New file.
5443 * int_encoding.h: New file.
5444
5445 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5446
5447 PR gold/11055
5448 * incremental-dump.cc (dump_incremental_inputs): New.
5449 (main): Use dump_incremental_inputs.
5450
5451 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5452
5453 PR gold/10893
5454 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5455 checking elfcpp::STT_FUNC.
5456 (Target_i386::Relocate::relocate): Likewise.
5457 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5458
5459 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5460 symbols from shared libraries into normal FUNC symbols.
5461
5462 * symtab.h (Symbol): Add is_func and use it.
5463
5464 2009-12-05 Doug Kwan <dougkwan@google.com>
5465
5466 * arm.cc (Target_arm::arm_info): Initialize new fields
5467 attributes_section and attributes_vendor.
5468 * i386.cc (Target_i386::i386_info): Same.
5469 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5470 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5471 fields attributes_section and attributes_vendor.
5472 * sparc.cc (Target_sparc::sparc_info): Same.
5473 * target.h (Target::attributes_section, Target::attributes_vendor,
5474 Target::is_attributes_section, Target::attribute_arg_type,
5475 Target::attributes_order): New method definitions.
5476 (Target::Target_info::attributes_section,
5477 Target::Target_info::attributes_vendor): New fields.
5478 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5479 virtual method definitions.
5480 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5481 attributes_section and attributes_vendor.
5482 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5483
5484 2009-12-05 Doug Kwan <dougkwan@google.com>
5485
5486 * arm.cc: Update comments about interworking and stub generation.
5487 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5488 considered as non-PIC.
5489 (Arm_relocate_functions::base_abs): Fix formatting.
5490 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5491 of function to use GOT entry address instead of offset.
5492 (Target_arm::Scan::global): Issue an error if a symbol would need a
5493 PLT does not get one because it is untyped. Remove code to create
5494 dynamic symbols for relative branches.
5495 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5496 takes unsigned integer instead of boolean.
5497
5498 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5499
5500 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5501 (two_file_test_LDADD): Likewise.
5502 (common_test_1_LDADD): Likewise.
5503 (exception_test_LDADD) Likewise.
5504 (weak_test_LDADD): Likewise.
5505 (many_sections_test_LDADD): Likewise.
5506 (initpri1_LDADD): Likewise.
5507 (script_test_1_LDADD): Likewise.
5508 (script_test_2_LDADD): Likewise.
5509 (justsyms_LDADD): Likewise.
5510 (binary_test_LDADD): Likewise.
5511 (large_LDADD): Likewise.
5512 * testsuite/Makefile.in: Regenerated.
5513
5514 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5515
5516 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5517 (Symbol_table::override_with_special): Likewise.
5518 (Symbol_table::add_from_object): Likewise.
5519
5520 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5521
5522 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5523 Don't set the data_offset twice.
5524
5525 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5526
5527 * testsuite/Makefile.in: Regenerate.
5528
5529 2009-12-03 Doug Kwan <dougkwan@google.com>
5530
5531 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5532 (Target_arm::do_finalize_sections): Add parameter for symbol table
5533 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5534 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5535 parameter for symbol table pointer.
5536 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5537 an additional parameter for a pointer to symbol table.
5538 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5539 parameter for a symbol table pointer.
5540 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5541 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5542 Ditto.
5543 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5544 parameter for a symbol table pointer.
5545
5546 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5547
5548 * incremental.cc (Incremental_inputs_header)
5549 (Incremental_inputs_header_write, Incremental_inputs_entry)
5550 (Incremental_inputs_entry_write): Move ...
5551 * incremental.h (Incremental_inputs_header)
5552 (Incremental_inputs_header_write, Incremental_inputs_entry)
5553 (Incremental_inputs_entry_write): here.
5554
5555 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5556
5557 * incremental.cc (make_sized_incremental_binary): Set the target.
5558 Error if it is incompatible.
5559 * output.h (Output_file): Add filename method.
5560
5561 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5562
5563 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5564 from the get_* methods.
5565
5566 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5567
5568 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5569 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5570 Write 0 for the data_offset of scripts.
5571
5572 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5573
5574 * testsuite/Makefile.am: Add the incremental_test.sh test.
5575 * testsuite/incremental_test.sh: New.
5576 * testsuite/incremental_test_1.c: New.
5577 * testsuite/incremental_test_2.c: New.
5578
5579 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5580
5581 * incremental-dump.cc (main): Fix typos.
5582
5583 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5584
5585 PR gold/11025
5586 * incremental-dump.cc (main): Use llu to print 64 bit values.
5587
5588 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5589 H.J. Lu <hongjiu.lu@intel.com>
5590
5591 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5592 $(LIBDL).
5593 (incremental_dump_LDADD): Likewise.
5594 * Makefile.in: Regenerated.
5595
5596 2009-11-25 Doug Kwan <dougkwan@google.com>
5597
5598 Revert:
5599
5600 2009-11-25 Doug Kwan <dougkwan@google.com>
5601
5602 * arm.cc (Target_arm::Target_arm): Move method definition
5603 outside of class definition. Add code to handle
5604 --target1-rel, --target1-abs and --target2= options.
5605 (Target_arm::get_reloc_reloc_type): Change method to be
5606 non-static and const.
5607 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5608 New data member declaration.
5609 (Target_arm::Scan::local, Target_arm::Scan::global,
5610 Target_arm::Relocate::relocate,
5611 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5612 Adjust call to Target_arm::get_real_reloc_type.
5613 (Target_arm::get_real_reloc_type): Use command line options
5614 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5615 * options.h (--target1-rel, --target1-abs, --target2): New
5616 ARM-only options.
5617
5618 2009-11-25 Doug Kwan <dougkwan@google.com>
5619
5620 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5621 class definition. Add code to handle --target1-rel, --target1-abs
5622 and --target2= options.
5623 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5624 and const.
5625 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5626 member declaration.
5627 (Target_arm::Scan::local, Target_arm::Scan::global,
5628 Target_arm::Relocate::relocate,
5629 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5630 call to Target_arm::get_real_reloc_type.
5631 (Target_arm::get_real_reloc_type): Use command line options to
5632 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5633 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5634 options.
5635
5636 2009-11-25 Doug Kwan <dougkwan@google.com>
5637
5638 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5639 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5640 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5641 formatting.
5642 (Arm_relocate_functions::thm_call): Replace body with a call to
5643 Arm_relocate_functions::thumb_branch_common.
5644 (Arm_relocate_functions::thm_jump24,
5645 Arm_relocate_functions::thm_xpc22): New method definitions.
5646 (Arm_relocate_functions::thumb_branch_common): New method definition.
5647 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5648 operator.
5649 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5650 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5651
5652 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5653
5654 * Makefile.am: Build incremental-dump
5655 * Makefile.in: Regenerate.
5656 * incremental-dump.cc: New.
5657 * incremental.cc (Incremental_inputs_header_data,
5658 Incremental_inputs_entry_data): Move to incremental.h
5659 * incremental.h: (Incremental_inputs_header_data,
5660 Incremental_inputs_entry_data): Move from incremental.cc
5661
5662 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5663
5664 * incremental.cc (Incremental_inputs_header,
5665 Incremental_inputs_header_write, Incremental_inputs_entry,
5666 Incremental_inputs_entry_write): Add a typedef with the data type.
5667
5668 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5669
5670 * incremental.cc (Incremental_inputs_header,
5671 Incremental_inputs_header_write, Incremental_inputs_entry,
5672 Incremental_inputs_entry_write): Update comment about which
5673 type has the filed descriptions.
5674
5675 2009-11-15 Doug Kwan <dougkwan@google.com>
5676
5677 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5678 (Arm_relocate_functions::arm_branch_common): Change method defintion
5679 in class definition to a method declaration and update list of formal
5680 parameters.
5681 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5682 Arm_relocation_functions::jump24): Adjust call to
5683 Arm_relocate_functions::arm_branch_common. Update list of formal
5684 parameters.
5685 (Arm_relocate_functions::xpc25): New method definition.
5686 (Arm_relocate_functions::arm_branch_common): Move method defintion
5687 out from class definition. Use stubs for mode-switching and extending
5688 branch ranges.
5689 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5690 specially. Change code to enable use of stubs in ARM branches.
5691
5692 2009-11-10 Doug Kwan <dougkwan@google.com>
5693
5694 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5695 in method declaration.
5696 (Target_arm::relocate_stub): New method declaration.
5697 (Target_arm::default_target): Change to return a pointer instead of
5698 a const reference.
5699 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5700 Target_arm::default_target.
5701 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5702 method definition.
5703 (Target_arm::relocate_section): Adjust view.
5704 (Target_arm::relocate_stub): New method definition.
5705
5706 2009-11-10 Doug Kwan <dougkwan@google.com>
5707
5708 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5709 a format warning.
5710 * incremental.cc (open_incremental_binary): Initialized local
5711 variables to avoid warnings.
5712 * object.cc (make_elf_object): Ditto.
5713 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5714 a format warning.
5715
5716 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5717
5718 PR gold/10930
5719 * testsuite/plugin_test.c: Include "config.h".
5720
5721 2009-11-09 Doug Kwan <dougkwan@google.com>
5722
5723 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5724 (arm_symbol_value): Remove.
5725 (Arm_relocate_functions::arm_branch_common,
5726 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5727 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5728 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5729 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5730 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5731 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5732 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5733 Arm_relocate_functions::thm_mobw_abs_nc,
5734 Arm_relocate_functions::thm_mov_abs,
5735 Arm_relocate_functions::movw_prel_nc,
5736 Arm_relocate_functions::thm_movt_abs,
5737 Arm_relocate_functions::movt_prel,
5738 Arm_relocate_functions::thm_movw_prel_nc,
5739 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5740 (Target_arm::Relocate::relocate): Only decompose address into two
5741 parts if relocation type uses the thumb-bit and pass the actual
5742 bit instead of a flag indicating that the thumb-bit is used. Adjust
5743 calls to methods in Arm_relocate_functions for this change.
5744
5745 2009-11-08 Ian Lance Taylor <iant@google.com>
5746
5747 PR 10925
5748 * reloc.cc: Instantiate
5749 Sized_relobj::initialize_input_to_output_maps and
5750 Sized_relobj:free_input_to_output_maps.
5751
5752 2009-11-06 Ian Lance Taylor <iant@google.com>
5753
5754 PR 10876
5755 * defstd.cc (in_segment): Set only_if_ref true for "end".
5756
5757 2009-11-06 Doug Kwan <dougkwan@google.com>
5758
5759 * arm.cc (class Reloc_stub): Correct a comment.
5760 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5761 (Target_arm::scan_section_for_stubs): New method declaration.
5762 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5763 Change methods from private to protected.
5764 (Target_arm::do_may_relax): New method definition.
5765 (Target_arm::do_relax, Target_arm::group_sections,
5766 Target_arm::scan_reloc_for_stub,
5767 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5768 (Target_arm::arm_input_section_map_): New data member declaration.
5769 (Target_arm::scan_reloc_for_stub,
5770 Target_arm::scan_reloc_section_for_stubs,
5771 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5772 Target_arm::do_relax): New method definitions.
5773
5774 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5775
5776 * configure.ac: Check for (struct stat)::st_mtim
5777 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5778 * config.in: Regenerate.
5779 * configure: Regenerate.
5780
5781 2009-11-05 Ian Lance Taylor <iant@google.com>
5782
5783 PR 10910
5784 * output.cc (Output_segment::add_output_section): Add missing
5785 return statement.
5786
5787 2009-11-04 Ian Lance Taylor <iant@google.com>
5788
5789 PR 10880
5790 * object.h (class Object): Add is_needed and set_is_needed
5791 methods. Add is_needed_ field. Make bool fields into bitfields.
5792 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5793 defined in a dynamic object and referenced by a regular object,
5794 set is_needed for the dynamic object.
5795 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5796 if the file is marked with as_needed and it is not needed.
5797
5798 2009-11-04 Ian Lance Taylor <iant@google.com>
5799
5800 PR 10887
5801 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5802 tags if data is discarded by linker script.
5803 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5804 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5805 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5806 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5807
5808 2009-11-04 Ian Lance Taylor <iant@google.com>
5809
5810 * layout.cc (Layout::get_output_section): Add is_interp and
5811 is_dynamic_linker_section parameters. Change all callers.
5812 (Layout::choose_output_section): Likewise.
5813 (Layout::make_output_section): Likewise.
5814 (Layout::add_output_section_data): Add is_dynamic_linker_section
5815 parameter. Change all callers.
5816 * layout.h (class Layout): Update declarations.
5817 * output.h (class Output_section): Add is_interp, set_is_interp,
5818 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5819 Add is_interp_, is_dynamic_linker_section_ fields. Change
5820 generate_code_fills_at_write_ to a bitfield.
5821 * output.cc (Output_section::Output_sections): Initialize new
5822 fields.
5823 (Output_segment::add_output_section): Add do_sort parameter.
5824 Change all callers.
5825
5826 2009-11-03 Ian Lance Taylor <iant@google.com>
5827
5828 PR 10860
5829 * options.h (class General_options): Add --warn-common.
5830 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5831 merging two common symbols.
5832 (Symbol_table::should_override): Handle --warn-common when merging
5833 a common symbol with a defined symbol. Use report_resolve_problem
5834 for multiple definitions.
5835 (Symbol_table::report_resolve_problem): New function.
5836 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5837
5838 2009-11-03 Doug Kwan <dougkwan@google.com>
5839
5840 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5841 stub_factory_.
5842 (Target_arm::stub_factory): New method definition.
5843 (Target_arm::new_arm_input_section,
5844 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5845 Target_arm::reloc_uses_thumb_bit): New method declarations.
5846 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5847 New type definitions.
5848 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5849 member declarations.
5850 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5851 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5852 New method definitions.
5853
5854 2009-11-03 Ian Lance Taylor <iant@google.com>
5855
5856 * options.h (class General_options): Add --warn_constructors.
5857
5858 2009-11-03 Ian Lance Taylor <iant@google.com>
5859
5860 PR 10893
5861 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5862 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5863
5864 2009-11-03 Ian Lance Taylor <iant@google.com>
5865
5866 PR 10895
5867 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5868 --msgid-bugs-address.
5869 (install-pdf): New target.
5870 (install-data_yes): Look up one directory to find mkinstalldirs.
5871
5872 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5873
5874 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5875 tree.
5876
5877 2009-10-30 Doug Kwan <dougkwan@google.com>
5878
5879 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5880
5881 2009-10-30 Doug Kwan <dougkwan@google.com>
5882
5883 * arm.cc (Stub_addend_reader): New struct template definition
5884 and partial specializations.
5885 (Stub_addend_reader::operator()): New method definition for a
5886 partially specialized template.
5887
5888 2009-10-30 Doug Kwan <dougkwan@google.com>
5889
5890 * arm.cc (Arm_relobj::processor_specific_flags): New method
5891 definition.
5892 (Arm_relobj::do_read_symbols): New method declaration.
5893 (Arm_relobj::processor_specific_flags_): New data member declaration.
5894 (Arm_dynobj): New class definition.
5895 (Target_arm::do_finalize_sections): Add input_objects parameter.
5896 (Target_arm::do_adjust_elf_header): New method declaration.
5897 (Target_arm::are_eabi_versions_compatible,
5898 (Target_arm::merge_processor_specific_flags): New method declaration.
5899 (Target_arm::do_make_elf_object): New overloaded method definitions
5900 and declaration.
5901 (Arm_relobj::do_read_symbols): New method definition.
5902 (Arm_dynobj::do_read_symbols): Ditto.
5903 (Target_arm::do_finalize_sections): Add input_objects parameters.
5904 Merge processor-specific flags from all input objects.
5905 (Target_arm::are_eabi_versions_compatible,
5906 Target_arm::merge_processor_specific_flags,
5907 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5908 New method definitions.
5909 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5910 Input_objects pointer type parameter.
5911 * layout.cc (Layout::finalize): Pass input objects to target's.
5912 finalize_sections function.
5913 * output.cc (Output_file_header::do_sized_write): Set ELF file
5914 header's processor-specific flags.
5915 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5916 Input_objects pointer type parameter.
5917 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5918 * target.h (Input_objects): New forward class declaration.
5919 (Target::processor_specific_flags,
5920 Target::are_processor_specific_flags_sect): New method definitions.
5921 (Target::finalize_sections): Add input_objects parameter.
5922 (Target::Target): Initialize processor_specific_flags_ and
5923 are_processor_specific_flags_set_.
5924 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5925 parameter.
5926 (Target::set_processor_specific_flags): New method definition.
5927 (Target::processor_specific_flags_,
5928 Target::are_processor_specific_flags_set_): New data member
5929 declarations.
5930 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5931 Input_objects pointer type parameter.
5932
5933 2009-10-30 Doug Kwan <dougkwan@google.com>
5934
5935 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5936
5937 2009-10-28 Ian Lance Taylor <iant@google.com>
5938
5939 * object.h (class Relobj): Drop options parameter from
5940 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5941 do_scan_relocs, do_relocate. Change all callers.
5942 (class Sized_relobj): Drop options parameters from
5943 do_gc_process_relocs, do_scan_relocs, do_relocate,
5944 do_relocate_sections, relocate_sections, emit_relocs_scan,
5945 emit_relocs_scan_reltype. Change all callers.
5946 (struct Relocate_info): Remove options field and all references to
5947 it.
5948 * reloc.h (class Read_relocs): Remove options constructor
5949 parameter and options_ field. Change all callers.
5950 (class Gc_process_relocs, class Scan_relocs): Likewise.
5951 (class Relocate_task): Likewise.
5952 * target-reloc.h (scan_relocs): Remove options parameter. Change
5953 all callers.
5954 (scan_relocatable_relocs): Likewise.
5955 * target.h (class Sized_target): Remove options parameter from
5956 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5957 all callers.
5958 * gc.h (gc_process_relocs): Remove options parameter. Change all
5959 callers.
5960 * arm.cc: Update functions to remove options parameters.
5961 * i386.cc: Likewise.
5962 * powerpc.cc: Likewise.
5963 * sparc.cc: Likewise.
5964 * x86_64.cc: Likewise.
5965 * testsuite/testfile.cc: Likewise.
5966
5967 2009-10-28 Doug Kwan <dougkwan@google.com>
5968
5969 * arm.cc (Arm_relobj): New class definition.
5970 (Arm_relobj::scan_sections_for_stubs,
5971 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5972 New method definitions.
5973
5974 2009-10-28 Cary Coutant <ccoutant@google.com>
5975
5976 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5977 (Plugin::cleanup_done_): New member.
5978 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5979 (Plugin_manager::cleanup_done_): Remove.
5980 (Plugin_manager::add_input_file): Edit error message.
5981 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5982 (Plugin_manager::cleanup): Remove use of cleanup_done_.
5983
5984 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
5985
5986 * fileread.cc: (File_read::View::~View): Use the new
5987 data_ownership_ filed.
5988 (File_read::~File_read): Dispose the new whole_file_view_.
5989 (File_read::open): Mmap the whole file if needed.
5990 (File_read::open): Use whole_file_view_ instead of contents_.
5991 (File_read::find_view): Use whole_file_view_ if applicable.
5992 (File_read::do_read): Use whole_file_view_ instead of contents_.
5993 (File_read::make_view): Use whole_file_view_ instead of contents_,
5994 update File_read::View::View call.
5995 (File_read::find_or_make_view): Update File_read::View::View
5996 call.
5997 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5998 remove contents_
5999 (File_read::View::Data_ownership): New enum.
6000 (File_read::View::View): Replace bool mapped_ with Data_ownership
6001 argument.
6002 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6003 (File_read::View::data_ownership_): New field.
6004 (File_read::contents_): Remove (replaced by whole_file_view_).
6005 (File_read::whole_file_view_): New field.
6006 * options.h (class General_options): Add --keep-files-mapped.
6007
6008 2009-10-27 Cary Coutant <ccoutant@google.com>
6009
6010 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6011 * testsuite/Makefile.am (plugin_test_5): New test case.
6012 * testsuite/Makefile.in: Regenerate.
6013
6014 2009-10-25 Doug Kwan <dougkwan@google.com>
6015
6016 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6017 from private to protected to allow access by child class.
6018 (Sized_relobj::do_relocate_sections): New method declaration.
6019 (Sized_relobj::relocate_sections): Virtualize.
6020 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6021 Sized_relobj::relocate_sections. Instantiate template explicitly
6022 for different target sizes and endianity.
6023
6024 2009-10-24 Doug Kwan <dougkwan@google.com>
6025
6026 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6027 (Arm_input_section::as_arm_input_section): New method.
6028 (Arm_output_section): New class definition.
6029 (Arm_output_section::create_stub_group,
6030 Arm_output_section::group_sections): New method definitions.
6031
6032 2009-10-22 Doug Kwan <dougkwan@google.com>
6033
6034 * arm.cc (Arm_input_section): New class definition.
6035 (Arm_input_section::init, Arm_input_section:do_write,
6036 Arm_input_section::set_final_data_size,
6037 Arm_input_section::do_reset_address_and_file_offset): New method
6038 definitions.
6039
6040 2009-10-21 Doug Kwan <dougkwan@google.com>
6041
6042 * arm.cc (Stub_table, Arm_input_section): New forward class
6043 declarations.
6044 (Stub_table): New class defintion.
6045 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6046 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6047 New method definition.
6048
6049 2009-10-21 Doug Kwan <dougkwan@google.com>
6050
6051 * arm.cc: Update copyright comments.
6052 (Target_arm): New forward class template declaration.
6053 (Arm_address): New type.
6054 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6055 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6056 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6057 constants.
6058 (Insn_template): Same.
6059 (DEF_STUBS): New macro.
6060 (Stub_type): New enum type.
6061 (Stub_template): New class definition.
6062 (Stub): Same.
6063 (Reloc_stub): Same.
6064 (Stub_factory): Same.
6065 (Target_arm::Target_arm): Initialize may_use_blx_ and
6066 should_force_pic_veneer_.
6067 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6068 Target_arm::should_force_pic_veneer,
6069 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6070 Target_arm::using_thumb_only, Target_arm:;default_target): New
6071 method defintions.
6072 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6073 New data member declarations.
6074 (Insn_template::size, Insn_template::alignment): New method defintions.
6075 (Stub_template::Stub_template): New method definition.
6076 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6077 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6078 (Stub_factory::Stub_factory): New method definition.
6079 * gold.h (string_hash): New template.
6080 * output.h (Input_section_specifier::hash_value): Use
6081 gold::string_hash.
6082 (Input_section_specifier::string_hash): Remove.
6083 * stringpool.cc (Stringpool_template::string_hash): Use
6084 gold::string_hash.
6085
6086 2009-10-20 Doug Kwan <dougkwan@google.com>
6087
6088 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6089 symbols of relaxed input sections.
6090 * output.h (Output_section::find_relaxed_input_section): Make
6091 method public.
6092
6093 2009-10-16 Doug Kwan <dougkwan@google.com>
6094
6095 * dynobj.cc (Versions::Versions): Initialize version_script_.
6096 Only insert base version symbol definition for a shared object
6097 if version script defines any version versions.
6098 (Versions::define_base_version): New method definition.
6099 (Versions::add_def): Check that base version is not needed.
6100 (Versions::add_need): Define base version lazily.
6101 * dynobj.h (Versions::define_base_version): New method declaration.
6102 (Versions::needs_base_version_): New data member declaration.
6103 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6104 (check_DATA): Add no_version_test.stdout.
6105 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6106 New make rules.
6107 * testsuite/Makefile.in: Regenerate.
6108 * testsuite/no_version_test.c: New file.
6109 * testsuite/no_version_test.sh: Ditto.
6110
6111 2009-10-16 Doug Kwan <dougkwan@google.com>
6112
6113 * expression.cc (class Segment_start_expression): New class definition.
6114 (Segment_start_expression::value): New method definition.
6115 (script_exp_function_segment_start): Return a new
6116 Segment_start_expression.
6117 * gold/script-c.h (script_saw_segment_start_expression): New function
6118 prototype.
6119 * script-sections.cc (Script_sections::Script_sections): Initialize
6120 SAW_SEGMENT_START_EXPRESSION_ to false.
6121 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6122 and -Tbbs options to specify section addresses if given in
6123 command line and no SEGMENT_START expression is seen in a script.
6124 * script-sections.h (Script_sections::saw_segment_start_expression,
6125 Script_sections::set_saw_segment_start_expression): New method
6126 definition.
6127 (Script_sections::saw_segment_start_expression_): New data member
6128 declaration.
6129 * script.cc (script_saw_segment_start_expression): New function.
6130 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6131 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6132 script_test_7.sh and script_test_8.sh.
6133 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6134 script_test_8.stdout.
6135 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6136 (script_test_6, script_test_6.stdout, script_test_7,
6137 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6138 * Makefile.in: Regenerate.
6139 * testsuite/script_test_6.sh: New file.
6140 * testsuite/script_test_6.t: Same.
6141 * testsuite/script_test_7.sh: Same.
6142 * testsuite/script_test_7.t: Same.
6143 * testsuite/script_test_8.sh: Same.
6144
6145 2009-10-16 Doug Kwan <dougkwan@google.com>
6146
6147 * output.cc (Output_segment::set_section_list_address): Cast
6148 expressions to unsigned long long type to avoid format warnings.
6149
6150 2009-10-15 Ian Lance Taylor <iant@google.com>
6151
6152 * script.cc (Script_options::add_symbol_assignment): Always add a
6153 dot assignment to script_sections_.
6154 * script-sections.cc (Script_sections::add_dot_assignment):
6155 Initialize if necessary.
6156
6157 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6158 program headers with no load segment if there is a linker script.
6159
6160 * layout.cc (Layout::set_segment_offsets): Align the file offset
6161 to the segment aligment for -N or -n with no load segment.
6162 * output.cc (Output_segment::add_output_section): Don't crash if
6163 the first section is a TLS section.
6164 (Output_segment::set_section_list_addresses): Print an error
6165 message if the address moves backward in a linker script.
6166 * script-sections.cc
6167 (Output_section_element_input::set_section_addresses): Don't
6168 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6169 (Orphan_output_section::set_section_addresses): Likewise.
6170
6171 2009-10-15 Doug Kwan <dougkwan@google.com>
6172
6173 * layout.cc (Layout::finish_dynamic_section): Generate tags
6174 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6175 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6176 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6177
6178 2009-10-14 Ian Lance Taylor <iant@google.com>
6179
6180 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6181 fields.
6182 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6183 data_shdr fields of relinfo.
6184 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6185 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6186 R_386_TLS_LDO_32, adjust based on section flags.
6187 (Target_i386::Relocate::fix_up_ldo): Remove.
6188
6189 2009-10-13 Ian Lance Taylor <iant@google.com>
6190
6191 Add support for -pie.
6192 * options.h (class General_options): Add -pie and
6193 --pic-executable.
6194 (General_options::output_is_position_independent): Test -pie.
6195 (General_options::output_is_executable): Return true if not shared
6196 and not relocatable.
6197 (General_options::output_is_pie): Remove.
6198 * options.cc (General_options::finalize): Reject incompatible uses
6199 of -pie.
6200 * gold.cc (queue_middle_tasks): A -pie link is not static.
6201 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6202 * symtab.cc (Symbol::final_value_is_known): Return false if
6203 output_is_position_independent.
6204 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6205 output_is_position_independent.
6206 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6207 output_is_position_independent.
6208 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6209 output_is_position_independent.
6210 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6211 two_file_pie_test.
6212 (basic_pie_test.o, basic_pie_test): New targets.
6213 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6214 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6215 (two_file_pie_test): New target.
6216 * testsuite/Makefile.in: Rebuild.
6217 * README: Remove note saying that -pie is not supported.
6218
6219 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6220
6221 * options.h (class General_options): Add -init and -fini.
6222 * layout.cc (Layout::finish_dynamic_section): Emit
6223 given init and fini functions.
6224
6225 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6226
6227 * gc.h (gc_process_relocs): Check if icf is enabled using new
6228 function.
6229 * gold.cc (queue_initial_tasks): Likewise.
6230 (queue_middle_tasks): Likewise.
6231 * object.cc (do_layout): Likewise.
6232 * symtab.cc (is_section_folded): Likewise.
6233 * main.cc (main): Likewise.
6234 * reloc.cc (Read_relocs::run): Likewise.
6235 (Sized_relobj::do_scan_relocs): Likewise.
6236 * icf.cc (is_function_ctor_or_dtor): New function.
6237 (Icf::find_identical_sections): Check if function is ctor or dtor when
6238 safe icf is chosen.
6239 * options.h (General_options::icf): Change option to be an enum.
6240 (Icf_status): New enum.
6241 (icf_enabled): New method.
6242 (icf_safe_folding): New method.
6243 (set_icf_status): New method.
6244 (icf_status_): New variable.
6245 * (options.cc) (General_options::finalize): Set icf_status_.
6246 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6247 icf_test and icf_keep_unique_test to use the --icf enum flag.
6248 * testsuite/icf_safe_test.sh: New file.
6249 * testsuite/icf_safe_test.cc: New file.
6250
6251 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6252
6253 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6254 includes to gc.h and icf.h.
6255 * arm.cc: Include gc.h.
6256 * gold.cc: Likewise.
6257 * i386.cc: Likewise.
6258 * powerpc.cc: Likewise.
6259 * sparc.cc: Likewise.
6260 * x86_64.cc: Likewise.
6261 * gc.h: Include icf.h.
6262
6263 2009-10-11 Ian Lance Taylor <iant@google.com>
6264
6265 * plugin.cc: Include "gold.h" before other header files.
6266
6267 2009-10-10 Chris Demetriou <cgd@google.com>
6268
6269 * options.h (Input_file_argument::Input_file_type): New enum.
6270 (Input_file_argument::is_lib_): Replace with...
6271 (Input_file_argument::type_): New member.
6272 (Input_file_argument::Input_file_argument): Take Input_file_type
6273 'type' rather than boolean 'is_lib' as second argument.
6274 (Input_file_argument::is_lib): Use type_.
6275 (Input_file_argument::is_searched_file): New function.
6276 (Input_file_argument::may_need_search): Handle is_searched_file.
6277 * options.cc (General_options::parse_library): Support -l:filename.
6278 (General_options::parse_just_symbols): Update for Input_file_argument
6279 changes.
6280 (Command_line::process): Likewise.
6281 * archive.cc (Archive::get_file_and_offset): Likewise.
6282 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6283 * script.cc (read_script_file, script_add_file): Likewise.
6284 * fileread.cc (Input_file::Input_file): Likewise.
6285 (Input_file::will_search_for): Handle is_searched_file.
6286 (Input_file::open): Likewise.
6287 * readsyms.cc (Read_symbols::get_name): Likewise.
6288 * testsuite/Makefile.am (searched_file_test): New test.
6289 * testsuite/Makefile.in: Regenerate.
6290 * testsuite/searched_file_test.cc: New file.
6291 * testsuite/searched_file_test_lib.cc: New file.
6292
6293 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6294 Ian Lance Taylor <iant@google.com>
6295
6296 * descriptor.cc: Include <cstdio> and "binary-io.h".
6297 (Descriptors::open): Open the files in binary mode always.
6298 * script.cc (Lex::get_token): Treat \r as whitespace.
6299
6300 2009-10-09 Ian Lance Taylor <iant@google.com>
6301
6302 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6303
6304 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6305 Ian Lance Taylor <iant@google.com>
6306
6307 * configure.ac: Check for readv function also.
6308 * fileread.cc (readv): Define if not HAVE_READV.
6309 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6310 does not exist.
6311 * config.in: Regenerate.
6312 * configure: Regenerate.
6313
6314 2009-10-09 Doug Kwan <dougkwan@google.com>
6315
6316 * layout.cc (Layout::make_output_section): Call target hook to make
6317 ordinary output section.
6318 (Layout::finalize): Adjust parameter list of call the
6319 Target::may_relax().
6320 * layout.h (class Layout::section_list): New method.
6321 * merge.h (Output_merge_base::entsize): Change visibility to public.
6322 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6323 New methods.
6324 (Output_merge_string::do_is_string): New method.
6325 * object.cc (Sized_relobj::do_setup): renamed from
6326 Sized_relobj::set_up.
6327 * object.h (Sized_relobj::adjust_shndx,
6328 Sized_relobj::initializ_input_to_output_maps,
6329 Sized_relobj::free_input_to_output_maps): Change visibilities to
6330 protected.
6331 (Sized_relobj::setup): Virtualize.
6332 (Sized_relobj::do_setup): New method declaration.
6333 (Sized_relobj::invalidate_section_offset,
6334 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6335 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6336 * options.cc (parse_int): New function.
6337 * options.h (parse_int): New declaration.
6338 (DEFINE_int): New macro.
6339 (stub_group_size): New option.
6340 * output.cc (Output_section::Output_section): Initialize memebers
6341 merge_section_map_, merge_section_by_properties_map_,
6342 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6343 (Output_section::add_input_section): Handled deferred code-fill
6344 generation and remove an old comment.
6345 (Output_section::add_relaxed_input_section): New method definition.
6346 (Output_section::add_merge_input_section): Use merge section by
6347 properties map to speed to search. Update merge section maps
6348 as appropriate.
6349 (Output_section::build_relaxation_map): New method definition.
6350 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6351 Same.
6352 (Output_section::relax_input_section): Renamed to
6353 Output_section::convert_input_sections_to_relaxed_sections and change
6354 interface to take a vector of pointers to relaxed sections.
6355 (Output_section::find_merge_section,
6356 Output_section::find_relaxed_input_section): New method definitions.
6357 (Output_section::is_input_address_mapped,
6358 Output_section::output_offset, Output_section::output_address):
6359 Use output section data maps to speed up searching.
6360 (Output_section::find_starting_output_address): Add comments.
6361 (Output_section::do_write,
6362 Output_section::write_to_postprocessing_buffer): Do code-fill
6363 generation as appropriate.
6364 (Output_section::get_input_sections): Invalidate relaxed input section
6365 map.
6366 (Output_section::restore_states): Adjust type of checkpoint .
6367 Invalidate relaxed input section map.
6368 * output.h (Output_merge_base): New class declaration.
6369 (Input_section_specifier): New class defintion.
6370 (class Output_relaxed_input_section) Change base class to
6371 Output_section_data_build.
6372 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6373 base class initializer.
6374 (Output_section::add_relaxed_input_section): New method declaration.
6375 (Output_section::Input_section): Change visibility to protected.
6376 (Output_section::Input_section::relobj,
6377 Output_section::Input_section::shndx): Handle relaxed input sections.
6378 Output_section::input_sections) Change visibility to protected. Also
6379 define overload to return a non-const pointer.
6380 (Output_section::Merge_section_properties): New class defintion.
6381 (Output_section::Merge_section_by_properties_map,
6382 Output_section::Output_section_data_by_input_section_map,
6383 Output_section::Relaxation_map): New types.
6384 (Output_section::relax_input_section): Rename method to
6385 Output_section::convert_input_sections_to_relaxed_sections and change
6386 interface to take a vector of relaxed section pointers.
6387 (Output_section::find_merge_section,
6388 Output_section::find_relaxed_input_section,
6389 Output_section::build_relaxation_map,
6390 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6391 New method declarations.
6392 (Output_section::merge_section_map_
6393 Output_section::merge_section_by_properties_map_,
6394 Output_section::relaxed_input_section_map_,
6395 Output_section::is_relaxed_input_section_map_valid_,
6396 Output_section::generate_code_fills_at_write_): New data members.
6397 * script-sections.cc
6398 (Output_section_element_input::set_section_addresses): Call
6399 current_data_size and addralign methods of relaxed input sections.
6400 (Orphan_output_section::set_section_addresses): Call current_data_size
6401 and addralign methods of relaxed input sections.
6402 * symtab.cc (Symbol_table::compute_final_value): Extract template
6403 from the body of Symbol_table::sized_finalize_symbol.
6404 (Symbol_table::sized_finalized_symbol): Call
6405 Symbol_table::compute_final_value.
6406 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6407 (Symbol_table::compute_final_value): New templated method declaration.
6408 * target.cc (Target::do_make_output_section): New method defintion.
6409 * target.h (Target::make_output_section): New method declaration.
6410 (Target::relax): Add more parameters for input objects, symbol table
6411 and layout. Adjust call to do_relax.
6412 (Target::do_make_output_section): New method declaration.
6413 (Target::do_relax): Add parameters for input objects, symbol table
6414 and layout.
6415
6416 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6417
6418 * pread.c: Include stdio.h.
6419
6420 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6421
6422 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6423 defined.
6424
6425 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6426
6427 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6428 Change read_shndx type to unsigned int.
6429 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6430 int.
6431 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6432 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6433 Change read_shndx type to unsigned int.
6434 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6435 int.
6436 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6437 * layout.cc (Layout::create_symtab_sections): Cast the result of
6438 local_symcount * symsize to off_t in the gold_assert.
6439
6440 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6441
6442 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6443 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6444 R_ARM_BASE_ABS.
6445 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6446 (Arm_relocate_functions::thm_abs5): New function.
6447 (Arm_relocate_functions::abs12): New function.
6448 (Arm_relocate_functions::abs16): New function.
6449 (Arm_relocate_functions::base_abs): New function.
6450 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6451 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6452 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6453 R_ARM_BASE_ABS.
6454 (Scan::global): Likewise.
6455 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6456 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6457 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6458 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6459 R_ARM_BASE_ABS.
6460
6461 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6462
6463 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6464 (Arm_relocate_functions::movt_prel): New function.
6465 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6466 (Arm_relocate_functions::thm_movt_prel): New function.
6467 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6468 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6469 (Scan::global, Relocate::relocate): Likewise.
6470 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6471
6472 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6473
6474 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6475 Incremental_checker.
6476 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6477 unsigned int.
6478 (class Incremental_inputs_header): New class.
6479 (Incremental_inputs_header_writer): Edit comment.
6480 (Incremental_inputs_entry): New class.
6481 (Incremental_inputs_entry_writer): Edit comment.
6482 (Sized_incremental_binary::do_find_incremental_inputs_section):
6483 Add *strtab_shndx parameter, fill it.
6484 (Sized_incremental_binary::do_check_inputs): New method.
6485 (Incremental_checker::can_incrementally_link_output_file): Use
6486 Sized_incremental_binary::check_inputs.
6487 (Incremental_inputs::report_command_line): Save command line in
6488 command_line_.
6489 * incremental.h:
6490 (Incremental_binary::find_incremental_inputs_section): New
6491 method.
6492 (Incremental_binary::do_find_incremental_inputs_section): Add
6493 strtab_shndx parameter.
6494 (Incremental_binary::do_check_inputs): New pure virtual method.
6495 (Sized_incremental_binary::do_check_inputs): Declare.
6496 (Incremental_checker::Incremental_checker): Add incremental_inputs
6497 parameter, use it to initialize incremental_inputs_.
6498 (Incremental_checker::incremental_inputs_): New field.
6499 (Incremental_checker::command_line): New method.
6500 (Incremental_checker::inputs): New method.
6501 (Incremental_checker::command_line_): New field.
6502
6503 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6504
6505 * incremental.cc: Include <cstdarg> and "target-select.h".
6506 (vexplain_no_incremental): New function.
6507 (explain_no_incremental): New function.
6508 (Incremental_binary::error): New method.
6509 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6510 method.
6511 (make_sized_incremental_binary): New function.
6512 (open_incremental_binary): New function.
6513 (can_incrementally_link_file): Add checks if output is ELF and has
6514 inputs section.
6515 * incremental.h: Include "elfcpp_file.h" and "output.h".
6516 (Incremental_binary): New class.
6517 (Sized_incremental_binary): New class.
6518 (open_incremental_binary): Declare.
6519 * object.cc (is_elf_object): Use
6520 elfcpp::Elf_recognizer::is_elf_file.
6521 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6522 * output.h (Output_file::filesize): New method.
6523
6524 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6525
6526 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6527 New function.
6528 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6529 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6530 function.
6531 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6532 function.
6533 (Arm_relocate_functions::movw_abs_nc): New function.
6534 (Arm_relocate_functions::movt_abs): New function.
6535 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6536 (Arm_relocate_functions::thm_movt_abs): New function.
6537 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6538 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6539 (Scan::global): Likewise.
6540 (Relocate::relocate): Likewise.
6541 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6542
6543 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6544
6545 * arm.cc (Arm_relocate_functions::got_prel) New function.
6546 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6547 (Relocate::relocate): Likewise.
6548 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6549
6550 2009-10-06 Ian Lance Taylor <iant@google.com>
6551
6552 * options.h (class General_options): Define
6553 split_stack_adjust_size parameter.
6554 * object.h (class Object): Add uses_split_stack_ and
6555 has_no_split_stack_ fields. Add uses_split_stack and
6556 has_no_split_stack accessor functions. Declare
6557 handle_split_stack_section.
6558 (class Reloc_symbol_changes): Define.
6559 (class Sized_relobj): Define Function_offsets. Declare
6560 split_stack_adjust, split_stack_adjust_reltype, and
6561 find_functions.
6562 * object.cc (Object::handle_split_stack_section): New function.
6563 (Sized_relobj::do_layout): Call handle_split_stack_section.
6564 * dynobj.cc (Sized_dynobj::do_layout): Call
6565 handle_split_stack_section.
6566 * reloc.cc (Sized_relobj::relocate_sections): Call
6567 split_stack_adjust for executable sections in split_stack
6568 objects. Pass reloc_map to relocate_section.
6569 (Sized_relobj::split_stack_adjust): New function.
6570 (Sized_relobj::split_stack_adjust_reltype): New function.
6571 (Sized_relobj::find_functions): New function.
6572 * target-reloc.h: Include "object.h".
6573 (relocate_section): Add reloc_symbol_changes parameter. Change
6574 all callers.
6575 * target.h (class Target): Add calls_non_split method. Declare
6576 do_calls_non_split virtual method. Declare match_view and
6577 set_view_to_nop.
6578 * target.cc: Include "elfcpp.h".
6579 (Target::do_calls_non_split): New function.
6580 (Target::match_view): New function.
6581 (Target::set_view_to_nop): New function.
6582 * gold.cc (queue_middle_tasks): Give an error if mixing
6583 split-stack and non-split-stack objects with -r.
6584 * i386.cc (Target_i386::relocate_section): Add
6585 reloc_symbol_changes parameter.
6586 (Target_i386::do_calls_non_split): New function.
6587 * x86_64.cc (Target_x86_64::relocate_section): Add
6588 reloc_symbol_changes parameter.
6589 (Target_x86_64::do_calls_non_split): New function.
6590 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6591 parameter.
6592 * powerpc.cc (Target_powerpc::relocate_section): Add
6593 reloc_symbol_changes parameter.
6594 * sparc.cc (Target_sparc::relocate_section): Add
6595 reloc_symbol_changes parameter.
6596 * configure.ac: Call AM_CONDITIONAL for the default target.
6597 * configure: Rebuild.
6598 * testsuite/Makefile.am (TEST_AS): New variable.
6599 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6600 (check_DATA): Add split_i386 and split_x86_64 files.
6601 (SPLIT_DEFSYMS): Define.
6602 (split_i386_[1234n].o): New targets.
6603 (split_i386_[124]): New targets.
6604 (split_i386_[1234r].stdout): New targets.
6605 (split_x86_64_[1234n].o): New targets.
6606 (split_x86_64_[124]): New targets.
6607 (split_x86_64_[1234r].stdout): New targets.
6608 (MOSTLYCLEANFILES): Add new executables.
6609 * testsuite/split_i386.sh: New file.
6610 * testsuite/split_x86_64.sh: New file.
6611 * testsuite/split_i386_1.s: New file.
6612 * testsuite/split_i386_2.s: New file.
6613 * testsuite/split_i386_3.s: New file.
6614 * testsuite/split_i386_4.s: New file.
6615 * testsuite/split_i386_n.s: New file.
6616 * testsuite/split_x86_64_1.s: New file.
6617 * testsuite/split_x86_64_2.s: New file.
6618 * testsuite/split_x86_64_3.s: New file.
6619 * testsuite/split_x86_64_4.s: New file.
6620 * testsuite/split_x86_64_n.s: New file.
6621 * testsuite/testfile.cc (Target_test): Update relocation_section
6622 function.
6623 * testsuite/Makefile.in: Rebuild.
6624
6625 2009-10-06 Ian Lance Taylor <iant@google.com>
6626
6627 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6628 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6629 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6630 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6631 the address on ldo_addrs_.
6632 (Target_i386::Relocate::fix_up_ldo): New function.
6633
6634 2009-10-06 Rafael Espindola <espindola@google.com>
6635
6636 * plugin.cc (add_input_library): New.
6637 (Plugin::load): Add add_input_library to tv.
6638 (Plugin_manager::add_input_file): Add the is_lib argument.
6639 (add_input_file): Update call to Plugin_manager::add_input_file.
6640 (add_input_library): New.
6641 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6642
6643 2009-09-30 Doug Kwan <dougkwan@google.com>
6644
6645 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6646 symbol and call Symbol::may_need_copy_reloc to determine if
6647 a copy reloc is needed.
6648 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6649 nocopyreloc is given in command line.
6650 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6651 given in command line.
6652 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6653 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6654 of the removed Target_i386::may_need_copy_reloc.
6655 * options.h (copyreloc): New option with default value false.
6656 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6657 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6658 instead of the removed Target_powerpc::may_need_copy_reloc.
6659 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6660 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6661 instead of the removed Target_sparc::may_need_copy_reloc.
6662 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6663 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6664 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6665 instead of the removed Target_x86_64::may_need_copy_reloc.
6666
6667 2009-09-30 Ian Lance Taylor <iant@google.com>
6668
6669 * object.h (class Object): Remove target_ field, and target,
6670 sized_target, and set_target methods.
6671 (Object::sized_target): Remove.
6672 (class Sized_relobj): Update declarations. Remove sized_target.
6673 * object.cc (Sized_relobj::setup): Remove target parameter.
6674 Change all callers.
6675 (Input_objects::add_object): Don't do anything with the target.
6676 (make_elf_sized_object): Add punconfigured parameter. Change all
6677 callers. Set or test parameter target.
6678 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6679 Change all callers.
6680 * parameters.cc (Parameters::set_target): Change parameter type to
6681 be non-const.
6682 (Parameters::default_target): Remove.
6683 (set_parameters_target): Change parameter type to be non-const.
6684 (parameters_force_valid_target): New function.
6685 (parameters_clear_target): New function.
6686 * parameters.h (class Parameters): Update declarations. Remove
6687 default_target method. Add sized_target and clear_target
6688 methods. Change target_ to be non-const.
6689 (set_parameters_target): Update declaration.
6690 (parameters_force_valid_target): Declare.
6691 (parameters_clear_target): Declare.
6692 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6693 as NULL if we aren't searching.
6694 (Add_symbols::run): Don't check for compatible target.
6695 * fileread.cc (Input_file::open_binary): Call
6696 parameters_force_valid_target.
6697 * gold.cc (queue_middle_tasks): Likewise.
6698 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6699 set_target on object.
6700 * dynobj.h (class Sized_dynobj): Update declarations.
6701 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6702 make_elf_object returns NULL.
6703 (Archive::include_member): Don't check whether object target is
6704 compatible.
6705 * output.cc (Output_section::add_input_section): Get target from
6706 parameters.
6707 (Output_section::relax_input_section): Likewise.
6708 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6709 parameters.
6710 (Sized_relobj::do_scan_relocs): Likewise.
6711 (Sized_relobj::relocate_sections): Likewise.
6712 * resolve.cc (Symbol_table::resolve): Likewise.
6713 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6714 parameter. Change all callers.
6715 (Symbol_table::add_from_object): Get target from parameters.
6716 (Symbol_table::add_from_relobj): Don't check object target.
6717 (Symbol_table::add_from_dynobj): Likewise.
6718 (Symbol_table::define_special_symbol): Get target from
6719 parameters.
6720 * symtab.h (class Symbol_table): Update declaration.
6721 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6722 parameter. Change all callers. Clear parameter target.
6723 (Binary_test): Test target here.
6724 * testsuite/object_unittest.cc (gold_testsuite): Remove
6725 target_test_pointer parameter. Change all callers.
6726 (Object_test): Test target here.
6727
6728 2009-09-26 Ian Lance Taylor <iant@google.com>
6729
6730 * testsuite/initpri1.c: Don't try to use constructor priorities if
6731 compiling with gcc before 4.3.
6732
6733 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6734
6735 * testsuite/retain_symbols_file_test.sh (check_present): Change
6736 output file name to retain_symbols_file_test.stdout.
6737 (check_absent): Likewise.
6738
6739 2009-09-18 Craig Silverstein <csilvers@google.com>
6740
6741 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6742 * options.cc: Include <cerrno> and <fstream>.
6743 (General_options::finalize): Parse -retain-symbols-file tag.
6744 * options.h: New flag.
6745 (General_options): New method should_retain_symbol, new
6746 variable symbols_to_retain.
6747 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6748 should_retain_symbol map.
6749 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6750 * testsuite/Makefile.in: Regenerate.
6751 * testsuite/retain_symbols_file_test.sh: New file.
6752
6753 2009-09-18 Nick Clifton <nickc@redhat.com>
6754
6755 * po/es.po: Updated Spanish translation.
6756
6757 2009-09-17 Doug Kwan <dougkwan@google.com>
6758
6759 * debug.h (DEBUG_RELAXATION): New constant.
6760 (DEBUG_ALL): Add DEBUG_RELAXATION.
6761 (debug_string_to_enum): Add relaxation debug option.
6762 * layout.cc
6763 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6764 Layout::Relaxation_debug_check::read_sections,
6765 Layout::Relaxation_debug_check::read_sections): New method definitions.
6766 (Layout::Layout): Initialize data members
6767 record_output_section_data_from_scrips_,
6768 script_output_section_data_list_ and relaxation_debug_check_.
6769 (Layout::save_segments, Layout::restore_segments,
6770 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6771 Layout::relaxation_loop_body): New method definitions.
6772 (Layout::finalize): Support relaxation. Move section layout code to
6773 Layout::relaxation_loop_body.
6774 (Layout::set_asection_address_from_script): Move code for orphan
6775 section placement out.
6776 (Layout::place_orphan_sections_in_script): New method definition.
6777 * layout.h (Output_segment_headers, Output_file_header):
6778 New forward class declarations.
6779 (Layout::~Layout): Define.
6780 (Layout::new_output_section_data_from_script): New method definition.
6781 (Layout::place_orphan_sections_in_script): New method declaration.
6782 (Layout::Segment_states): New type declaration.
6783 (Layout::save_segments, Layout::restore_segments,
6784 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6785 Layout::relaxation_loop_body): New method declarations.
6786 (Layout::Output_section_data_list): New type declaration.
6787 (Layout::Relaxation_debug_check): New class definition.
6788 (Layout::record_output_section_data_from_script_,
6789 Layout::script_output_section_data_list_, Layout::segment_states_,
6790 Layout::relaxation_debug_check_): New data members.
6791 * output.cc: (Output_section_headers::do_size): New method definition.
6792 (Output_section_headers::Output_section_headers): Move size
6793 computation to Output_section_headers::do_size.
6794 (Output_segment_headers::do_size): New method definition.
6795 (Output_file_header::Output_file_header): Move size computation to
6796 Output_file_header::do_size and call it.
6797 (Output_file_header::do_size): New method definition.
6798 (Output_data_group::Output_data_group): Adjust call to
6799 Output_section_data.
6800 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6801 (Output_symtab_xindex::do_write): Add array bound check.
6802 (Output_section::Input_section::print_to_mapfile): Handle
6803 RELAXED_INPUT_SECTION_CODE.
6804 (Output_section::Output_section): Initialize data member checkpoint_.
6805 (Output_section::~Output_section): Delete checkpoint object pointed
6806 by checkpoint_.
6807 (Output_section::add_input_section): Always add an Input_section if
6808 relaxing.
6809 (Output_section::add_merge_input_section): Add assert.
6810 (Output_section::relax_input_section): New method definition.
6811 (Output_section::set_final_data_size): Set load address to zero for
6812 an unallocated section.
6813 (Output_section::do_address_and_file_offset_have_reset_values):
6814 New method definition.
6815 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6816 Handle relaxed input section.
6817 (Output_section::sort_attached_input_sections): Checkpoint input
6818 section list lazily.
6819 (Output_section::get_input_sections): Change type of input_sections to
6820 list of Simple_input_section pointers. Checkpoint input section list
6821 lazily. Also handle relaxed input sections.
6822 (Output_section::add_input_section_for_script): Take a reference to
6823 a Simple_input_section object instead of Relobj pointer and section
6824 index as parameter. Handle relaxed input sections.
6825 (Output_section::save_states, Output_section::restore_states): New
6826 method definitions.
6827 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6828 (Output_data::is_data_size_fixed): New method definition.
6829 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6830 if it is fixed.
6831 (Output_data::address_and_file_offset_have_reset_values): New method
6832 definition.
6833 (Output_data::do_address_and_file_offset_have_reset_values): New method
6834 definition.
6835 (Output_data::set_data_size): Check that data size is not fixed.
6836 (Output_data::fix_data_size): New method definition.
6837 (Output_data::is_data_size_fixed_): New data member.
6838 (Output_section_headers::set_final_data_size): New method definition.
6839 (Output_section_headers::do_size): New method declaration.
6840 (Output_segment_headers::set_final_data_size): New method definition.
6841 (Output_segment_headers::do_size): New method declaration.
6842 (Output_file_header::set_final_data_size)::New method definition.
6843 (Output_file_header::do_size)::New method declaration.
6844 (Output_section_data::Output_section_data): Add new parameter
6845 is_data_size_fixed and use it to fix data size.
6846 (Output_data_const::Output_data_const): Adjust call to base class
6847 constructor and fix data size.
6848 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6849 base class constructor and fix data size.
6850 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6851 base class constructor and fix data size.
6852 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6853 class constructor and fix data size.
6854 (Output_data_group::set_final_data_size): New method definition.
6855 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6856 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6857 class constructor and fix data size.
6858 (Output_relaxed_input_section): New class definition.
6859 (Output_section::Simple_input_section): New class definition.
6860 (Output_section::get_input_sections): Adjust parameter list.
6861 (Output_section::add_input_section_for_script): Same.
6862 (Output_section::save_states, Output_section::restore_states,
6863 Output_section::do_address_and_file_offset_have_reset_values,
6864 (Output_section::Input_section::Input_section): Handle
6865 RELAXED_INPUT_SECTION_CODE. Add new overload for
6866 Output_relaxed_input_section.
6867 (Output_section::Input_section::is_input_section,
6868 Output_section::Input_section::set_output_section): Handle relaxed
6869 input section.
6870 (Output_section::Input_section::is_relaxed_input_section,
6871 Output_section::Input_section::output_section_data,
6872 Output_section::Input_section::relaxed_input_section): New method
6873 definitions.
6874 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6875 value.
6876 (Output_section::Input_section::u1_): Update comments.
6877 (Output_section::Input_section::u2_): Add new union member poris.
6878 (Output_section::Checkpoint_output_section): New classs definition.
6879 (Output_section::relax_input_section): New method declaration.
6880 (Output_section::checkpoint_): New data member.
6881 (Output_segment): Update comments.
6882 (Output_segment::Output_segment): Un-privatize copy constructor.
6883 (Output_segment::operator=): Un-privatize.
6884 * script-sections.cc (Output_section_element::Input_section_list):
6885 Change element type to Output_section::Simple_input_section.
6886 (Output_section_element_dot_assignment::set_section_addresses):
6887 Register output section data for relaxation clean up.
6888 (Output_data_exression::Output_data_expression): Adjust call to base
6889 constructor to fix data size.
6890 (Output_section_element_data::set_section_addresses): Register
6891 Output_data_expression object for relaxation clean up.
6892 (struct Input_section_info): Replace Relobj pointer and section index
6893 pair with Output_section::Simple_input_section and Convert struct to a
6894 class.
6895 (Input_section_sorter::operator()): Adjust access to
6896 Input_section_info data member to use accessors.
6897 (Output_section_element_input::set_section_addresses): Use layout
6898 parameter. Adjust code to use Output_section::Simple_input_section
6899 and Input_secction_info classes. Register filler for relaxation
6900 clean up.
6901 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6902 and section index pair with Output_section::Simple_input_section
6903 class. Adjust code accordingly.
6904 (Phdrs_element::release_segment): New method definition.
6905 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6906 segment list.
6907 (Script_sections::release_segments): New method definition.
6908 * gold/script-sections.h (Script_sections::release_segments): New
6909 method declaration.
6910 * gold/target.h (Target::may_relax, Target::relax,
6911 Target::do_may_relax, Target::do_relax): New method definitions.
6912
6913 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6914
6915 * arm.cc (has_signed_unsigned_overflow): New function.
6916 (Arm_relocate_functions::abs8): New function.
6917 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6918 (Target_arm::Scan::global): Likewise.
6919 (Target_arm::relocate::relocate): Likewise.
6920 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6921 Likewise.
6922
6923 2009-09-16 Cary Coutant <ccoutant@google.com>
6924
6925 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6926 * testsuite/Makefile.in: Regenerate.
6927
6928 2009-09-11 Nick Clifton <nickc@redhat.com>
6929
6930 * po/gold.pot: Updated by the Translation project.
6931
6932 2009-09-08 Cary Coutant <ccoutant@google.com>
6933
6934 * output.cc (Output_file::open): Add execute permission to empty file.
6935 * testsuite/Makefile.am (permission_test): New test.
6936 * testsuite/Makefile.in: Regenerate.
6937
6938 2009-09-02 Ian Lance Taylor <iant@google.com>
6939
6940 * output.cc (Output_file::resize): Call map_no_anonymous rather
6941 than map.
6942
6943 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
6944
6945 * gold.cc: Include "incremental.h".
6946 (queue_initial_tasks): Call Incremental_checker methods.
6947 * incremental.cc: Include "output.h".
6948 (Incremental_checker::can_incrementally_link_output_file): New
6949 method.
6950 * incremental.h (Incremental_checker): New class.
6951
6952 * output.cc (Output_file::open_for_modification): New method.
6953 (Output_file::map_anonymous): Changed return type to bool. Record
6954 map in base_ field.
6955 (Output_file::map_no_anonymous): New method, broken out of map.
6956 (Output_file::map): Use map_no_anonymous and map_anonymous.
6957 * output.h (class Output_file): Update declarations.
6958
6959 2009-08-24 Cary Coutant <ccoutant@google.com>
6960
6961 * options.h (Command_line::Pre_options): New class.
6962 (Command_line::pre_options): New member.
6963 * options.cc (gold::options::ready_to_register): New variable.
6964 (One_option::register_option): Do nothing if not registering options.
6965 Assert if same short option registered twice.
6966 (General_options::General_options): Turn off option registration when
6967 done constructing.
6968 (Command_line::Pre_options::Pre_options): New constructor.
6969
6970 2009-08-24 Cary Coutant <ccoutant@google.com>
6971
6972 * options.h (General_options::no_keep_memory): Remove incorrect
6973 short option.
6974
6975 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6976
6977 * Makefile.am (am__skiplex, am__skipyacc): New.
6978 * Makefile.in: Regenerate.
6979
6980 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6981
6982 * Makefile.am (AM_CPPFLAGS): Renamed from ...
6983 (INCLUDES): ... this.
6984 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6985 (AM_CPPFLAGS): Renamed from ...
6986 (INCLUDE): ... this.
6987 * Makefile.in, testsuite/Makefile.in: Regenerate.
6988
6989 * Makefile.in: Regenerate.
6990 * aclocal.m4: Likewise.
6991 * config.in: Likewise.
6992 * configure: Likewise.
6993 * testsuite/Makefile.in: Likewise.
6994
6995 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6996 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6997 * Makefile.in: Regenerate.
6998 * testsuite/Makefile.in: Regenerate.
6999
7000 2009-08-19 Cary Coutant <ccoutant@google.com>
7001
7002 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7003 symbols in shared libraries overridden by hidden or internal symbols
7004 in the main program.
7005
7006 2009-08-19 Chris Demetriou <cgd@google.com>
7007
7008 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7009 checking source file names in error messages.
7010
7011 2009-08-18 Doug Kwan <dougkwan@google.com>
7012
7013 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7014 an elcpp::Ehdr as parameter. Adjust call to set_target.
7015 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7016 an elfcpp::Ehdr as parameter.
7017 * object.cc (Object::set_target): Remove the version that looks up
7018 a target and sets it.
7019 (Sized_relobj::setup): Take a Target object instead of
7020 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7021 (make_elf_sized_object): Find target and ask target to
7022 make an ELF object.
7023 * object.h: (Object::set_target): Remove the version that looks up
7024 a target and sets it.
7025 (Sized_relobj::setup): Take a Target object instead of
7026 an elfcpp:Ehdr as parameter.
7027 * target.cc: Include dynobj.h.
7028 (Target::do_make_elf_object_implementation): New.
7029 (Target::do_make_elf_object): New.
7030 * target.h (Target::make_elf_object): New template declaration.
7031 (Target::do_make_elf_object): New method declarations.
7032 (Target::do_make_elf_object_implementation): New template declaration.
7033
7034 2009-08-14 Ian Lance Taylor <iant@google.com>
7035
7036 * gold.h (FUNCTION_NAME): Define.
7037 (gold_unreachable): Use FUNCTION_NAME.
7038
7039 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7040
7041 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7042 symbol in the --keep-unique list is not found.
7043
7044 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7045
7046 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7047 been maked as --keep-unique.
7048 (Icf::unfold_section): New function.
7049 * icf.h (Icf::unfold_section): New function.
7050 * options.h (General_options::keep_unique): New option.
7051 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7052 * testsuite/Makefile.in: Regenerate.
7053 * testsuite/icf_keep_unique_test.sh: New file.
7054 * testsuite/icf_keep_unique_test.cc: New file.
7055
7056 2009-08-12 Cary Coutant <ccoutant@google.com>
7057
7058 PR 10471
7059 * resolve.cc (Symbol_table::resolve): Check for references from
7060 dynamic objects to hidden and internal symbols.
7061 * testsuite/Makefile.am (hidden_test.sh): New test.
7062 * testsuite/Makefile.in: Regenerate.
7063 * testsuite/hidden_test.sh: New script.
7064 * testsuite/hidden_test_1.c: New test source.
7065 * testsuite/hidden_test_main.c: New test source.
7066
7067 2009-08-11 Doug Kwan <dougkwan@google.com>
7068
7069 * arm.cc: Update comments.
7070 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7071 segment to locate the .ARM.exidx section if present.
7072
7073 2009-08-09 Doug Kwan <dougkwan@google.com>
7074
7075 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7076 patch.
7077
7078 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7079 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7080 compiler warnings.
7081
7082 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7083
7084 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7085 valid tls_segment only for non-debug-section relocations.
7086 * testsuite/Makefile.am: Add gc_tls_test.
7087 * testsuite/Makefile.in: Regenerate.
7088 * testsuite/gc_tls_test.cc: New file.
7089 * testsuite/gc_tls_test.sh: New file.
7090
7091 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7092
7093 * icf.cc: New file.
7094 * icf.h: New file.
7095 * Makefile.am (CCFILES): Add icf.cc.
7096 (HFILES): Add icf.h
7097 * Makefile.in: Regenerate.
7098 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7099 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7100 section, symbol and addend information for the relocs.
7101 * gold.cc (queue_middle_tasks): Call identical code folding.
7102 * gold.h: Add defines for multimap.
7103 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7104 to the call of finalize_local_symbols.
7105 * main.cc (main): Create object of class Icf.
7106 * object.cc (Sized_relobj::do_layout): Allow this function to be
7107 called twice during icf.
7108 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7109 to sections marked as identical by icf.
7110 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7111 when available.
7112 (Sized_relobj::do_section_entsize): New function.
7113 * object.h (Object::section_entsize): New function.
7114 (Object::do_section_entsize): New pure virtual function.
7115 (Relobj::finalize_local_symbols): Add new parameter.
7116 (Relobj::do_section_entsize): New function.
7117 * options.h (General_options::icf): New option.
7118 (General_options::icf_iterations): New option.
7119 (General_options::print_icf_sections): New option.
7120 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7121 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7122 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7123 icf.
7124 * symtab.cc (Symbol_table::is_section_folded): New function.
7125 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7126 to sections marked as identical by icf.
7127 * symtab.h (Symbol_table::set_icf): New function.
7128 (Symbol_table::icf): New function.
7129 (Symbol_table::is_section_folded): New function.
7130 (Symbol_table::icf_): New data member.
7131 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7132 * testsuite/Makefile.am: Add commands to build icf_test.
7133 * testsuite/Makefile.in: Regenerate.
7134 * testsuite/icf_test.sh: New file.
7135 * testsuite/icf_test.cc: New file.
7136
7137 2009-07-24 Chris Demetriou <cgd@google.com>
7138
7139 * layout.cc (is_compressible_debug_section): Fix incorrect
7140 comment about compressed section names.
7141
7142 2009-07-20 Ian Lance Taylor <ian@airs.com>
7143
7144 PR 10419
7145 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7146
7147 2009-07-16 Ian Lance Taylor <iant@google.com>
7148
7149 PR 10400
7150 * layout.h: #include <map>.
7151 (class Kept_section): Change from struct to class. Add accessors
7152 and setters. Add section size to Comdat_group mapping. Change
7153 Comdat_group to std::map. Add is_comdat_ field. Add
7154 linkonce_size field in union.
7155 (class Layout): Update declaration of find_or_add_kept_section.
7156 Don't declare find_kept_object.
7157 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7158 parameter. Add object, shndx, is_comdat, and is_group_name
7159 parameters. Change all callers. Adjust for new Kept_section.
7160 (Layout::find_kept_object): Remove.
7161 * object.cc (Sized_relobj::include_section_group): Update use of
7162 Kept_section. Rename secnum to shndx. Only record
7163 Kept_comdat_section if sections are the same size.
7164 (Sized_relobj::include_linkonce_section): Update use of
7165 Kept_section. Only record Kept_comdat_section if sections are the
7166 same size. Set size of linkonce section.
7167 (Sized_relobj::map_to_kept_section): Update call to
7168 get_kept_comdat_section.
7169 * object.h (class Sized_relobj): Rename fields in
7170 Kept_comdat_section to drop trailing underscores; change object
7171 field to Relobj*. Change Kept_comdat_section_table to store
7172 struct rather than pointer.
7173 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7174 Add kept_object and kept_shndx parameters. Change all callers.
7175 (Sized_relobj::get_kept_comdat_section): Change return type to
7176 bool. Add kept_object and kept_shndx parameters. Change all
7177 callers.
7178 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7179 Layout::find_or_add_kept_section.
7180
7181 2009-07-09 Ian Lance Taylor <iant@google.com>
7182
7183 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7184 Reserve space in the hash table.
7185
7186 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7187
7188 * fileread.cc (File_read::get_mtime): New method.
7189 * fileread.h (Timespec): New structure.
7190 (File_read::get_mtime): New method.
7191 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7192 Renamed from timestamp_nsec.
7193 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7194 Elf_Xword.
7195 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7196 timestamp_nsec.
7197 (Incremental_inputs::report_archive): Save mtime; style fix.
7198 (Incremental_inputs::report_obejct): Save mtime; style fix.
7199 (Incremental_inputs::report_script): Save mtime; style fix.
7200 (Incremental_inputs::finalize_inputs): Style fix.
7201 (Incremental_inputs::finalize): Style fix.
7202 (Incremental_inputs::create_input_section_data): Store inputs
7203 mtime.
7204 * incremental.h (Incremental_inputs::report_script): Add mtime
7205 argument.
7206 (Incremental_inputs::Input_info::Input_info): Intialize only one
7207 union member.
7208 (Incremental_inputs::Input_info::archive): Move to nameless
7209 union.
7210 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7211 (Incremental_inputs::Input_info::script): Move to nameless union.
7212 (Incremental_inputs::mtime): New field.
7213 * script.cc (read_input_script): Pass file mtime to
7214 Incremental_input.
7215 * script.h (Script_info::inputs): Style fix.
7216
7217 2009-07-01 Ian Lance Taylor <ian@airs.com>
7218
7219 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7220 instead of 32.
7221
7222 2009-06-24 Ian Lance Taylor <iant@google.com>
7223
7224 PR 10156
7225 * layout.cc (Layout::choose_output_section): If we find an
7226 existing section, update the flags.
7227 (Layout::create_notes): New function, broken out of
7228 Layout::finalize.
7229 (Layout::finalize): Don't create note sections.
7230 (Layout::create_note): Don't crash if linker script discards
7231 section.
7232 (Layout::create_gold_note): Likewise.
7233 (Layout::create_build_id): Likewise. Don't set
7234 after_input_sections on the section.
7235 (Layout::create_executable_stack_info): Remove target parameter.
7236 Change caller.
7237 * layout.h (class Layout): Declare create_notes. Update
7238 declaration of create_executable_stack_info.
7239 * gold.cc (queue_middle_tasks): Call create_notes.
7240 * output.cc (Output_section::update_flags_for_input_section): Move
7241 here from output.h. If SHF_ALLOC flag is newly set, mark address
7242 invalid.
7243 * output.h (Output_data::mark_address_invalid): New function.
7244 (class Output_section): Only declare, not define,
7245 update_flags_for_input_section. Remove set_flags.
7246
7247 2009-06-24 Ian Lance Taylor <iant@google.com>
7248
7249 * script-sections.cc (Output_section_definition::
7250 set_section_addresses): Rename shadowing local load_address to
7251 laddr.
7252
7253 2009-06-24 Ian Lance Taylor <iant@google.com>
7254
7255 PR 10244
7256 * reloc.cc (relocate_sections): Skip empty relocation sections.
7257
7258 2009-06-23 Ian Lance Taylor <iant@google.com>
7259
7260 PR 10156
7261 * layout.cc (Layout::create_note): Use choose_output_section
7262 rather than make_output_section.
7263
7264 2009-06-23 Ian Lance Taylor <iant@google.com>
7265
7266 PR 10237
7267 * options.cc (General_options::parse_V): Set printed_version_.
7268 (General_options::General_options): Initialize printed_version_.
7269 * options.h (class General_options): Add printed_version_ field.
7270 * gold.cc (queue_initial_tasks): If there are no input files,
7271 don't give a fatal error if we printed the version information.
7272 (queue_middle_tasks): If using -r with a shared object, give a
7273 fatal error rather than an ordinary error.
7274
7275 2009-06-23 Ian Lance Taylor <iant@google.com>
7276
7277 PR 10219
7278 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7279 (Layout::make_output_section): Set have_stabstr_section_ if we see
7280 a .stab*str section.
7281 (Layout::finalize): Call link_stabs_sections.
7282 (Layout::link_stabs_sections): New file.
7283 * layout.h (class Layout): Add have_stabstr_section_ field.
7284 Declare link_stabs_sections.
7285
7286 2009-06-23 Doug Kwan <dougkwan@google.com>
7287
7288 * Makefile.am (libgold_a_LIBADD): New.
7289 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7290 * Makefile.in: Regenerate.
7291 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7292 * configure: Regenerate.
7293 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7294 * fileread.cc: Include sys/state.h
7295 * gold.h: Declare memmem and strndup if found missing.
7296 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7297
7298 2009-06-23 Ian Lance Taylor <iant@google.com>
7299
7300 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7301 * configure: Rebuild.
7302
7303 2009-06-23 Ian Lance Taylor <iant@google.com>
7304
7305 PR 10147
7306 * object.cc (Object::section_contents): Don't try to get a view if
7307 the section has length zero.
7308 (Object::handle_gnu_warning_section): If the section is empty, use
7309 the name of the section as the warning.
7310
7311 2009-06-23 Ian Lance Taylor <iant@google.com>
7312
7313 PR 10133
7314 * stringpool.h (class Stringpool_template): Add optimize_ field.
7315 (Stringpool_template::set_optimize): New function.
7316 * stringpool.cc (Stringpool_template::Stringpool_template):
7317 Initialize optimize_ field.
7318 (Stringpool_template::set_string_offsets): Test local optimize
7319 fild rather than parameter.
7320 * layout.cc (Layout::Layout): Call set_optimize on the section
7321 name stringpool.
7322
7323 2009-06-22 Ian Lance Taylor <iant@google.com>
7324
7325 PR 10030
7326 * yyscript.y: Parse TARGET.
7327 * script.cc (script_set_target): New function.
7328 * script-c.h (script_set_target): Declare.
7329 * options.cc (General_options::string_to_object_format): Rename
7330 from string_to_object_format in anonymous namespace. Change
7331 callers.
7332 * options.h (class General_options): Declare
7333 string_to_object_format.
7334
7335 2009-06-22 Ian Lance Taylor <iant@google.com>
7336
7337 * script-sections.cc (Script_sections::create_segments): Don't put
7338 program headers in a PT_LOAD segment if -n or -N.
7339
7340 2009-06-22 Ian Lance Taylor <iant@google.com>
7341
7342 PR 10141
7343 * options.h (class General_options): Add -z lazy and -z now. Sort
7344 -z options into alphabetical order.
7345 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7346
7347 2009-06-21 Ian Lance Taylor <iant@google.com>
7348
7349 * layout.cc (Layout::make_output_section): Call
7350 Target::new_output_section.
7351 (Layout::attach_allocated_section_to_segment): Put large section
7352 sections in a separate load segment with the large segment flag
7353 set.
7354 (Layout::segment_precedes): Sort large data segments after other
7355 load segments.
7356 (align_file_offset): New static function.
7357 (Layout::set_segment_offsets): Use align_file_offset.
7358 * output.h (class Output_section): Add is_small_section_ and
7359 is_large_section_ fields.
7360 (Output_section::is_small_section): New function.
7361 (Output_section::set_is_small_section): New function.
7362 (Output_section::is_large_section): New function.
7363 (Output_section::set_is_large_section): New function.
7364 (Output_section::is_large_data_section): New function.
7365 (class Output_segment): Add is_large_data_segment_ field.
7366 (Output_segment::is_large_data_segment): New function.
7367 (Output_segment::set_is_large_data_segment): New function.
7368 * output.cc (Output_section::Output_section): Initialize new
7369 fields.
7370 (Output_segment::Output_segment): Likewise.
7371 (Output_segment::add_output_section): Add assertion that large
7372 data sections always go in large data segments. Force small data
7373 sections to the end of the list of data sections. Force small BSS
7374 sections to the start of the list of BSS sections. For large BSS
7375 sections to the end of the list of BSS sections.
7376 * symtab.h (class Symbol): Declare is_common_shndx.
7377 (Symbol::is_defined): Check Symbol::is_common_shndx.
7378 (Symbol::is_common): Likewise.
7379 (class Symbol_table): Define enum Commons_section_type. Update
7380 declarations. Add small_commons_ and large_commons_ fields.
7381 * symtab.cc (Symbol::is_common_shndx): New function.
7382 (Symbol_table::Symbol_table): Initialize new fields.
7383 (Symbol_table::add_from_object): Put small and large common
7384 symbols in the right list.
7385 (Symbol_table::sized_finalized_symbol): Check
7386 Symbol::is_common_shndx.
7387 (Symbol_table::sized_write_globals): Likewise.
7388 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7389 common symbol lists. Don't call do_allocate_commons_list if the
7390 list is empty.
7391 (Symbol_table::do_allocate_commons_list): Remove is_tls
7392 parameter. Add comons_section_type parameter. Change all
7393 callers. Handle small and large common symbols.
7394 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7395 Symbol::is_common_shndx.
7396 * resolve.cc (symbol_to_bits): Likewise.
7397 * target.h (Target::small_common_shndx): New function.
7398 (Target::small_common_section_flags): New function.
7399 (Target::large_common_shndx): New function.
7400 (Target::large_common_section_flags): New function.
7401 (Target::new_output_section): New function.
7402 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7403 small_common_section_flags, and large_common_section_flags
7404 fields.
7405 (Target::do_new_output_section): New virtual function.
7406 * arm.cc (Target_arm::arm_info): Initialize new fields.
7407 * i386.cc (Target_i386::i386_info): Likewise.
7408 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7409 Likewise.
7410 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7411 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7412 (Target_x86_64::do_new_output_section): New function.
7413 * configure.ac: Define conditional MCMODEL_MEDIUM.
7414 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7415 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7416 (large_LDFLAGS): Define.
7417 * testsuite/large.c: New file.
7418 * testsuite/testfile.cc (Target_test::test_target_info):
7419 Initialize new fields.
7420 * configure, testsuite/Makefile.in: Rebuild.
7421
7422 2009-06-05 Doug Kwan <dougkwan@google.com>
7423
7424 * Makefile.am (CCFILES): Add target.cc.
7425 * Makefile.in: Regenerate.
7426 * i386.cc (class Target_i386): Define new virtual method to
7427 override do_is_local_label_name in parent.
7428 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7429 local symbols if --discard-locals or -X is given.
7430 * options.h (class General_options): Declare new options
7431 '--discard-locals' and '-X' for discarding locals.
7432 * target.h (class Target): Define new methods is_local_label_name.
7433 Declare new virtual method do_is_local_label_name.
7434 * target.cc: New file.
7435 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7436 (check_SCRIPTS): Add discard_locals_test.sh.
7437 (check_DATA): Add discard_local_tests.syms.
7438 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7439 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7440 * testsuite/Makefile.in: Regenerate.
7441 * testsuite/discard_locals_test.c: New file.
7442 * testsuite/discard_locals_test.sh: Same.
7443
7444 2009-06-05 Doug Kwan <dougkwan@google.com>
7445
7446 * object.cc (Sized_relobj::Sized_relobj): Initialize
7447 discarded_eh_frame_shndx_ to -1U.
7448 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7449 section.
7450 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7451 a discarded .eh_frame section.
7452 (Sized_relobj::do_finalize_local_symbols): Ditto.
7453 * object.h (class Sized_relobj): Declare new member
7454 discarded_eh_frame_shndx_.
7455 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7456 (local_labels_test.o, local_labels_test): New rules.
7457 * testsuite/Makefile.in: Regenerate.
7458
7459 2009-06-04 Doug Kwan <dougkwan@google.com>
7460
7461 * layout.cc (Layout::section_name_mapping): Add mapping for
7462 special ARM sections.
7463
7464 2009-06-03 Doug Kwan <dougkwan@google.com>
7465
7466 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7467 (utils::has_overflow): Same.
7468
7469 2009-06-03 Ian Lance Taylor <iant@google.com>
7470
7471 * layout.cc (Layout::section_name_mapping): New array, replacing
7472 Layout::linkonce_mapping.
7473 (Layout::section_name_mapping_count): New variable, replacing
7474 Layout::linkonce_mapping_count.
7475 (Layout::linkonce_output_name): Remove.
7476 (Layout::output_section_name): Rewrite.
7477 * layout.h (class Layout): Rename Linkonce_mapping to
7478 Section_name_mapping, linkonce_mapping to section_name_mapping,
7479 linkonce_mapping_count to section_name_mapping_count. Don't
7480 declare linkonce_output_name.
7481
7482 2009-06-03 Doug Kwan <dougkwan@google.com>
7483
7484 * gold/arm.cc (namespace utils): New.
7485 (Target_arm::reloc_is_non_pic): Define new method.
7486 (class Arm_relocate_functions): New.
7487 (Target_arm::Relocate::relocate): Handle relocation types used by
7488 Android.
7489
7490 2009-06-03 Ian Lance Taylor <iant@google.com>
7491
7492 * arm.cc (Target_arm::scan::global): Use || instead of |.
7493
7494 2009-06-02 Doug Kwan <dougkwan@google.com>
7495
7496 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7497 issued_non_pic_error_.
7498 (class Target_arm::Scan): Declare new method check_non_pic.
7499 Define new method symbol_needs_plt_entry.
7500 Declare new data member issued_non_pic_error_.
7501 (class Target_arm::Relocate): Declare new method
7502 should_apply_static_reloc.
7503 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7504 (Target_arm::Scan::check_non_pic): Define new method.
7505 (Target_arm::Scan::local): Handle a small subset of reloc types used
7506 by Android.
7507 (Target_arm::Scan::local): Same.
7508 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7509
7510 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7511
7512 * incremental.cc (Incremental_inputs::report_command_line): Filter
7513 out --incremental-* options.
7514
7515 2009-05-29 Doug Kwan <dougkwan@google.com>
7516
7517 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7518 template class.
7519 (class Target_arm): Update comment.
7520 (Target_arm::Target_arm): Initialize new data members GOT_,
7521 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7522 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7523 and Target_arm::rel_dyn_section.
7524 Declare new_enum Target_arm::Got_type.
7525 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7526 and DYNBSS_.
7527 Update commments for member do_dynsym_value.
7528 (Target_arm::got_size, Target_arm::plt_section,
7529 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7530 new methods inside class defintion.
7531 (Target_arm::got_section): Define new method.
7532 (Target_arm::rel_dyn_section): Same.
7533 (Output_data_plt_arm): New template class.
7534 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7535 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7536 (Output_data_plt_arm::add_entry): Same.
7537 (Output_data_plt_arm::first_plt_entry): Define new
7538 static data member for PLT instruction template.
7539 (Output_data_plt_arm::plt_entry): Same.
7540 (Output_data_plt_arm::do_write): Define new method.
7541 (Target_arm::make_plt_entry): Same.
7542 (Target_arm::do_finalize_sections): Same.
7543 (Target_arm::do_dynsym_value): Same.
7544
7545 2009-05-28 Doug Kwan <dougkwan@google.com>
7546
7547 * Makefile.am (TARGETSOURCES): Add arm.cc.
7548 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7549 * Makefile.in: Regenerate.
7550 * arm.cc: New file.
7551 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7552
7553 2009-05-26 Doug Kwan <dougkwan@google.com>
7554
7555 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7556 (General_options::check_excluded_libs): Strip off directories in
7557 archive name before matching like GNU ld does.
7558 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7559 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7560 (exclude_libs_test_LDFLAGS): Add linker option
7561 -Wl,--exclude-libs,libexclude_libs_test_3
7562 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7563 an explicit archive without using -l.
7564 (alt/libexclude_libs_test_3.a): New make rule.
7565 * testsuite/Makefile.in: Regenerate.
7566 * testsuite/exclude_libs_test.c : Declare lib3_default().
7567 (main): Call it.
7568 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7569 * exclude_libs_test_3.c: New file.
7570
7571 2009-05-26 Nick Clifton <nickc@redhat.com>
7572
7573 * po/id.po: New Indonesian translation.
7574 * po/gold.pot: Updated template file.
7575
7576 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7577
7578 * testsuite/Makefile.am: Add -ffunction-sections to compile
7579 gc_comdat_test files. Add -Wl,--gc-sections to build
7580 gc_comdat_test.
7581 * testsuite/Makefile.in: Regenerate.
7582 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7583
7584 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7585
7586 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7587 kept comdat section was garbage collected.
7588 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7589 * testsuite/Makefile.in: Regenerate.
7590 * testsuite/gc_comdat_test.sh: New file.
7591 * testsuite/gc_comdat_test_1.cc: New file.
7592 * testsuite/gc_comdat_test_2.cc: New file.
7593
7594 2009-05-19 Doug Kwan <dougkwan@google.com>
7595
7596 * archive.cc (Archive::Archive): Move constructor from archive.h
7597 to here. Initialize no_export_.
7598 (Archive::get_elf_object_for_member): Set no_export flag of object.
7599 * archive.h (Archive::Archive): Move constructor body to
7600 archive.cc.
7601 (Archive::no_export): New method.
7602 (Archive::no_export_): New field.
7603 * object.h (Object::Object): Initialize no_export_ to false.
7604 (Object::no_export, Object::set_no_export): New methods.
7605 (Object::no_export_): New field.
7606 * options.cc (General_options::parse_exclude_libs): New method.
7607 (General_options::check_excluded_libs) Same.
7608 * options.h (exclude_libs): New option.
7609 (General_options::check_excluded_libs): New method declaration.
7610 (General_options::excluded_libs_): New field.
7611 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7612 default or protected visibility if an object has no-export flag set.
7613 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7614 (check_SCRIPTS): Add exclude_libs_test.sh.
7615 (check_DATA): Add exclude_libs_test.syms.
7616 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7617 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7618 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7619 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7620 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7621 libexclude_libs_test_2.a): New rules.
7622 * testsuite/Makefile.in: Regenerate.
7623 * testsuite/exclude_libs_test.c: New file.
7624 * testsuite/exclude_libs_test.sh: Ditto.
7625 * testsuite/exclude_libs_test_1.c: Ditto.
7626 * testsuite/exclude_libs_test_2.c: Ditto.
7627
7628 2009-05-15 Ian Lance Taylor <iant@google.com>
7629
7630 * configure.ac: Check for declarations for cases where libiberty.h
7631 checks HAVE_DECL_xxx.
7632 * configure, config.in: Rebuild.
7633
7634 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7635
7636 * gold.h (Incremental_argument_list): Remove (invalid) forward
7637 declaration.
7638 * incremental.cc (Incremental_inputs::report_achive): New method.
7639 (Incremental_inputs::report_object): New method.
7640 (Incremental_inputs::report_script): New method.
7641 (Incremental_inputs::finalize_inputs): New method.
7642 (Incremental_inputs::finalize): Call finalize_inputs().
7643 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7644 Create inputs entries.
7645 * incremental.h (Incremental_input_type): New enum.
7646 (Incremental_inputs::Incremental_input): Initialize new fields.
7647 (Incremental_inputs::report_inputs): New method.
7648 (Incremental_inputs::report_achive): New method.
7649 (Incremental_inputs::report_object): New method.
7650 (Incremental_inputs::report_script): New method.
7651 (Incremental_inputs::finalize_inputs): New method.
7652 (Incremental_inputs::Input_info): New struct.
7653 (Incremental_inputs::Input_info_map): New typedef.
7654 (Incremental_inputs::lock_): New field.
7655 (Incremental_inputs::Inputs_): New field.
7656 (Incremental_inputs::Inputs_map): New field.
7657 * main.cc (main): Call Incremental_input::report_inputs.
7658 * options.h (Input_argument_list): Typedef moved from
7659 Input_arguments.
7660 (Input_file_group::Files): Remove, use ::Input_argument_list.
7661 (Input_file_group::Input_argument_list): Remove, use
7662 ::Input_argument_list.
7663 * plugin.cc (Plugin_manager::add_input_file): Add error in
7664 incremental build.
7665 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7666 functions.
7667 * script.cc (read_input_script): Call
7668 Incremental_input::report_script.
7669 * script.h (Script_info): New class.
7670
7671 2009-04-27 Ian Lance Taylor <iant@google.com>
7672
7673 * x86_64.cc (do_adjust_output_section): Set entsize to
7674 plt_entry_size.
7675
7676 2009-04-23 Elliott Hughes <enh@google.com>
7677
7678 * output.cc (Output_file::close): After short writes, continue
7679 writing from the correct offset in the buffer being written.
7680
7681 2009-04-23 Chris Demetriou <cgd@google.com>
7682
7683 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7684 * configure: Regenerate.
7685 * config.in: Regenerate.
7686 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7687 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7688
7689 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7690
7691 * incremental.cc (Incremental_inputs_header_data): Renamed from
7692 Incremental_input_header_data.
7693 (Incremental_inputs_header_data::data_size): New field.
7694 (Incremental_inputs_header_data::put_input_file_count): Renamed
7695 from input_file_count.
7696 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7697 from command_line_offset.
7698 (Incremental_inputs_header_data::put_reserved): Renamed from
7699 put_reserved.
7700 (Incremental_inputs_entry_data): Renamed from
7701 Incremental_input_entry_data.
7702 (Incremental_inputs_entry_data::data_size): New field.
7703 (Incremental_inputs::report_command_line): New method.
7704 (Incremental_inputs::finalize): New method.
7705 (Incremental_inputs::create_incremental_inputs_data): New method.
7706 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7707 * incremental.h: New file.
7708 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7709 (Layout::finalize): Create incremental inputs section in
7710 incremental builds.
7711 (Layout::create_incremental_info_sections): New method.
7712 * layout.h (Layout::incremental_inputs): New method.
7713 (Layout::create_incremental_info_sections): New method.
7714 (Layout::incremental_inputs_): New field.
7715 * main.cc (main): Notify Incremental_input of the command line.
7716
7717 2009-04-01 Ian Lance Taylor <iant@google.com>
7718 Mikolaj Zalewski <mikolajz@google.com>
7719
7720 * gold.h (reserve_unordered_map): Define, three versions, one for
7721 each version of Unordered_map.
7722 * layout.cc (Layout::Layout): Remove options parameter. Add
7723 number_of_input_files parameter. Don't initialize options_.
7724 Initialize number_of_input_files_ and resized_signatures_. Move
7725 sections_are_attached_.
7726 (Layout::layout_group): Reserve space for group_signatures_.
7727 (Layout::find_or_add_kept_section): Change name parameter to be a
7728 reference. Resize signatures_ map when it gets large enough.
7729 (Layout::layout_eh_frame): Use parameters->options() instead of
7730 this->options_.
7731 (Layout::make_output_section): Likewise.
7732 (Layout::attach_allocated_section_to_segment): Likewise.
7733 (Layout::finalize, Layout::create_executable_stack): Likewise.
7734 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7735 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7736 * layout.h (class Layout): Update declarations. Remove options_
7737 field. Add number_of_input_files_ and resized_signatures_
7738 fields. Move sections_are_attached_ field.
7739 * main.cc (main): Pass number of input files to Layout
7740 constructor. Don't pass options.
7741
7742 2009-03-30 Ian Lance Taylor <iant@google.com>
7743
7744 * ffsll.c (ffsll): Correct implementation.
7745
7746 2009-03-27 Ian Lance Taylor <iant@google.com>
7747
7748 * ffsll.c: New file.
7749 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7750 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7751 * ftruncate.c (ftruncate): Declare before definition.
7752 * mremap.c (mremap): Likewise.
7753 * pread.c (pread): Likewise.
7754 * configure, Makefile.in, config.in: Rebuild.
7755
7756 * mremap.c: New file.
7757 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7758 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7759 (mremap): Declare if HAVE_MREMAP is not defined.
7760 * configure, Makefile.in, config.in: Rebuild.
7761
7762 2009-03-27 Cary Coutant <ccoutant@google.com>
7763
7764 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7765 position independent.
7766 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7767 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7768
7769 2009-03-24 Cary Coutant <ccoutant@google.com>
7770
7771 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7772 an executable.
7773 (needs_dynamic_reloc): Likewise.
7774
7775 2009-03-24 Ian Lance Taylor <iant@google.com>
7776
7777 * yyscript.y (file_cmd): Recognize EXTERN.
7778 (extern_name_list, extern_name_list_body): New nonterminals.
7779 * script.cc (script_add_extern): Define.
7780 * script-c.h (script_add_extern): Declare.
7781
7782 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
7783
7784 * object.cc (is_elf_object): Define.
7785 * object.h (is_elf_object): Declare.
7786 * archive.cc (Archive::get_elf_object_for_member): Call
7787 is_elf_object.
7788 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7789
7790 2009-03-24 Elliott Hughes <enh@google.com>
7791
7792 * output.cc (Output_file::map_anonymous): Define.
7793 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7794 try an anonymous one. Report the size if the mmap fails.
7795 * output.h (class Output_file): Declare map_anonymous.
7796
7797 2009-03-24 Ian Lance Taylor <iant@google.com>
7798
7799 * target-select.cc (instantiate_target): Don't acquire the lock if
7800 the instantiated_target_ field has already been set.
7801
7802 2009-03-23 Ian Lance Taylor <iant@google.com>
7803
7804 * gold-threads.h (class Initialize_lock): Define.
7805 * gold-threads.cc (class Initialize_lock_once): Define.
7806 (initialize_lock_control): New static variable.
7807 (initialize_lock_pointer): New static variable.
7808 (initialize_lock_once): New static function.
7809 (Initialize_lock::Initialize_lock): Define.
7810 (Initialize_lock::initialize): Define.
7811 * target-select.h: Include "gold-threads.h".
7812 (class Target_selector): Add lock_ and initialize_lock_ fields.
7813 Don't define instantiate_target, just declare it.
7814 * target-select.cc (Target_selector::Target_selector): Initialize
7815 new fields.
7816 (Target_selector::instantiate_target): Define.
7817 * descriptors.h: Include "gold-threads.h".
7818 (class Descriptors): Add initialize_lock_ field.
7819 * descriptors.cc (Descriptors::Descriptors): Initialize new
7820 field.
7821 (Descriptors::open): Use initialize_lock_ field
7822 * errors.h (class Errors): Add initialize_lock_ field.
7823 * errors.cc (Errors::Errors): Initialize new field.
7824 (Errors::initialize_lock): Use initialize_lock_ field.
7825 * powerpc.cc (class Target_selector_powerpc): Remove
7826 instantiated_target_ field. In do_recognize call
7827 instantiate_target rather than do_instantiate_target. In
7828 do_instantiate_target just allocate a new target.
7829 * sparc.cc (class Target_selector_sparc): Likewise.
7830
7831 * freebsd.h: New file.
7832 * i386.cc: Include "freebsd.h".
7833 (Target_i386): Derive from Target_freebsd rather than
7834 Sized_target.
7835 (Target_selector_i386): Derive from Target_selector_freebsd rather
7836 than Target_selector.
7837 * x86_64.cc: Include "freebsd.h".
7838 (Target_x86_64): Derive from Target_freebsd rather than
7839 Sized_target.
7840 (Target_selector_x86_64): Derive from Target_selector_freebsd
7841 rather than Target_selector.
7842 * target.h (class Target): Add adjust_elf_header and
7843 do_adjust_elf_header.
7844 * output.cc (Output_file_header:: do_sized_write): Call target
7845 adjust_elf_header routine.
7846 * configure.tgt: Set targ_osabi.
7847 * configure.ac: Define GOLD_DEFAULT_OSABI.
7848 * parameters.cc (Parameters::default_target): Pass
7849 GOLD_DEFAULT_OSABI to select_target.
7850 * target-select.h (class Target_selector): Make instantiate_target
7851 protected rather than private.
7852 * Makefile.am (HFILES): Add freebsd.h.
7853 * configure, Makefile.in, config.in: Rebuild.
7854
7855 * merge.cc (do_add_input_section): Correct pend value. Change
7856 message about last entry not being null terminated from error to
7857 warning.
7858
7859 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7860
7861 * incremental.cc: New file.
7862 * Makefile.am (CCFILES): Add incremental.cc.
7863 * Makefile.in: Rebuild.
7864
7865 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7866
7867 * layout.cc (Layout::output_section_name): Preserve names
7868 of '.note.' sections.
7869
7870 2009-03-19 Ian Lance Taylor <iant@google.com>
7871
7872 * descriptors.cc (Descriptors::open): Check that the options are
7873 valid before using them.
7874
7875 2009-03-18 Ian Lance Taylor <iant@google.com>
7876
7877 * script-sections.h: Include <list>.
7878 (class Script_sections): Change Sections_elements from std::vector
7879 to std::list. Typedef public Elements_iterator. Add
7880 orphan_section_placement_, data_segment_align_start_, and
7881 saw_data_segment_align_ fields. Remove data_segment_align_index_
7882 field.
7883 * script-sections.cc (class Orphan_section_placement): New class.
7884 (class Sections_element): Add virtual functions is_relro and
7885 orphan_section_init. Remove virtual function place_orphan_here.
7886 (class Output_section_definition): Add is_relro and
7887 orphan_section_init. Remove place_orphan_here.
7888 (class Orphan_output_section): Likewise.
7889 (Script_sections::Script_sections): Update for field changes.
7890 (Script_sections::data_segment_align): Set saw_data_segment_align_
7891 and data_segment_align_start_, not data_segment_align_index.
7892 (Script_sections::data_segment_relro_end): Check
7893 saw_data_segment_align_. Use data_segment_align_start_ rather
7894 than data_segment_align_index_.
7895 (Script_sections::place_orphan): Rewrite to use
7896 Orphan_section_placement.
7897
7898 2009-03-17 Ian Lance Taylor <iant@google.com>
7899
7900 * archive.cc (Archive::add_symbols): Check for a version attached
7901 to the symbol name in the archive map.
7902 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7903 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7904 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7905 (ver_test_11.a): New target.
7906 * testsuite/Makefile.in: Rebuild.
7907
7908 * configure.ac: Check for chsize and posix_fallocate. Replace
7909 ftruncate.
7910 * ftruncate.c: New file, from gnulib.
7911 * output.cc (posix_fallocate): Define dummy version if not
7912 HAVE_POSIX_FALLOCATE.
7913 (Output_file::map): Call posix_fallocate rather than lseek and
7914 write.
7915 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7916 * configure, Makefile.in, config.in: Rebuild.
7917
7918 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
7919
7920 * layout.h (Layout::create_note): Add section_name parameter.
7921 * layout.cc (Layout::create_note): Likewise.
7922 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7923
7924 2009-03-17 Ian Lance Taylor <iant@google.com>
7925
7926 * descriptors.cc: Include "options.h".
7927 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7928 (Descriptors::open): Always use O_CLOEXEC when opening a new
7929 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7930 then set FD_CLOEXEC.
7931
7932 * sparc.cc (class Target_sparc): Add has_got_section.
7933 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7934 make sure we have a GOT section.
7935
7936 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7937 (Target_sparc::Scan::local): Likewise.
7938 (Target_sparc::Scan::global): Likewise.
7939 (Target_sparc::Relocate::relocate): Likewise.
7940 (Target_sparc::Relocate::relocate_tls): Likewise.
7941
7942 * symtab.cc (Symbol_table::define_default_version): New function,
7943 broken out of add_from_object.
7944 (Symbol_table::add_from_object): Call define_default_version.
7945 (Symbol_table::define_special_symbol): Add resolve_oldsym
7946 parameter. Change all callers. If the version for a symbol comes
7947 from a version script, resolve it with the symbol with the same
7948 name with no version. Also add the symbol without a version if
7949 appropriate.
7950 (do_define_in_output_data): If resolving with oldsym, don't delete
7951 sym.
7952 (do_define_in_output_segment): Likewise.
7953 (do_define_as_constant): Likewise.
7954 * symtab.h (class Symbol_table): Update declarations.
7955
7956 2009-03-13 Ian Lance Taylor <iant@google.com>
7957
7958 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7959 (Read_symbols::requeue): New function.
7960 (Read_symbols::do_read_symbols): If make_elf_object fails because
7961 the target type is not configured, and the file was searched for,
7962 issue a warning and retry with the next directory.
7963 (Add_symbols::run): If the file has an incompatible format, and
7964 it was searched for, requeue the Read_symbols task. On error,
7965 release the object.
7966 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
7967 dirindex parameter to constructor. Change all callers. Declare
7968 incompatible_warning and requeue.
7969 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7970 input_argument_ and input_group_ fields. Add them to
7971 constructor. Change all callers.
7972 (class Read_script): Add dirindex_ field. Add it to constructor.
7973 Change all callers.
7974 * archive.cc (Archive::setup): Remove input_objects parameter.
7975 Change all callers.
7976 (Archive::get_file_and_offset): Likewise.
7977 (Archive::read_all_symbols): Likewise.
7978 (Archive::read_symbols): Likewise.
7979 (Archive::get_elf_object_for_member): Remove input_objects
7980 parameter. Add punconfigured parameter. Change all callers.
7981 (Archive::add_symbols): Change return type to bool. Check return
7982 value of include_member.
7983 (Archive::include_all_members): Likewise.
7984 (Archive::include_member): Change return type to bool. Return
7985 false if first included object has incompatible target. Set
7986 included_member_ field.
7987 (Add_archive_symbols::run): If add_symbols returns false, requeue
7988 Read_symbols task.
7989 * archive.h (class Archive): Add included_member_ field.
7990 Initialize it in constructor. Add input_file and searched_for
7991 methods. Update declarations.
7992 (class Add_archive_symbols): Add dirpath_, dirindex_, and
7993 input_argument_ fields. Add them to constructor. Change all
7994 callers.
7995 * script.cc: Include "target-select.h".
7996 (class Parser_closure): Add skip_on_incompatible_target_ and
7997 found_incompatible_target_ fields. Add
7998 skip_on_incompatible_target parameter to constructor. Change all
7999 callers. Add methods skip_on_incompatible_target,
8000 clear_skip_on_incompatible_target, found_incompatible_target, and
8001 set_found_incompatible_target.
8002 (read_input_script): Add dirindex parameter. Change all callers.
8003 If parser finds an incompatible target, requeue Read_symbols
8004 task.
8005 (script_set_symbol): Clear skip_on_incompatible_target in
8006 closure.
8007 (script_add_assertion, script_parse_option): Likewise.
8008 (script_start_sections, script_add_phdr): Likewise.
8009 (script_check_output_format): New function.
8010 * script.h (read_input_script): Update declaration.
8011 * script-c.h (script_check_output_format): Declare.
8012 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8013 (ignore_cmd): Remove OUTPUT_FORMAT.
8014 * fileread.cc (Input_file::Input_file): Add explicit this.
8015 (Input_file::will_search_for): New function.
8016 (Input_file::open): Add pindex parameter. Change all callers.
8017 * fileread.h (class Input_file): Add input_file_argument method.
8018 Declare will_search_for. Update declarations.
8019 * object.cc (make_elf_object): Add punconfigured parameter.
8020 Change all callers.
8021 * object.h (class Object): Make input_file public. Add
8022 searched_for method.
8023 (make_elf_object): Update declaration.
8024 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8025 restart search.
8026 * dirsearch.h (class Dirsearch): Update declaration.
8027 * options.h (class General_options): Add --warn-search-mismatch.
8028 * parameters.cc (Parameters::is_compatible_target): New function.
8029 * parameters.h (class Parameters): Declare is_compatible_target.
8030 * workqueue.cc (Workqueue::add_blocker): New function.
8031 * workqueue.h (class Workqueue): Declare add_blocker.
8032
8033 * fileread.cc (Input_file::open): Remove options parameter.
8034 Change all callers.
8035 (Input_file::open_binary): Likewise.
8036 * script.cc (read_input_script): Likewise.
8037 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8038 options parameter from constructor. Change all callers.
8039 (class Read_script): Likewise.
8040 * fileread.h (class Input_file): Update declarations.
8041 * script.h (read_input_script): Update declaration.
8042
8043 2009-03-10 Nick Clifton <nickc@redhat.com>
8044
8045 * po/es.po: New Spanish translation.
8046
8047 2009-03-06 Cary Coutant <ccoutant@google.com>
8048
8049 * options.cc (parse_short_option): Keep dash_z from registering itself.
8050
8051 2009-03-03 Ian Lance Taylor <iant@google.com>
8052
8053 PR 9918
8054 * target-reloc.h (relocate_section): Pass output_section to
8055 relocate.
8056 * i386.cc (Target_i386::should_apply_static_reloc): Add
8057 output_section parameter. Change all callers.
8058 (Target_i386::Relocate::relocate): Add output_section parameter.
8059 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8060 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8061 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8062 * testsuite/two_file_shared.sh: New script.
8063 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8064 (check_DATA): Add two_file_shared.dbg.
8065 (two_file_shared.dbg): New target.
8066 * testsuite/Makefile.in: Rebuild.
8067
8068 2009-03-01 Ian Lance Taylor <iant@google.com>
8069
8070 * configure.ac: Check for byteswap.h.
8071 * configure: Rebuild.
8072 * config.in: Rebuild.
8073
8074 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8075
8076 * layout.cc (Layout::find_or_add_kept_section): New function.
8077 (Layout::add_comdat): Removed.
8078 * layout.h (struct Kept_section): Move out of class Layout.
8079 Remove trailing underscores from field names. Add group_sections
8080 field. Rename group_ field to is_group. Change all uses.
8081 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8082 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8083 comdat_groups_ field.
8084 (Sized_relobj::include_section_group): Use
8085 find_or_add_kept_section and Kept_section::group_sections.
8086 (Sized_relobj::include_linkonce_section): Likewise.
8087 * object.cc (class Sized_relobj): Don't define Comdat_group or
8088 Comdat_group_table. Remove find_comdat_group and
8089 add_comdat_group. Remove comdat_groups_ field.
8090 * plugin.cc (include_comdat_group): Use
8091 Layout::find_or_add_kept_section.
8092
8093 2009-02-28 Ian Lance Taylor <iant@google.com>
8094
8095 * README: --gc-sections and map files are now supported. Document
8096 some build requirements.
8097
8098 PR 6992
8099 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8100 relocatable link set the value of the section symbol to zero.
8101 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8102 relocatable link don't include the section address in the local
8103 symbol value.
8104
8105 2009-02-27 Ian Lance Taylor <iant@google.com>
8106
8107 PR 6811
8108 * options.h (class Search_directory): Add is_system_directory.
8109 (class General_options): Declare is_in_system_directory.
8110 * options.cc (get_relative_sysroot): Make static.
8111 (get_default_sysroot): Make static.
8112 (General_optoins::is_in_system_directory): New function.
8113 * fileread.cc (Input_file::is_in_system_directory): New function.
8114 * fileread.h (class Input_file): Declare is_in_system_directory.
8115 * object.h (class Object): Add is_in_system_directory.
8116 (class Input_objects): Remove system_library_directory_ field.
8117 * object.cc (Input_objects::add_object): Don't set
8118 system_library_directory_.
8119 (input_objects::found_in_system_library_directory): Remove.
8120 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8121 parameter. Change all callers.
8122 (Symbol_table::sized_write_globals): Likewise.
8123 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8124 Call Object::is_in_system_directory.
8125 * symtab.h (class Symbol_table): Update declarations.
8126
8127 PR 5990
8128 * descriptors.h (Open_descriptor): Add is_on_stack field.
8129 * descriptors.cc (Descriptors::open): If the descriptor is on the
8130 top of the stack, remove it. Initialize is_on_stack field.
8131 (Descriptors::release): Only add pod to stack if it is not on the
8132 stack already.
8133 (Descriptors::close_some_descriptor): Clear stack_next and
8134 is_on_stack fields.
8135
8136 PR 7091
8137 * output.cc (Output_section::find_starting_output_address): Rename
8138 from starting_output_address; add PADDR parameter; change return
8139 type.
8140 * output.h (class Output_section): Declare
8141 find_starting_output_address instead of starting_output_address.
8142 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8143 section symbol for which we can't find a merge section.
8144
8145 PR 9836
8146 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8147 hidden or internal, force the symbol to be local.
8148 * resolve.cc (Symbol::override_visibility): Define.
8149 (Symbol::override_base): Use override_visibility.
8150 (Symbol_table::resolve): Likewise.
8151 (Symbol::override_base_with_special): Likewise.
8152 (Symbol_table::override_with_special): If the visibility is hidden
8153 or internal, force the symbol to be local.
8154 * symtab.h (class Symbol): Add set_visibility and
8155 override_visibility.
8156 * testsuite/ver_test_1.sh: New file.
8157 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8158 (check_DATA): Add ver_test_1.syms.
8159 (ver_test_1.syms): New target.
8160 * testsuite/Makefile.in: Rebuild.
8161
8162 2009-02-25 Cary Coutant <ccoutant@google.com>
8163
8164 * layout.cc (Layout::choose_output_section): Don't rename sections
8165 when using a linker script that has a SECTIONS clause.
8166 * Makefile.in: Regenerate.
8167
8168 * testsuite/Makefile.am (script_test_5.sh): New test case.
8169 * testsuite/Makefile.in: Regenerate.
8170 * testsuite/script_test_5.cc: New file.
8171 * testsuite/script_test_5.sh: New file.
8172 * testsuite/script_test_5.t: New file.
8173
8174 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8175
8176 * archive.cc (Archive::include_member): Update calls to add_symbols.
8177 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8178 the Layout argument.
8179 * dynobj.h (do_add_symbols): Add the Layout argument.
8180 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8181 Layout argument.
8182 * object.h (Object::add_symbols): Add the Layout argument.
8183 (Object::do_add_symbols): Add the Layout argument.
8184 (Sized_relobj::do_add_symbols): Add the Layout argument.
8185 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8186 Unify the two versions.
8187 (Add_plugin_symbols): Remove.
8188 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8189 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8190 (Add_plugin_symbols): Remove.
8191 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8192 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8193 (Add_symbols::run): Make it work with Pulginobj.
8194
8195 2009-02-06 Ian Lance Taylor <iant@google.com>
8196
8197 * object.cc (Sized_relobj::do_layout): Make info message start
8198 with lower case letter.
8199
8200 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8201
8202 * binary.cc: Fix file comment.
8203
8204 * options.h (enum Incremental_disposition): Define.
8205 (class General_options): Add new options: --incremental,
8206 --incremental_changed, --incremental_unchanged,
8207 --incremental_unknown. Add incremental_disposition_ and
8208 implicit_incremental_ fields.
8209 (General_options::incremental_disposition): New function.
8210 (class Position_dependent_options): Add incremental_disposition
8211 option.
8212 (Position_dependent_options::copy_from_options): Set incremental
8213 dispositions.
8214 * options.cc (General_options::parse_incremental_changed): New
8215 function.
8216 (General_options::parse_incremental_unchanged): New function.
8217 (General_options::parse_incremental_unknown): New function.
8218 (General_options::General_options): Initialize new fields
8219 incremental_disposition_ and implicit_incremental_.
8220 (General_options::finalize): Check for uasge of --incremental-*
8221 without --incremental.
8222
8223 2009-02-06 Chris Demetriou <cgd@google.com>
8224
8225 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8226 pointer and to report location as the file name associated with
8227 the symbol.
8228 (gold_undefined_symbol_at_location): New function to replace the
8229 old gold_undefined_symbol functionality.
8230 * target-reloc.h (relocate_section): Update to use
8231 gold_undefined_symbol_at_location.
8232 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8233 Call gold_undefined_symbol function rather than gold_error.
8234 * errors.h (Errors::undefined_symbol): Take location as a
8235 string, rather than calculating it from a relocation.
8236 * errors.cc (Errors::fatal): Print "fatal error:" before the
8237 formatted message.
8238 (Errors::error, Errors::error_at_location): Print "error: "
8239 before the formatted message.
8240 (Errors::undefined_symbol): Take location as a string, rather
8241 than calculating it from a relocation.
8242 (gold_undefined_symbol_at_location): New function akin to
8243 old gold_undefined_symbol, calculates location from relocation.
8244 (gold_undefined_symbol): Change to take only a Symbol pointer
8245 and to report location as the file name associated with the symbol.
8246 * testsuite/debug_msg.sh: Update for changed error messages.
8247 * testsuite/undef_symbol.sh: Likewise.
8248
8249 2009-02-04 Duncan Sands <baldrick@free.fr>
8250
8251 PR 9812
8252 * reduced_debug_output.h
8253 (Output_reduced_debug_abbrev_section::failed): Use format for
8254 gold_warning.
8255 (Output_reduced_debug_info_section::faild): Likewise.
8256
8257 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8258
8259 * script.cc (Lazy_demangler): New class.
8260 (Version_script_info::get_symbol_version_helper): Demangle a
8261 symbol only once.
8262
8263 2009-01-29 Cary Coutant <ccoutant@google.com>
8264
8265 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8266 to __tls_get_addr.
8267 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8268
8269 2009-01-28 Ian Lance Taylor <iant@google.com>
8270
8271 * version.cc (version_string): Bump to 1.9.
8272
8273 * gold.h: Include <cstring> and <stdint.h>.
8274 * version.cc: Include <cstdio>.
8275 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8276 warning.
8277 * reduced_debug_output.cc (insert_into_vector): Rename from
8278 Insert_into_vector; change all callers. Use Swap_unaligned to
8279 avoid aliasing issue; remove union since it is unnecessary.
8280
8281 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8282
8283 * Makefile.am (CCFILES): Add gc.cc.
8284 (HFILES): Add gc.h.
8285 * Makefile.in: Regenerate.
8286 * gold.cc (Gc_runner): New class.
8287 (queue_initial_tasks): Call garbage collection related tasks
8288 when corresponding options are invoked.
8289 (queue_middle_gc_tasks): New function.
8290 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8291 processed early before laying out sections during garbage collection.
8292 * gold.h (queue_middle_gc_tasks): New function.
8293 (is_prefix_of): Move from "layout.cc".
8294 * i386.cc (Target_i386::gc_process_relocs): New function.
8295 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8296 * main.cc (main): Create object of class "Garbage_collection".
8297 * object.cc (Relobj::copy_symbols_data): New function.
8298 (Relobj::is_section_name_included): New function.
8299 (Sized_relobj::do_layout): Allow this function to be called twice
8300 during garbage collection and defer layout of section during the
8301 first call.
8302 * object.h (Relobj::get_symbols_data): New function.
8303 (Relobj::is_section_name_included): New function.
8304 (Relobj::copy_symbols_data): New function.
8305 (Relobj::set_symbols_data): New function.
8306 (Relobj::get_relocs_data): New function.
8307 (Relobj::set_relocs_data): New function.
8308 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8309 (Relobj::gc_process_relocs): New function.
8310 (Relobj::do_gc_process_relocs): New pure virtual function.
8311 (Relobj::sd_): New data member.
8312 (Sized_relobj::is_output_section_offset_invalid): New function.
8313 (Sized_relobj::do_gc_process_relocs): New function.
8314 * options.h (General_options::gc_sections): Modify to not be a no-op.
8315 (General_options::print_gc_sections): New option.
8316 * plugin.cc (Plugin_finish::run): Remove function call to
8317 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8318 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8319 * reloc.cc (Read_relocs::run): Add task to process relocs and
8320 determine unreferenced sections when doing garbage collection.
8321 (Gc_process_relocs): New class.
8322 (Sized_relobj::do_gc_process_relocs): New function.
8323 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8324 sections that are garbage collected.
8325 * reloc.h (Gc_process_relocs): New class.
8326 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8327 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8328 symbols whose corresponding sections are garbage collected.
8329 (Symbol_table::Symbol_table): Add new parameter for the garbage
8330 collection object.
8331 (Symbol_table::gc_mark_undef_symbols): New function.
8332 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8333 (Symbol_table::gc_mark_dyn_syms): New function.
8334 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8335 as garbage.
8336 (Symbol_table::add_from_object): Likewise.
8337 (Symbol_table::add_from_relobj): When building shared objects, do not
8338 treat externally visible symbols as garbage.
8339 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8340 table information for static and relocatable links.
8341 * symtab.h (Symbol_table::set_gc): New function.
8342 (Symbol_table::gc): New function.
8343 (Symbol_table::gc_mark_undef_symbols): New function.
8344 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8345 (Symbol_table::gc_mark_dyn_syms): New function.
8346 (Symbol_table::gc_): New data member.
8347 * target.h (Sized_target::gc_process_relocs): New pure virtual
8348 function.
8349 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8350 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8351
8352 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8353
8354 * options.h (General_options::gc_sections): Define as a no-op for now.
8355 (General_options::no_keep_memory): Ditto.
8356 (General_options::Bshareable): Define.
8357 * options.cc (General_options::finalize): Honor -Bshareable.
8358
8359 2009-01-20 Andreas Schwab <schwab@suse.de>
8360
8361 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8362 read the value in the contents, since we don't use it. Use the
8363 template endianness when writing.
8364 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8365
8366 2009-01-19 Andreas Schwab <schwab@suse.de>
8367
8368 * configure.tgt (powerpc64-*): Fix targ_obj.
8369
8370 2009-01-15 Ian Lance Taylor <iant@google.com>
8371
8372 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8373 local symbols when stripping all symbols.
8374
8375 2009-01-14 Cary Coutant <ccoutant@google.com>
8376
8377 * output.cc (Output_reloc): Add explicit instantiations.
8378
8379 2009-01-14 Cary Coutant <ccoutant@google.com>
8380
8381 * archive.cc (Archive::get_elf_object_for_member): Remove call
8382 to File_read::claim_for_plugin.
8383 * descriptors.cc (Descriptors::open): Remove reference to
8384 is_claimed.
8385 (Descriptors::claim_for_plugin): Remove.
8386 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8387 (Descriptors::is_claimed): Remove.
8388 (claim_descriptor_for_plugin): Remove.
8389 * fileread.cc (File_read::claim_for_plugin): Remove.
8390 * fileread.h (File_read::claim_for_plugin): Remove.
8391 (File_read::descriptor): Reopen descriptor if necessary.
8392 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8393 (Plugin_manager::all_symbols_read): Add task parameter. Change
8394 all callers.
8395 (Plugin_manager::get_input_file): New function.
8396 (Plugin_manager::release_input_file): New function.
8397 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8398 corresponding data member.
8399 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8400 and pass to base constructor. Change all callers.
8401 (get_input_file, release_input_file): New functions.
8402 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8403 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8404 (Plugin_manager::all_symbols_read): Add task parameter.
8405 (Plugin_manager::get_input_file): New function.
8406 (Plugin_manager::release_input_file): New function.
8407 (Plugin_manager::task_): New data member.
8408 (Pluginobj::Pluginobj): Add filesize parameter.
8409 (Pluginobj::filename): New function.
8410 (Pluginobj::descriptor): New function.
8411 (Pluginobj::filesize): New function.
8412 (Pluginobj::filesize_): New data member.
8413 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8414 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8415 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8416
8417 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8418 with archive libraries.
8419 * testsuite/Makefile.in: Regenerate.
8420 * testsuite/plugin_test.c (struct sym_info): New type.
8421 (get_input_file, release_input_file): New static variables.
8422 (onload): Capture new transfer vector entries.
8423 (claim_file_hook): Stop reading at end of file according to filesize.
8424 Factor out parsing of readelf output into separate function.
8425 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8426 APIs and get the source file name from the symbol table. Convert
8427 source file name to corresponding object file name. Print info
8428 message when adding new input files.
8429 (parse_readelf_line): New function.
8430 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8431 * testsuite/plugin_test_2.sh: Likewise.
8432 * testsuite/plugin_test_3.sh: Likewise.
8433 * testsuite/plugin_test_4.sh: New test case.
8434
8435 2009-01-07 Ian Lance Taylor <iant@google.com>
8436
8437 * version.cc (version_string): Bump to 1.8.
8438
8439 2008-12-23 Cary Coutant <ccoutant@google.com>
8440
8441 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8442 * plugin.cc (Plugin_manager::finish): Rename as
8443 layout_deferred_objects. Move cleanup to separate function.
8444 (Plugin_manager::cleanup): New function.
8445 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8446 separately.
8447 * plugin.h (Plugin_manager::finish): Rename as
8448 layout_deferred_objects.
8449 (Plugin_manager::cleanup): New function.
8450 (Plugin_manager::cleanup_done): New field.
8451
8452 2008-12-23 Cary Coutant <ccoutant@google.com>
8453
8454 * plugin.cc (is_visible_from_outside): New function.
8455 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8456 so we don't return "IR only" status for exported symbols or -r links.
8457
8458 * testsuite/Makefile.am (plugin_test_3): New test case.
8459 * testsuite/Makefile.in: Regenerate.
8460 * testsuite/plugin_test_3.sh: New file.
8461
8462 2008-12-22 Cary Coutant <ccoutant@google.com>
8463
8464 * object.cc (Sized_relobj::layout_section): New function.
8465 (Sized_relobj::do_layout): Defer layout of input sections until after
8466 plugin has provided replacement files.
8467 (Sized_relobj::do_layout_deferred_sections): New function.
8468 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8469 (Relobj::layout_deferred_sections): New function.
8470 (Relobj::do_layout_deferred_sections): New function.
8471 (Sized_relobj::do_layout_deferred_sections): New function.
8472 (Sized_relobj::layout_section): New function.
8473 (Sized_relobj::Deferred_layout): New structure.
8474 (Sized_relobj::deferred_layout_): New field.
8475 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8476 Change all callers. Layout deferred sections.
8477 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8478 references.
8479 (Plugin_hook::run): Move code from do_plugin_hook inline.
8480 (Plugin_hook::do_plugin_hook): Remove.
8481 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8482 (Plugin_manager::finish): Renamed, was cleanup.
8483 (Plugin_manager::should_defer_layout): New function.
8484 (Plugin_manager::add_deferred_layout_object): New function.
8485 (Plugin_manager::Deferred_layout_list): New type.
8486 (Plugin_manager::deferred_layout_objects_): New field.
8487 (Plugin_hook::do_plugin_hook): Remove.
8488
8489 2008-12-17 Ian Lance Taylor <iant@google.com>
8490
8491 * options.h (class General_options): Add --no case for
8492 --export-dynamic.
8493
8494 2008-12-16 Cary Coutant <ccoutant@google.com>
8495
8496 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8497 vector.
8498 (Plugin_manager::claim_file): Create plugin object even if
8499 plugin did not call the add_symbols callback.
8500 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8501 asking for more symbols than were added.
8502 * testsuite/Makefile.am (plugin_test_1): Add test case with
8503 no global symbols.
8504 (empty.syms): New target.
8505 * testsuite/Makefile.in: Regenerate.
8506 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8507 message. Don't call add_symbols if no globals.
8508 (all_symbols_read_hook): Don't provide replacement for empty
8509 claimed file.
8510
8511 2008-12-12 Ian Lance Taylor <iant@google.com>
8512
8513 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8514 r_type == 0 for a local symbol with r_sym == 0.
8515 (scan_relocatable_relocs): Pass r_sym to
8516 local_non_section_strategy.
8517 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8518 r_sym parameter.
8519
8520 * configure.ac: Update test for TLS descriptors: they are
8521 supported as of glibc 2.9.
8522 * configure: Rebuild.
8523
8524 2008-12-11 Ian Lance Taylor <iant@google.com>
8525
8526 PR 7091
8527 * target-reloc.h (Default_scan_relocatable_relocs): For each
8528 function, map r_type == 0 to RELOC_DISCARD.
8529
8530 2008-12-10 Cary Coutant <ccoutant@google.com>
8531
8532 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8533 object to override a kept COMDAT group from a plugin object.
8534
8535 2008-12-09 Ian Lance Taylor <iant@google.com>
8536
8537 PR 7088
8538 * yyscript.y (file_cmd): Handle INPUT.
8539
8540 * testsuite/initpri1.c: Change all declarations to be full
8541 prototypes by adding void, to avoid compiler warnings.
8542
8543 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8544
8545 * options.cc (General_options::parse_plugin_opt): New.
8546 (General_options::add_plugin): The argument now is just the filename.
8547 (General_options::add_plugin_option): New.
8548 * options.h (plugin_opt): New.
8549 (add_plugin): Change argument name.
8550 (add_plugin_option): New.
8551 * plugin.cc (Plugin::load): Don't parse the plugin option.
8552 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8553 (Plugin::add_option): New.
8554 (Plugin::args_): Change type.
8555 (Plugin::filename_): New.
8556 (Plugin_manager::add_plugin_option): New.
8557 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8558 * testsuite/Makefile.in: Regenerate.
8559
8560 2008-12-05 Cary Coutant <ccoutant@google.com>
8561
8562 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8563 Handle --strip-lto-sections option.
8564 * options.h (strip_lto_sections): New option.
8565
8566 2008-12-01 Cary Coutant <ccoutant@google.com>
8567
8568 * plugin.cc (ld_plugin_message): Change format parameter to const.
8569 Fix mismatch between new[] and delete.
8570
8571 2008-11-14 Cary Coutant <ccoutant@google.com>
8572
8573 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8574 instead of -1U.
8575
8576 2008-11-05 Craig Silverstein <csilvers@google.com>
8577
8578 * options.cc (General_options::parse_dynamic_list): New function.
8579 * options.h (General_options): New flags dynamic_list,
8580 dynamic_list_data, dynamic_list_cpp_new, and
8581 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8582 (General_options::in_dynamic_list): New function.
8583 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8584 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8585 (Lex::can_continue_name): Likewise.
8586 (yylex): Likewise.
8587 (read_script_file): New parameter script_options.
8588 (read_dynamic_list): New function.
8589 (Script_options::define_dynamic_list): New function.
8590 (dynamic_list_keyword_parsecodes): New variable.
8591 (dynamic_list_keywords): New variable.
8592 * script.h (Script_options::define_dynamic_list): New function
8593 prototype.
8594 (read_dynamic_list): New function prototype.
8595 * symtab.cc (strprefix): New macro.
8596 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8597 dynamic_list_data, dynamic_list_cpp_new, and
8598 dynamic_list_cpp_typeinfo.
8599 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8600 (dynamic_list_expr): New rule.
8601 (dynamic_list_nodes): Likewise.
8602 (dynamic_list_node): Likewise.
8603 * testsuite/Makefile.am (dynamic_list): New test.
8604 * testsuite/Makefile.in: Regenerated.
8605 * testsuite/dynamic_list.t: New file.
8606 * testsuite/dynamic_list.sh: New file.
8607
8608 2008-11-05 Craig Silverstein <csilvers@google.com>
8609
8610 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8611 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8612 (t11_last): Likewise.
8613 * testsuite/ver_test_6.c (main): Likewise.
8614
8615 2008-10-07 Cary Coutant <ccoutant@google.com>
8616
8617 * options.c (General_options::finalize): Add check for -static and
8618 -shared.
8619 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8620 is not empty.
8621
8622 2008-10-02 Cary Coutant <ccoutant@google.com>
8623
8624 * plugin.cc (make_sized_plugin_object): Fix conditional
8625 compilation to work when not all targets are enabled.
8626
8627 2008-09-29 Cary Coutant <ccoutant@google.com>
8628
8629 * archive.cc (Archive::get_file_and_offset): Use filename instead
8630 of name to get library path.
8631 (Archive::include_member): Unlock external member of a thin archive.
8632
8633 * testsuite/Makefile.am (TEST_AR): New variable.
8634 (thin_archive_test_1): New test.
8635 (thin_archive_test_2): New test.
8636 * testsuite/Makefile.in: Regenerate.
8637 * testsuite/thin_archive_main.cc: New file.
8638 * testsuite/thin_archive_test_1.cc: New file.
8639 * testsuite/thin_archive_test_2.cc: New file.
8640 * testsuite/thin_archive_test_3.cc: New file.
8641 * testsuite/thin_archive_test_4.cc: New file.
8642
8643 2008-09-29 Cary Coutant <ccoutant@google.com>
8644
8645 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8646 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8647 instead of -1U.
8648 (Sized_relobj::do_finalize_local_symbols): Likewise.
8649 (Sized_relobj::map_to_kept_section): Likewise.
8650 * object.h (Sized_relobj::invalid_address): New constant.
8651 (Sized_relobj::do_output_section_offset): Check for invalid_address
8652 and return -1ULL.
8653 * output.cc (Output_reloc::local_section_offset): Use constant
8654 invalid_address instead of -1U.
8655 (Output_reloc::get_address): Likewise.
8656 (Output_section::output_address): Change -1U to -1ULL.
8657 * output.h (Output_reloc::invalid_address): New constant.
8658 * reloc.cc (Sized_relobj::write_sections): Use constant
8659 invalid_address instead of -1U.
8660 (Sized_relobj::relocate_sections): Likewise.
8661 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8662 values for merge sections.
8663 * target-reloc.h (relocate_for_relocatable): Use constant
8664 invalid_address instead of -1U.
8665
8666 2008-09-19 Cary Coutant <ccoutant@google.com>
8667
8668 Add plugin functionality for link-time optimization (LTO).
8669 * configure.ac (plugins): Add --enable-plugins option.
8670 * configure: Regenerate.
8671 * config.in: Regenerate.
8672 * Makefile.am (LIBDL): New variable.
8673 (CCFILES): Add plugin.cc.
8674 (HFILES): Add plugin.h.
8675 (ldadd_var): Add LIBDL.
8676 * Makefile.in: Regenerate.
8677
8678 * archive.cc: Include "plugin.h".
8679 (Archive::setup): Don't preread archive symbols when using a plugin.
8680 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8681 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8682 files.
8683 (Archive::include_member): Add symbols from plugin objects.
8684 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8685 * descriptors.cc (Descriptors::open): Check for file descriptors
8686 abandoned by plugins.
8687 (Descriptors::claim_for_plugin): New function.
8688 * descriptors.h (Descriptors::claim_for_plugin): New function.
8689 (Open_descriptor::is_claimed): New field.
8690 (claim_descriptor_for_plugin): New function.
8691 * fileread.cc (File_read::claim_for_plugin): New function.
8692 * fileread.h (File_read::claim_for_plugin): New function.
8693 (File_read::descriptor): New function.
8694 * gold.cc: Include "plugin.h".
8695 (queue_initial_tasks): Add task to call plugin hooks for generating
8696 new object files.
8697 * main.cc: Include "plugin.h".
8698 (main): Load plugin libraries.
8699 * object.h (Pluginobj): Declare.
8700 (Object::pluginobj): New function.
8701 (Object::do_pluginobj): New function.
8702 (Object::set_target): New function.
8703 * options.cc: Include "plugin.h".
8704 (General_options::parse_plugin): New function.
8705 (General_options::General_options): Initialize plugins_ field.
8706 (General_options::add_plugin): New function.
8707 * options.h (Plugin_manager): Declare.
8708 (General_options): Add --plugin option.
8709 (General_options::has_plugins): New function.
8710 (General_options::plugins): New function.
8711 (General_options::add_plugin): New function.
8712 (General_options::plugins_): New field.
8713 * plugin.cc: New file.
8714 * plugin.h: New file.
8715 * readsyms.cc: Include "plugin.h".
8716 (Read_symbols::do_read_symbols): Check for archive before checking
8717 for ELF file. Call plugin hooks to claim files.
8718 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8719 from a real object file; force override when processing replacement
8720 files.
8721 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8722 (Symbol::init_base_object): Likewise.
8723 (Symbol::init_base_output_data): Likewise.
8724 (Symbol::init_base_output_segment): Likewise.
8725 (Symbol::init_base_constant): Likewise.
8726 (Symbol::init_base_undefined): Likewise.
8727 (Symbol::output_section): Assert that object is not a plugin.
8728 (Symbol_table::add_from_pluginobj): New function.
8729 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8730 undefined.
8731 (Symbol_table::sized_write_globals): Likewise.
8732 (Symbol_table::add_from_pluginobj): Instantiate template.
8733 * symtab.h (Sized_pluginobj): Declare.
8734 (Symbol::in_real_elf): New function.
8735 (Symbol::set_in_real_elf): New function.
8736 (Symbol::in_real_elf_): New field.
8737 (Symbol_table::add_from_pluginobj): New function.
8738
8739 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8740 (LIBDL): New variable.
8741 (LDADD): Add LIBDL.
8742 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8743 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8744 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8745 (MOSTLYCLEANFILES): Likewise.
8746 * testsuite/Makefile.in: Regenerate.
8747 * testsuite/plugin_test.c: New file.
8748 * testsuite/plugin_test_1.sh: New file.
8749 * testsuite/plugin_test_2.sh: New file.
8750
8751 2008-09-16 Ian Lance Taylor <iant@google.com>
8752
8753 * target-reloc.h (relocate_section): Check whether a symbol is
8754 defined by the ABI before reporting an undefined symbol error.
8755 * target.h (Target::is_defined_by_abi): Make parameter const.
8756 (Target::do_is_defined_by_abi): Likewise.
8757 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8758 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8759 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8760 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8761 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8762 * testsuite/Makefile.in: Rebuild.
8763
8764 * fileread.cc (make_view): Add casts to avoid warning.
8765
8766 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8767
8768 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8769 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8770
8771 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8772
8773 * options.h (General_options::output_is_executable): New.
8774 (General_options::output_is_pie): New.
8775 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8776 for shared libraries.
8777 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8778
8779 2008-09-11 Chris Demetriou <cgd@google.com>
8780
8781 * options.h (origin): New -z option.
8782 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8783 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8784 in DT_FLAGS_1.
8785
8786 2008-09-05 Cary Coutant <ccoutant@google.com>
8787
8788 * fileread.cc (File_read::make_view): Add check for attempt to map
8789 beyond end of file.
8790
8791 2008-09-05 Cary Coutant <ccoutant@google.com>
8792
8793 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8794 explicit instantiations.
8795
8796 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8797
8798 PR gold/6858
8799 * options.cc (General_options::finalize): Allow undefined symbols
8800 in shlibs if linking -shared.
8801
8802 PR gold/6859
8803 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8804 symbols as not needing a dynsym entry.
8805
8806 2008-08-20 Craig Silverstein <csilvers@google.com>
8807
8808 * fileread.cc (File_read::open): Do not lock the file unless it
8809 was successfully opened.
8810
8811 2008-08-14 Cary Coutant <ccoutant@google.com>
8812
8813 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8814 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8815 * testsuite/tls_test.cc (struct int128): 128-bit struct
8816 for testing TLS relocs with non-zero addend.
8817 (v12): New TLS variable.
8818 (t12): New test.
8819 (t_last): Add check for v12.
8820 * testsuite/tls_test.h (t12): New function.
8821 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8822
8823 2008-08-13 Ian Lance Taylor <iant@google.com>
8824
8825 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8826 set tls_segment_ or relro_segment_.
8827 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8828 when appropriate.
8829 * output.h (Output_section::clear_is_relro): New function.
8830 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8831 sections specially even when output_data_ is empty.
8832 (Output_segment::maximum_alignment): When first section is relro,
8833 only force alignment for PT_LOAD segments.
8834 * script.cc (script_data_segment_align): New function.
8835 (script_data_segment_relro_end): New function.
8836 * script-c.h (script_data_segment_align): Declare.
8837 (script_data_segment_relro_end): Declare.
8838 * script-sections.h (class Script_sections): Declare
8839 data_segment_align and data_segment_relro_end. Add fields
8840 segment_align_index_ and saw_relro_end_.
8841 * script-sections.cc (class Sections_element): Add set_is_relro
8842 virtual function. Add new bool* parameter to place_orphan_here.
8843 Add get_output_section virtual function.
8844 (class Output_section_definition): Add set_is_relro. Add new
8845 bool* parameter to place_orphan_here. Add get_output_section.
8846 Add is_relro_ field.
8847 (Output_section_definition::Output_section_definition): Initialize
8848 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8849 and is_relro_ fields.
8850 (Output_section_definition::place_orphan_here): Add is_relro
8851 parameter.
8852 (Output_section_definition::set_section_addresses): Set relro for
8853 output section.
8854 (Output_section_definition::alternate_constraint): Likewise.
8855 (class Orphan_output_section): Add new bool* parameter to
8856 place_orphan_here. Add get_output_section.
8857 (Orphan_output_section::place_orphan_here): Add is_relro
8858 parameter.
8859 (Script_sections::Script_sections): Initialize
8860 data_segment_align_index_ and saw_relro_end_.
8861 (Script_sections::data_segment_align): New function.
8862 (Script_sections::data_segment_relro_end): New function.
8863 (Script_sections::place_orphan): Set or clear is_relro.
8864 (Script_sections::set_section_addresses): Force alignment of first
8865 TLS section.
8866 * yyscript.y (exp): Call script_data_segment_align and
8867 script_data_segment_relro_end.
8868 * testsuite/relro_script_test.t: New file.
8869 * testsuite/relro_test.cc (using_script): Declare.
8870 (t1, t2): Test using_script.
8871 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8872 (relro_script_test_SOURCES): Define.
8873 (relro_script_test_DEPENDENCIES): Define.
8874 (relro_script_test_LDFLAGS): Define.
8875 (relro_script_test_LDADD): Define.
8876 (relro_script_test.so): New target.
8877 * testsuite/Makefile.in: Rebuild.
8878
8879 2008-08-06 Cary Coutant <ccoutant@google.com>
8880
8881 * archive.cc (Archive::total_archives, Archive::total_members)
8882 (Archive::total_members_loaded): New variables.
8883 (Archive::setup): Add parameter. Add option to preread
8884 archive symbols.
8885 (Archive::read_armap): Add counter.
8886 (Archive::get_file_and_offset): New function.
8887 (Archive::get_elf_object_for_member): New function.
8888 (Archive::read_all_symbols): New function.
8889 (Archive::read_symbols): New function.
8890 (Archive::add_symbols): Add counters.
8891 (Archive::include_all_members): Use armap to find members if it's
8892 already built.
8893 (Archive::include_member): Skip reading symbols if already read.
8894 Factored code into Archive::get_file_and_offset and
8895 Archive::get_elf_object_for_member. Changed call to
8896 Mapfile::report_include_archive_member.
8897 (Archive::print_stats): New function.
8898 * archive.h: Declare Object and Read_symbols_data classes.
8899 (Archive::Archive): Add initializers for new members.
8900 (Archive::setup): Add parameter.
8901 (Archive::print_stats): New function.
8902 (Archive::total_archives, Archive::total_members)
8903 (Archive::total_members_loaded): New variables.
8904 (Archive::get_file_and_offset): New function.
8905 (Archive::get_elf_object_for_member): New function.
8906 (Archive::read_all_symbols): New function.
8907 (Archive::read_symbols): New function.
8908 (Archive::Archive_member): New class.
8909 (Archive::members_): New member.
8910 (Archive::num_members_): New member.
8911 * main.cc: Include archive.h.
8912 (main): Call Archive::print_stats.
8913 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8914 archive parameter; member_name is now the fully-decorated name.
8915 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8916 * options.h: (General_options): Add --preread-archive-symbols option.
8917 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8918 Archive::setup.
8919
8920 2008-08-04 Ian Lance Taylor <iant@google.com>
8921
8922 * symtab.h (Symbol::use_plt_offset): New function.
8923 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8924 * powerpc.cc (Relocate::relocate): Likewise.
8925 * sparc.cc (Relocate::relocate): Likewise.
8926 * x86_64.cc (Relocate::relocate): Likewise.
8927 * testsuite/weak_plt.sh: New test.
8928 * testsuite/weak_plt_main.cc: New test.
8929 * testsuite/weak_plt_shared.cc: New test.
8930 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8931 (check_PROGRAMS): Add weak_plt.
8932 (check_DATA): Add weak_plt_shared.so.
8933 (weak_plt_main_pic.o, weak_plt): New targets.
8934 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8935 * testsuite/Makefile.in: Rebuild.
8936
8937 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8938 gcctestdir/ld.
8939 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8940 * testsuite/Makefile.in: Rebuild.
8941
8942 2008-08-04 Alan Modra <amodra@bigpond.net.au>
8943
8944 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8945 * Makefile.in: Regenerate.
8946 * po/POTFILES.in: Regenerate.
8947
8948 2008-07-29 Ian Lance Taylor <iant@google.com>
8949
8950 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8951 symbols before other symbols.
8952 * testsuite/script_test_2.cc (test_addr): Declare.
8953 (test_addr_alias): Declare.
8954 (main): Check that test_addr and test_addr_alias have the right
8955 values.
8956 * testsuite/script_test_2.t: Define test_addr_alias and
8957 test_addr.
8958
8959 2008-07-24 Ian Lance Taylor <iant@google.com>
8960
8961 PR 5990
8962 * descriptors.cc: New file.
8963 * descriptors.h: New file.
8964 * gold-threads.h (class Hold_optional_lock): New class.
8965 * fileread.cc: Include "descriptors.h".
8966 (File_read::~File_read): Release descriptor rather than closing
8967 it.
8968 (File_read::open) [file]: Call open_descriptor rather than open.
8969 Set is_descriptor_opened_.
8970 (File_read::open) [memory]: Assert that descriptor is not open.
8971 (File_read::reopen_descriptor): New function.
8972 (File_read::release): Release descriptor.
8973 (File_read::do_read): Make non-const. Reopen descriptor.
8974 (File_read::read): Make non-const.
8975 (File_read::make_view): Reopen descriptor.
8976 (File_read::do_readv): Likewise.
8977 * fileread.h (class File_read): Add is_descriptor_opened_ field.
8978 Update declarations.
8979 * layout.cc: Include "descriptors.h".
8980 (Layout::create_build_id): Use open_descriptor rather than open.
8981 * output.cc: Include "descriptors.h".
8982 (Output_file::open): Use open_descriptor rather than open.
8983 * archive.cc (Archive::const_iterator): Change Archive to be
8984 non-const.
8985 (Archive::begin, Archive::end): Make non-const.
8986 (Archive::count_members): Likewise.
8987 * archive.h (class Archive): Update declarations.
8988 * object.h (Object::read): Make non-const.
8989 * Makefile.am (CCFILES): Add descriptors.cc.
8990 (HFILES): Add descriptors.h.
8991 * Makefile.in: Rebuild.
8992
8993 PR 6716
8994 * gold.h: Always include <clocale>. Add Solaris workarounds
8995 following code in binutils/sysdep.h.
8996
8997 PR 6048
8998 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8999 this->eh_frame_hdr_ is NULL before using it.
9000
9001 * dynobj.cc (Versions::Versions): Update comment.
9002
9003 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9004 the base version name.
9005
9006 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9007 array size plus one.
9008 (Stringpool_template::set_string_offsets): Subtract one from key
9009 before using it as an array index.
9010 (Stringpool_template::get_offset_with_length): Likewise.
9011 (Stringpool_template::write_to_buffer): Likewise.
9012 * stringpool.h (Stringpool_template::get_offset_from_key):
9013 Likewise.
9014
9015 2008-07-23 Ian Lance Taylor <iant@google.com>
9016
9017 PR 6658
9018 * object.h (Merged_symbol_value::value): Do our best to handle a
9019 negative addend.
9020
9021 PR 6647
9022 * script.cc (Version_script_info::get_versions): Don't add empty
9023 version tag to return value.
9024 (Version_script_info::get_symbol_version_helper): Change return
9025 type to bool. Add pversion parameter. Change all callers.
9026 (script_register_vers_node): Don't require a non-NULL tag.
9027 * script.h (class Version_script_info): Update declarations.
9028 (Version_script_info::get_symbol_version): Change return type to
9029 bool. Add version parameter. Change all callers.
9030 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9031 handling. Handle an empty version from a version script.
9032 (Symbol_table::define_special_symbol): Likewise.
9033 * testsuite/ver_test_10.script: New file.
9034 * testsuite/ver_test_10.sh: New file.
9035 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9036 (check_DATA): Add ver_test_10.syms.
9037 (ver_test_10.syms, ver_test_10.so): New target.
9038 * testsuite/Makefile.in: Rebuild.
9039
9040 2008-07-23 Simon Baldwin <simonb@google.com>
9041
9042 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9043 to zero for undefined symbols from dynamic libraries.
9044
9045 2008-07-23 Ian Lance Taylor <iant@google.com>
9046
9047 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9048 Change all callers.
9049 * symtab.h (class Symbol_table): Update declaration.
9050 * testsuite/ver_test_9.cc: New file.
9051 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9052 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9053 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9054 (ver_test_9.so, ver_test_9.o): New targets.
9055 * testsuite/Makefile.in: Rebuild.
9056
9057 2008-07-22 Ian Lance Taylor <iant@google.com>
9058
9059 * options.h (class General_options): Define --check-sections.
9060 * layout.cc (Layout::set_segment_offsets): Handle
9061 --check-sections.
9062
9063 * options.h (class General_options): Define -n/--nmagic and
9064 -N/--omagic.
9065 * options.cc (General_options::finalize): For -n/--nmagic or
9066 -N/--omagic, set -static.
9067 * layout.cc (Layout::attach_allocated_section_to_segment): If
9068 -N/--omagic, don't put read-only and read-write sections in
9069 different segments.
9070 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9071 finding a read-only segment.
9072 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9073 don't set the minimum segment alignment to the common page size,
9074 and don't set the file offset to the address modulo the page size.
9075 * script-sections.cc (Script_sections::create_segments): If
9076 -n/--omagic, don't put read-only and read-write sections in
9077 different segments.
9078
9079 * cref.cc: New file.
9080 * cref.h: New file.
9081 * options.h (class General_options): Add --print-symbol-counts.
9082 * main.cc (main): Issue defined symbol report if requested.
9083 * archive.cc (Archive::interpret_header): Make into a const member
9084 function.
9085 (Archive::add_symbols): Call Input_objects::archive_start and
9086 archive_stop.
9087 (Archive::const_iterator): Define new class.
9088 (Archive::begin, Archive::end): New functions.
9089 (Archive::include_all_members): Rewrite to use iterator.
9090 (Archive::count_members): New function.
9091 * archive.h (class Archive): Update declarations.
9092 (Archive::filename): New function.
9093 * object.cc: Include "cref.h".
9094 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9095 (Sized_relobj::do_get_global_symbol_counts): New function.
9096 (Input_objects::add_object): Add object to cross-referencer.
9097 (Input_objects::archive_start): New function.
9098 (Input_objects::archive_stop): New function.
9099 (Input_objects::print_symbol_counts): New function.
9100 * object.h: Declare Cref and Archive.
9101 (Object::get_global_symbol_counts): New function.
9102 (Object::do_get_global_symbol_counts): New pure virtual function.
9103 (class Sized_relobj): Add defined_count_ field. Update
9104 declarations.
9105 (class Input_objects): Add cref_ field. Update constructor.
9106 Update declarations.
9107 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9108 defined_count_.
9109 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9110 symbol counts.
9111 (Sized_dynobj::do_get_global_symbol_counts): New function.
9112 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9113 defined_count_. Update declarations. Define Symbols typedef.
9114 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9115 parameter. Change all callers.
9116 (Symbol_table::add_from_dynobj): Add sympointers and defined
9117 parameters. Change all callers.
9118 * symtab.h (class Symbol_table): Update declarations.
9119 * Makefile.am (CCFILES): Add cref.cc.
9120 (HFILES): Add cref.h.
9121 * Makefile.in: Rebuild.
9122
9123 2008-07-22 Simon Baldwin <simonb@google.com>
9124
9125 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9126 to zero when writing undefined symbols.
9127
9128 2008-07-22 Ian Lance Taylor <iant@google.com>
9129
9130 * output.cc (Output_section::add_input_section): Don't try to
9131 merge empty merge sections.
9132
9133 2008-07-21 Craig Silverstein <csilvers@google.com>
9134
9135 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9136 Include symbol version in error message.
9137
9138 2008-07-20 Chris Demetriou <cgd@google.com>
9139
9140 * configure.ac (gold_cv_c_random_seed): New configured variable.
9141 (RANDOM_SEED_CFLAGS): New substituted variable.
9142 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9143 * configure: Rebuild.
9144 * Makefile.in: Likewise.
9145 * testsuite/Makefile.in: Likewise.
9146
9147 2008-07-18 Ian Lance Taylor <iant@google.com>
9148
9149 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9150 where we see NAME/NULL and NAME/VERSION as separate symbols.
9151 * testsuite/ver_test_main.cc (main): Call t4.
9152 (t4, t4_2a): Define.
9153 * testsuite/ver_test_2.cc (t4_2): Define.
9154 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9155 * testsuite/ver_test_4.cc (t4_2a): Define.
9156 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9157 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9158
9159 2008-07-17 Ian Lance Taylor <iant@google.com>
9160
9161 * dynobj.cc (Versions::add_def): If we give an error about a
9162 missing version, go ahead and create the version anyhow.
9163
9164 2008-07-10 Ian Lance Taylor <iant@google.com>
9165
9166 Handle output sections with more than 0x7fffffff bytes.
9167 * object.h (class Relobj): Change map_to_output_ to
9168 output_sections_, and just keep a section pointer. Change all
9169 uses. Move comdat group support to Sized_relobj.
9170 (Relobj::is_section_specially_mapped): Remove.
9171 (Relobj::output_section): Remove poff parameter. Change all
9172 callers.
9173 (Relobj::output_section_offset): New function.
9174 (Relobj::set_section_offset): Rewrite.
9175 (Relobj::map_to_output): Remove.
9176 (Relobj::output_sections): New function.
9177 (Relobj::do_output_section_offset): New pure virtual function.
9178 (Relobj::do_set_section_offset): Likewise.
9179 (class Sized_relobj): Add section_offsets_ field. Add comdat
9180 group support from Relobj. Update declarations.
9181 (Sized_relobj::get_output_section_offset): New function.
9182 (Sized_relobj::do_output_section_offset): New function.
9183 (Sized_relobj::do_set_section_offset): New function.
9184 * object.cc (Relobj::output_section_address): Remove.
9185 (Sized_relobj::Sized_relobj): Initialize new fields.
9186 (Sized_relobj::include_section_group): Cast find_kept_object to
9187 Sized_relobj.
9188 (Sized_relobj::include_linkonce_section): Likewise.
9189 (Sized_relobj::do_layout): Use separate arrays for output section
9190 and output offset.
9191 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9192 output_sections.
9193 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9194 output_sections and section_offsets.
9195 (Sized_relobj::write_local_symbols): Likewise.
9196 (map_to_kept_section): Compute output address directly.
9197 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9198 output_sections and section_offsets.
9199 (Sized_relobj::write_sections): Likewise.
9200 (Sized_relobj::relocate_sections): Likewise.
9201 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9202 * output.h (class Output_reloc): Update declarations. Change
9203 u2_.relobj to Sized_relobj*.
9204 (class Output_data_reloc): Change add functions to use
9205 Sized_relobj*.
9206 * output.cc (Output_reloc::Output_reloc): Change relobj to
9207 Sized_relobj*.
9208 (Output_reloc::local_section_offset): Change return type to
9209 Elf_Addr. Use get_output_section_offset.
9210 (Output_reloc::get_address): Likewise.
9211 (Output_section::is_input_address_mapped): Don't call
9212 is_section_specially_mapped.
9213 (Output_section::output_offset): Likewise.
9214 (Output_section::output_address): Likewise.
9215 (Output_section::starting_output_address): Likewise.
9216 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9217 parameter to Sized_relobj*.
9218 (Copy_relocs::need_copy_reloc): Likewise.
9219 (Copy_relocs::save): Likewise.
9220 * copy-relocs.h (class Copy_relocs): Update declarations.
9221 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9222 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9223 * target-reloc.h (relocate_for_relocatable): Change
9224 offset_in_output_section type to Elf_Addr. Change code that uses
9225 it as well.
9226 * layout.cc (Layout::layout): Always set *off.
9227 * mapfile.cc (Mapfile::print_input_section): Use
9228 output_section_offset.
9229 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9230 Sized_relobj*.
9231 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9232 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9233 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9234
9235 2008-07-03 Ian Lance Taylor <iant@google.com>
9236
9237 * layout.cc (Layout::include_section): Do not discard unrecognized
9238 SHT_STRTAB sections.
9239
9240 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9241
9242 * script.cc (Lex::can_continue_name): Make '?' allowable in
9243 version-script names.
9244 * testsuite/version_script.map: Change glob pattern to use '?'
9245
9246 2008-06-30 Manish Singh <yosh@gimp.org>
9247
9248 PR 6585
9249 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9250 Correct typo.
9251
9252 2008-06-30 Ian Lance Taylor <iant@google.com>
9253
9254 PR 6660
9255 PR 6682
9256 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9257 versions]: Don't try to read the value in the contents, since we
9258 don't use it. Use the template endianness when writing.
9259
9260 2008-06-25 Cary Coutant <ccoutant@google.com>
9261
9262 * fileread.cc (File_read::make_view): Assert on zero-length view.
9263 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9264 symbol table when there are no symbols to read.
9265
9266 2008-06-23 Craig Silverstein <csilvers@google.com>
9267
9268 * version.cc (version_string): Bump to 1.7
9269
9270 2008-06-18 Craig Silverstein <csilvers@google.com>
9271
9272 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9273 constant 0xFFFF to type Valtype.
9274 (Powerpc_relocate_functions::rel16_ha): Likewise.
9275
9276 2008-06-17 Ian Lance Taylor <iant@google.com>
9277
9278 * output.h (Output_section::Input_section): Initialize p2align_ to
9279 zero for Output_section_data constructors.
9280 (Output_section::Input_section::addralign): If not an input
9281 section, return the alignment of the Output_section_data.
9282 * testsuite/copy_test.cc: New file.
9283 * testsuite/copy_test_1.cc: New file.
9284 * testsuite/copy_test_2.cc: New file.
9285 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9286 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9287 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9288 (copy_test_1_pic.o, copy_test_1.so): New targets.
9289 (copy_test_2_pic.o, copy_test_2.so): New targets.
9290 * testsuite/Makefile.in: Rebuild.
9291
9292 * script-sections.cc (Script_sections::place_orphan): Initialize
9293 local variable exact.
9294
9295 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9296
9297 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9298
9299 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9300 David S. Miller <davem@davemloft.net>
9301
9302 * powerpc.cc: New file.
9303 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9304 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9305 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9306 * Makefile.in: Rebuild.
9307
9308 2008-06-09 Ian Lance Taylor <iant@google.com>
9309
9310 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9311 <exception>.
9312 (throwing, orig_terminate): New static variables.
9313 (terminate_handler): New static function.
9314 (t2): Set terminate handler.
9315
9316 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9317
9318 PR 6584
9319 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9320 alignment.
9321
9322 2008-05-30 Cary Coutant <ccoutant@google.com>
9323
9324 * archive.cc (Archive::include_all_members) Correct to step
9325 over symbol table and extended name table in thin archives.
9326
9327 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9328
9329 PR 6407
9330 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9331 calculation.
9332
9333 2008-05-28 Caleb Howe <cshowe@google.com>
9334
9335 * reduced_debug_output.cc: New file.
9336 * reduced_debug_output.h: New file.
9337 * options.h (class General_options): Add --strip-debug-non-line.
9338 * options.cc (General_options::finalize): Add strip_debug_non_line
9339 to the strip heirarchy.
9340 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9341 fields.
9342 * layout.cc: Include "reduced_debug_output.h".
9343 (Layout::Layout): Initialize new fields.
9344 (line_only_debug_sections): New static array.
9345 (is_lines_only_debug_sections): New static inline function.
9346 (Layout::include_section): Handle --strip-debug-non-line.
9347 (Layout::make_output_section): If --strip-debug-non-line, build
9348 new output sections for .debug_abbrev and .debug_info.
9349 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9350 gold. Warn about possible overflow.
9351 (read_signed_LEB_128): Likewise.
9352 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9353 (read_signed_LEB_128): Declare.
9354 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9355 (HFILES): Add reduced_debug_output.h.
9356 * Makefile.in: Rebuild.
9357
9358 2008-05-21 Ian Lance Taylor <iant@google.com>
9359
9360 * mapfile.cc: New file.
9361 * mapfile.h: New file.
9362 * options.h (class General_options): Add -M/--print-map and -Map.
9363 * options.cc (General_options::finalize): Make -M equivalent to
9364 -Map -.
9365 * main.cc: Include <cstdio> and "mapfile.h".
9366 (main): Open mapfile if requested.
9367 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9368 constructor. Change caller.
9369 (queue_initial_tasks): Add mapfile parameter. Change caller.
9370 (queue_middle_tasks): Likewise.
9371 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9372 declarations.
9373 * archive.cc: Include "mapfile.h".
9374 (Archive::add_symbols): Add mapfile parameter. Change all
9375 callers. Pass mapfile, symbol, and reason to include_member.
9376 (Archive::include_all_members): Add mapfile parameter. Change all
9377 callers.
9378 (Archive::include_member): Add mapfile, sym, and why parameters.
9379 Change all callers. Report inclusion to map file.
9380 * archive.h: Include "fileread.h".
9381 (class Archive): Update declarations.
9382 (Archive::file): New const method.
9383 (class Add_archive_symbols): Add mapfile_ field. Update
9384 constructor. Change all callers.
9385 * readsyms.h (class Read_symbols): Likewise.
9386 (class Finish_group): Likewise.
9387 (class Read_script): Likewise.
9388 * common.cc: Include "mapfile.h".
9389 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9390 all callers.
9391 (Symbol_table::do_allocate_commons): Likewise.
9392 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9393 symbol allocation to mapfile.
9394 * common.h (class Allocate_commons_task): Add mapfile_ field.
9395 Update constructor. Change all callers.
9396 * symtab.h (class Symbol_table): Update declarations.
9397 * layout.cc: Include "mapfile.h".
9398 (Layout_task_runner::run): Print information to mapfile.
9399 (Layout::create_gold_note): Change Output_data_fixed_space to
9400 Output_data_zero_fill.
9401 (Layout::create_build_id): Likewise.
9402 (Layout::print_to_mapfile): New function.
9403 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9404 constructor. Change caller.
9405 (class Layout): Declare print_to_mapfile.
9406 * output.cc (Output_section::Input_section::print_to_mapfile): New
9407 function.
9408 (Output_section::add_input_section): If producing a map, always
9409 add to input_sections_ list.
9410 (Output_section::do_print_to_mapfile): New function.
9411 (Output_segment::print_sections_to_mapfile): New function.
9412 (Output_segment::print_section_list_to_mapfile): New function.
9413 * output.h: Include "mapfile.h".
9414 (Output_data::print_to_mapfile): New function.
9415 (Output_data::do_print_to_mapfile): New virtual function.
9416 (Output_segment_headers::do_print_to_mapfile): New function.
9417 (Output_file_header::do_print_to_mapfile): New function.
9418 (Output_data_const::do_print_to_mapfile): New function.
9419 (class Output_data_const_buffer): Add map_name_ field. Update
9420 constructor. Change all callers. Add do_print_to_mapfile
9421 function.
9422 (class Output_data_fixed_space): Likewise.
9423 (class Output_data_space): Likewise.
9424 (class Output_data_zero_fill): New class.
9425 (Output_data_strtab::do_print_to_mapfile): New function.
9426 (Output_data_reloc_base::do_print_to_mapfile): New function.
9427 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9428 (Output_data_group::do_print_to_mapfile): New function.
9429 (Output_data_got::do_print_to_mapfile): New function.
9430 (Output_data_dynamic::do_print_to_mapfile): New function.
9431 (Output_symtab_xindex::do_print_to_mapfile): New function.
9432 (class Output_section): Declare do_print_to_mapflie. Declare
9433 print_to_mapfile in Input_section.
9434 (class Output_segment): Declare new functions.
9435 * object.h (Sized_relobj::symbol_count): New function.
9436 * script-sections.cc
9437 (Output_section_element_dot_assignment::set_section_addresses):
9438 Change Output_data_fixed_space to Output_data_zero_fill.
9439 (Output_data_expression::do_print_to_mapfile): New function.
9440 * script.cc (read_input_script): Add mapfile parameter. Change
9441 all callers.
9442 * script.h (read_input_script): Update declaration.
9443 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9444 (Eh_frame::do_print_to_mapfile): New function.
9445 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9446 (Output_merge_string::do_print_to_mapfile): New function.
9447 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9448 function.
9449 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9450 function.
9451 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9452 function.
9453 * Makefile.am (CCFILES): Add mapfile.cc.
9454 (HFILES): Add mapfile.h.
9455 * Makefile.in: Rebuild.
9456
9457 2008-05-19 Ian Lance Taylor <iant@google.com>
9458
9459 * options.h (class General_options): Add -z relro.
9460 * layout.cc (Layout::Layout): Initialize relro_segment_.
9461 (Layout::add_output_section_data): Return the output section.
9462 (Layout::make_output_section): Rcognize relro sections and mark
9463 them appropriately.
9464 (Layout::attach_allocated_section_to_segment): Put relro sections
9465 in a PT_GNU_RELRO segment.
9466 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9467 section as relro.
9468 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9469 PT_TLS segments.
9470 (Layout::linkonce_mapping): Map d.rel.ro.local to
9471 .data.rel.ro.local.
9472 (Layout::output_section_name): Us .data.rel.ro.local for any
9473 section which begins with that.
9474 * layout.h (class Layout): Update add_output_section_data
9475 declaration. Add relro_segment_ field.
9476 * output.cc (Output_section::Output_section): Initialize is_relro_
9477 and is_relro_local_ fields.
9478 (Output_segment::add_output_section): Group relro sections.
9479 (Output_segment::is_first_section_relro): New function.
9480 (Output_segment::maximum_alignment): If there is a relro section,
9481 align the segment to the common page size.
9482 (Output_segment::set_section_addresses): Track whether we are
9483 looking at relro sections. If the last section is a relro
9484 section, align to the common page size.
9485 (Output_segment::set_section_list_addresses): Add in_relro
9486 parameter. Change all callers. Align to the page size when
9487 moving from relro to non-relro section.
9488 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9489 segment.
9490 * output.h (class Output_section): Add is_relro_ and
9491 is_relro_local_ fields.
9492 (Output_section::is_relro): New function.
9493 (Output_section::set_is_relro): New function.
9494 (Output_section::is_relro_local): New function.
9495 (Output_section::set_is_relro_local): New function.
9496 (class Output_segment): Update declarations.
9497 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9498 * sparc.cc (Target_sparc::got_section): Likewise.
9499 * x86_64.cc (Target_x86_64::got_section): Likewise.
9500 * testsuite/relro_test_main.cc: New file.
9501 * testsuite/relro_test.cc: New file.
9502 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9503 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9504 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9505 (relro_test.so, relro_test_pic.o): New targets.
9506 * testsuite/Makefile.in: Rebuild.
9507
9508 2008-05-16 Ian Lance Taylor <iant@google.com>
9509
9510 * output.cc (Output_segment::add_output_section): Remove front
9511 parameter.
9512 * output.h (class Output_segment): Remove
9513 add_initial_output_section and overloaded add_output_section.
9514 Update declaration of remaining add_output_section.
9515 * layout.cc (Layout::create_interp): Call add_output_section
9516 rather than add_initial_output_section.
9517 (Layout::finish_dynamic_section): Likewise.
9518
9519 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9520 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9521 know the dynamic type.
9522 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9523 field. Initialize it in constructor.
9524 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9525 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9526 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9527 reloc.
9528
9529 * output.cc (Output_reloc::get_address): Change return type to
9530 Elf_Addr.
9531 * output.h (class Output_reloc): Update get_address declaration.
9532 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9533 for section addresses.
9534
9535 2008-05-09 Ian Lance Taylor <iant@google.com>
9536
9537 PR 6493
9538 * gold.cc (gold_nomem): Use return value of write.
9539
9540 2008-05-08 Ian Lance Taylor <iant@google.com>
9541
9542 * symtab.c (Symbol::init_base_output_data): Add version
9543 parameter. Change all callers.
9544 (Symbol::init_base_output_segment): Likewise.
9545 (Symbol::init_base_constant): Likewise.
9546 (Symbol::init_base_undefined): Likewise.
9547 (Sized_symbol::init_output_data): Likewise.
9548 (Sized_symbol::init_output_segment): Likewise.
9549 (Sized_symbol::init_constant): Likewise.
9550 (Sized_symbol::init_undefined): Likewise.
9551 (Symbol_table::do_define_in_output_data): If the new symbol has a
9552 version, mark it as the default.
9553 (Symbol_table::do_define_in_output_segment): Likewise.
9554 (Symbol_table::do_define_as_constant): Likewise.
9555 * symtab.h (class Symbol): Update declarations.
9556 (class Sized_symbol): Likewise.
9557 * resolve.cc (Symbol::override_version): New function.
9558 (Symbol::override_base): Call override_version.
9559 (Symbol::override_base_with_special): Likewise.
9560 * testsuite/ver_script_8.script: New file.
9561 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9562 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9563 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9564 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9565
9566 2008-05-06 Ian Lance Taylor <iant@google.com>
9567
9568 PR 6049
9569 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9570 functions.
9571 (class General_options): Remove existing --undefined, and add
9572 --no-undefined instead. Add new --undefined as synonym for -u.
9573 * archive.cc (Archive::add_symbols): Check whether symbol was
9574 named with -u.
9575 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9576 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9577 all uses. Add IS_UNDEFINED. Update declarations to split
9578 different versions of init_base. Declare init_base_undefined.
9579 (Symbol::is_defined): Handle IS_UNDEFINED.
9580 (Symbol::is_undefined): Likewise.
9581 (Symbol::is_weak_undefined): Call is_undefined.
9582 (Symbol::is_absolute): Handle IS_CONSTANT.
9583 (class Sized_symbol): Update declarations to split different
9584 versions of init. Declare init_undefined.
9585 (class Symbol_table): Declare new functions.
9586 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9587 Change all callers.
9588 (Symbol::init_base_output_data): Likewise.
9589 (Symbol::init_base_output_segment): Likewise.
9590 (Symbol::init_base_constant): Likewise.
9591 (Symbol::init_base_undefined): New function.
9592 (Sized_symbol::init_object): Rename from init. Change all
9593 callers.
9594 (Sized_symbol::init_output_data): Likewise.
9595 (Sized_symbol::init_output_segment): Likewise.
9596 (Sized_symbol::init_constant): Likewise.
9597 (Sized_symbol::init_undefined): New function.
9598 (Symbol_table::add_undefined_symbols_from_command_line): New
9599 function.
9600 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9601 function.
9602 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9603 (Symbol::output_section): Likewise.
9604 (Symbol::set_output_section): Likewise.
9605 (Symbol_table::sized_finalize_symbol): Likewise.
9606 (Symbol_table::sized_write_globals): Likewise.
9607 * resolve.cc (Symbol_table::should_override): Likewise.
9608 (Symbol::override_base_with_special): Likewise.
9609
9610 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9611 symbol, change it to have default visibility.
9612 * testsuite/protected_1.cc: New file.
9613 * testsuite/protected_2.cc: New file.
9614 * testsuite/protected_3.cc: New file.
9615 * testsuite/protected_main_1.cc: New file.
9616 * testsuite/protected_main_2.cc: New file.
9617 * testsuite/protected_main_3.cc: New file.
9618 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9619 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9620 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9621 (protected_1.so): New target.
9622 (protected_1_pic.o, protected_2_pic.o): New targets.
9623 (protected_3_pic.o): New target.
9624 (check_PROGRAMS): Add protected_2.
9625 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9626 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9627 * testsuite/Makefile.in: Rebuild.
9628
9629 * options.h (DEFINE_var): Add set_user_set_##varname__.
9630 (DEFINE_bool_alias): New macro.
9631 (class General_options): Define -Bstatic using DEFINE_bool_alias
9632 rather than DEFINE_special. Add --undefined as an alias for -z
9633 defs.
9634 * options.cc (General_options::parse_Bstatic): Remove.
9635
9636 * options.h (class General_options): Add --fatal-warnings.
9637 * main.cc (main): Implement --fatal-warnings.
9638 * errors.h (Errors::warning_count): New function.
9639
9640 * options.h (class General_options): Add -Bsymbolic-functions.
9641 * symtab.h (Symbol::is_preemptible): Check for
9642 -Bsymbolic-functions.
9643
9644 2008-05-05 Ian Lance Taylor <iant@google.com>
9645
9646 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9647 as noVARNAME rather than no-VARNAME.
9648 (class General_options): Add option -z combreloc.
9649 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9650 get_address.
9651 (Output_reloc::sort_before) [SHT_REL]: New function.
9652 (Output_reloc::sort_before) [SHT_RELA]: New function.
9653 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9654 Sort_relocs_comparison.
9655 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9656 parameter. Change all callers.
9657 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9658 sort_relocs parameter. Change all callers.
9659 * output.cc (Output_reloc::get_address): New function, broken out
9660 of write_rel.
9661 (Output_reloc::write_rel): Call it.
9662 (Output_reloc::compare): New function.
9663 (Output_data_reloc_base::do_write): Optionally sort relocs.
9664
9665 * configure.ac: If targ_extra_obj is set, link it in.
9666 * configure.tgt: Initialize all variables.
9667 (x86_64*): Set targ_extra_obj and targ_extra_size.
9668 * configure: Rebuild.
9669
9670 * object.cc (Sized_relobj::include_section_group): Adjust section
9671 indexes read from group data. Build vector to pass to
9672 layout_group.
9673 * layout.cc (Layout::layout_group): Add flags and shndxes
9674 parameters. Remove contents parameter. Change caller. Update
9675 explicit instantiations.
9676 * layout.h (class Layout): Update layout_group declaration.
9677 * output.cc (Output_data_group::Output_data_group): Add flags and
9678 input_shndxes parameters. Remove contents parameter. Change
9679 caller.
9680 (Output_data_group::do_write): Change input_sections_ to
9681 input_shndxes_.
9682 * output.h (class Output_data_group): Update constructor
9683 declaration. Rename input_sections_ to input_shndxes_.
9684 * testsuite/many_sections_test.cc: Add template.
9685
9686 2008-04-30 Cary Coutant <ccoutant@google.com>
9687
9688 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9689
9690 * layout.cc (Layout::include_section): Refactored check for debug
9691 info section.
9692 (Layout::add_comdat): Add new parameters. Change type
9693 of signature parameter. Add object and shndx to signatures table.
9694 (Layout::find_kept_object): New function.
9695 * layout.h: Include <cstring>.
9696 (Layout::is_debug_info_section): New function.
9697 (Layout::add_comdat): Add new parameters.
9698 (Layout::find_kept_object): New function.
9699 (Layout::Kept_section): New struct.
9700 (Layout::Signatures): Change type of map range.
9701 * object.cc (Relobj::output_section_address): New function.
9702 (Sized_relobj::include_section_group): Add new parameters. Change
9703 calls to Layout::add_comdat. Change to build table of kept comdat
9704 groups and table mapping discarded sections to kept sections.
9705 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9706 (Sized_relobj::do_layout): Change calls to include_section_group and
9707 include_linkonce_section.
9708 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9709 value to zero when section is discarded.
9710 (Sized_relobj::map_to_kept_section): New function.
9711 * object.h (Relobj::output_section_address): New function.
9712 (Relobj::Comdat_group): New type.
9713 (Relobj::find_comdat_group): New function.
9714 (Relobj::Comdat_group_table): New type.
9715 (Relobj::Kept_comdat_section): New type.
9716 (Relobj::Kept_comdat_section_table): New type.
9717 (Relobj::add_comdat_group): New function.
9718 (Relobj::set_kept_comdat_section): New function.
9719 (Relobj::get_kept_comdat_section): New function.
9720 (Relobj::comdat_groups_): New field.
9721 (Relobj::kept_comdat_sections_): New field.
9722 (Symbol_value::input_value): Update comment.
9723 (Sized_relobj::map_to_kept_section) New function.
9724 (Sized_relobj::include_linkonce_section): Add new parameter.
9725 * target-reloc.h (Comdat_behavior): New type.
9726 (get_comdat_behavior): New function.
9727 (relocate_section): Add code to map a discarded section to the
9728 corresponding kept section when applying a relocation.
9729
9730 2008-04-30 Craig Silverstein <csilvers@google.com>
9731
9732 * dwarf_reader.cc (next_generation_count): New static var.
9733 (Addr2line_cache_entry): New struct.
9734 (addr2line_cache): New static var.
9735 (Dwarf_line_info::one_addr2line): Added caching.
9736 (Dwarf_line_info::clear_addr2line_cache): New function.
9737 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9738 cache-size parameter.
9739 (Dwarf_line_info::one_addr2line_cache): New function.
9740 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9741 new cache-size argument to one_addr2line(), and clear cache.
9742
9743 2008-04-28 Cary Coutant <ccoutant@google.com>
9744
9745 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9746 R_386_PC8 relocations.
9747
9748 2008-04-23 Ian Lance Taylor <iant@google.com>
9749
9750 * object.cc (Sized_relobj::include_section_group): Check for
9751 invalid section group.
9752
9753 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9754 header size.
9755
9756 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9757 than read for file header.
9758 * archive.cc (Archive::include_member): Likewise.
9759
9760 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
9761
9762 * aclocal.m4: Regenerate.
9763 * configure: Regenerate.
9764
9765 2008-04-19 Ian Lance Taylor <iant@google.com>
9766
9767 * version.cc (version_string): Bump to 1.6.
9768
9769 * testsuite/Makefile.am (many_sections_r_test): New target.
9770 (many_sections_r_test_SOURCES): Remove.
9771 (many_sections_r_test_DEPENDENCIES): Remove.
9772 (many_sections_r_test_LDFLAGS): Remove.
9773 (many_sections_r_test_LDADD): Remove.
9774
9775 * object.cc (Sized_relobj::do_add_symbols): Always pass
9776 local_symbol_count_ to add_from_relobj.
9777
9778 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9779 every thousand variables.
9780 * testsuite/Makefile.in: Rebuild.
9781
9782 * object.cc (Xindex::initialize_symtab_xindex): New function.
9783 (Xindex::read_symtab_xindex): New function.
9784 (Xindex::sym_xindex_to_shndx): New function.
9785 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9786 available.
9787 (Sized_relobj::do_initialize_xindex): New function.
9788 (Sized_relobj::do_read_symbols): Adjust section links.
9789 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9790 parameter. Change all callers.
9791 (Sized_relobj::include_section_group): Adjust section links and
9792 symbol section indexes.
9793 (Sized_relobj::do_layout): Adjust section links.
9794 (Sized_relobj::do_count_local_symbols): Adjust section links and
9795 symbol section indexes.
9796 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9797 ordinary and special symbols.
9798 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9799 dynsym_xindex parameters. Change all callers. Adjust section
9800 links. Use SHN_XINDEX when needed.
9801 (Sized_relobj::get_symbol_location_info): Adjust section links.
9802 Don't get fooled by special symbols.
9803 * object.h (class Xindex): Define.
9804 (class Object): Add xindex_ parameter. Declare virtual functoin
9805 do_initialize_xindex.
9806 (Object::adjust_sym_shndx): New function.
9807 (Object::set_xindex): New protected function.
9808 (class Symbol_value): Add is_ordinary_shndx_ field.
9809 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9810 (Symbol_value::value): Assert ordinary section.
9811 (Symbol_value::initialize_input_to_output_map): Likewise.
9812 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9813 Change all callers.
9814 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9815 all callers.
9816 (class Sized_relobj): Update declarations.
9817 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9818 parameter. Change all callers.
9819 (Sized_relobj::adjust_shndx): New function.
9820 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9821 field.
9822 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9823 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9824 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9825 (Sized_dynobj::read_dynsym_section): Adjust section links.
9826 (Sized_dynobj::read_dynamic): Likewise.
9827 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9828 section links.
9829 (Sized_dynobj::do_initialize_xindex): New function.
9830 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9831 do_initialize_xindex.
9832 (Sized_dynobj::adjust_shndx): New function.
9833 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9834 dynsym_xindex_ fields.
9835 (Layout::finalize): Add a call to set_section_indexes before
9836 creating the symtab sections.
9837 (Layout::set_section_indexes): Don't do anything if the section
9838 already has a section index.
9839 (Layout::create_symtab_sections): Add shnum parameter. Change
9840 caller. Create .symtab_shndx section if needed.
9841 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9842 caller.
9843 (Layout::allocated_output_section_count): New function.
9844 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9845 needed.
9846 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9847 fields. Update declarations.
9848 (Layout::symtab_xindex): New function.
9849 (Layout::dynsym_xindex): New function.
9850 (class Write_symbols_task): Add layout_ field.
9851 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9852 Change caller.
9853 * output.cc (Output_section_headers::Output_section_headers): Add
9854 shstrtab_section parameter. Change all callers.
9855 (Output_section_headers::do_sized_write): Store overflow values
9856 for section count and section string table section index in
9857 section header zero.
9858 (Output_file_header::do_sized_write): Check for overflow of
9859 section count and section string table section index.
9860 (Output_symtab_xindex::do_write): New function.
9861 (Output_symtab_xindex::endian_do_write): New function.
9862 * output.h (class Output_section_headers): Add shstrtab_section_.
9863 Update declarations.
9864 (class Output_symtab_xindex): Define.
9865 (Output_section::has_out_shndx): New function.
9866 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9867 field.
9868 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9869 Change all callers.
9870 (Sized_symbol::init): Likewise.
9871 (Symbol::output_section): Check for ordinary symbol.
9872 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9873 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9874 callers.
9875 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9876 Change all callers. Simplify handling of symbols from sections
9877 not included in the link.
9878 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9879 distinction.
9880 (Weak_alias_sorter::operator()): Assert that symbols are
9881 ordinary.
9882 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9883 distinction.
9884 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9885 parameters. Change all callers.
9886 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9887 symbol distinction. Use SHN_XINDEX when needed.
9888 (Symbol_table::write_section_symbol): Add symtab_xindex
9889 parameter. Change all callers.
9890 (Symbol_table::sized_write_section_symbol): Likewise. Use
9891 SHN_XINDEX when needed.
9892 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9893 declarations.
9894 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9895 (Symbol::is_defined): Check is_ordinary.
9896 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9897 (Symbol::is_absolute, Symbol::is_common): Likewise.
9898 (class Sized_symbol): Update declarations.
9899 (class Symbol_table): Update declarations.
9900 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9901 parameters. Change all callers.
9902 (Sized_symbol::override): Likewise.
9903 (Symbol_table::override): Likewise.
9904 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9905 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9906 is_ordinary, and orig_st_shndx parameters. Change all callers.
9907 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9908 to be in an ordinary section.
9909 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9910 object and is_ordinary parameters. Change all callers.
9911 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9912 Change all callers. Don't add undefined or non-ordinary symbols
9913 to reloc_map_.
9914 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9915 Change all callers.
9916 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9917 declarations.
9918 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9919 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9920 (Sized_relobj::relocate_sections): Likewise.
9921 * target-reloc.h (scan_relocs): Adjust section symbol index.
9922 (scan_relocatable_relocs): Likewise.
9923 * i386.cc (Scan::local): Check for ordinary symbols.
9924 * sparc.cc (Scan::local): Likewise.
9925 * x86_64.cc (Scan::local): Likewise.
9926 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9927 to symbol_section_and_value.
9928 * testsuite/many_sections_test.cc: New file.
9929 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9930 (check_PROGRAMS): Add many_sections_test.
9931 (many_sections_test_SOURCES): Define.
9932 (many_sections_test_DEPENDENCIES): Define.
9933 (many_sections_test_LDFLAGS): Define.
9934 (BUILT_SOURCES): Add many_sections_define.h.
9935 (many_sections_define.h): New target.
9936 (BUILT_SOURCES): Add many_sections_check.h.
9937 (many_sections_check.h): New target.
9938 (check_PROGRAMS): Add many_sections_r_test.
9939 (many_sections_r_test_SOURCES): Define.
9940 (many_sections_r_test_DEPENDENCIES): Define.
9941 (many_sections_r_test_LDFLAGS): Define.
9942 (many_sections_r_test_LDADD): Define.
9943 (many_sections_r_test.o): New target.
9944 * testsuite/Makefile.in: Rebuild.
9945
9946 2008-04-17 Cary Coutant <ccoutant@google.com>
9947
9948 * errors.cc (Errors::info): New function.
9949 (gold_info): New function.
9950 * errors.h (Errors::info): New function.
9951 * gold.h (gold_info): New function.
9952 * object.cc (Input_objects::add_object): Print trace output.
9953 * options.cc (options::parse_set): New function.
9954 (General_options::parse_wrap): Deleted.
9955 (General_options::General_options): Deleted initializer.
9956 * options.h (options::String_set): New typedef.
9957 (options::parse_set): New function.
9958 (DEFINE_set): New macro.
9959 (General_options::wrap): Changed to use DEFINE_set. Changed
9960 callers of any_wrap_symbols and is_wrap_symbol.
9961 (General_options::trace, General_options::trace_symbol):
9962 New options.
9963 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9964 (General_options::wrap_symbols_): Deleted.
9965 * symtab.cc (Symbol_table::add_from_object): Print trace output.
9966
9967 2008-04-17 David S. Miller <davem@davemloft.net>
9968
9969 * options.cc (General_options::parse_V): New function.
9970 * options.h: Add entries for -V and -Qy.
9971
9972 2008-04-17 Ian Lance Taylor <iant@google.com>
9973
9974 * common.cc (Symbol_table::allocate_commons): Remove options
9975 parameter. Change caller.
9976 (Symbol_table::do_allocate_commons): Remove options parameter.
9977 Change caller. Just call do_allocate_commons_list twice.
9978 (Symbol_table::do_allocate_commons_list): New function, broken out
9979 of do_allocate_commons.
9980 * common.h (class Allocate_commons_task): Remove options_ field.
9981 Update constructor.
9982 * symtab.cc (Symbol_table::Symbol_table): Initialize
9983 tls_commons_.
9984 (Symbol_table::add_from_object): Put TLS common symbols on
9985 tls_commons_ list.
9986 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9987 which are IN_OUTPUT_DATA.
9988 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
9989 allocate_commons and do_allocate_commons declarations. Declare
9990 do_allocate_commons_list.
9991 * gold.cc (queue_middle_tasks): Update creation of
9992 Allocate_commons_task to not pass options.
9993 * testsuite/Makefile.am (INCLUDES): Add -I.. .
9994 (TLS_TEST_C_FLAGS): New variable.
9995 (tls_test_c_pic.o): New target.
9996 (tls_test_shared.so): Link in tls_test_c_pic.o.
9997 (tls_test_c_pic_ie.o): New target.
9998 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9999 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10000 (tls_test_c.o): New target.
10001 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10002 (tls_pic_test_LDADD): Likewise.
10003 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10004 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10005 (tls_test_c_gnu2.o): New target.
10006 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10007 tls_test_c_gnu2.o.
10008 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10009 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10010 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10011 * testsuite/tls_test.cc: Include "config.h".
10012 (t_last): Call t11_last.
10013 * testsuite/tls_test.h (t11, t11_last): Declare.
10014 * testsuite/tls_test_c.c: New file.
10015 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10016 * configure.ac: Check for OpenMP support.
10017 * configure, config.in, Makefile.in: Rebuild.
10018 * testsuite/Makefile.in: Rebuild.
10019
10020 2008-04-16 Cary Coutant <ccoutant@google.com>
10021
10022 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10023 (Target_i386::tls_base_symbol_defined_): New field.
10024 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10025 (Target_i386::Scan::global): Likewise.
10026 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10027 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10028 (Target_x86_64::tls_base_symbol_defined_): New field.
10029 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10030 (Target_x86_64::Scan::global): Likewise.
10031
10032 2008-04-16 Cary Coutant <ccoutant@google.com>
10033
10034 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10035 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10036 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10037 building shared libraries.
10038 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10039 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10040 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10041 * testsuite/Makefile.in: Rebuild.
10042 * testsuite/weak_undef.h: New file.
10043 * testsuite/weak_undef_file1.cc: Add extra test cases.
10044 * testsuite/weak_undef_file2.cc: Likewise.
10045 * testsuite/weak_undef_test.cc: Likewise.
10046
10047 2008-04-16 David S. Miller <davem@davemloft.net>
10048
10049 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10050 Add issued_non_pic_error_ field. Declare check_non_pic.
10051 (Target_sparc::Scan::check_non_pic): New function.
10052 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10053 (Target_sparc::Scan::global): Likewise.
10054
10055 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10056 * configure: Rebuild.
10057
10058 * options.h (DEFINE_enable): New macro.
10059 (new_dtags): New enable option.
10060 (initfirst, interpose, loadfltr, nodefaultlib,
10061 nodelete, nodlopen, nodump): New -z options.
10062 * layout.cc (Layout:finish_dynamic_section): If new
10063 dtags enabled, emit DT_RUNPATH. Also, emit a
10064 DT_FLAGS_1 containing any specified -z flags.
10065
10066 2008-04-16 Ian Lance Taylor <iant@google.com>
10067
10068 * copy-relocs.cc: New file.
10069 * copy-relocs.h: New file.
10070 * reloc.cc: Remove Copy_relocs code.
10071 * reloc.h: Likewise.
10072 * reloc-types.h (struct Reloc_types) [both versions]: Add
10073 get_reloc_addend_noerror.
10074 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10075 variants of add_global which take an addend which must be zero.
10076 * i386.cc: Include "copy-relocs.h".
10077 (class Target_i386): Change type of copy_relocs_ to variable,
10078 update initializer.
10079 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10080 Change all callers.
10081 (Target_i386::do_finalize_sections): Change handling of
10082 copy_relocs_.
10083 * sparc.cc: Include "copy-relocs.h".
10084 (class Target_sparc): Change type of copy_relocs_ to variable,
10085 update initializer.
10086 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10087 Change all callers.
10088 (Target_sparc::do_finalize_sections): Change handling of
10089 copy_relocs_.
10090 * x86_64.cc: Include "copy-relocs.h".
10091 (class Target_x86_64): Change type of copy_relocs_ to variable,
10092 update initializer.
10093 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10094 class. Change all callers.
10095 (Target_x86_64::do_finalize_sections): Change handling of
10096 copy_relocs_.
10097 * Makefile.am (CCFILES): Add copy-relocs.cc.
10098 (HFILES): Add copy-relocs.h.
10099
10100 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10101
10102 * testsuite/script_test_4.sh: Permit leading zeroes.
10103
10104 2008-04-15 Ian Lance Taylor <iant@google.com>
10105
10106 * script-sections.cc (Script_sections::create_segments): Use
10107 header_size_adjustment even when there is enough room for the
10108 headers.
10109 * testsuite/script_test_4.sh: New file.
10110 * testsuite/script_test_4.t: New file.
10111 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10112 (check_DATA): Add script_test_4.stdout.
10113 (MOSTLYCLEANFILES): Likewise.
10114 (script_test_4): New target.
10115 (script_test_4.stdout): New target.
10116 * testsuite/Makefile.in: Rebuild.
10117
10118 * sparc.cc: Add definitions for Output_data_plt_sparc class
10119 constants.
10120
10121 2008-04-14 David S. Miller <davem@davemloft.net>
10122
10123 * sparc.cc: New file.
10124 * Makefile.am (TARGETSOURCES): Add sparc.cc
10125 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10126 * configure.tgt: Document targ_extra_size and
10127 targ_extra_big_endian. Add entries for sparc-* and
10128 sparc64-*.
10129 * configure.ac: Handle targ_extra_size and
10130 targ_extra_big_endian.
10131 * Makefile.in: Rebuild.
10132 * configure: Likewise.
10133 * po/POTFILES.in: Likewise.
10134 * po/gold.pot: Likewise.
10135
10136 2008-04-14 Ian Lance Taylor <iant@google.com>
10137
10138 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10139 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10140 in the name/type/flags to section mapping. Don't call
10141 allocate_output_section.
10142 (Layout::choose_output_section): Change parameter from adjust_name
10143 to is_input_section. Don't permit input sections after sections
10144 are attached to segments. Don't call allocate_output_section.
10145 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10146 not write_enable_output_section.
10147 (Layout::make_output_section): Don't push to
10148 unattached_section_list_ nor call attach_to_segment. Call
10149 attach_section_to_segment if sections are attached.
10150 (Layout::attach_sections_to_segments): New function.
10151 (Layout::attach_section_to_segment): New function.
10152 (Layout::attach_allocated_section_to_segment): Rename from
10153 attach_to_segment. Remove flags parameter.
10154 (Layout::allocate_output_section): Remove function.
10155 (Layout::write_enable_output_section): Remove function.
10156 * layout.h (class Layout): Update for above changes. Add new
10157 field sections_are_attached_.
10158 * output.h (Output_section::update_flags_for_input_section): New
10159 function.
10160 * output.cc (Output_section::add_input_section): Call
10161 update_flags_for_input_section.
10162 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10163
10164 2008-04-11 Cary Coutant <ccoutant@google.com>
10165
10166 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10167 thought unnecessary.
10168 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10169
10170 2008-04-11 Ian Lance Taylor <iant@google.com>
10171
10172 * output.h (class Output_section_data): Remove inline definition
10173 of set_addralign.
10174 * output.cc (Output_section_data::set_addralign): New function.
10175
10176 2008-04-11 Cary Coutant <ccoutant@google.com>
10177
10178 Add support for TLS descriptors for i386 and x86_64.
10179 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10180 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10181 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10182 GOT_TYPE_TLS_DESC.
10183 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10184 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10185 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10186 relocations.
10187 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10188 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10189 Fix problem with initial-exec relocations.
10190 (Target_i386::Relocate::relocate_tls): Likewise.
10191 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10192 relaxation.
10193 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10194 support for section-plus-offset dynamic table entries.
10195 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10196 (Output_data_dynamic::Dynamic_entry): Add support for
10197 section-plus-offset dynamic table entries.
10198 (Output_data_dynamic::Classification): Likewise.
10199 (Output_data_dynamic::classification_): Renamed offset_.
10200 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10201 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10202 (Target_x86_64::make_plt_section): New function.
10203 (Target_x86_64::reserve_tlsdesc_entries): New function.
10204 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10205 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10206 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10207 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10208 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10209 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10210 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10211 add extra PLT entry for TLS descriptors.
10212 (Output_data_plt_x86_64::got_): New field.
10213 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10214 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10215 fields.
10216 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10217 descriptors.
10218 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10219 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10220 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10221 R_386_TLS_DESC_CALL relocations.
10222 (Target_x86_64::Scan::global): Likewise.
10223 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10224 for TLS descriptors.
10225 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10226 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10227 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10228 GD-to-IE relaxation.
10229 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10230 and TLS_DESCRIPTORS.
10231 * Makefile.in: Rebuild.
10232 * configure: Rebuild.
10233 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10234 (tls_test_shared2.so): New target.
10235 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10236 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10237 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10238 (tls_shared_gd_to_ie_test_LDADD): New variable.
10239 (tls_shared_gnu2_gd_to_ie_test): New target.
10240 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10241 New targets.
10242 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10243 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10244 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10245 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10246 (tls_shared_gnu2_test): New target.
10247 (tls_test_gnu2_shared.so): New target.
10248 (tls_shared_gnu2_test_SOURCES): New variable.
10249 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10250 (tls_shared_gnu2_test_LDFLAGS): New variable.
10251 (tls_shared_gnu2_test_LDADD): New variable.
10252 * testsuite/Makefile.in: Rebuild.
10253 * testsuite/Makefile.
10254
10255 2008-04-11 Ian Lance Taylor <iant@google.com>
10256
10257 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10258 justsyms.t.
10259 * testsuite/Makefile.in: Rebuild.
10260
10261 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10262 long.
10263 * testsuite/script_test_2.cc (main): Adjust test.
10264
10265 2008-04-11 David S. Miller <davem@davemloft.net>
10266 Ian Lance Taylor <iant@google.com>
10267
10268 * options.h (General_options): Add entries for '-Y' and
10269 '-relax'.
10270 * options.cc (General_options:finalize): If -Y was used, add those
10271 entries to the library path instead of the default "/lib" and
10272 "/usr/lib".
10273
10274 2008-04-11 David S. Miller <davem@davemloft.net>
10275
10276 * testsuite/justsyms.t: Start at 0x100.
10277 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10278 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10279 long.
10280 * testsuite/script_test_2.cc: Adjust string and section length
10281 checks.
10282
10283 2008-04-09 Ian Lance Taylor <iant@google.com>
10284
10285 PR gold/5996
10286 * script-sections.cc (Sections_element::allocate_to_segment): Add
10287 orphan parameter.
10288 (Output_section_definition::allocate_to_segment): Likewise.
10289 (Orphan_output_section::allocate_to_segment): Likewise.
10290 (Script_sections::attach_sections_using_phdrs_clause): Don't
10291 propagate non-PT_LOAD segments to orphan sections.
10292 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10293 readelf rather than objdump.
10294 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10295 .interp section and PT_INTERP segment are the same size.
10296 * testsuite/Makefile.in: Rebuild.
10297
10298 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10299 aliases for symbols defined in the same object.
10300 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10301 (weak_alias_test_SOURCES): New variable.
10302 (weak_alias_test_DEPENDENCIES): New variable.
10303 (weak_alias_test_LDFLAGS): New variable.
10304 (weak_alias_test_LDADD): New variable.
10305 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10306 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10307 (weak_alias_test_3.o): New target.
10308 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10309 * testsuite/weak_alias_test_main.cc: New file.
10310 * testsuite/weak_alias_test_1.cc: New file.
10311 * testsuite/weak_alias_test_2.cc: New file.
10312 * testsuite/weak_alias_test_3.cc: New file.
10313
10314 2008-04-08 Ian Lance Taylor <iant@google.com>
10315
10316 * options.h (class General_options): Add --noinhibit-exec option.
10317 * main.cc (main): Check --noinhibit-exec.
10318
10319 * options.h (class General_options): Define --wrap as a special
10320 option. Add wrap_symbols_ field.
10321 (General_options::any_wrap_symbols): New function.
10322 (General_options::is_wrap_symbol): New function.
10323 * options.cc (General_options::parse_wrap): New function.
10324 (General_options::General_options): Initialize wrap_symbols_.
10325 * symtab.cc (Symbol_table::wrap_symbol): New function.
10326 (Symbol_table::add_from_object): Handle --wrap.
10327 * symtab.h (class Symbol_table): Declare wrap_symbol.
10328 * target.h (Target::wrap_char): New function.
10329 (Target::Target_info): Add wrap_char field.
10330 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10331 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10332 * testsuite/testfile.cc (Target_test::test_target_info):
10333 Likewise.
10334
10335 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10336 there is one.
10337
10338 * layout.h (class Layout): Add added_eh_frame_data_ field.
10339 * layout.cc (Layout::Layout): Initialize new field.
10340 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10341 output section until we find a section we merged successfully.
10342 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10343 that the size be non-zero.
10344
10345 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10346 qualifier.
10347
10348 2008-04-08 Craig Silverstein <csilvers@google.com>
10349
10350 * configure.ac: Export new conditional variable HAVE_ZLIB.
10351 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10352 on HAVE_ZLIB.
10353 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10354 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10355
10356 2008-04-07 Ian Lance Taylor <iant@google.com>
10357
10358 * version.cc (version_string): Set to "1.5".
10359
10360 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10361 Add issued_non_pic_error_ field. Declare check_non_pic.
10362 (Target_x86_64::Scan::check_non_pic): New function.
10363 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10364 (Target_x86_64::Scan::global): Likewise.
10365
10366 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10367 addend parameter. Change caller. Handle merge sections.
10368 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10369 Address to Addend. Don't add in the result of
10370 local_section_offset, pass down the addend and use the returned
10371 value.
10372 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10373 Update declarations of local_section_offset and symbol_value.
10374 * testsuite/two_file_test_1.cc (t18): New function.
10375 * testsuite/two_file_test_2.cc (f18): New function.
10376 * testsuite/two_file_test_main.cc (main): Call t18.
10377 * testsuite/two_file_test.h (t18, f18): Declare.
10378
10379 * configure.ac: Don't test for objdump, c++filt, or readelf.
10380 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10381 conditionals.
10382 (TEST_READELF): New variable.
10383 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10384 (check_PROGRAMS): Add two_file_strip_test.
10385 (two_file_strip_test): New target.
10386 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10387 (two_file_same_shared_strip_test_SOURCES): New variable.
10388 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10389 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10390 (two_file_same_shared_strip_test_LDADD): New variable.
10391 (two_file_shared_strip.so): New target.
10392 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10393 (ver_test_5.syms, ver_test_7.syms): Likewise.
10394 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10395 (strip_test_3.stdout): Use TEST_OBJDUMP.
10396 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10397
10398 2008-04-04 Cary Coutant <ccoutant@google.com>
10399
10400 * symtab.h (Symbol::is_weak_undefined): New function.
10401 (Symbol::is_strong_undefined): New function.
10402 (Symbol::is_absolute): New function.
10403 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10404 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10405 absolute symbols.
10406 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10407 (weak_undef_test): New target.
10408 * testsuite/Makefile.in: Rebuild.
10409 * testsuite/weak_undef_file1.cc: New file.
10410 * testsuite/weak_undef_file2.cc: New file.
10411 * testsuite/weak_undef_test.cc: New file.
10412
10413 2008-04-03 Craig Silverstein <csilvers@google.com>
10414
10415 * compressed_output.h (class Output_compressed_section): Use
10416 unsigned buffer.
10417 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10418 add zlib header.
10419 (zlib_compressed_suffix): Removed.
10420 (Output_compressed_section::set_final_data_size): Use unsigned
10421 buffers.
10422 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10423 Fix linker invocation.
10424 (flagstest_o_specialfile_and_compress_debug_sections):
10425 Likewise.
10426 * testsuite/Makefile.in: Regenerated.
10427
10428 2008-04-02 David S. Miller <davem@davemloft.net>
10429
10430 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10431 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10432
10433 2008-04-02 Craig Silverstein <csilvers@google.com>
10434
10435 * TODO: New file.
10436
10437 2008-04-02 Ian Lance Taylor <iant@google.com>
10438
10439 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10440 parameters. Update for new key type to views_. Change all
10441 callers.
10442 (File_read::read): Adjust for byteshift in returned view.
10443 (File_read::add_view): New function, broken out of
10444 find_and_make_view.
10445 (File_read::make_view): New function, broken out of
10446 find_and_make_view.
10447 (File_read::find_or_make_view): Add offset and aligned
10448 parameters. Rewrite accordingly. Change all callers.
10449 (File_read::get_view): Add offset and aligned parameters. Adjust
10450 for byteshift in return value.
10451 (File_read::get_lasting_view): Likewise.
10452 * fileread.h (class File_read): Update declarations.
10453 (class File_read::View): Add byteshift_ field. Add byteshift to
10454 constructor. Add byteshift method.
10455 * archive.h (Archive::clear_uncached_views): New function.
10456 (Archive::get_view): Add aligned parameter. Change all callers.
10457 * object.h (Object::get_view): Add aligned parameter. Change all
10458 callers.
10459 (Object::get_lasting_view): Likewise.
10460
10461 * fileread.cc (File_read::release): Don't call clear_views if
10462 there are multiple objects.
10463 * fileread.h (File_read::clear_uncached_views): New function.
10464 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10465 on the archive.
10466
10467 2008-03-31 Cary Coutant <ccoutant@google.com>
10468
10469 Add thin archive support.
10470 * archive.cc (Archive::armagt): New const.
10471 (Archive::setup): Remove task parameter and calls to unlock.
10472 (Archive::unlock_nested_archives): New function.
10473 (Archive::read_header): Add nested_off parameter. Change
10474 all callers.
10475 (Archive::interpret_header): Likewise.
10476 (Archive::include_all_members): Change to handle thin
10477 archives.
10478 (Archive::include_member): Likewise.
10479 * archive.h (Archive::Archive): Add new parameters and
10480 initializers.
10481 (Archive::armagt): New const.
10482 (Archive::setup): Remove task parameter.
10483 (Archive::unlock_nested_archives): New function.
10484 (Archive::read_header): Add nested_off parameter.
10485 (Archive::interpret_header): Likewise.
10486 (Archive::Nested_archive_table): New typedef.
10487 (Archive::is_thin_archive_): New field.
10488 (Archive::nested_archives_): New field.
10489 (Archive::options_): New field.
10490 (Archive::dirpath_): New field.
10491 (Archive::task_): New field.
10492 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10493 for thin archives. Pass additional parameters to
10494 Archive::Archive. Unlock the archive file after calling
10495 Archive::setup.
10496
10497 2008-03-29 Ian Lance Taylor <iant@google.com>
10498
10499 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10500 version symbol to be local.
10501 * testsuite/ver_test_4.sh: New file.
10502 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10503 (check_DATA): Add ver_test_4.syms.
10504 (ver_test_4.syms): New target.
10505 * testsuite/Makefile.in: Rebuild.
10506
10507 * output.cc
10508 (Output_section::Input_section_sort_entry::has_priority): New
10509 function.
10510 (Output_section::Input_section_sort_entry::match_file_name): New
10511 function.
10512 (Output_section::Input_section_sort_entry::match_section_name):
10513 Remove.
10514 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10515 Remove.
10516 (Output_section::Input_section_sort_entry::match_section_file):
10517 Remove.
10518 (Output_section::Input_section_sort_compare::operator()): Rewrite
10519 using new Input_section_sort_entry functions. Sort crtbegin and
10520 crtend first. Sort sections with no priority before sections with
10521 a priority.
10522 * testsuite/initpri1.c (d3): Check j != 4.
10523 (cd5): New constructor/destructor function.
10524 (main): Check j != 2.
10525
10526 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10527 new symbol when resolving, don't call set_is_default.
10528 * testsuite/ver_test_7.cc: New file.
10529 * testsuite/ver_test_7.sh: New file.
10530 * testsuite/Makefile.am (ver_test_7.so): New target.
10531 (ver_test_7.o): New target.
10532 (check_SCRIPTS): Add ver_test_7.sh.
10533 (check_DATA): Add ver_test_7.syms.
10534 (ver_test_7.syms): New target.
10535
10536 2008-03-28 Ian Lance Taylor <iant@google.com>
10537
10538 * layout.cc (Layout::layout): If we see an input section with a
10539 name that needs sorting, set the must_sort flag for the output
10540 section.
10541 (Layout::make_output_section): If the name of the output section
10542 indicates that it might require sorting, set the may_sort flag.
10543 * output.h (Output_section::may_sort_attached_input_sections): New
10544 function.
10545 (Output_section::set_may_sort_attached_input_sections): New
10546 function.
10547 (Output_section::must_sort_attached_input_sections): New
10548 function.
10549 (Output_section::set_must_sort_attached_input_sections): New
10550 function.
10551 (class Output_section): Declare Input_section_sort_entry. Define
10552 Input_section_sort_compare. Declare
10553 sort_attached_input_sections. Add new fields:
10554 may_sort_attached_input_sections_,
10555 must_sort_attached_input_sections_,
10556 attached_input_sections_are_sorted_.
10557 * output.cc (Output_section::Output_section): Initialize new
10558 fields.
10559 (Output_section::add_input_section): Add an entry to
10560 input_sections_ if may_sort or must_sort are true.
10561 (Output_section::set_final_data_size): Call
10562 sort_attached_input_sections if necessary.
10563 (Output_section::Input_section_sort_entry): Define new class.
10564 (Output_section::Input_section_sort_compare::operator()): New
10565 function.
10566 (Output_section::sort_attached_input_sections): New function.
10567 * configure.ac: Check whether the compiler supports constructor
10568 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10569 * testsuite/initpri1.c: New file.
10570 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10571 CONSTRUCTOR_PRIORITY.
10572 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10573 (initpri1_LDFLAGS): New variable.
10574 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10575
10576 2008-03-27 Ian Lance Taylor <iant@google.com>
10577
10578 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10579 * testsuite/common_test_1.c: New file.
10580 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10581 (common_test_1_SOURCES): New variable.
10582 (common_test_1_DEPENDENCIES): New variable.
10583 (common_test_1_LDFLAGS): New variable.
10584
10585 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10586 and commons_ correctly when NAME/VERSION does not override
10587 NAME/NULL.
10588 * testsuite/ver_test_6.c: New file.
10589 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10590 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10591 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10592
10593 2008-03-26 Ian Lance Taylor <iant@google.com>
10594
10595 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10596 of an undefined symbol from a version script.
10597 * testsuite/Makefile.am (ver_test_5.so): New target.
10598 (ver_test_5.o): New target.
10599 (check_SCRIPTS): Add ver_test_5.sh.
10600 (check_DATA): Add ver_test_5.syms.
10601 (ver_test_5.syms): New target.
10602 * testsuite/ver_test_5.cc: New file.
10603 * testsuite/ver_test_5.script: New file.
10604 * testsuite/ver_test_5.sh: New file.
10605 * Makefile.in, testsuite/Makefile.in: Rebuild.
10606
10607 PR gold/5986
10608 Fix problems building gold with gcc 4.3.0.
10609 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10610 (gold_error_at_location, gold_warning_at_location): Use it.
10611 * configure.ac: Check whether we can compile and use a template
10612 function with a printf attribute.
10613 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10614 when jumping over bytes.
10615 * object.cc: Instantiate Object::read_section_data.
10616 * debug.h: Include <cstring>
10617 * dwarf_reader.cc: Include <algorithm>
10618 * main.cc: Include <cstring>.
10619 * options.cc: Include <cstring>.
10620 * output.cc: Include <cstring>.
10621 * script.cc: Include <cstring>.
10622 * script.h: Include <string>.
10623 * symtab.cc: Include <cstring> and <algorithm>.
10624 * target-select.cc: Include <cstring>.
10625 * version.cc: Include <string>.
10626 * testsuite/testmain.cc: Include <cstdlib>.
10627 * configure, config.in: Rebuild.
10628
10629 2008-03-25 Ian Lance Taylor <iant@google.com>
10630
10631 * options.cc: Include "../bfd/bfdver.h".
10632 (options::help): Print bug reporting address.
10633
10634 * version.cc (print_version): Adjust output for current value of
10635 BFD_VERSION_STRING.
10636
10637 * NEWS: New file.
10638
10639 * options.cc (options::help): Print list of supported targets.
10640 * target-select.h: Include <vector>.
10641 (class Target_selector): Make machine_, size_, and is_big_endian_
10642 fields const. Add bfd_name_ and instantiated_target_ fields.
10643 (Target_selector::Target_selector): Add bfd_name parameter.
10644 (Target_selector::recognize): Make non-virtual, call
10645 do_recognize.
10646 (Target_selector::recognize_by_name): Make non-virtual, call
10647 do_recognize_by_name.
10648 (Target_selector::supported_names): New function.
10649 (Target_selector::bfd_name): New function.
10650 (Target_selector::do_instantiate_target): New pure virtual
10651 function.
10652 (Target_selector::do_recognize): New virtual function.
10653 (Target_selector::do_recognize_by_name): New virtual function.
10654 (Target_selector::instantiate_target): New private function.
10655 (supported_target_names): Declare.
10656 * target-select.cc (Target_selector::Target_selector): Update for
10657 new parameter and fields.
10658 (select_target_by_name): Check that the name matches before
10659 calling recognize_by_name.
10660 (supported_target_names): New function.
10661 * i386.cc (class Target_selector_i386): Update Target_selector
10662 constructor call. Remove recognize and recognize_by_name. Add
10663 do_instantiate_target.
10664 * x86_64.cc (class Target_selector_x86_64): Likewise.
10665 * testsuite/testfile.cc (class Target_selector_test): Update for
10666 changes to Target_selector.
10667
10668 * README: Rewrite, with some notes on unsupported features.
10669
10670 2008-03-24 Cary Coutant <ccoutant@google.com>
10671
10672 * i386.cc (Target_i386::Got_type): New enum declaration.
10673 (Target_i386::Scan::local): Updated callers of Output_data_got
10674 member functions.
10675 (Target_i386::Scan::global): Likewise.
10676 (Target_i386::Relocate::relocate): Likewise.
10677 (Target_i386::Relocate::relocate_tls): Likewise.
10678 * object.h (Got_offset_list): New class.
10679 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10680 (Sized_relobj::local_got_offset): Likewise.
10681 (Sized_relobj::set_local_got_offset): Likewise.
10682 (Sized_relobj::local_has_tls_got_offset): Removed.
10683 (Sized_relobj::local_tls_got_offset): Removed.
10684 (Sized_relobj::set_local_tls_got_offset): Removed.
10685 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10686 * output.cc (Output_data_got::add_global): Added got_type parameter.
10687 (Output_data_got::add_global_with_rel): Likewise.
10688 (Output_data_got::add_global_with_rela): Likewise.
10689 (Output_data_got::add_global_pair_with_rel): New function.
10690 (Output_data_got::add_global_pair_with_rela): New function.
10691 (Output_data_got::add_local): Added got_type parameter.
10692 (Output_data_got::add_local_with_rel): Likewise.
10693 (Output_data_got::add_local_with_rela): Likewise.
10694 (Output_data_got::add_local_pair_with_rel): New function.
10695 (Output_data_got::add_local_pair_with_rela): New function.
10696 (Output_data_got::add_global_tls): Removed.
10697 (Output_data_got::add_global_tls_with_rel): Removed.
10698 (Output_data_got::add_global_tls_with_rela): Removed.
10699 (Output_data_got::add_local_tls): Removed.
10700 (Output_data_got::add_local_tls_with_rel): Removed.
10701 (Output_data_got::add_local_tls_with_rela): Removed.
10702 * output.h (Output_data_got::add_global): Added got_type parameter.
10703 (Output_data_got::add_global_with_rel): Likewise.
10704 (Output_data_got::add_global_with_rela): Likewise.
10705 (Output_data_got::add_global_pair_with_rel): New function.
10706 (Output_data_got::add_global_pair_with_rela): New function.
10707 (Output_data_got::add_local): Added got_type parameter.
10708 (Output_data_got::add_local_with_rel): Likewise.
10709 (Output_data_got::add_local_with_rela): Likewise.
10710 (Output_data_got::add_local_pair_with_rel): New function.
10711 (Output_data_got::add_local_pair_with_rela): New function.
10712 (Output_data_got::add_global_tls): Removed.
10713 (Output_data_got::add_global_tls_with_rel): Removed.
10714 (Output_data_got::add_global_tls_with_rela): Removed.
10715 (Output_data_got::add_local_tls): Removed.
10716 (Output_data_got::add_local_tls_with_rel): Removed.
10717 (Output_data_got::add_local_tls_with_rela): Removed.
10718 * resolve.cc (Symbol::override_base_with_special): Removed
10719 reference to has_got_offset_ field.
10720 * symtab.cc (Symbol::init_fields): Replaced initialization
10721 of got_offset_ with got_offsets_. Removed initialization
10722 of has_got_offset_
10723 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10724 (Symbol::got_offset): Likewise.
10725 (Symbol::set_got_offset): Likewise.
10726 (Symbol::has_tls_got_offset): Removed.
10727 (Symbol::tls_got_offset): Removed.
10728 (Symbol::set_tls_got_offset): Removed.
10729 (Symbol::got_offset_): Removed.
10730 (Symbol::tls_mod_got_offset_): Removed.
10731 (Symbol::tls_pair_got_offset_): Removed.
10732 (Symbol::got_offsets_): New field.
10733 (Symbol::has_got_offset): Removed.
10734 (Symbol::has_tls_mod_got_offset): Removed.
10735 (Symbol::has_tls_pair_got_offset): Removed.
10736 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10737 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10738 member functions.
10739 (Target_x86_64::Scan::global): Likewise.
10740 (Target_x86_64::Relocate::relocate): Likewise.
10741 (Target_x86_64::Relocate::relocate_tls): Likewise.
10742
10743 2008-03-25 Ben Elliston <bje@au.ibm.com>
10744
10745 * yyscript.y: Fix spelling error in comment.
10746
10747 2008-03-24 Ian Lance Taylor <iant@google.com>
10748
10749 * options.h (class General_options): Define build_id option.
10750 * layout.h (class Layout): Declare write_build_id, create_note,
10751 create_build_id. Add build_id_note_ member.
10752 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10753 "libiberty.h", "md5.h", "sha1.h".
10754 (Layout::Layout): Initialize eh_frame_data_,
10755 eh_frame_hdr_section_, and build_id_note_.
10756 (Layout::finalize): Call create_build_id.
10757 (Layout::create_note): New function, broken out of
10758 Layout::create_gold_note.
10759 (Layout::create_gold_note): Call create_note.
10760 (Layout::create_build_id): New function.
10761 (Layout::write_build_id): New function.
10762 (Close_task_runner::run): Call write_build_id.
10763
10764 * x86_64.cc: Correct license to GPLv3.
10765
10766 2008-03-23 Ian Lance Taylor <iant@google.com>
10767
10768 * options.cc: Include "demangle.h".
10769 (parse_optional_string): New function.
10770 (parse_long_option): Handle takes_optional_argument.
10771 (parse_short_option): Update dash_z initializer. Handle
10772 takes_optional_argument.
10773 (General_options::General_options): Initialize do_demangle_.
10774 (General_options::finalize): Set do_demangle_. Handle demangling
10775 style.
10776 * options.h (parse_optional_string): Declare.
10777 (struct One_option): Add optional_arg field. Update constructor.
10778 Update call constructor calls. Add takes_optional_argument
10779 function.
10780 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10781 (DEFINE_optional_string): Define.
10782 (General_options::demangle): Change from DEFINE_bool to
10783 DEFINE_optional_string.
10784 (General_options::no_demangle): New function.
10785 (General_options::do_demangle): New function.
10786 (General_options::set_do_demangle): New function.
10787 (General_options::execstack_status_): Move definition to end of
10788 class definition.
10789 (General_options::static_): Likewise.
10790 (General_options::do_demangle_): New field.
10791 * object.cc (big_endian>::get_symbol_location_info): Call
10792 Options::do_demangle, not Options::demangle.
10793 * symtab.cc (demangle): Likewise.
10794
10795 2008-03-22 Ian Lance Taylor <iant@google.com>
10796
10797 * gold.h: Include <cstddef> and <sys/types.h>
10798 * options.h: Include <cstring>.
10799
10800 2008-03-21 Ian Lance Taylor <iant@google.com>
10801
10802 * Added source code to GNU binutils.