* binary.cc (Binary_to_elf::sized_convert): Don't crash if the
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
69d53f7a
ILT
12011-05-29 Ian Lance Taylor <iant@google.com>
2
3 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4 binary input file is empty.
5
41d0ab5f
ILT
62011-05-27 Ian Lance Taylor <iant@google.com>
7
8 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
9 (ver_test_9.so): Likewise.
10 * testsuite/Makefile.in: Rebuild.
11
89d8a36b
CC
122011-05-26 Cary Coutant <ccoutant@google.com>
13
14 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
15 * incremental.cc (Incremental_inputs::report_input_section): Fix
16 comment, indentation.
17 (Incremental_inputs::report_comdat_group): New function.
18 (Output_section_incremental_inputs::set_final_data_size): Adjust size
19 of data for incremental input file entry.
20 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
21 group count, COMDAT group signatures.
22 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
23 an unchanged input file.
24 * incremental.h (Incremental_object_entry::Incremental_object_entry):
25 Initialize new data member.
26 (Incremental_object_entry::add_comdat_group): New function.
27 (Incremental_object_entry::get_comdat_group_count): New function.
28 (Incremental_object_entry::get_comdat_signature_key): New function.
29 (Incremental_object_entry::groups_): New data member.
30 (Incremental_inputs::report_comdat_group): New function.
31 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
32 data for incremental input file entry.
33 (Incremental_input_entry_reader::get_comdat_group_count): New function.
34 (Incremental_input_entry_reader::get_input_section): Adjust size of
35 data for incremental input file entry.
36 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
37 (Incremental_input_entry_reader::get_comdat_group_signature): New
38 function.
39 * object.cc (Sized_relobj::include_section_group): Report kept
40 COMDAT groups for incremental links.
41
1706a06f
ILT
422011-05-24 David Meyer <pdox@google.com>
43
44 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
45 with name parameter. Add found_name parameter.
46 * fileread.cc (Input_file::find_file): Adjust code accordingly.
47 * dirsearch.h (class Dirsearch): Update declaration.
48
a10ae760
ILT
492011-05-24 Ian Lance Taylor <iant@google.com>
50
51 * archive.cc (Library_base::should_include_member): Pull in object
52 from archive if it defines the entry symbol.
53 * parameters.cc (Parameters::entry): New function.
54 * parameters.h (class Parameters): Declare entry.
55 * output.h (class Output_file_header): Remove entry_ field.
56 * output.cc (Output_file_header::Output_file_header): Remove entry
57 parameter. Change all callers.
58 (Output_file_header::entry): Use parameters->entry.
59 * gold.cc (queue_middle_tasks): Likewise.
60 * plugin.cc (Plugin_hook::run): Likewise.
61
aa92d6ed
CC
622011-05-24 Cary Coutant <ccoutant@google.com>
63
64 * gold.cc (queue_initial_tasks): Pass incremental base filename
65 to Output_file::open_base_file; don't print error message.
66 * incremental-dump.cc (main): Adjust call to
67 Output_file::open_for_modification.
68 * incremental-dump.cc (main): Likewise.
69 * incremental.cc (Incremental_inputs::report_command_line):
70 Ignore --incremental-base option when comparing command lines.
71 Ignore parameter when given as separate argument.
72 * options.h (class General_options): Add --incremental-base.
73 * output.cc (Output_file::Output_file):
74 (Output_file::open_base_file): Add base_name and writable parameters;
75 read base file into new file; print error message here.
76 (Output_file::map_no_anonymous): Add writable parameter; adjust all
77 callers.
78 * output.h (Output_file::open_for_modification): Rename to...
79 (Output_file::open_base_file): ...this; add base_name and
80 writable parameters; adjust all callers.
81 (Output_file::map_no_anonymous): Add writable parameter; adjust all
82 callers.
83 * testsuite/Makefile.am (incremental_test_4): Test
84 --incremental-base.
85 * testsuite/Makefile.in: Regenerate.
86
2eedd706
CC
872011-05-24 Cary Coutant <ccoutant@google.com>
88
89 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
90 incremental_test_4.
91 * testsuite/Makefile.in: Regenerate.
92 * testsuite/two_file_test_1_v1.cc: New test source file.
93 * testsuite/two_file_test_1b_v1.cc: New test source file.
94 * testsuite/two_file_test_2_v1.cc: New test source file.
95
0f1c85a6
CC
962011-05-24 Cary Coutant <ccoutant@google.com>
97
98 * dynobj.h (Dynobj::do_dynobj): New function.
99 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
100 flag and soname for shared objects.
101 * incremental.cc (Incremental_inputs::report_object): Make
102 either Incremental_object_entry or Incremental_dynobj_entry; add
103 soname to string table.
104 (Incremental_inputs::report_input_section): Add assertion.
105 (Output_section_incremental_inputs::set_final_data_size): Adjust
106 type of input file entry for shared libraries; adjust size of
107 shared library info entry.
108 (Output_section_incremental_inputs::write_input_files): Write
109 as_needed flag for shared libraries.
110 (Output_section_incremental_inputs::write_info_blocks): Adjust type
111 of input file entry for shared libraries; write soname.
112 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
113 soname from incremental info.
114 * incremental.h (enum Incremental_input_flags): Add
115 INCREMENTAL_INPUT_AS_NEEDED.
116 (Incremental_input_entry::Incremental_input_entry): Initialize new
117 data member.
118 (Incremental_input_entry::set_as_needed): New function.
119 (Incremental_input_entry::as_needed): New function.
120 (Incremental_input_entry::do_dynobj_entry): New function.
121 (Incremental_input_entry::as_needed_): New data member.
122 (Incremental_object_entry::Incremental_object_entry): Don't check
123 for shared library.
124 (Incremental_object_entry::do_type): Likewise.
125 (class Incremental_dynobj_entry): New class.
126 (Incremental_input_entry_reader::as_needed): New function.
127 (Incremental_input_entry_reader::get_soname): New function.
128 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
129 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
130 size of shared library info entry.
131 * layout.cc (Layout::finish_dynamic_section): Don't test for
132 incremental link when adding DT_NEEDED entries.
133 * object.h (Object::Object): Initialize new data member.
134 (Object::dynobj): New function.
135 (Object::set_as_needed): New function.
136 (Object::as_needed): New function.
137 (Object::do_dynobj): New function.
138 (Object::as_needed_): New data member.
139
6fa2a40b
CC
1402011-05-24 Cary Coutant <ccoutant@google.com>
141
142 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
143 info; adjust display of GOT entries.
144 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
145 vector of input objects; remove file_status_.
146 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
147 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
148 got_plt reader; call target hooks to reserve GOT entries.
149 (Output_section_incremental_inputs::set_final_data_size): Adjust size
150 of input file info header and GOT info entry.
151 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
152 relocation info.
153 (Got_plt_view_info::got_descriptor): Remove.
154 (Got_plt_view_info::sym_index): New data member.
155 (Got_plt_view_info::input_index): New data member.
156 (Local_got_offset_visitor::visit): Write input file index.
157 (Global_got_offset_visitor::visit): Write 0 for input file index.
158 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
159 with sym_index and input_index.
160 (Output_section_incremental_inputs::write_got_plt): Adjust size of
161 incremental info GOT entry; replace got_descriptor with input_index.
162 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
163 map from input file index to object.
164 (Sized_relobj_incr::do_layout): Replace direct data member reference
165 with accessor function.
166 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
167 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
168 Adjust size of input file info header.
169 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
170 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
171 (Incremental_input_entry_reader::get_input_section): Adjust size of
172 input file info header.
173 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
174 of incremental info GOT entry.
175 (Incremental_got_plt_reader::get_got_desc): Remove.
176 (Incremental_got_plt_reader::get_got_symndx): New function.
177 (Incremental_got_plt_reader::get_got_input_index): New function.
178 (Sized_incremental_binary::Sized_incremental_binary): Remove
179 file_status_; add input_objects_.
180 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
181 (Sized_incremental_binary::set_file_is_unchanged): Remove.
182 (Sized_incremental_binary::file_is_unchanged): Remove.
183 (Sized_incremental_binary::set_input_object): New function.
184 (Sized_incremental_binary::input_object): New function.
185 (Sized_incremental_binary::file_status_): Remove.
186 (Sized_incremental_binary::input_objects_): New data member.
187 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
188 references.
189 (Sized_relobj_incr::invalid_address): Move to base class.
190 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
191 class.
192 (Sized_relobj_incr::do_output_section_offset): Likewise.
193 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
194 (Sized_relobj_incr::section_offsets_): Likewise.
195 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
196 function.
197 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
198 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
199 with accessor function.
200 (Sized_relobj_file::do_layout): Likewise.
201 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
202 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
203 (Sized_relobj_file::compute_final_local_value): Replace refs to
204 section_offsets_ with accessor function.
205 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
206 * object.h (Relobj::Relobj): Initialize new data members.
207 (Relobj::add_dyn_reloc): New function.
208 (Relobj::first_dyn_reloc): New function.
209 (Relobj::dyn_reloc_count): New function.
210 (Relobj::first_dyn_reloc_): New data member.
211 (Relobj::dyn_reloc_count_): New data member.
212 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
213 references.
214 (Sized_relobj::Address): New typedef.
215 (Sized_relobj::invalid_address): Move here from child class.
216 (Sized_relobj::Sized_relobj): Initialize new data members.
217 (Sized_relobj::sized_relobj): New function.
218 (Sized_relobj::is_output_section_offset_invalid): Move here from
219 child class.
220 (Sized_relobj::get_output_section_offset): Likewise.
221 (Sized_relobj::local_has_got_offset): Likewise.
222 (Sized_relobj::local_got_offset): Likewise.
223 (Sized_relobj::set_local_got_offset): Likewise.
224 (Sized_relobj::do_for_all_local_got_entries): Likewise.
225 (Sized_relobj::clear_got_offsets): New function.
226 (Sized_relobj::section_offsets): Move here from child class.
227 (Sized_relobj::do_output_section_offset): Likewise.
228 (Sized_relobj::do_set_section_offset): Likewise.
229 (Sized_relobj::Local_got_offsets): Likewise.
230 (Sized_relobj::local_got_offsets_): Likewise.
231 (Sized_relobj::section_offsets_): Likewise.
232 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
233 references.
234 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
235 class.
236 (Sized_relobj_file::sized_relobj): New function
237 (Sized_relobj_file::local_has_got_offset): Move to base class.
238 (Sized_relobj_file::local_got_offset): Likewise.
239 (Sized_relobj_file::set_local_got_offset): Likewise.
240 (Sized_relobj_file::get_output_section_offset): Likewise.
241 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
242 (Sized_relobj_file::do_output_section_offset): Likewise.
243 (Sized_relobj_file::do_set_section_offset): Likewise.
244 (Sized_relobj_file::Local_got_offsets): Likewise.
245 (Sized_relobj_file::local_got_offsets_): Likewise.
246 (Sized_relobj_file::section_offsets_): Likewise.
247 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
248 (all constructors).
249 (set_needs_dynsym_index): Convert relobj to derived class pointer.
250 (Output_reloc::get_symbol_index): Likewise.
251 (Output_reloc::local_section_offset): Likewise.
252 (Output_reloc::get_address): Likewise.
253 (Output_reloc::symbol_value): Likewise.
254 (Output_data_got::reserve_slot): Move to class definition.
255 (Output_data_got::reserve_local): New function.
256 (Output_data_got::reserve_slot_for_global): Remove.
257 (Output_data_got::reserve_global): New function.
258 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
259 (all constructors, two instantiations).
260 (Output_reloc::get_relobj): New function (two instantiations).
261 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
262 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
263 (Output_data_reloc::add_global): Adjust type of relobj.
264 (Output_data_reloc::add_global_relative): Likewise.
265 (Output_data_reloc::add_symbolless_global_addend): Likewise.
266 (Output_data_reloc::add_local): Likewise.
267 (Output_data_reloc::add_local_relative): Likewise.
268 (Output_data_reloc::add_symbolless_local_addend): Likewise.
269 (Output_data_reloc::add_local_section): Likewise.
270 (Output_data_reloc::add_output_section): Likewise.
271 (Output_data_reloc::add_absolute): Likewise.
272 (Output_data_reloc::add_target_specific): Likewise.
273 (Output_data_got::reserve_slot): Move definition here.
274 (Output_data_got::reserve_local): New function.
275 (Output_data_got::reserve_global): New function.
276 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
277 section_offsets_ with accessor function.
278 (Sized_relobj_file::write_sections): Likewise.
279 (Sized_relobj_file::do_relocate_sections): Likewise.
280 * target.h (Sized_target::reserve_local_got_entry): New function.
281 (Sized_target::reserve_global_got_entry): New function.
282 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
283 (Target_x86_64::reserve_global_got_entry): New function.
284 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
285
4829d394
CC
2862011-05-23 Cary Coutant <ccoutant@google.com>
287
288 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
289 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
290 bit when checking got_type.
291 * incremental.cc (Sized_incremental_binary::setup_readers):
292 Store symbol table and string table locations; initialize bit vector
293 of file status flags.
294 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
295 unchanged files.
296 (Sized_incremental_binary::do_process_got_plt): New function.
297 (Sized_incremental_binary::get_symtab_view): Use stored locations.
298 (Output_section_incremental_inputs::set_final_data_size): Record
299 file index for each input file.
300 (Output_section_incremental_inputs::write_got_plt): Store file index
301 instead of input entry offset for each GOT entry.
302 * incremental.h
303 (Incremental_input_entry::Incremental_input_entry): Initialize new
304 data member.
305 (Incremental_input_entry::set_offset): Store file index.
306 (Incremental_input_entry::get_file_index): New function.
307 (Incremental_input_entry::file_index_): New data member.
308 (Incremental_binary::process_got_plt): New function.
309 (Incremental_binary::do_process_got_plt): New function.
310 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
311 data members.
312 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
313 (Sized_incremental_binary::set_file_is_unchanged): New function.
314 (Sized_incremental_binary::file_is_unchanged): New function.
315 (Sized_incremental_binary::do_process_got_plt): New function.
316 (Sized_incremental_binary::file_status_): New data member.
317 (Sized_incremental_binary::main_symtab_loc_): New data member.
318 (Sized_incremental_binary::main_strtab_loc_): New data member.
319 * output.cc (Output_data_got::Got_entry::write): Add case
320 RESERVED_CODE.
321 (Output_data_got::add_global): Call add_got_entry.
322 (Output_data_got::add_global_plt): Likewise.
323 (Output_data_got::add_global_with_rel): Likewise.
324 (Output_data_got::add_global_with_rela): Likewise.
325 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
326 (Output_data_got::add_global_pair_with_rela): Likewise.
327 (Output_data_got::add_local): Call add_got_entry.
328 (Output_data_got::add_local_plt): Likewise.
329 (Output_data_got::add_local_with_rel): Likewise.
330 (Output_data_got::add_local_with_rela): Likewise.
331 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
332 (Output_data_got::add_local_pair_with_rela): Likewise.
333 (Output_data_got::reserve_slot): New function.
334 (Output_data_got::reserve_slot_for_global): New function.
335 (Output_data_got::add_got_entry): New function.
336 (Output_data_got::add_got_entry_pair): New function.
337 (Output_section::add_output_section_data): Edit FIXME.
338 * output.h
339 (Output_section_data_build::Output_section_data_build): New
340 constructor with size parameter.
341 (Output_data_space::Output_data_space): Likewise.
342 (Output_data_got::Output_data_got): Initialize new data member; new
343 constructor with size parameter.
344 (Output_data_got::add_constant): Call add_got_entry.
345 (Output_data_got::reserve_slot): New function.
346 (Output_data_got::reserve_slot_for_global): New function.
347 (class Output_data_got::Got_entry): Add RESERVED_CODE.
348 (Output_data_got::add_got_entry): New function.
349 (Output_data_got::add_got_entry_pair): New function.
350 (Output_data_got::free_list_): New data member.
351 * target.h (Sized_target::init_got_plt_for_update): New function.
352 (Sized_target::register_global_plt_entry): New function.
353 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
354 Initialize new data member; call init; add constructor with PLT count.
355 (Output_data_plt_x86_64::init): New function.
356 (Output_data_plt_x86_64::add_relocation): New function.
357 (Output_data_plt_x86_64::reserve_slot): New function.
358 (Output_data_plt_x86_64::free_list_): New data member.
359 (Target_x86_64::init_got_plt_for_update): New function.
360 (Target_x86_64::register_global_plt_entry): New function.
361 (Output_data_plt_x86_64::add_entry): Allocate from free list for
362 incremental updates.
363 (Output_data_plt_x86_64::add_relocation): New function.
364 * testsuite/object_unittest.cc (Object_test): Set default options.
365
ec69d6da
ILT
3662011-05-16 Ian Lance Taylor <iant@google.com>
367
368 * options.h (class General_options): Make -i a synonym for -r.
369
732e31de
ILT
3702011-05-16 Ian Lance Taylor <iant@google.com>
371
372 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
373
403676b5
CC
3742011-05-10 Cary Coutant <ccoutant@google.com>
375
376 * object.cc (Sized_relobj::do_count_local_symbols): Check for
377 strip_all (-s).
378
5b7b7d6e
ILT
3792011-05-06 Ian Lance Taylor <iant@google.com>
380
381 * layout.cc (Layout::layout): If the output section flags change,
382 update the ordering.
383
f0f9babf
CC
3842011-04-25 Cary Coutant <ccoutant@google.com>
385
386 * incremental-dump.cc (dump_incremental_inputs): Print local
387 symbol info for each input file.
388 * incremental.cc
389 (Output_section_incremental_inputs::set_final_data_size): Add local
390 symbol info to input file entries in incremental info.
391 (Output_section_incremental_inputs::write_info_blocks): Likewise.
392 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
393 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
394 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
395 implementation.
396 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
397 (Sized_incr_relobj::do_relocate): Write the local symbols.
398 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
399 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
400 Adjust size of input file header.
401 (Incremental_inputs_reader::get_local_symbol_offset): New function.
402 (Incremental_inputs_reader::get_local_symbol_count): New function.
403 (Incremental_inputs_reader::get_input_section): Adjust size of input
404 file header.
405 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
406 (Sized_incr_relobj::This): New typedef.
407 (Sized_incr_relobj::sym_size): New const data member.
408 (Sized_incr_relobj::Local_symbol): New struct.
409 (Sized_incr_relobj::do_output_local_symbol_count): New function.
410 (Sized_incr_relobj::do_local_symbol_offset): New function.
411 (Sized_incr_relobj::local_symbol_count_): New data member.
412 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
413 (Sized_incr_relobj::local_symbol_index_): New data member.
414 (Sized_incr_relobj::local_symbol_offset_): New data member.
415 (Sized_incr_relobj::local_dynsym_offset_): New data member.
416 (Sized_incr_relobj::local_symbols_): New data member.
417 * object.h (Relobj::output_local_symbol_count): New function.
418 (Relobj::local_symbol_offset): New function.
419 (Relobj::do_output_local_symbol_count): New function.
420 (Relobj::do_local_symbol_offset): New function.
421 (Sized_relobj::do_output_local_symbol_count): New function.
422 (Sized_relobj::do_local_symbol_offset): New function.
423
d0a9ace3
ILT
4242011-04-22 Vladimir Simonov <sv@sw.ru>
425
426 * descriptors.cc (set_close_on_exec): New function.
427 (Descriptors::open): Use set_close_on_exec.
428 * output.cc (S_ISLNK): Define if not defined.
429
94a3fc8b
CC
4302011-04-22 Cary Coutant <ccoutant@google.com>
431
432 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
433 global symbol map.
434 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
435 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
436 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
437 relocations.
438 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
439 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
440 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
441 * incremental.h
442 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
443 function.
444 (Incremental_binary::apply_incremental_relocs): New function.
445 (Incremental_binary::do_apply_incremental_relocs): New function.
446 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
447 data member.
448 (Sized_incremental_binary::add_global_symbol): New function.
449 (Sized_incremental_binary::global_symbol): New function.
450 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
451 (Sized_incremental_binary::symbol_map_): New data member.
452 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
453 * target.h (Sized_target::apply_relocation): New function.
454 * target-reloc.h (apply_relocation): New function.
455 * x86_64.cc (Target_x86_64::apply_relocation): New function.
456
c87e4302
DK
4572011-04-22 Doug Kwan <dougkwan@google.com>
458
459 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
460 flag of a SHT_ARM_EXIDX section.
461 * testsuite/Makefile.am (arm_exidx_test): New test rules.
462 * testsuite/Makefile.in: Regenerate.
463 * testsuite/arm_exidx_test.s: New file.
464 * testsuite/arm_exidx_test.sh: Same.
465
e7782cf6
CC
4662011-04-20 Cary Coutant <ccoutant@google.com>
467
468 PR gold/12689
469 * archive.h (Incremental_archive_entry::Archive_member):
470 Initialize arg_serial_ (second constructor).
471
308ecdc7
ILT
4722011-04-17 Ian Lance Taylor <iant@google.com>
473
474 * object.cc (Relocate_info::location): Simplify location string.
475 * errors.cc (Errors::error_at_location): Don't print program
476 name.
477 (Errors::warning_at_location): Likewise.
478 (Errors::undefined_symbol): Likewise.
479 * testsuite/debug_msg.sh: Update accordingly.
480
bec5b579
CC
4812011-04-14 Cary Coutant <ccoutant@google.com>
482
483 * gold/layout.cc (Layout::symtab_section_offset): New function.
484 * gold/layout.h (Layout::symtab_section_offset): New function.
485 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
486
88597d34
ILT
4872011-04-12 Ian Lance Taylor <iant@google.com>
488
489 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
490 with MREMAP_MAYMOVE.
491 * output.h (class Output_file): Add map_is_allocated_ field.
492 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
493 not available, provide stubs. If mremap is not available, #define
494 it to gold_mremap.
495 (MREMAP_MAYMOVE): Define if not defined.
496 (Output_file::Output_file): Initialize map_is_allocated_.
497 (Output_file::resize): Check map_is_allocated_.
498 (Output_file::map_anonymous): If mmap fails, use malloc.
499 (Output_file::unmap): Don't do anything for an anonymous map.
500 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
501 is not available, provide stubs.
502 (File_read::View::~View): Use free rather than delete[].
503 (File_read::make_view): Use malloc rather than new[]. If mmap
504 fails, use malloc.
505 (File_read::find_or_make_view): Use malloc rather than new[].
506 * gold.h: Remove HAVE_REMAP code.
507 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
508 exists. Rename mremap to gold_mremap. If mmap is not available
509 don't do anything.
510 * configure, config.in: Rebuild.
511
11e361bc
ILT
5122011-04-11 Ian Lance Taylor <iant@google.com>
513
514 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
515 initialize local variable v.
516
cdc29364
CC
5172011-04-11 Cary Coutant <ccoutant@google.com>
518
519 * archive.cc (Archive::include_member): Adjust call to
520 report_object.
521 (Add_archive_symbols::run): Track argument serial numbers.
522 (Lib_group::include_member): Likewise.
523 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
524 * archive.h (Incremental_archive_entry::Archive_member):
525 Initialize arg_serial_.
526 (Archive_member::arg_serial_): New data member.
527 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
528 (Sized_dynobj::do_add_symbols): Track symbols when doing an
529 incremental link.
530 (Sized_dynobj::do_for_all_local_got_entries): New function.
531 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
532 function.
533 * fileread.cc (get_mtime): New function.
534 * fileread.h (get_mtime): New function.
535 * gold.cc (queue_initial_tasks): Check for incremental update.
536 (process_incremental_input): New function.
537 (queue_middle_tasks): Don't force valid target for incremental
538 update.
539 * incremental-dump.cc (find_input_containing_global): Adjust
540 size of symbol info entry.
541 (dump_incremental_inputs): Dump argument serial number and
542 in_system_directory flag; bias shndx by 1; print symbol names
543 when dumping per-file symbol lists; use new symbol info readers.
544 * incremental.cc
545 (Output_section_incremental_inputs:update_data_size): New function.
546 (Sized_incremental_binary::setup_readers): Setup input readers
547 for each input file; build maps for files added from libraries
548 and scripts.
549 (Sized_incremental_binary::check_input_args): New function.
550 (Sized_incremental_binary::do_check_inputs): Build map of argument
551 serial numbers to input arguments.
552 (Sized_incremental_binary::do_file_has_changed): Rename
553 do_file_is_unchanged to this; compare file modification times.
554 (Sized_incremental_binary::do_init_layout): New function.
555 (Sized_incremental_binary::do_reserve_layout): New function.
556 (Sized_incremental_binary::do_get_input_reader): Remove.
557 (Sized_incremental_binary::get_symtab_view): New function.
558 (Incremental_checker::can_incrementally_link_output_file): Remove.
559 (Incremental_inputs::report_command_line): Exclude --debug options.
560 (Incremental_inputs::report_archive_begin): Add parameter; track
561 argument serial numbers; don't put input file entry for archive
562 before archive members.
563 (Incremental_inputs::report_archive_end): Put input file entry
564 for archive after archive members.
565 (Incremental_inputs::report_object): Add parameter; track argument
566 serial numbers and in_system_directory flag.
567 (Incremental_inputs::report_script): Add parameter; track argument
568 serial numbers.
569 (Output_section_incremental_inputs::set_final_data_size): Adjust
570 size of symbol info entry; check for forwarding symbols.
571 (Output_section_incremental_inputs::write_input_files): Write
572 in_system_directory flag and argument serial number.
573 (Output_section_incremental_inputs::write_info_blocks): Map section
574 indices between incremental info and original input file; store
575 input section index for each symbol.
576 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
577 change operator() to visit().
578 (class Global_got_offset_visitor): Likewise.
579 (class Global_symbol_visitor_got_plt):
580 (Output_section_incremental_inputs::write_got_plt): Use new visitor
581 classes.
582 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
583 (Sized_incr_relobj::do_read_symbols): New function.
584 (Sized_incr_relobj::do_layout): New function.
585 (Sized_incr_relobj::do_layout_deferred_sections): New function.
586 (Sized_incr_relobj::do_add_symbols): New function.
587 (Sized_incr_relobj::do_should_include_member): New function.
588 (Sized_incr_relobj::do_for_all_global_symbols): New function.
589 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
590 (Sized_incr_relobj::do_section_size): New function.
591 (Sized_incr_relobj::do_section_name): New function.
592 (Sized_incr_relobj::do_section_contents): New function.
593 (Sized_incr_relobj::do_section_flags): New function.
594 (Sized_incr_relobj::do_section_entsize): New function.
595 (Sized_incr_relobj::do_section_address): New function.
596 (Sized_incr_relobj::do_section_type): New function.
597 (Sized_incr_relobj::do_section_link): New function.
598 (Sized_incr_relobj::do_section_info): New function.
599 (Sized_incr_relobj::do_section_addralign): New function.
600 (Sized_incr_relobj::do_initialize_xindex): New function.
601 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
602 (Sized_incr_relobj::do_read_relocs): New function.
603 (Sized_incr_relobj::do_gc_process_relocs): New function.
604 (Sized_incr_relobj::do_scan_relocs): New function.
605 (Sized_incr_relobj::do_count_local_symbols): New function.
606 (Sized_incr_relobj::do_finalize_local_symbols): New function.
607 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
608 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
609 (Sized_incr_relobj::do_relocate): New function.
610 (Sized_incr_relobj::do_set_section_offset): New function.
611 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
612 (Sized_incr_dynobj::do_read_symbols): New function.
613 (Sized_incr_dynobj::do_layout): New function.
614 (Sized_incr_dynobj::do_add_symbols): New function.
615 (Sized_incr_dynobj::do_should_include_member): New function.
616 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
617 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
618 (Sized_incr_dynobj::do_section_size): New function.
619 (Sized_incr_dynobj::do_section_name): New function.
620 (Sized_incr_dynobj::do_section_contents): New function.
621 (Sized_incr_dynobj::do_section_flags): New function.
622 (Sized_incr_dynobj::do_section_entsize): New function.
623 (Sized_incr_dynobj::do_section_address): New function.
624 (Sized_incr_dynobj::do_section_type): New function.
625 (Sized_incr_dynobj::do_section_link): New function.
626 (Sized_incr_dynobj::do_section_info): New function.
627 (Sized_incr_dynobj::do_section_addralign): New function.
628 (Sized_incr_dynobj::do_initialize_xindex): New function.
629 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
630 (make_sized_incremental_object): New function.
631 (Incremental_library::copy_unused_symbols): New function.
632 (Incremental_library::do_for_all_unused_symbols): New function.
633 * incremental.h (enum Incremental_input_flags): New type.
634 (class Incremental_checker): Remove.
635 (Incremental_input_entry::Incremental_input_entry): Add argument
636 serial number.
637 (Incremental_input_entry::arg_serial): New function.
638 (Incremental_input_entry::set_is_in_system_directory): New function.
639 (Incremental_input_entry::is_in_system_directory): New function.
640 (Incremental_input_entry::arg_serial_): New data member.
641 (Incremental_input_entry::is_in_system_directory_): New data member.
642 (class Script_info): Move here from script.h.
643 (Script_info::Script_info): Add filename parameter.
644 (Script_info::filename): New function.
645 (Script_info::filename_): New data member.
646 (Incremental_script_entry::Incremental_script_entry): Add argument
647 serial number.
648 (Incremental_object_entry::Incremental_object_entry): Likewise.
649 (Incremental_object_entry::add_input_section): Build list of input
650 sections with map to original shndx.
651 (Incremental_object_entry::get_input_section_index): New function.
652 (Incremental_object_entry::shndx_): New data member.
653 (Incremental_object_entry::name_key_): Rename; adjust all refs.
654 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
655 (Incremental_archive_entry::Incremental_archive_entry): Add argument
656 serial number.
657 (Incremental_inputs::report_archive_begin): Likewise.
658 (Incremental_inputs::report_object): Likewise.
659 (Incremental_inputs::report_script): Likewise.
660 (class Incremental_global_symbol_reader): New class.
661 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
662 and store flags and input file type.
663 (Incremental_input_entry_reader::arg_serial): New function.
664 (Incremental_input_entry_reader::type): Extract type from flags.
665 (Incremental_input_entry_reader::is_in_system_directory): New function.
666 (Incremental_input_entry_reader::get_input_section_count): Call
667 accessor function for type.
668 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
669 function for type; adjust size of global symbol entry.
670 (Incremental_input_entry_reader::get_global_symbol_count): Call
671 accessor function for type.
672 (Incremental_input_entry_reader::get_object_count): Likewise.
673 (Incremental_input_entry_reader::get_object_offset): Likewise.
674 (Incremental_input_entry_reader::get_member_count): Likewise.
675 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
676 (Incremental_input_entry_reader::get_member_offset): Likewise.
677 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
678 (Incremental_input_entry_reader::Global_symbol_info): Remove.
679 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
680 (Incremental_input_entry_reader::get_global_symbol_reader): New
681 function.
682 (Incremental_input_entry_reader::get_output_symbol_index): New
683 function.
684 (Incremental_input_entry_reader::type_): Remove.
685 (Incremental_input_entry_reader::flags_): New data member.
686 (Incremental_inputs_reader::input_file_offset): New function.
687 (Incremental_inputs_reader::input_file_index): New function.
688 (Incremental_inputs_reader::input_file): Call input_file_offset.
689 (Incremental_inputs_reader::input_file_at_offset): New function.
690 (Incremental_relocs_reader::get_r_type): Reformat.
691 (Incremental_relocs_reader::get_r_shndx): Reformat.
692 (Incremental_relocs_reader::get_r_offset): Reformat.
693 (Incremental_relocs_reader::data): New function.
694 (Incremental_binary::Incremental_binary): Initialize new data members.
695 (Incremental_binary::check_inputs): Add cmdline parameter.
696 (Incremental_binary::file_is_unchanged): Remove.
697 (Input_reader::arg_serial): New function.
698 (Input_reader::get_unused_symbol_count): New function.
699 (Input_reader::get_unused_symbol): New function.
700 (Input_reader::do_arg_serial): New function.
701 (Input_reader::do_get_unused_symbol_count): New function.
702 (Input_reader::do_get_unused_symbol): New function.
703 (Incremental_binary::input_file_count): New function.
704 (Incremental_binary::get_input_reader): Change signature to use
705 index instead of filename.
706 (Incremental_binary::file_has_changed): New function.
707 (Incremental_binary::get_input_argument): New function.
708 (Incremental_binary::get_library): New function.
709 (Incremental_binary::get_script_info): New function.
710 (Incremental_binary::init_layout): New function.
711 (Incremental_binary::reserve_layout): New function.
712 (Incremental_binary::output_file): New function.
713 (Incremental_binary::do_check_inputs): New function.
714 (Incremental_binary::do_file_is_unchanged): Remove.
715 (Incremental_binary::do_file_has_changed): New function.
716 (Incremental_binary::do_init_layout): New function.
717 (Incremental_binary::do_reserve_layout): New function.
718 (Incremental_binary::do_input_file_count): New function.
719 (Incremental_binary::do_get_input_reader): Change signature.
720 (Incremental_binary::input_args_map_): New data member.
721 (Incremental_binary::library_map_): New data member.
722 (Incremental_binary::script_map_): New data member.
723 (Sized_incremental_binary::Sized_incremental_binary): Initialize
724 new data members.
725 (Sized_incremental_binary::output_section): New function.
726 (Sized_incremental_binary::inputs_reader): Add const.
727 (Sized_incremental_binary::symtab_reader): Add const.
728 (Sized_incremental_binary::relocs_reader): Add const.
729 (Sized_incremental_binary::got_plt_reader): Add const.
730 (Sized_incremental_binary::get_symtab_view): New function.
731 (Sized_incremental_binary::Inputs_reader): New typedef.
732 (Sized_incremental_binary::Input_entry_reader): New typedef.
733 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
734 (Sized_incremental_binary::do_file_is_unchanged): Remove.
735 (Sized_incremental_binary::do_file_has_changed): New function.
736 (Sized_incremental_binary::do_init_layout): New function.
737 (Sized_incremental_binary::do_reserve_layout): New function.
738 (Sized_input_reader::Inputs_reader): Remove.
739 (Sized_input_reader::Input_entry_reader): Remove.
740 (Sized_input_reader::do_arg_serial): New function.
741 (Sized_input_reader::do_get_unused_symbol_count): New function.
742 (Sized_input_reader::do_get_unused_symbol): New function.
743 (Sized_incremental_binary::do_input_file_count): New function.
744 (Sized_incremental_binary::do_get_input_reader): Change signature;
745 use index instead of filename.
746 (Sized_incremental_binary::section_map_): New data member.
747 (Sized_incremental_binary::input_entry_readers_): New data member.
748 (class Sized_incr_relobj): New class.
749 (class Sized_incr_dynobj): New class.
750 (make_sized_incremental_object): New function.
751 (class Incremental_library): New class.
752 * layout.cc (Free_list::num_lists): New static data member.
753 (Free_list::num_nodes): New static data member.
754 (Free_list::num_removes): New static data member.
755 (Free_list::num_remove_visits): New static data member.
756 (Free_list::num_allocates): New static data member.
757 (Free_list::num_allocate_visits): New static data member.
758 (Free_list::init): New function.
759 (Free_list::remove): New function.
760 (Free_list::allocate): New function.
761 (Free_list::dump): New function.
762 (Free_list::print_stats): New function.
763 (Layout_task_runner::run): Resize output file for incremental updates.
764 (Layout::Layout): Initialize new data members.
765 (Layout::set_incremental_base): New function.
766 (Layout::init_fixed_output_section): New function.
767 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
768 incremental updates.
769 (Layout::create_gold_note): Do not create gold note section for
770 incremental updates.
771 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
772 for incremental updates.
773 (Layout::set_section_offsets): For incremental updates, allocate space
774 from free list.
775 (Layout::create_symtab_sections): Layout with offsets relative to
776 start of section; for incremental updates, allocate space from free
777 list.
778 (Layout::create_shdrs): For incremental updates, allocate space from
779 free list.
780 (Layout::finish_dynamic_section): For incremental updates, do not
781 check --as-needed (fixed in subsequent patch).
782 * layout.h (class Free_list): New class.
783 (Layout::set_incremental_base): New function.
784 (Layout::incremental_base): New function.
785 (Layout::init_fixed_output_section): New function.
786 (Layout::allocate): New function.
787 (Layout::incremental_base_): New data member.
788 (Layout::free_list_): New data member.
789 * main.cc (main): Print Free_list statistics.
790 * object.cc (Relobj::finalize_incremental_relocs): Add
791 clear_counts parameter; clear counts only when clear_counts is set.
792 (Sized_relobj::Sized_relobj): Initialize new base class.
793 (Sized_relobj::do_layout): Don't report special sections.
794 (Sized_relobj::do_for_all_local_got_entries): New function.
795 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
796 symtab_off to all symbol table offsets.
797 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
798 * object.h (class Got_offset_list): Move to top of file.
799 (Object::Object): Allow case where input_file == NULL.
800 (Object::~Object): Likewise.
801 (Object::input_file): Assert that input_file != NULL.
802 (Object::lock): Allow case where input_file == NULL.
803 (Object::unlock): Likewise.
804 (Object::is_locked): Likewise.
805 (Object::token): Likewise.
806 (Object::release): Likewise.
807 (Object::is_incremental): New function.
808 (Object::get_mtime): New function.
809 (Object::for_all_local_got_entries): New function.
810 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
811 (Object::set_is_in_system_directory): New function.
812 (Object::is_in_system_directory): New function.
813 (Object::do_is_incremental): New function.
814 (Object::do_get_mtime): New function.
815 (Object::do_for_all_local_got_entries): New function.
816 (Object::is_in_system_directory_): New data member.
817 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
818 (class Sized_relobj_base): New class.
819 (class Sized_relobj): Derive from Sized_relobj_base.
820 (class Sized_relobj::Symbols): Redeclare from base class.
821 (class Sized_relobj::local_got_offset_list): Remove.
822 (class Sized_relobj::Output_sections): Redeclare from base class.
823 (class Sized_relobj::do_for_all_local_got_entries): New function.
824 (class Sized_relobj::write_local_symbols): Add offset parameter.
825 (class Sized_relobj::local_symbol_offset_): Update comment.
826 (class Sized_relobj::local_dynsym_offset_): Update comment.
827 * options.cc (Input_arguments::add_file): Remove const.
828 * options.h (Input_file_argument::Input_file_argument):
829 Initialize arg_serial_ (all constructors).
830 (Input_file_argument::set_arg_serial): New function.
831 (Input_file_argument::arg_serial): New function.
832 (Input_file_argument::arg_serial_): New data member.
833 (Input_arguments::Input_arguments): Initialize file_count_.
834 (Input_arguments::add_file): Remove const.
835 (Input_arguments::number_of_input_files): New function.
836 (Input_arguments::file_count_): New data member.
837 (Command_line::number_of_input_files): Call
838 Input_arguments::number_of_input_files.
839 * output.cc (Output_segment_headers::Output_segment_headers):
840 Set current size.
841 (Output_section::Input_section::current_data_size): New function.
842 (Output_section::Output_section): Initialize new data members.
843 (Output_section::add_input_section): Don't do merge sections for
844 an incremental link; allocate space from free list for an
845 incremental update.
846 (Output_section::add_output_section_data): Allocate space from
847 free list for an incremental update.
848 (Output_section::update_data_size): New function.
849 (Output_section::set_fixed_layout): New function.
850 (Output_section::reserve): New function.
851 (Output_segment::set_section_addresses): Remove const.
852 (Output_segment::set_section_list_addresses): Remove const; allocate
853 space from free list for an incremental update.
854 (Output_segment::set_offset): Adjust size of RELRO segment for an
855 incremental update.
856 * output.h (Output_data::current_data_size): Move here from
857 child classes.
858 (Output_data::pre_finalize_data_size): New function.
859 (Output_data::update_data_size): New function.
860 (Output_section_headers::update_data_size): new function.
861 (Output_section_data_build::current_data_size): Move to Output_data.
862 (Output_data_strtab::update_data_size): New function.
863 (Output_section::current_data_size): Move to Output_data.
864 (Output_section::set_fixed_layout): New function.
865 (Output_section::has_fixed_layout): New function.
866 (Output_section::reserve): New function.
867 (Output_section::update_data_size): New function.
868 (Output_section::has_fixed_layout_): New data member.
869 (Output_section::free_list_): New data member.
870 (Output_segment::set_section_addresses): Remove const.
871 (Output_segment::set_section_list_addresses): Remove const.
872 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
873 New function.
874 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
875 New function.
876 * readsyms.cc (Read_symbols::do_read_symbols): Add library
877 parameter when calling Add_symbols constructor; store argument
878 serial number for members of a lib group.
879 (Add_symbols::locks): Allow case where token == NULL.
880 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
881 (Read_member::~Read_member): New function.
882 (Read_member::is_runnable): New function.
883 (Read_member::locks): New function.
884 (Read_member::run): New function.
885 (Check_script::~Check_script): New function.
886 (Check_script::is_runnable): New function.
887 (Check_script::locks): New function.
888 (Check_script::run): New function.
889 (Check_library::~Check_library): New function.
890 (Check_library::is_runnable): New function.
891 (Check_library::locks): New function.
892 (Check_library::run): New function.
893 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
894 (Add_symbols::library_): New data member.
895 (class Read_member): New class.
896 (class Check_script): New class.
897 (class Check_library): New class.
898 * reloc.cc (Read_relocs::is_runnable): Allow case where
899 token == NULL.
900 (Read_relocs::locks): Likewise.
901 (Scan_relocs::locks): Likewise.
902 (Relocate_task::locks): Likewise.
903 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
904 to clear counters.
905 (Sized_relobj::incremental_relocs_scan): Fix comment.
906 (Sized_relobj::do_relocate): Pass output file offset to
907 write_local_symbols.
908 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
909 from class declaration.
910 * script.cc (read_input_script): Allocate Script_info; pass
911 argument serial number to report_script.
912 * script.h (class Script_info): Move to incremental.h.
913 * symtab.cc (Symbol_table::add_from_incrobj): New function.
914 * symtab.h (Symbol_table::add_from_incrobj): New function.
915 (Symbol_table::set_file_offset): New function.
916
b961d0d7
CC
9172011-04-05 Cary Coutant <ccoutant@google.com>
918
919 * incremental-dump.cc (dump_incremental_inputs): Change signature
920 to take a Sized_incremental_binary; change caller. Use readers
921 in Sized_incremental_binary.
922 * incremental.cc
923 (Sized_incremental_binary::find_incremental_inputs_sections):
924 Rename do_find_incremental_inputs_sections to this.
925 (Sized_incremental_binary::setup_readers): New function.
926 (Sized_incremental_binary::do_check_inputs): Check
927 has_incremental_info_ flag; move setup code to setup_readers;
928 use input readers.
929 (Sized_incremental_binary::do_file_is_unchanged): New function.
930 (Sized_incremental_binary::do_get_input_reader): New function.
931 * incremental.h (class Incremental_binary): Move to end of file.
932 (Incremental_binary::file_is_unchanged): New function.
933 (Incremental_binary::do_file_is_unchanged): New function.
934 (Incremental_binary::Input_reader): New class.
935 (Incremental_binary::get_input_reader): New function.
936 (class Sized_incremental_binary): Move to end of file.
937 (Sized_incremental_binary::Sized_incremental_binary): Setup the
938 input section reader classes.
939 (Sized_incremental_binary::has_incremental_info): New function.
940 (Sized_incremental_binary::inputs_reader): New function.
941 (Sized_incremental_binary::symtab_reader): New function.
942 (Sized_incremental_binary::relocs_reader): New function.
943 (Sized_incremental_binary::got_plt_reader): New function.
944 (Sized_incremental_binary::do_file_is_unchanged): New function.
945 (Sized_incremental_binary::Sized_input_reader): New class.
946 (Sized_incremental_binary::get_input_reader): New function.
947 (Sized_incremental_binary::find_incremental_inputs_sections):
948 Rename do_find_incremental_inputs_sections to this.
949 (Sized_incremental_binary::setup_readers): New function.
950 (Sized_incremental_binary::has_incremental_info_): New data member.
951 (Sized_incremental_binary::inputs_reader_): New data member.
952 (Sized_incremental_binary::symtab_reader_): New data member.
953 (Sized_incremental_binary::relocs_reader_): New data member.
954 (Sized_incremental_binary::got_plt_reader_): New data member.
955 (Sized_incremental_binary::current_input_file_): New data member.
956
a869183f
PP
9572011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
958
959 PR gold/12640
960 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
961 violation.
962
9632011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
964
965 * archive.cc (Archive::include_member): Adjust call to report_object.
966 (Add_archive_symbols::run): Add script_info to call to
967 report_archive_begin.
968 (Lib_group::include_member): Adjust call to report_object.
969 (Add_lib_group_symbols::run): Adjust call to report_object.
970 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
971 blocks. Add object count for script input files.
972 * incremental.cc (Incremental_inputs::report_archive_begin): Add
973 script_info parameter; change all callers.
974 (Incremental_inputs::report_object): Add script_info parameter;
975 change all callers.
976 (Incremental_inputs::report_script): Store backpointer to
977 incremental info entry.
978 (Output_section_incremental_inputs::set_final_data_size): Record
979 additional information for scripts.
980 (Output_section_incremental_inputs::write_info_blocks): Likewise.
981 * incremental.h (Incremental_script_entry::add_object): New function.
982 (Incremental_script_entry::get_object_count): New function.
983 (Incremental_script_entry::get_object): New function.
984 (Incremental_script_entry::objects_): New data member; adjust
985 constructor.
986 (Incremental_inputs::report_archive_begin): Add script_info parameter.
987 (Incremental_inputs::report_object): Add script_info parameter.
988 (Incremental_inputs_reader::get_object_count): New function.
989 (Incremental_inputs_reader::get_object_offset): New function.
990 * options.cc (Input_arguments::add_file): Return reference to
991 new input argument.
992 * options.h (Input_argument::set_script_info): New function.
993 (Input_argument::script_info): New function.
994 (Input_argument::script_info_): New data member; adjust all
995 constructors.
996 (Input_file_group::add_file): Return reference to new input argument.
997 (Input_file_lib::add_file): Likewise.
998 (Input_arguments::add_file): Likewise.
999 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1000 * script.cc (Parser_closure::Parser_closure): Add script_info
1001 parameter; adjust all callers.
1002 (Parser_closure::script_info): New function.
1003 (Parser_closure::script_info_): New data member.
1004 (read_input_script): Report scripts earlier to incremental info.
1005 (script_add_file): Set script_info in Input_argument.
1006 (script_add_library): Likewise.
1007 * script.h (Script_options::Script_info): Rewrite class.
1008
a869183f 10092011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
1010
1011 * archive.cc (Library_base::should_include_member): Move
1012 method here from class Archive.
1013 (Archive::Archive): Initialize base class.
1014 (Archive::should_include_member): Move to base class.
1015 (Archive::do_for_all_unused_symbols): New function.
1016 (Add_archive_symbols::run): Remove redundant access to
1017 incremental_inputs.
1018 (Lib_group::Lib_group): Initialize base class.
1019 (Lib_group::do_filename): New function.
1020 (Lib_group::include_member): Pass pointer to Lib_group to
1021 report_object.
1022 (Lib_group::do_for_all_unused_symbols): New function.
1023 (Add_lib_group_symbols::run): Report archive information for
1024 incremental links.
1025 * archive.h (class Library_base): New base class.
1026 (class Archive): Derive from Library_base.
1027 (Archive::filename): Move to base class.
1028 (Archive::set_incremental_info): Likewise.
1029 (Archive::incremental_info): Likewise.
1030 (Archive::Should_include): Likewise.
1031 (Archive::should_include_member): Likewise.
1032 (Archive::Armap_entry): Remove.
1033 (Archive::Unused_symbol_iterator): Remove.
1034 (Archive::unused_symbols_begin): Remove.
1035 (Archive::unused_symbols_end): Remove.
1036 (Archive::do_filename): New function.
1037 (Archive::do_get_mtime): New function.
1038 (Archive::do_for_all_unused_symbols): New function.
1039 (Archive::task_): Move to base class.
1040 (Archive::incremental_info_): Likewise.
1041 (class Lib_group): Derive from Library_base.
1042 (Lib_group::do_filename): New function.
1043 (Lib_group::do_get_mtime): New function.
1044 (Lib_group::do_for_all_unused_symbols): New function.
1045 (Lib_group::task_): Move to base class.
1046 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1047 function.
1048 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1049 function.
1050 * incremental.cc (Incremental_inputs::report_archive_begin):
1051 Use Library_base; call library's get_mtime; add incremental inputs
1052 entry before members.
1053 (class Unused_symbol_visitor): New class.
1054 (Incremental_inputs::report_archive_end): Use Library_base; use
1055 visitor class to record unused symbols; don't add incremental inputs
1056 entry after members.
1057 (Incremental_inputs::report_object): Use Library_base.
1058 * incremental.h
1059 (Incremental_archive_entry::Incremental_archive_entry): Remove
1060 unused Archive parameter.
1061 (Incremental_inputs::report_archive_begin): Use Library_base.
1062 (Incremental_inputs::report_archive_end): Likewise.
1063 (Incremental_inputs::report_object): Likewise.
1064 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1065 function.
1066 * object.h (Object::for_all_global_symbols): New function.
1067 (Object::do_for_all_global_symbols): New function.
1068 (Sized_relobj::do_for_all_global_symbols): New function.
1069 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1070 function.
1071 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1072 function.
1073
61ab3e40
ILT
10742011-03-27 Ian Lance Taylor <iant@google.com>
1075
1076 * archive.cc (Archive::interpret_header): Return -1 if something
1077 goes wrong. Change callers accordingly.
1078
30e1f9e6
CC
10792011-03-25 Cary Coutant <ccoutant@google.com>
1080
1081 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1082 * testsuite/Makefile.in: Regenerate.
1083
9c793f14
RÁE
10842010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1085
1086 * plugin.cc (get_view): New.
1087 (Plugin::load): Pass get_view to the plugin.
1088 (Plugin_manager::get_view): New.
1089
9312bb0a
ILT
10902011-03-21 Ian Lance Taylor <iant@google.com>
1091
1092 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 1093 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 1094
7e12ba9e
ST
10952011-03-21 Sriraman Tallam <tmsriram@google.com>
1096
1097 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1098 Change == to -eq.
1099 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1100 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1101 Change == to -eq.
1102 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1103 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1104
fd7a005d
ILT
11052011-03-14 Ian Lance Taylor <iant@google.com>
1106
1107 * script-sections.cc (Sort_output_sections::script_compare):
1108 Rename from is_before, change return type.
1109 (Sort_output_sections::operator()): Adjust accordingly.
1110
ed16fd1b
ILT
11112011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1112
1113 PR gold/12572
1114 * testsuite/odr_violation2.cc: Add comment to make all error line
1115 numbers double digits.
1116 * testsuite/debug_msg.sh: Adjust expected errors.
1117
71ff8986
ILT
11182011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1119
1120 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1121 but mark earlier ones as non-canonical
1122 (offset_to_iterator): Update search target and example
1123 (do_addr2line): Return extra lines in a vector*
1124 (format_file_lineno): Extract from do_addr2line
1125 (one_addr2line): Add vector* out-param
1126 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1127 when a lineno entry appeared last for its instruction
1128 (Dwarf_line_info): Add vector* out-param
1129 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1130 * symtab.cc (Odr_violation_compare): Include the lineno in the
1131 comparison again.
1132 (linenos_from_loc): New. Combine the canonical line for an
1133 address with its other lines.
1134 (True_if_intersect): New. Helper functor to make
1135 std::set_intersection a query.
1136 (detect_odr_violations): Compare sets of lines instead of just
1137 one line for each function. This became less deterministic, but
1138 has fewer false positives.
1139 * symtab.h: Declarations.
1140 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1141 mix an optimized and non-optimized object in the same binary
1142 (odr_violation2.so): Same.
1143 * testsuite/Makefile.in: Regenerate from Makefile.am.
1144 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1145 * testsuite/debug_msg.sh: Update line numbers and add
1146 assertions.
1147 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1148 non-optimized context.
1149 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1150 isn't inlined, and use OdrDerived in an optimized context.
1151 * testsuite/odr_header1.h: Defines OdrDerived, where
1152 optimization will change the
1153 first-instruction-in-the-destructor's file and line number.
1154 * testsuite/odr_header2.h: Defines OdrBase.
1155
a19fefdc
ILT
11562011-03-09 Ian Lance Taylor <iant@google.com>
1157
1158 * fileread.cc (File_read::clear_views): Don't delete the whole
1159 file view.
1160
ecb351e9
ILT
11612011-03-08 Ian Lance Taylor <iant@google.com>
1162
1163 PR gold/12525
1164 * fileread.cc: #include <climits>.
1165 (GOLD_IOV_MAX): Define.
1166 (File_read::read_multiple): Limit number of entries by iov_max.
1167 * fileread.h (class File_read): Always set max_readv_entries to
1168 128.
1169
b821d13c
ILT
11702011-03-07 Ian Lance Taylor <iant@google.com>
1171
1172 PR gold/12525
1173 * options.h (class General_options): Add -dy and -dn.
1174
89243142
CC
11752011-03-02 Cary Coutant <ccoutant@google.com>
1176
1177 * testsuite/script_test_9.t: Add TLS segment.
1178
d0773f31
ILT
11792011-03-02 Simon Baldwin <simonb@google.com>
1180
1181 * configure.ac: Add check for gnu_indirect_function support in
1182 the toolchain building binutils.
1183 * configure: Rebuild.
1184
badc8139
RÁE
11852010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1186
1187 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1188 plugin only symbols.
1189 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1190 in plugin files as not needed in the symbol table.
1191
4cf7a849
ST
11922011-02-11 Sriraman Tallam <tmsriram@google.com>
1193
1194 * output.cc (Output_section::add_input_section): Delay fill
1195 generation for section ordering.
1196
b578bd7d
ILT
11972011-02-09 Ian Lance Taylor <iant@google.com>
1198
1199 PR gold/12316
1200 * object.h (class Sized_relobj): Remove clear_local_symbols.
1201 * reloc.cc (Sized_relobj::do_relocate): Don't call
1202 clear_local_symbols.
1203
84ced98a
RÁE
12042010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1205
1206 * plugin.cc (is_visible_from_outside): Return true for symbols
1207 in the -u option.
1208
55382fb7
ILT
12092011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1210
1211 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1212 filename.
1213
4e271fff
ST
12142011-02-02 Sriraman Tallam <tmsriram@google.com>
1215
1216 * icf.h (is_section_foldable_candidate): Change type of parameter
1217 to std::string.
1218 * icf.cc (Icf::find_identical_sections): Change type of local variable
1219 section_name to be std::string.
1220 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1221
d433c3ac
ILT
12222011-01-25 Ian Lance Taylor <iant@google.com>
1223
1224 * script.cc (script_add_extern): Rewrite to use
1225 add_symbol_reference.
1226
880473a6
DK
12272011-01-25 Doug Kwan <dougkwan@google.com>
1228
d433c3ac 1229 * icf.cc (get_section_contents): Always lock section's object.
880473a6 1230
f30f86fa
ILT
12312011-01-24 Ian Lance Taylor <iant@google.com>
1232
1233 * options.h (class General_options): Accept
1234 --no-detect-odr-violations.
1235
8e51a0b9
ILT
12362011-01-24 Ian Lance Taylor <iant@google.com>
1237
1238 * version.cc (version_string): Bump to 1.11.
1239
0f3b89d8
ILT
12402011-01-24 Ian Lance Taylor <iant@google.com>
1241
1242 * plugin.cc (class Plugin_rescan): Define new class.
1243 (Plugin_manager::claim_file): Set any_claimed_.
1244 (Plugin_manager::save_archive): New function.
1245 (Plugin_manager::save_input_group): New function.
1246 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1247 necessary.
1248 (Plugin_manager::new_undefined_symbol): New function.
1249 (Plugin_manager::rescan): New function.
1250 (Plugin_manager::rescannable_defines): New function.
1251 (Plugin_manager::add_input_file): Set any_added_.
1252 * plugin.h (class Plugin_manager): define new fields rescannable_,
1253 undefined_symbols_, any_claimed_, and any_added_. Declare
1254 Plugin_rescan as friend. Declare new functions.
1255 (Plugin_manager::Rescannable): Define type.
1256 (Plugin_manager::Rescannable_list): Define type.
1257 (Plugin_manager::Undefined_symbol_list): Define type.
1258 (Plugin_manager::Plugin_manager): Initialize new fields.
1259 * archive.cc (Archive::defines_symbol): New function.
1260 (Add_archive_symbols::run): Pass archive to plugins if any.
1261 * archive.h (class Archive): Declare defines_symbol.
1262 * readsyms.cc (Input_group::~Input_group): New function.
1263 (Finish_group::run): Pass input_group to plugins if any.
1264 * readsyms.h (class Input_group): Declare destructor.
1265 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1266 any.
1267
3bb951e5
ILT
12682011-01-10 Ian Lance Taylor <iant@google.com>
1269
1270 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1271 section as relro.
1272 (Layout::set_segment_offsets): Reset increase_relro before calling
1273 set_section_addresses a second time.
1274
0aa45fac
CC
12752011-01-04 Cary Coutant <ccoutant@google.com>
1276
1277 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1278 sections before NOBITS sections.
1279
0db46eb4
L
12802011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1281
1282 * version.cc (print_version): Update copyright to 2011.
1283
829c9745
CC
12842010-12-23 Cary Coutant <ccoutant@google.com>
1285
1286 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1287 of OS to this->add. Add OD parameter to second form of the function.
1288
7500420b
ILT
12892010-12-20 Ian Lance Taylor <iant@google.com>
1290
1291 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1292 second of two consecutive entries with same offset.
1293
f8e9a930
RW
12942010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1295
1296 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1297 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1298 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1299 to avoid unneeded links against $(LDADD).
1300 * testsuite/Makefile.in: Regenerate.
1301
2fbb4320
ILT
13022010-12-15 Ian Lance Taylor <iant@google.com>
1303
1304 PR gold/12324
1305 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1306 for R_X86_64_32 and R_X86_64_PC32.
1307 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1308 ver_matching_def_pic.o.
1309 (ver_matching_def_pic.o): New target.
1310
fedb228d
RW
13112010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1312
1313 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1314 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1315 Move definition before File_read::View member definitions.
1316 (File_read::View::~View): Initialize and hold lock before
1317 updating current_mapped_bytes.
1318
9b547ce6
RW
13192010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1320
1321 * dwarf_reader.cc: Remove outdated comment.
1322 * gold-threads.cc: Fix typo in error message.
1323 * archive.cc: Fix typos in comments.
1324 * archive.h: Likewise.
1325 * arm-reloc-property.cc: Likewise.
1326 * arm-reloc-property.h: Likewise.
1327 * arm-reloc.def: Likewise.
1328 * arm.cc: Likewise.
1329 * attributes.h: Likewise.
1330 * cref.cc: Likewise.
1331 * ehframe.cc: Likewise.
1332 * fileread.h: Likewise.
1333 * gold.h: Likewise.
1334 * i386.cc: Likewise.
1335 * icf.cc: Likewise.
1336 * incremental.h: Likewise.
1337 * int_encoding.cc: Likewise.
1338 * layout.h: Likewise.
1339 * main.cc: Likewise.
1340 * merge.h: Likewise.
1341 * object.cc: Likewise.
1342 * object.h: Likewise.
1343 * options.cc: Likewise.
1344 * readsyms.cc: Likewise.
1345 * reduced_debug_output.cc: Likewise.
1346 * reloc.cc: Likewise.
1347 * script-sections.cc: Likewise.
1348 * sparc.cc: Likewise.
1349 * symtab.h: Likewise.
1350 * target-reloc.h: Likewise.
1351 * target.cc: Likewise.
1352 * target.h: Likewise.
1353 * timer.cc: Likewise.
1354 * timer.h: Likewise.
1355 * x86_64.cc: Likewise.
1356
83e17bd5
CC
13572010-12-09 Cary Coutant <ccoutant@google.com>
1358
1359 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1360 stack.
1361 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1362 parameter; change all callers.
1363 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1364 * options.h (warn_execstack): New option.
1365
017257f8
DK
13662010-12-07 Doug Kwan <dougkwan@google.com>
1367
1368 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1369 like function call relocations.
1370
c20cbc06
ILT
13712010-12-07 Ian Lance Taylor <iant@google.com>
1372
1373 * archive.cc (Archive::get_elf_object_for_member): Permit
1374 punconfigured to be NULL.
1375 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1376 (Archive::include_member): Pass NULL to get_elf_object_for_member
1377 if we searched for the archive and this is the first included
1378 object.
1379
4dbfafcc
ILT
13802010-12-01 Ian Lance Taylor <iant@google.com>
1381
1382 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1383 track_relocs_type_ field.
1384 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1385 Set track_relocs_type_.
1386 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1387 contents when using RELA relocs.
1388 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1389 reloc_map_.
1390 * reloc.cc (Track_relocs::next_addend): New function.
1391 * reloc.h (class Track_relocs): Declare next_addend.
1392
e5e19edd
ILT
13932010-12-01 Ian Lance Taylor <iant@google.com>
1394
1395 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1396 virtual destructor.
1397
9a5ce24c
ILT
13982010-12-01 Ian Lance Taylor <iant@google.com>
1399
1400 * README: Update compilers known to work and fail.
1401
c7791212
NC
14022010-11-23 Matthias Klose <doko@ubuntu.com>
1403
1404 * configure.in: For --enable-gold, handle value `default' instead of
1405 `both*'. Always install ld as ld.bfd, install as ld if gold is
1406 not the default.
1407 * configure: Regenerate.
1408
0ad220c9
DK
14092010-11-18 Doug Kwan <dougkwan@google.com>
1410
1411 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1412 and right_alignment to be zero. Store result alignment only if it is
1413 greater than existing alignment.
1414
ab8056e0
CC
14152010-11-16 Cary Coutant <ccoutant@google.com>
1416
1417 PR gold/12220
1418 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1419 Check for ".zdebug_line".
1420
fd064a5b
CC
14212010-11-16 Doug Kwan <dougkwan@google.com>
1422 Cary Coutant <ccoutant@google.com>
1423
1424 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1425 by reference; adjust all callers.
1426 * output.cc (Output_segment::set_section_addresses): Adjust references
1427 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1428 list is empty.
1429 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1430 end at page boundary.
1431
6fc6ea19
CC
14322010-11-16 Cary Coutant <ccoutant@google.com>
1433
1434 PR gold/12220
1435 * layout.cc (Layout::choose_output_section): Transform names of
1436 compressed sections even when using a script with a SECTIONS clause.
1437 (Layout::output_section_name): Remove code to transform
1438 compressed debug section names.
1439 * output.cc (Output_section::add_input_section): Use uncompressed
1440 section size when tracking input sections.
1441
95a2c8d6
RS
14422010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1443
1444 * symtab.h (Symbol::NON_PIC_REF): Remove.
1445 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1446 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1447 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1448 (Symbol::use_plt_offset): Take a flags argument and pass it
1449 directly to needs_dynamic_reloc. Restrict check for undefined
1450 weak symbols to function calls.
1451 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1452 (Target_arm::Scan::global): Use it.
1453 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1454 (Target_arm::Relocate::relocate): Likewise.
1455 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1456 parameter with an r_type parameter. Use get_reference_flags
1457 to get the flags.
1458 (Target_arm::Relocate::relocate): Update accordingly.
1459 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1460 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1461 (Target_i386::Scan::global): Likewise.
1462 (Target_i386::Relocate::relocate): Likewise.
1463 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1464 parameter with an r_type parameter. Use get_reference_flags
1465 to get the flags.
1466 (Target_i386::Relocate::relocate): Update accordingly.
1467 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1468 (Target_powerpc::Scan::global): Use it.
1469 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1470 (Target_powerpc::Relocate::relocate): Likewise.
1471 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1472 (Target_sparc::Scan::global): Use it.
1473 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1474 (Target_sparc::Relocate::relocate): Likewise.
1475 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1476 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1477 (Target_x86_64::Scan::global): Likewise.
1478 (Target_x86_64::Relocate::relocate): Likewise.
1479
f625ae50
DK
14802010-11-08 Doug Kwan <dougkwan@google.com>
1481 Cary Coutant <ccoutant@google.com>
1482
1483 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1484 (Arm_exidx_merge_section::section_contents_): New data member.
1485 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1486 (Arm_input_section::~Arm_input_section): De-allocate memory.
1487 (Arm_input_section::original_contents_): New data member.
1488 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1489 in parameters instead of calling Object::section_contents without
1490 locking.
1491 (Arm_output_section::group_section): New parameter TASK. Pass it
1492 to callees that need locking objects.
1493 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1494 to lock EXIDX input sections. Fix a formatting issue. Call
1495 Arm_exidx_merged_section::build_contents to create merged section
1496 contents.
1497 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1498 to lock object of stub table owner.
1499 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1500 TEXT_SIZE to initialize data member TEXT_SIZE_.
1501 (Arm_exidx_input_section::addralign): Fix typo in comment.
1502 (Arm_exidx_input_section::text_size): New method.
1503 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1504 that require locking objects. Lock objects before scanning for stubs
1505 and updating local symbols.
1506 (Arm_input_section<big_endian>::init): Copy contents of original
1507 input section.
1508 (Arm_input_section<big_endian>::do_write): Use saved contents of
1509 original input section instead of calling Object::section_contents
1510 without locking.
1511 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1512 size without calling Object::section_size().
1513 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1514 for size. Allocate a buffer for merged EXIDX entries.
1515 (Arm_exidx_merged_section::build_contents): New method.
1516 (Arm_exidx_merged_section::do_write): Move merge section contents
1517 building code to Arm_exidx_merged_section::build_contetns. Write
1518 out contetns in buffer instead of building it on the fly.
1519 (Arm_relobj::make_exidx_input_section): Also pass text section size
1520 to Arm_exidx_input_section constructor.
1521 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1522 (Arm_dynobj::do_read_symbols): Fix memory leak.
1523 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1524 * target.h: (class Task): Add forward declaration.
1525 (Target::relax): Add new parameter TASK and pass it to
1526 Target::do_relax().
1527 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1528
5f9bcf58
CC
15292010-11-05 Cary Coutant <ccoutant@google.com>
1530
1531 PR gold/10708
1532 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1533 object when reading from the file.
1534 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1535 second layout pass.
1536 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1537 when reading section contents.
1538 (get_section_contents): Likewise.
1539 (icf::find_identical_sections): Likewise.
1540 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1541 object when reading from the file.
1542 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1543 the object when doing deferred section layout.
1544
e597fa08
NC
15452010-11-03 Nick Clifton <nickc@redhat.com>
1546
1547 PR gold/12001
1548 * script.h (class Symbol_assignment: name): New member. Returns
1549 the name of the symbol.
1550 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1551 Returns true if the given symbol name is on the list of
1552 assignments wating to be processed.
1553 * archive.cc (should_incldue_member): If the symbol is undefined,
1554 check to see if it is on the list of symbols pending assignment.
1555
3f9a3278
ILT
15562010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1557
1558 * script-sections.cc (Script_sections::find_memory_region): Check
1559 for a NULL output section pointer.
1560
d06fb4d1
DK
15612010-10-29 Doug Kwan <dougkwan@google.com>
1562
1563 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1564 Output_section::add_relaxed_input_section.
1565 * output.cc (Output_section::add_relaxed_input_section): Add new
1566 arguments LAYOUT and NAME. Set section order index.
1567 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1568 Copy section order index.
1569 * output.h (Output_section::add_relaxed_input_section): Add new
1570 arguments LAYOUT and NAME.
1571
90e24de5
ILT
15722010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1573
1574 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1575 NATIVE_OR_CROSS_LINKER.
1576 * testsuite/Makefile.in: Regenerate.
1577
c9484ea5
DK
15782010-10-20 Doug Kwan <dougkwan@google.com>
1579
1580 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1581 without SHF_LINK_ORDER flags.
1582 * layout.cc (Layout::choose_output_section): Do not filter
1583 SHF_LINK_ORDER flag in a relocatable link.
1584
5bc2f5be
CC
15852010-10-17 Cary Coutant <ccoutant@google.com>
1586
1587 * output.h (Output_segment::set_section_addresses): Change function
1588 signature. Update all callers.
1589 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1590 sections.
1591 (Output_segment::set_section_addresses): Align after last TLS
1592 section. Add padding before last relro section instead of after.
1593
0c91cf04
DK
15942010-10-17 Doug Kwan <dougkwan@google.com>
1595
1596 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1597 GOT output section to be writable.
1598
8c21d9d3
CC
15992010-10-14 Cary Coutant <ccoutant@google.com>
1600
1601 * debug.h (DEBUG_INCREMENTAL): New flag.
1602 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1603 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1604 mode.
1605 * incremental.cc (report_command_line): Ignore all forms of
1606 --incremental.
1607 * layout.cc (Layout::Layout): Check parameters for incremental link
1608 mode.
1609 * options.cc (General_options::parse_incremental): New function.
1610 (General_options::parse_no_incremental): New function.
1611 (General_options::parse_incremental_full): New function.
1612 (General_options::parse_incremental_update): New function.
1613 (General_options::incremental_mode_): New data member.
1614 (General_options::finalize): Check incremental_mode_.
1615 * options.h (General_options): Update help text for --incremental.
1616 Add --no-incremental, --incremental-full, --incremental-update.
1617 (General_options::Incremental_mode): New enum type.
1618 (General_options::incremental_mode): New function.
1619 (General_options::incremental_mode_): New data member.
1620 * parameters.cc (Parameters::incremental_mode_): New data member.
1621 (Parameters::set_options): Set incremental_mode_.
1622 (Parameters::set_incremental_full): New function.
1623 (Parameters::incremental): New function.
1624 (Parameters::incremental_update): New function.
1625 (set_parameters_incremental_full): New function.
1626 * parameters.h (Parameters::set_incremental_full): New function.
1627 (Parameters::incremental): New function.
1628 (Parameters::incremental_update): New function.
1629 (Parameters::incremental_mode_): New data member.
1630 (set_parameters_incremental_full): New function.
1631 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1632 incremental link mode.
1633 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1634 (Sized_relobj::do_relocate_sections): Likewise.
1635 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1636 option.
1637 * testsuite/Makefile.in: Regenerate.
1638 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1639
bb32aa18 16402010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
1641
1642 * script-sections.h (class Script_sections): Make
1643 Sections_elements typedef public.
1644 * script-sections.cc (class Sort_output_sections): Add elements_
1645 field. Add constructor which sets it; change all callers.
1646 (Sort_output_sections::is_before): New function.
1647 (Sort_output_sections::operator()): Call is_before.
1648 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1649 conditional.
1650 * testsuite/script_test_10.sh: New test. Test script section
1651 order.
1652 * testsuite/script_test_10.t: Likewise.
1653 * testsuite/script_test_10.s: Likewise.
1654 * testsuite/Makefile.am: Wrap the cross linker tests and the
1655 common tests into NATIVE_OR_CROSS_LINKER.
1656 (check_SCRIPTS): Add script_test_10.sh.
1657 (check_DATA): Add script_test_10.stdout.
1658 (script_test_10.o, script_test_10): New targets.
1659 (script_test_10.stdout): New target.
1660 * configure, testsuite/Makefile.in: Regenerate.
1661
3cef7179
ILT
16622010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1663
1664 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1665 error for the deprecated relocations.
1666 (Target_arm::Scan::global): Likewise.
1667 (Target_arm::Relocate::relocate): Likewise.
1668
7411e9a8
RS
16692010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1670
1671 * fileread.cc (Input_file::find_file): Initialize *found_name
1672 and *namep when using the fallback search for case 4.
1673
6a9da32a
CC
16742010-10-11 Cary Coutant <ccoutant@google.com>
1675
1676 * options.h (class General_options): Redefine -z lazy as an alias for
1677 the negation of -z now.
1678
ac897c20
ILT
16792010-10-11 Ian Lance Taylor <iant@google.com>
1680
1681 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1682 binding.
1683
ea5cae92
NC
16842010-10-06 Nick Clifton <nickc@redhat.com>
1685
1686 * script-sections.cc(class Memory_region): Remove
1687 current_lma_offset_ field. Rename current_vma_offset_ to
1688 current_offset_. Add last_section_ field.
1689 (Memory_region::get_current_vma_address): Rename to
1690 get_current_address.
1691 (Memory_region::get_current_lma_address): Delete.
1692 (Memory_region::increment_vma_offset): Rename to
1693 increment_offset.
1694 (Memory_region::increment_lma_offset): Delete.
1695 (Memory_region::attributes_compatible): New method. Returns
1696 true if the provided section is compatible with the region.
1697 (Memory_region::get_last_section): New method. Returns the last
1698 section to use the region.
1699 (Memory_region::set_last_section): New method. Stores the last
1700 section to use the region.
1701 (Script_sections::block_in_region): New method. Returns true if
1702 a block of memory is contained within a region.
1703 (Script_sections::find_memory_region): New method. Locates a
1704 memory region to be used to set a VMA or LMA address.
1705 (Output_section_definition::set_section_addresses): Add code to
1706 check for addresses set by memory regions.
1707 (Output_segment::set_section_addresses): Remove memory region
1708 walking code.
1709 (Script_sections::create_segment): Add a warning if a header
1710 segment is created outside of any region.
1711 * script-sections.h (class Script_sections): Add prototypes for
1712 find_memory_region and block_in_region methods.
1713 * testsuite/memory_test.s: Use .long instead of .word.
1714 * testsuite/memory_test.t: Add some more output sections.
1715 * testsuite/memory_test.sh: Update expected output.
1716
a9bfd952
DK
17172010-10-02 Doug Kwan <dougkwan@google.com>
1718
1719 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1720 defintion to symtab.h
1721 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1722 declaration to defintion.
1723
bacff3ab
NC
17242010-10-01 Nick Clifton <nickc@redhat.com>
1725
1726 * expression.cc (eval): Replace dummy argument with NULL.
1727 (eval_maybe_dot): Check for a NULL result section pointer.
1728 (Symbol_expression::value): Likewise.
1729 (Dot_expression::value): Likewise.
1730 (BINARY_EXPRESSION): Likewise.
1731 (Max_expression::value): Likewise.
1732 (Min_expression::value): Likewise.
1733 (Absolute_expression::value): Likewise.
1734 (Addr_expression::value_from_output_section): Likewise.
1735 (Loaddddr_expression::value_from_output_section): Likewise.
1736 (Segment_start_expression::value): Likewise.
1737 * script-sections.cc
1738 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1739 argument with NULL.
1740 (Sections_elememt_dot_assignment::set_section_addresses):
1741 Likewise.
1742 (Output_data_expression::do_write_to_buffer): Likewise.
1743 (Output_section_definition::finalize_symbols): Likewise.
1744 (Output_section_definition::set_section_addresses): Likewise.
1745
f81bc8b5
DK
17462010-09-30 Doug Kwan <dougkwan@google.com>
1747
1748 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1749
c95e9f27
ST
17502010-09-28 Sriraman Tallam <tmsriram@google.com>
1751
1752 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 1753 function.
c95e9f27
ST
1754 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1755 virtual function.
1756 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1757 virtual function.
1758 * icf.cc (get_section_contents): Inline merge sections only when
1759 target allows it.
1760
3cac54d2
RW
17612010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1762
1763 * configure: Regenerate.
1764
2904037a
ILT
17652010-09-17 Ian Lance Taylor <iant@google.com>
1766
1767 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
1768 * testsuite/Makefile.am (memory_test.o): New target.
1769 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1770 memory_test.t.
1771 * testsuite/Makefile.in: Rebuild.
2904037a 1772
bca7fb63
DK
17732010-09-17 Doug Kwan <dougkwan@google.com>
1774
1775 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1776 defintion if relocation uses GOT entries of the symbol.
1777 * testsuite/icf_safe_test.sh: Fix test.
1778 * testsuite/icf_safe_so_test.sh: Fix test.
1779
4ef28648
CC
17802010-09-16 Cary Coutant <ccoutant@google.com>
1781
1782 * script_sections.cc (class Memory_region): Remove "NULL" from
1783 vector initializations.
1784
793990de
CC
17852010-09-15 Cary Coutant <ccoutant@google.com>
1786
1787 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1788 Resolve forwarding symbols.
1789
81e015e2
DK
17902010-09-15 Doug Kwan <dougkwan@google.com>
1791
1792 * gold/testsuite/script_test_3.t: Add ARM special sections.
1793 * gold/testsuite/script_test_4.t: Same.
1794 * gold/testsuite/script_test_5.t: Same.
1795 * gold/testsuite/script_test_6.t: Same.
1796 * gold/testsuite/script_test_7.t: Same.
1797 * gold/testsuite/script_test_7.t: Same.
1798 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1799
36171d64
CC
18002010-09-14 Cary Coutant <ccoutant@google.com>
1801
1802 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1803 (Target_x86_64::Relocate::relocate_tls): Replace check for
1804 saw_tls_block_reloc_ with test for executable section.
1805
d89051bd
CC
18062010-09-12 Cary Coutant <ccoutant@google.com>
1807
1808 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1809 position-independent executables to shared libraries need dynamic
1810 relocations.
1811 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1812 position-independent executables.
1813 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1814 * testsuite/Makefile.in: Regenerate.
1815
fca41f0f
NC
18162010-09-10 Nick Clifton <nickc@redhat.com>
1817
1818 PR gold/11997
1819 * testsuite/memory_test.t: Discard any sections that are not
1820 needed.
1821
6695e4b3
L
18222010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1823
1824 PR gold/11996
1825 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1826 "This::" to work around a bug in gcc 4.2.
1827
1828 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1829
0f72bf6f
RÁE
18302010-09-09 Rafael Espindola <espindola@google.com>
1831
1832 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1833 sections with different PF_X flags in the same segment.
1834 (Layout::find_first_load_seg): Search all segments to find the first
1835 one.
1836 * options.h (rosegment): New.
1837
18382010-09-08 Rafael Espindola <espindola@google.com>
a6577478 1839
05a79166 1840 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 1841
aa98ff75
DK
18422010-09-08 Doug Kwan <dougkwan@google.com>
1843
1844 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1845 (Arm_relobj::do_relocate_sections): Add new parameter for output
1846 file to match the parent.
1847 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1848 of local symbols instead of input values. Update code to track
1849 changes in gold::relocate_section.
1850 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1851 (Sized_relobj::compute_final_local_value_internal): New methods.
1852 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1853 body into private version of Sized_relobj::compute_final_local_value.
1854 Call the inline method.
1855 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1856 merged symbol value if there is one.
1857 (Symbol_value::has_output_value): New method defintiion.
1858 (Sized_relobj::Compute_final_local_value_status): New enum type.
1859 (Sized_relobj::compute_final_local_value): New methods.
1860 (Sized_relobj::compute_final_local_value_internal): New methods.
1861 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1862 and arm_cortex_a8.sh.
1863 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1864 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1865 New tests.
1866 * Makefile.in: Regenerate.
1867 * testsuite/arm_bl_out_of_range.s: Update test.
1868 * testsuite/thumb_bl_out_of_range.s: Ditto.
1869 * testsuite/thumb_blx_out_of_range.s: Ditto.
1870 * testsuite/arm_branch_out_of_range.sh: New file.
1871 * testsuite/arm_cortex_a8.sh: Ditto.
1872 * testsuite/arm_cortex_a8_b.s: Ditto.
1873 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1874 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1875 * testsuite/arm_cortex_a8_bl.s: Ditto.
1876 * testsuite/arm_cortex_a8_blx.s: Ditto.
1877 * testsuite/arm_cortex_a8_local.s: Ditto.
1878 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1879 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1880
05a79166
L
18812010-09-08 Rafael Espindola <espindola@google.com>
1882
1883 * Makefile.am (memory_test.stdout): Run readelf with -W.
1884 * Makefile.in: Regenerate.
1885 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1886 64 bit output.
1887
33dbc701
RÁE
18882010-09-08 Rafael Espindola <espindola@google.com>
1889
1890 * script-sections.cc (Script_sections::add_memory_region): Convert
1891 field precision to int.
1892 * script.cc (script_set_section_region, script_set_section_region):
1893 Convert field precision to int.
1894
731ca54a
RÁE
18952010-09-08 Rafael Espindola <espindola@google.com>
1896
1897 * arm.cc (do_finalize_sections): Create the __exidx_start and
1898 __exdix_end symbols even when the section is missing.
1899
7f8cd844
NC
19002010-09-08 Nick Clifton <nickc@redhat.com>
1901
1902 * README: Remove claim that MEMORY is not supported.
1903 * expression.cc (script_exp_function_origin)
1904 (script_exp_function_length): Move from here to ...
1905 * script.cc: ... here.
1906 (script_set_section_region, script_add_memory)
1907 (script_parse_memory_attr, script_include_directive): New
1908 functions.
1909 * script-sections.cc
1910 (class Memory_region): New class.
1911 (class Output_section_definition): Add set_memory_region,
1912 set_section_vma, set_section_lma and get_section_name methods.
1913 (class Script_Sections): Add add_memory_region,
1914 find_memory_region, find_memory_region_origin,
1915 find_memory_region_length and set_memory_region methods.
1916 Have set_section_addresses method walk the list of set memory
1917 regions.
1918 Extend the print methos to display memory regions.
1919 * script-sections.h: Add prototypes for new methods.
1920 Add enum for MEMORY region attributes.
1921 * yyscript.y: Add support for parsing MEMORY regions.
1922 * script-c.h: Add prototypes for new functions.
1923 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1924 * testsuite/Makefile.in: Regenerate.
1925 * testsuite/memory_test.sh: New script.
1926 * testsuite/memory_test.s: New assembler source file.
1927 * testsuite/memory_test.t: New linker script.
1928
a4649286
DK
19292010-08-27 Doug Kwan <dougkwan@google.com>
1930
1931 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1932 reference override an existing dynamic weak reference.
1933 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1934 * testsuite/Makefile.in: Regenerate.
1935 * testsuite/dyn_weak_ref.sh: New file.
1936 * testsuite/dyn_weak_ref_1.c: Ditto.
1937 * testsuite/dyn_weak_ref_2.c: Ditto.
1938
b56648ad
ILT
19392010-08-27 Ian Lance Taylor <iant@google.com>
1940
1941 * incremental.h (class Incremental_input_entry): Add virtual
1942 destructor.
1943
809313cb
ILT
19442010-08-27 Ian Lance Taylor <iant@google.com>
1945
1946 * testsuite/start_lib_test_3.c: Mark t3 as used.
1947
11e32464
NC
19482010-08-27 Nick Clifton <nickc@redhat.com>
1949
1950 * options.cc (version_script): Fix small typo in previous
1951 whitespace tidyup.
1952
ca09d69a
NC
19532010-08-25 Nick Clifton <nickc@redhat.com>
1954
1955 * archive.cc: Formatting fixes: Remove whitespace between
1956 typename and following asterisk. Remove whitespace between
1957 function name and opening parenthesis.
1958 * archive.h: Likewise.
1959 * arm.cc: Likewise.
1960 * attributes.cc: Likewise.
1961 * attributes.h: Likewise.
1962 * common.cc: Likewise.
1963 * copy-relocs.cc: Likewise.
1964 * dirsearch.h: Likewise.
1965 * dynobj.cc: Likewise.
1966 * ehframe.cc: Likewise.
1967 * ehframe.h: Likewise.
1968 * expression.cc: Likewise.
1969 * fileread.cc: Likewise.
1970 * fileread.h: Likewise.
1971 * gc.h: Likewise.
1972 * gold-threads.cc: Likewise.
1973 * gold.cc: Likewise.
1974 * i386.cc: Likewise.
1975 * icf.h: Likewise.
1976 * incremental-dump.cc: Likewise.
1977 * incremental.cc: Likewise.
1978 * layout.cc: Likewise.
1979 * layout.h: Likewise.
1980 * main.cc: Likewise.
1981 * merge.cc: Likewise.
1982 * merge.h: Likewise.
1983 * object.cc: Likewise.
1984 * object.h: Likewise.
1985 * options.cc: Likewise.
1986 * options.h: Likewise.
1987 * output.cc: Likewise.
1988 * output.h: Likewise.
1989 * plugin.cc: Likewise.
1990 * plugin.h: Likewise.
1991 * powerpc.cc: Likewise.
1992 * reloc.cc: Likewise.
1993 * script-c.h: Likewise.
1994 * script-sections.cc: Likewise.
1995 * script.cc: Likewise.
1996 * stringpool.cc: Likewise.
1997 * symtab.cc: Likewise.
1998 * symtab.h: Likewise.
1999 * target.cc: Likewise.
2000 * timer.cc: Likewise.
2001 * timer.h: Likewise.
2002 * version.cc: Likewise.
2003 * x86_64.cc: Likewise.
2004
b8fa8750
NC
20052010-08-24 Nick Clifton <nickc@redhat.com>
2006
2007 PR 11899
2008 * layout.cc (segment_precedes): Sort segments by their physical
2009 addresses, if they have been set.
2010
9919d93b
CC
20112010-08-23 Cary Coutant <ccoutant@google.com>
2012
2013 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2014 symbols data.
2015 (Lib_group::include_member): Unlock object after deleting its
2016 symbols data.
2017 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2018 the bug fixed here.
2019
97b4be1c
CC
20202010-08-19 Neil Vachharajani <nvachhar@google.com>
2021 Cary Coutant <ccoutant@google.com>
2022
2023 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2024 constructor, and set_blocker.
2025 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2026 readsyms_blocker_.
2027 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2028 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2029 * testsuite/Makefile.am (start_lib_test): New test case.
2030 * testsuite/Makefile.in: Regenerate.
2031 * testsuite/start_lib_test_main.c: New file.
2032 * testsuite/start_lib_test_1.c: New file.
2033 * testsuite/start_lib_test_2.c: New file.
2034 * testsuite/start_lib_test_3.c: New file.
2035
dd0b1884
ILT
20362010-08-19 Ian Lance Taylor <iant@google.com>
2037
2038 * Makefile.in: Rebuild with automake 1.11.1.
2039 * aclocal.m4: Likewise.
2040 * testsuite/Makefile.in: Likewise.
2041
7223e9ca
ILT
20422010-08-19 Ian Lance Taylor <iant@google.com>
2043
2044 PR 10893
2045 * i386.cc (class Output_data_plt_i386): Update declarations.
2046 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2047 local_ifuncs_ fields.
2048 (Target_i386::do_plt_section_for_global): New function.
2049 (Target_i386::do_plt_section_for_local): New function.
2050 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2051 parameter; change all callers. Initialize global_ifuncs_ and
2052 local_ifuncs_. If doing a static link define __rel_iplt_start and
2053 __rel_iplt_end.
2054 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2055 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2056 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2057 symbols.
2058 (Target_i386::make_plt_section): New function, broken out of
2059 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2060 (Target_i386::make_plt_entry): Call make_plt_section.
2061 (Target_i386::make_local_ifunc_plt_entry): New function.
2062 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2063 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2064 R_386_IRELATIVE to switch.
2065 (Target_i386::Scan::global): Likewise.
2066 (Target_i386::Relocate::relocate): Likewise.
2067 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2068 switch.
2069 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2070 (Target_x86_64::do_plt_section_for_global): New function.
2071 (Target_x86_64::do_plt_section_for_local): New function.
2072 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2073 parameter; change all callers. If doing a static link define
2074 __rela_iplt_start and __rela_iplt_end.
2075 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2076 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2077 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2078 to point to .plt.
2079 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2080 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2081 switch.
2082 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2083 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2084 R_X86_64_IRELATIVE to switch.
2085 (Target_x86_64::Scan::global): Likewise.
2086 (Target_x86_64::Relocate::relocate): Likewise.
2087 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2088 switch.
2089 * target.h (class Target): Add plt_section_for_global and
2090 plt_section_for_local functions. Add do_plt_section_for_global
2091 and do_plt_section_for_local virtual functions.
2092 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2093 clarifying comments.
2094 (Symbol::use_plt_offset): Handle IFUNC symbol.
2095 * object.cc (Sized_relobj::Sized_relobj): Initialize
2096 local_plt_offsets_.
2097 (Sized_relobj::local_has_plt_offset): New function.
2098 (Sized_relobj::local_plt_offset): New function.
2099 (Sized_relobj::set_local_plt_offset): New function.
2100 (Sized_relobj::do_count): Handle IFUNC symbol.
2101 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2102 a bit away from input_shndx_ field. Add set_is_func_symbol and
2103 is_ifunc_symbol functions.
2104 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2105 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2106 local_plt_offsets_ field.
2107 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2108 * output.h (class Output_section_data): Add non-const
2109 output_section function.
2110 (class Output_data_got): Update declarations.
2111 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2112 Add use_plt_offset parameter to global and local constructors.
2113 Change all callers. Change local_sym_index_ field to 31 bits.
2114 Change GSYM_CODE and CONSTANT_CODE accordingly.
2115 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2116 doing a static link don't set sh_link field.
2117 (Output_data_got::Got_entry::write): Use PLT offset if
2118 appropriate.
2119 (Output_data_got::add_global_plt): New function.
2120 (Output_data_got::add_local_plt): New function.
2121 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2122 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2123 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2124 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2125 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2126 IFUNC conditional.
2127 * testsuite/ifunc-sel.h: New file.
2128 * testsuite/ifuncmain1.c: New file.
2129 * testsuite/ifuncmain1vis.c: New file.
2130 * testsuite/ifuncmod1.c: New file.
2131 * testsuite/ifuncdep2.c: New file.
2132 * testsuite/ifuncmain2.c: New file.
2133 * testsuite/ifuncmain3.c: New file.
2134 * testsuite/ifuncmod3.c: New file.
2135 * testsuite/ifuncmain4.c: New file.
2136 * testsuite/ifuncmain5.c: New file.
2137 * testsuite/ifuncmod5.c: New file.
2138 * testsuite/ifuncmain6pie.c: New file.
2139 * testsuite/ifuncmod6.c: New file.
2140 * testsuite/ifuncmain7.c: New file.
2141 * configure, testsuite/Makefile.in: Rebuild.
2142
56f75c03
ILT
21432010-08-18 Ian Lance Taylor <iant@google.com>
2144
2145 * incremental.cc
2146 (Output_section_incremental_inputs::write_input_files): Add cast
2147 to avoid signed/unsigned comparison warning.
2148 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2149
55455f89
CC
21502010-08-12 Cary Coutant <ccoutant@google.com>
2151
2152 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2153
e2054bcb
ILT
21542010-08-13 Ian Lance Taylor <iant@google.com>
2155
2156 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2157
74f67560
DK
21582010-08-12 Cary Coutant <ccoutant@google.com>
2159 Doug Kwan <dougkwan@google.com>
2160
2161 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2162 defintion overrides non-weak undef, remember that the original undef
2163 is not weak.
2164 * symtab.cc (Symbol_table::sized_write_global): For undef without
2165 an original weak binding, set binding to global in output.
2166 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2167 * testsuite/Makefile.in: Regenerate.
2168 * testsuite/strong_ref_weak_def.sh: New file.
2169 * testsuite/strong_ref_weak_def_1.c: Ditto.
2170 * testsuite/strong_ref_weak_def_2.c: Ditto.
2171
d1238d12
CC
21722010-08-12 Cary Coutant <ccoutant@google.com>
2173
2174 * testsuite/incremental_test.sh: Rewrite.
2175 * testsuite/incremental_test_1.c: Rewrite.
2176 * testsuite/incremental_test_2.c: Rewrite.
2177
0e70b911
CC
21782010-08-12 Cary Coutant <ccoutant@google.com>
2179
2180 * arm.cc (Target_arm::got_size): Add const.
2181 (Target_arm::got_entry_count): New function.
2182 (Target_arm::plt_entry_count): New function.
2183 (Target_arm::first_plt_entry_offset): New function.
2184 (Target_arm::plt_entry_size): New function.
2185 (Output_data_plt_arm::entry_count): New function.
2186 (Output_data_plt_arm::first_plt_entry_offset): New function.
2187 (Output_data_plt_arm::get_plt_entry_size): New function.
2188 * i386.cc (Target_i386::got_size): Add const.
2189 (Target_i386::got_entry_count): New function.
2190 (Target_i386::plt_entry_count): New function.
2191 (Target_i386::first_plt_entry_offset): New function.
2192 (Target_i386::plt_entry_size): New function.
2193 (Output_data_plt_i386::entry_count): New function.
2194 (Output_data_plt_i386::first_plt_entry_offset): New function.
2195 (Output_data_plt_i386::get_plt_entry_size): New function.
2196 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2197 find_incremental_inputs_sections. Dump incremental_got_plt section.
2198 * incremental.cc: Include target.h.
2199 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2200 parameter. Adjust all callers. Find incremental_got_plt section.
2201 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2202 section.
2203 (Output_section_incremental_inputs::set_final_data_size): Calculate
2204 size of incremental_got_plt section.
2205 (Output_section_incremental_inputs::do_write): Write the
2206 incremental_got_plt section.
2207 (Got_plt_view_info): New struct.
2208 (Local_got_offset_visitor): New class.
2209 (Global_got_offset_visitor): New class.
2210 (Global_symbol_visitor_got_plt): New class.
2211 (Output_section_incremental_inputs::write_got_plt): New function.
2212 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2213 Add parameter. Adjust all callers.
2214 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2215 (Incremental_inputs::got_plt_section): New function.
2216 (Incremental_inputs::got_plt_section_): New data member.
2217 (Incremental_got_plt_reader): New class.
2218 * layout.cc (Layout::create_incremental_info_sections): Add the
2219 incremental_got_plt section.
2220 * object.h (Got_offset_list::get_list): New function.
2221 (Got offset_list::for_all_got_offsets): New function.
2222 (Sized_relobj::local_got_offset_list): New function.
2223 * powerpc.cc (Target_powerpc::got_size): Add const.
2224 (Target_powerpc::got_entry_count): New function.
2225 (Target_powerpc::plt_entry_count): New function.
2226 (Target_powerpc::first_plt_entry_offset): New function.
2227 (Target_powerpc::plt_entry_size): New function.
2228 (Output_data_plt_powerpc::entry_count): New function.
2229 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2230 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2231 * sparc.cc (Target_sparc::got_size): Add const.
2232 (Target_sparc::got_entry_count): New function.
2233 (Target_sparc::plt_entry_count): New function.
2234 (Target_sparc::first_plt_entry_offset): New function.
2235 (Target_sparc::plt_entry_size): New function.
2236 (Output_data_plt_sparc::entry_count): New function.
2237 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2238 (Output_data_plt_sparc::get_plt_entry_size): New function.
2239 * symtab.h (Symbol::got_offset_list): New function.
2240 (Symbol_table::for_all_symbols): New function.
2241 * target.h (Sized_target::got_entry_count): New function.
2242 (Sized_target::plt_entry_count): New function.
2243 (Sized_target::plt_entry_size): New function.
2244 * x86_64.cc (Target_x86_64::got_size): Add const.
2245 (Target_x86_64::got_entry_count): New function.
2246 (Target_x86_64::plt_entry_count): New function.
2247 (Target_x86_64::first_plt_entry_offset): New function.
2248 (Target_x86_64::plt_entry_size): New function.
2249 (Output_data_plt_x86_64::entry_count): New function.
2250 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2251 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2252
09ec0418
CC
22532010-08-12 Cary Coutant <ccoutant@google.com>
2254
2255 * archive.cc: Include incremental.h.
2256 (Archive::Archive): Initialize incremental_info_.
2257 (Archive::include_member): Record archive members in incremental info.
2258 (Add_archive_symbols::run): Record begin and end of an archive in
2259 incremental info.
2260 (Lib_group::include_member): Record objects in incremental info.
2261 * archive.h (Incremental_archive_entry): Forward declaration.
2262 (Archive::set_incremental_info): New member function.
2263 (Archive::incremental_info): New member function.
2264 (Archive::Unused_symbol_iterator): New class.
2265 (Archive::unused_symbols_begin): New member function.
2266 (Archive::unused_symbols_end): New member function.
2267 (Archive::incremental_info_): New data member.
2268 * incremental-dump.cc (find_input_containing_global): New function.
2269 (dump_incremental_inputs): Dump new incremental info sections.
2270 * incremental.cc: Include symtab.h.
2271 (Output_section_incremental_inputs): New class.
2272 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2273 new incremental info sections.
2274 (Sized_incremental_binary::do_check_inputs): Likewise.
2275 (Incremental_inputs::report_archive): Remove.
2276 (Incremental_inputs::report_archive_begin): New function.
2277 (Incremental_inputs::report_archive_end): New function.
2278 (Incremental_inputs::report_object): New function.
2279 (Incremental_inputs::finalize_inputs): Remove.
2280 (Incremental_inputs::report_input_section): New function.
2281 (Incremental_inputs::report_script): Rewrite.
2282 (Incremental_inputs::finalize): Do nothing but finalize string table.
2283 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2284 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2285 (Incremental_inputs::create_data_sections): New function.
2286 (Incremental_inputs::relocs_entsize): New function.
2287 (Output_section_incremental_inputs::set_final_data_size): New function.
2288 (Output_section_incremental_inputs::do_write): New function.
2289 (Output_section_incremental_inputs::write_header): New function.
2290 (Output_section_incremental_inputs::write_input_files): New function.
2291 (Output_section_incremental_inputs::write_info_blocks): New function.
2292 (Output_section_incremental_inputs::write_symtab): New function.
2293 * incremental.h (Incremental_script_entry): Forward declaration.
2294 (Incremental_object_entry): Forward declaration.
2295 (Incremental_archive_entry): Forward declaration.
2296 (Incremental_inputs): Forward declaration.
2297 (Incremental_inputs_header_data): Remove.
2298 (Incremental_inputs_header): Remove.
2299 (Incremental_inputs_header_write): Remove.
2300 (Incremental_inputs_entry_data): Remove.
2301 (Incremental_inputs_entry): Remove.
2302 (Incremental_inputs_entry_write): Remove.
2303 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2304 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2305 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2306 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2307 Likewise.
2308 (Incremental_input_entry): New class.
2309 (Incremental_script_entry): New class.
2310 (Incremental_object_entry): New class.
2311 (Incremental_archive_entry): New class.
2312 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2313 (Incremental_inputs::report_inputs): Remove.
2314 (Incremental_inputs::report_archive): Remove.
2315 (Incremental_inputs::report_archive_begin): New function.
2316 (Incremental_inputs::report_archive_end): New function.
2317 (Incremental_inputs::report_object): Change prototype.
2318 (Incremental_inputs::report_input_section): New function.
2319 (Incremental_inputs::report_script): Change prototype.
2320 (Incremental_inputs::get_reloc_count): New function.
2321 (Incremental_inputs::set_reloc_count): New function.
2322 (Incremental_inputs::create_data_sections): New function.
2323 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2324 (Incremental_inputs::inputs_section): New function.
2325 (Incremental_inputs::symtab_section): New function.
2326 (Incremental_inputs::relocs_section): New function.
2327 (Incremental_inputs::get_stringpool): Add const.
2328 (Incremental_inputs::command_line): Add const.
2329 (Incremental_inputs::inputs): Remove.
2330 (Incremental_inputs::command_line_key): New function.
2331 (Incremental_inputs::input_file_count): New function.
2332 (Incremental_inputs::input_files): New function.
2333 (Incremental_inputs::relocs_entsize): New function.
2334 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2335 (Incremental_inputs::finalize_inputs): Remove.
2336 (Incremental_inputs::Input_info): Remove.
2337 (Incremental_inputs::lock_): Remove.
2338 (Incremental_inputs::inputs_): Change type.
2339 (Incremental_inputs::inputs_map_): Remove.
2340 (Incremental_inputs::current_object_entry_): New data member.
2341 (Incremental_inputs::inputs_section_): New data member.
2342 (Incremental_inputs::symtab_section_): New data member.
2343 (Incremental_inputs::relocs_section_): New data member.
2344 (Incremental_inputs::reloc_count_): New data member.
2345 (Incremental_inputs_reader): New class.
2346 (Incremental_symtab_reader): New class.
2347 (Incremental_relocs_reader): New class.
2348 * layout.cc (Layout::finalize): Move finalization of incremental info
2349 and creation of incremental info sections to follow finalization of
2350 symbol table. Set offsets for postprocessing sections.
2351 (Layout::create_incremental_info_sections): Call
2352 Incremental_inputs::create_data_sections. Add incremental symtab
2353 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2354 sections to layout after input sections.
2355 * layout.h (struct Timespec): Forward declaration.
2356 (Layout::incremental_inputs): Add const.
2357 (Layout::create_incremental_info_sections): Add parameter.
2358 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2359 * object.cc: Include incremental.h.
2360 (Relobj::finalize_incremental_relocs): New function.
2361 (Sized_relobj::do_layout): Record input sections in incremental info.
2362 * object.h (Object::output_section): New function.
2363 (Object::output_section_offset): Moved from Relobj.
2364 (Object::get_incremental_reloc_base): New function.
2365 (Object::get_incremental_reloc_count): New function.
2366 (Object::do_output_section): New function.
2367 (Object::do_output_section_offset): Moved from Relobj.
2368 (Object::do_get_incremental_reloc_base): New function.
2369 (Object::do_get_incremental_reloc_count): New function.
2370 (Object::Object): Initialize new data members.
2371 (Relobj::output_section): Renamed do_output_section and moved to
2372 protected.
2373 (Relobj::output_section_offset): Moved to Object.
2374 (Relobj::do_get_incremental_reloc_base): New function.
2375 (Relobj::do_get_incremental_reloc_count): New function.
2376 (Relobj::allocate_incremental_reloc_counts): New function.
2377 (Relobj::count_incremental_reloc): New function.
2378 (Relobj::finalize_incremental_relocs): New function.
2379 (Relobj::next_incremental_reloc_index): New function.
2380 (Relobj::reloc_counts_): New data member.
2381 (Relobj::reloc_bases_): New data member.
2382 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2383 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2384 (Sized_relobj::incremental_relocs_scan): New function.
2385 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2386 (Sized_relobj::incremental_relocs_write): New function.
2387 (Sized_relobj::incremental_relocs_write_reltype): New function.
2388 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2389 incremental link.
2390 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2391 archives and object files elsewhere.
2392 (Add_symbols::run): Report object files here.
2393 (Finish_group::run): Report end of archive at end of group.
2394 * reloc.cc: Include layout.h, incremental.h.
2395 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2396 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2397 (Sized_relobj::incremental_relocs_scan): New function.
2398 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2399 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2400 (Sized_relobj::incremental_relocs_write): New function.
2401 (Sized_relobj::incremental_relocs_write_reltype): New function.
2402 * script.cc (read_input_script): Rewrite test for incremental link.
2403 Change call to Incremental_inputs::report_script.
2404 * symtab.h (Symbol_table::first_global_index): New function.
2405 (Symbol_table::output_count): New function.
2406
ce0d1972
DK
24072010-08-12 Doug Kwan <dougkwan@google.com>
2408
2409 * arm.cc (Target_arm::merge_object_attributes): Check command line
2410 options --no-wchar-size-warning and --no-enum-size-warning.
2411 * options.h (General_options): Add ld-compatible options
2412 --no-enum-size-warning and --no-wchar-size-warning.
2413
6e5710ce
ILT
24142010-08-04 Ian Lance Taylor <iant@google.com>
2415
2416 * x86_64.cc (Target_x86_64::Scan::local): Use
2417 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2418 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2419 (Target_x86_64::Scan::global): Likewise.
2420 (Target_x86_64::Relocate::relocate): Likewise.
2421 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2422 Likewise.
2423
fef830db
CC
24242010-08-03 Cary Coutant <ccoutant@google.com>
2425
2426 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2427 to reserve space in merged_strings vector. Keep total input size
2428 for stats.
2429 (Output_merge_string::do_print_merge_stats): Print total input size.
2430 * merge.h (Output_merge_string): Add input_size_ field.
2431 * stringpool.cc (Stringpool_template::string_length): Move
2432 implementations out of Stringpool_template class and place in
2433 stringpool.h.
2434 * stringpool.h (string_length): Move out of Stringpool_template.
2435
1e3811b0
ILT
24362010-08-03 Ian Lance Taylor <iant@google.com>
2437
2438 PR 11712
2439 * layout.cc (relaxation_loop_body): If address of load segment is
2440 set, adjust address to include headers if possible.
2441
7af0c620
ILT
24422010-08-03 Ian Lance Taylor <iant@google.com>
2443
2444 * version.cc (version_string): Bump to 1.10.
2445
22f0da72
ILT
24462010-08-03 Ian Lance Taylor <iant@google.com>
2447
2448 PR 11805
2449 * layout.h (enum Output_section_order): Define.
2450 (class Layout): Update declarations.
2451 * layout.cc (Layout::get_output_section): Add order parameter.
2452 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2453 is_first_non_relro parameters. Change all callers.
2454 (Layout::choose_output_section): Likewise.
2455 (Layout::add_output_section_data): Likewise.
2456 (Layout::make_output_section): Likewise. Set order.
2457 (Layout::default_section_order): New function.
2458 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2459 * output.cc (Output_section::Output_section): Initialize order_.
2460 Don't initialize deleted fields.
2461 (Output_segment::Output_segment): Don't initialize deleted
2462 fields.
2463 (Output_segment::add_output_section_to_load): New function
2464 replacing add_output_section. Change all callers to call this or
2465 add_output_section_to_nonload.
2466 (Output_segment::add_output_section_to_nonload): New function.
2467 (Output_segment::remove_output_section): Rewrite.
2468 (Output_segment::add_initial_output_data): Likewise.
2469 (Output_segment::has_any_data_sections): Likewise.
2470 (Output_segment::is_first_section_relro): Likewise.
2471 (Output_segment::maximum_alignment): Likewise.
2472 (Output_segment::has_dynamic_reloc): New function replacing
2473 dynamic_reloc_count. Change all callers.
2474 (Output_segment::has_dynamic_reloc_list): New function replacing
2475 dynamic_reloc_count_list. Change all callers.
2476 (Output_segment::set_section_addresses): Rewrite.
2477 (Output_segment::set_offset): Rewrite.
2478 (Output_segment::find_first_and_last_list): Remove.
2479 (Output_segment::set_tls_offsets): Rewrite.
2480 (Output_segment::first_section_load_address): Likewise.
2481 (Output_segment::output_section_count): Likewise.
2482 (Output_segment::section_with_lowest_load_address): Likewise.
2483 (Output_segment::write_section_headers): Likewise.
2484 (Output_segment::print_sections_to_map): Likewise.
2485 * output.h (class Output_data): Remove dynamic_reloc_count_
2486 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2487 (Output_data::add_dynamic_reloc): Rewrite.
2488 (Output_data::has_dynamic_reloc): New function.
2489 (Output_data::dynamic_reloc_count): Remove.
2490 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2491 is_last_relro_, is_first_non_relro_, is_interp_,
2492 is_dynamic_linker_section_ fields. Add order and set_order
2493 functions. Remove is_relro_local, set_is_relro_local,
2494 is_last_relro, set_is_last_relro, is_first_non_relro,
2495 set_is_first_non_relro functions, is_interp, set_is_interp,
2496 is_dynamic_linker_section, and set_is_dynamic_linker_section
2497 functions.
2498 (class Output_segment): Change Output_data_list from std::list to
2499 std:;vector. Add output_lists_ field. Remove output_data_ and
2500 output_bss_ fields. Update declarations.
2501
3ff2ccb0
ILT
25022010-08-02 Ian Lance Taylor <iant@google.com>
2503
2504 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2505 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2506 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2507
88a4108b
ILT
25082010-08-02 Ian Lance Taylor <iant@google.com>
2509
2510 PR 11855
2511 * script.cc (Script_options::Script_options): Initialize
2512 symbol_definitions_ and symbol_references_.
2513 (Script_options::add_symbol_assignment): Update
2514 symbol_definitions_ and symbol_references_.
2515 (Script_options::add_symbol_reference): New function.
2516 (script_symbol): New function.
2517 * script.h (class Script_options): Add symbol_definitions_ and
2518 symbol_references_ fields.
2519 (Script_options::referenced_const_iterator): New type.
2520 (Script_options::referenced_begin): New function.
2521 (Script_options::referenced_end): New function.
2522 (Script_options::is_referenced): New function.
2523 (Script_options::any_unreferenced): New function.
2524 * script-c.h (script_symbol): Declare.
2525 * yyscript.y (exp): Call script_symbol.
2526 * symtab.cc: Include "script.h".
2527 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2528 Change all callers. Check symbols referenced by scripts.
2529 (Symbol_table::add_undefined_symbols_from_command_line): Add
2530 layout parameter. Change all callers.
2531 (Symbol_table::do_add_undefined_symbols_from_command_line):
2532 Likewise. Break out loop body. Check symbols referenced by
2533 scripts.
2534 (Symbol_table::add_undefined_symbol_from_command_line): New
2535 function broken out of
2536 do_add_undefined_symbols_from_command_line.
2537 * symtab.h (class Symbol_table): Update declarations.
2538 * archive.cc: Include "layout.h".
2539 (Archive::should_include_member): Add layout parameter. Change
2540 all callers. Check for symbol mentioned in expression.
2541 * archive.h (class Archive): Update declaration.
2542 * object.cc (Sized_relobj::do_should_include_member): Add layout
2543 parameter.
2544 * object.h (Object::should_include_member): Add layout parameter.
2545 Change all callers.
2546 (Object::do_should_include_member): Add layout parameter.
2547 (class Sized_relobj): Update declaration.
2548 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2549 parameter.
2550 * dynobj.h (class Sized_dynobj): Update declaration.
2551 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2552 layout parameter.
2553 * plugin.h (class Sized_pluginobj): Update declaration.
2554
5f1ab67a
ILT
25552010-08-02 Ian Lance Taylor <iant@google.com>
2556
2557 PR 11866
2558 * output.cc (Output_segment::set_offset): Search for the first and
2559 last sections rather than assuming that the list is in order.
2560 (Output_segment::find_first_and_last_list): New function.
2561 * output.h (class Output_segment): Update declarations.
2562 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2563 (relro_strip_test_SOURCES): New variable.
2564 (relro_strip_test_DEPENDENCIES): New variable.
2565 (relro_strip_test_LDFLAGS): New variable.
2566 (relro_strip_test_LDADD): New variable.
2567 (relro_strip_test.so): New target.
2568
a8df5856
ILT
25692010-08-02 Ian Lance Taylor <iant@google.com>
2570
2571 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2572 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2573 (Target_i386::got_tlsdesc_section): New function.
2574 (Target_i386::got_section): Create space for GOT entries for
2575 TLSDESC relocations.
2576 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2577 R_386_TLS_GOTDESC.
2578 (Target_i386::Scan::global): Likewise.
2579 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2580 using TLSDESC GOT.
2581 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2582 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2583 (Target_x86_64::got_tlsdesc_section): New function.
2584 (Target_x86_64::got_section): Create space for GOT entries for
2585 TLSDESC relocations.
2586 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2587 R_386_TLS_GOTDESC.
2588 (Target_x86_64::Scan::global): Likewise.
2589 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2590 using TLSDESC GOT.
2591
0c10a0a6
ILT
25922010-08-02 Ian Lance Taylor <iant@google.com>
2593
2594 * testsuite/final_layout.sh: Use dc to convert from hex to
2595 decimal.
2596
41cbeecc
ST
25972010-07-29 Sriraman Tallam <tmsriram@google.com>
2598
2599 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2600 paramter to the call to gold::gc_process_relocs.
2601 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2602 paramter to the call to gold::gc_process_relocs.
2603 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2604 parameter to the call to gold::gc_process_relocs.
2605 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2606 template parameter to the call to gold::gc_process_relocs.
2607 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2608 paramter to the call to gold::gc_process_relocs.
2609 * gc.h (get_embedded_addend_size): New function.
2610 (gc_process_relocs): Save the size of the reloc for use by ICF.
2611 * icf.cc (get_section_contents): Get the addend from the text section
2612 for SHT_REL relocation sections.
2613 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2614 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2615 * int_encoding.h (read_from_pointer): New overloaded function.
2616 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2617 * testsuite/icf_sht_rel_addend_test.sh: New file.
2618 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2619 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2620
6ea55b82
RW
26212010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2622
2623 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2624 * Makefile.in: Regenerate.
2625 * testsuite/Makefile.in: Regenerate.
2626
9691462b
ILT
26272010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2628
2629 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2630 * gold/testsuite/debug_msg.cc: Likewise.
2631 * gold/testsuite/odr_violation1.cc
2632 * gold/testsuite/odr_violation2.cc
2633
76897331
CC
26342010-07-21 Cary Coutant <ccoutant@google.com>
2635
2636 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2637 string, and length fields.
2638 (Output_merge_string::Merged_strings_list): New type.
2639 (Output_merge_string::Merged_strings_lists): New typedef.
2640 (Output_merge_string): Replace merged_strings_ with
2641 merged_strings_lists_.
2642 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2643 Merged_strings_list per input object and section. Don't store pointer
2644 to the string. Don't store length with each merged string entry.
2645 (Output_merge_string::finalize_merged_data): Loop over list of merged
2646 strings lists. Recompute length of each merged string.
2647
78384e8f
CC
26482010-07-15 Cary Coutant <ccoutant@google.com>
2649
2650 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2651 here.
2652
783659f9
ILT
26532010-07-14 Ian Lance Taylor <iant@google.com>
2654
2655 * descriptors.cc (Descriptors::open): Report correct name in error
2656 message.
2657
131687b4
DK
26582010-07-13 Doug Kwan <dougkwan@google.com>
2659
2660 * arm.cc (Arm_input_section::Arm_input_section): For a
2661 SHT_ARM_EXIDX section, always keeps the input sections.
2662 (Arm_input_section::set_exidx_section_link): New method.
2663 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2664 has_errors_ to false.
2665 (Arm_exidx_input_section::has_errors,
2666 Arm_exidx_input_section::set_has_errors): New methods.
2667 (Arm_exidx_input_section::has_errors_): New data member.
2668 (Arm_relobj::get_exidx_shndx_list): New method.
2669 (Arm_output_section::append_text_sections_to_list): Do not skip
2670 section without SHF_EXECINSTR.
2671 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2672 errors.
2673 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2674 section header. Make error messages more verbose. Check for
2675 a non-executable section linked to an EXIDX section.
2676 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2677 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2678 check that there is no deferred EXIDX section if we exit early.
2679 Instead of not making an EXIDX section in case of an error, make one
2680 and set the has_errors flag of it.
2681 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2682 in a relocatable link.
2683 (Target_arm::do_relax): Look for the EXIDX output section instead of
2684 assuming that it is called .ARM.exidx.
2685 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2686 section list. Do not check for SHF_EXECINSTR section flags but
2687 skip any input section with errors.
2688 * output.cc (Output_section::Output_section): Initialize
2689 always_keeps_input_sections_ to false.
2690 (Output_section::add_input_section): Check for
2691 always_keeps_input_sections_.
2692 * output.h (Output_section::always_keeps_input_sections,
2693 Output_section::set_always_keeps_input_sections): New methods.
2694 (Output_section::always_keeps_input_sections): New data member.
2695
69517287
RÁE
26962010-07-13 Rafael Espindola <espindola@google.com>
2697
2698 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2699 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2700
82742395
ILT
27012010-07-13 Philip Herron <herron.philip@googlemail.com>
2702 Ian Lance Taylor <iant@google.com>
2703
2704 * output.h (Output_section_lookup_maps::add_merge_section):
2705 Correct check of whether value was inserted.
2706 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2707 (Output_section_lookup_maps::add_relaxed_input_section):
2708 Likewise.
2709 * arm.cc (Target_arm::got_section): Remove used local os.
2710 * i386.cc (Target_i386::got_section): Likewise.
2711 * x86_64.cc (Target_x86_64::got_section): Likewise.
2712 * sparc.cc (Target_sparc::got_section): Likewise.
2713 (Target_sparc::relocate): Remove unused local have_got_offset.
2714 * powerpc.cc (Target_powerpc::relocate): Likewise.
2715
f2d707b5
ILT
27162010-07-13 Ian Lance Taylor <iant@google.com>
2717
241531d6
ILT
2718 * compressed_output.cc (zlib_decompress): Fix signature in
2719 !HAVE_ZLIB_H case.
2720
f2d707b5
ILT
2721 * archive.cc (Archive::include_member): Unlock an external member
2722 of a thin archive. Don't bother to delete an object we know is
2723 NULL.
2724
a2e47362
CC
27252010-07-12 Cary Coutant <ccoutant@google.com>
2726
2727 * compressed_output.cc (zlib_decompress): New function.
2728 (get_uncompressed_size): New function.
2729 (decompress_input_section): New function.
2730 * compressed_output.h (get_uncompressed_size): New function.
2731 (decompress_input_section): New function.
2732 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2733 Handle compressed debug sections.
2734 * layout.cc (is_compressed_debug_section): New function.
2735 (Layout::output_section_name): Map compressed section names to
2736 canonical names.
2737 * layout.h (is_compressed_debug_section): New function.
2738 (is_debug_info_section): Recognize compressed debug sections.
2739 * merge.cc: Include compressed_output.h.
2740 (Output_merge_data::do_add_input_section): Handle compressed
2741 debug sections.
2742 (Output_merge_string::do_add_input_section): Handle compressed
2743 debug sections.
2744 * object.cc: Include compressed_output.h.
2745 (Sized_relobj::Sized_relobj): Initialize new data members.
2746 (build_compressed_section_map): New function.
2747 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2748 * object.h (Object::section_is_compressed): New method.
2749 (Object::do_section_is_compressed): New method.
2750 (Sized_relobj::Compressed_section_map): New type.
2751 (Sized_relobj::do_section_is_compressed): New method.
2752 (Sized_relobj::compressed_sections_): New data member.
2753 * output.cc (Output_section::add_input_section): Handle compressed
2754 debug sections.
2755 * reloc.cc: Include compressed_output.h.
2756 (Sized_relobj::write_sections): Handle compressed debug sections.
2757
ce279a62
CC
27582010-07-08 Cary Coutant <ccoutant@google.com>
2759
2760 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2761 weak when resolving to a dynamic def.
2762 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2763 for weak undef/dynamic def cases. Adjust callers.
2764 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2765 undef_binding_weak_.
2766 (Symbol_table::sized_write_globals): Adjust symbol binding.
2767 (Symbol_table::sized_write_symbol): Add binding parameter.
2768 * symtab.h (Symbol::set_undef_binding): New method.
2769 (Symbol::is_undef_binding_weak): New method.
2770 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2771 (Symbol_table::should_override): Add new parameter.
2772 (Symbol_table::sized_write_symbol): Add new parameter.
2773
2774 * testsuite/weak_undef_file1.cc: Add new test case.
2775 * testsuite/weak_undef_file2.cc: Fix header comment.
2776 * testsuite/weak_undef_test.cc: Add new test case.
2777
b2286c10
DK
27782010-06-29 Doug Kwan <dougkwan@google.com>
2779
2780 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2781 Initialize USE_SYMBOL_.
2782 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2783 definition.
2784 (Arm_reloc_property::uses_symbol_): New data member declaration.
2785 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2786 uses symbol value and symbol is undefined but not weakly undefined.
2787
4802450a
RÁE
27882010-06-28 Rafael Espindola <espindola@google.com>
2789
2790 * plugin.cc (Plugin::load): Use dlerror.
2791
e5ca47ba
ILT
27922010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2793
2794 * symtab.cc (detect_odr_violations): When reporting an ODR
2795 violation, report an object where the symbol is defined.
2796
8a75a161
DK
27972010-06-25 Doug Kwan <dougkwan@google.com>
2798
2799 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2800 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2801 definition.
2802 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2803 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2804 target hook to detect function points.
2805 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2806 * icf.h (Icf::check_section_for_function_pointers): Change type of
2807 parameter SECTION_NAME to const reference to std::string. Use
2808 target hook to determine if section may have unsafe pointers.
2809 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2810 method definition.
2811
42218b9f
RÁE
28122010-06-21 Rafael Espindola <espindola@google.com>
2813
2814 * fileread.cc (Input_file::find_fie): New
2815 (Input_file::open): Use Input_file::find_fie.
2816 * fileread.h (Input_file::find_fie): New
2817 * plugin.cc (set_extra_library_path): New.
2818 (Plugin::load): Add set_extra_library_path to the transfer vector.
2819 (Plugin_manager::set_extra_library_path): New.
2820 (Plugin_manager::add_input_file): Use the extra search path if set.
2821 (set_extra_library_path(): New.
2822 * plugin.h (Plugin_manager): Add set_extra_library_path and
2823 extra_search_path_.
2824
a0506cca
CC
28252010-06-19 Cary Coutant <ccoutant@google.com>
2826
2827 * layout.cc (gdb_sections): Add .debug_types.
2828 (lines_only_debug_sections): Likewise.
2829
6508b958
RÁE
28302010-06-18 Rafael Espindola <espindola@google.com>
2831
2832 * plugin.cc (add_input_file,add_input_library)
2833 (Plugin_manager::add_input_file): Make filename arguments const.
2834 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2835 const.
2836
3e235302
DK
28372010-06-16 Doug Kwan <dougkwan@google.com>
2838
2839 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2840 .ARM.attributes section if we have not merged any input
2841 attributes sections.
2842
106e8a6c
DK
28432010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2844
2845 * arm.cc: Allow combining objects with no EABI version
2846 information.
2847
91ff43fe
RÁE
28482010-06-15 Rafael Espindola <espindola@google.com>
2849
2850 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2851
68ed838c
ILT
28522010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2853
2854 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2855 (struct iovec): Correct !HAVE_READV definition.
2856
f3a2388f
CC
28572010-06-10 Cary Coutant <ccoutant@google.com>
2858
2859 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2860 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2861 reloc sections.
2862 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2863
2864 PR 11683
2865 * symtab.h (Symbol::is_placeholder): New member function.
2866 * target-reloc.h (relocate_section): Check for placeholder symbols.
2867
2868 * testsuite/Makefile.am (plugin_test_8): New test.
2869 (plugin_test_9): New test.
2870 * testsuite/Makefile.in: Regenerate.
2871
e1df38aa
NC
28722010-06-09 Nick Clifton <nickc@redhat.com>
2873
2874 * yyscript.y (input_list_element): Allow strings prefixed with
2875 the '-' character. Treat these as libraries.
2876 * script.cc (script_add_library): New function. Adds a library
2877 specified by "-l<name>" found in an input script.
2878 * script-c.h: Add prototype for script_add_library.
2879
25bbe950
DK
28802010-06-07 Doug Kwan <dougkwan@google.com>
2881
2882 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2883 Restrict stub-group size to be within long conditional branch
2884 range when working around cortex-A8 erratum.
2885
0f32ea4c
ILT
28862010-06-07 Damien Diederen <dd@crosstwine.com>
2887
2888 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2889 #ifdef typo.
2890
8fe2a369
ST
28912010-06-03 Sriraman Tallam <tmsriram@google.com>
2892
2893 PR gold/11658
2894 * output.cc
2895 (Output_section::Input_section_sort_entry::compare_section_ordering):
2896 Change to return non-zero correctly.
2897 (Output_section::Input_section_sort_section_order_index_compare
2898 ::operator()): Change to fix ambiguity in comparisons.
2899
6e9ba2ca
ST
29002010-06-01 Sriraman Tallam <tmsriram@google.com>
2901
2902 * gold.h (is_wildcard_string): New function.
2903 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2904 (Layout::layout_eh_frame): Ditto.
2905 (Layout::find_section_order_index): New method.
2906 (Layout::read_layout_from_file): New method.
2907 * layout.h (Layout::find_section_order_index): New method.
2908 (Layout::read_layout_from_file): New method.
2909 (Layout::input_section_position_): New private member.
2910 (Layout::input_section_glob_): New private member.
2911 * main.cc (main): Call read_layout_from_file here.
2912 * options.h (--section-ordering-file): New option.
2913 * output.cc (Output_section::input_section_order_specified_): New
2914 member.
2915 (Output_section::Output_section): Initialize new member.
2916 (Output_section::add_input_section): Add new parameter.
2917 Keep input sections when --section-ordering-file is used.
2918 (Output_section::set_final_data_size): Sort input sections when
2919 section ordering file is specified.
2920 (Output_section::Input_section_sort_entry): Add new parameter.
2921 Check sorting type.
2922 (Output_section::Input_section_sort_entry::compare_section_ordering):
2923 New method.
2924 (Output_section::Input_section_sort_compare::operator()): Change to
2925 consider section_order_index.
2926 (Output_section::Input_section_sort_init_fini_compare::operator()):
2927 Change to consider section_order_index.
2928 (Output_section::Input_section_sort_section_order_index_compare
2929 ::operator()): New method.
2930 (Output_section::sort_attached_input_sections): Change to sort
2931 according to section order when specified.
e1df38aa
NC
2932 (Output_section::add_input_section<32, true>): Add new parameter.
2933 (Output_section::add_input_section<64, true>): Add new parameter.
2934 (Output_section::add_input_section<32, false>): Add new parameter.
2935 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
2936 * output.h (Output_section::add_input_section): Add new parameter.
2937 (Output_section::input_section_order_specified): New
2938 method.
2939 (Output_section::set_input_section_order_specified): New method.
2940 (Input_section::Input_section): Initialize section_order_index_.
2941 (Input_section::section_order_index): New method.
2942 (Input_section::set_section_order_index): New method.
2943 (Input_section::section_order_index_): New member.
2944 (Input_section::Input_section_sort_section_order_index_compare): New
2945 struct.
2946 (Output_section::input_section_order_specified_): New member.
2947 * script-sections.cc (is_wildcard_string): Delete and move modified
2948 method to gold.h.
2949 (Output_section_element_input::Output_section_element_input): Modify
2950 call to is_wildcard_string.
2951 (Output_section_element_input::Input_section_pattern
2952 ::Input_section_pattern): Ditto.
2953 (Output_section_element_input::Output_section_element_input): Ditto.
2954 * testsuite/Makefile.am (final_layout): New test case.
2955 * testsuite/Makefile.in: Regenerate.
2956 * testsuite/final_layout.cc: New file.
2957 * testsuite/final_layout.sh: New file.
2958
3537c84b
RÁE
29592010-06-01 Rafael Espindola <espindola@google.com>
2960
2961 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2962
105b6afd
RÁE
29632010-06-01 Rafael Espindola <espindola@google.com>
2964
2965 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2966 visibility of symbols.
2967
29e11421
DK
29682010-05-27 Doug Kwan <dougkwan@google.com>
2969
2970 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2971 from start of output section instead of address for a local symbol
2972 in a merged or relaxed section when doing a relocatable link.
2973
5e0f337e
RÁE
29742010-05-26 Rafael Espindola <espindola@google.com>
2975
2976 PR 11604
2977 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2978 adding sections the garbage collector removed.
2979 * gold/testsuite/Makefile.am: Add test.
2980 * gold/testsuite/Makefile.in: Regenerate.
2981 * gold/testsuite/plugin_test_7.sh: New.
2982 * gold/testsuite/plugin_test_7_1.c: New.
2983 * gold/testsuite/plugin_test_7_2.c: New.
2984
f4187277
RÁE
29852010-05-26 Rafael Espindola <espindola@google.com>
2986
2987 * script-sections.cc (Output_section_definition::set_section_addresses):
2988 Check for --section-start.
2989
5c388529
DK
29902010-05-26 Doug Kwan <dougkwan@google.com>
2991
2992 * arm.cc (Arm_scan_relocatable_relocs): New class.
2993 (Target_arm::relocate_special_relocatable): New method.
2994 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2995 (Arm_relocate_functions::thumb_branch_common): Same.
2996 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2997 instead of Default_scan_relocatable_relocs.
2998 * target-reloc.h (relocate_for_relocatable): Let target handle
2999 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3000 * target.h (Sized_target::relocate_special_relocatable): New method.
3001
bca1c3ae
ILT
30022010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3003
3004 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3005
0439c796
DK
30062010-05-23 Doug Kwan <dougkwan@google.com>
3007
3008 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3009 instead of a cast.
3010 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3011 with a direct branch, not a conditional branch, to a stub.
3012 * merge.cc (Output_merge_base::record_input_section): New method
3013 defintion.
3014 (Output_merge_data::do_add_input_section): Record input section if
3015 keeps-input-sections flag is set.
3016 (Output_merge_string::do_add_input_section): Ditto.
3017 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3018 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3019 INPUT_SECTIONS_.
3020 (Output_merge_base::keeps_input_sections,
3021 Output_merge_base::set_keeps_input_sections,
3022 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3023 method definitions.
3024 (Output_merge_base::Input_sections): New type declaration.
3025 (Output_merge_base::input_sections_begin,
3026 Output_merge_base::input_sections_end,
3027 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3028 (Output_merge_base::bool keeps_input_sections_,
3029 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3030 Output_merge_base::input_sections_): New data members.
3031 (Output_merge_data::do_set_keeps_input_sections): New method
3032 defintion.
3033 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3034 * output.cc (Output_section::Input_section::relobj): Move method
3035 defintion from class declaration to here and handle merge sections.
3036 (Output_section::Input_section::shndx): Ditto.
3037 (Output_section::Output_section): Remove initializations of removed
3038 data members and initialize new data member LOOKUP_MAPS_.
3039 (Output_section::add_input_section): Set keeps-input-sections flag
3040 for a newly created merge output section as appropriate. Adjust code
3041 to use Output_section_lookup_maps class.
3042 (Output_section::add_relaxed_input_section): Adjst code for lookup
3043 maps code refactoring.
3044 (Output_section::add_merge_input_section): Add a new parameter
3045 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3046 class. If adding input section to a newly created merge output
3047 section fails, remove the new merge section.
3048 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 3049 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
3050 (Output_section::find_merge_section): Ditto.
3051 (Output_section::build_lookup_maps): New method defintion.
3052 (Output_section::find_relaxed_input_section): Adjust code to use
3053 Output_section_lookup_maps class.
3054 (Output_section::get_input_sections): Export merge sections. Adjust
3055 code to use Output_section_lookup_maps class.
3056 (Output_section:::add_script_input_section): Adjust code to use
3057 Output_section_lookup_maps class. Update lookup maps for merge
3058 sections also.
3059 (Output_section::discard_states): Use Output_section_lookup_maps.
3060 (Output_section::restore_states): Same.
3061 * output.h (Merge_section_properties): Move class defintion out of
3062 Output_section.
3063 (Output_section_lookup_maps): New class.
3064 (Output_section::Input_section::is_merge_section): New method
3065 defintion.
3066 (Output_section::Input_section::relobj): Move defintion out of class
3067 defintion. Declare method only.
3068 (Output_section::Input_section::shndx): Ditto.
3069 (Output_section::Input_section::output_merge_base): New method defintion.
3070 (Output_section::Input_section::u2_.pomb): New union field.
3071 (Output_section::Merge_section_by_properties_map,
3072 Output_section::Output_section_data_by_input_section_map,
3073 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3074 Remove types.
3075 (Output_section::add_merge_input_section): Add new parameter
3076 KEEPS_INPUT_SECTIONS.
3077 (Output_section::build_lookup_maps): New method declaration.
3078 (Output_section::merge_section_map_,
3079 Output_section::merge_section_by_properties_map_,
3080 Output_section::relaxed_input_section_map_,
3081 Output_section::is_relaxed_input_section_map_valid_): Remove data
3082 members.
3083 (Output_section::lookup_maps_): New data member.
3084
76295588
L
30852010-05-21 Doug Kwan <dougkwan@google.com>
3086
3087 PR gold/11619
3088 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3089 avoid a compilation error.
3090
d103a984
RÁE
30912010-05-19 Rafael Espindola <espindola@google.com>
3092
3093 * script-sections.cc (Output_section_definition::allocate_to_segment):
3094 Update the phdrs_list even when the output section is NULL.
3095 * testsuite/Makefile.am: Add test.
3096 * testsuite/Makefile.in: Regenerate.
3097 * testsuite/script_test_9.cc: New.
3098 * testsuite/script_test_9.sh: New.
3099 * testsuite/script_test_9.t: New.
3100
6625d24e
DK
31012010-05-19 Doug Kwan <dougkwan@google.com>
3102
3103 * arm.cc (Arm_input_section::original_size): New method.
3104 (Arm_input_section::do_addralign): Add a cast.
3105 (Arm_input_section::do_output_offset): Remove static cast.
3106 (Arm_input_section::original_addralign,
3107 Arm_input_section::original_size_): Change type to uint32_t.
3108 (Arm_input_section::init): Add safe casts for section alignment
3109 and size.
3110 (Arm_input_section::set_final_data_size): Do not set address and
3111 offset of stub table.
3112 (Arm_output_section::fix_exidx_coverage): Change use of of
3113 Output_section::Simple_input_section to that of
3114 Output_section::Input_section.
3115 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3116 except for the first pass.
3117 * output.cc (Output_section::get_input_sections): Change type of
3118 input_sections to std::list<Input_section>.
3119 (Output_section::add_script_input_section): Rename from
3120 Output_section::add_simple_input_section. Change type of SIS
3121 parameter from Simple_input_section to Input_section.
3122 * output.h (Output_section::Simple_input_section): Remove class.
3123 (Output_section::Input_section): Change class visibility to public.
3124 (Output_section::Input_section::addralign): Use stored alignments
3125 for special input sections if set.
3126 (Output_section::Input_section::set_addralign): New method.
3127 (Output_section::get_input_sections): Change parameter type from
3128 list of Simple_input_section to list of Input_section.
3129 (Output_section::add_script_input_section): Rename from
3130 Output_section::add_simple_input_section. Change first parameter's
3131 type from Simple_input_section to Input_section and remove the
3132 second and third parameters.
3133 * script-sections.cc (Input_section::Input_section_list): Change
3134 type to list of Output_section::Input_section/
3135 (Input_section_info::Input_section_info): Change parameter type of
3136 INPUT_SECTION to Output_section::Input_section.
3137 (Input_section_info::input_section): Change return type.
3138 (Input_section_info::input_section_): Change type to
3139 Output_section::Input_section.
3140 (Output_section_element_input::set_section_addresses): Adjust code
3141 to use Output_section::Input_section instead of
3142 Output_section::Simple_input_section. Adjust code for renaming
3143 of Output_section::add_simple_input_section.
3144 (Orphan_output_section::set_section_addresses): Ditto.
3145
e1e82ea4
RW
31462010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3147
3148 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3149 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3150
91e75c8a
RÁE
31512010-05-18 Rafael Espindola <espindola@google.com>
3152
3153 * options.cc (General_options::finalize): Handle -nostdlib.
3154 * options.h (nostdlib): New option.
3155 * script.cc (script_add_search_dir): Handle -nostdlib.
3156
da59ad79
DK
31572010-05-12 Doug Kwan <dougkwan@google.com>
3158
3159 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3160 attributes section only if there no attributes section after merging.
3161 (Target_arm::merge_object_attributes): Move value of
e1df38aa 3162 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
3163 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3164 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3165 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3166 and arm_attr_merge_7.stdout.
3167 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3168 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3169 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3170 arm_attr_merge_7b.o): New rules.
3171 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3172 arm_attr_merge_7
3173 * testsuite/Makefile.in: Regenerate.
3174 * testsuite/arm_attr_merge.sh: New file.
3175 * testsuite/arm_attr_merge_[67][ab].s: Same.
3176
3e01a7fd
NC
31772010-05-05 Nick Clifton <nickc@redhat.com>
3178
3179 * po/es.po: Updated Spanish translation.
3180
7ad2014a
L
31812010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3182
3183 * Makefile.am (install-exec-local): Properly install gold as
3184 default cross linker.
3185 * Makefile.in: Regenerated.
3186
4fda8867
NC
31872010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3188 Nick Clifton <nickc@redhat.com>
3189
3190 * configure.ac (install_as_default): Define and set to false
3191 unless --enable-gold or --enable-gold=both/gold has been
3192 specified.
3193 * configure: Regenerate.
3194
3195 * Makefile.am (install-exec-local): Install the executable as
3196 'ld.gold'. If install_as_default is true then also install it as
3197 'ld'.
3198 * Makefile.in: Regenerated.
3199
bd288ea2
ILT
32002010-04-24 Ian Lance Taylor <iant@google.com>
3201
3202 * layout.cc (Layout::layout_reloc): In relocatable link don't
3203 combine reloc sections for grouped sections.
3204
ef38fd8a
ST
32052010-04-23 Sriraman Tallam <tmsriram@google.com>
3206
3207 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3208 sections that are not ordinary to icf.
3209 * icf.cc (get_section_contents): Handle relocation pointing to section
3210 with no object or shndx information.
3211 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3212 * testsuite/Makefile.in: Regenerate.
3213 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3214 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3215
f6973bdc
ILT
32162010-04-22 Ian Lance Taylor <iant@google.com>
3217
3218 * expression.cc (Expression::Expression_eval_info): Add
3219 result_alignment_pointer field.
3220 (Expression::eval_with_dot): Add result_alignment_pointer
3221 parameter. Change all callers.
3222 (Expression::eval_maybe_dot): Likewise.
3223 (class Binary_expression): Add alignment_pointer parameter to
3224 left_value and right_value. Change all callers.
3225 (BINARY_EXPRESSION): Set result alignment.
3226 (class Trinary_expression): Add alignment_pointer parameter to
3227 arg2_value and arg3_value. Change all callers.
3228 (Trinary_cond::value): Set result alignment.
3229 (Max_expression::value, Min_expression::value): Likewise.
3230 (Align_expression::value): Likewise.
3231 * script-sections.cc (class Sections_element): Add dot_alignment
3232 parameter to set_section_addresses virtual function. Update
3233 instantiations.
3234 (class Output_section_element): Likewise.
3235 (Script_sections::create_segments): Add dot_alignment parameter.
3236 Change all callers.
3237 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3238 (Script_sections::set_phdrs_clause_addresses): Likewise.
3239 * script-sections.h: Update declarations.
3240 * script.h: Update declarations.
3241 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3242 min_p_align.
3243 * testsuite/script_test_3.t: Set large alignment.
3244 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3245 segment has expected alignment.
3246
9c9c98a5
NC
32472010-04-22 Nick Clifton <nickc@redhat.com>
3248
3249 * po/gold.pot: Updated by the Translation project.
3250 * po/vi.po: Updated Vietnamese translation.
3251
2253bfba
L
32522010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3253
3254 * testsuite/Makefile.am (check_PROGRAMS): Add
3255 icf_virtual_function_folding_test.
3256 * testsuite/Makefile.in: Regenerated.
3257
85fdf906
AH
32582010-04-15 Andrew Haley <aph@redhat.com>
3259
3260 * options.h (merge_exidx_entries): New option.
3261 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3262 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3263 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3264 (Target_arm::merge_exidx_entries): New function.
3265 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3266 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3267 to Arm_exidx_fixup constructor.
3268 Add new arg, merge_exidx_entries.
3269 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3270 Arm_output_section::fix_exidx_coverage.
3271
ce97fa81
ST
32722010-04-18 Sriraman Tallam <tmsriram@google.com>
3273
3274 * icf.cc (get_section_contents): Check for preemptible functions.
3275 Ignore addend when appropriate.
3276 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3277 section folded.
3278 (add_from_relobj): Check for section folded.
3279 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3280 * symtab.h (should_add_dynsym_entry): Add new parameter.
3281 * target-reloc.h (scan_relocs): Check for section folded.
3282 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3283 Check reloc types for function pointers in shared objects.
3284 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3285 case.
3286 (icf_preemptible_functions_test): New test case.
3287 (icf_string_merge_test): New test case.
3288 * testsuite.Makefile.in: Regenerate.
3289 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3290 bar_glob. Refactor code.
3291 * testsuite/icf_preemptible_functions_test.cc: New file.
3292 * testsuite/icf_preemptible_functions_test.sh: New file.
3293 * testsuite/icf_string_merge_test.cc: New file.
3294 * testsuite/icf_string_merge_test.sh: New file.
3295 * testsuite/icf_virtual_function_folding_test.cc: New file.
3296 * testsuite/icf_virtual_function_folding_test.sh: New file.
3297
04ceb17c
DK
32982010-04-14 Doug Kwan <dougkwan@google.com>
3299
3300 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3301 for local symbol recounting if we remove a section due to ICF.
3302 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3303 there are no regular objects in input.
3304
153e7da4
DK
33052010-04-13 Doug Kwan <dougkwan@google.com>
3306
3307 * arm.cc (Arm_input_section::set_final_data_size): Compute
3308 accurate final data size instead of using current data size.
3309
4dbd9faf
DK
33102010-04-09 Doug Kwan <dougkwan@google.com>
3311
3312 * layout.cc (Layout::choose_output_section): Handle script section
3313 types.
3314 (Layout::make_output_section_for_script): Add section type parameter.
3315 Handle script section types.
3316 * layout.h (Layout::make_output_section_for_script): Add section
3317 type parameter.
3318 * output.cc (Output_section::Output_section): Initialize data member
3319 is_noload_.
3320 (Output_section::do_reset_address_and_file_offset): Do not set address
3321 to 0 if section is a NOLOAD section.
3322 * output.h (Output_section::is_noload): New method.
3323 (Output_section::set_is_noload): Ditto.
3324 (Output_section::is_noload_): New data member.
3325 * script-c.h (Script_section_type): New enum type.
3326 (struct Parser_output_section_header): Add new file section_type.
3327 * script-sections.cc (Sections_element::output_section_name): Add
3328 parameter for returning script section type.
3329 (Output_section_definition::output_section_name): Ditto.
3330 (Output_section_definition::section_type)P; New method.
3331 (Output_section_definiton::script_section_type_name): Ditto.
3332 (Output_section_definition::script_section_type_): New data member.
3333 (Output_section_definition::Output_section_definition): Initialize
3334 data member Output_section_definition::script_section_type_.
3335 (Output_section_definition::create_sections): Pass script section type
3336 to Layout::make_output_section_for_script.
3337 (Output_section_definition::output_section_name): Return script
3338 section type to caller.
3339 (Output_section_definition::set_section_address): Do not advance
3340 dot value and load address if section type is NOLOAD. Set address
3341 of NOLOAD sections regardless of section flags.
3342 (Output_section_definition::print): Print section type if it is
3343 not SCRIPT_SECTION_TYPE_NONE.
3344 (Output_section_definition::section_type): New method.
3345 (Output_section_definition::script_section_type_name): Ditto.
3346 (Script_sections::output_section_name): Add new parameter
3347 PSECTION_TYPE for returning script section type. Pass it to
3348 section elements. Handle discard sections.
3349 (Sort_output_sections::operator()): Handle NOLOAD sections.
3350 * script-sections.h (Script_sections::Section_type): New enum type.
3351 (Script_sections::output_section_name): Add a new parameter for
3352 returning script section type.
3353 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3354 INFO and NOLOAD.
3355 * yyscript.y (union): Add new field SECTION_TYPE.
3356 (COPY, DSECT, INFO, NOLOAD): New tokens.
3357 (opt_address_and_section_type): Change type to output_section_header.
3358 (section_type): New non-terminal
3359 (section_header): Handle section type.
2253bfba 3360 (opt_address_and_section_type): Return section type value.
4dbd9faf 3361
721ea635
L
33622010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3363
3364 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3365 * testsuite/plugin_common_test_2.c (foo): Likewise.
3366
6bf924b0
DK
33672010-04-08 Doug Kwan <dougkwan@google.com>
3368
3369 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3370 Output_merge_data.
3371 * output.cc (Output_section::add_merge_input_section): Simplify
3372 code and return status of Output_merge_base::add_input_section.
e1df38aa 3373 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
3374 returns true.
3375
24af6f92
DK
33762010-04-07 Doug Kwan <dougkwan@google.com>
3377
3378 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3379 if section is marked as containing instructions but has no mapping
3380 symbols.
3381 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3382 correct section index.
3383 (Arm_relobj::find_linked_text_section): Ditto.
3384
00698fc5
CC
33852010-04-07 Cary Coutant <ccoutant@google.com>
3386
3387 * archive.cc (include_member): Destroy Read_symbols_data object before
3388 releasing file.
3389 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3390 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3391 (Read_symbols_data::~Read_symbols_data) New destructor.
3392 (Section_relocs::Section_relocs) New constructor.
3393 (Section_relocs::~Section_relocs) New destructor.
3394 (Read_relocs_data::Read_relocs_data) New constructor.
3395 (Read_relocs_data::~Read_relocs_data) New destructor.
3396 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3397 pointers to NULL after deleting.
3398
7296d933
DK
33992010-04-07 Doug Kwan <dougkwan@google.com>
3400
3401 * arm.cc: Replace "endianity" with "endianness" in comments.
3402 (Arm_exidx_cantunwind): Ditto.
3403 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3404 (Arm_relobj::merge_flags_and_attributes): New method.
3405 (Arm_relobj::merge_flags_and_attributes_): New data member.
3406 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3407 (Arm_relobj::scan_sections_for_stubs): Ditto.
3408 (Arm_relobj::do_read_symbols): Check to see if we really want to
3409 merge processor-specific flags and attributes. Exit early if
3410 an object is empty except for section names and the undefined symbol.
3411 (Target_arm::do_finalize_sections): Move check for ELF format to
3412 Arm_relobj::do_read_symbols. Merge processor specific flags and
3413 attributes from a regular object only when we have determined that
3414 it is aapropriate. Do not create an .ARM.attributes section in
3415 output if there is no regular input object.
3416 (Target_arm::merge_processor_specific_flags): Check
3417 --warn-mismatch before printing any error.
3418 (Target_arm::merge_object_attributes): Ditto.
3419 * gold.cc (queue_middle_tasks): Handle the case in which there is
3420 no regular object in input.
3421 * options.cc (General_options::parse_EB): New method.
3422 (General_options::parse_EL): Same.
3423 (General_options::General_options): Initialize endianness_.
3424 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3425 New options.
3426 (General_options::Endianness): New enum.
3427 (General_options::endianness): New method.
3428 (General_options::endianness_): New data member.
3429 * parameters.cc (Parameters::set_options): Check target endianness.
3430 (Parameters::set_target_once): Ditto.
3431 (Parameters::check_target_endianness): New method.
3432 (parameters_force_valid_target): If either -EL or -EB is specified,
3433 use it to define endianness of default target.
3434 * parameters.h (Parameters::check_target_endianness): New method
3435 declaration.
3436 * target.h (class Target): Change "endianity" to "endianness"
3437 in comments.
3438
efc8d4f2
RW
34392010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3440
3441 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3442 * configure: Regenerate.
3443 * Makefile.in: Regenerate.
3444 * testsuite/Makefile.in: Regenerate.
3445
be234d88
CC
34462010-04-06 Cary Coutant <ccoutant@google.com>
3447
3448 gcc PR lto/42757
3449 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3450 prevailing definitions of common symbols.
3451 * testsuite/plugin_test_6.sh: New test case.
3452 * testsuite/plugin_common_test_1.c: New test case.
3453 * testsuite/plugin_common_test_2.c: New test case.
3454 * testsuite/Makefile.am (plugin_test_6): New test case.
3455 * testsuite/Makefile.in: Regenerate.
3456
bd32c6bd
NC
34572010-04-06 Nick Clifton <nickc@redhat.com>
3458
3459 * po/vi.po: New Vietnamese translation.
3460
323c532f
DK
34612010-03-30 Doug Kwan <dougkwan@google.com>
3462
3463 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3464
4fcd97eb
DK
34652010-03-25 Doug Kwan <dougkwan@google.com>
3466
3467 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3468 to avoid a conversion warning on a 32-bit host.
3469
4ebf39db
ILT
34702010-03-24 Ian Lance Taylor <iant@google.com>
3471
3472 * testsuite/script_test_3.t: Add a TLS segment.
3473 * testsuite/Makefile.am (check_PROGRAMS): Add
3474 tls_phdrs_script_test.
3475 (tls_phdrs_script_test_SOURCES): Define.
3476 (tls_phdrs_script_test_DEPENDENCIES): Define.
3477 (tls_phdrs_script_test_LDFLAGS): Define.
3478 (tls_phdrs_script_test_LDADD): Define.
3479 * testsuite/Makefile.in: Rebuild.
3480
4a599bdd
CC
34812010-03-23 Cary Coutant <ccoutant@google.com>
3482
3483 * fileread.cc (find_or_make_view): Fix comment.
3484
6c93b22c
ILT
34852010-03-23 Ian Lance Taylor <iant@google.com>
3486
3487 * script-sections.cc (class Orphan_section_placement): Define
3488 PLACE_TLS and PLACE_TLS_BSS.
3489 (Orphan_section_placement::Orphan_section_placement): Initialize
3490 new places.
3491 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3492 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3493 (tls_script_test_SOURCES): Define.
3494 (tls_script_test_DEPENDENCIES): Define.
3495 (tls_script_test_LDFLAGS): Define.
3496 (tls_script_test_LDADD): Define.
3497 * testsuite/Makefile.in: Rebuild.
3498
a2c7281b
DK
34992010-03-22 Doug Kwan <dougkwan@google.com>
3500
3501 * arm.cc (Arm_relocate_functions::abs8,
3502 Arm_relocate_functions::abs16): Use correct check for overflow
3503 specified in the ARM ELF specs.
3504 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3505 target of a BLX instruction specially.
3506 (Reloc_stub::stub_type_for_reloc): Ditto.
3507 (Relocate::relocate): Use symbolic names instead of numeric relocation
3508 codes to report error.
3509 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3510 workaround.
3511 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3512 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3513 thumb2_blx_out_of_range.stdout
3514 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3515 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3516 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3517 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3518 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3519 thumb2_blx_in_range, thumb2_blx_in_range.o,
3520 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3521 thumb2_blx_out_of_range.o): New rules.
3522 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3523 thumb2_blx_in_range and thumb2_blx_out_of_range.
3524 * testsuite/Makefile.in: Regenerate.
3525 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3526 * testsuite/thumb_blx_in_range.s: New file.
3527 * testsuite/thumb_blx_out_of_range.s: New file.
3528
b0193076
RÁE
35292010-03-22 Rafael Espindola <espindola@google.com>
3530
3531 * archive.cc (Should_include): Move to archive.h.
3532 (should_include_member): Make it a member of Archive.
3533 (Lib_group): New.
3534 (Add_lib_group_symbols): New.
3535 * archive.h: Include options.h.
3536 (Archive_member): Moved from Archive.
3537 (Should_include): Moved from archive.cc.
3538 (Lib_group): New.
3539 (Add_lib_group_symbols): New.
3540 * dynobj.cc (do_should_include_member): New.
3541 * dynobj.h (do_should_include_member): New.
3542 * gold.cc (queue_initial_tasks): Update call to queue.
3543 * main.cc (main): Print lib group stats.
3544 * object.cc (do_should_include_member): New.
3545 * object.h: Include archive.h.
3546 (Object::should_include_member): New.
3547 (Object::do_should_include_member): New.
3548 (Sized_relobj::do_should_include_member): New.
3549 * options.cc (General_options::parse_start_lib): New.
3550 (General_options::parse_end_lib): New.
3551 (Input_arguments::add_file): Handle lib groups.
3552 (Input_arguments::start_group): Check we are not in a lib.
3553 (Input_arguments::start_lib): New.
3554 (Input_arguments::end_lib): New.
3555 * options.h (General_options): Add start_lib and end_lib.
3556 (Input_argument::lib_): New.
3557 (Input_argument::lib): New.
3558 (Input_argument::is_lib): New.
3559 (Input_file_lib): New.
3560 (Input_arguments::in_lib_): New.
3561 (Input_arguments::in_lib): New.
3562 (Input_arguments::start_lib): New.
3563 (Input_arguments::end_lib_): New.
3564 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3565 in unused members as preempted.
3566 (Sized_pluginobj::do_should_include_member): New.
3567 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3568 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3569 return the blocker.
3570 (Read_symbols::do_whole_lib_group): New.
3571 (Read_symbols::do_lib_group): New.
3572 (Read_symbols::do_read_symbols): Handle lib groups.
3573 (Read_symbols::get_name): Handle lib groups.
3574 * readsyms.h (Read_symbols): Add an archive member pointer.
3575 (Read_symbols::do_whole_lib_group): New.
3576 (Read_symbols::do_lib_group): New.
3577 (Read_symbols::member_): New.
3578 * script.cc (read_input_script): Update call to queue_soon.
3579
d099120c
DK
35802010-03-19 Doug Kwan <dougkwan@google.com>
3581
3582 * arm.cc (Stub_table::Stub_table): Initialize new data members
3583 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3584 (Stub_table::add_reloc_stub): Assign stub offset and update
3585 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3586 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3587 New data members.
3588 (Stub_table::update_data_size_and_addralign): Use
3589 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3590 instead of going over all reloc stubs.
3591 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3592 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3593 Stringpool_template::offset_ to size of Stringpool_char.
3594 (Stringpool_template::new_key_offset): Remove code to initialize
3595 Stringpool_template::offset_.
3596 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3597 Stringpool_template::offset_ to zero.
3598
1aa37384
DK
35992010-03-15 Doug Kwan <dougkwan@google.com>
3600
3601 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3602 offset_.
3603 (Stringpool_template::new_key_offset): New method.
3604 (Stringpool_template::add_string): Assign offsets when adding new
3605 strings.
3606 (Stringpool_template::set_string_offsets): Do not set string offsets
3607 when not optimizing.
3608 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3609 member size_.
3610 (Chunked_vector::clear): Clear size_.
3611 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3612 (Chunked_vector::size): Return size_.
3613 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 3614 (Chunked_vector::size_): New data member.
1aa37384
DK
3615 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3616 (Stringpool_template::new_key_offset): New method declaration.
3617 (Stringpool_template::offset_): New data member.
3618
b672b057
RÁE
36192010-03-15 Rafael Espindola <espindola@google.com>
3620
3621 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3622 Add_symbols' constructor.
3623 * readsyms.h (Add_symbols): Remove the input_group member.
3624
b6848d3c
ILT
36252010-03-10 Ian Lance Taylor <iant@google.com>
3626
3627 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3628 target to ask whether a reference to a symbol requires a stack
3629 split.
3630 * target.h (Target::is_call_to_non_split): New function.
3631 (Target::do_is_call_to_non_split): Declare virtual function.
3632 * target.cc: Include "symtab.h".
3633 (Target::do_is_call_to_non_split): New function.
3634 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3635
a2a5469e
CC
36362010-03-10 Cary Coutant <ccoutant@google.com>
3637
3638 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3639 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3640 (File_read::open[2]): Add whole_file_view_ to list of views.
3641 (File_read::make_view): Remove test of whole_file_view_.
3642 (File_read::find_or_make_view): Create whole_file_view_ if
3643 necessary.
3644 (File_read::clear_views): Replace bool parameter with enum;
3645 adjust all callers. Don't delete views with permanent data;
3646 do delete cached views and views from archives if
3647 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3648 if clearing the corresponding view.
3649 * fileread.h (File_read::Clear_views_mode): New enum.
3650 (File_read::View::is_permanent_view): New method.
3651 (File_read::clear_views): Replace bool parameter
3652 with enum; adjust all callers.
3653 * options.h (General_options): Change keep_files_mapped option;
3654 add map_whole_files.
3655 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3656 releasing the file.
3657 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3658 the file.
3659
8861f32b
DM
36602010-03-10 David S. Miller <davem@davemloft.net>
3661
3662 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3663
d62d0f5f
ST
36642010-03-09 Sriraman Tallam <tmsriram@google.com>
3665
3666 * icf.cc (get_section_contents): Add '@' marker after processing the
3667 merge reloc.
3668
9177756d
DK
36692010-03-08 Doug Kwan <dougkwan@google.com>
3670
3671 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3672 due to a conversion warning.
3673 (Arm_relobj::update_output_local_symbol_count): Check for local
3674 symbol with unset output index.
3675
9e9e071b
ILT
36762010-03-05 Ian Lance Taylor <iant@google.com>
3677
3678 * options.h (class General_options): Add --spare-dynamic-tags.
3679 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3680 --spare-dynamic-tags.
3681
a81ee015
ILT
36822010-03-05 Ian Lance Taylor <iant@google.com>
3683
3684 * incremental.cc: Include "libiberty.h".
3685
44ec90b9
RO
36862010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3687
3688 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3689 function, is_info_ member.
3690 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3691 (Versions::Versions): Update caller.
3692 (Versions::define_base_version): Likewise.
3693 (Versions::add_def): Likewise.
3694
0897ed3b
ST
36952010-03-03 Sriraman Tallam <tmsriram@google.com>
3696
3697 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3698 (Scan::possible_function_pointer_reloc): New function.
3699 (Scan::local_reloc_may_be_function_pointer): Change to call
3700 possible_function_pointer_reloc.
3701 (Scan::global_reloc_may_be_function_pointer): Ditto.
3702 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3703 relocations in ".data.rel.ro._ZTV" section.
3704 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3705 * testsuite/icf_safe_so_test.cc: Ditto.
3706 * testsuite/icf_safe_test.cc: Ditto.
3707 * testsuite/icf_safe_test.sh: Ditto.
3708
d3bbad62
ILT
37092010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3710 Ian Lance Taylor <iant@google.com>
3711
3712 * target-reloc.h (relocate_section): Check the symbol table index
3713 for -1U before setting the local symbol index.
3714 (scan_relocatable_relocs): If copying the relocation, record that
3715 the local symbol is required.
3716 * object.h (Symbol_value::is_output_symtab_index_set): New
3717 function.
3718 (Symbol_value::may_be_discarded_from_output_symtab): New
3719 function.
3720 (Symbol_value::has_output_symtab_entry): New function.
3721 (Symbol_value::needs_output_symtab_entry): Remove.
3722 (Symbol_value::output_symtab_index): Make sure the symbol index is
3723 set.
3724 (Symbol_value::set_output_symtab_index): Make sure the symbol
3725 index is not set. Make sure the new index is valid.
3726 (Symbol_value::set_must_have_output_symtab_entry): New function.
3727 (Symbol_value::has_output_dynsym_entry): New function.
3728 (Symbol_value::set_output_dynsym_index): Make sure the new index
3729 is valid.
3730 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3731 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3732 local symbol if permitted.
3733 (Sized_relobj::do_finalize_local_symbols): Call
3734 is_output_symtab_index_set rather than needs_output_symtab_entry.
3735 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3736 rather than needs_output_symtab_entry. Call
3737 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3738 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3739 is_output_symtab_index_set rather than needs_output_symtab_entry.
3740 * testsuite/discard_locals_relocatable_test.c: New file.
3741 * testsuite/discard_locals_test.sh: Test -r.
3742 * testsuite/Makefile.am (check_DATA): Add
3743 discard_locals_relocatable_test1.syms,
3744 discard_local_relocatable_test2.syms.
3745 (MOSTLYCLEANFILES): Likewise. Also add
3746 discard_locals_relocatable_test1.lout and
3747 discard_locals_relocatable_test2.out.
3748 (discard_locals_relocatable_test1.syms): New target.
3749 (discard_locals_relocatable_test.o): New target.
3750 (discard_locals_relocatable_test1.out): New target.
3751 (discard_locals_relocatable_test2.syms): New target.
3752 (discard_locals_relocatable_test2.out): New target.
3753 (various): Add missing ../ld-new dependencies.
3754 * testsuite/Makefile.in: Rebuild.
3755
7e8ccf26
NC
37562010-03-03 Nick Clifton <nickc@redhat.com>
3757
3758 * po/fi.po: New Finnish translation.
3759
2a0ff005
DK
37602010-03-01 Doug Kwan <dougkwan@google.com>
3761
3762 * layout.cc (Layout::Layout): Force section types of .init_array*,
3763 .preinit_array* and .fini_array* sections.
3764 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3765 Fix check of return value of std::string::find.().
3766 (Output_section::Input_section_sort_compare::operator()): Remove
3767 comment about .init_array.
3768 (Output_section::Input_section_sort_init_fini_compare::operator()):
3769 New method.
3770 (Output_section::sort_attached_input_sections): Handle .init_array
3771 and .fini_array specially.
3772 * output.h (Output_section::Inut_section_sort_compare): Update
3773 comment.
3774 (Output_section::Input_section_sort_init_fini_compare): New struct.
3775
c3e4ae29
DK
37762010-02-26 Doug Kwan <dougkwan@google.com>
3777
3778 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3779 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3780 * testsuite/debug_msg.sh: Avoid matching source line number for
3781 use of global variable undef_int.
3782
2fd9ae7a
DK
37832010-02-26 Doug Kwan <dougkwan@google.com>
3784
3785 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3786 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3787 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3788 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3789 * options.cc (General_options::General_options): Initialize member
3790 fix_v4bx_.
3791 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3792 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3793 and rm_no_fix_v4bx.stdout
3794 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3795 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3796 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3797 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3798 and arm_no_fix_v4bx.
3799 * Makefile.in: Regenerate.
3800 * testsuite/arm_fix_v4bx.s: New file.
3801 * testsuite/arm_fix_v4bx.sh: Ditto.
3802
67ec7d0b
DK
38032010-02-24 Doug Kwan <dougkwan@google.com>
3804
3805 * arm.cc (Target_arm::got_section): Make the .got section the first
3806 non RELRO section in the data segment.
3807 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3808 suffixes of section names.
3809
10165461
DK
38102010-02-24 Doug Kwan <dougkwan@google.com>
3811
3812 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3813 flags and attributes merging if an input file is a binary file.
3814 * fileread.cc (Input_file::open): Record format of original file.
3815 * fileread.h (Input_file::Format): New enum type.
3816 (Input_file::Input_file): Initialize data member format_.
3817 (Input_file::format): New method definition.
3818 (Input_file::format_):: New data member.
3819
4a54abbb
DK
38202010-02-24 Doug Kwan <dougkwan@google.com>
3821
3822 * arm.cc (Arm_output_data_got): New class.
3823 (ARM_TCB_SIZE): New constant
3824 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3825 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3826 If user uses a script with a SECTIONS clause, issue only a warning
3827 for a misplaced EXIDX input section. Otherwise, issue an error.
3828 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3829 garbage collection.
3830 (Target_arm::got_mode_index_entry): Handle static linking.
3831 (Target_arm::Scan::local): Ditto.
3832 (Target_arm::Scan::global): Ditto.
3833 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3834 all incorrectly implemented relocations.
e1df38aa 3835 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
3836 Arm_output_section::fix_exidx_coverage.
3837 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3838 from ".ARM.exidx." and ".ARM.extab.".
3839
ca419a6f
ILT
38402010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3841
3842 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3843 section if it does not already exist.
3844 * attributes.cc (Attributes_section_data::Attributes_section_data):
3845 Don't crash if size is zero.
3846
135b9c78
ILT
38472010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3848 Ian Lance Taylor <iant@google.com>
3849
3850 * gold.cc (queue_middle_tasks): If no input files were opened,
3851 exit.
3852 * workqueue.h (Task_function::Task_function): Assert that there is
3853 a blocker.
3854
bb0bfe4f
DK
38552010-02-22 Doug Kwan <dougkwan@google.com>
3856
3857 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3858 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3859 types to avoid warnings due to different uint64_t implementations
3860 on different hosts.
3861
2a2b6d42
DK
38622010-02-21 Doug Kwan <dougkwan@google.com>
3863
3864 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3865 handling of the maximum backward branch offset.
3866 (Arm_relocate_functions::thumb_branch_common): Ditto.
3867 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3868 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 3869 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
3870 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3871 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3872 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3873 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3874 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3875 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3876 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3877 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3878 thumb2_bl_out_of_range.o): New rules.
3879 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3880 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3881 thumb2_bl_out_of_range
3882 * testsuite/Makefile.in: Regenerate.
3883 * testsuite/arm_bl_in_range.s: New file.
3884 * testsuite/arm_bl_out_of_range.s: Ditto.
3885 * testsuite/arm_branch_in_range.sh: Ditto.
3886 * testsuite/arm_branch_range.t: Ditto.
3887 * testsuite/thumb2_branch_range.t: Ditto.
3888 * testsuite/thumb_bl_in_range.s: Ditto.
3889 * testsuite/thumb_bl_out_of_range.s: Ditto.
3890 * testsuite/thumb_branch_range.t: Ditto.
3891
b487ad64
ST
38922010-02-20 Sriraman Tallam <tmsriram@google.com>
3893
3894 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3895 Add reloc offset information.
3896 * icf.cc (get_section_contents): Change iterators to point to the new
3897 vectors. Add reloc offset information to the contents.
3898 * icf.h (Icf::Sections_reachable_info): New typedef.
3899 (Icf::Sections_reachable_list): New typedef.
3900 (Icf::Offset_info): New typedef.
3901 (Icf::Reloc_info): New struct typedef.
3902 (Icf::Reloc_info_list): New typedef.
3903 (Icf::symbol_reloc_list): Delete method.
3904 (Icf::addend_reloc_list): Delete method.
3905 (Icf::section_reloc_list): Delete method.
3906 (Icf::reloc_info_list): New method.
3907 (Icf::reloc_info_list_): New member.
3908
f96accdf
DK
39092010-02-19 Doug Kwan <dougkwan@google.com>
3910
3911 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3912 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3913 * arm.cc (Arm_relocation_functions): New forward declaration.
3914 (Target_arm::Target_arm): Initialize new data members
3915 got_mod_index_offset_ and tls_base_symbol_defined_.
3916 (Target_arm::Relocate::relocate_tls): New method.
3917 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3918 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3919 New methods.
3920 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3921 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3922 (Target_arm::got_mod_index_offset_,
3923 Target_arm::tls_base_symbol_defined_): New data members.
3924 (Target_arm::Scan::local, Target::Scan::global,
3925 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3926 relocations.
3927
c8761b9a
DK
39282010-02-18 Doug Kwan <dougkwan@google.com>
3929
3930 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3931 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3932 text section as a parameter becuase some broken tools may not set
3933 the link in section header.
3934 (Target_arm::has_got_section): New method.
3935 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3936 without any mapping symbol as data only. Remove warning.
3937 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3938 link in its section header, try to discover the link by inspecting the
3939 REL31 relocation at the beginning of the section.
3940 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3941 in error message.
3942 (Target_arm::Scan::global): Treat any reference to the symbol
3943 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3944
21bb3914
ST
39452010-02-12 Sriraman Tallam <tmsriram@google.com>
3946
3947 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3948 (Scan::global_reloc_may_be_function_pointer): New function.
3949 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3950 (Scan::global_reloc_may_be_function_pointer): New function.
3951 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3952 (Scan::global_reloc_may_be_function_pointer): New function.
3953 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3954 (Scan::global_reloc_may_be_function_pointer): New function.
3955 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3956 (Scan::global_reloc_may_be_function_pointer): New function.
3957 (Scan::possible_function_pointer_reloc): New function.
3958 (Target_x86_64::can_check_for_function_pointers): New function.
3959 * gc.h (gc_process_relocs): Scan relocation types to determine if
3960 function pointers were taken for targets that support it.
3961 * icf.cc (Icf::find_identical_sections): Include functions for
3962 folding in safe ICF whose pointer is not taken.
3963 * icf.h (Secn_fptr_taken_set): New typedef.
3964 (fptr_section_id_): New member.
3965 (section_has_function_pointers): New function.
3966 (set_section_has_function_pointers): New function.
3967 (check_section_for_function_pointers): New function.
3968 * options.h: Fix comment for safe ICF option.
3969 * target.h (can_check_for_function_pointers): New function.
3970 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3971 Modify icf_safe_test for X86-64.
3972 * testsuite/Makefile.in: Regenerate.
3973 * testsuite/icf_safe_so_test.cc: New file.
3974 * testsuite/icf_safe_so_test.sh: New file.
3975 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3976 (main): Change to take pointer to function kept_func_3.
3977 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3978 folding is done correctly for X86-64.
3979
0da6fa6c
DM
39802010-02-12 David S. Miller <davem@davemloft.net>
3981
3982 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3983 is_symbolless parameter.
3984 (Output_reloc<SHT_REL>::is_symbolless): New.
3985 (Output_reloc<SHT_REL>::is_symbolless_): New.
3986 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3987 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3988 (Output_reloc<SHT_RELA>::is_symbolless): New.
3989 (Output_data_reloc::add_global): Handle is_symbolless.
3990 (Output_data_reloc::add_global_relative): Likewise.
3991 (Output_data_reloc::add_local): Likewise.
3992 (Output_data_reloc::add_local_relative): Likewise.
3993 (Output_data_reloc::add_symbolless_global_addend): New.
3994 (Output_data_reloc::add_symbolless_local_addend): New.
3995 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3996 is_symbolless.
3997 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3998 instead of ->is_relative_
3999 (Output_reloc::write): Likewise.
4000 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4001 (Output_reloc::write_rel): Simplify.
4002
4003 * sparc.cc (Target_sparc::Scan::local): Use
4004 ->add_symbolless_local_addend as needed.
4005 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4006 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4007 based upon relocation offset.
4008
e4782e83
DK
40092010-02-11 Doug Kwan <dougkwan@google.com>
4010
4011 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4012 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4013 beginning of function.
4014 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4015 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4016 parameter is_32bit in calls to should_apply_static_reloc.
4017 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4018 (check_DATA): Add arm_abs_global.stdout.
4019 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4020 arm_abs_global.stdout): New rules.
4021 (MOSTLLYCLEANFILES): Add arm_abs_global
4022 * Makefile.in: Regenerate.
4023 * testsuite/arm_abs_global.s: New file.
4024 * testsuite/arm_abs_global.sh: Ditto.
4025 * testsuite/arm_abs_lib.s: Ditto.
4026
93ceb764
ILT
40272010-02-11 Ian Lance Taylor <iant@google.com>
4028
4029 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4030 Read_relocs task.
4031 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4032 Allocate_commons_task first.
4033 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4034 task, rather than symtab_lock_.
4035 (Gc_process_relocs::~Gc_process_relocs): New function.
4036 (Gc_process_relocs::is_runnable): Check this_blocker_.
4037 (Gc_process_relocs::locks): Use next_blocker_ rather than
4038 blocker_.
4039 (Scan_relocs::~Scan_relocs): New function.
4040 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4041 symtab_lock_.
4042 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4043 next_blocker_.
4044 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4045 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4046 constructor accordingly.
4047 (class Gc_process_relocs): Likewise.
4048 (class Scan_relocs): Likewise.
4049 * common.h (class Allocate_commons_task): Remove symtab_lock_
4050 field, and corresponding constructor parameter.
4051 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4052 symtab_lock_.
4053 (Allocate_commons_task::locks): Likewise.
4054
114dfbe1
ILT
40552010-02-11 Ian Lance Taylor <iant@google.com>
4056
4057 * gold-threads.h (class Once): Define.
4058 (class Initialize_lock): Rewrite as child of Once.
4059 * gold-threads.cc (class Once_initialize): Define.
4060 (once_pointer_control): New static variable.
4061 (once_pointer, once_arg): New static variables.
4062 (c_run_once): New static function.
4063 (Once::Once, Once::run_once, Once::internal_run): New functions.
4064 (class Initialize_lock_once): Remove.
4065 (initialize_lock_control): Remove.
4066 (initialize_lock_pointer): Remove.
4067 (initialize_lock_once): Remove.
4068 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4069 (Initialize_lock::initialize): Rewrite.
4070 (Initialize_lock::do_run_once): New function.
4071 * archive.cc (Archive::interpret_header): Only clear name if it is
4072 not already empty.
4073 * fileread.cc: Include "gold-threads.h"
4074 (file_counts_lock): New static variable.
4075 (file_counts_initialize_lock): Likewise.
4076 (File_read::release): Only increment counts when using --stats.
4077 Use a lock around the increment.
4078 * parameters.cc (class Set_parameters_target_once): Define.
4079 (set_parameters_target_once): New static variable.
4080 (Parameters::Parameters): Move here from parameters.h.
4081 (Parameters::set_target): Rewrite.
4082 (Parameters::set_target_once): New function.
4083 (Parameters::clear_target): Move here and rewrite.
4084 * parameters.h (class Parameters): Update declarations. Add
4085 set_parameters_target_once_ field.
4086 (Parameters::Parameters): Move to parameters.cc.
4087 (Parameters::clear_target): Likewise.
4088 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4089 task.
4090 (Start_group::~Start_group): New function.
4091 (Start_group::is_runnable): New function.
4092 (Start_group::locks, Start_group::run): New functions.
4093 (Finish_group::run): Change saw_undefined to size_t.
4094 * readsyms.h (class Start_group): Define.
4095 (class Finish_group): Change saw_undefined_ field to size_t.
4096 (Finish_group::Finish_group): Remove saw_undefined and
4097 this_blocker parameters. Change all callers.
4098 (Finish_group::set_saw_undefined): New function.
4099 (Finish_group::set_blocker): New function.
4100 * symtab.h (class Symbol_table): Change saw_undefined to return
4101 size_t. Change saw_undefined_ field to size_t.
4102 * target-select.cc (Set_target_once::do_run_once): New function.
4103 (Target_selector::Target_selector): Initialize set_target_once_
4104 field. Don't initialize lock_ and initialize_lock_ fields.
4105 (Target_selector::instantiate_target): Rewrite.
4106 (Target_selector::set_target): New function.
4107 * target-select.h (class Set_target_once): Define.
4108 (class Target_selector): Update declarations. Make
4109 Set_target_once a friend. Remove lock_ and initialize_lock_
4110 fields. Add set_target_once_ field.
4111
fa17a3f4
ILT
41122010-02-10 Ian Lance Taylor <iant@google.com>
4113
4114 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4115 queueing any tasks.
4116 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4117 (queue_middle_tasks): Add all blockers before queueing any tasks.
4118 (queue_final_tasks): Likewise.
4119 * token.h (Task_token::add_blockers): New function.
4120 * object.h (Input_objects::number_of_relobjs): New function.
4121
c7177d31
ILT
41222010-02-10 Ian Lance Taylor <iant@google.com>
4123
5de0e392
ILT
4124 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4125 shared, not if not position independent.
4126 * x86_64.cc (Relocate::relocate_tls): Likewise.
4127 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4128 (tls_pie_pic_test): New target.
4129 * testsuite/Makefile.in: Rebuild.
4130
c7177d31
ILT
4131 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4132 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4133 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4134 * testsuite/Makefile.in: Rebuild.
4135
684b268a
DM
41362010-02-09 David S. Miller <davem@davemloft.net>
4137
4138 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4139 R_SPARC_RELATIVE using ->add_local_relative().
4140 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4141
612a8d3d
DM
4142 * output.h (Output_data_dynamic::add_section_size): New method
4143 that takes two Output_data objects.
4144 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4145 entry param. Handle it in initializers.
4146 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4147 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4148 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4149 arg.
4150 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4151 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4152 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4153 for dynrel_includes_plt.
4154 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4155 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4156 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4157 before .rela.plt
4158 (Target_sparc::do_finalize_sections): Update to pass true for
4159 dynrel_includes_plt.
4160 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4161 output before .rela.plt
4162 (Target_powerpc::do_finalize_sections): Update to pass true for
4163 dynrel_includes_plt when 32-bit.
4164
cb1be87e
DK
41652010-02-08 Doug Kwan <dougkwan@google.com>
4166
4167 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4168 method.
4169 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4170 Arm_relobj::scan_section_for_cortex_a8_stubs,
4171 Arm_relobj::do_relocation_section): Instead of calling
4172 Output_section::output_address, use faster
4173 Arm_relobj::simple_input_section_output_address.
4174
705b5121
DM
41752010-02-08 David S. Miller <davem@davemloft.net>
4176
4177 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4178 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4179 relocation helper function.
4180
024c4466
DM
4181 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4182 just like R_SPARC_GOT{10,13,22}.
4183 (Target_sparc::Scan::local): Likewise.
4184 (Target_sparc::Relocate:relocate): Likewise.
4185
9109c078
ILT
41862010-02-06 Ian Lance Taylor <iant@google.com>
4187
4188 * configure.ac: Rewrite targetobjs duplicate removal code to use
4189 only shell constructs.
4190 * configure: Rebuild.
4191
cf846138
DK
41922010-02-05 Doug Kwan <dougkwan@google.com>
4193
4194 PR 11247
4195 * arm.cc (Arm_relobj::section_is_scannable): New method.
4196 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4197 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4198
6cfaf60b
DK
41992010-02-04 Doug Kwan <dougkwan@google.com>
4200
4201 PR 11247
4202 * arm-reloc-property.cc (cstdio): Include.
4203 * configure.ac (targetobjs): Remove duplicates.
4204 * configure: Regenerate.
4205 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4206 big and little endian version for a given address size.
4207
5c57f1be
DK
42082010-02-03 Doug Kwan <dougkwan@google.com>
4209
4210 * arm-reloc-property.cc
4211 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4212 definition.
4213 * arm-reloc-property.h
4214 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4215 New method definition.
4216 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4217 declaration.
4218 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4219 overflow to N.
4220 (GOT_PREL): Change implemented to Y.
4221 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4222 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4223 (Arm_relocate_functions::movw_abs_nc): Remove method.
4224 (Arm_relocate_functions::movt_abs): Ditto.
4225 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4226 (Arm_relocate_functions::thm_movt_abs): Ditto.
4227 (Arm_relocate_functions::movw_rel_nc): Ditto.
4228 (Arm_relocate_functions::movw_rel): Ditto.
4229 (Arm_relocate_functions::movt_rel): Ditto.
4230 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4231 (Arm_relocate_functions:thm_movw_rel): Ditto.
4232 (Arm_relocate_functions:thm_movt_rel): Ditto.
4233 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4234 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4235 New method definitions.
4236 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4237 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4238 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4239 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4240 (Target_arm::Relocate::relocate): Check for non-static or
4241 unimplemented relocation code and exit early. Change calls to
4242 Target_arm::reloc_uses_thumb_bit and
4243 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4244 instead. Refactor code to handle similar relocations to increase
4245 code sharing. Remove check for unsupported relocation code in switch
4246 statement.
4247 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4248 relocation property table to find out size. Change error message to
4249 print out the name of a relocation code instead of the numeric value.
4250 (Target_arm::scan_reloc_for_stub): Use relocation property table
4251 instead of calling Target_arm::reloc_uses_thumb_bit().
4252
218c5831
DK
42532010-02-02 Doug Kwan <dougkwan@google.com>
4254
4255 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4256 types of relaxed input section.
4257
0d31c79d
DK
42582010-02-02 Doug Kwan <dougkwan@google.com>
4259
4260 * Makefile.am (HFILES): Add arm-reloc-property.h.
4261 (DEFFILES): New.
4262 (TARGETSOURCES): Add arm-reloc-property.cc
4263 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4264 (libgold_a_SOURCES): $(DEFFILES)
4265 * Makefile.in: Regenerate.
4266 * arm-reloc-property.cc: New file.
4267 * arm-reloc-property.h: New file.
4268 * arm-reloc.def: New file.
4269 * arm.cc: Update comments.
4270 (arm-reloc-property.h): New included header.
4271 (arm_reloc_property_table): New global variable.
4272 (Target_arm::do_select_as_default_target): New method definition.
4273 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4274 arm-reloc-property to targ_extra_obj.
4275 * parameters.cc (set_parameters_target): Call
4276 Target::select_as_default_target().
4277 * target.h (Target::select_as_default_target): New method definition.
4278 (Target::do_select_as_default_target): Same.
4279
546c7457
DK
42802010-02-01 Doug Kwan <dougkwan@google.com>
4281
4282 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4283 first_output_text_section_.
4284 (Arm_exidx_fixup::first_output_text_section): New method definition.
4285 (Arm_exidx_fixup::first_output_text_section_): New data member.
4286 (Arm_exidx_fixup::process_exidx_section): Record the first text
4287 output section seen.
4288 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4289 and entsize in output section header.
4290
11b861d5
DK
42912010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4292
4293 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4294 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4295 (Arm_relocate_functions::thm_alu11): New Method.
4296 (Arm_relocate_functions::thm_pc8): New Method.
4297 (Arm_relocate_functions::thm_pc12): New Method.
4298 (Target_arm::Scan::local): Handle the relocations.
4299 (Target_arm::Scan::global): Likewise.
4300 (Target_arm::Relocate::relocate): Likewise.
4301 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4302
c9a2c125
DK
43032010-01-29 Doug Kwan <dougkwan@google.com>
4304
4305 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4306 of relocation types as ld.
4307
1521477a
DK
43082010-01-29 Doug Kwan <dougkwan@google.com>
4309
4310 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4311 to public.
4312 (Arm_relocate_functions::thumb_branch_common): Ditto.
4313 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4314 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4315 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4316 Arm_relocate_functions::jump24): Remove.
4317 (Target_arm::Relocate::relocate): Adjust code to call
4318 Arm_relocation_functions::arm_branch_common and
4319 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 4320 wrappers. Merge switch-cases together to reduce source code size.
1521477a 4321
e7eca48c
DK
43222010-01-29 Doug Kwan <dougkwan@google.com>
4323
4324 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4325 output_local_symbol_count_needs_update_.
4326 (Arm_relobj::output_local_symbol_count_needs_update,
4327 Arm_relobj::set_output_local_symbol_count_needs_update,
4328 Arm_relobj::update_output_local_symbol_count): New methods.
4329 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4330 member.
4331 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4332 of pointed function as in a R_ARM_PREL31 relocation.
4333 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4334 for output local symbol count updating.
4335 (Target_arm::do_relax): Update output local symbol counts in objects
4336 if necessary.
4337 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4338
02961d7e
ILT
43392010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4340
4341 * arm.cc: Added support for the ARM relocations:
4342 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4343 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4344 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4345 movw_prel_nc).
4346 (Arm_relocate_functions::movw_rel): New method.
4347 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4348 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4349 thm_movw_prel_nc).
4350 (Arm_relocate_functions::thm_movw_rel): New method.
4351 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4352 thm_movt_prel).
4353 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4354 relocations.
4355 (Target_arm::Scan::global): Likewise.
4356 (Target_arm::Relocate::relocate): Likewise.
4357 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4358 Likewise.
4359
b10d2873
ILT
43602010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4361
4362 * arm.cc: Added support for ARM group relocations.
4363 (Target_arm::reloc_needs_sym_origin): New method.
4364 (Arm_relocate_functions::calc_grp_kn): New method.
4365 (Arm_relocate_functions::calc_grp_residual): New method.
4366 (Arm_relocate_functions::calc_grp_gn): New method.
4367 (Arm_relocate_functions::arm_grp_alu): New Method.
4368 (Arm_relocate_functions::arm_grp_ldr): New Method.
4369 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4370 (Arm_relocate_functions::arm_grp_ldc): New Method.
4371 (Target_arm::Scan::local): Handle the ARM group relocations.
4372 (Target_arm::Scan::global): Likewise.
4373 (Target_arm::Relocate::relocate): Likewise.
4374 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4375 Likewise.
4376
2b328d4e
DK
43772010-01-26 Doug Kwan <dougkwan@google.com>
4378
4379 * arm.cc (set): Include.
4380 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4381 pointer type.
4382 (Arm_output_section::Text_section_list): New type.
4383 (Arm_output_section::append_text_sections_to_list): New method.
4384 (Arm_output_section::fix_exidx_coverage): Ditto.
4385 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4386 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4387 Relobj::set_section_offset() instead of
4388 Sized_relobj::invalidate_section_offset().
4389 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4390 parameter for section headers. Ignore relocation sections for
4391 unallocated sections and EXIDX sections.
4392 (Target_arm::fix_exidx_coverage): New method.
4393 (Target_arm::output_section_address_less_than): New type.
4394 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4395 linked text section instead of the EXIDX section.
4396 (Arm_output_section::create_stub_group): Add an assertion to check
4397 that this is not an EXIDX output section.
4398 (Arm_output_section::append_text_sections_to_list): New method.
4399 (Arm_output_section::fix_exidx_coverage): Ditto.
4400 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4401 Arm_relobj::section_needs_reloc_stub_scanning.
4402 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4403 first pass.
4404 (Target_arm::fix_exidx_coverage): New method.
4405 * object.h (Relobj::set_output_section): New method.
4406 (Sized_relobj::invalidate_section_offset): Remove method.
4407 (Sized_relobj::do_invalidate_section_offset): Remove method.
4408 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4409
c7f3c371
DK
44102010-01-25 Doug Kwan <dougkwan@google.com>
4411
4412 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4413 Fix warning due to signed and unsigned comparison on a 32-bit host.
4414
8923b24c
DK
44152010-01-22 Doug Kwan <dougkwan@google.com>
4416
4417 * arm.cc (Target_arm::do_relax): Record an output section for section
4418 offset adjustment it contains any stub table that has changed.
4419 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4420 offsets in an output section if necessary.
4421 * output.cc (Output_section::Output_section): Initialize
4422 section_offsets_need_adjustments_.
4423 (Output_section::add_input_section_for_script): Renamed to
4424 Output_section::add_simple_input_section.
4425 (Output_section::save_states): Add a comment.
4426 (Output_section::discard_states): New method defintion.
4427 (Output_section::adjust_section_offsets): Same.
4428 * output.h (Output_section::add_input_section_for_script): Renamed to
4429 Output_section::add_simple_input_section.
4430 (Output_section::discard_states): New method declaration.
4431 (Output_section::adjust_section_offsets): Same.
4432 (Output_section::section_offsets_need_adjustment,
4433 Output_section::set_section_offsets_need_adjustment): New method
4434 definitions.
4435 (Output_section::section_offsets_need_adjustment_): New data member.
4436 * script-sections.cc
4437 (Output_section_element_input::set_section_address): Adjust code for
4438 renaming of Output_section::add_input_section_for_script.
4439 (Orphan_output_section::set_section_address): Same.
4440
9b2fd367
DK
44412010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4442
4443 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4444 Fix_v4bx enum values .
4445 * gold/options.h (General_options): New option definitions.
4446 (General_options::fix_v4bx): New method.
4447 (General_options::Fix_v4bx): New enum.
4448 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4449 (General_options::parse_fix_v4bx_interworking): New method.
4450
80d0d023
DK
44512010-01-22 Doug Kwan <dougkwan@google.com>
4452
4453 * arm.cc (Arm_exidx_fixup): New class.
4454
af2cdeae
DK
44552010-01-21 Doug Kwan <dougkwan@google.com>
4456
4457 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4458 classes.
4459 (Arm_exidx_section_offset_map): New type.
4460
993d07c1
DK
44612010-01-21 Doug Kwan <dougkwan@google.com>
4462
4463 * arm.cc (Arm_exidx_input_section): New class.
4464 (Arm_relobj::exidx_input_section_by_link,
4465 Arm_relobj::exidx_input_section_by_shndx,
4466 Arm_relobj::make_exidx_input_section): New methods.
4467 (read_arm_attributes_section): Remove.
4468 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4469 information about them.
4470 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4471 to here.
4472
5ac169d4
DK
44732010-01-20 Doug Kwan <dougkwan@google.com>
4474
4475 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4476 Input_section_specifier to Section_id.
4477 (Target_arm::new_arm_input_section: Adjust code for change of key
4478 type.
4479 (Target_arm::find_arm_input_section): Ditto.
4480 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4481 (Section_id): Remove.
4482 (Garbage_collection::Section_id_hash): Remove.
4483 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4484 (Section_id): Remove.
4485 (Icf::Section_id_hash): Remove.
4486 * object.h (Section_id, Const_section_id, Section_id_hash,
4487 Const_section_id_hash): New type definitions.
4488 * output.cc (Output_section::add_relaxed_input_section): Change to
4489 use Const_section_id instead of Input_section_specifier as key type.
4490 (Output_section::add_merge_input_section): Ditto.
4491 (Output_section::build_relaxation_map): Change to use Section_id
4492 instead of Input_section_specifier as key type.
4493 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4494 Ditto.
4495 (Output_section::convert_input_sections_to_relaxed_sections): Change
4496 to use Const_section_id instead of Input_section_specifier as key type.
4497 (Output_section::find_merge_section): Ditto.
4498 (Output_section::find_relaxed_input_section): Ditto.
4499 * output.h (Input_section_specifier): Remove class.
4500 (Output_section::Output_section_data_by_input_section_map): Change
4501 key type to Const_section_id.
4502 (Output_section::Output_relaxed_input_section_by_input_section_map):
4503 Ditto.
4504 (Output_section::Relaxation_map): Change key type to Section_id.
4505
a2162063
ILT
45062010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4507
4508 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4509 (class Arm_v4bx_stub): New class.
4510 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4511 (Stub_factory::make_arm_v4bx_stub): New method.
4512 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4513 (Stub_table::empty): Handle v4bx stubs.
4514 (Stub_table::add_arm_v4bx_stub): New method.
4515 (Stub_table::find_arm_v4bx_stub): New method.
4516 (Arm_relocate_functions::v4bx): New method.
4517 (Target_arm::fix_v4bx): New method.
4518 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4519 (Stub_table::relocate_stubs): Likewise.
4520 (Stub_table::do_write): Likewise.
4521 (Stub_table::update_data_size_and_addralign): Likewise.
4522 (Stub_table::finalize_stubs): Likewise.
4523 (Target_arm::Scan::local): Likewise.
4524 (Target_arm::Scan::global): Likewise.
4525 (Target_arm::do_finalize_sections): Likewise.
4526 (Target_arm::Relocate::relocate): Likewise.
4527 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4528 Likewise.
4529 (Target_arm::scan_reloc_for_stub): Likewise.
4530 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4531
5696ab0b
ILT
45322010-01-19 Ian Lance Taylor <iant@google.com>
4533
4534 * output.cc (Output_section_headers::do_sized_write): Write large
4535 segment count to sh_info field.
4536 (Output_file_header::do_sized_write): For large segment count,
4537 write PN_XNUM to e_phnum field.
4538
800d0f56
ILT
45392010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4540
4541 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4542 (Arm_relocate_functions::thm_jump8): New function.
4543 (Arm_relocate_functions::thm_jump11): New function.
4544 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4545 R_ARM_THM_JUMP11.
4546 (Target_arm::Scan::global): Likewise.
4547 (Target_arm::Relocate::relocate): Likewise.
4548 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4549 Likewise.
4550
41263c05
DK
45512010-01-14 Doug Kwan <dougkwan@google.com>
4552
4553 * arm.cc (map, utility): Include headers.
4554 (Target_arm::apply_cortex_a8_workaround): New method.
4555 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4556 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4557 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4558 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4559 the --[no-]fix-cortex-a8 command line options.
4560 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4561 (Target_arm::relocate_stub): Use addend in instruction template.
4562 * options.h (DEFINE_bool): Set the user-set flag.
4563 (General_options): Add --[no-]-fix-cortex options.
4564 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 4565 : Update fast look-up map after conversion.
41263c05 4566
459e9b03
ST
45672010-01-14 Sriraman Tallam <tmsriram@google.com>
4568
4569 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4570 in the first pass of do_layout.
4571
b521dfe4
DK
45722010-01-13 Doug Kwan <dougkwan@google.com>
4573
4574 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4575 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4576 apparent compiler problem of not folding static constant integral
4577 data members of elfcpp::Elf_sizes<32>.
4578
44272192
DK
45792010-01-13 Doug Kwan <dougkwan@google.com>
4580
4581 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4582 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4583 Arm_relobj::scan_section_for_cortex_a8_erratum,
4584 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4585 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4586 sections to scan for relocation stubs into a new method
4587 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4588 relocation and Cortex-A8 stub scanning.
4589 (Target_arm::do_relax): Force stubs to be after stubbed sections
4590 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 4591 the beginning of a new relaxation pass. Update a comment.
44272192
DK
4592 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4593
44b71ece
ILT
45942010-01-12 Ian Lance Taylor <iant@google.com>
4595
4596 * target-reloc.h (visibility_error): New inline function.
4597 (relocate_section): Call visibility_error.
4598 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4599 (MOSTLYCLEANFILES): Likewise.
4600 (protected_4_pic.o, protected_3.err): New targets.
4601 * testsuite/protected_4.cc: New file.
4602
a120bc7f
DK
46032010-01-12 Doug Kwan <dougkwan@google.com>
4604
4605 * arm.cc (Cortex_a8_reloc): New class.
4606 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4607 and cortex_a8_relocs_info_.
4608 (Target_arm::fix_cortex_a8): New method definition.
4609 (Target_arm::Cortex_a8_relocs_info): New type.
4610 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4611 New data member declarations.
4612 (Target_arm::scan_reloc_for_stub): Record information about
4613 relocations for THUMB branches that might be exempted from the
4614 Cortex-A8 workaround.
4615 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4616 at the beginning of a relaxation pass.
4617
20138696
DK
46182010-01-12 Doug Kwan <dougkwan@google.com>
4619
4620 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4621 (Arm_relobj::Mapping_symbol_position,
4622 Arm_reloj::Mapping_symbol_position_less,
4623 Arm_relobj::Mapping_symbols_info): New types.
4624 (Target_arm::is_mapping_symbol_name): New method definition.
4625 (Arm_relobj::do_count_local_symbols): Save information about mapping
4626 symbols.
4627
089d69dc
DK
46282010-01-11 Doug Kwan <dougkwan@google.com>
4629
4630 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4631 Arm_relocate_functions::thumb32_branch_upper,
4632 Arm_relocate_functions::thumb32_branch_lower,
4633 Arm_relocate_functions::thumb32_cond_branch_offset,
4634 Arm_relocate_functions::thumb32_cond_branch_upper,
4635 Arm_relocate_functions::thumb32_cond_branch_lower,
4636 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4637 branch offset encoding.
4638 (Arm_relocate_functions::thumb_branch_common): Use new branch
4639 offset encoding methods to avoid code duplication.
4640 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4641 (Stub_addend_reader::operator()): Use new branch encoding method
4642 to avoid code duplication.
4643
99e5bff2
DK
46442010-01-11 Doug Kwan <dougkwan@google.com>
4645
4646 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4647 (Target_arm::do_finalize_sections): Define special EXIDX section
4648 symbols only if referenced.
4649 * gc.h (Garbage_collection::add_reference): New method.
4650 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4651 code duplication.
4652
98e090bd
ILT
46532010-01-11 Ian Lance Taylor <iant@google.com>
4654
d0a91bd8
ILT
4655 * script.cc (Version_script_info::build_expression_list_lookup):
4656 Change complaing about duplicate wildcard match from error to
4657 warning.
4658
98e090bd
ILT
4659 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4660 of 2009-12-30.
4661 (Version_script_info::Version_script_info): Initialize globs_,
4662 default_version_, default_is_global_, and exact_. Don't
4663 initialize globals_ or locals_.
4664 (Version_script_info::build_lookup_tables): Build local symbols
4665 first.
4666 (Version_script_info::unquote): New function.
4667 (Version_script_info::add_exact_match): New function.
4668 (Version_script_info::build_expression_list_lookup): Remove lookup
4669 parameter. Add is_global parameter. Change all callers. Handle
4670 wildcard pattern specially. Unquote pattern. Call
4671 add_exact_match.
4672 (Version_script_info::get_name_to_match): New function.
4673 (Version_script_info::get_symbol_version): New function.
4674 (Version_script_info::get_symbol_version_helper): Remove.
4675 (Version_script_info::check_unmatched_names): Call unquote.
4676 * script.h (class Version_script_info): Change get_symbol_version
4677 to be non-inline and add is_global parameter; change all callers.
4678 Rewrite symbol_is_local. Update declarations. Define struct
4679 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4680 Remove globals_ and locals_ members. Add exact_, globs_,
4681 default_version_, is_global_.
4682 (Version_script_info::Glob): Remove pattern, add expression and
4683 is_global. Update constructor. Change all callers.
4684 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4685 default version.
4686 (Versions::symbol_section_contents): If a symbol is undefined, or
4687 defined in a dynamic object, set the version index to
4688 VER_NDX_LOCAL.
4689 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4690 symbol_is_local.
4691 (Symbol_table::add_from_pluginobj): Likewise.
4692 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4693
d56962d3
DK
46942010-01-11 Doug Kwan <dougkwan@google.com>
4695
4696 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4697 (incremental_dump_LDADD): Add linking option for libintl.
4698 * Makefile.in: Regenerate.
4699
94e6ee91
L
47002010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4701
4702 PR gold/11144
4703 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4704 instead of -Ds.
4705 * testsuite/Makefile.in: Regenerated.
4706
e96c574b
DK
47072010-01-10 Doug Kwan <dougkwan@google.com>
4708
4709 * options.h (DEFINE_var): Use parentheses around argument varname__
4710 in macro body to avoid any unintended subsequent substitutions.
4711
7198066b
ILT
47122010-01-10 Ian Lance Taylor <iant@google.com>
4713
ba4d53bf
ILT
4714 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4715 candidates before doing symbol resolution.
4716
7198066b
ILT
4717 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4718 ODR candidates if only one is weak.
4719
a2beed37
ILT
47202010-01-08 Ian Lance Taylor <iant@google.com>
4721
4722 * script.cc (Version_script_info::build_expression_list_lookup):
4723 Don't warn about ambiguous version, just record the ambiguity.
4724 (Version_script_info::get_symbol_version_helper): Give error if
4725 version is ambiguous.
4726
2fb7225c
DK
47272010-01-08 Doug Kwan <dougkwan@google.com>
4728
4729 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4730 prev_data_size_ and prev_addralign_. Remove initializer for
4731 deleted data member has_been_changed_.
4732 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4733 to determine if the table is empty.
4734 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4735 Remove.
4736 (Stub_table::add_reloc_stub): Define method in class definition
4737 instead of just declaring it there.
4738 (Stub_table::add_cortex_a8_stub): New method definition.
4739 (Stub_table::update_data_size_and_addralign): Ditto.
4740 (Stub_table::finalize_stubs): Ditto.
4741 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4742 (Stub_table::do_addralign_): Return address alignment in the
4743 (Stub_table::do_reset_address_and_file_offset): Define method in
4744 class definition instead of declaring it there. Set current data
4745 size to be the data size of the previous pass.
4746 (Stub_table::set_final_data_size): Use current data size as the
4747 final data size.
4748 (Stub_table::relocate_stub): Change parameter type of stub from
4749 Reloc_stub pointer to Stub pointer.
4750 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4751 (Stub_table::Cortex_a8_stub_list): New typedef.
4752 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4753 Stub_table::prev_addralign_): New data member.
4754 (Arm_relobj::Arm_relobj): Initialize data member
4755 section_has_cortex_a8_workaround_.
4756 (Arm_relobj::section_has_cortex_a8_workaround,
4757 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4758 definitions.
4759 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4760 declarations.
4761 (Target_arm::relocate_stub): Change parameter type of stub from
4762 Reloc_stub pointer to Stub pointer.
4763 (Insn_template::size, Insn_template::alignment): Handle
4764 THUMB16_SPECIAL_TYPE.
4765 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4766 Stub_table::update_data_size_and_addralign,
4767 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4768 definitions.
4769 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4770 (Stub_table::do_write): Ditto.
4771 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4772
880cd20d
ILT
47732010-01-08 Ian Lance Taylor <iant@google.com>
4774
4775 PR 11108
4776 * symtab.h (class Symbol): Remove fields is_target_special_ and
4777 has_plt_offset_. Add field is_defined_in_discarded_section_.
4778 (Symbol::is_defined_in_discarded_section): New function.
4779 (Symbol::set_is_defined_in_discarded_section): New function.
4780 (Symbol::has_plt_offset): Rewrite.
4781 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4782 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4783 Don't initialize is_target_special_ or has_plt_offset_.
4784 Initialize is_defined_in_discarded_section_.
4785 (Symbol_table::add_from_relobj): If appropriate, set
4786 is_defined_in_discarded_section.
4787 * resolve.cc (Symbol::override_base_with_special): Don't test
4788 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4789 * target-reloc.h (relocate_section): Do special handling for
4790 symbols defined in discarded sections for global symbols as well
4791 as local symbols.
4792
2703e3eb
ILT
47932010-01-08 Ian Lance Taylor <iant@google.com>
4794
4795 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4796 the SHT_SYMTAB case.
4797
339d40a3
ILT
47982010-01-08 Ian Lance Taylor <iant@google.com>
4799
4800 * object.cc (Sized_relobj::do_layout): Don't get confused if
4801 layout_eh_frame returns NULL.
4802
abecea76
ILT
48032010-01-08 Ian Lance Taylor <iant@google.com>
4804
4805 PR 11084
4806 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4807 dynamic symbol table, use the normal symbol table.
4808 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4809 symbol table.
4810
6b7dd3f3
ILT
48112010-01-08 Ian Lance Taylor <iant@google.com>
4812
4813 PR 11072
4814 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4815 sections.
4816
36c50e63
L
48172010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4818
4819 * version.cc (print_version): Change to "Copyright 2010".
4820
e291e7b9
ILT
48212010-01-08 Ian Lance Taylor <iant@google.com>
4822
4823 PR 10287
4824 PR 11063
4825 * i386.cc (class Target_i386): Change return type of plt_section
4826 to be non-const.
4827 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4828 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4829 tls_desc_rel_ field.
4830 (Output_data_plt_i386::rel_tls_desc): New function.
4831 (Target_i386::rel_tls_desc_section): New function.
4832 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4833 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4834 R_386_TLS_DESC reloc in rel_tls_desc_section.
4835 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4836 Define struct Tlsdesc_info.
4837 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4838 (Target_x86_64::do_reloc_symbol_index): New function.
4839 (Target_x86_64::add_tlsdesc_info): New function.
4840 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4841 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4842 tlsdesc_rel_ field.
4843 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4844 all callers.
4845 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4846 (Target_x86_64::rela_tlsdesc_section): New function.
4847 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4848 handling.
4849 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4850 (Target_x86_64::do_reloc_addend): New function.
4851 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4852 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4853 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4854 (Output_reloc::type): New function.
4855 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4856 (Output_reloc::is_target_specific): New function.
4857 (Output_reloc::target_arg): New function.
4858 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4859 absolute relocs and target specific relocs.
4860 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4861 add_target_specific.
4862 (class Output_data_reloc) [SHT_RELA]: Likewise.
4863 * output.cc (Output_reloc::Output_reloc): Add four new versions
4864 for absolute relocs and target specific relocs.
4865 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4866 (Output_reloc::get_symbol_index): Likewise.
4867 (Output_reloc::local_section_offset): Check that local_sym_index_
4868 is not TARGET_CODE or 0.
4869 (Output_reloc::symbol_value): Likewise.
4870 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4871 reloc.
4872 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4873 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4874 functions.
4875 * layout.cc (add_target_dynamic_tags): Use output section for
4876 DT_PLTRELSZ and DT_JMPREL.
4877
3a44184e
ILT
48782010-01-07 Ian Lance Taylor <iant@google.com>
4879
4880 PR 11061
4881 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4882 function.
4883 (class Output_data_reloc_generic): Define.
4884 (class Output_data_reloc_base): Change base class to
4885 Output_data_reloc_generic. Change add() method to call
4886 bump_relative_reloc_count for a relative reloc. Remove
4887 sort_relocs_ field.
4888 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4889 to sort_relocs().
4890 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4891 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4892 appropriate.
4893 * layout.h (class Layout): Update declaration.
4894
ea715a34
ILT
48952010-01-07 Ian Lance Taylor <iant@google.com>
4896
4897 * output.h (class Output_data): Add const version of
4898 output_section and do_output_section.
4899 (class Output_section_data): Add const version of
4900 do_output_section.
4901 (class Output_section): Likewise.
4902 * layout.cc (Layout::add_target_dynamic_tags): New function.
4903 * layout.h (class Layout): Update declarations.
4904 * arm.cc (Target_arm::do_finalize_sections): Use
4905 add_target_dynamic_tags.
4906 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4907 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4908 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4909 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4910
659948a4
ILT
49112010-01-07 Ian Lance Taylor <iant@google.com>
4912
4913 PR 11042
4914 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4915 object as needed.
4916
9d3b86f6
ILT
49172010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4918 Ian Lance Taylor <iant@google.com>
4919
4920 PR 11019
4921 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4922 Xindex::read_symtab_xindex.
4923
bb0d3eb0
DK
49242010-01-07 Doug Kwan <dougkwan@google.com>
4925
4926 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4927 (Insn_template::thumb16_bcond_insn): New method declaration.
4928 (Insn_template): Fix spelling.
4929 (Stub::thumb16_special): New method declaration.
4930 (Stub::do_write): Define virtual method which was previously pure
4931 virtual.
4932 (Stub::do_thumb16_special): New method declaration.
4933 (Stub::do_fixed_endian_write): New template member.
4934 (Reloc_stub::do_write): Remove.
4935 (Reloc_stub::do_fixed_endian_write): Remove.
4936 (Cortex_a8_stub): New class definition.
4937 (Stub_factory::make_cortex_a8_stub): New method definition.
4938 (Stub_factory::Stub_factory): Add missing static storage class
4939 qualifier for elf32_arm_stub_a8_veneer_blx.
4940
ffeef7df
ILT
49412010-01-07 Ian Lance Taylor <iant@google.com>
4942
dc3f80fe
ILT
4943 PR 10980
4944 * options.h (class General_options): Add --warn-unresolved-symbols
4945 and --error-unresolved-symbols.
4946 * errors.cc (Errors::undefined_symbol): Implement
4947 --warn-unresolved-symbols.
4948
ffeef7df
ILT
4949 * options.h (class General_options): Add -z text and -z textoff.
4950 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4951
f1ec9ded
ST
49522010-01-06 Sriraman Tallam <tmsriram@google.com>
4953
4954 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4955 (Garbage_collection::cident_sections): New function.
4956 (Garbage_collection::add_cident_section): New function.
4957 (Garbage_collection::cident_sections_): New member.
4958 (gc_process_relocs): Add references to sections whose names are C
4959 identifiers.
4960 * gold.h (cident_section_start_prefix): New constant.
4961 (cident_section_stop_prefix): New constant.
4962 (is_cident): New function.
4963 * layout.cc (Layout::define_section_symbols): Replace string constants
4964 with the newly defined constants.
4965 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4966 C identifiers.
4967 * testsuite/Makefile.am: Add gc_orphan_section_test.
4968 * testsuite/Makefile.in: Regenerate.
4969 * testsuite/gc_orphan_section_test.cc: New file.
4970 * testsuite/gc_orphan_section_test.sh: New file.
4971
6eda8c29
ILT
49722010-01-06 Ian Lance Taylor <iant@google.com>
4973
b9674e17
ILT
4974 PR 10980
4975 * options.h (class General_options): Add --warn-shared-textrel.
4976 * layout.cc (Layout::finish_dynamic_section): Implement
4977 --warn-shared-textrel.
4978
6eda8c29
ILT
4979 PR 10980
4980 * options.h (class General_options): Add --warn-multiple-gp.
4981
32dcd44e
ILT
49822010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4983
4984 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4985 $(THREADSLIB) and $(LIBDL).
4986 * Makefile.in: Rebuild.
4987
a192ba05
ILT
49882010-01-06 Ian Lance Taylor <iant@google.com>
4989
4990 PR 10980
4991 * options.cc (General_options::parse_section_start): New function.
4992 (General_options::section_start): New function.
4993 (General_options::General_options): Initialize all members.
4994 * options.h: Include <map>
4995 (class General_options): Add --section-start. Add section_starts_
4996 member.
4997 * layout.cc (Layout::attach_allocated_section_to_segment): If
4998 --section-start was used, set the address of the segment. Remove
4999 local sort_sections.
5000 (Layout::relaxation_loop_body): If the address of the load segment
5001 has been set by --section-start, don't use it.
5002 * output.h (Output_segment::update_flags_for_output_section): New
5003 function.
5004 * output.cc (Output_segment::add_output_section): Call
5005 update_flags_for_output_section.
5006
dde3f402
ILT
50072010-01-05 Ian Lance Taylor <iant@google.com>
5008
62dfdd4d
ILT
5009 PR 10980
5010 * options.h (class General_options): Add --undefined-version.
5011 * script.cc (struct Version_expression): Add was_matched_by_symbol
5012 field.
5013 (Version_script_info::matched_symbol): New function.
5014 (Version_script_info::get_symbol_version_helper): Call
5015 matched_symbol.
5016 (Version_script_info::check_unmatched_names): New function.
5017 * script.h (class Version_script_info): Update declarations.
5018 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5019
9c4ae156
ILT
5020 * options.h (class General_options): Use DEFINE_bool_alias for
5021 allow_multiple_definition.
5022 * resolve.cc (Symbol_table::should_override): Don't test
5023 allow_multiple_definition.
5024
dde3f402
ILT
5025 PR 10980
5026 * options.h (class General_options): Add --cref.
5027 * main.cc (main): Print cref table if --cref. Don't close mapfile
5028 until after printing cref table.
5029 * cref.cc: Include "symtab.h".
5030 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5031 (Cref_table_compare::operator()): New function.
5032 (Cref_inputs::gather_cref): New function.
5033 (filecol): New static const.
5034 (Cref_inputs::print_cref): New function.
5035 (Cref::print_cref): New function.
5036 * cref.h: Include <cstdio>.
5037 (class Cref): Update declarations.
5038 * mapfile.h (Mapfile::file): New function.
5039 * object.h (class Object): Define Symbols. Declare virtual
5040 do_get_global_symbols.
5041 (Object::get_global_symbols): New function.
5042 * object.cc (Input_objects::add_object): Pass object to cref_ if
5043 --cref.
5044 (Input_objects::archive_start): Likewise.
5045 (Input_objects::archive_stop): Likewise.
5046 (Input_objects::print_cref): New function.
5047 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5048 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5049 --cref.
5050 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5051 function.
5052 * plugin.h (class Sized_pluginobj): Update declarations.
5053
8781f709
ILT
50542010-01-05 Ian Lance Taylor <iant@google.com>
5055
5056 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5057 to is_default_version. Rename insdef to insdefault.
5058 (Symbol_table::add_from_relobj): Rename def to is_default_version
5059 and local to is_forced_local.
5060 (Symbol_table::add_from_pluginobj): Likewise.
5061 (Symbol_table::add_from_dynobj): Likewise.
5062 (Symbol_table::define_special_symbol): Rename insdef to
5063 insdefault.
5064
fe35d28d
ILT
50652010-01-04 Ian Lance Taylor <iant@google.com>
5066
30bc8c46
ILT
5067 PR 10980
5068 * options.h (class General_options): Add
5069 --allow-multiple-definition and -z muldefs.
5070 * resolve.cc (Symbol_table::should_override): Don't warn about a
5071 multiple symbol definition if --allow-multiple-definition or -z
5072 muldefs.
5073
7eaea549
ILT
5074 PR 10980
5075 * options.h (class General_options): Add --add-needed and
5076 --copy-dt-needed-entries. Tweak --as-needed help entry.
5077 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5078 error if --copy-dt-needed-entries aka --add-needed is used and
5079 would cause a change in behaviour.
5080
fe35d28d
ILT
5081 PR 10980
5082 * options.h (class General_options): Add -G as a short version of
5083 --shared. Add no-op options -assert, -g, and -i.
5084
55a2bb35
ST
50852010-01-04 Sriraman Tallam <tmsriram@google.com>
5086
5087 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5088 check for .text or .gnu.linkonce.t sections.
5089 * icf.cc (Icf::find_identical_sections): Ditto.
5090 Change the detection for mangled function name within the section
5091 name.
5092 * icf.h (is_section_foldable_candidate): New function.
5093
719328e1
ILT
50942009-12-30 Ian Lance Taylor <iant@google.com>
5095
5096 PR 10980
5097 * options.h (class General_options): Permit two dashes with
5098 --retain-symbols-file.
5099
d7bb5745
ILT
51002009-12-30 Ian Lance Taylor <iant@google.com>
5101
403a15dd
ILT
5102 PR 10979
5103 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5104 don't put the file header and segment headers in the text
5105 segment.
5106
eda294df
ILT
5107 PR 10979
5108 * common.cc (Sort_commons::operator()): Stabilize sort when both
5109 entries are NULL.
5110 (Symbol_table::do_allocate_commons_list): When allocating common
5111 symbols, skip a symbol which is no longer common.
5112 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5113 an object before checking its type.
5114 * testsuite/common_test_2.c: New file.
5115 * testsuite/common_test_3.c: New file.
5116 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5117 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5118 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5119 (common_test_2_pic.o, common_test_2.so): New targets.
5120 (common_test_3_pic.o, common_test_3.so): New targets.
5121 * testsuite/Makefile.in: Rebuild.
5122
d7bb5745
ILT
5123 PR 10979
5124 * script.cc (read_input_script): If we see a new SECTIONS clause,
5125 and we have added an input section, give an error.
5126 * layout.h (class Layout): Add have_added_input_section function.
5127 Add have_added_input_section_ field.
5128 * layout.cc (Layout::Layout): Initialize
5129 have_added_input_section_.
5130 (Layout::layout): Set have_added_input_section_.
5131 (Layout::layout_eh_frame): Likewise.
5132
fc59c572
ILT
51332009-12-30 Ian Lance Taylor <iant@google.com>
5134
5135 PR 10931
5136 * options.h (class General_options): Add --sort-common option.
5137 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5138 * common.cc (Sort_common): Add sort_order parameter to
5139 constructor. Add sort_order_ field.
5140 (Sort_commons::operator): Check sort_order_.
5141 (Symbol_table::allocate_commons): Determine the sort order.
5142 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5143 Change all callers.
5144 (Symbol_table::do_allocate_commons_list): Likewise.
5145
1c74fab0
ILT
51462009-12-30 Ian Lance Taylor <iant@google.com>
5147
5148 PR 10916
5149 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5150 symbols from this object, don't change the visibility of an
5151 undefined symbol.
5152 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5153
6affe781
ILT
51542009-12-30 Ian Lance Taylor <iant@google.com>
5155
5156 PR 10861
5157 * script.h (class Version_script_info): Define Language enum.
5158 Update declarations. Define Glob, Exact, and Lookup types. Add
5159 new fields globals_, locals_, and is_finalized_.
5160 * script.cc: Various formatting fixes.
5161 (class Parser_closure): Change language_stack_ from a vector of
5162 std::string to one of Version_script_info::Language. Adjust all
5163 uses accordingly.
5164 (class Lazy_demangler): Remove.
5165 (struct Version_expression): Change language from std::string to
5166 Version_script_info::Language.
5167 (Version_script_info::Version_script_info): New function.
5168 (Version_script_info::~Version_script_info): Don't call clear.
5169 (Version_script_info::finalize): New function.
5170 (Version_script_info::build_lookup_tables): New function.
5171 (Version_script_info::build_expression_list_lookup): New
5172 function.
5173 (Version_script_info::get_symbol_version_helper): Rewrite to use
5174 lookup tables.
5175 (Version_script_info::print_expression_list): Adjust to use
5176 Version_script_info::Language.
5177 (script_push_lex_into_version_mode): Check that the version script
5178 has not been finalized.
5179 (version_script_push_lang): Change language string to
5180 Version_script_info::Language.
5181 * options.cc (Command_line::version_script): New function.
5182 * options.h (class General_options): Add finalize_dynamic_list
5183 function. Change version_script from declaration to definition.
5184 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5185 * testsuite/version_script.map: Remove duplicate def of foo.
5186 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5187 version_script.map.
5188 * testsuite/Makefile.in: Rebuild.
5189
818bf354
ILT
51902009-12-30 Ian Lance Taylor <iant@google.com>
5191
5192 PR 10843
5193 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5194 if the input symbol index is 0, make the output symbol index 0.
5195
ebcc8304
ILT
51962009-12-30 Ian Lance Taylor <iant@google.com>
5197
5198 PR 10670
5199 * options.h (class General_options): Add -x/--discard-all.
5200 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5201 --discard-all. If the local symbol needs a dynamic entry, check
5202 that before handling --discard-locals.
5203
176fe33f
ILT
52042009-12-30 Ian Lance Taylor <iant@google.com>
5205
bb321bb1
ILT
5206 PR 10450
5207 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5208 flags to PF_R.
5209 (Output_segment::add_output_section): Don't change the flags if
5210 the type is PT_TLS.
5211
176fe33f
ILT
5212 PR 10450
5213 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5214 GNU hash table if they need a dynamic value. Otherwise, don't add
5215 them if they are defined in a dynamic object or are forced local.
5216
e8cd95c7
ILT
52172009-12-29 Ian Lance Taylor <iant@google.com>
5218
1b81fb71
ILT
5219 PR 10450
5220 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5221 .gnu.hash table for a 32-bit target.
5222
8d6d383d
ILT
5223 PR 10450
5224 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5225 regular and a dynamic object only needs a dynamic symbol table
5226 entry if it is externally visible.
5227
e785ec03
ILT
5228 PR 10450
5229 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5230 constructor. Add global_offset_table_ field.
5231 (Target_i386::got_section): Set global_offset_table_.
5232 (Target_i386::do_finalize_sections): Set global_offset_table_
5233 size.
5234 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5235 in constructor. Add global_offset_table_ field.
5236 (Target_x86_64::got_section): Set global_offset_table_.
5237 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5238 size.
5239
1a2dff53
ILT
5240 * layout.cc (Layout::Layout): Initialize increase_relro_.
5241 (Layout::get_output_section): Add is_relro, is_last_relro, and
5242 is_first_non_relro parameters. Change all callers.
5243 (Layout::choose_output_section): Likewise.
5244 (Layout::add_output_section_data): Likewise.
5245 (Layout::make_output_section): Likewise.
5246 (Layout::set_segment_offsets): Clear increase_relro when using a
5247 linker script.
5248 * layout.h (class Layout): Add increase_relro method. Add
5249 increase_relro_ field. Update declarations.
5250 * output.cc (Output_section::Output_section): Initialize
5251 is_last_relro_ and is_first_non_relro_.
5252 (Output_segment::add_output_section): Group relro sections is
5253 do_sort is true. Handle is_last_relro and is_first_non_relro.
5254 (Output_segment::maximum_alignment): Remove relro handling.
5255 (Output_segment::set_section_addresses): Add increase_relro
5256 parameter. Change all callers. Add initial alignment to align
5257 relro sections on separate page. Remove old relro handling.
5258 (Output_segment::set_section_list_addresses): Remove in_relro
5259 parameter. Change all callers.
5260 (Output_segment::set_offset): Add increase parameter. Change all
5261 callers. Remove old relro handling.
5262 * output.h (class Output_section): Add new methods: is_last_relro,
5263 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5264 Add is_last_relro_ and is_first_non_relro_ fields.
5265 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5266 Create separate .got.plt section. Call increase_relro.
5267 * x86_64.cc (Target_x86_64::got_section): Likewise.
5268 * testsuite/relro_script_test.t: Add .got.plt.
5269
f0ba79e2
ILT
5270 PR 10450
5271 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5272 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5273 (Layout::finalize): Call set_dynamic_symbol_size.
5274 (Layout::set_dynamic_symbol_size): New function.
5275 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5276 set_dynamic_symbol_size.
5277
e8cd95c7
ILT
5278 PR 10450
5279 * output.h (class Output_section): Add is_entsize_zero_ field.
5280 * output.cc (Output_section::Output_section): Initialize
5281 is_entsize_zero_.
5282 (Output_section::set_entsize): If two different entsizes are
5283 requested, force it to zero.
5284 (Output_section::add_input_section): Set flags for .debug_str
5285 before updating section flags. Set entsize.
5286 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5287 and SHF_STRING if all input sections have those flags.
5288
3e1b9a8a
RÁE
52892009-12-29 Rafael Espindola <espindola@google.com>
5290
5291 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
5292 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5293 reporting.
3e1b9a8a 5294
3dcad376
ST
52952009-12-29 Sriraman Tallam <tmsriram@google.com>
5296
5297 * options.cc (General_options::parse_version): Allow -v to exit
5298 without an error if there is nothing to link.
5299
084e2665
ILT
53002009-12-29 Ian Lance Taylor <iant@google.com>
5301
5302 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5303 using a version of gcc before 4.1.
5304 * configure: Rebuild.
5305
250acde3
CD
53062009-12-28 Chris Demetriou <cgd@google.com>
5307
5308 * attributes.cc (Output_attributes_section_data::do_write): Use
5309 std::vector::front rather than std::vector::data.
5310
99fff23b
ILT
53112009-12-28 Ian Lance Taylor <iant@google.com>
5312
5313 * symtab.h (class Symbol_table): Add enum Defined.
5314 * resolve.cc (Symbol_table::should_override): Add defined
5315 parameter. Change all callers. Test whether object is NULL
5316 before calling a method on it.
5317 (Symbol_table::report_resolve_problem): Add defined parameter.
5318 Change all callers.
5319 (Symbol_table::should_override_with_special): Likewise.
5320 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5321 parameter. Change all callers.
5322 (Symbol_table::do_define_in_output_data): Likewise.
5323 (Symbol_table::define_in_output_segment): Likewise.
5324 (Symbol_table::do_define_in_output_segment): Likewise.
5325 (Symbol_table::define_as_constant): Likewise.
5326 (Symbol_table::do_define_as_constant): Likewise.
5327 * script.h (class Symbol_assignment): Add is_defsym parameter to
5328 constructor; change all callers.
5329 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5330 parameter. Change all callers. Add is_defsym_ field.
5331 (class Parser_closure): Add parsing_defsym parameter to
5332 constructor; change all callers. Add parsing_defsym accessor
5333 function. Add parsing_defsym_ field.
5334
556bd683
ILT
53352009-12-28 Ian Lance Taylor <iant@google.com>
5336
5337 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 5338 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 5339
1782c879
ILT
53402009-12-23 Ian Lance Taylor <iant@google.com>
5341
5342 * i386.cc (Target_i386::do_calls_non_split): Recognize
5343 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
5344 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5345 -fsplit-stack prologue when using %r11.
1782c879 5346
329ca2b1
ST
53472009-12-21 Sriraman Tallam <tmsriram@google.com>
5348
5349 * options.cc (General_options::parse_version): Make -v continue and do
5350 the link like GNU ld does.
5351
d675ff46
RÁE
53522009-12-17 Rafael Avila de Espindola <espindola@google.com>
5353
5354 * Makefile.am (CCFILES): Add timer.cc.
5355 (HFILES): Add timer.h.
5356 * configure.ac: Check for sysconf and times.
5357 * main.cc: include timer.h.
5358 (main): Use Timer instead of get_run_time.
5359 * timer.cc: New.
5360 * timer.h: New.
5361 * workqueue.cc: include timer.h.
5362 (Workqueue::find_and_run_task):
5363 Report user, sys and wall time.
5364 * Makefile.in: Regenerate.
5365 * config.in: Regenerate.
5366 * configure: Regenerate.
5367
d6344fb5
DK
53682009-12-16 Doug Kwan <dougkwan@google.com>
5369
5370 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5371 sections.
5372 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5373 relaxed input sections.
5374 * output.cc (Output_section::find_relaxed_input_section): Change
5375 return type to Output_relaxed_input_section pointer. Adjust code
5376 for new type of relaxed_input_section_map_.
5377 * output.h (Output_section::find_relaxed_input_section): Change
5378 return type to Output_relaxed_input_section pointer.
5379 (Output_section::Output_relaxed_input_section_by_input_section_map):
5380 New type.
5381 (Output_section::relaxed_input_section_map_): Change type to
5382 Output_section::Output_relaxed_input_section_by_input_section_map.
5383 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5384 input section.
5385
0e0d5469
ILT
53862009-12-15 Ian Lance Taylor <iant@google.com>
5387
5388 * layout.cc (Layout::create_shstrtab): Only write out after input
5389 sections if we are compressing debug sections.
5390
0649a889
ILT
53912009-12-15 Ian Lance Taylor <iant@google.com>
5392
5393 * archive.cc (Archive::add_symbols): Only look up a symbol without
5394 a version if there is, in fact, a version.
5395
2ea97941
ILT
53962009-12-14 Ian Lance Taylor <iant@google.com>
5397
5398 Revert -Wshadow changes, all changes from:
5399 2009-12-11 Doug Kwan <dougkwan@google.com>
5400 2009-12-11 Nick Clifton <nickc@redhat.com>
5401 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5402
b0eec2cc
DK
54032009-12-11 Doug Kwan <dougkwan@google.com>
5404
5405 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5406 due to -Wshadow.
5407 * attributes.cc (Object_attribute::size): Ditto.
5408 (Attributes_section_data::size): Ditto.
5409 (Attributes_section_data::Attributes_section_data): Ditto.
5410 (Output_attributes_section_data::do_write): Ditto.
5411 * attributes.h (Object_attribute::set_type): Ditto.
5412 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5413
91d6fa6a
NC
54142009-12-11 Nick Clifton <nickc@redhat.com>
5415
5416 * archive.cc: Fix shadowed variable warnings.
5417 * arm.cc: Likewise.
5418 * compressed_output.cc: Likewise.
5419 * compressed_output.h: Likewise.
5420 * configure: Likewise.
5421 * dwarf_reader.cc: Likewise.
5422 * dynobj.cc: Likewise.
5423 * dynobj.h: Likewise.
5424 * ehframe.cc: Likewise.
5425 * ehframe.h: Likewise.
5426 * errors.cc: Likewise.
5427 * expression.cc: Likewise.
5428 * fileread.cc: Likewise.
5429 * fileread.h: Likewise.
5430 * freebsd.h: Likewise.
5431 * i386.cc: Likewise.
5432 * icf.cc: Likewise.
5433 * incremental.h: Likewise.
5434 * layout.cc: Likewise.
5435 * layout.h: Likewise.
5436 * mapfile.cc: Likewise.
5437 * merge.cc: Likewise.
5438 * merge.h: Likewise.
5439 * object.cc: Likewise.
5440 * object.h: Likewise.
5441 * options.h: Likewise.
5442 * output.cc: Likewise.
5443 * output.h: Likewise.
5444 * parameters.cc: Likewise.
5445 * plugin.cc: Likewise.
5446 * powerpc.cc: Likewise.
5447 * reduced_debug_output.cc: Likewise.
5448 * reduced_debug_output.h: Likewise.
5449 * reloc.cc: Likewise.
5450 * reloc.h: Likewise.
5451 * resolve.cc: Likewise.
5452 * script-sections.cc: Likewise.
5453 * script.cc: Likewise.
5454 * script.h: Likewise.
5455 * sparc.cc: Likewise.
5456 * symtab.cc: Likewise.
5457 * symtab.h: Likewise.
5458 * target-select.cc: Likewise.
5459 * target-select.h: Likewise.
5460 * token.h: Likewise.
5461 * workqueue.cc: Likewise.
5462 * workqueue.h: Likewise.
5463 * x86_64.cc: Likewise.
5464
a0351a69
DK
54652009-12-10 Doug Kwan <dougkwan@google.com>
5466
5467 * arm.cc (attributes.h): New include.
5468 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5469 (Arm_relobj::~Arm_relobj): Delete object pointed by
5470 attributes_section_data_.
5471 (Arm_relobj::attributes_section_data): New method definition.
5472 (Arm_relobj::attributes_section_data_): New data member declaration.
5473 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5474 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5475 attributes_section_data_.
5476 (Arm_dynobj::attributes_section_data): New method definition.
5477 (Arm_dynobj::attributes_section_data_): New data member declaration.
5478 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5479 initialization value of may_use_blx_ to false.
5480 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5481 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5482 object attributes to compute results instead of hard-coding.
5483 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5484 Target_arm::get_secondary_compatible_arch,
5485 Target_arm::set_secondary_compatible_arch
5486 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5487 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5488 New method declarations.
5489 (Target_arm::get_aeabi_object_attribute): New method definition.
5490 (Target_arm::attributes_section_data_): New data member declaration.
5491 (read_arm_attributes_section): New template definition.
5492 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5493 (Arm_dynobj::do_read_symbols): Ditto.
5494 (Target_arm::do_finalize_sections): Merge attributes sections from
5495 input. Check for BLX use after attributes section merging.
5496 Fix __exidx_start and __exidx_end visibility. Create an
5497 .ARM.attributes section if necessary.
5498 (Target_arm::get_secondary_compatible_arch,
5499 Target_arm::set_secondary_compatible_arch,
5500 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5501 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 5502 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
5503 New method definitions.
5504
b59befec
ILT
55052009-12-09 Ian Lance Taylor <iant@google.com>
5506
5507 * plugin.cc (Plugin::load): Don't cast from void* to a function
5508 pointer.
5509
1276bc89
ILT
55102009-12-09 Ian Lance Taylor <iant@google.com>
5511
5512 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5513 information fields.
5514
2f2de248
L
55152009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5516
5517 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5518 Replace two_file_shared_1.so with two_file_shared_2.so.
5519 * testsuite/Makefile.in: Regenerated.
5520
4f787271
DK
55212009-12-08 Doug Kwan <dougkwan@google.com>
5522
5523 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5524 (HFILES): Add attributes.h and int_encoding.h.
5525 * Makefile.in: Regenerate.
5526 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5527 function definitions to int_encoding.cc
5528 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5529 prototypes to int_encoding.h
5530 * reduced_debug_output.cc (int_encoding.h): New include.
5531 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5532 function definitions to int_encoding.cc
5533 (insert_into_vector, read_from_pointer): Move template definitions to
5534 int_encoding.h
5535 * attributes.cc: New file.
5536 * attributes.h: New file.
5537 * int_encoding.cc: New file.
5538 * int_encoding.h: New file.
5539
20b52f1a
RÁE
55402009-12-07 Rafael Avila de Espindola <espindola@google.com>
5541
5542 PR gold/11055
5543 * incremental-dump.cc (dump_incremental_inputs): New.
5544 (main): Use dump_incremental_inputs.
5545
53d7974c
L
55462009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5547
5548 PR gold/10893
5549 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5550 checking elfcpp::STT_FUNC.
5551 (Target_i386::Relocate::relocate): Likewise.
5552 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5553
5554 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5555 symbols from shared libraries into normal FUNC symbols.
5556
5557 * symtab.h (Symbol): Add is_func and use it.
5558
05a352e6
DK
55592009-12-05 Doug Kwan <dougkwan@google.com>
5560
5561 * arm.cc (Target_arm::arm_info): Initialize new fields
5562 attributes_section and attributes_vendor.
5563 * i386.cc (Target_i386::i386_info): Same.
5564 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5565 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5566 fields attributes_section and attributes_vendor.
53d7974c 5567 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
5568 * target.h (Target::attributes_section, Target::attributes_vendor,
5569 Target::is_attributes_section, Target::attribute_arg_type,
5570 Target::attributes_order): New method definitions.
5571 (Target::Target_info::attributes_section,
5572 Target::Target_info::attributes_vendor): New fields.
5573 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5574 virtual method definitions.
5575 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5576 attributes_section and attributes_vendor.
5577 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5578
f4e5969c
DK
55792009-12-05 Doug Kwan <dougkwan@google.com>
5580
5581 * arm.cc: Update comments about interworking and stub generation.
5582 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5583 considered as non-PIC.
5584 (Arm_relocate_functions::base_abs): Fix formatting.
5585 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5586 of function to use GOT entry address instead of offset.
5587 (Target_arm::Scan::global): Issue an error if a symbol would need a
5588 PLT does not get one because it is untyped. Remove code to create
5589 dynamic symbols for relative branches.
5590 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5591 takes unsigned integer instead of boolean.
5592
1abce4a6
L
55932009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5594
5595 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5596 (two_file_test_LDADD): Likewise.
5597 (common_test_1_LDADD): Likewise.
5598 (exception_test_LDADD) Likewise.
5599 (weak_test_LDADD): Likewise.
5600 (many_sections_test_LDADD): Likewise.
5601 (initpri1_LDADD): Likewise.
5602 (script_test_1_LDADD): Likewise.
5603 (script_test_2_LDADD): Likewise.
5604 (justsyms_LDADD): Likewise.
5605 (binary_test_LDADD): Likewise.
5606 (large_LDADD): Likewise.
5607 * testsuite/Makefile.in: Regenerated.
5608
adcf2816 56092009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 5610
adcf2816
L
5611 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5612 (Symbol_table::override_with_special): Likewise.
5613 (Symbol_table::add_from_object): Likewise.
5614
28e67f5d
RÁE
56152009-12-04 Rafael Avila de Espindola <espindola@google.com>
5616
5617 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5618 Don't set the data_offset twice.
5619
ae10a101
RÁE
56202009-12-04 Rafael Avila de Espindola <espindola@google.com>
5621
5622 * testsuite/Makefile.in: Regenerate.
5623
f59f41f3
DK
56242009-12-03 Doug Kwan <dougkwan@google.com>
5625
5626 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5627 (Target_arm::do_finalize_sections): Add parameter for symbol table
5628 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5629 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5630 parameter for symbol table pointer.
5631 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5632 an additional parameter for a pointer to symbol table.
5633 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5634 parameter for a symbol table pointer.
5635 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5636 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5637 Ditto.
5638 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5639 parameter for a symbol table pointer.
5640
ca55d848
RÁE
56412009-12-03 Rafael Avila de Espindola <espindola@google.com>
5642
5643 * incremental.cc (Incremental_inputs_header)
5644 (Incremental_inputs_header_write, Incremental_inputs_entry)
5645 (Incremental_inputs_entry_write): Move ...
5646 * incremental.h (Incremental_inputs_header)
5647 (Incremental_inputs_header_write, Incremental_inputs_entry)
5648 (Incremental_inputs_entry_write): here.
5649
3aec4f9c
RÁE
56502009-12-02 Rafael Avila de Espindola <espindola@google.com>
5651
5652 * incremental.cc (make_sized_incremental_binary): Set the target.
5653 Error if it is incompatible.
5654 * output.h (Output_file): Add filename method.
5655
9c0ae74d
RÁE
56562009-12-02 Rafael Avila de Espindola <espindola@google.com>
5657
5658 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5659 from the get_* methods.
5660
a45500ae
RÁE
56612009-12-02 Rafael Avila de Espindola <espindola@google.com>
5662
5663 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5664 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5665 Write 0 for the data_offset of scripts.
5666
325e6408
RÁE
56672009-12-02 Rafael Avila de Espindola <espindola@google.com>
5668
5669 * testsuite/Makefile.am: Add the incremental_test.sh test.
5670 * testsuite/incremental_test.sh: New.
5671 * testsuite/incremental_test_1.c: New.
5672 * testsuite/incremental_test_2.c: New.
5673
954c3e2e
RÁE
56742009-12-01 Rafael Avila de Espindola <espindola@google.com>
5675
5676 * incremental-dump.cc (main): Fix typos.
5677
f8086623
RÁE
56782009-11-27 Rafael Avila de Espindola <espindola@google.com>
5679
5680 PR gold/11025
5681 * incremental-dump.cc (main): Use llu to print 64 bit values.
5682
3b0dd6ac
L
56832009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5684 H.J. Lu <hongjiu.lu@intel.com>
5685
5686 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5687 $(LIBDL).
5688 (incremental_dump_LDADD): Likewise.
5689 * Makefile.in: Regenerated.
5690
a6d1ef57 56912009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 5692
a6d1ef57
DK
5693 Revert:
5694
5695 2009-11-25 Doug Kwan <dougkwan@google.com>
5696
5697 * arm.cc (Target_arm::Target_arm): Move method definition
5698 outside of class definition. Add code to handle
5699 --target1-rel, --target1-abs and --target2= options.
5700 (Target_arm::get_reloc_reloc_type): Change method to be
5701 non-static and const.
5702 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5703 New data member declaration.
5704 (Target_arm::Scan::local, Target_arm::Scan::global,
5705 Target_arm::Relocate::relocate,
5706 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5707 Adjust call to Target_arm::get_real_reloc_type.
5708 (Target_arm::get_real_reloc_type): Use command line options
5709 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5710 * options.h (--target1-rel, --target1-abs, --target2): New
5711 ARM-only options.
5712
50aeb7d4
DK
57132009-11-25 Doug Kwan <dougkwan@google.com>
5714
5715 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5716 class definition. Add code to handle --target1-rel, --target1-abs
5717 and --target2= options.
5718 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5719 and const.
5720 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5721 member declaration.
5722 (Target_arm::Scan::local, Target_arm::Scan::global,
5723 Target_arm::Relocate::relocate,
5724 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5725 call to Target_arm::get_real_reloc_type.
5726 (Target_arm::get_real_reloc_type): Use command line options to
5727 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5728 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5729 options.
5730
51938283
DK
57312009-11-25 Doug Kwan <dougkwan@google.com>
5732
5733 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5734 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5735 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5736 formatting.
5737 (Arm_relocate_functions::thm_call): Replace body with a call to
5738 Arm_relocate_functions::thumb_branch_common.
5739 (Arm_relocate_functions::thm_jump24,
5740 Arm_relocate_functions::thm_xpc22): New method definitions.
5741 (Arm_relocate_functions::thumb_branch_common): New method definition.
5742 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5743 operator.
5744 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5745 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5746
e2b8f3c4
RÁE
57472009-11-24 Rafael Avila de Espindola <espindola@google.com>
5748
5749 * Makefile.am: Build incremental-dump
5750 * Makefile.in: Regenerate.
5751 * incremental-dump.cc: New.
5752 * incremental.cc (Incremental_inputs_header_data,
5753 Incremental_inputs_entry_data): Move to incremental.h
5754 * incremental.h: (Incremental_inputs_header_data,
5755 Incremental_inputs_entry_data): Move from incremental.cc
5756
bcba9aec
RÁE
57572009-11-24 Rafael Avila de Espindola <espindola@google.com>
5758
5759 * incremental.cc (Incremental_inputs_header,
5760 Incremental_inputs_header_write, Incremental_inputs_entry,
5761 Incremental_inputs_entry_write): Add a typedef with the data type.
5762
7c3afe08
RÁE
57632009-11-24 Rafael Avila de Espindola <espindola@google.com>
5764
5765 * incremental.cc (Incremental_inputs_header,
5766 Incremental_inputs_header_write, Incremental_inputs_entry,
5767 Incremental_inputs_entry_write): Update comment about which
5768 type has the filed descriptions.
5769
d204b6e9
DK
57702009-11-15 Doug Kwan <dougkwan@google.com>
5771
5772 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5773 (Arm_relocate_functions::arm_branch_common): Change method defintion
5774 in class definition to a method declaration and update list of formal
5775 parameters.
5776 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5777 Arm_relocation_functions::jump24): Adjust call to
5778 Arm_relocate_functions::arm_branch_common. Update list of formal
5779 parameters.
5780 (Arm_relocate_functions::xpc25): New method definition.
5781 (Arm_relocate_functions::arm_branch_common): Move method defintion
5782 out from class definition. Use stubs for mode-switching and extending
5783 branch ranges.
5784 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5785 specially. Change code to enable use of stubs in ARM branches.
5786
43d12afe
DK
57872009-11-10 Doug Kwan <dougkwan@google.com>
5788
5789 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5790 in method declaration.
5791 (Target_arm::relocate_stub): New method declaration.
5792 (Target_arm::default_target): Change to return a pointer instead of
5793 a const reference.
5794 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5795 Target_arm::default_target.
5796 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5797 method definition.
5798 (Target_arm::relocate_section): Adjust view.
5799 (Target_arm::relocate_stub): New method definition.
5800
ac33a407
DK
58012009-11-10 Doug Kwan <dougkwan@google.com>
5802
5803 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5804 a format warning.
5805 * incremental.cc (open_incremental_binary): Initialized local
5806 variables to avoid warnings.
5807 * object.cc (make_elf_object): Ditto.
5808 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5809 a format warning.
e1df38aa 5810
88ee28e9
L
5811009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5812
5813 PR gold/10930
5814 * testsuite/plugin_test.c: Include "config.h".
5815
2daedcd6
DK
58162009-11-09 Doug Kwan <dougkwan@google.com>
5817
5818 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5819 (arm_symbol_value): Remove.
5820 (Arm_relocate_functions::arm_branch_common,
5821 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5822 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5823 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5824 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5825 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5826 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5827 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5828 Arm_relocate_functions::thm_mobw_abs_nc,
5829 Arm_relocate_functions::thm_mov_abs,
5830 Arm_relocate_functions::movw_prel_nc,
5831 Arm_relocate_functions::thm_movt_abs,
5832 Arm_relocate_functions::movt_prel,
5833 Arm_relocate_functions::thm_movw_prel_nc,
5834 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5835 (Target_arm::Relocate::relocate): Only decompose address into two
5836 parts if relocation type uses the thumb-bit and pass the actual
5837 bit instead of a flag indicating that the thumb-bit is used. Adjust
5838 calls to methods in Arm_relocate_functions for this change.
5839
1276bc89 58402009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
5841
5842 PR 10925
5843 * reloc.cc: Instantiate
5844 Sized_relobj::initialize_input_to_output_maps and
5845 Sized_relobj:free_input_to_output_maps.
5846
e53ad1b5
ILT
58472009-11-06 Ian Lance Taylor <iant@google.com>
5848
5849 PR 10876
5850 * defstd.cc (in_segment): Set only_if_ref true for "end".
5851
eb44217c
DK
58522009-11-06 Doug Kwan <dougkwan@google.com>
5853
5854 * arm.cc (class Reloc_stub): Correct a comment.
5855 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5856 (Target_arm::scan_section_for_stubs): New method declaration.
5857 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5858 Change methods from private to protected.
5859 (Target_arm::do_may_relax): New method definition.
5860 (Target_arm::do_relax, Target_arm::group_sections,
5861 Target_arm::scan_reloc_for_stub,
5862 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5863 (Target_arm::arm_input_section_map_): New data member declaration.
5864 (Target_arm::scan_reloc_for_stub,
5865 Target_arm::scan_reloc_section_for_stubs,
5866 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5867 Target_arm::do_relax): New method definitions.
5868
5d329b7d
ILT
58692009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5870
5871 * configure.ac: Check for (struct stat)::st_mtim
5872 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5873 * config.in: Regenerate.
5874 * configure: Regenerate.
5875
96a0d71b
ILT
58762009-11-05 Ian Lance Taylor <iant@google.com>
5877
5878 PR 10910
5879 * output.cc (Output_segment::add_output_section): Add missing
5880 return statement.
5881
594c8e5e
ILT
58822009-11-04 Ian Lance Taylor <iant@google.com>
5883
5884 PR 10880
5885 * object.h (class Object): Add is_needed and set_is_needed
5886 methods. Add is_needed_ field. Make bool fields into bitfields.
5887 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5888 defined in a dynamic object and referenced by a regular object,
5889 set is_needed for the dynamic object.
5890 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5891 if the file is marked with as_needed and it is not needed.
5892
22b127cc
ILT
58932009-11-04 Ian Lance Taylor <iant@google.com>
5894
5895 PR 10887
5896 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5897 tags if data is discarded by linker script.
5898 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5899 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5900 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5901 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5902
f5c870d2
ILT
59032009-11-04 Ian Lance Taylor <iant@google.com>
5904
5905 * layout.cc (Layout::get_output_section): Add is_interp and
5906 is_dynamic_linker_section parameters. Change all callers.
5907 (Layout::choose_output_section): Likewise.
5908 (Layout::make_output_section): Likewise.
5909 (Layout::add_output_section_data): Add is_dynamic_linker_section
5910 parameter. Change all callers.
5911 * layout.h (class Layout): Update declarations.
5912 * output.h (class Output_section): Add is_interp, set_is_interp,
5913 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5914 Add is_interp_, is_dynamic_linker_section_ fields. Change
5915 generate_code_fills_at_write_ to a bitfield.
5916 * output.cc (Output_section::Output_sections): Initialize new
5917 fields.
5918 (Output_segment::add_output_section): Add do_sort parameter.
5919 Change all callers.
5920
1ae4d23b
ILT
59212009-11-03 Ian Lance Taylor <iant@google.com>
5922
5923 PR 10860
5924 * options.h (class General_options): Add --warn-common.
5925 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5926 merging two common symbols.
5927 (Symbol_table::should_override): Handle --warn-common when merging
5928 a common symbol with a defined symbol. Use report_resolve_problem
5929 for multiple definitions.
5930 (Symbol_table::report_resolve_problem): New function.
5931 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5932
55da9579
DK
59332009-11-03 Doug Kwan <dougkwan@google.com>
5934
5935 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5936 stub_factory_.
5937 (Target_arm::stub_factory): New method definition.
5938 (Target_arm::new_arm_input_section,
5939 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5940 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 5941 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
5942 New type definitions.
5943 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5944 member declarations.
5945 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5946 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5947 New method definitions.
5948
37a9ac43
ILT
59492009-11-03 Ian Lance Taylor <iant@google.com>
5950
5951 * options.h (class General_options): Add --warn_constructors.
5952
b3d6a3d4
ILT
59532009-11-03 Ian Lance Taylor <iant@google.com>
5954
5955 PR 10893
5956 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5957 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5958
934b01dd
ILT
59592009-11-03 Ian Lance Taylor <iant@google.com>
5960
5961 PR 10895
5962 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5963 --msgid-bugs-address.
5964 (install-pdf): New target.
5965 (install-data_yes): Look up one directory to find mkinstalldirs.
5966
03c1939b
L
59672009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5968
5969 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5970 tree.
5971
ebd95253
DK
59722009-10-30 Doug Kwan <dougkwan@google.com>
5973
5974 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5975
e9bbb538
DK
59762009-10-30 Doug Kwan <dougkwan@google.com>
5977
5978 * arm.cc (Stub_addend_reader): New struct template definition
5979 and partial specializations.
5980 (Stub_addend_reader::operator()): New method definition for a
5981 partially specialized template.
5982
d5b40221
DK
59832009-10-30 Doug Kwan <dougkwan@google.com>
5984
5985 * arm.cc (Arm_relobj::processor_specific_flags): New method
5986 definition.
5987 (Arm_relobj::do_read_symbols): New method declaration.
5988 (Arm_relobj::processor_specific_flags_): New data member declaration.
5989 (Arm_dynobj): New class definition.
5990 (Target_arm::do_finalize_sections): Add input_objects parameter.
5991 (Target_arm::do_adjust_elf_header): New method declaration.
5992 (Target_arm::are_eabi_versions_compatible,
5993 (Target_arm::merge_processor_specific_flags): New method declaration.
5994 (Target_arm::do_make_elf_object): New overloaded method definitions
5995 and declaration.
5996 (Arm_relobj::do_read_symbols): New method definition.
5997 (Arm_dynobj::do_read_symbols): Ditto.
5998 (Target_arm::do_finalize_sections): Add input_objects parameters.
5999 Merge processor-specific flags from all input objects.
6000 (Target_arm::are_eabi_versions_compatible,
6001 Target_arm::merge_processor_specific_flags,
6002 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6003 New method definitions.
6004 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6005 Input_objects pointer type parameter.
6006 * layout.cc (Layout::finalize): Pass input objects to target's.
6007 finalize_sections function.
6008 * output.cc (Output_file_header::do_sized_write): Set ELF file
6009 header's processor-specific flags.
6010 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6011 Input_objects pointer type parameter.
6012 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6013 * target.h (Input_objects): New forward class declaration.
6014 (Target::processor_specific_flags,
6015 Target::are_processor_specific_flags_sect): New method definitions.
6016 (Target::finalize_sections): Add input_objects parameter.
6017 (Target::Target): Initialize processor_specific_flags_ and
6018 are_processor_specific_flags_set_.
6019 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6020 parameter.
6021 (Target::set_processor_specific_flags): New method definition.
6022 (Target::processor_specific_flags_,
6023 Target::are_processor_specific_flags_set_): New data member
6024 declarations.
6025 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6026 Input_objects pointer type parameter.
6027
ebabffbd
DK
60282009-10-30 Doug Kwan <dougkwan@google.com>
6029
6030 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6031
ad0f2072
ILT
60322009-10-28 Ian Lance Taylor <iant@google.com>
6033
6034 * object.h (class Relobj): Drop options parameter from
6035 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6036 do_scan_relocs, do_relocate. Change all callers.
6037 (class Sized_relobj): Drop options parameters from
6038 do_gc_process_relocs, do_scan_relocs, do_relocate,
6039 do_relocate_sections, relocate_sections, emit_relocs_scan,
6040 emit_relocs_scan_reltype. Change all callers.
6041 (struct Relocate_info): Remove options field and all references to
6042 it.
6043 * reloc.h (class Read_relocs): Remove options constructor
6044 parameter and options_ field. Change all callers.
6045 (class Gc_process_relocs, class Scan_relocs): Likewise.
6046 (class Relocate_task): Likewise.
6047 * target-reloc.h (scan_relocs): Remove options parameter. Change
6048 all callers.
6049 (scan_relocatable_relocs): Likewise.
6050 * target.h (class Sized_target): Remove options parameter from
6051 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6052 all callers.
6053 * gc.h (gc_process_relocs): Remove options parameter. Change all
6054 callers.
6055 * arm.cc: Update functions to remove options parameters.
6056 * i386.cc: Likewise.
6057 * powerpc.cc: Likewise.
6058 * sparc.cc: Likewise.
6059 * x86_64.cc: Likewise.
6060 * testsuite/testfile.cc: Likewise.
6061
8ffa3667
DK
60622009-10-28 Doug Kwan <dougkwan@google.com>
6063
6064 * arm.cc (Arm_relobj): New class definition.
e1df38aa 6065 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
6066 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6067 New method definitions.
6068
40f36857
CC
60692009-10-28 Cary Coutant <ccoutant@google.com>
6070
6071 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6072 (Plugin::cleanup_done_): New member.
6073 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6074 (Plugin_manager::cleanup_done_): Remove.
6075 (Plugin_manager::add_input_file): Edit error message.
6076 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6077 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6078
2c849493
ILT
60792009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6080
6081 * fileread.cc: (File_read::View::~View): Use the new
6082 data_ownership_ filed.
6083 (File_read::~File_read): Dispose the new whole_file_view_.
6084 (File_read::open): Mmap the whole file if needed.
6085 (File_read::open): Use whole_file_view_ instead of contents_.
6086 (File_read::find_view): Use whole_file_view_ if applicable.
6087 (File_read::do_read): Use whole_file_view_ instead of contents_.
6088 (File_read::make_view): Use whole_file_view_ instead of contents_,
6089 update File_read::View::View call.
6090 (File_read::find_or_make_view): Update File_read::View::View
6091 call.
6092 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6093 remove contents_
6094 (File_read::View::Data_ownership): New enum.
6095 (File_read::View::View): Replace bool mapped_ with Data_ownership
6096 argument.
6097 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6098 (File_read::View::data_ownership_): New field.
6099 (File_read::contents_): Remove (replaced by whole_file_view_).
6100 (File_read::whole_file_view_): New field.
6101 * options.h (class General_options): Add --keep-files-mapped.
6102
24998053
CC
61032009-10-27 Cary Coutant <ccoutant@google.com>
6104
6105 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6106 * testsuite/Makefile.am (plugin_test_5): New test case.
6107 * testsuite/Makefile.in: Regenerate.
6108
72adc4fa
DK
61092009-10-25 Doug Kwan <dougkwan@google.com>
6110
6111 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6112 from private to protected to allow access by child class.
6113 (Sized_relobj::do_relocate_sections): New method declaration.
6114 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 6115 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
6116 Sized_relobj::relocate_sections. Instantiate template explicitly
6117 for different target sizes and endianity.
6118
07f508a2
DK
61192009-10-24 Doug Kwan <dougkwan@google.com>
6120
6121 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6122 (Arm_input_section::as_arm_input_section): New method.
6123 (Arm_output_section): New class definition.
6124 (Arm_output_section::create_stub_group,
6125 Arm_output_section::group_sections): New method definitions.
6126
10ad9fe5
DK
61272009-10-22 Doug Kwan <dougkwan@google.com>
6128
6129 * arm.cc (Arm_input_section): New class definition.
6130 (Arm_input_section::init, Arm_input_section:do_write,
6131 Arm_input_section::set_final_data_size,
6132 Arm_input_section::do_reset_address_and_file_offset): New method
6133 definitions.
6134
56ee5e00
DK
61352009-10-21 Doug Kwan <dougkwan@google.com>
6136
6137 * arm.cc (Stub_table, Arm_input_section): New forward class
6138 declarations.
6139 (Stub_table): New class defintion.
6140 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6141 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6142 New method definition.
6143
b569affa
DK
61442009-10-21 Doug Kwan <dougkwan@google.com>
6145
6146 * arm.cc: Update copyright comments.
6147 (Target_arm): New forward class template declaration.
6148 (Arm_address): New type.
6149 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6150 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6151 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6152 constants.
6153 (Insn_template): Same.
6154 (DEF_STUBS): New macro.
6155 (Stub_type): New enum type.
6156 (Stub_template): New class definition.
6157 (Stub): Same.
6158 (Reloc_stub): Same.
6159 (Stub_factory): Same.
6160 (Target_arm::Target_arm): Initialize may_use_blx_ and
6161 should_force_pic_veneer_.
6162 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6163 Target_arm::should_force_pic_veneer,
6164 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6165 Target_arm::using_thumb_only, Target_arm:;default_target): New
6166 method defintions.
6167 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6168 New data member declarations.
6169 (Insn_template::size, Insn_template::alignment): New method defintions.
6170 (Stub_template::Stub_template): New method definition.
6171 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6172 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6173 (Stub_factory::Stub_factory): New method definition.
6174 * gold.h (string_hash): New template.
6175 * output.h (Input_section_specifier::hash_value): Use
6176 gold::string_hash.
6177 (Input_section_specifier::string_hash): Remove.
6178 * stringpool.cc (Stringpool_template::string_hash): Use
6179 gold::string_hash.
6180
6c172549
DK
61812009-10-20 Doug Kwan <dougkwan@google.com>
6182
6183 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6184 symbols of relaxed input sections.
6185 * output.h (Output_section::find_relaxed_input_section): Make
6186 method public.
6187
c5617f2f
DK
61882009-10-16 Doug Kwan <dougkwan@google.com>
6189
6190 * dynobj.cc (Versions::Versions): Initialize version_script_.
6191 Only insert base version symbol definition for a shared object
6192 if version script defines any version versions.
6193 (Versions::define_base_version): New method definition.
6194 (Versions::add_def): Check that base version is not needed.
6195 (Versions::add_need): Define base version lazily.
6196 * dynobj.h (Versions::define_base_version): New method declaration.
6197 (Versions::needs_base_version_): New data member declaration.
6198 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6199 (check_DATA): Add no_version_test.stdout.
6200 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6201 New make rules.
6202 * testsuite/Makefile.in: Regenerate.
6203 * testsuite/no_version_test.c: New file.
6204 * testsuite/no_version_test.sh: Ditto.
6205
3c12dcdb
DK
62062009-10-16 Doug Kwan <dougkwan@google.com>
6207
6208 * expression.cc (class Segment_start_expression): New class definition.
6209 (Segment_start_expression::value): New method definition.
6210 (script_exp_function_segment_start): Return a new
6211 Segment_start_expression.
6212 * gold/script-c.h (script_saw_segment_start_expression): New function
6213 prototype.
6214 * script-sections.cc (Script_sections::Script_sections): Initialize
6215 SAW_SEGMENT_START_EXPRESSION_ to false.
6216 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6217 and -Tbbs options to specify section addresses if given in
6218 command line and no SEGMENT_START expression is seen in a script.
6219 * script-sections.h (Script_sections::saw_segment_start_expression,
6220 Script_sections::set_saw_segment_start_expression): New method
6221 definition.
6222 (Script_sections::saw_segment_start_expression_): New data member
6223 declaration.
6224 * script.cc (script_saw_segment_start_expression): New function.
6225 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6226 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6227 script_test_7.sh and script_test_8.sh.
6228 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6229 script_test_8.stdout.
6230 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6231 (script_test_6, script_test_6.stdout, script_test_7,
6232 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6233 * Makefile.in: Regenerate.
6234 * testsuite/script_test_6.sh: New file.
6235 * testsuite/script_test_6.t: Same.
6236 * testsuite/script_test_7.sh: Same.
6237 * testsuite/script_test_7.t: Same.
6238 * testsuite/script_test_8.sh: Same.
6239
64b1ae37
DK
62402009-10-16 Doug Kwan <dougkwan@google.com>
6241
6242 * output.cc (Output_segment::set_section_list_address): Cast
6243 expressions to unsigned long long type to avoid format warnings.
6244
661be1e2
ILT
62452009-10-15 Ian Lance Taylor <iant@google.com>
6246
12edd763 6247 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 6248 dot assignment to script_sections_.
12edd763
ILT
6249 * script-sections.cc (Script_sections::add_dot_assignment):
6250 Initialize if necessary.
6251
68b6574b
ILT
6252 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6253 program headers with no load segment if there is a linker script.
6254
661be1e2
ILT
6255 * layout.cc (Layout::set_segment_offsets): Align the file offset
6256 to the segment aligment for -N or -n with no load segment.
6257 * output.cc (Output_segment::add_output_section): Don't crash if
6258 the first section is a TLS section.
6259 (Output_segment::set_section_list_addresses): Print an error
6260 message if the address moves backward in a linker script.
6261 * script-sections.cc
6262 (Output_section_element_input::set_section_addresses): Don't
6263 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6264 (Orphan_output_section::set_section_addresses): Likewise.
6265
f15f61a7
DK
62662009-10-15 Doug Kwan <dougkwan@google.com>
6267
6268 * layout.cc (Layout::finish_dynamic_section): Generate tags
6269 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6270 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6271 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6272
82bb573a
ILT
62732009-10-14 Ian Lance Taylor <iant@google.com>
6274
6275 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6276 fields.
6277 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6278 data_shdr fields of relinfo.
6279 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6280 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6281 R_386_TLS_LDO_32, adjust based on section flags.
6282 (Target_i386::Relocate::fix_up_ldo): Remove.
6283
374ad285
ILT
62842009-10-13 Ian Lance Taylor <iant@google.com>
6285
6286 Add support for -pie.
6287 * options.h (class General_options): Add -pie and
6288 --pic-executable.
6289 (General_options::output_is_position_independent): Test -pie.
6290 (General_options::output_is_executable): Return true if not shared
6291 and not relocatable.
6292 (General_options::output_is_pie): Remove.
6293 * options.cc (General_options::finalize): Reject incompatible uses
6294 of -pie.
6295 * gold.cc (queue_middle_tasks): A -pie link is not static.
6296 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6297 * symtab.cc (Symbol::final_value_is_known): Return false if
6298 output_is_position_independent.
6299 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6300 output_is_position_independent.
6301 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6302 output_is_position_independent.
6303 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6304 output_is_position_independent.
6305 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6306 two_file_pie_test.
6307 (basic_pie_test.o, basic_pie_test): New targets.
6308 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6309 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6310 (two_file_pie_test): New target.
6311 * testsuite/Makefile.in: Rebuild.
6312 * README: Remove note saying that -pie is not supported.
6313
c6585162
ILT
63142009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6315
6316 * options.h (class General_options): Add -init and -fini.
6317 * layout.cc (Layout::finish_dynamic_section): Emit
6318 given init and fini functions.
6319
032ce4e9
ST
63202009-10-13 Sriraman Tallam <tmsriram@google.com>
6321
6322 * gc.h (gc_process_relocs): Check if icf is enabled using new
6323 function.
6324 * gold.cc (queue_initial_tasks): Likewise.
6325 (queue_middle_tasks): Likewise.
6326 * object.cc (do_layout): Likewise.
6327 * symtab.cc (is_section_folded): Likewise.
6328 * main.cc (main): Likewise.
6329 * reloc.cc (Read_relocs::run): Likewise.
6330 (Sized_relobj::do_scan_relocs): Likewise.
6331 * icf.cc (is_function_ctor_or_dtor): New function.
6332 (Icf::find_identical_sections): Check if function is ctor or dtor when
6333 safe icf is chosen.
6334 * options.h (General_options::icf): Change option to be an enum.
6335 (Icf_status): New enum.
6336 (icf_enabled): New method.
6337 (icf_safe_folding): New method.
6338 (set_icf_status): New method.
6339 (icf_status_): New variable.
6340 * (options.cc) (General_options::finalize): Set icf_status_.
6341 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6342 icf_test and icf_keep_unique_test to use the --icf enum flag.
6343 * testsuite/icf_safe_test.sh: New file.
e1df38aa 6344 * testsuite/icf_safe_test.cc: New file.
032ce4e9 6345
f345227a
ST
63462009-10-12 Sriraman Tallam <tmsriram@google.com>
6347
6348 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6349 includes to gc.h and icf.h.
6350 * arm.cc: Include gc.h.
6351 * gold.cc: Likewise.
6352 * i386.cc: Likewise.
6353 * powerpc.cc: Likewise.
6354 * sparc.cc: Likewise.
6355 * x86_64.cc: Likewise.
6356 * gc.h: Include icf.h.
6357
1c7814ed
ILT
63582009-10-11 Ian Lance Taylor <iant@google.com>
6359
6360 * plugin.cc: Include "gold.h" before other header files.
6361
ae3b5189
CD
63622009-10-10 Chris Demetriou <cgd@google.com>
6363
6364 * options.h (Input_file_argument::Input_file_type): New enum.
6365 (Input_file_argument::is_lib_): Replace with...
6366 (Input_file_argument::type_): New member.
6367 (Input_file_argument::Input_file_argument): Take Input_file_type
6368 'type' rather than boolean 'is_lib' as second argument.
6369 (Input_file_argument::is_lib): Use type_.
6370 (Input_file_argument::is_searched_file): New function.
6371 (Input_file_argument::may_need_search): Handle is_searched_file.
6372 * options.cc (General_options::parse_library): Support -l:filename.
6373 (General_options::parse_just_symbols): Update for Input_file_argument
6374 changes.
6375 (Command_line::process): Likewise.
6376 * archive.cc (Archive::get_file_and_offset): Likewise.
6377 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6378 * script.cc (read_script_file, script_add_file): Likewise.
6379 * fileread.cc (Input_file::Input_file): Likewise.
6380 (Input_file::will_search_for): Handle is_searched_file.
6381 (Input_file::open): Likewise.
6382 * readsyms.cc (Read_symbols::get_name): Likewise.
6383 * testsuite/Makefile.am (searched_file_test): New test.
6384 * testsuite/Makefile.in: Regenerate.
6385 * testsuite/searched_file_test.cc: New file.
6386 * testsuite/searched_file_test_lib.cc: New file.
6387
f3048a1d
ILT
63882009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6389 Ian Lance Taylor <iant@google.com>
6390
6391 * descriptor.cc: Include <cstdio> and "binary-io.h".
6392 (Descriptors::open): Open the files in binary mode always.
6393 * script.cc (Lex::get_token): Treat \r as whitespace.
6394
d4780e57
ILT
63952009-10-09 Ian Lance Taylor <iant@google.com>
6396
6397 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6398
d9a893b8
ILT
63992009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6400 Ian Lance Taylor <iant@google.com>
6401
6402 * configure.ac: Check for readv function also.
6403 * fileread.cc (readv): Define if not HAVE_READV.
6404 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6405 does not exist.
6406 * config.in: Regenerate.
6407 * configure: Regenerate.
6408
c0a62865
DK
64092009-10-09 Doug Kwan <dougkwan@google.com>
6410
6411 * layout.cc (Layout::make_output_section): Call target hook to make
6412 ordinary output section.
6413 (Layout::finalize): Adjust parameter list of call the
6414 Target::may_relax().
6415 * layout.h (class Layout::section_list): New method.
6416 * merge.h (Output_merge_base::entsize): Change visibility to public.
6417 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6418 New methods.
6419 (Output_merge_string::do_is_string): New method.
6420 * object.cc (Sized_relobj::do_setup): renamed from
6421 Sized_relobj::set_up.
6422 * object.h (Sized_relobj::adjust_shndx,
6423 Sized_relobj::initializ_input_to_output_maps,
6424 Sized_relobj::free_input_to_output_maps): Change visibilities to
6425 protected.
6426 (Sized_relobj::setup): Virtualize.
6427 (Sized_relobj::do_setup): New method declaration.
6428 (Sized_relobj::invalidate_section_offset,
6429 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6430 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6431 * options.cc (parse_int): New function.
6432 * options.h (parse_int): New declaration.
6433 (DEFINE_int): New macro.
6434 (stub_group_size): New option.
6435 * output.cc (Output_section::Output_section): Initialize memebers
6436 merge_section_map_, merge_section_by_properties_map_,
6437 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6438 (Output_section::add_input_section): Handled deferred code-fill
6439 generation and remove an old comment.
6440 (Output_section::add_relaxed_input_section): New method definition.
6441 (Output_section::add_merge_input_section): Use merge section by
6442 properties map to speed to search. Update merge section maps
6443 as appropriate.
6444 (Output_section::build_relaxation_map): New method definition.
6445 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6446 Same.
6447 (Output_section::relax_input_section): Renamed to
6448 Output_section::convert_input_sections_to_relaxed_sections and change
6449 interface to take a vector of pointers to relaxed sections.
6450 (Output_section::find_merge_section,
6451 Output_section::find_relaxed_input_section): New method definitions.
6452 (Output_section::is_input_address_mapped,
6453 Output_section::output_offset, Output_section::output_address):
6454 Use output section data maps to speed up searching.
6455 (Output_section::find_starting_output_address): Add comments.
6456 (Output_section::do_write,
6457 Output_section::write_to_postprocessing_buffer): Do code-fill
6458 generation as appropriate.
6459 (Output_section::get_input_sections): Invalidate relaxed input section
6460 map.
6461 (Output_section::restore_states): Adjust type of checkpoint .
6462 Invalidate relaxed input section map.
6463 * output.h (Output_merge_base): New class declaration.
6464 (Input_section_specifier): New class defintion.
6465 (class Output_relaxed_input_section) Change base class to
6466 Output_section_data_build.
6467 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6468 base class initializer.
6469 (Output_section::add_relaxed_input_section): New method declaration.
6470 (Output_section::Input_section): Change visibility to protected.
6471 (Output_section::Input_section::relobj,
6472 Output_section::Input_section::shndx): Handle relaxed input sections.
6473 Output_section::input_sections) Change visibility to protected. Also
6474 define overload to return a non-const pointer.
6475 (Output_section::Merge_section_properties): New class defintion.
6476 (Output_section::Merge_section_by_properties_map,
6477 Output_section::Output_section_data_by_input_section_map,
6478 Output_section::Relaxation_map): New types.
6479 (Output_section::relax_input_section): Rename method to
6480 Output_section::convert_input_sections_to_relaxed_sections and change
6481 interface to take a vector of relaxed section pointers.
6482 (Output_section::find_merge_section,
6483 Output_section::find_relaxed_input_section,
6484 Output_section::build_relaxation_map,
6485 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6486 New method declarations.
6487 (Output_section::merge_section_map_
6488 Output_section::merge_section_by_properties_map_,
6489 Output_section::relaxed_input_section_map_,
6490 Output_section::is_relaxed_input_section_map_valid_,
6491 Output_section::generate_code_fills_at_write_): New data members.
6492 * script-sections.cc
6493 (Output_section_element_input::set_section_addresses): Call
6494 current_data_size and addralign methods of relaxed input sections.
6495 (Orphan_output_section::set_section_addresses): Call current_data_size
6496 and addralign methods of relaxed input sections.
6497 * symtab.cc (Symbol_table::compute_final_value): Extract template
6498 from the body of Symbol_table::sized_finalize_symbol.
6499 (Symbol_table::sized_finalized_symbol): Call
6500 Symbol_table::compute_final_value.
6501 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6502 (Symbol_table::compute_final_value): New templated method declaration.
6503 * target.cc (Target::do_make_output_section): New method defintion.
6504 * target.h (Target::make_output_section): New method declaration.
6505 (Target::relax): Add more parameters for input objects, symbol table
6506 and layout. Adjust call to do_relax.
6507 (Target::do_make_output_section): New method declaration.
6508 (Target::do_relax): Add parameters for input objects, symbol table
6509 and layout.
6510
d446d6c4
ILT
65112009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6512
6513 * pread.c: Include stdio.h.
6514
bc06c745
ILT
65152009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6516
6517 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6518 defined.
6519
75aea3d0
ILT
65202009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6521
6522 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6523 Change read_shndx type to unsigned int.
6524 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6525 int.
6526 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6527 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6528 Change read_shndx type to unsigned int.
6529 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6530 int.
6531 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6532 * layout.cc (Layout::create_symtab_sections): Cast the result of
6533 local_symcount * symsize to off_t in the gold_assert.
6534
be8fcb75
ILT
65352009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6536
6537 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6538 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6539 R_ARM_BASE_ABS.
6540 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6541 (Arm_relocate_functions::thm_abs5): New function.
6542 (Arm_relocate_functions::abs12): New function.
6543 (Arm_relocate_functions::abs16): New function.
6544 (Arm_relocate_functions::base_abs): New function.
6545 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6546 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6547 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6548 R_ARM_BASE_ABS.
6549 (Scan::global): Likewise.
6550 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6551 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6552 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6553 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6554 R_ARM_BASE_ABS.
6555
c2a122b6
ILT
65562009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6557
6558 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6559 (Arm_relocate_functions::movt_prel): New function.
6560 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6561 (Arm_relocate_functions::thm_movt_prel): New function.
6562 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6563 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6564 (Scan::global, Relocate::relocate): Likewise.
6565 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6566
c4aa1e2d
ILT
65672009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6568
6569 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6570 Incremental_checker.
6571 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6572 unsigned int.
6573 (class Incremental_inputs_header): New class.
6574 (Incremental_inputs_header_writer): Edit comment.
6575 (Incremental_inputs_entry): New class.
6576 (Incremental_inputs_entry_writer): Edit comment.
6577 (Sized_incremental_binary::do_find_incremental_inputs_section):
6578 Add *strtab_shndx parameter, fill it.
6579 (Sized_incremental_binary::do_check_inputs): New method.
6580 (Incremental_checker::can_incrementally_link_output_file): Use
6581 Sized_incremental_binary::check_inputs.
6582 (Incremental_inputs::report_command_line): Save command line in
6583 command_line_.
6584 * incremental.h:
6585 (Incremental_binary::find_incremental_inputs_section): New
6586 method.
6587 (Incremental_binary::do_find_incremental_inputs_section): Add
6588 strtab_shndx parameter.
6589 (Incremental_binary::do_check_inputs): New pure virtual method.
6590 (Sized_incremental_binary::do_check_inputs): Declare.
6591 (Incremental_checker::Incremental_checker): Add incremental_inputs
6592 parameter, use it to initialize incremental_inputs_.
6593 (Incremental_checker::incremental_inputs_): New field.
6594 (Incremental_checker::command_line): New method.
6595 (Incremental_checker::inputs): New method.
6596 (Incremental_checker::command_line_): New field.
6597
c549a694
ILT
65982009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6599
6600 * incremental.cc: Include <cstdarg> and "target-select.h".
6601 (vexplain_no_incremental): New function.
6602 (explain_no_incremental): New function.
6603 (Incremental_binary::error): New method.
6604 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6605 method.
6606 (make_sized_incremental_binary): New function.
6607 (open_incremental_binary): New function.
6608 (can_incrementally_link_file): Add checks if output is ELF and has
6609 inputs section.
6610 * incremental.h: Include "elfcpp_file.h" and "output.h".
6611 (Incremental_binary): New class.
6612 (Sized_incremental_binary): New class.
6613 (open_incremental_binary): Declare.
6614 * object.cc (is_elf_object): Use
6615 elfcpp::Elf_recognizer::is_elf_file.
6616 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6617 * output.h (Output_file::filesize): New method.
6618
fd3c5f0b
ILT
66192009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6620
6621 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6622 New function.
6623 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6624 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6625 function.
6626 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6627 function.
6628 (Arm_relocate_functions::movw_abs_nc): New function.
6629 (Arm_relocate_functions::movt_abs): New function.
6630 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6631 (Arm_relocate_functions::thm_movt_abs): New function.
6632 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6633 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6634 (Scan::global): Likewise.
6635 (Relocate::relocate): Likewise.
6636 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6637
7f5309a5
ILT
66382009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6639
6640 * arm.cc (Arm_relocate_functions::got_prel) New function.
6641 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6642 (Relocate::relocate): Likewise.
6643 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6644
364c7fa5
ILT
66452009-10-06 Ian Lance Taylor <iant@google.com>
6646
6647 * options.h (class General_options): Define
6648 split_stack_adjust_size parameter.
6649 * object.h (class Object): Add uses_split_stack_ and
6650 has_no_split_stack_ fields. Add uses_split_stack and
6651 has_no_split_stack accessor functions. Declare
6652 handle_split_stack_section.
6653 (class Reloc_symbol_changes): Define.
6654 (class Sized_relobj): Define Function_offsets. Declare
6655 split_stack_adjust, split_stack_adjust_reltype, and
6656 find_functions.
6657 * object.cc (Object::handle_split_stack_section): New function.
6658 (Sized_relobj::do_layout): Call handle_split_stack_section.
6659 * dynobj.cc (Sized_dynobj::do_layout): Call
6660 handle_split_stack_section.
6661 * reloc.cc (Sized_relobj::relocate_sections): Call
6662 split_stack_adjust for executable sections in split_stack
6663 objects. Pass reloc_map to relocate_section.
6664 (Sized_relobj::split_stack_adjust): New function.
6665 (Sized_relobj::split_stack_adjust_reltype): New function.
6666 (Sized_relobj::find_functions): New function.
6667 * target-reloc.h: Include "object.h".
6668 (relocate_section): Add reloc_symbol_changes parameter. Change
6669 all callers.
6670 * target.h (class Target): Add calls_non_split method. Declare
6671 do_calls_non_split virtual method. Declare match_view and
6672 set_view_to_nop.
6673 * target.cc: Include "elfcpp.h".
6674 (Target::do_calls_non_split): New function.
6675 (Target::match_view): New function.
6676 (Target::set_view_to_nop): New function.
6677 * gold.cc (queue_middle_tasks): Give an error if mixing
6678 split-stack and non-split-stack objects with -r.
6679 * i386.cc (Target_i386::relocate_section): Add
6680 reloc_symbol_changes parameter.
6681 (Target_i386::do_calls_non_split): New function.
6682 * x86_64.cc (Target_x86_64::relocate_section): Add
6683 reloc_symbol_changes parameter.
6684 (Target_x86_64::do_calls_non_split): New function.
6685 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6686 parameter.
6687 * powerpc.cc (Target_powerpc::relocate_section): Add
6688 reloc_symbol_changes parameter.
6689 * sparc.cc (Target_sparc::relocate_section): Add
6690 reloc_symbol_changes parameter.
6691 * configure.ac: Call AM_CONDITIONAL for the default target.
6692 * configure: Rebuild.
6693 * testsuite/Makefile.am (TEST_AS): New variable.
6694 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6695 (check_DATA): Add split_i386 and split_x86_64 files.
6696 (SPLIT_DEFSYMS): Define.
6697 (split_i386_[1234n].o): New targets.
6698 (split_i386_[124]): New targets.
6699 (split_i386_[1234r].stdout): New targets.
6700 (split_x86_64_[1234n].o): New targets.
6701 (split_x86_64_[124]): New targets.
6702 (split_x86_64_[1234r].stdout): New targets.
6703 (MOSTLYCLEANFILES): Add new executables.
6704 * testsuite/split_i386.sh: New file.
6705 * testsuite/split_x86_64.sh: New file.
6706 * testsuite/split_i386_1.s: New file.
6707 * testsuite/split_i386_2.s: New file.
6708 * testsuite/split_i386_3.s: New file.
6709 * testsuite/split_i386_4.s: New file.
6710 * testsuite/split_i386_n.s: New file.
6711 * testsuite/split_x86_64_1.s: New file.
6712 * testsuite/split_x86_64_2.s: New file.
6713 * testsuite/split_x86_64_3.s: New file.
6714 * testsuite/split_x86_64_4.s: New file.
6715 * testsuite/split_x86_64_n.s: New file.
6716 * testsuite/testfile.cc (Target_test): Update relocation_section
6717 function.
6718 * testsuite/Makefile.in: Rebuild.
6719
e8a9fcda
ILT
67202009-10-06 Ian Lance Taylor <iant@google.com>
6721
6722 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6723 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6724 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6725 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6726 the address on ldo_addrs_.
6727 (Target_i386::Relocate::fix_up_ldo): New function.
6728
e99daf92
ILT
67292009-10-06 Rafael Espindola <espindola@google.com>
6730
6731 * plugin.cc (add_input_library): New.
6732 (Plugin::load): Add add_input_library to tv.
6733 (Plugin_manager::add_input_file): Add the is_lib argument.
6734 (add_input_file): Update call to Plugin_manager::add_input_file.
6735 (add_input_library): New.
6736 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6737
966d4097
DK
67382009-09-30 Doug Kwan <dougkwan@google.com>
6739
6740 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6741 symbol and call Symbol::may_need_copy_reloc to determine if
6742 a copy reloc is needed.
6743 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6744 nocopyreloc is given in command line.
6745 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6746 given in command line.
6747 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6748 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6749 of the removed Target_i386::may_need_copy_reloc.
6750 * options.h (copyreloc): New option with default value false.
6751 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6752 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6753 instead of the removed Target_powerpc::may_need_copy_reloc.
6754 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6755 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6756 instead of the removed Target_sparc::may_need_copy_reloc.
6757 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6758 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6759 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6760 instead of the removed Target_x86_64::may_need_copy_reloc.
6761
029ba973
ILT
67622009-09-30 Ian Lance Taylor <iant@google.com>
6763
6764 * object.h (class Object): Remove target_ field, and target,
6765 sized_target, and set_target methods.
6766 (Object::sized_target): Remove.
6767 (class Sized_relobj): Update declarations. Remove sized_target.
6768 * object.cc (Sized_relobj::setup): Remove target parameter.
6769 Change all callers.
6770 (Input_objects::add_object): Don't do anything with the target.
6771 (make_elf_sized_object): Add punconfigured parameter. Change all
6772 callers. Set or test parameter target.
6773 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6774 Change all callers.
6775 * parameters.cc (Parameters::set_target): Change parameter type to
6776 be non-const.
6777 (Parameters::default_target): Remove.
6778 (set_parameters_target): Change parameter type to be non-const.
6779 (parameters_force_valid_target): New function.
6780 (parameters_clear_target): New function.
6781 * parameters.h (class Parameters): Update declarations. Remove
6782 default_target method. Add sized_target and clear_target
6783 methods. Change target_ to be non-const.
6784 (set_parameters_target): Update declaration.
6785 (parameters_force_valid_target): Declare.
6786 (parameters_clear_target): Declare.
6787 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6788 as NULL if we aren't searching.
6789 (Add_symbols::run): Don't check for compatible target.
6790 * fileread.cc (Input_file::open_binary): Call
6791 parameters_force_valid_target.
6792 * gold.cc (queue_middle_tasks): Likewise.
6793 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6794 set_target on object.
6795 * dynobj.h (class Sized_dynobj): Update declarations.
6796 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6797 make_elf_object returns NULL.
6798 (Archive::include_member): Don't check whether object target is
6799 compatible.
6800 * output.cc (Output_section::add_input_section): Get target from
6801 parameters.
6802 (Output_section::relax_input_section): Likewise.
6803 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6804 parameters.
6805 (Sized_relobj::do_scan_relocs): Likewise.
6806 (Sized_relobj::relocate_sections): Likewise.
6807 * resolve.cc (Symbol_table::resolve): Likewise.
6808 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6809 parameter. Change all callers.
6810 (Symbol_table::add_from_object): Get target from parameters.
6811 (Symbol_table::add_from_relobj): Don't check object target.
6812 (Symbol_table::add_from_dynobj): Likewise.
6813 (Symbol_table::define_special_symbol): Get target from
6814 parameters.
6815 * symtab.h (class Symbol_table): Update declaration.
6816 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6817 parameter. Change all callers. Clear parameter target.
6818 (Binary_test): Test target here.
6819 * testsuite/object_unittest.cc (gold_testsuite): Remove
6820 target_test_pointer parameter. Change all callers.
6821 (Object_test): Test target here.
6822
a6a22b83
ILT
68232009-09-26 Ian Lance Taylor <iant@google.com>
6824
6825 * testsuite/initpri1.c: Don't try to use constructor priorities if
6826 compiling with gcc before 4.3.
6827
6a8f49fe
ILT
68282009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6829
6830 * testsuite/retain_symbols_file_test.sh (check_present): Change
6831 output file name to retain_symbols_file_test.stdout.
6832 (check_absent): Likewise.
6833
8c604651
CS
68342009-09-18 Craig Silverstein <csilvers@google.com>
6835
6836 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6837 * options.cc: Include <cerrno> and <fstream>.
6838 (General_options::finalize): Parse -retain-symbols-file tag.
6839 * options.h: New flag.
6840 (General_options): New method should_retain_symbol, new
6841 variable symbols_to_retain.
6842 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6843 should_retain_symbol map.
6844 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6845 * testsuite/Makefile.in: Regenerate.
6846 * testsuite/retain_symbols_file_test.sh: New file.
6847
ca58b19f
NC
68482009-09-18 Nick Clifton <nickc@redhat.com>
6849
6850 * po/es.po: Updated Spanish translation.
6851
20e6d0d6
DK
68522009-09-17 Doug Kwan <dougkwan@google.com>
6853
6854 * debug.h (DEBUG_RELAXATION): New constant.
6855 (DEBUG_ALL): Add DEBUG_RELAXATION.
6856 (debug_string_to_enum): Add relaxation debug option.
6857 * layout.cc
6858 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6859 Layout::Relaxation_debug_check::read_sections,
6860 Layout::Relaxation_debug_check::read_sections): New method definitions.
6861 (Layout::Layout): Initialize data members
6862 record_output_section_data_from_scrips_,
6863 script_output_section_data_list_ and relaxation_debug_check_.
6864 (Layout::save_segments, Layout::restore_segments,
6865 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6866 Layout::relaxation_loop_body): New method definitions.
6867 (Layout::finalize): Support relaxation. Move section layout code to
6868 Layout::relaxation_loop_body.
6869 (Layout::set_asection_address_from_script): Move code for orphan
6870 section placement out.
6871 (Layout::place_orphan_sections_in_script): New method definition.
6872 * layout.h (Output_segment_headers, Output_file_header):
6873 New forward class declarations.
6874 (Layout::~Layout): Define.
6875 (Layout::new_output_section_data_from_script): New method definition.
6876 (Layout::place_orphan_sections_in_script): New method declaration.
6877 (Layout::Segment_states): New type declaration.
6878 (Layout::save_segments, Layout::restore_segments,
6879 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6880 Layout::relaxation_loop_body): New method declarations.
6881 (Layout::Output_section_data_list): New type declaration.
6882 (Layout::Relaxation_debug_check): New class definition.
6883 (Layout::record_output_section_data_from_script_,
6884 Layout::script_output_section_data_list_, Layout::segment_states_,
6885 Layout::relaxation_debug_check_): New data members.
6886 * output.cc: (Output_section_headers::do_size): New method definition.
6887 (Output_section_headers::Output_section_headers): Move size
6888 computation to Output_section_headers::do_size.
6889 (Output_segment_headers::do_size): New method definition.
e1df38aa 6890 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
6891 Output_file_header::do_size and call it.
6892 (Output_file_header::do_size): New method definition.
6893 (Output_data_group::Output_data_group): Adjust call to
6894 Output_section_data.
6895 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6896 (Output_symtab_xindex::do_write): Add array bound check.
6897 (Output_section::Input_section::print_to_mapfile): Handle
6898 RELAXED_INPUT_SECTION_CODE.
6899 (Output_section::Output_section): Initialize data member checkpoint_.
6900 (Output_section::~Output_section): Delete checkpoint object pointed
6901 by checkpoint_.
6902 (Output_section::add_input_section): Always add an Input_section if
6903 relaxing.
6904 (Output_section::add_merge_input_section): Add assert.
6905 (Output_section::relax_input_section): New method definition.
6906 (Output_section::set_final_data_size): Set load address to zero for
6907 an unallocated section.
6908 (Output_section::do_address_and_file_offset_have_reset_values):
6909 New method definition.
6910 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6911 Handle relaxed input section.
6912 (Output_section::sort_attached_input_sections): Checkpoint input
6913 section list lazily.
6914 (Output_section::get_input_sections): Change type of input_sections to
6915 list of Simple_input_section pointers. Checkpoint input section list
6916 lazily. Also handle relaxed input sections.
6917 (Output_section::add_input_section_for_script): Take a reference to
6918 a Simple_input_section object instead of Relobj pointer and section
6919 index as parameter. Handle relaxed input sections.
6920 (Output_section::save_states, Output_section::restore_states): New
6921 method definitions.
6922 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6923 (Output_data::is_data_size_fixed): New method definition.
6924 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6925 if it is fixed.
6926 (Output_data::address_and_file_offset_have_reset_values): New method
6927 definition.
6928 (Output_data::do_address_and_file_offset_have_reset_values): New method
6929 definition.
6930 (Output_data::set_data_size): Check that data size is not fixed.
6931 (Output_data::fix_data_size): New method definition.
6932 (Output_data::is_data_size_fixed_): New data member.
6933 (Output_section_headers::set_final_data_size): New method definition.
6934 (Output_section_headers::do_size): New method declaration.
6935 (Output_segment_headers::set_final_data_size): New method definition.
6936 (Output_segment_headers::do_size): New method declaration.
6937 (Output_file_header::set_final_data_size)::New method definition.
6938 (Output_file_header::do_size)::New method declaration.
6939 (Output_section_data::Output_section_data): Add new parameter
6940 is_data_size_fixed and use it to fix data size.
6941 (Output_data_const::Output_data_const): Adjust call to base class
6942 constructor and fix data size.
6943 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6944 base class constructor and fix data size.
6945 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6946 base class constructor and fix data size.
6947 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6948 class constructor and fix data size.
6949 (Output_data_group::set_final_data_size): New method definition.
6950 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6951 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6952 class constructor and fix data size.
6953 (Output_relaxed_input_section): New class definition.
6954 (Output_section::Simple_input_section): New class definition.
6955 (Output_section::get_input_sections): Adjust parameter list.
6956 (Output_section::add_input_section_for_script): Same.
6957 (Output_section::save_states, Output_section::restore_states,
6958 Output_section::do_address_and_file_offset_have_reset_values,
6959 (Output_section::Input_section::Input_section): Handle
6960 RELAXED_INPUT_SECTION_CODE. Add new overload for
6961 Output_relaxed_input_section.
6962 (Output_section::Input_section::is_input_section,
6963 Output_section::Input_section::set_output_section): Handle relaxed
6964 input section.
6965 (Output_section::Input_section::is_relaxed_input_section,
6966 Output_section::Input_section::output_section_data,
6967 Output_section::Input_section::relaxed_input_section): New method
6968 definitions.
6969 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6970 value.
6971 (Output_section::Input_section::u1_): Update comments.
6972 (Output_section::Input_section::u2_): Add new union member poris.
6973 (Output_section::Checkpoint_output_section): New classs definition.
6974 (Output_section::relax_input_section): New method declaration.
6975 (Output_section::checkpoint_): New data member.
6976 (Output_segment): Update comments.
6977 (Output_segment::Output_segment): Un-privatize copy constructor.
6978 (Output_segment::operator=): Un-privatize.
6979 * script-sections.cc (Output_section_element::Input_section_list):
6980 Change element type to Output_section::Simple_input_section.
6981 (Output_section_element_dot_assignment::set_section_addresses):
6982 Register output section data for relaxation clean up.
6983 (Output_data_exression::Output_data_expression): Adjust call to base
6984 constructor to fix data size.
6985 (Output_section_element_data::set_section_addresses): Register
6986 Output_data_expression object for relaxation clean up.
6987 (struct Input_section_info): Replace Relobj pointer and section index
6988 pair with Output_section::Simple_input_section and Convert struct to a
6989 class.
6990 (Input_section_sorter::operator()): Adjust access to
e1df38aa 6991 Input_section_info data member to use accessors.
20e6d0d6
DK
6992 (Output_section_element_input::set_section_addresses): Use layout
6993 parameter. Adjust code to use Output_section::Simple_input_section
6994 and Input_secction_info classes. Register filler for relaxation
6995 clean up.
6996 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6997 and section index pair with Output_section::Simple_input_section
6998 class. Adjust code accordingly.
6999 (Phdrs_element::release_segment): New method definition.
7000 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7001 segment list.
7002 (Script_sections::release_segments): New method definition.
7003 * gold/script-sections.h (Script_sections::release_segments): New
7004 method declaration.
7005 * gold/target.h (Target::may_relax, Target::relax,
7006 Target::do_may_relax, Target::do_relax): New method definitions.
7007
5e445df6
ILT
70082009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7009
7010 * arm.cc (has_signed_unsigned_overflow): New function.
7011 (Arm_relocate_functions::abs8): New function.
7012 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7013 (Target_arm::Scan::global): Likewise.
7014 (Target_arm::relocate::relocate): Likewise.
7015 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7016 Likewise.
7017
8c604651 70182009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
7019
7020 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7021 * testsuite/Makefile.in: Regenerate.
7022
1e9cc1c2
NC
70232009-09-11 Nick Clifton <nickc@redhat.com>
7024
7025 * po/gold.pot: Updated by the Translation project.
7026
6a89f575
CC
70272009-09-08 Cary Coutant <ccoutant@google.com>
7028
7029 * output.cc (Output_file::open): Add execute permission to empty file.
7030 * testsuite/Makefile.am (permission_test): New test.
7031 * testsuite/Makefile.in: Regenerate.
7032
fdcac5af
ILT
70332009-09-02 Ian Lance Taylor <iant@google.com>
7034
7035 * output.cc (Output_file::resize): Call map_no_anonymous rather
7036 than map.
7037
44453f85
ILT
70382009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7039
7040 * gold.cc: Include "incremental.h".
7041 (queue_initial_tasks): Call Incremental_checker methods.
7042 * incremental.cc: Include "output.h".
7043 (Incremental_checker::can_incrementally_link_output_file): New
7044 method.
7045 * incremental.h (Incremental_checker): New class.
7046
7047 * output.cc (Output_file::open_for_modification): New method.
7048 (Output_file::map_anonymous): Changed return type to bool. Record
7049 map in base_ field.
7050 (Output_file::map_no_anonymous): New method, broken out of map.
7051 (Output_file::map): Use map_no_anonymous and map_anonymous.
7052 * output.h (class Output_file): Update declarations.
7053
293c1386
CC
70542009-08-24 Cary Coutant <ccoutant@google.com>
7055
7056 * options.h (Command_line::Pre_options): New class.
7057 (Command_line::pre_options): New member.
7058 * options.cc (gold::options::ready_to_register): New variable.
7059 (One_option::register_option): Do nothing if not registering options.
7060 Assert if same short option registered twice.
7061 (General_options::General_options): Turn off option registration when
7062 done constructing.
7063 (Command_line::Pre_options::Pre_options): New constructor.
7064
f773f3d2
CC
70652009-08-24 Cary Coutant <ccoutant@google.com>
7066
06a73cfe
CC
7067 * options.h (General_options::no_keep_memory): Remove incorrect
7068 short option.
f773f3d2 7069
a15af8e2
RW
70702009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7071
7072 * Makefile.am (am__skiplex, am__skipyacc): New.
7073 * Makefile.in: Regenerate.
7074
c462b41b
RW
70752009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7076
14ec8efd
RW
7077 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7078 (INCLUDES): ... this.
7079 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7080 (AM_CPPFLAGS): Renamed from ...
7081 (INCLUDE): ... this.
7082 * Makefile.in, testsuite/Makefile.in: Regenerate.
7083
81ecdfbb
RW
7084 * Makefile.in: Regenerate.
7085 * aclocal.m4: Likewise.
7086 * config.in: Likewise.
7087 * configure: Likewise.
7088 * testsuite/Makefile.in: Likewise.
7089
c462b41b
RW
7090 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7091 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7092 * Makefile.in: Regenerate.
7093 * testsuite/Makefile.in: Regenerate.
7094
2da73f13
CC
70952009-08-19 Cary Coutant <ccoutant@google.com>
7096
7097 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7098 symbols in shared libraries overridden by hidden or internal symbols
7099 in the main program.
7100
2db70501
CD
71012009-08-19 Chris Demetriou <cgd@google.com>
7102
7103 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7104 checking source file names in error messages.
7105
f733487b
DK
71062009-08-18 Doug Kwan <dougkwan@google.com>
7107
7108 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7109 an elcpp::Ehdr as parameter. Adjust call to set_target.
7110 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7111 an elfcpp::Ehdr as parameter.
7112 * object.cc (Object::set_target): Remove the version that looks up
7113 a target and sets it.
7114 (Sized_relobj::setup): Take a Target object instead of
7115 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7116 (make_elf_sized_object): Find target and ask target to
7117 make an ELF object.
7118 * object.h: (Object::set_target): Remove the version that looks up
7119 a target and sets it.
7120 (Sized_relobj::setup): Take a Target object instead of
7121 an elfcpp:Ehdr as parameter.
7122 * target.cc: Include dynobj.h.
7123 (Target::do_make_elf_object_implementation): New.
7124 (Target::do_make_elf_object): New.
7125 * target.h (Target::make_elf_object): New template declaration.
7126 (Target::do_make_elf_object): New method declarations.
7127 (Target::do_make_elf_object_implementation): New template declaration.
7128
cc70f101
ILT
71292009-08-14 Ian Lance Taylor <iant@google.com>
7130
7131 * gold.h (FUNCTION_NAME): Define.
7132 (gold_unreachable): Use FUNCTION_NAME.
7133
ef5e0cb1
ST
71342009-08-12 Sriraman Tallam <tmsriram@google.com>
7135
7136 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7137 symbol in the --keep-unique list is not found.
7138
48c187ce
ST
71392009-08-12 Sriraman Tallam <tmsriram@google.com>
7140
7141 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7142 been maked as --keep-unique.
7143 (Icf::unfold_section): New function.
7144 * icf.h (Icf::unfold_section): New function.
7145 * options.h (General_options::keep_unique): New option.
7146 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7147 * testsuite/Makefile.in: Regenerate.
7148 * testsuite/icf_keep_unique_test.sh: New file.
7149 * testsuite/icf_keep_unique_test.cc: New file.
7150
645afe0c
CC
71512009-08-12 Cary Coutant <ccoutant@google.com>
7152
7153 PR 10471
7154 * resolve.cc (Symbol_table::resolve): Check for references from
7155 dynamic objects to hidden and internal symbols.
7156 * testsuite/Makefile.am (hidden_test.sh): New test.
7157 * testsuite/Makefile.in: Regenerate.
7158 * testsuite/hidden_test.sh: New script.
7159 * testsuite/hidden_test_1.c: New test source.
7160 * testsuite/hidden_test_main.c: New test source.
7161
11af873f
DK
71622009-08-11 Doug Kwan <dougkwan@google.com>
7163
7164 * arm.cc: Update comments.
7165 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7166 segment to locate the .ARM.exidx section if present.
7167
b9f7d72d
DK
71682009-08-09 Doug Kwan <dougkwan@google.com>
7169
7170 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7171 patch.
7172
ddd3c53c
ST
71732009-08-07 Sriraman Tallam <tmsriram@google.com>
7174 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7175 compiler warnings.
7176
27721062
ST
71772009-08-06 Sriraman Tallam <tmsriram@google.com>
7178
7179 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7180 valid tls_segment only for non-debug-section relocations.
7181 * testsuite/Makefile.am: Add gc_tls_test.
7182 * testsuite/Makefile.in: Regenerate.
7183 * testsuite/gc_tls_test.cc: New file.
7184 * testsuite/gc_tls_test.sh: New file.
7185
ef15dade 71862009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 7187
ef15dade
ST
7188 * icf.cc: New file.
7189 * icf.h: New file.
7190 * Makefile.am (CCFILES): Add icf.cc.
7191 (HFILES): Add icf.h
7192 * Makefile.in: Regenerate.
7193 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7194 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7195 section, symbol and addend information for the relocs.
7196 * gold.cc (queue_middle_tasks): Call identical code folding.
7197 * gold.h: Add defines for multimap.
7198 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7199 to the call of finalize_local_symbols.
7200 * main.cc (main): Create object of class Icf.
7201 * object.cc (Sized_relobj::do_layout): Allow this function to be
7202 called twice during icf.
7203 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7204 to sections marked as identical by icf.
7205 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7206 when available.
7207 (Sized_relobj::do_section_entsize): New function.
7208 * object.h (Object::section_entsize): New function.
7209 (Object::do_section_entsize): New pure virtual function.
7210 (Relobj::finalize_local_symbols): Add new parameter.
7211 (Relobj::do_section_entsize): New function.
7212 * options.h (General_options::icf): New option.
7213 (General_options::icf_iterations): New option.
7214 (General_options::print_icf_sections): New option.
7215 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7216 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7217 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7218 icf.
7219 * symtab.cc (Symbol_table::is_section_folded): New function.
7220 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7221 to sections marked as identical by icf.
7222 * symtab.h (Symbol_table::set_icf): New function.
7223 (Symbol_table::icf): New function.
7224 (Symbol_table::is_section_folded): New function.
7225 (Symbol_table::icf_): New data member.
7226 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7227 * testsuite/Makefile.am: Add commands to build icf_test.
7228 * testsuite/Makefile.in: Regenerate.
7229 * testsuite/icf_test.sh: New file.
7230 * testsuite/icf_test.cc: New file.
7231
c3b65ac4
CD
72322009-07-24 Chris Demetriou <cgd@google.com>
7233
7234 * layout.cc (is_compressible_debug_section): Fix incorrect
7235 comment about compressed section names.
7236
1caf2c51
ILT
72372009-07-20 Ian Lance Taylor <ian@airs.com>
7238
7239 PR 10419
7240 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7241
1ef4d87f
ILT
72422009-07-16 Ian Lance Taylor <iant@google.com>
7243
7244 PR 10400
7245 * layout.h: #include <map>.
7246 (class Kept_section): Change from struct to class. Add accessors
7247 and setters. Add section size to Comdat_group mapping. Change
7248 Comdat_group to std::map. Add is_comdat_ field. Add
7249 linkonce_size field in union.
7250 (class Layout): Update declaration of find_or_add_kept_section.
7251 Don't declare find_kept_object.
7252 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7253 parameter. Add object, shndx, is_comdat, and is_group_name
7254 parameters. Change all callers. Adjust for new Kept_section.
7255 (Layout::find_kept_object): Remove.
7256 * object.cc (Sized_relobj::include_section_group): Update use of
7257 Kept_section. Rename secnum to shndx. Only record
7258 Kept_comdat_section if sections are the same size.
7259 (Sized_relobj::include_linkonce_section): Update use of
7260 Kept_section. Only record Kept_comdat_section if sections are the
7261 same size. Set size of linkonce section.
7262 (Sized_relobj::map_to_kept_section): Update call to
7263 get_kept_comdat_section.
7264 * object.h (class Sized_relobj): Rename fields in
7265 Kept_comdat_section to drop trailing underscores; change object
7266 field to Relobj*. Change Kept_comdat_section_table to store
7267 struct rather than pointer.
7268 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7269 Add kept_object and kept_shndx parameters. Change all callers.
7270 (Sized_relobj::get_kept_comdat_section): Change return type to
7271 bool. Add kept_object and kept_shndx parameters. Change all
7272 callers.
7273 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7274 Layout::find_or_add_kept_section.
7275
37c3b7b0
ILT
72762009-07-09 Ian Lance Taylor <iant@google.com>
7277
7278 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7279 Reserve space in the hash table.
7280
98fa85cb
ILT
72812009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7282
7283 * fileread.cc (File_read::get_mtime): New method.
7284 * fileread.h (Timespec): New structure.
7285 (File_read::get_mtime): New method.
7286 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7287 Renamed from timestamp_nsec.
7288 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7289 Elf_Xword.
e1df38aa 7290 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 7291 timestamp_nsec.
e1df38aa 7292 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
7293 (Incremental_inputs::report_obejct): Save mtime; style fix.
7294 (Incremental_inputs::report_script): Save mtime; style fix.
7295 (Incremental_inputs::finalize_inputs): Style fix.
7296 (Incremental_inputs::finalize): Style fix.
7297 (Incremental_inputs::create_input_section_data): Store inputs
7298 mtime.
7299 * incremental.h (Incremental_inputs::report_script): Add mtime
7300 argument.
7301 (Incremental_inputs::Input_info::Input_info): Intialize only one
7302 union member.
7303 (Incremental_inputs::Input_info::archive): Move to nameless
7304 union.
7305 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7306 (Incremental_inputs::Input_info::script): Move to nameless union.
7307 (Incremental_inputs::mtime): New field.
7308 * script.cc (read_input_script): Pass file mtime to
7309 Incremental_input.
7310 * script.h (Script_info::inputs): Style fix.
7311
c9d70757
ILT
73122009-07-01 Ian Lance Taylor <ian@airs.com>
7313
7314 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7315 instead of 32.
7316
9c547ec3
ILT
73172009-06-24 Ian Lance Taylor <iant@google.com>
7318
7319 PR 10156
7320 * layout.cc (Layout::choose_output_section): If we find an
7321 existing section, update the flags.
7322 (Layout::create_notes): New function, broken out of
7323 Layout::finalize.
7324 (Layout::finalize): Don't create note sections.
7325 (Layout::create_note): Don't crash if linker script discards
7326 section.
7327 (Layout::create_gold_note): Likewise.
7328 (Layout::create_build_id): Likewise. Don't set
7329 after_input_sections on the section.
7330 (Layout::create_executable_stack_info): Remove target parameter.
7331 Change caller.
7332 * layout.h (class Layout): Declare create_notes. Update
7333 declaration of create_executable_stack_info.
7334 * gold.cc (queue_middle_tasks): Call create_notes.
7335 * output.cc (Output_section::update_flags_for_input_section): Move
7336 here from output.h. If SHF_ALLOC flag is newly set, mark address
7337 invalid.
7338 * output.h (Output_data::mark_address_invalid): New function.
7339 (class Output_section): Only declare, not define,
7340 update_flags_for_input_section. Remove set_flags.
7341
55458500
ILT
73422009-06-24 Ian Lance Taylor <iant@google.com>
7343
7344 * script-sections.cc (Output_section_definition::
7345 set_section_addresses): Rename shadowing local load_address to
7346 laddr.
7347
1307d6cd
ILT
73482009-06-24 Ian Lance Taylor <iant@google.com>
7349
7350 PR 10244
7351 * reloc.cc (relocate_sections): Skip empty relocation sections.
7352
ec3f783e
ILT
73532009-06-23 Ian Lance Taylor <iant@google.com>
7354
7355 PR 10156
7356 * layout.cc (Layout::create_note): Use choose_output_section
7357 rather than make_output_section.
7358
459c9f1c
ILT
73592009-06-23 Ian Lance Taylor <iant@google.com>
7360
7361 PR 10237
7362 * options.cc (General_options::parse_V): Set printed_version_.
7363 (General_options::General_options): Initialize printed_version_.
7364 * options.h (class General_options): Add printed_version_ field.
7365 * gold.cc (queue_initial_tasks): If there are no input files,
7366 don't give a fatal error if we printed the version information.
7367 (queue_middle_tasks): If using -r with a shared object, give a
7368 fatal error rather than an ordinary error.
7369
1518dc8f
ILT
73702009-06-23 Ian Lance Taylor <iant@google.com>
7371
7372 PR 10219
7373 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7374 (Layout::make_output_section): Set have_stabstr_section_ if we see
7375 a .stab*str section.
7376 (Layout::finalize): Call link_stabs_sections.
7377 (Layout::link_stabs_sections): New file.
7378 * layout.h (class Layout): Add have_stabstr_section_ field.
7379 Declare link_stabs_sections.
7380
3d857b98
DK
73812009-06-23 Doug Kwan <dougkwan@google.com>
7382
7383 * Makefile.am (libgold_a_LIBADD): New.
7384 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7385 * Makefile.in: Regenerate.
7386 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7387 * configure: Regenerate.
7388 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7389 * fileread.cc: Include sys/state.h
7390 * gold.h: Declare memmem and strndup if found missing.
7391 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7392
0639a6f6
ILT
73932009-06-23 Ian Lance Taylor <iant@google.com>
7394
7395 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7396 * configure: Rebuild.
7397
8d63875c
ILT
73982009-06-23 Ian Lance Taylor <iant@google.com>
7399
7400 PR 10147
7401 * object.cc (Object::section_contents): Don't try to get a view if
7402 the section has length zero.
7403 (Object::handle_gnu_warning_section): If the section is empty, use
7404 the name of the section as the warning.
7405
f7c8a183
ILT
74062009-06-23 Ian Lance Taylor <iant@google.com>
7407
7408 PR 10133
7409 * stringpool.h (class Stringpool_template): Add optimize_ field.
7410 (Stringpool_template::set_optimize): New function.
7411 * stringpool.cc (Stringpool_template::Stringpool_template):
7412 Initialize optimize_ field.
7413 (Stringpool_template::set_string_offsets): Test local optimize
7414 fild rather than parameter.
7415 * layout.cc (Layout::Layout): Call set_optimize on the section
7416 name stringpool.
7417
e6a307ba
ILT
74182009-06-22 Ian Lance Taylor <iant@google.com>
7419
7420 PR 10030
7421 * yyscript.y: Parse TARGET.
7422 * script.cc (script_set_target): New function.
7423 * script-c.h (script_set_target): Declare.
7424 * options.cc (General_options::string_to_object_format): Rename
7425 from string_to_object_format in anonymous namespace. Change
7426 callers.
7427 * options.h (class General_options): Declare
7428 string_to_object_format.
7429
3ee173de
ILT
74302009-06-22 Ian Lance Taylor <iant@google.com>
7431
7432 * script-sections.cc (Script_sections::create_segments): Don't put
7433 program headers in a PT_LOAD segment if -n or -N.
7434
74352009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
7436
7437 PR 10141
7438 * options.h (class General_options): Add -z lazy and -z now. Sort
7439 -z options into alphabetical order.
7440 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7441
cd6739a1 74422009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
7443
7444 * layout.cc (Layout::make_output_section): Call
7445 Target::new_output_section.
7446 (Layout::attach_allocated_section_to_segment): Put large section
7447 sections in a separate load segment with the large segment flag
7448 set.
7449 (Layout::segment_precedes): Sort large data segments after other
7450 load segments.
7451 (align_file_offset): New static function.
7452 (Layout::set_segment_offsets): Use align_file_offset.
7453 * output.h (class Output_section): Add is_small_section_ and
7454 is_large_section_ fields.
7455 (Output_section::is_small_section): New function.
7456 (Output_section::set_is_small_section): New function.
7457 (Output_section::is_large_section): New function.
7458 (Output_section::set_is_large_section): New function.
7459 (Output_section::is_large_data_section): New function.
7460 (class Output_segment): Add is_large_data_segment_ field.
7461 (Output_segment::is_large_data_segment): New function.
7462 (Output_segment::set_is_large_data_segment): New function.
7463 * output.cc (Output_section::Output_section): Initialize new
7464 fields.
7465 (Output_segment::Output_segment): Likewise.
7466 (Output_segment::add_output_section): Add assertion that large
7467 data sections always go in large data segments. Force small data
7468 sections to the end of the list of data sections. Force small BSS
7469 sections to the start of the list of BSS sections. For large BSS
7470 sections to the end of the list of BSS sections.
7471 * symtab.h (class Symbol): Declare is_common_shndx.
7472 (Symbol::is_defined): Check Symbol::is_common_shndx.
7473 (Symbol::is_common): Likewise.
7474 (class Symbol_table): Define enum Commons_section_type. Update
7475 declarations. Add small_commons_ and large_commons_ fields.
7476 * symtab.cc (Symbol::is_common_shndx): New function.
7477 (Symbol_table::Symbol_table): Initialize new fields.
7478 (Symbol_table::add_from_object): Put small and large common
7479 symbols in the right list.
7480 (Symbol_table::sized_finalized_symbol): Check
7481 Symbol::is_common_shndx.
7482 (Symbol_table::sized_write_globals): Likewise.
7483 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7484 common symbol lists. Don't call do_allocate_commons_list if the
7485 list is empty.
7486 (Symbol_table::do_allocate_commons_list): Remove is_tls
7487 parameter. Add comons_section_type parameter. Change all
7488 callers. Handle small and large common symbols.
7489 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7490 Symbol::is_common_shndx.
7491 * resolve.cc (symbol_to_bits): Likewise.
7492 * target.h (Target::small_common_shndx): New function.
7493 (Target::small_common_section_flags): New function.
7494 (Target::large_common_shndx): New function.
7495 (Target::large_common_section_flags): New function.
7496 (Target::new_output_section): New function.
7497 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7498 small_common_section_flags, and large_common_section_flags
7499 fields.
7500 (Target::do_new_output_section): New virtual function.
7501 * arm.cc (Target_arm::arm_info): Initialize new fields.
7502 * i386.cc (Target_i386::i386_info): Likewise.
7503 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7504 Likewise.
7505 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7506 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7507 (Target_x86_64::do_new_output_section): New function.
7508 * configure.ac: Define conditional MCMODEL_MEDIUM.
7509 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7510 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7511 (large_LDFLAGS): Define.
7512 * testsuite/large.c: New file.
7513 * testsuite/testfile.cc (Target_test::test_target_info):
7514 Initialize new fields.
7515 * configure, testsuite/Makefile.in: Rebuild.
7516
bb04269c
DK
75172009-06-05 Doug Kwan <dougkwan@google.com>
7518
7519 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 7520 * Makefile.in: Regenerate.
bb04269c
DK
7521 * i386.cc (class Target_i386): Define new virtual method to
7522 override do_is_local_label_name in parent.
7523 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7524 local symbols if --discard-locals or -X is given.
7525 * options.h (class General_options): Declare new options
7526 '--discard-locals' and '-X' for discarding locals.
7527 * target.h (class Target): Define new methods is_local_label_name.
7528 Declare new virtual method do_is_local_label_name.
7529 * target.cc: New file.
7530 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7531 (check_SCRIPTS): Add discard_locals_test.sh.
7532 (check_DATA): Add discard_local_tests.syms.
7533 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7534 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7535 * testsuite/Makefile.in: Regenerate.
7536 * testsuite/discard_locals_test.c: New file.
7537 * testsuite/discard_locals_test.sh: Same.
7538
805bb01c
DK
75392009-06-05 Doug Kwan <dougkwan@google.com>
7540
7541 * object.cc (Sized_relobj::Sized_relobj): Initialize
7542 discarded_eh_frame_shndx_ to -1U.
7543 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7544 section.
7545 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7546 a discarded .eh_frame section.
7547 (Sized_relobj::do_finalize_local_symbols): Ditto.
7548 * object.h (class Sized_relobj): Declare new member
7549 discarded_eh_frame_shndx_.
7550 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7551 (local_labels_test.o, local_labels_test): New rules.
7552 * testsuite/Makefile.in: Regenerate.
7553
1dcd334d
DK
75542009-06-04 Doug Kwan <dougkwan@google.com>
7555
7556 * layout.cc (Layout::section_name_mapping): Add mapping for
7557 special ARM sections.
7558
96d49306
DK
75592009-06-03 Doug Kwan <dougkwan@google.com>
7560
7561 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7562 (utils::has_overflow): Same.
7563
dff16297
ILT
75642009-06-03 Ian Lance Taylor <iant@google.com>
7565
7566 * layout.cc (Layout::section_name_mapping): New array, replacing
7567 Layout::linkonce_mapping.
7568 (Layout::section_name_mapping_count): New variable, replacing
7569 Layout::linkonce_mapping_count.
7570 (Layout::linkonce_output_name): Remove.
7571 (Layout::output_section_name): Rewrite.
7572 * layout.h (class Layout): Rename Linkonce_mapping to
7573 Section_name_mapping, linkonce_mapping to section_name_mapping,
7574 linkonce_mapping_count to section_name_mapping_count. Don't
7575 declare linkonce_output_name.
7576
c121c671
DK
75772009-06-03 Doug Kwan <dougkwan@google.com>
7578
7579 * gold/arm.cc (namespace utils): New.
7580 (Target_arm::reloc_is_non_pic): Define new method.
7581 (class Arm_relocate_functions): New.
7582 (Target_arm::Relocate::relocate): Handle relocation types used by
7583 Android.
7584
07800fab
ILT
75852009-06-03 Ian Lance Taylor <iant@google.com>
7586
7587 * arm.cc (Target_arm::scan::global): Use || instead of |.
7588
c121c671
DK
75892009-06-02 Doug Kwan <dougkwan@google.com>
7590
7591 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7592 issued_non_pic_error_.
7593 (class Target_arm::Scan): Declare new method check_non_pic.
7594 Define new method symbol_needs_plt_entry.
7595 Declare new data member issued_non_pic_error_.
7596 (class Target_arm::Relocate): Declare new method
7597 should_apply_static_reloc.
7598 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7599 (Target_arm::Scan::check_non_pic): Define new method.
7600 (Target_arm::Scan::local): Handle a small subset of reloc types used
7601 by Android.
7602 (Target_arm::Scan::local): Same.
7603 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7604
b19b0c6d
ILT
76052009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7606
7607 * incremental.cc (Incremental_inputs::report_command_line): Filter
7608 out --incremental-* options.
7609
94cdfcff
DK
76102009-05-29 Doug Kwan <dougkwan@google.com>
7611
7612 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7613 template class.
7614 (class Target_arm): Update comment.
7615 (Target_arm::Target_arm): Initialize new data members GOT_,
7616 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7617 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7618 and Target_arm::rel_dyn_section.
7619 Declare new_enum Target_arm::Got_type.
7620 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7621 and DYNBSS_.
7622 Update commments for member do_dynsym_value.
7623 (Target_arm::got_size, Target_arm::plt_section,
7624 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7625 new methods inside class defintion.
7626 (Target_arm::got_section): Define new method.
7627 (Target_arm::rel_dyn_section): Same.
7628 (Output_data_plt_arm): New template class.
7629 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7630 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7631 (Output_data_plt_arm::add_entry): Same.
7632 (Output_data_plt_arm::first_plt_entry): Define new
7633 static data member for PLT instruction template.
7634 (Output_data_plt_arm::plt_entry): Same.
7635 (Output_data_plt_arm::do_write): Define new method.
7636 (Target_arm::make_plt_entry): Same.
7637 (Target_arm::do_finalize_sections): Same.
7638 (Target_arm::do_dynsym_value): Same.
7639
4a657b0d
DK
76402009-05-28 Doug Kwan <dougkwan@google.com>
7641
7642 * Makefile.am (TARGETSOURCES): Add arm.cc.
7643 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7644 * Makefile.in: Regenerate.
7645 * arm.cc: New file.
7646 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7647
e7ae8c36
DK
76482009-05-26 Doug Kwan <dougkwan@google.com>
7649
7650 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7651 (General_options::check_excluded_libs): Strip off directories in
7652 archive name before matching like GNU ld does.
7653 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7654 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7655 (exclude_libs_test_LDFLAGS): Add linker option
7656 -Wl,--exclude-libs,libexclude_libs_test_3
7657 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7658 an explicit archive without using -l.
7659 (alt/libexclude_libs_test_3.a): New make rule.
7660 * testsuite/Makefile.in: Regenerate.
7661 * testsuite/exclude_libs_test.c : Declare lib3_default().
7662 (main): Call it.
7663 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7664 * exclude_libs_test_3.c: New file.
7665
f12e7348
NC
76662009-05-26 Nick Clifton <nickc@redhat.com>
7667
7668 * po/id.po: New Indonesian translation.
7669 * po/gold.pot: Updated template file.
7670
4daadc0d
ST
76712009-05-22 Sriraman Tallam <tmsriram@google.com>
7672
e1df38aa 7673 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
7674 gc_comdat_test files. Add -Wl,--gc-sections to build
7675 gc_comdat_test.
7676 * testsuite/Makefile.in: Regenerate.
7677 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7678
531813ad
ST
76792009-05-21 Sriraman Tallam <tmsriram@google.com>
7680
7681 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7682 kept comdat section was garbage collected.
7683 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7684 * testsuite/Makefile.in: Regenerate.
7685 * testsuite/gc_comdat_test.sh: New file.
7686 * testsuite/gc_comdat_test_1.cc: New file.
7687 * testsuite/gc_comdat_test_2.cc: New file.
7688
65514900
CC
76892009-05-19 Doug Kwan <dougkwan@google.com>
7690
7691 * archive.cc (Archive::Archive): Move constructor from archive.h
7692 to here. Initialize no_export_.
7693 (Archive::get_elf_object_for_member): Set no_export flag of object.
7694 * archive.h (Archive::Archive): Move constructor body to
7695 archive.cc.
7696 (Archive::no_export): New method.
7697 (Archive::no_export_): New field.
7698 * object.h (Object::Object): Initialize no_export_ to false.
7699 (Object::no_export, Object::set_no_export): New methods.
7700 (Object::no_export_): New field.
7701 * options.cc (General_options::parse_exclude_libs): New method.
7702 (General_options::check_excluded_libs) Same.
7703 * options.h (exclude_libs): New option.
7704 (General_options::check_excluded_libs): New method declaration.
7705 (General_options::excluded_libs_): New field.
7706 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7707 default or protected visibility if an object has no-export flag set.
7708 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7709 (check_SCRIPTS): Add exclude_libs_test.sh.
7710 (check_DATA): Add exclude_libs_test.syms.
7711 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7712 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7713 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7714 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7715 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7716 libexclude_libs_test_2.a): New rules.
7717 * testsuite/Makefile.in: Regenerate.
7718 * testsuite/exclude_libs_test.c: New file.
7719 * testsuite/exclude_libs_test.sh: Ditto.
7720 * testsuite/exclude_libs_test_1.c: Ditto.
7721 * testsuite/exclude_libs_test_2.c: Ditto.
7722
1b77ea50
ILT
77232009-05-15 Ian Lance Taylor <iant@google.com>
7724
7725 * configure.ac: Check for declarations for cases where libiberty.h
7726 checks HAVE_DECL_xxx.
7727 * configure, config.in: Rebuild.
7728
072fe7ce
ILT
77292009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7730
7731 * gold.h (Incremental_argument_list): Remove (invalid) forward
7732 declaration.
7733 * incremental.cc (Incremental_inputs::report_achive): New method.
7734 (Incremental_inputs::report_object): New method.
7735 (Incremental_inputs::report_script): New method.
7736 (Incremental_inputs::finalize_inputs): New method.
7737 (Incremental_inputs::finalize): Call finalize_inputs().
7738 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7739 Create inputs entries.
7740 * incremental.h (Incremental_input_type): New enum.
7741 (Incremental_inputs::Incremental_input): Initialize new fields.
7742 (Incremental_inputs::report_inputs): New method.
7743 (Incremental_inputs::report_achive): New method.
7744 (Incremental_inputs::report_object): New method.
7745 (Incremental_inputs::report_script): New method.
7746 (Incremental_inputs::finalize_inputs): New method.
7747 (Incremental_inputs::Input_info): New struct.
7748 (Incremental_inputs::Input_info_map): New typedef.
7749 (Incremental_inputs::lock_): New field.
7750 (Incremental_inputs::Inputs_): New field.
7751 (Incremental_inputs::Inputs_map): New field.
7752 * main.cc (main): Call Incremental_input::report_inputs.
7753 * options.h (Input_argument_list): Typedef moved from
7754 Input_arguments.
7755 (Input_file_group::Files): Remove, use ::Input_argument_list.
7756 (Input_file_group::Input_argument_list): Remove, use
7757 ::Input_argument_list.
7758 * plugin.cc (Plugin_manager::add_input_file): Add error in
7759 incremental build.
7760 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7761 functions.
7762 * script.cc (read_input_script): Call
7763 Incremental_input::report_script.
7764 * script.h (Script_info): New class.
7765
b0481b0b
ILT
77662009-04-27 Ian Lance Taylor <iant@google.com>
7767
7768 * x86_64.cc (do_adjust_output_section): Set entsize to
7769 plt_entry_size.
7770
b22a5a41 77712009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
7772
7773 * output.cc (Output_file::close): After short writes, continue
7774 writing from the correct offset in the buffer being written.
7775
40fde488
CD
77762009-04-23 Chris Demetriou <cgd@google.com>
7777
7778 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7779 * configure: Regenerate.
7780 * config.in: Regenerate.
7781 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7782 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7783
3ce2c28e
ILT
77842009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7785
7786 * incremental.cc (Incremental_inputs_header_data): Renamed from
7787 Incremental_input_header_data.
7788 (Incremental_inputs_header_data::data_size): New field.
7789 (Incremental_inputs_header_data::put_input_file_count): Renamed
7790 from input_file_count.
7791 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7792 from command_line_offset.
7793 (Incremental_inputs_header_data::put_reserved): Renamed from
7794 put_reserved.
7795 (Incremental_inputs_entry_data): Renamed from
7796 Incremental_input_entry_data.
7797 (Incremental_inputs_entry_data::data_size): New field.
7798 (Incremental_inputs::report_command_line): New method.
7799 (Incremental_inputs::finalize): New method.
7800 (Incremental_inputs::create_incremental_inputs_data): New method.
7801 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7802 * incremental.h: New file.
7803 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7804 (Layout::finalize): Create incremental inputs section in
7805 incremental builds.
7806 (Layout::create_incremental_info_sections): New method.
7807 * layout.h (Layout::incremental_inputs): New method.
7808 (Layout::create_incremental_info_sections): New method.
7809 (Layout::incremental_inputs_): New field.
7810 * main.cc (main): Notify Incremental_input of the command line.
7811
e55bde5e
ILT
78122009-04-01 Ian Lance Taylor <iant@google.com>
7813 Mikolaj Zalewski <mikolajz@google.com>
7814
7815 * gold.h (reserve_unordered_map): Define, three versions, one for
7816 each version of Unordered_map.
7817 * layout.cc (Layout::Layout): Remove options parameter. Add
7818 number_of_input_files parameter. Don't initialize options_.
7819 Initialize number_of_input_files_ and resized_signatures_. Move
7820 sections_are_attached_.
7821 (Layout::layout_group): Reserve space for group_signatures_.
7822 (Layout::find_or_add_kept_section): Change name parameter to be a
7823 reference. Resize signatures_ map when it gets large enough.
7824 (Layout::layout_eh_frame): Use parameters->options() instead of
7825 this->options_.
7826 (Layout::make_output_section): Likewise.
7827 (Layout::attach_allocated_section_to_segment): Likewise.
7828 (Layout::finalize, Layout::create_executable_stack): Likewise.
7829 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7830 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7831 * layout.h (class Layout): Update declarations. Remove options_
7832 field. Add number_of_input_files_ and resized_signatures_
7833 fields. Move sections_are_attached_ field.
7834 * main.cc (main): Pass number of input files to Layout
7835 constructor. Don't pass options.
7836
154b857c
ILT
78372009-03-30 Ian Lance Taylor <iant@google.com>
7838
7839 * ffsll.c (ffsll): Correct implementation.
7840
2f35ab9b
ILT
78412009-03-27 Ian Lance Taylor <iant@google.com>
7842
fd03461a
ILT
7843 * ffsll.c: New file.
7844 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7845 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7846 * ftruncate.c (ftruncate): Declare before definition.
7847 * mremap.c (mremap): Likewise.
7848 * pread.c (pread): Likewise.
7849 * configure, Makefile.in, config.in: Rebuild.
7850
2f35ab9b
ILT
7851 * mremap.c: New file.
7852 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7853 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7854 (mremap): Declare if HAVE_MREMAP is not defined.
7855 * configure, Makefile.in, config.in: Rebuild.
7856
33aea2fd
CC
78572009-03-27 Cary Coutant <ccoutant@google.com>
7858
7859 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7860 position independent.
7861 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7862 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7863
6d479619
CC
78642009-03-24 Cary Coutant <ccoutant@google.com>
7865
7866 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7867 an executable.
7868 (needs_dynamic_reloc): Likewise.
7869
afc06bb8
ILT
78702009-03-24 Ian Lance Taylor <iant@google.com>
7871
7872 * yyscript.y (file_cmd): Recognize EXTERN.
7873 (extern_name_list, extern_name_list_body): New nonterminals.
7874 * script.cc (script_add_extern): Define.
7875 * script-c.h (script_add_extern): Declare.
7876
f6060a4d
ILT
78772009-03-24 Rafael Avila de Espindola <espindola@google.com>
7878
7879 * object.cc (is_elf_object): Define.
7880 * object.h (is_elf_object): Declare.
7881 * archive.cc (Archive::get_elf_object_for_member): Call
7882 is_elf_object.
33aea2fd 7883 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 7884
26736d8e
ILT
78852009-03-24 Elliott Hughes <enh@google.com>
7886
7887 * output.cc (Output_file::map_anonymous): Define.
7888 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7889 try an anonymous one. Report the size if the mmap fails.
7890 * output.h (class Output_file): Declare map_anonymous.
7891
22fd9730
ILT
78922009-03-24 Ian Lance Taylor <iant@google.com>
7893
7894 * target-select.cc (instantiate_target): Don't acquire the lock if
7895 the instantiated_target_ field has already been set.
7896
cb010894
ILT
78972009-03-23 Ian Lance Taylor <iant@google.com>
7898
7f055c20
ILT
7899 * gold-threads.h (class Initialize_lock): Define.
7900 * gold-threads.cc (class Initialize_lock_once): Define.
7901 (initialize_lock_control): New static variable.
7902 (initialize_lock_pointer): New static variable.
7903 (initialize_lock_once): New static function.
7904 (Initialize_lock::Initialize_lock): Define.
7905 (Initialize_lock::initialize): Define.
7906 * target-select.h: Include "gold-threads.h".
7907 (class Target_selector): Add lock_ and initialize_lock_ fields.
7908 Don't define instantiate_target, just declare it.
7909 * target-select.cc (Target_selector::Target_selector): Initialize
7910 new fields.
7911 (Target_selector::instantiate_target): Define.
7912 * descriptors.h: Include "gold-threads.h".
7913 (class Descriptors): Add initialize_lock_ field.
7914 * descriptors.cc (Descriptors::Descriptors): Initialize new
7915 field.
7916 (Descriptors::open): Use initialize_lock_ field
7917 * errors.h (class Errors): Add initialize_lock_ field.
7918 * errors.cc (Errors::Errors): Initialize new field.
7919 (Errors::initialize_lock): Use initialize_lock_ field.
7920 * powerpc.cc (class Target_selector_powerpc): Remove
7921 instantiated_target_ field. In do_recognize call
7922 instantiate_target rather than do_instantiate_target. In
7923 do_instantiate_target just allocate a new target.
7924 * sparc.cc (class Target_selector_sparc): Likewise.
7925
36959681
ILT
7926 * freebsd.h: New file.
7927 * i386.cc: Include "freebsd.h".
7928 (Target_i386): Derive from Target_freebsd rather than
7929 Sized_target.
7930 (Target_selector_i386): Derive from Target_selector_freebsd rather
7931 than Target_selector.
7932 * x86_64.cc: Include "freebsd.h".
7933 (Target_x86_64): Derive from Target_freebsd rather than
7934 Sized_target.
7935 (Target_selector_x86_64): Derive from Target_selector_freebsd
7936 rather than Target_selector.
7937 * target.h (class Target): Add adjust_elf_header and
7938 do_adjust_elf_header.
7939 * output.cc (Output_file_header:: do_sized_write): Call target
7940 adjust_elf_header routine.
7941 * configure.tgt: Set targ_osabi.
7942 * configure.ac: Define GOLD_DEFAULT_OSABI.
7943 * parameters.cc (Parameters::default_target): Pass
7944 GOLD_DEFAULT_OSABI to select_target.
7945 * target-select.h (class Target_selector): Make instantiate_target
7946 protected rather than private.
7947 * Makefile.am (HFILES): Add freebsd.h.
7948 * configure, Makefile.in, config.in: Rebuild.
7949
cb010894
ILT
7950 * merge.cc (do_add_input_section): Correct pend value. Change
7951 message about last entry not being null terminated from error to
7952 warning.
7953
0e879927
ILT
79542009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7955
7956 * incremental.cc: New file.
7957 * Makefile.am (CCFILES): Add incremental.cc.
7958 * Makefile.in: Rebuild.
7959
41105937
PP
79602009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7961
7962 * layout.cc (Layout::output_section_name): Preserve names
7963 of '.note.' sections.
e1df38aa 7964
60439920
ILT
79652009-03-19 Ian Lance Taylor <iant@google.com>
7966
7967 * descriptors.cc (Descriptors::open): Check that the options are
7968 valid before using them.
7969
0d371ad3
ILT
79702009-03-18 Ian Lance Taylor <iant@google.com>
7971
7972 * script-sections.h: Include <list>.
7973 (class Script_sections): Change Sections_elements from std::vector
7974 to std::list. Typedef public Elements_iterator. Add
7975 orphan_section_placement_, data_segment_align_start_, and
7976 saw_data_segment_align_ fields. Remove data_segment_align_index_
7977 field.
7978 * script-sections.cc (class Orphan_section_placement): New class.
7979 (class Sections_element): Add virtual functions is_relro and
7980 orphan_section_init. Remove virtual function place_orphan_here.
7981 (class Output_section_definition): Add is_relro and
7982 orphan_section_init. Remove place_orphan_here.
7983 (class Orphan_output_section): Likewise.
7984 (Script_sections::Script_sections): Update for field changes.
7985 (Script_sections::data_segment_align): Set saw_data_segment_align_
7986 and data_segment_align_start_, not data_segment_align_index.
7987 (Script_sections::data_segment_relro_end): Check
7988 saw_data_segment_align_. Use data_segment_align_start_ rather
7989 than data_segment_align_index_.
7990 (Script_sections::place_orphan): Rewrite to use
7991 Orphan_section_placement.
7992
9201d894
ILT
79932009-03-17 Ian Lance Taylor <iant@google.com>
7994
9c5b8369
ILT
7995 * archive.cc (Archive::add_symbols): Check for a version attached
7996 to the symbol name in the archive map.
7997 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7998 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7999 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8000 (ver_test_11.a): New target.
8001 * testsuite/Makefile.in: Rebuild.
8002
9201d894
ILT
8003 * configure.ac: Check for chsize and posix_fallocate. Replace
8004 ftruncate.
8005 * ftruncate.c: New file, from gnulib.
8006 * output.cc (posix_fallocate): Define dummy version if not
8007 HAVE_POSIX_FALLOCATE.
8008 (Output_file::map): Call posix_fallocate rather than lseek and
8009 write.
8010 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8011 * configure, Makefile.in, config.in: Rebuild.
8012
ef4ab7a8 80132009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 8014
ef4ab7a8
PP
8015 * layout.h (Layout::create_note): Add section_name parameter.
8016 * layout.cc (Layout::create_note): Likewise.
8017 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 8018
8c500701
ILT
80192009-03-17 Ian Lance Taylor <iant@google.com>
8020
e85b18e1
ILT
8021 * descriptors.cc: Include "options.h".
8022 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8023 (Descriptors::open): Always use O_CLOEXEC when opening a new
8024 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8025 then set FD_CLOEXEC.
8026
9efe6174
ILT
8027 * sparc.cc (class Target_sparc): Add has_got_section.
8028 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8029 make sure we have a GOT section.
8030
8031 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8032 (Target_sparc::Scan::local): Likewise.
8033 (Target_sparc::Scan::global): Likewise.
8034 (Target_sparc::Relocate::relocate): Likewise.
8035 (Target_sparc::Relocate::relocate_tls): Likewise.
8036
8c500701
ILT
8037 * symtab.cc (Symbol_table::define_default_version): New function,
8038 broken out of add_from_object.
8039 (Symbol_table::add_from_object): Call define_default_version.
8040 (Symbol_table::define_special_symbol): Add resolve_oldsym
8041 parameter. Change all callers. If the version for a symbol comes
8042 from a version script, resolve it with the symbol with the same
8043 name with no version. Also add the symbol without a version if
8044 appropriate.
8045 (do_define_in_output_data): If resolving with oldsym, don't delete
8046 sym.
8047 (do_define_in_output_segment): Likewise.
8048 (do_define_as_constant): Likewise.
8049 * symtab.h (class Symbol_table): Update declarations.
8050
f1ed28fb
ILT
80512009-03-13 Ian Lance Taylor <iant@google.com>
8052
15f8229b
ILT
8053 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8054 (Read_symbols::requeue): New function.
8055 (Read_symbols::do_read_symbols): If make_elf_object fails because
8056 the target type is not configured, and the file was searched for,
8057 issue a warning and retry with the next directory.
8058 (Add_symbols::run): If the file has an incompatible format, and
8059 it was searched for, requeue the Read_symbols task. On error,
8060 release the object.
8061 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8062 dirindex parameter to constructor. Change all callers. Declare
8063 incompatible_warning and requeue.
8064 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8065 input_argument_ and input_group_ fields. Add them to
8066 constructor. Change all callers.
8067 (class Read_script): Add dirindex_ field. Add it to constructor.
8068 Change all callers.
8069 * archive.cc (Archive::setup): Remove input_objects parameter.
8070 Change all callers.
8071 (Archive::get_file_and_offset): Likewise.
8072 (Archive::read_all_symbols): Likewise.
8073 (Archive::read_symbols): Likewise.
8074 (Archive::get_elf_object_for_member): Remove input_objects
8075 parameter. Add punconfigured parameter. Change all callers.
8076 (Archive::add_symbols): Change return type to bool. Check return
8077 value of include_member.
8078 (Archive::include_all_members): Likewise.
8079 (Archive::include_member): Change return type to bool. Return
8080 false if first included object has incompatible target. Set
8081 included_member_ field.
8082 (Add_archive_symbols::run): If add_symbols returns false, requeue
8083 Read_symbols task.
8084 * archive.h (class Archive): Add included_member_ field.
8085 Initialize it in constructor. Add input_file and searched_for
8086 methods. Update declarations.
8087 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8088 input_argument_ fields. Add them to constructor. Change all
8089 callers.
8090 * script.cc: Include "target-select.h".
8091 (class Parser_closure): Add skip_on_incompatible_target_ and
8092 found_incompatible_target_ fields. Add
8093 skip_on_incompatible_target parameter to constructor. Change all
8094 callers. Add methods skip_on_incompatible_target,
8095 clear_skip_on_incompatible_target, found_incompatible_target, and
8096 set_found_incompatible_target.
8097 (read_input_script): Add dirindex parameter. Change all callers.
8098 If parser finds an incompatible target, requeue Read_symbols
8099 task.
8100 (script_set_symbol): Clear skip_on_incompatible_target in
8101 closure.
8102 (script_add_assertion, script_parse_option): Likewise.
8103 (script_start_sections, script_add_phdr): Likewise.
8104 (script_check_output_format): New function.
8105 * script.h (read_input_script): Update declaration.
8106 * script-c.h (script_check_output_format): Declare.
8107 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8108 (ignore_cmd): Remove OUTPUT_FORMAT.
8109 * fileread.cc (Input_file::Input_file): Add explicit this.
8110 (Input_file::will_search_for): New function.
8111 (Input_file::open): Add pindex parameter. Change all callers.
8112 * fileread.h (class Input_file): Add input_file_argument method.
8113 Declare will_search_for. Update declarations.
8114 * object.cc (make_elf_object): Add punconfigured parameter.
8115 Change all callers.
8116 * object.h (class Object): Make input_file public. Add
8117 searched_for method.
8118 (make_elf_object): Update declaration.
8119 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8120 restart search.
8121 * dirsearch.h (class Dirsearch): Update declaration.
8122 * options.h (class General_options): Add --warn-search-mismatch.
8123 * parameters.cc (Parameters::is_compatible_target): New function.
8124 * parameters.h (class Parameters): Declare is_compatible_target.
8125 * workqueue.cc (Workqueue::add_blocker): New function.
8126 * workqueue.h (class Workqueue): Declare add_blocker.
8127
f1ed28fb
ILT
8128 * fileread.cc (Input_file::open): Remove options parameter.
8129 Change all callers.
8130 (Input_file::open_binary): Likewise.
8131 * script.cc (read_input_script): Likewise.
8132 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8133 options parameter from constructor. Change all callers.
8134 (class Read_script): Likewise.
8135 * fileread.h (class Input_file): Update declarations.
8136 * script.h (read_input_script): Update declaration.
8137
34dd024a
NC
81382009-03-10 Nick Clifton <nickc@redhat.com>
8139
8140 * po/es.po: New Spanish translation.
8141
6d71b17c
CC
81422009-03-06 Cary Coutant <ccoutant@google.com>
8143
8144 * options.cc (parse_short_option): Keep dash_z from registering itself.
8145
031cdbed
ILT
81462009-03-03 Ian Lance Taylor <iant@google.com>
8147
8148 PR 9918
8149 * target-reloc.h (relocate_section): Pass output_section to
8150 relocate.
8151 * i386.cc (Target_i386::should_apply_static_reloc): Add
8152 output_section parameter. Change all callers.
8153 (Target_i386::Relocate::relocate): Add output_section parameter.
8154 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8155 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8156 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8157 * testsuite/two_file_shared.sh: New script.
8158 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8159 (check_DATA): Add two_file_shared.dbg.
8160 (two_file_shared.dbg): New target.
8161 * testsuite/Makefile.in: Rebuild.
8162
15d5fa16
ILT
81632009-03-01 Ian Lance Taylor <iant@google.com>
8164
8165 * configure.ac: Check for byteswap.h.
8166 * configure: Rebuild.
8167 * config.in: Rebuild.
8168
8a4c0b0d
ILT
81692009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8170
8171 * layout.cc (Layout::find_or_add_kept_section): New function.
8172 (Layout::add_comdat): Removed.
8173 * layout.h (struct Kept_section): Move out of class Layout.
8174 Remove trailing underscores from field names. Add group_sections
8175 field. Rename group_ field to is_group. Change all uses.
8176 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8177 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8178 comdat_groups_ field.
8179 (Sized_relobj::include_section_group): Use
8180 find_or_add_kept_section and Kept_section::group_sections.
8181 (Sized_relobj::include_linkonce_section): Likewise.
8182 * object.cc (class Sized_relobj): Don't define Comdat_group or
8183 Comdat_group_table. Remove find_comdat_group and
8184 add_comdat_group. Remove comdat_groups_ field.
8185 * plugin.cc (include_comdat_group): Use
8186 Layout::find_or_add_kept_section.
8187
b4ecf66b
ILT
81882009-02-28 Ian Lance Taylor <iant@google.com>
8189
14359ca0
ILT
8190 * README: --gc-sections and map files are now supported. Document
8191 some build requirements.
8192
b4ecf66b
ILT
8193 PR 6992
8194 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8195 relocatable link set the value of the section symbol to zero.
8196 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8197 relocatable link don't include the section address in the local
8198 symbol value.
8199
0602e05a
ILT
82002009-02-27 Ian Lance Taylor <iant@google.com>
8201
fd9d194f
ILT
8202 PR 6811
8203 * options.h (class Search_directory): Add is_system_directory.
8204 (class General_options): Declare is_in_system_directory.
8205 * options.cc (get_relative_sysroot): Make static.
8206 (get_default_sysroot): Make static.
8207 (General_optoins::is_in_system_directory): New function.
8208 * fileread.cc (Input_file::is_in_system_directory): New function.
8209 * fileread.h (class Input_file): Declare is_in_system_directory.
8210 * object.h (class Object): Add is_in_system_directory.
8211 (class Input_objects): Remove system_library_directory_ field.
8212 * object.cc (Input_objects::add_object): Don't set
8213 system_library_directory_.
8214 (input_objects::found_in_system_library_directory): Remove.
8215 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8216 parameter. Change all callers.
8217 (Symbol_table::sized_write_globals): Likewise.
8218 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8219 Call Object::is_in_system_directory.
8220 * symtab.h (class Symbol_table): Update declarations.
8221
61edd21f
ILT
8222 PR 5990
8223 * descriptors.h (Open_descriptor): Add is_on_stack field.
8224 * descriptors.cc (Descriptors::open): If the descriptor is on the
8225 top of the stack, remove it. Initialize is_on_stack field.
8226 (Descriptors::release): Only add pod to stack if it is not on the
8227 stack already.
8228 (Descriptors::close_some_descriptor): Clear stack_next and
8229 is_on_stack fields.
8230
e29e076a
ILT
8231 PR 7091
8232 * output.cc (Output_section::find_starting_output_address): Rename
8233 from starting_output_address; add PADDR parameter; change return
8234 type.
8235 * output.h (class Output_section): Declare
8236 find_starting_output_address instead of starting_output_address.
8237 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8238 section symbol for which we can't find a merge section.
8239
0602e05a
ILT
8240 PR 9836
8241 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8242 hidden or internal, force the symbol to be local.
8243 * resolve.cc (Symbol::override_visibility): Define.
8244 (Symbol::override_base): Use override_visibility.
8245 (Symbol_table::resolve): Likewise.
8246 (Symbol::override_base_with_special): Likewise.
8247 (Symbol_table::override_with_special): If the visibility is hidden
8248 or internal, force the symbol to be local.
8249 * symtab.h (class Symbol): Add set_visibility and
8250 override_visibility.
8251 * testsuite/ver_test_1.sh: New file.
8252 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8253 (check_DATA): Add ver_test_1.syms.
8254 (ver_test_1.syms): New target.
8255 * testsuite/Makefile.in: Rebuild.
8256
401a9a73
CC
82572009-02-25 Cary Coutant <ccoutant@google.com>
8258
8259 * layout.cc (Layout::choose_output_section): Don't rename sections
8260 when using a linker script that has a SECTIONS clause.
8261 * Makefile.in: Regenerate.
8262
8263 * testsuite/Makefile.am (script_test_5.sh): New test case.
8264 * testsuite/Makefile.in: Regenerate.
8265 * testsuite/script_test_5.cc: New file.
8266 * testsuite/script_test_5.sh: New file.
8267 * testsuite/script_test_5.t: New file.
8268
f488e4b0
CC
82692009-02-13 Rafael Avila de Espindola <espindola@google.com>
8270
8271 * archive.cc (Archive::include_member): Update calls to add_symbols.
8272 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8273 the Layout argument.
8274 * dynobj.h (do_add_symbols): Add the Layout argument.
8275 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8276 Layout argument.
8277 * object.h (Object::add_symbols): Add the Layout argument.
8278 (Object::do_add_symbols): Add the Layout argument.
8279 (Sized_relobj::do_add_symbols): Add the Layout argument.
8280 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8281 Unify the two versions.
8282 (Add_plugin_symbols): Remove.
8283 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8284 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8285 (Add_plugin_symbols): Remove.
8286 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8287 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8288 (Add_symbols::run): Make it work with Pulginobj.
8289
89dd1680
ILT
82902009-02-06 Ian Lance Taylor <iant@google.com>
8291
8292 * object.cc (Sized_relobj::do_layout): Make info message start
8293 with lower case letter.
8294
266d0a74
ILT
82952009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8296
602b464e
ILT
8297 * binary.cc: Fix file comment.
8298
266d0a74
ILT
8299 * options.h (enum Incremental_disposition): Define.
8300 (class General_options): Add new options: --incremental,
8301 --incremental_changed, --incremental_unchanged,
8302 --incremental_unknown. Add incremental_disposition_ and
8303 implicit_incremental_ fields.
8304 (General_options::incremental_disposition): New function.
8305 (class Position_dependent_options): Add incremental_disposition
8306 option.
8307 (Position_dependent_options::copy_from_options): Set incremental
8308 dispositions.
8309 * options.cc (General_options::parse_incremental_changed): New
8310 function.
8311 (General_options::parse_incremental_unchanged): New function.
8312 (General_options::parse_incremental_unknown): New function.
8313 (General_options::General_options): Initialize new fields
8314 incremental_disposition_ and implicit_incremental_.
8315 (General_options::finalize): Check for uasge of --incremental-*
8316 without --incremental.
8317
f073bbf7
CD
83182009-02-06 Chris Demetriou <cgd@google.com>
8319
8320 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8321 pointer and to report location as the file name associated with
8322 the symbol.
8323 (gold_undefined_symbol_at_location): New function to replace the
8324 old gold_undefined_symbol functionality.
8325 * target-reloc.h (relocate_section): Update to use
8326 gold_undefined_symbol_at_location.
8327 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8328 Call gold_undefined_symbol function rather than gold_error.
8329 * errors.h (Errors::undefined_symbol): Take location as a
8330 string, rather than calculating it from a relocation.
8331 * errors.cc (Errors::fatal): Print "fatal error:" before the
8332 formatted message.
8333 (Errors::error, Errors::error_at_location): Print "error: "
8334 before the formatted message.
8335 (Errors::undefined_symbol): Take location as a string, rather
8336 than calculating it from a relocation.
8337 (gold_undefined_symbol_at_location): New function akin to
8338 old gold_undefined_symbol, calculates location from relocation.
8339 (gold_undefined_symbol): Change to take only a Symbol pointer
8340 and to report location as the file name associated with the symbol.
8341 * testsuite/debug_msg.sh: Update for changed error messages.
8342 * testsuite/undef_symbol.sh: Likewise.
8343
8e94a90c
ILT
83442009-02-04 Duncan Sands <baldrick@free.fr>
8345
8346 PR 9812
8347 * reduced_debug_output.h
8348 (Output_reduced_debug_abbrev_section::failed): Use format for
8349 gold_warning.
8350 (Output_reduced_debug_info_section::faild): Likewise.
8351
88a0e15b
ILT
83522009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8353
8354 * script.cc (Lazy_demangler): New class.
8355 (Version_script_info::get_symbol_version_helper): Demangle a
8356 symbol only once.
8357
5efc7cd2
CC
83582009-01-29 Cary Coutant <ccoutant@google.com>
8359
8360 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8361 to __tls_get_addr.
8362 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8363
e0ebcf42
ILT
83642009-01-28 Ian Lance Taylor <iant@google.com>
8365
5efc7cd2 8366 * version.cc (version_string): Bump to 1.9.
75fe7426 8367
e0ebcf42
ILT
8368 * gold.h: Include <cstring> and <stdint.h>.
8369 * version.cc: Include <cstdio>.
8370 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8371 warning.
8372 * reduced_debug_output.cc (insert_into_vector): Rename from
8373 Insert_into_vector; change all callers. Use Swap_unaligned to
8374 avoid aliasing issue; remove union since it is unnecessary.
8375
8e2813be 83762009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
8377
8378 * Makefile.am (CCFILES): Add gc.cc.
8379 (HFILES): Add gc.h.
8380 * Makefile.in: Regenerate.
8381 * gold.cc (Gc_runner): New class.
8382 (queue_initial_tasks): Call garbage collection related tasks
8383 when corresponding options are invoked.
8384 (queue_middle_gc_tasks): New function.
8385 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8386 processed early before laying out sections during garbage collection.
8387 * gold.h (queue_middle_gc_tasks): New function.
8388 (is_prefix_of): Move from "layout.cc".
8389 * i386.cc (Target_i386::gc_process_relocs): New function.
8390 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8391 * main.cc (main): Create object of class "Garbage_collection".
8392 * object.cc (Relobj::copy_symbols_data): New function.
8393 (Relobj::is_section_name_included): New function.
e1df38aa
NC
8394 (Sized_relobj::do_layout): Allow this function to be called twice
8395 during garbage collection and defer layout of section during the
6d03d481
ST
8396 first call.
8397 * object.h (Relobj::get_symbols_data): New function.
8398 (Relobj::is_section_name_included): New function.
8399 (Relobj::copy_symbols_data): New function.
8400 (Relobj::set_symbols_data): New function.
8401 (Relobj::get_relocs_data): New function.
8402 (Relobj::set_relocs_data): New function.
8403 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8404 (Relobj::gc_process_relocs): New function.
8405 (Relobj::do_gc_process_relocs): New pure virtual function.
8406 (Relobj::sd_): New data member.
8407 (Sized_relobj::is_output_section_offset_invalid): New function.
8408 (Sized_relobj::do_gc_process_relocs): New function.
8409 * options.h (General_options::gc_sections): Modify to not be a no-op.
8410 (General_options::print_gc_sections): New option.
8411 * plugin.cc (Plugin_finish::run): Remove function call to
8412 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8413 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8414 * reloc.cc (Read_relocs::run): Add task to process relocs and
8415 determine unreferenced sections when doing garbage collection.
8416 (Gc_process_relocs): New class.
8417 (Sized_relobj::do_gc_process_relocs): New function.
8418 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8419 sections that are garbage collected.
8420 * reloc.h (Gc_process_relocs): New class.
8421 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8422 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8423 symbols whose corresponding sections are garbage collected.
8424 (Symbol_table::Symbol_table): Add new parameter for the garbage
8425 collection object.
8426 (Symbol_table::gc_mark_undef_symbols): New function.
8427 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8428 (Symbol_table::gc_mark_dyn_syms): New function.
8429 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8430 as garbage.
8431 (Symbol_table::add_from_object): Likewise.
8432 (Symbol_table::add_from_relobj): When building shared objects, do not
8433 treat externally visible symbols as garbage.
8434 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8435 table information for static and relocatable links.
8436 * symtab.h (Symbol_table::set_gc): New function.
8437 (Symbol_table::gc): New function.
8438 (Symbol_table::gc_mark_undef_symbols): New function.
8439 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8440 (Symbol_table::gc_mark_dyn_syms): New function.
8441 (Symbol_table::gc_): New data member.
e1df38aa 8442 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
8443 function.
8444 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8445 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8446
3b293544
CF
84472009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8448
8449 * options.h (General_options::gc_sections): Define as a no-op for now.
8450 (General_options::no_keep_memory): Ditto.
8451 (General_options::Bshareable): Define.
8452 * options.cc (General_options::finalize): Honor -Bshareable.
8453
83d22aa8
AS
84542009-01-20 Andreas Schwab <schwab@suse.de>
8455
8456 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8457 read the value in the contents, since we don't use it. Use the
8458 template endianness when writing.
8459 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8460
cd536b21
AS
84612009-01-19 Andreas Schwab <schwab@suse.de>
8462
8463 * configure.tgt (powerpc64-*): Fix targ_obj.
8464
99e9a495
ILT
84652009-01-15 Ian Lance Taylor <iant@google.com>
8466
8467 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8468 local symbols when stripping all symbols.
8469
bbbfea06
CC
84702009-01-14 Cary Coutant <ccoutant@google.com>
8471
99e9a495 8472 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 8473
0f7c0701
CC
84742009-01-14 Cary Coutant <ccoutant@google.com>
8475
8476 * archive.cc (Archive::get_elf_object_for_member): Remove call
8477 to File_read::claim_for_plugin.
8478 * descriptors.cc (Descriptors::open): Remove reference to
8479 is_claimed.
8480 (Descriptors::claim_for_plugin): Remove.
8481 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8482 (Descriptors::is_claimed): Remove.
8483 (claim_descriptor_for_plugin): Remove.
8484 * fileread.cc (File_read::claim_for_plugin): Remove.
8485 * fileread.h (File_read::claim_for_plugin): Remove.
8486 (File_read::descriptor): Reopen descriptor if necessary.
8487 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8488 (Plugin_manager::all_symbols_read): Add task parameter. Change
8489 all callers.
8490 (Plugin_manager::get_input_file): New function.
8491 (Plugin_manager::release_input_file): New function.
8492 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8493 corresponding data member.
8494 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8495 and pass to base constructor. Change all callers.
8496 (get_input_file, release_input_file): New functions.
8497 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8498 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8499 (Plugin_manager::all_symbols_read): Add task parameter.
8500 (Plugin_manager::get_input_file): New function.
8501 (Plugin_manager::release_input_file): New function.
8502 (Plugin_manager::task_): New data member.
8503 (Pluginobj::Pluginobj): Add filesize parameter.
8504 (Pluginobj::filename): New function.
8505 (Pluginobj::descriptor): New function.
8506 (Pluginobj::filesize): New function.
8507 (Pluginobj::filesize_): New data member.
8508 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8509 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8510 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8511
8512 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8513 with archive libraries.
8514 * testsuite/Makefile.in: Regenerate.
8515 * testsuite/plugin_test.c (struct sym_info): New type.
8516 (get_input_file, release_input_file): New static variables.
8517 (onload): Capture new transfer vector entries.
8518 (claim_file_hook): Stop reading at end of file according to filesize.
8519 Factor out parsing of readelf output into separate function.
8520 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8521 APIs and get the source file name from the symbol table. Convert
8522 source file name to corresponding object file name. Print info
8523 message when adding new input files.
8524 (parse_readelf_line): New function.
8525 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8526 * testsuite/plugin_test_2.sh: Likewise.
8527 * testsuite/plugin_test_3.sh: Likewise.
8528 * testsuite/plugin_test_4.sh: New test case.
8529
62a6d109
ILT
85302009-01-07 Ian Lance Taylor <iant@google.com>
8531
8532 * version.cc (version_string): Bump to 1.8.
8533
483620e8
CC
85342008-12-23 Cary Coutant <ccoutant@google.com>
8535
8536 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8537 * plugin.cc (Plugin_manager::finish): Rename as
8538 layout_deferred_objects. Move cleanup to separate function.
8539 (Plugin_manager::cleanup): New function.
8540 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8541 separately.
8542 * plugin.h (Plugin_manager::finish): Rename as
8543 layout_deferred_objects.
8544 (Plugin_manager::cleanup): New function.
8545 (Plugin_manager::cleanup_done): New field.
8546
d66a9eb3
CC
85472008-12-23 Cary Coutant <ccoutant@google.com>
8548
8549 * plugin.cc (is_visible_from_outside): New function.
8550 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8551 so we don't return "IR only" status for exported symbols or -r links.
8552
8553 * testsuite/Makefile.am (plugin_test_3): New test case.
8554 * testsuite/Makefile.in: Regenerate.
8555 * testsuite/plugin_test_3.sh: New file.
8556
5995b570
CC
85572008-12-22 Cary Coutant <ccoutant@google.com>
8558
8559 * object.cc (Sized_relobj::layout_section): New function.
8560 (Sized_relobj::do_layout): Defer layout of input sections until after
8561 plugin has provided replacement files.
8562 (Sized_relobj::do_layout_deferred_sections): New function.
8563 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8564 (Relobj::layout_deferred_sections): New function.
8565 (Relobj::do_layout_deferred_sections): New function.
8566 (Sized_relobj::do_layout_deferred_sections): New function.
8567 (Sized_relobj::layout_section): New function.
8568 (Sized_relobj::Deferred_layout): New structure.
8569 (Sized_relobj::deferred_layout_): New field.
8570 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8571 Change all callers. Layout deferred sections.
8572 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8573 references.
8574 (Plugin_hook::run): Move code from do_plugin_hook inline.
8575 (Plugin_hook::do_plugin_hook): Remove.
8576 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8577 (Plugin_manager::finish): Renamed, was cleanup.
8578 (Plugin_manager::should_defer_layout): New function.
8579 (Plugin_manager::add_deferred_layout_object): New function.
8580 (Plugin_manager::Deferred_layout_list): New type.
8581 (Plugin_manager::deferred_layout_objects_): New field.
8582 (Plugin_hook::do_plugin_hook): Remove.
8583
ee769c88
ILT
85842008-12-17 Ian Lance Taylor <iant@google.com>
8585
8586 * options.h (class General_options): Add --no case for
8587 --export-dynamic.
8588
abc8dcba
CC
85892008-12-16 Cary Coutant <ccoutant@google.com>
8590
8591 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8592 vector.
8593 (Plugin_manager::claim_file): Create plugin object even if
8594 plugin did not call the add_symbols callback.
8595 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8596 asking for more symbols than were added.
8597 * testsuite/Makefile.am (plugin_test_1): Add test case with
8598 no global symbols.
8599 (empty.syms): New target.
8600 * testsuite/Makefile.in: Regenerate.
8601 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8602 message. Don't call add_symbols if no globals.
8603 (all_symbols_read_hook): Don't provide replacement for empty
8604 claimed file.
8605
b0074644
ILT
86062008-12-12 Ian Lance Taylor <iant@google.com>
8607
68943102
ILT
8608 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8609 r_type == 0 for a local symbol with r_sym == 0.
8610 (scan_relocatable_relocs): Pass r_sym to
8611 local_non_section_strategy.
8612 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8613 r_sym parameter.
8614
b0074644
ILT
8615 * configure.ac: Update test for TLS descriptors: they are
8616 supported as of glibc 2.9.
8617 * configure: Rebuild.
8618
c2508178
ILT
86192008-12-11 Ian Lance Taylor <iant@google.com>
8620
8621 PR 7091
8622 * target-reloc.h (Default_scan_relocatable_relocs): For each
8623 function, map r_type == 0 to RELOC_DISCARD.
8624
2756a258
CC
86252008-12-10 Cary Coutant <ccoutant@google.com>
8626
8627 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8628 object to override a kept COMDAT group from a plugin object.
8629
bb6f53d3
ILT
86302008-12-09 Ian Lance Taylor <iant@google.com>
8631
fbc558e1
ILT
8632 PR 7088
8633 * yyscript.y (file_cmd): Handle INPUT.
8634
bb6f53d3
ILT
8635 * testsuite/initpri1.c: Change all declarations to be full
8636 prototypes by adding void, to avoid compiler warnings.
8637
4674ecfc
CC
86382008-12-05 Rafael Avila de Espindola <espindola@google.com>
8639
8640 * options.cc (General_options::parse_plugin_opt): New.
8641 (General_options::add_plugin): The argument now is just the filename.
8642 (General_options::add_plugin_option): New.
8643 * options.h (plugin_opt): New.
8644 (add_plugin): Change argument name.
8645 (add_plugin_option): New.
8646 * plugin.cc (Plugin::load): Don't parse the plugin option.
8647 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8648 (Plugin::add_option): New.
8649 (Plugin::args_): Change type.
8650 (Plugin::filename_): New.
8651 (Plugin_manager::add_plugin_option): New.
8652 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8653 * testsuite/Makefile.in: Regenerate.
8654
fd06b4aa
CC
86552008-12-05 Cary Coutant <ccoutant@google.com>
8656
8657 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8658 Handle --strip-lto-sections option.
8659 * options.h (strip_lto_sections): New option.
8660
6c52134c
CC
86612008-12-01 Cary Coutant <ccoutant@google.com>
8662
8663 * plugin.cc (ld_plugin_message): Change format parameter to const.
8664 Fix mismatch between new[] and delete.
8665
a45248e0
CC
86662008-11-14 Cary Coutant <ccoutant@google.com>
8667
8668 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8669 instead of -1U.
8670
c82fbeee
CS
86712008-11-05 Craig Silverstein <csilvers@google.com>
8672
8673 * options.cc (General_options::parse_dynamic_list): New function.
8674 * options.h (General_options): New flags dynamic_list,
8675 dynamic_list_data, dynamic_list_cpp_new, and
8676 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8677 (General_options::in_dynamic_list): New function.
8678 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8679 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8680 (Lex::can_continue_name): Likewise.
8681 (yylex): Likewise.
8682 (read_script_file): New parameter script_options.
8683 (read_dynamic_list): New function.
8684 (Script_options::define_dynamic_list): New function.
8685 (dynamic_list_keyword_parsecodes): New variable.
8686 (dynamic_list_keywords): New variable.
8687 * script.h (Script_options::define_dynamic_list): New function
8688 prototype.
8689 (read_dynamic_list): New function prototype.
8690 * symtab.cc (strprefix): New macro.
8691 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8692 dynamic_list_data, dynamic_list_cpp_new, and
8693 dynamic_list_cpp_typeinfo.
8694 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8695 (dynamic_list_expr): New rule.
8696 (dynamic_list_nodes): Likewise.
8697 (dynamic_list_node): Likewise.
8698 * testsuite/Makefile.am (dynamic_list): New test.
8699 * testsuite/Makefile.in: Regenerated.
8700 * testsuite/dynamic_list.t: New file.
8701 * testsuite/dynamic_list.sh: New file.
8702
e0bb29a5
CS
87032008-11-05 Craig Silverstein <csilvers@google.com>
8704
8705 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8706 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8707 (t11_last): Likewise.
8708 * testsuite/ver_test_6.c (main): Likewise.
8709
4e1e25e0
CC
87102008-10-07 Cary Coutant <ccoutant@google.com>
8711
8712 * options.c (General_options::finalize): Add check for -static and
8713 -shared.
8714 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8715 is not empty.
8716
92f03fcb
CC
87172008-10-02 Cary Coutant <ccoutant@google.com>
8718
8719 * plugin.cc (make_sized_plugin_object): Fix conditional
8720 compilation to work when not all targets are enabled.
8721
fbd8a257
CC
87222008-09-29 Cary Coutant <ccoutant@google.com>
8723
8724 * archive.cc (Archive::get_file_and_offset): Use filename instead
8725 of name to get library path.
8726 (Archive::include_member): Unlock external member of a thin archive.
8727
8728 * testsuite/Makefile.am (TEST_AR): New variable.
8729 (thin_archive_test_1): New test.
8730 (thin_archive_test_2): New test.
81636b3f
CC
8731 * testsuite/Makefile.in: Regenerate.
8732 * testsuite/thin_archive_main.cc: New file.
8733 * testsuite/thin_archive_test_1.cc: New file.
8734 * testsuite/thin_archive_test_2.cc: New file.
8735 * testsuite/thin_archive_test_3.cc: New file.
8736 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 8737
eff45813
CC
87382008-09-29 Cary Coutant <ccoutant@google.com>
8739
8740 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8741 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8742 instead of -1U.
8743 (Sized_relobj::do_finalize_local_symbols): Likewise.
8744 (Sized_relobj::map_to_kept_section): Likewise.
8745 * object.h (Sized_relobj::invalid_address): New constant.
8746 (Sized_relobj::do_output_section_offset): Check for invalid_address
8747 and return -1ULL.
8748 * output.cc (Output_reloc::local_section_offset): Use constant
8749 invalid_address instead of -1U.
8750 (Output_reloc::get_address): Likewise.
8751 (Output_section::output_address): Change -1U to -1ULL.
8752 * output.h (Output_reloc::invalid_address): New constant.
8753 * reloc.cc (Sized_relobj::write_sections): Use constant
8754 invalid_address instead of -1U.
8755 (Sized_relobj::relocate_sections): Likewise.
8756 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8757 values for merge sections.
8758 * target-reloc.h (relocate_for_relocatable): Use constant
8759 invalid_address instead of -1U.
8760
89fc3421
CC
87612008-09-19 Cary Coutant <ccoutant@google.com>
8762
8763 Add plugin functionality for link-time optimization (LTO).
8764 * configure.ac (plugins): Add --enable-plugins option.
8765 * configure: Regenerate.
8766 * config.in: Regenerate.
8767 * Makefile.am (LIBDL): New variable.
8768 (CCFILES): Add plugin.cc.
8769 (HFILES): Add plugin.h.
8770 (ldadd_var): Add LIBDL.
8771 * Makefile.in: Regenerate.
8772
8773 * archive.cc: Include "plugin.h".
8774 (Archive::setup): Don't preread archive symbols when using a plugin.
8775 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8776 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8777 files.
8778 (Archive::include_member): Add symbols from plugin objects.
8779 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8780 * descriptors.cc (Descriptors::open): Check for file descriptors
8781 abandoned by plugins.
8782 (Descriptors::claim_for_plugin): New function.
8783 * descriptors.h (Descriptors::claim_for_plugin): New function.
8784 (Open_descriptor::is_claimed): New field.
8785 (claim_descriptor_for_plugin): New function.
8786 * fileread.cc (File_read::claim_for_plugin): New function.
8787 * fileread.h (File_read::claim_for_plugin): New function.
8788 (File_read::descriptor): New function.
8789 * gold.cc: Include "plugin.h".
8790 (queue_initial_tasks): Add task to call plugin hooks for generating
8791 new object files.
8792 * main.cc: Include "plugin.h".
8793 (main): Load plugin libraries.
8794 * object.h (Pluginobj): Declare.
8795 (Object::pluginobj): New function.
8796 (Object::do_pluginobj): New function.
8797 (Object::set_target): New function.
8798 * options.cc: Include "plugin.h".
8799 (General_options::parse_plugin): New function.
8800 (General_options::General_options): Initialize plugins_ field.
8801 (General_options::add_plugin): New function.
8802 * options.h (Plugin_manager): Declare.
8803 (General_options): Add --plugin option.
8804 (General_options::has_plugins): New function.
8805 (General_options::plugins): New function.
8806 (General_options::add_plugin): New function.
8807 (General_options::plugins_): New field.
8808 * plugin.cc: New file.
8809 * plugin.h: New file.
8810 * readsyms.cc: Include "plugin.h".
8811 (Read_symbols::do_read_symbols): Check for archive before checking
8812 for ELF file. Call plugin hooks to claim files.
8813 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8814 from a real object file; force override when processing replacement
8815 files.
8816 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8817 (Symbol::init_base_object): Likewise.
8818 (Symbol::init_base_output_data): Likewise.
8819 (Symbol::init_base_output_segment): Likewise.
8820 (Symbol::init_base_constant): Likewise.
8821 (Symbol::init_base_undefined): Likewise.
8822 (Symbol::output_section): Assert that object is not a plugin.
8823 (Symbol_table::add_from_pluginobj): New function.
8824 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8825 undefined.
8826 (Symbol_table::sized_write_globals): Likewise.
8827 (Symbol_table::add_from_pluginobj): Instantiate template.
8828 * symtab.h (Sized_pluginobj): Declare.
8829 (Symbol::in_real_elf): New function.
8830 (Symbol::set_in_real_elf): New function.
8831 (Symbol::in_real_elf_): New field.
8832 (Symbol_table::add_from_pluginobj): New function.
8833
8834 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8835 (LIBDL): New variable.
8836 (LDADD): Add LIBDL.
8837 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8838 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8839 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8840 (MOSTLYCLEANFILES): Likewise.
8841 * testsuite/Makefile.in: Regenerate.
8842 * testsuite/plugin_test.c: New file.
8843 * testsuite/plugin_test_1.sh: New file.
8844 * testsuite/plugin_test_2.sh: New file.
8845
de31bda5
ILT
88462008-09-16 Ian Lance Taylor <iant@google.com>
8847
9c2d0ef9
ILT
8848 * target-reloc.h (relocate_section): Check whether a symbol is
8849 defined by the ABI before reporting an undefined symbol error.
8850 * target.h (Target::is_defined_by_abi): Make parameter const.
8851 (Target::do_is_defined_by_abi): Likewise.
8852 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8853 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8854 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8855 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8856 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8857 * testsuite/Makefile.in: Rebuild.
8858
de31bda5
ILT
8859 * fileread.cc (make_view): Add casts to avoid warning.
8860
9fa33bee
AO
88612008-09-16 Alexandre Oliva <aoliva@redhat.com>
8862
8863 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8864 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8865
183fd0e3
AO
88662008-09-16 Alexandre Oliva <aoliva@redhat.com>
8867
8868 * options.h (General_options::output_is_executable): New.
8869 (General_options::output_is_pie): New.
8870 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8871 for shared libraries.
8872 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8873
7be8330a
CD
88742008-09-11 Chris Demetriou <cgd@google.com>
8875
8876 * options.h (origin): New -z option.
8877 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8878 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8879 in DT_FLAGS_1.
8880
a9caad02
CC
88812008-09-05 Cary Coutant <ccoutant@google.com>
8882
8883 * fileread.cc (File_read::make_view): Add check for attempt to map
8884 beyond end of file.
8885
ae6dce4d
CC
88862008-09-05 Cary Coutant <ccoutant@google.com>
8887
8888 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8889 explicit instantiations.
8890
d7ab2a47
KVH
88912008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8892
8893 PR gold/6858
8894 * options.cc (General_options::finalize): Allow undefined symbols
8895 in shlibs if linking -shared.
8896
8897 PR gold/6859
8898 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8899 symbols as not needing a dynsym entry.
8900
1e52a9c1
CS
89012008-08-20 Craig Silverstein <csilvers@google.com>
8902
8903 * fileread.cc (File_read::open): Do not lock the file unless it
8904 was successfully opened.
8905
d85c80a3
CC
89062008-08-14 Cary Coutant <ccoutant@google.com>
8907
8908 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8909 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8910 * testsuite/tls_test.cc (struct int128): 128-bit struct
8911 for testing TLS relocs with non-zero addend.
8912 (v12): New TLS variable.
8913 (t12): New test.
8914 (t_last): Add check for v12.
8915 * testsuite/tls_test.h (t12): New function.
8916 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8917
2d924fd9
ILT
89182008-08-13 Ian Lance Taylor <iant@google.com>
8919
8920 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8921 set tls_segment_ or relro_segment_.
8922 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8923 when appropriate.
8924 * output.h (Output_section::clear_is_relro): New function.
8925 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8926 sections specially even when output_data_ is empty.
8927 (Output_segment::maximum_alignment): When first section is relro,
8928 only force alignment for PT_LOAD segments.
8929 * script.cc (script_data_segment_align): New function.
8930 (script_data_segment_relro_end): New function.
8931 * script-c.h (script_data_segment_align): Declare.
8932 (script_data_segment_relro_end): Declare.
8933 * script-sections.h (class Script_sections): Declare
8934 data_segment_align and data_segment_relro_end. Add fields
8935 segment_align_index_ and saw_relro_end_.
8936 * script-sections.cc (class Sections_element): Add set_is_relro
8937 virtual function. Add new bool* parameter to place_orphan_here.
8938 Add get_output_section virtual function.
8939 (class Output_section_definition): Add set_is_relro. Add new
8940 bool* parameter to place_orphan_here. Add get_output_section.
8941 Add is_relro_ field.
8942 (Output_section_definition::Output_section_definition): Initialize
8943 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8944 and is_relro_ fields.
8945 (Output_section_definition::place_orphan_here): Add is_relro
8946 parameter.
8947 (Output_section_definition::set_section_addresses): Set relro for
8948 output section.
8949 (Output_section_definition::alternate_constraint): Likewise.
8950 (class Orphan_output_section): Add new bool* parameter to
8951 place_orphan_here. Add get_output_section.
8952 (Orphan_output_section::place_orphan_here): Add is_relro
8953 parameter.
8954 (Script_sections::Script_sections): Initialize
8955 data_segment_align_index_ and saw_relro_end_.
8956 (Script_sections::data_segment_align): New function.
8957 (Script_sections::data_segment_relro_end): New function.
8958 (Script_sections::place_orphan): Set or clear is_relro.
8959 (Script_sections::set_section_addresses): Force alignment of first
8960 TLS section.
8961 * yyscript.y (exp): Call script_data_segment_align and
8962 script_data_segment_relro_end.
8963 * testsuite/relro_script_test.t: New file.
8964 * testsuite/relro_test.cc (using_script): Declare.
8965 (t1, t2): Test using_script.
8966 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8967 (relro_script_test_SOURCES): Define.
8968 (relro_script_test_DEPENDENCIES): Define.
8969 (relro_script_test_LDFLAGS): Define.
8970 (relro_script_test_LDADD): Define.
8971 (relro_script_test.so): New target.
8972 * testsuite/Makefile.in: Rebuild.
8973
f827c9a9
CC
89742008-08-06 Cary Coutant <ccoutant@google.com>
8975
8976 * archive.cc (Archive::total_archives, Archive::total_members)
8977 (Archive::total_members_loaded): New variables.
8978 (Archive::setup): Add parameter. Add option to preread
8979 archive symbols.
8980 (Archive::read_armap): Add counter.
8981 (Archive::get_file_and_offset): New function.
8982 (Archive::get_elf_object_for_member): New function.
8983 (Archive::read_all_symbols): New function.
8984 (Archive::read_symbols): New function.
8985 (Archive::add_symbols): Add counters.
8986 (Archive::include_all_members): Use armap to find members if it's
8987 already built.
8988 (Archive::include_member): Skip reading symbols if already read.
8989 Factored code into Archive::get_file_and_offset and
8990 Archive::get_elf_object_for_member. Changed call to
8991 Mapfile::report_include_archive_member.
8992 (Archive::print_stats): New function.
8993 * archive.h: Declare Object and Read_symbols_data classes.
8994 (Archive::Archive): Add initializers for new members.
8995 (Archive::setup): Add parameter.
8996 (Archive::print_stats): New function.
8997 (Archive::total_archives, Archive::total_members)
8998 (Archive::total_members_loaded): New variables.
8999 (Archive::get_file_and_offset): New function.
9000 (Archive::get_elf_object_for_member): New function.
9001 (Archive::read_all_symbols): New function.
9002 (Archive::read_symbols): New function.
9003 (Archive::Archive_member): New class.
9004 (Archive::members_): New member.
9005 (Archive::num_members_): New member.
9006 * main.cc: Include archive.h.
9007 (main): Call Archive::print_stats.
9008 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9009 archive parameter; member_name is now the fully-decorated name.
9010 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9011 * options.h: (General_options): Add --preread-archive-symbols option.
9012 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9013 Archive::setup.
9014
de4c45bd
ILT
90152008-08-04 Ian Lance Taylor <iant@google.com>
9016
9017 * symtab.h (Symbol::use_plt_offset): New function.
9018 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9019 * powerpc.cc (Relocate::relocate): Likewise.
9020 * sparc.cc (Relocate::relocate): Likewise.
9021 * x86_64.cc (Relocate::relocate): Likewise.
9022 * testsuite/weak_plt.sh: New test.
9023 * testsuite/weak_plt_main.cc: New test.
9024 * testsuite/weak_plt_shared.cc: New test.
9025 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9026 (check_PROGRAMS): Add weak_plt.
9027 (check_DATA): Add weak_plt_shared.so.
9028 (weak_plt_main_pic.o, weak_plt): New targets.
9029 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9030 * testsuite/Makefile.in: Rebuild.
9031
9032 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9033 gcctestdir/ld.
9034 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9035 * testsuite/Makefile.in: Rebuild.
9036
323ee3f4
AM
90372008-08-04 Alan Modra <amodra@bigpond.net.au>
9038
9039 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9040 * Makefile.in: Regenerate.
9041 * po/POTFILES.in: Regenerate.
9042
7c07ecec
ILT
90432008-07-29 Ian Lance Taylor <iant@google.com>
9044
9045 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9046 symbols before other symbols.
9047 * testsuite/script_test_2.cc (test_addr): Declare.
9048 (test_addr_alias): Declare.
9049 (main): Check that test_addr and test_addr_alias have the right
cd536b21 9050 values.
7c07ecec
ILT
9051 * testsuite/script_test_2.t: Define test_addr_alias and
9052 test_addr.
9053
5778530e
ILT
90542008-07-24 Ian Lance Taylor <iant@google.com>
9055
2a00e4fb
ILT
9056 PR 5990
9057 * descriptors.cc: New file.
9058 * descriptors.h: New file.
9059 * gold-threads.h (class Hold_optional_lock): New class.
9060 * fileread.cc: Include "descriptors.h".
9061 (File_read::~File_read): Release descriptor rather than closing
9062 it.
9063 (File_read::open) [file]: Call open_descriptor rather than open.
9064 Set is_descriptor_opened_.
9065 (File_read::open) [memory]: Assert that descriptor is not open.
9066 (File_read::reopen_descriptor): New function.
9067 (File_read::release): Release descriptor.
9068 (File_read::do_read): Make non-const. Reopen descriptor.
9069 (File_read::read): Make non-const.
9070 (File_read::make_view): Reopen descriptor.
9071 (File_read::do_readv): Likewise.
9072 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9073 Update declarations.
9074 * layout.cc: Include "descriptors.h".
9075 (Layout::create_build_id): Use open_descriptor rather than open.
9076 * output.cc: Include "descriptors.h".
9077 (Output_file::open): Use open_descriptor rather than open.
9078 * archive.cc (Archive::const_iterator): Change Archive to be
9079 non-const.
9080 (Archive::begin, Archive::end): Make non-const.
9081 (Archive::count_members): Likewise.
9082 * archive.h (class Archive): Update declarations.
9083 * object.h (Object::read): Make non-const.
9084 * Makefile.am (CCFILES): Add descriptors.cc.
9085 (HFILES): Add descriptors.h.
9086 * Makefile.in: Rebuild.
9087
801647d1
ILT
9088 PR 6716
9089 * gold.h: Always include <clocale>. Add Solaris workarounds
9090 following code in binutils/sysdep.h.
9091
5edd166e
ILT
9092 PR 6048
9093 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9094 this->eh_frame_hdr_ is NULL before using it.
9095
c89ad728
ILT
9096 * dynobj.cc (Versions::Versions): Update comment.
9097
aa86f06b
ILT
9098 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9099 the base version name.
9100
5778530e
ILT
9101 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9102 array size plus one.
9103 (Stringpool_template::set_string_offsets): Subtract one from key
9104 before using it as an array index.
9105 (Stringpool_template::get_offset_with_length): Likewise.
9106 (Stringpool_template::write_to_buffer): Likewise.
9107 * stringpool.h (Stringpool_template::get_offset_from_key):
9108 Likewise.
9109
057ead22
ILT
91102008-07-23 Ian Lance Taylor <iant@google.com>
9111
7f649c59
ILT
9112 PR 6658
9113 * object.h (Merged_symbol_value::value): Do our best to handle a
9114 negative addend.
9115
057ead22
ILT
9116 PR 6647
9117 * script.cc (Version_script_info::get_versions): Don't add empty
9118 version tag to return value.
9119 (Version_script_info::get_symbol_version_helper): Change return
9120 type to bool. Add pversion parameter. Change all callers.
9121 (script_register_vers_node): Don't require a non-NULL tag.
9122 * script.h (class Version_script_info): Update declarations.
9123 (Version_script_info::get_symbol_version): Change return type to
9124 bool. Add version parameter. Change all callers.
9125 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9126 handling. Handle an empty version from a version script.
9127 (Symbol_table::define_special_symbol): Likewise.
9128 * testsuite/ver_test_10.script: New file.
9129 * testsuite/ver_test_10.sh: New file.
9130 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9131 (check_DATA): Add ver_test_10.syms.
9132 (ver_test_10.syms, ver_test_10.so): New target.
9133 * testsuite/Makefile.in: Rebuild.
9134
58e54ac2
CD
91352008-07-23 Simon Baldwin <simonb@google.com>
9136
9137 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9138 to zero for undefined symbols from dynamic libraries.
9139
95d14cd3
ILT
91402008-07-23 Ian Lance Taylor <iant@google.com>
9141
9142 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9143 Change all callers.
9144 * symtab.h (class Symbol_table): Update declaration.
9145 * testsuite/ver_test_9.cc: New file.
9146 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9147 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9148 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9149 (ver_test_9.so, ver_test_9.o): New targets.
9150 * testsuite/Makefile.in: Rebuild.
9151
92de84a6
ILT
91522008-07-22 Ian Lance Taylor <iant@google.com>
9153
34810851
ILT
9154 * options.h (class General_options): Define --check-sections.
9155 * layout.cc (Layout::set_segment_offsets): Handle
9156 --check-sections.
9157
af6156ef
ILT
9158 * options.h (class General_options): Define -n/--nmagic and
9159 -N/--omagic.
9160 * options.cc (General_options::finalize): For -n/--nmagic or
9161 -N/--omagic, set -static.
9162 * layout.cc (Layout::attach_allocated_section_to_segment): If
9163 -N/--omagic, don't put read-only and read-write sections in
9164 different segments.
9165 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9166 finding a read-only segment.
9167 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9168 don't set the minimum segment alignment to the common page size,
9169 and don't set the file offset to the address modulo the page size.
9170 * script-sections.cc (Script_sections::create_segments): If
9171 -n/--omagic, don't put read-only and read-write sections in
9172 different segments.
9173
92de84a6
ILT
9174 * cref.cc: New file.
9175 * cref.h: New file.
9176 * options.h (class General_options): Add --print-symbol-counts.
9177 * main.cc (main): Issue defined symbol report if requested.
9178 * archive.cc (Archive::interpret_header): Make into a const member
9179 function.
9180 (Archive::add_symbols): Call Input_objects::archive_start and
9181 archive_stop.
9182 (Archive::const_iterator): Define new class.
9183 (Archive::begin, Archive::end): New functions.
9184 (Archive::include_all_members): Rewrite to use iterator.
9185 (Archive::count_members): New function.
9186 * archive.h (class Archive): Update declarations.
9187 (Archive::filename): New function.
9188 * object.cc: Include "cref.h".
9189 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9190 (Sized_relobj::do_get_global_symbol_counts): New function.
9191 (Input_objects::add_object): Add object to cross-referencer.
9192 (Input_objects::archive_start): New function.
9193 (Input_objects::archive_stop): New function.
9194 (Input_objects::print_symbol_counts): New function.
9195 * object.h: Declare Cref and Archive.
9196 (Object::get_global_symbol_counts): New function.
9197 (Object::do_get_global_symbol_counts): New pure virtual function.
9198 (class Sized_relobj): Add defined_count_ field. Update
9199 declarations.
9200 (class Input_objects): Add cref_ field. Update constructor.
9201 Update declarations.
9202 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9203 defined_count_.
9204 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9205 symbol counts.
9206 (Sized_dynobj::do_get_global_symbol_counts): New function.
9207 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9208 defined_count_. Update declarations. Define Symbols typedef.
9209 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9210 parameter. Change all callers.
9211 (Symbol_table::add_from_dynobj): Add sympointers and defined
9212 parameters. Change all callers.
9213 * symtab.h (class Symbol_table): Update declarations.
9214 * Makefile.am (CCFILES): Add cref.cc.
9215 (HFILES): Add cref.h.
9216 * Makefile.in: Rebuild.
9217
3f7c5e1d
CD
92182008-07-22 Simon Baldwin <simonb@google.com>
9219
9220 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9221 to zero when writing undefined symbols.
9222
e0b64032
ILT
92232008-07-22 Ian Lance Taylor <iant@google.com>
9224
9225 * output.cc (Output_section::add_input_section): Don't try to
9226 merge empty merge sections.
9227
096b02cf
CS
92282008-07-21 Craig Silverstein <csilvers@google.com>
9229
9230 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9231 Include symbol version in error message.
cd536b21 9232
1d1f116d
CD
92332008-07-20 Chris Demetriou <cgd@google.com>
9234
cd536b21 9235 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
9236 (RANDOM_SEED_CFLAGS): New substituted variable.
9237 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9238 * configure: Rebuild.
9239 * Makefile.in: Likewise.
9240 * testsuite/Makefile.in: Likewise.
9241
a18f591e
ILT
92422008-07-18 Ian Lance Taylor <iant@google.com>
9243
9244 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9245 where we see NAME/NULL and NAME/VERSION as separate symbols.
9246 * testsuite/ver_test_main.cc (main): Call t4.
9247 (t4, t4_2a): Define.
9248 * testsuite/ver_test_2.cc (t4_2): Define.
9249 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9250 * testsuite/ver_test_4.cc (t4_2a): Define.
9251 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9252 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9253
c6e3f6ed
ILT
92542008-07-17 Ian Lance Taylor <iant@google.com>
9255
9256 * dynobj.cc (Versions::add_def): If we give an error about a
9257 missing version, go ahead and create the version anyhow.
9258
ef9beddf
ILT
92592008-07-10 Ian Lance Taylor <iant@google.com>
9260
9261 Handle output sections with more than 0x7fffffff bytes.
9262 * object.h (class Relobj): Change map_to_output_ to
9263 output_sections_, and just keep a section pointer. Change all
9264 uses. Move comdat group support to Sized_relobj.
9265 (Relobj::is_section_specially_mapped): Remove.
9266 (Relobj::output_section): Remove poff parameter. Change all
9267 callers.
9268 (Relobj::output_section_offset): New function.
9269 (Relobj::set_section_offset): Rewrite.
9270 (Relobj::map_to_output): Remove.
9271 (Relobj::output_sections): New function.
9272 (Relobj::do_output_section_offset): New pure virtual function.
9273 (Relobj::do_set_section_offset): Likewise.
9274 (class Sized_relobj): Add section_offsets_ field. Add comdat
9275 group support from Relobj. Update declarations.
9276 (Sized_relobj::get_output_section_offset): New function.
9277 (Sized_relobj::do_output_section_offset): New function.
9278 (Sized_relobj::do_set_section_offset): New function.
9279 * object.cc (Relobj::output_section_address): Remove.
9280 (Sized_relobj::Sized_relobj): Initialize new fields.
9281 (Sized_relobj::include_section_group): Cast find_kept_object to
9282 Sized_relobj.
9283 (Sized_relobj::include_linkonce_section): Likewise.
9284 (Sized_relobj::do_layout): Use separate arrays for output section
9285 and output offset.
9286 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9287 output_sections.
9288 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9289 output_sections and section_offsets.
9290 (Sized_relobj::write_local_symbols): Likewise.
9291 (map_to_kept_section): Compute output address directly.
9292 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9293 output_sections and section_offsets.
9294 (Sized_relobj::write_sections): Likewise.
9295 (Sized_relobj::relocate_sections): Likewise.
9296 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9297 * output.h (class Output_reloc): Update declarations. Change
9298 u2_.relobj to Sized_relobj*.
9299 (class Output_data_reloc): Change add functions to use
9300 Sized_relobj*.
9301 * output.cc (Output_reloc::Output_reloc): Change relobj to
9302 Sized_relobj*.
9303 (Output_reloc::local_section_offset): Change return type to
9304 Elf_Addr. Use get_output_section_offset.
9305 (Output_reloc::get_address): Likewise.
9306 (Output_section::is_input_address_mapped): Don't call
9307 is_section_specially_mapped.
9308 (Output_section::output_offset): Likewise.
9309 (Output_section::output_address): Likewise.
9310 (Output_section::starting_output_address): Likewise.
9311 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9312 parameter to Sized_relobj*.
9313 (Copy_relocs::need_copy_reloc): Likewise.
9314 (Copy_relocs::save): Likewise.
9315 * copy-relocs.h (class Copy_relocs): Update declarations.
9316 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9317 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9318 * target-reloc.h (relocate_for_relocatable): Change
9319 offset_in_output_section type to Elf_Addr. Change code that uses
9320 it as well.
9321 * layout.cc (Layout::layout): Always set *off.
9322 * mapfile.cc (Mapfile::print_input_section): Use
9323 output_section_offset.
9324 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9325 Sized_relobj*.
9326 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9327 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9328 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9329
5cb66f97
ILT
93302008-07-03 Ian Lance Taylor <iant@google.com>
9331
9332 * layout.cc (Layout::include_section): Do not discard unrecognized
9333 SHT_STRTAB sections.
9334
afe47622
CS
93352008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9336
9337 * script.cc (Lex::can_continue_name): Make '?' allowable in
9338 version-script names.
9339 * testsuite/version_script.map: Change glob pattern to use '?'
9340
5adf9721
ILT
93412008-06-30 Manish Singh <yosh@gimp.org>
9342
9343 PR 6585
9344 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9345 Correct typo.
9346
e6fde208
ILT
93472008-06-30 Ian Lance Taylor <iant@google.com>
9348
9349 PR 6660
9350 PR 6682
9351 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9352 versions]: Don't try to read the value in the contents, since we
9353 don't use it. Use the template endianness when writing.
9354
3f2e6a2d
CC
93552008-06-25 Cary Coutant <ccoutant@google.com>
9356
9357 * fileread.cc (File_read::make_view): Assert on zero-length view.
9358 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9359 symbol table when there are no symbols to read.
9360
c43d3a48
CS
93612008-06-23 Craig Silverstein <csilvers@google.com>
9362
9363 * version.cc (version_string): Bump to 1.7
9364
5f494ea0
CS
93652008-06-18 Craig Silverstein <csilvers@google.com>
9366
9367 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9368 constant 0xFFFF to type Valtype.
9369 (Powerpc_relocate_functions::rel16_ha): Likewise.
9370
c42e122e
ILT
93712008-06-17 Ian Lance Taylor <iant@google.com>
9372
f34787f8
ILT
9373 * output.h (Output_section::Input_section): Initialize p2align_ to
9374 zero for Output_section_data constructors.
9375 (Output_section::Input_section::addralign): If not an input
9376 section, return the alignment of the Output_section_data.
9377 * testsuite/copy_test.cc: New file.
9378 * testsuite/copy_test_1.cc: New file.
9379 * testsuite/copy_test_2.cc: New file.
9380 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9381 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9382 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9383 (copy_test_1_pic.o, copy_test_1.so): New targets.
9384 (copy_test_2_pic.o, copy_test_2.so): New targets.
9385 * testsuite/Makefile.in: Rebuild.
9386
c42e122e
ILT
9387 * script-sections.cc (Script_sections::place_orphan): Initialize
9388 local variable exact.
9389
ce3ac18a
DE
93902008-06-13 David Edelsohn <edelsohn@gnu.org>
9391
9392 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9393
42cacb20
DE
93942008-06-12 David Edelsohn <edelsohn@gnu.org>
9395 David S. Miller <davem@davemloft.net>
9396
9397 * powerpc.cc: New file.
9398 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9399 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9400 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9401 * Makefile.in: Rebuild.
9402
7b308235
ILT
94032008-06-09 Ian Lance Taylor <iant@google.com>
9404
9405 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9406 <exception>.
9407 (throwing, orig_terminate): New static variables.
9408 (terminate_handler): New static function.
9409 (t2): Set terminate handler.
9410
f0b886e3
ILT
94112008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9412
9413 PR 6584
cd536b21 9414 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
9415 alignment.
9416
3e90f135
CC
94172008-05-30 Cary Coutant <ccoutant@google.com>
9418
9419 * archive.cc (Archive::include_all_members) Correct to step
9420 over symbol table and extended name table in thin archives.
9421
e09ad04a
ILT
94222008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9423
9424 PR 6407
9425 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9426 calculation.
9427
62b01cb5
ILT
94282008-05-28 Caleb Howe <cshowe@google.com>
9429
9430 * reduced_debug_output.cc: New file.
9431 * reduced_debug_output.h: New file.
92de84a6 9432 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
9433 * options.cc (General_options::finalize): Add strip_debug_non_line
9434 to the strip heirarchy.
9435 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9436 fields.
9437 * layout.cc: Include "reduced_debug_output.h".
9438 (Layout::Layout): Initialize new fields.
9439 (line_only_debug_sections): New static array.
9440 (is_lines_only_debug_sections): New static inline function.
9441 (Layout::include_section): Handle --strip-debug-non-line.
9442 (Layout::make_output_section): If --strip-debug-non-line, build
9443 new output sections for .debug_abbrev and .debug_info.
9444 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9445 gold. Warn about possible overflow.
9446 (read_signed_LEB_128): Likewise.
9447 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9448 (read_signed_LEB_128): Declare.
9449 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9450 (HFILES): Add reduced_debug_output.h.
9451 * Makefile.in: Rebuild.
9452
7d9e3d98
ILT
94532008-05-21 Ian Lance Taylor <iant@google.com>
9454
9455 * mapfile.cc: New file.
9456 * mapfile.h: New file.
9457 * options.h (class General_options): Add -M/--print-map and -Map.
9458 * options.cc (General_options::finalize): Make -M equivalent to
9459 -Map -.
9460 * main.cc: Include <cstdio> and "mapfile.h".
9461 (main): Open mapfile if requested.
9462 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9463 constructor. Change caller.
9464 (queue_initial_tasks): Add mapfile parameter. Change caller.
9465 (queue_middle_tasks): Likewise.
9466 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9467 declarations.
9468 * archive.cc: Include "mapfile.h".
9469 (Archive::add_symbols): Add mapfile parameter. Change all
9470 callers. Pass mapfile, symbol, and reason to include_member.
9471 (Archive::include_all_members): Add mapfile parameter. Change all
9472 callers.
9473 (Archive::include_member): Add mapfile, sym, and why parameters.
9474 Change all callers. Report inclusion to map file.
9475 * archive.h: Include "fileread.h".
9476 (class Archive): Update declarations.
9477 (Archive::file): New const method.
9478 (class Add_archive_symbols): Add mapfile_ field. Update
9479 constructor. Change all callers.
9480 * readsyms.h (class Read_symbols): Likewise.
9481 (class Finish_group): Likewise.
9482 (class Read_script): Likewise.
9483 * common.cc: Include "mapfile.h".
9484 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9485 all callers.
9486 (Symbol_table::do_allocate_commons): Likewise.
9487 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9488 symbol allocation to mapfile.
9489 * common.h (class Allocate_commons_task): Add mapfile_ field.
9490 Update constructor. Change all callers.
9491 * symtab.h (class Symbol_table): Update declarations.
9492 * layout.cc: Include "mapfile.h".
9493 (Layout_task_runner::run): Print information to mapfile.
9494 (Layout::create_gold_note): Change Output_data_fixed_space to
9495 Output_data_zero_fill.
9496 (Layout::create_build_id): Likewise.
9497 (Layout::print_to_mapfile): New function.
9498 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9499 constructor. Change caller.
9500 (class Layout): Declare print_to_mapfile.
9501 * output.cc (Output_section::Input_section::print_to_mapfile): New
9502 function.
9503 (Output_section::add_input_section): If producing a map, always
9504 add to input_sections_ list.
9505 (Output_section::do_print_to_mapfile): New function.
9506 (Output_segment::print_sections_to_mapfile): New function.
9507 (Output_segment::print_section_list_to_mapfile): New function.
9508 * output.h: Include "mapfile.h".
9509 (Output_data::print_to_mapfile): New function.
9510 (Output_data::do_print_to_mapfile): New virtual function.
9511 (Output_segment_headers::do_print_to_mapfile): New function.
9512 (Output_file_header::do_print_to_mapfile): New function.
9513 (Output_data_const::do_print_to_mapfile): New function.
9514 (class Output_data_const_buffer): Add map_name_ field. Update
9515 constructor. Change all callers. Add do_print_to_mapfile
9516 function.
9517 (class Output_data_fixed_space): Likewise.
9518 (class Output_data_space): Likewise.
9519 (class Output_data_zero_fill): New class.
9520 (Output_data_strtab::do_print_to_mapfile): New function.
9521 (Output_data_reloc_base::do_print_to_mapfile): New function.
9522 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9523 (Output_data_group::do_print_to_mapfile): New function.
9524 (Output_data_got::do_print_to_mapfile): New function.
9525 (Output_data_dynamic::do_print_to_mapfile): New function.
9526 (Output_symtab_xindex::do_print_to_mapfile): New function.
9527 (class Output_section): Declare do_print_to_mapflie. Declare
9528 print_to_mapfile in Input_section.
9529 (class Output_segment): Declare new functions.
9530 * object.h (Sized_relobj::symbol_count): New function.
9531 * script-sections.cc
9532 (Output_section_element_dot_assignment::set_section_addresses):
9533 Change Output_data_fixed_space to Output_data_zero_fill.
9534 (Output_data_expression::do_print_to_mapfile): New function.
9535 * script.cc (read_input_script): Add mapfile parameter. Change
9536 all callers.
9537 * script.h (read_input_script): Update declaration.
9538 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9539 (Eh_frame::do_print_to_mapfile): New function.
9540 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9541 (Output_merge_string::do_print_to_mapfile): New function.
9542 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9543 function.
9544 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9545 function.
9546 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9547 function.
9548 * Makefile.am (CCFILES): Add mapfile.cc.
9549 (HFILES): Add mapfile.h.
9550 * Makefile.in: Rebuild.
9551
9f1d377b
ILT
95522008-05-19 Ian Lance Taylor <iant@google.com>
9553
9554 * options.h (class General_options): Add -z relro.
9555 * layout.cc (Layout::Layout): Initialize relro_segment_.
9556 (Layout::add_output_section_data): Return the output section.
9557 (Layout::make_output_section): Rcognize relro sections and mark
9558 them appropriately.
9559 (Layout::attach_allocated_section_to_segment): Put relro sections
9560 in a PT_GNU_RELRO segment.
9561 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9562 section as relro.
9563 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9564 PT_TLS segments.
9565 (Layout::linkonce_mapping): Map d.rel.ro.local to
9566 .data.rel.ro.local.
9567 (Layout::output_section_name): Us .data.rel.ro.local for any
9568 section which begins with that.
9569 * layout.h (class Layout): Update add_output_section_data
9570 declaration. Add relro_segment_ field.
9571 * output.cc (Output_section::Output_section): Initialize is_relro_
9572 and is_relro_local_ fields.
9573 (Output_segment::add_output_section): Group relro sections.
9574 (Output_segment::is_first_section_relro): New function.
9575 (Output_segment::maximum_alignment): If there is a relro section,
9576 align the segment to the common page size.
9577 (Output_segment::set_section_addresses): Track whether we are
9578 looking at relro sections. If the last section is a relro
9579 section, align to the common page size.
9580 (Output_segment::set_section_list_addresses): Add in_relro
9581 parameter. Change all callers. Align to the page size when
9582 moving from relro to non-relro section.
9583 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9584 segment.
9585 * output.h (class Output_section): Add is_relro_ and
9586 is_relro_local_ fields.
9587 (Output_section::is_relro): New function.
9588 (Output_section::set_is_relro): New function.
9589 (Output_section::is_relro_local): New function.
9590 (Output_section::set_is_relro_local): New function.
9591 (class Output_segment): Update declarations.
9592 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9593 * sparc.cc (Target_sparc::got_section): Likewise.
9594 * x86_64.cc (Target_x86_64::got_section): Likewise.
9595 * testsuite/relro_test_main.cc: New file.
9596 * testsuite/relro_test.cc: New file.
9597 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9598 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9599 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9600 (relro_test.so, relro_test_pic.o): New targets.
9601 * testsuite/Makefile.in: Rebuild.
9602
a984ee1d
ILT
96032008-05-16 Ian Lance Taylor <iant@google.com>
9604
01676dcd
ILT
9605 * output.cc (Output_segment::add_output_section): Remove front
9606 parameter.
9607 * output.h (class Output_segment): Remove
9608 add_initial_output_section and overloaded add_output_section.
9609 Update declaration of remaining add_output_section.
9610 * layout.cc (Layout::create_interp): Call add_output_section
9611 rather than add_initial_output_section.
9612 (Layout::finish_dynamic_section): Likewise.
9613
497897f9
ILT
9614 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9615 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9616 know the dynamic type.
9617 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9618 field. Initialize it in constructor.
9619 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9620 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9621 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9622 reloc.
9623
a984ee1d
ILT
9624 * output.cc (Output_reloc::get_address): Change return type to
9625 Elf_Addr.
9626 * output.h (class Output_reloc): Update get_address declaration.
9627 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9628 for section addresses.
9629
55ba0940
ILT
96302008-05-09 Ian Lance Taylor <iant@google.com>
9631
9632 PR 6493
9633 * gold.cc (gold_nomem): Use return value of write.
9634
75517b77
ILT
96352008-05-08 Ian Lance Taylor <iant@google.com>
9636
9637 * symtab.c (Symbol::init_base_output_data): Add version
9638 parameter. Change all callers.
9639 (Symbol::init_base_output_segment): Likewise.
9640 (Symbol::init_base_constant): Likewise.
9641 (Symbol::init_base_undefined): Likewise.
9642 (Sized_symbol::init_output_data): Likewise.
9643 (Sized_symbol::init_output_segment): Likewise.
9644 (Sized_symbol::init_constant): Likewise.
9645 (Sized_symbol::init_undefined): Likewise.
9646 (Symbol_table::do_define_in_output_data): If the new symbol has a
9647 version, mark it as the default.
9648 (Symbol_table::do_define_in_output_segment): Likewise.
9649 (Symbol_table::do_define_as_constant): Likewise.
9650 * symtab.h (class Symbol): Update declarations.
9651 (class Sized_symbol): Likewise.
9652 * resolve.cc (Symbol::override_version): New function.
c42e122e 9653 (Symbol::override_base): Call override_version.
75517b77
ILT
9654 (Symbol::override_base_with_special): Likewise.
9655 * testsuite/ver_script_8.script: New file.
9656 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9657 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9658 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9659 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9660
f1f70eae
ILT
96612008-05-06 Ian Lance Taylor <iant@google.com>
9662
f3e9c5c5
ILT
9663 PR 6049
9664 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9665 functions.
9666 (class General_options): Remove existing --undefined, and add
9667 --no-undefined instead. Add new --undefined as synonym for -u.
9668 * archive.cc (Archive::add_symbols): Check whether symbol was
9669 named with -u.
9670 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9671 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9672 all uses. Add IS_UNDEFINED. Update declarations to split
9673 different versions of init_base. Declare init_base_undefined.
9674 (Symbol::is_defined): Handle IS_UNDEFINED.
9675 (Symbol::is_undefined): Likewise.
9676 (Symbol::is_weak_undefined): Call is_undefined.
9677 (Symbol::is_absolute): Handle IS_CONSTANT.
9678 (class Sized_symbol): Update declarations to split different
9679 versions of init. Declare init_undefined.
9680 (class Symbol_table): Declare new functions.
9681 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9682 Change all callers.
9683 (Symbol::init_base_output_data): Likewise.
9684 (Symbol::init_base_output_segment): Likewise.
9685 (Symbol::init_base_constant): Likewise.
9686 (Symbol::init_base_undefined): New function.
9687 (Sized_symbol::init_object): Rename from init. Change all
9688 callers.
9689 (Sized_symbol::init_output_data): Likewise.
9690 (Sized_symbol::init_output_segment): Likewise.
9691 (Sized_symbol::init_constant): Likewise.
9692 (Sized_symbol::init_undefined): New function.
9693 (Symbol_table::add_undefined_symbols_from_command_line): New
9694 function.
9695 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9696 function.
9697 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9698 (Symbol::output_section): Likewise.
9699 (Symbol::set_output_section): Likewise.
9700 (Symbol_table::sized_finalize_symbol): Likewise.
9701 (Symbol_table::sized_write_globals): Likewise.
9702 * resolve.cc (Symbol_table::should_override): Likewise.
9703 (Symbol::override_base_with_special): Likewise.
9704
8bdcdf2c
ILT
9705 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9706 symbol, change it to have default visibility.
9707 * testsuite/protected_1.cc: New file.
9708 * testsuite/protected_2.cc: New file.
9709 * testsuite/protected_3.cc: New file.
9710 * testsuite/protected_main_1.cc: New file.
9711 * testsuite/protected_main_2.cc: New file.
9712 * testsuite/protected_main_3.cc: New file.
9713 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9714 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9715 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9716 (protected_1.so): New target.
9717 (protected_1_pic.o, protected_2_pic.o): New targets.
9718 (protected_3_pic.o): New target.
9719 (check_PROGRAMS): Add protected_2.
9720 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9721 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9722 * testsuite/Makefile.in: Rebuild.
9723
2b706932
ILT
9724 * options.h (DEFINE_var): Add set_user_set_##varname__.
9725 (DEFINE_bool_alias): New macro.
9726 (class General_options): Define -Bstatic using DEFINE_bool_alias
9727 rather than DEFINE_special. Add --undefined as an alias for -z
9728 defs.
9729 * options.cc (General_options::parse_Bstatic): Remove.
9730
d82a5bcc
ILT
9731 * options.h (class General_options): Add --fatal-warnings.
9732 * main.cc (main): Implement --fatal-warnings.
9733 * errors.h (Errors::warning_count): New function.
9734
f1f70eae
ILT
9735 * options.h (class General_options): Add -Bsymbolic-functions.
9736 * symtab.h (Symbol::is_preemptible): Check for
9737 -Bsymbolic-functions.
9738
8825ac63
ILT
97392008-05-05 Ian Lance Taylor <iant@google.com>
9740
d98bc257
ILT
9741 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9742 as noVARNAME rather than no-VARNAME.
9743 (class General_options): Add option -z combreloc.
9744 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9745 get_address.
9746 (Output_reloc::sort_before) [SHT_REL]: New function.
9747 (Output_reloc::sort_before) [SHT_RELA]: New function.
9748 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9749 Sort_relocs_comparison.
9750 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9751 parameter. Change all callers.
9752 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9753 sort_relocs parameter. Change all callers.
9754 * output.cc (Output_reloc::get_address): New function, broken out
9755 of write_rel.
9756 (Output_reloc::write_rel): Call it.
9757 (Output_reloc::compare): New function.
9758 (Output_data_reloc_base::do_write): Optionally sort relocs.
9759
60b2b4e7
ILT
9760 * configure.ac: If targ_extra_obj is set, link it in.
9761 * configure.tgt: Initialize all variables.
9762 (x86_64*): Set targ_extra_obj and targ_extra_size.
9763 * configure: Rebuild.
9764
8825ac63
ILT
9765 * object.cc (Sized_relobj::include_section_group): Adjust section
9766 indexes read from group data. Build vector to pass to
9767 layout_group.
9768 * layout.cc (Layout::layout_group): Add flags and shndxes
9769 parameters. Remove contents parameter. Change caller. Update
9770 explicit instantiations.
9771 * layout.h (class Layout): Update layout_group declaration.
9772 * output.cc (Output_data_group::Output_data_group): Add flags and
9773 input_shndxes parameters. Remove contents parameter. Change
9774 caller.
9775 (Output_data_group::do_write): Change input_sections_ to
9776 input_shndxes_.
9777 * output.h (class Output_data_group): Update constructor
9778 declaration. Rename input_sections_ to input_shndxes_.
9779 * testsuite/many_sections_test.cc: Add template.
9780
e94cf127
CC
97812008-04-30 Cary Coutant <ccoutant@google.com>
9782
4418b2d5
CC
9783 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9784
e94cf127
CC
9785 * layout.cc (Layout::include_section): Refactored check for debug
9786 info section.
9787 (Layout::add_comdat): Add new parameters. Change type
9788 of signature parameter. Add object and shndx to signatures table.
9789 (Layout::find_kept_object): New function.
9790 * layout.h: Include <cstring>.
9791 (Layout::is_debug_info_section): New function.
9792 (Layout::add_comdat): Add new parameters.
9793 (Layout::find_kept_object): New function.
9794 (Layout::Kept_section): New struct.
9795 (Layout::Signatures): Change type of map range.
9796 * object.cc (Relobj::output_section_address): New function.
9797 (Sized_relobj::include_section_group): Add new parameters. Change
9798 calls to Layout::add_comdat. Change to build table of kept comdat
9799 groups and table mapping discarded sections to kept sections.
9800 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9801 (Sized_relobj::do_layout): Change calls to include_section_group and
9802 include_linkonce_section.
9803 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9804 value to zero when section is discarded.
9805 (Sized_relobj::map_to_kept_section): New function.
9806 * object.h (Relobj::output_section_address): New function.
9807 (Relobj::Comdat_group): New type.
9808 (Relobj::find_comdat_group): New function.
9809 (Relobj::Comdat_group_table): New type.
9810 (Relobj::Kept_comdat_section): New type.
9811 (Relobj::Kept_comdat_section_table): New type.
9812 (Relobj::add_comdat_group): New function.
9813 (Relobj::set_kept_comdat_section): New function.
9814 (Relobj::get_kept_comdat_section): New function.
9815 (Relobj::comdat_groups_): New field.
9816 (Relobj::kept_comdat_sections_): New field.
9817 (Symbol_value::input_value): Update comment.
9818 (Sized_relobj::map_to_kept_section) New function.
9819 (Sized_relobj::include_linkonce_section): Add new parameter.
9820 * target-reloc.h (Comdat_behavior): New type.
9821 (get_comdat_behavior): New function.
9822 (relocate_section): Add code to map a discarded section to the
9823 corresponding kept section when applying a relocation.
9824
e4e5049b
CS
98252008-04-30 Craig Silverstein <csilvers@google.com>
9826
9827 * dwarf_reader.cc (next_generation_count): New static var.
9828 (Addr2line_cache_entry): New struct.
9829 (addr2line_cache): New static var.
9830 (Dwarf_line_info::one_addr2line): Added caching.
9831 (Dwarf_line_info::clear_addr2line_cache): New function.
9832 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9833 cache-size parameter.
9834 (Dwarf_line_info::one_addr2line_cache): New function.
9835 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9836 new cache-size argument to one_addr2line(), and clear cache.
9837
d09e9154
CC
98382008-04-28 Cary Coutant <ccoutant@google.com>
9839
9840 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9841 R_386_PC8 relocations.
9842
7ef73768
ILT
98432008-04-23 Ian Lance Taylor <iant@google.com>
9844
55438702
ILT
9845 * object.cc (Sized_relobj::include_section_group): Check for
9846 invalid section group.
9847
c165fb93
ILT
9848 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9849 header size.
9850
7ef73768
ILT
9851 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9852 than read for file header.
9853 * archive.cc (Archive::include_member): Likewise.
9854
6194aaab
L
98552008-04-23 Paolo Bonzini <bonzini@gnu.org>
9856
9857 * aclocal.m4: Regenerate.
9858 * configure: Regenerate.
9859
d491d34e
ILT
98602008-04-19 Ian Lance Taylor <iant@google.com>
9861
5ea2bac6
ILT
9862 * version.cc (version_string): Bump to 1.6.
9863
7bc3e21a
ILT
9864 * testsuite/Makefile.am (many_sections_r_test): New target.
9865 (many_sections_r_test_SOURCES): Remove.
9866 (many_sections_r_test_DEPENDENCIES): Remove.
9867 (many_sections_r_test_LDFLAGS): Remove.
9868 (many_sections_r_test_LDADD): Remove.
9869
7fcd3aa9
ILT
9870 * object.cc (Sized_relobj::do_add_symbols): Always pass
9871 local_symbol_count_ to add_from_relobj.
9872
4c94d6ae
ILT
9873 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9874 every thousand variables.
9875 * testsuite/Makefile.in: Rebuild.
9876
d491d34e
ILT
9877 * object.cc (Xindex::initialize_symtab_xindex): New function.
9878 (Xindex::read_symtab_xindex): New function.
9879 (Xindex::sym_xindex_to_shndx): New function.
9880 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9881 available.
9882 (Sized_relobj::do_initialize_xindex): New function.
9883 (Sized_relobj::do_read_symbols): Adjust section links.
9884 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9885 parameter. Change all callers.
9886 (Sized_relobj::include_section_group): Adjust section links and
9887 symbol section indexes.
9888 (Sized_relobj::do_layout): Adjust section links.
9889 (Sized_relobj::do_count_local_symbols): Adjust section links and
9890 symbol section indexes.
9891 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9892 ordinary and special symbols.
9893 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9894 dynsym_xindex parameters. Change all callers. Adjust section
9895 links. Use SHN_XINDEX when needed.
9896 (Sized_relobj::get_symbol_location_info): Adjust section links.
9897 Don't get fooled by special symbols.
9898 * object.h (class Xindex): Define.
9899 (class Object): Add xindex_ parameter. Declare virtual functoin
9900 do_initialize_xindex.
9901 (Object::adjust_sym_shndx): New function.
9902 (Object::set_xindex): New protected function.
9903 (class Symbol_value): Add is_ordinary_shndx_ field.
9904 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9905 (Symbol_value::value): Assert ordinary section.
9906 (Symbol_value::initialize_input_to_output_map): Likewise.
9907 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9908 Change all callers.
9909 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9910 all callers.
9911 (class Sized_relobj): Update declarations.
9912 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9913 parameter. Change all callers.
9914 (Sized_relobj::adjust_shndx): New function.
9915 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9916 field.
9917 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9918 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9919 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9920 (Sized_dynobj::read_dynsym_section): Adjust section links.
9921 (Sized_dynobj::read_dynamic): Likewise.
9922 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9923 section links.
9924 (Sized_dynobj::do_initialize_xindex): New function.
9925 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9926 do_initialize_xindex.
9927 (Sized_dynobj::adjust_shndx): New function.
9928 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9929 dynsym_xindex_ fields.
9930 (Layout::finalize): Add a call to set_section_indexes before
9931 creating the symtab sections.
9932 (Layout::set_section_indexes): Don't do anything if the section
9933 already has a section index.
9934 (Layout::create_symtab_sections): Add shnum parameter. Change
9935 caller. Create .symtab_shndx section if needed.
9936 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9937 caller.
9938 (Layout::allocated_output_section_count): New function.
9939 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9940 needed.
9941 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9942 fields. Update declarations.
9943 (Layout::symtab_xindex): New function.
9944 (Layout::dynsym_xindex): New function.
9945 (class Write_symbols_task): Add layout_ field.
9946 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9947 Change caller.
9948 * output.cc (Output_section_headers::Output_section_headers): Add
9949 shstrtab_section parameter. Change all callers.
9950 (Output_section_headers::do_sized_write): Store overflow values
9951 for section count and section string table section index in
9952 section header zero.
9953 (Output_file_header::do_sized_write): Check for overflow of
9954 section count and section string table section index.
9955 (Output_symtab_xindex::do_write): New function.
9956 (Output_symtab_xindex::endian_do_write): New function.
9957 * output.h (class Output_section_headers): Add shstrtab_section_.
9958 Update declarations.
9959 (class Output_symtab_xindex): Define.
9960 (Output_section::has_out_shndx): New function.
9961 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9962 field.
9963 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9964 Change all callers.
9965 (Sized_symbol::init): Likewise.
9966 (Symbol::output_section): Check for ordinary symbol.
9967 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9968 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9969 callers.
9970 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9971 Change all callers. Simplify handling of symbols from sections
9972 not included in the link.
9973 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9974 distinction.
9975 (Weak_alias_sorter::operator()): Assert that symbols are
9976 ordinary.
9977 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9978 distinction.
9979 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9980 parameters. Change all callers.
9981 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9982 symbol distinction. Use SHN_XINDEX when needed.
9983 (Symbol_table::write_section_symbol): Add symtab_xindex
9984 parameter. Change all callers.
9985 (Symbol_table::sized_write_section_symbol): Likewise. Use
9986 SHN_XINDEX when needed.
9987 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9988 declarations.
9989 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9990 (Symbol::is_defined): Check is_ordinary.
9991 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9992 (Symbol::is_absolute, Symbol::is_common): Likewise.
9993 (class Sized_symbol): Update declarations.
9994 (class Symbol_table): Update declarations.
9995 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9996 parameters. Change all callers.
9997 (Sized_symbol::override): Likewise.
9998 (Symbol_table::override): Likewise.
9999 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10000 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10001 is_ordinary, and orig_st_shndx parameters. Change all callers.
10002 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10003 to be in an ordinary section.
10004 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10005 object and is_ordinary parameters. Change all callers.
10006 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10007 Change all callers. Don't add undefined or non-ordinary symbols
10008 to reloc_map_.
10009 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10010 Change all callers.
10011 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10012 declarations.
10013 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10014 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10015 (Sized_relobj::relocate_sections): Likewise.
10016 * target-reloc.h (scan_relocs): Adjust section symbol index.
10017 (scan_relocatable_relocs): Likewise.
10018 * i386.cc (Scan::local): Check for ordinary symbols.
10019 * sparc.cc (Scan::local): Likewise.
10020 * x86_64.cc (Scan::local): Likewise.
10021 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10022 to symbol_section_and_value.
10023 * testsuite/many_sections_test.cc: New file.
10024 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10025 (check_PROGRAMS): Add many_sections_test.
10026 (many_sections_test_SOURCES): Define.
10027 (many_sections_test_DEPENDENCIES): Define.
10028 (many_sections_test_LDFLAGS): Define.
10029 (BUILT_SOURCES): Add many_sections_define.h.
10030 (many_sections_define.h): New target.
10031 (BUILT_SOURCES): Add many_sections_check.h.
10032 (many_sections_check.h): New target.
10033 (check_PROGRAMS): Add many_sections_r_test.
10034 (many_sections_r_test_SOURCES): Define.
10035 (many_sections_r_test_DEPENDENCIES): Define.
10036 (many_sections_r_test_LDFLAGS): Define.
10037 (many_sections_r_test_LDADD): Define.
10038 (many_sections_r_test.o): New target.
10039 * testsuite/Makefile.in: Rebuild.
10040
c5818ff1
CC
100412008-04-17 Cary Coutant <ccoutant@google.com>
10042
10043 * errors.cc (Errors::info): New function.
10044 (gold_info): New function.
10045 * errors.h (Errors::info): New function.
10046 * gold.h (gold_info): New function.
10047 * object.cc (Input_objects::add_object): Print trace output.
10048 * options.cc (options::parse_set): New function.
10049 (General_options::parse_wrap): Deleted.
10050 (General_options::General_options): Deleted initializer.
10051 * options.h (options::String_set): New typedef.
10052 (options::parse_set): New function.
10053 (DEFINE_set): New macro.
10054 (General_options::wrap): Changed to use DEFINE_set. Changed
10055 callers of any_wrap_symbols and is_wrap_symbol.
10056 (General_options::trace, General_options::trace_symbol):
10057 New options.
10058 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10059 (General_options::wrap_symbols_): Deleted.
10060 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10061
b5be4a7c
DM
100622008-04-17 David S. Miller <davem@davemloft.net>
10063
10064 * options.cc (General_options::parse_V): New function.
10065 * options.h: Add entries for -V and -Qy.
10066
155a0dd7
ILT
100672008-04-17 Ian Lance Taylor <iant@google.com>
10068
10069 * common.cc (Symbol_table::allocate_commons): Remove options
10070 parameter. Change caller.
10071 (Symbol_table::do_allocate_commons): Remove options parameter.
10072 Change caller. Just call do_allocate_commons_list twice.
10073 (Symbol_table::do_allocate_commons_list): New function, broken out
10074 of do_allocate_commons.
10075 * common.h (class Allocate_commons_task): Remove options_ field.
10076 Update constructor.
10077 * symtab.cc (Symbol_table::Symbol_table): Initialize
10078 tls_commons_.
10079 (Symbol_table::add_from_object): Put TLS common symbols on
10080 tls_commons_ list.
10081 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10082 which are IN_OUTPUT_DATA.
10083 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10084 allocate_commons and do_allocate_commons declarations. Declare
10085 do_allocate_commons_list.
10086 * gold.cc (queue_middle_tasks): Update creation of
10087 Allocate_commons_task to not pass options.
10088 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10089 (TLS_TEST_C_FLAGS): New variable.
10090 (tls_test_c_pic.o): New target.
10091 (tls_test_shared.so): Link in tls_test_c_pic.o.
10092 (tls_test_c_pic_ie.o): New target.
10093 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10094 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10095 (tls_test_c.o): New target.
10096 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10097 (tls_pic_test_LDADD): Likewise.
10098 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10099 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10100 (tls_test_c_gnu2.o): New target.
10101 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10102 tls_test_c_gnu2.o.
10103 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10104 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10105 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10106 * testsuite/tls_test.cc: Include "config.h".
10107 (t_last): Call t11_last.
10108 * testsuite/tls_test.h (t11, t11_last): Declare.
10109 * testsuite/tls_test_c.c: New file.
10110 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10111 * configure.ac: Check for OpenMP support.
10112 * configure, config.in, Makefile.in: Rebuild.
10113 * testsuite/Makefile.in: Rebuild.
10114
edfbb029
CC
101152008-04-16 Cary Coutant <ccoutant@google.com>
10116
10117 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10118 (Target_i386::tls_base_symbol_defined_): New field.
10119 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10120 (Target_i386::Scan::global): Likewise.
10121 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10122 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10123 (Target_x86_64::tls_base_symbol_defined_): New field.
10124 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10125 (Target_x86_64::Scan::global): Likewise.
10126
f3c69fca
CC
101272008-04-16 Cary Coutant <ccoutant@google.com>
10128
10129 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10130 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10131 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10132 building shared libraries.
10133 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10134 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10135 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10136 * testsuite/Makefile.in: Rebuild.
10137 * testsuite/weak_undef.h: New file.
10138 * testsuite/weak_undef_file1.cc: Add extra test cases.
10139 * testsuite/weak_undef_file2.cc: Likewise.
10140 * testsuite/weak_undef_test.cc: Likewise.
10141
7c414435
DM
101422008-04-16 David S. Miller <davem@davemloft.net>
10143
32b769e1
DM
10144 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10145 Add issued_non_pic_error_ field. Declare check_non_pic.
10146 (Target_sparc::Scan::check_non_pic): New function.
10147 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10148 (Target_sparc::Scan::global): Likewise.
10149
11936fb1
DM
10150 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10151 * configure: Rebuild.
10152
7c414435
DM
10153 * options.h (DEFINE_enable): New macro.
10154 (new_dtags): New enable option.
10155 (initfirst, interpose, loadfltr, nodefaultlib,
10156 nodelete, nodlopen, nodump): New -z options.
10157 * layout.cc (Layout:finish_dynamic_section): If new
10158 dtags enabled, emit DT_RUNPATH. Also, emit a
10159 DT_FLAGS_1 containing any specified -z flags.
10160
85c7bf8b
ILT
101612008-04-16 Ian Lance Taylor <iant@google.com>
10162
12c0daef
ILT
10163 * copy-relocs.cc: New file.
10164 * copy-relocs.h: New file.
10165 * reloc.cc: Remove Copy_relocs code.
10166 * reloc.h: Likewise.
10167 * reloc-types.h (struct Reloc_types) [both versions]: Add
10168 get_reloc_addend_noerror.
10169 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10170 variants of add_global which take an addend which must be zero.
10171 * i386.cc: Include "copy-relocs.h".
10172 (class Target_i386): Change type of copy_relocs_ to variable,
10173 update initializer.
10174 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10175 Change all callers.
10176 (Target_i386::do_finalize_sections): Change handling of
10177 copy_relocs_.
10178 * sparc.cc: Include "copy-relocs.h".
10179 (class Target_sparc): Change type of copy_relocs_ to variable,
10180 update initializer.
10181 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10182 Change all callers.
10183 (Target_sparc::do_finalize_sections): Change handling of
10184 copy_relocs_.
10185 * x86_64.cc: Include "copy-relocs.h".
10186 (class Target_x86_64): Change type of copy_relocs_ to variable,
10187 update initializer.
10188 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10189 class. Change all callers.
10190 (Target_x86_64::do_finalize_sections): Change handling of
10191 copy_relocs_.
10192 * Makefile.am (CCFILES): Add copy-relocs.cc.
10193 (HFILES): Add copy-relocs.h.
10194
4f4995b6
ILT
10195 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10196
85c7bf8b
ILT
10197 * testsuite/script_test_4.sh: Permit leading zeroes.
10198
4f2a9edd
ILT
101992008-04-15 Ian Lance Taylor <iant@google.com>
10200
e6188289
ILT
10201 * script-sections.cc (Script_sections::create_segments): Use
10202 header_size_adjustment even when there is enough room for the
10203 headers.
10204 * testsuite/script_test_4.sh: New file.
10205 * testsuite/script_test_4.t: New file.
10206 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10207 (check_DATA): Add script_test_4.stdout.
10208 (MOSTLYCLEANFILES): Likewise.
10209 (script_test_4): New target.
10210 (script_test_4.stdout): New target.
10211 * testsuite/Makefile.in: Rebuild.
10212
4f2a9edd
ILT
10213 * sparc.cc: Add definitions for Output_data_plt_sparc class
10214 constants.
10215
f5314dd5
DM
102162008-04-14 David S. Miller <davem@davemloft.net>
10217
10218 * sparc.cc: New file.
10219 * Makefile.am (TARGETSOURCES): Add sparc.cc
10220 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10221 * configure.tgt: Document targ_extra_size and
10222 targ_extra_big_endian. Add entries for sparc-* and
10223 sparc64-*.
10224 * configure.ac: Handle targ_extra_size and
10225 targ_extra_big_endian.
10226 * Makefile.in: Rebuild.
10227 * configure: Likewise.
10228 * po/POTFILES.in: Likewise.
10229 * po/gold.pot: Likewise.
10230
154e0e9a
ILT
102312008-04-14 Ian Lance Taylor <iant@google.com>
10232
10233 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10234 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10235 in the name/type/flags to section mapping. Don't call
10236 allocate_output_section.
10237 (Layout::choose_output_section): Change parameter from adjust_name
10238 to is_input_section. Don't permit input sections after sections
10239 are attached to segments. Don't call allocate_output_section.
10240 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10241 not write_enable_output_section.
10242 (Layout::make_output_section): Don't push to
10243 unattached_section_list_ nor call attach_to_segment. Call
10244 attach_section_to_segment if sections are attached.
10245 (Layout::attach_sections_to_segments): New function.
10246 (Layout::attach_section_to_segment): New function.
10247 (Layout::attach_allocated_section_to_segment): Rename from
10248 attach_to_segment. Remove flags parameter.
10249 (Layout::allocate_output_section): Remove function.
10250 (Layout::write_enable_output_section): Remove function.
10251 * layout.h (class Layout): Update for above changes. Add new
10252 field sections_are_attached_.
10253 * output.h (Output_section::update_flags_for_input_section): New
10254 function.
10255 * output.cc (Output_section::add_input_section): Call
10256 update_flags_for_input_section.
10257 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10258
009a67a2
CC
102592008-04-11 Cary Coutant <ccoutant@google.com>
10260
10261 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10262 thought unnecessary.
10263 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10264
759b1a24
ILT
102652008-04-11 Ian Lance Taylor <iant@google.com>
10266
10267 * output.h (class Output_section_data): Remove inline definition
10268 of set_addralign.
10269 * output.cc (Output_section_data::set_addralign): New function.
10270
c2b45e22
CC
102712008-04-11 Cary Coutant <ccoutant@google.com>
10272
10273 Add support for TLS descriptors for i386 and x86_64.
10274 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10275 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10276 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10277 GOT_TYPE_TLS_DESC.
10278 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10279 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10280 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10281 relocations.
10282 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10283 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10284 Fix problem with initial-exec relocations.
10285 (Target_i386::Relocate::relocate_tls): Likewise.
10286 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10287 relaxation.
10288 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10289 support for section-plus-offset dynamic table entries.
10290 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10291 (Output_data_dynamic::Dynamic_entry): Add support for
10292 section-plus-offset dynamic table entries.
10293 (Output_data_dynamic::Classification): Likewise.
10294 (Output_data_dynamic::classification_): Renamed offset_.
10295 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10296 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10297 (Target_x86_64::make_plt_section): New function.
10298 (Target_x86_64::reserve_tlsdesc_entries): New function.
10299 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10300 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10301 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10302 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10303 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10304 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10305 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10306 add extra PLT entry for TLS descriptors.
10307 (Output_data_plt_x86_64::got_): New field.
10308 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10309 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10310 fields.
10311 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10312 descriptors.
10313 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10314 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10315 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10316 R_386_TLS_DESC_CALL relocations.
10317 (Target_x86_64::Scan::global): Likewise.
10318 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10319 for TLS descriptors.
10320 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10321 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10322 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10323 GD-to-IE relaxation.
10324 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10325 and TLS_DESCRIPTORS.
10326 * Makefile.in: Rebuild.
10327 * configure: Rebuild.
10328 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10329 (tls_test_shared2.so): New target.
10330 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10331 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10332 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10333 (tls_shared_gd_to_ie_test_LDADD): New variable.
10334 (tls_shared_gnu2_gd_to_ie_test): New target.
10335 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10336 New targets.
10337 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10338 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10339 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10340 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10341 (tls_shared_gnu2_test): New target.
10342 (tls_test_gnu2_shared.so): New target.
10343 (tls_shared_gnu2_test_SOURCES): New variable.
10344 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10345 (tls_shared_gnu2_test_LDFLAGS): New variable.
10346 (tls_shared_gnu2_test_LDADD): New variable.
10347 * testsuite/Makefile.in: Rebuild.
10348 * testsuite/Makefile.
10349
83bfb6b7
ILT
103502008-04-11 Ian Lance Taylor <iant@google.com>
10351
10352 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10353 justsyms.t.
10354 * testsuite/Makefile.in: Rebuild.
10355
10356 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10357 long.
10358 * testsuite/script_test_2.cc (main): Adjust test.
10359
706e1f5e
ILT
103602008-04-11 David S. Miller <davem@davemloft.net>
10361 Ian Lance Taylor <iant@google.com>
10362
10363 * options.h (General_options): Add entries for '-Y' and
10364 '-relax'.
10365 * options.cc (General_options:finalize): If -Y was used, add those
10366 entries to the library path instead of the default "/lib" and
10367 "/usr/lib".
10368
7c98e6bb
DM
103692008-04-11 David S. Miller <davem@davemloft.net>
10370
10371 * testsuite/justsyms.t: Start at 0x100.
10372 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
10373 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10374 long.
10375 * testsuite/script_test_2.cc: Adjust string and section length
10376 checks.
7c98e6bb 10377
99a37bfd
ILT
103782008-04-09 Ian Lance Taylor <iant@google.com>
10379
2cefc357
ILT
10380 PR gold/5996
10381 * script-sections.cc (Sections_element::allocate_to_segment): Add
10382 orphan parameter.
10383 (Output_section_definition::allocate_to_segment): Likewise.
10384 (Orphan_output_section::allocate_to_segment): Likewise.
10385 (Script_sections::attach_sections_using_phdrs_clause): Don't
10386 propagate non-PT_LOAD segments to orphan sections.
10387 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10388 readelf rather than objdump.
10389 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10390 .interp section and PT_INTERP segment are the same size.
10391 * testsuite/Makefile.in: Rebuild.
10392
99a37bfd
ILT
10393 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10394 aliases for symbols defined in the same object.
10395 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10396 (weak_alias_test_SOURCES): New variable.
10397 (weak_alias_test_DEPENDENCIES): New variable.
10398 (weak_alias_test_LDFLAGS): New variable.
10399 (weak_alias_test_LDADD): New variable.
10400 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10401 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10402 (weak_alias_test_3.o): New target.
10403 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10404 * testsuite/weak_alias_test_main.cc: New file.
10405 * testsuite/weak_alias_test_1.cc: New file.
10406 * testsuite/weak_alias_test_2.cc: New file.
10407 * testsuite/weak_alias_test_3.cc: New file.
10408
780e49c5
ILT
104092008-04-08 Ian Lance Taylor <iant@google.com>
10410
cdb0b8f5
ILT
10411 * options.h (class General_options): Add --noinhibit-exec option.
10412 * main.cc (main): Check --noinhibit-exec.
10413
0864d551
ILT
10414 * options.h (class General_options): Define --wrap as a special
10415 option. Add wrap_symbols_ field.
10416 (General_options::any_wrap_symbols): New function.
10417 (General_options::is_wrap_symbol): New function.
10418 * options.cc (General_options::parse_wrap): New function.
10419 (General_options::General_options): Initialize wrap_symbols_.
10420 * symtab.cc (Symbol_table::wrap_symbol): New function.
10421 (Symbol_table::add_from_object): Handle --wrap.
10422 * symtab.h (class Symbol_table): Declare wrap_symbol.
10423 * target.h (Target::wrap_char): New function.
10424 (Target::Target_info): Add wrap_char field.
10425 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10426 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10427 * testsuite/testfile.cc (Target_test::test_target_info):
10428 Likewise.
10429
789aa6de
ILT
10430 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10431 there is one.
10432
2c38906f
ILT
10433 * layout.h (class Layout): Add added_eh_frame_data_ field.
10434 * layout.cc (Layout::Layout): Initialize new field.
10435 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10436 output section until we find a section we merged successfully.
10437 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10438 that the size be non-zero.
10439
780e49c5
ILT
10440 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10441 qualifier.
10442
7fcd0256
ILT
104432008-04-08 Craig Silverstein <csilvers@google.com>
10444
10445 * configure.ac: Export new conditional variable HAVE_ZLIB.
10446 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10447 on HAVE_ZLIB.
10448 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10449 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10450
6835af53
ILT
104512008-04-07 Ian Lance Taylor <iant@google.com>
10452
e24f324c
ILT
10453 * version.cc (version_string): Set to "1.5".
10454
a036edd8
ILT
10455 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10456 Add issued_non_pic_error_ field. Declare check_non_pic.
10457 (Target_x86_64::Scan::check_non_pic): New function.
10458 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10459 (Target_x86_64::Scan::global): Likewise.
10460
624f8810
ILT
10461 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10462 addend parameter. Change caller. Handle merge sections.
10463 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10464 Address to Addend. Don't add in the result of
10465 local_section_offset, pass down the addend and use the returned
10466 value.
10467 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10468 Update declarations of local_section_offset and symbol_value.
10469 * testsuite/two_file_test_1.cc (t18): New function.
10470 * testsuite/two_file_test_2.cc (f18): New function.
10471 * testsuite/two_file_test_main.cc (main): Call t18.
10472 * testsuite/two_file_test.h (t18, f18): Declare.
10473
6835af53
ILT
10474 * configure.ac: Don't test for objdump, c++filt, or readelf.
10475 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10476 conditionals.
10477 (TEST_READELF): New variable.
10478 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10479 (check_PROGRAMS): Add two_file_strip_test.
10480 (two_file_strip_test): New target.
10481 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10482 (two_file_same_shared_strip_test_SOURCES): New variable.
10483 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10484 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10485 (two_file_same_shared_strip_test_LDADD): New variable.
10486 (two_file_shared_strip.so): New target.
10487 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10488 (ver_test_5.syms, ver_test_7.syms): Likewise.
10489 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10490 (strip_test_3.stdout): Use TEST_OBJDUMP.
10491 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10492
86925eef
CC
104932008-04-04 Cary Coutant <ccoutant@google.com>
10494
10495 * symtab.h (Symbol::is_weak_undefined): New function.
10496 (Symbol::is_strong_undefined): New function.
10497 (Symbol::is_absolute): New function.
10498 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10499 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10500 absolute symbols.
10501 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10502 (weak_undef_test): New target.
10503 * testsuite/Makefile.in: Rebuild.
10504 * testsuite/weak_undef_file1.cc: New file.
10505 * testsuite/weak_undef_file2.cc: New file.
10506 * testsuite/weak_undef_test.cc: New file.
10507
126f3ece
ILT
105082008-04-03 Craig Silverstein <csilvers@google.com>
10509
10510 * compressed_output.h (class Output_compressed_section): Use
10511 unsigned buffer.
10512 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10513 add zlib header.
10514 (zlib_compressed_suffix): Removed.
10515 (Output_compressed_section::set_final_data_size): Use unsigned
10516 buffers.
10517 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10518 Fix linker invocation.
10519 (flagstest_o_specialfile_and_compress_debug_sections):
10520 Likewise.
10521 * testsuite/Makefile.in: Regenerated.
10522
deae2a14
DM
105232008-04-02 David S. Miller <davem@davemloft.net>
10524
10525 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10526 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10527
70752818
ILT
105282008-04-02 Craig Silverstein <csilvers@google.com>
10529
10530 * TODO: New file.
10531
39d0cb0e
ILT
105322008-04-02 Ian Lance Taylor <iant@google.com>
10533
10534 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10535 parameters. Update for new key type to views_. Change all
10536 callers.
10537 (File_read::read): Adjust for byteshift in returned view.
10538 (File_read::add_view): New function, broken out of
10539 find_and_make_view.
10540 (File_read::make_view): New function, broken out of
10541 find_and_make_view.
10542 (File_read::find_or_make_view): Add offset and aligned
10543 parameters. Rewrite accordingly. Change all callers.
10544 (File_read::get_view): Add offset and aligned parameters. Adjust
10545 for byteshift in return value.
10546 (File_read::get_lasting_view): Likewise.
10547 * fileread.h (class File_read): Update declarations.
10548 (class File_read::View): Add byteshift_ field. Add byteshift to
10549 constructor. Add byteshift method.
10550 * archive.h (Archive::clear_uncached_views): New function.
10551 (Archive::get_view): Add aligned parameter. Change all callers.
10552 * object.h (Object::get_view): Add aligned parameter. Change all
10553 callers.
10554 (Object::get_lasting_view): Likewise.
10555
10556 * fileread.cc (File_read::release): Don't call clear_views if
10557 there are multiple objects.
10558 * fileread.h (File_read::clear_uncached_views): New function.
10559 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10560 on the archive.
10561
a1207466
CC
105622008-03-31 Cary Coutant <ccoutant@google.com>
10563
10564 Add thin archive support.
10565 * archive.cc (Archive::armagt): New const.
10566 (Archive::setup): Remove task parameter and calls to unlock.
10567 (Archive::unlock_nested_archives): New function.
10568 (Archive::read_header): Add nested_off parameter. Change
10569 all callers.
10570 (Archive::interpret_header): Likewise.
10571 (Archive::include_all_members): Change to handle thin
10572 archives.
10573 (Archive::include_member): Likewise.
10574 * archive.h (Archive::Archive): Add new parameters and
10575 initializers.
10576 (Archive::armagt): New const.
10577 (Archive::setup): Remove task parameter.
10578 (Archive::unlock_nested_archives): New function.
10579 (Archive::read_header): Add nested_off parameter.
10580 (Archive::interpret_header): Likewise.
10581 (Archive::Nested_archive_table): New typedef.
10582 (Archive::is_thin_archive_): New field.
10583 (Archive::nested_archives_): New field.
10584 (Archive::options_): New field.
10585 (Archive::dirpath_): New field.
10586 (Archive::task_): New field.
10587 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10588 for thin archives. Pass additional parameters to
10589 Archive::Archive. Unlock the archive file after calling
10590 Archive::setup.
cd536b21 10591
479f6503
ILT
105922008-03-29 Ian Lance Taylor <iant@google.com>
10593
686c8caf
ILT
10594 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10595 version symbol to be local.
10596 * testsuite/ver_test_4.sh: New file.
10597 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10598 (check_DATA): Add ver_test_4.syms.
10599 (ver_test_4.syms): New target.
10600 * testsuite/Makefile.in: Rebuild.
10601
ab794b6b
ILT
10602 * output.cc
10603 (Output_section::Input_section_sort_entry::has_priority): New
10604 function.
10605 (Output_section::Input_section_sort_entry::match_file_name): New
10606 function.
10607 (Output_section::Input_section_sort_entry::match_section_name):
10608 Remove.
10609 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10610 Remove.
10611 (Output_section::Input_section_sort_entry::match_section_file):
10612 Remove.
10613 (Output_section::Input_section_sort_compare::operator()): Rewrite
10614 using new Input_section_sort_entry functions. Sort crtbegin and
10615 crtend first. Sort sections with no priority before sections with
10616 a priority.
10617 * testsuite/initpri1.c (d3): Check j != 4.
10618 (cd5): New constructor/destructor function.
10619 (main): Check j != 2.
10620
479f6503
ILT
10621 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10622 new symbol when resolving, don't call set_is_default.
10623 * testsuite/ver_test_7.cc: New file.
10624 * testsuite/ver_test_7.sh: New file.
10625 * testsuite/Makefile.am (ver_test_7.so): New target.
10626 (ver_test_7.o): New target.
10627 (check_SCRIPTS): Add ver_test_7.sh.
10628 (check_DATA): Add ver_test_7.syms.
10629 (ver_test_7.syms): New target.
10630
2fd32231
ILT
106312008-03-28 Ian Lance Taylor <iant@google.com>
10632
10633 * layout.cc (Layout::layout): If we see an input section with a
10634 name that needs sorting, set the must_sort flag for the output
10635 section.
10636 (Layout::make_output_section): If the name of the output section
10637 indicates that it might require sorting, set the may_sort flag.
10638 * output.h (Output_section::may_sort_attached_input_sections): New
10639 function.
10640 (Output_section::set_may_sort_attached_input_sections): New
10641 function.
10642 (Output_section::must_sort_attached_input_sections): New
10643 function.
10644 (Output_section::set_must_sort_attached_input_sections): New
10645 function.
10646 (class Output_section): Declare Input_section_sort_entry. Define
10647 Input_section_sort_compare. Declare
10648 sort_attached_input_sections. Add new fields:
10649 may_sort_attached_input_sections_,
10650 must_sort_attached_input_sections_,
10651 attached_input_sections_are_sorted_.
10652 * output.cc (Output_section::Output_section): Initialize new
10653 fields.
10654 (Output_section::add_input_section): Add an entry to
10655 input_sections_ if may_sort or must_sort are true.
10656 (Output_section::set_final_data_size): Call
10657 sort_attached_input_sections if necessary.
10658 (Output_section::Input_section_sort_entry): Define new class.
10659 (Output_section::Input_section_sort_compare::operator()): New
10660 function.
10661 (Output_section::sort_attached_input_sections): New function.
10662 * configure.ac: Check whether the compiler supports constructor
10663 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10664 * testsuite/initpri1.c: New file.
10665 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10666 CONSTRUCTOR_PRIORITY.
10667 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10668 (initpri1_LDFLAGS): New variable.
10669 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10670
18e6b24e
ILT
106712008-03-27 Ian Lance Taylor <iant@google.com>
10672
49bdd526
ILT
10673 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10674 * testsuite/common_test_1.c: New file.
10675 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10676 (common_test_1_SOURCES): New variable.
10677 (common_test_1_DEPENDENCIES): New variable.
10678 (common_test_1_LDFLAGS): New variable.
10679
18e6b24e
ILT
10680 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10681 and commons_ correctly when NAME/VERSION does not override
10682 NAME/NULL.
10683 * testsuite/ver_test_6.c: New file.
10684 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10685 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10686 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10687
04bf7072
ILT
106882008-03-26 Ian Lance Taylor <iant@google.com>
10689
5871526f
ILT
10690 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10691 of an undefined symbol from a version script.
10692 * testsuite/Makefile.am (ver_test_5.so): New target.
10693 (ver_test_5.o): New target.
10694 (check_SCRIPTS): Add ver_test_5.sh.
10695 (check_DATA): Add ver_test_5.syms.
10696 (ver_test_5.syms): New target.
10697 * testsuite/ver_test_5.cc: New file.
10698 * testsuite/ver_test_5.script: New file.
10699 * testsuite/ver_test_5.sh: New file.
10700 * Makefile.in, testsuite/Makefile.in: Rebuild.
10701
04bf7072
ILT
10702 PR gold/5986
10703 Fix problems building gold with gcc 4.3.0.
10704 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10705 (gold_error_at_location, gold_warning_at_location): Use it.
10706 * configure.ac: Check whether we can compile and use a template
10707 function with a printf attribute.
10708 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10709 when jumping over bytes.
10710 * object.cc: Instantiate Object::read_section_data.
10711 * debug.h: Include <cstring>
10712 * dwarf_reader.cc: Include <algorithm>
10713 * main.cc: Include <cstring>.
10714 * options.cc: Include <cstring>.
10715 * output.cc: Include <cstring>.
10716 * script.cc: Include <cstring>.
10717 * script.h: Include <string>.
10718 * symtab.cc: Include <cstring> and <algorithm>.
10719 * target-select.cc: Include <cstring>.
10720 * version.cc: Include <string>.
10721 * testsuite/testmain.cc: Include <cstdlib>.
10722 * configure, config.in: Rebuild.
10723
874c5b28
ILT
107242008-03-25 Ian Lance Taylor <iant@google.com>
10725
819d6c3a
ILT
10726 * options.cc: Include "../bfd/bfdver.h".
10727 (options::help): Print bug reporting address.
10728
f4b2c6f5
ILT
10729 * version.cc (print_version): Adjust output for current value of
10730 BFD_VERSION_STRING.
10731
10732 * NEWS: New file.
10733
e96caa79
ILT
10734 * options.cc (options::help): Print list of supported targets.
10735 * target-select.h: Include <vector>.
10736 (class Target_selector): Make machine_, size_, and is_big_endian_
10737 fields const. Add bfd_name_ and instantiated_target_ fields.
10738 (Target_selector::Target_selector): Add bfd_name parameter.
10739 (Target_selector::recognize): Make non-virtual, call
10740 do_recognize.
10741 (Target_selector::recognize_by_name): Make non-virtual, call
10742 do_recognize_by_name.
10743 (Target_selector::supported_names): New function.
10744 (Target_selector::bfd_name): New function.
10745 (Target_selector::do_instantiate_target): New pure virtual
10746 function.
10747 (Target_selector::do_recognize): New virtual function.
10748 (Target_selector::do_recognize_by_name): New virtual function.
10749 (Target_selector::instantiate_target): New private function.
10750 (supported_target_names): Declare.
10751 * target-select.cc (Target_selector::Target_selector): Update for
10752 new parameter and fields.
10753 (select_target_by_name): Check that the name matches before
10754 calling recognize_by_name.
10755 (supported_target_names): New function.
10756 * i386.cc (class Target_selector_i386): Update Target_selector
10757 constructor call. Remove recognize and recognize_by_name. Add
10758 do_instantiate_target.
10759 * x86_64.cc (class Target_selector_x86_64): Likewise.
10760 * testsuite/testfile.cc (class Target_selector_test): Update for
10761 changes to Target_selector.
10762
874c5b28
ILT
10763 * README: Rewrite, with some notes on unsupported features.
10764
0a65a3a7
CC
107652008-03-24 Cary Coutant <ccoutant@google.com>
10766
10767 * i386.cc (Target_i386::Got_type): New enum declaration.
10768 (Target_i386::Scan::local): Updated callers of Output_data_got
10769 member functions.
10770 (Target_i386::Scan::global): Likewise.
10771 (Target_i386::Relocate::relocate): Likewise.
10772 (Target_i386::Relocate::relocate_tls): Likewise.
10773 * object.h (Got_offset_list): New class.
10774 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10775 (Sized_relobj::local_got_offset): Likewise.
10776 (Sized_relobj::set_local_got_offset): Likewise.
10777 (Sized_relobj::local_has_tls_got_offset): Removed.
10778 (Sized_relobj::local_tls_got_offset): Removed.
10779 (Sized_relobj::set_local_tls_got_offset): Removed.
10780 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10781 * output.cc (Output_data_got::add_global): Added got_type parameter.
10782 (Output_data_got::add_global_with_rel): Likewise.
10783 (Output_data_got::add_global_with_rela): Likewise.
10784 (Output_data_got::add_global_pair_with_rel): New function.
10785 (Output_data_got::add_global_pair_with_rela): New function.
10786 (Output_data_got::add_local): Added got_type parameter.
10787 (Output_data_got::add_local_with_rel): Likewise.
10788 (Output_data_got::add_local_with_rela): Likewise.
10789 (Output_data_got::add_local_pair_with_rel): New function.
10790 (Output_data_got::add_local_pair_with_rela): New function.
10791 (Output_data_got::add_global_tls): Removed.
10792 (Output_data_got::add_global_tls_with_rel): Removed.
10793 (Output_data_got::add_global_tls_with_rela): Removed.
10794 (Output_data_got::add_local_tls): Removed.
10795 (Output_data_got::add_local_tls_with_rel): Removed.
10796 (Output_data_got::add_local_tls_with_rela): Removed.
10797 * output.h (Output_data_got::add_global): Added got_type parameter.
10798 (Output_data_got::add_global_with_rel): Likewise.
10799 (Output_data_got::add_global_with_rela): Likewise.
10800 (Output_data_got::add_global_pair_with_rel): New function.
10801 (Output_data_got::add_global_pair_with_rela): New function.
10802 (Output_data_got::add_local): Added got_type parameter.
10803 (Output_data_got::add_local_with_rel): Likewise.
10804 (Output_data_got::add_local_with_rela): Likewise.
10805 (Output_data_got::add_local_pair_with_rel): New function.
10806 (Output_data_got::add_local_pair_with_rela): New function.
10807 (Output_data_got::add_global_tls): Removed.
10808 (Output_data_got::add_global_tls_with_rel): Removed.
10809 (Output_data_got::add_global_tls_with_rela): Removed.
10810 (Output_data_got::add_local_tls): Removed.
10811 (Output_data_got::add_local_tls_with_rel): Removed.
10812 (Output_data_got::add_local_tls_with_rela): Removed.
10813 * resolve.cc (Symbol::override_base_with_special): Removed
10814 reference to has_got_offset_ field.
10815 * symtab.cc (Symbol::init_fields): Replaced initialization
10816 of got_offset_ with got_offsets_. Removed initialization
10817 of has_got_offset_
53fcba31 10818 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
10819 (Symbol::got_offset): Likewise.
10820 (Symbol::set_got_offset): Likewise.
10821 (Symbol::has_tls_got_offset): Removed.
10822 (Symbol::tls_got_offset): Removed.
10823 (Symbol::set_tls_got_offset): Removed.
10824 (Symbol::got_offset_): Removed.
10825 (Symbol::tls_mod_got_offset_): Removed.
10826 (Symbol::tls_pair_got_offset_): Removed.
10827 (Symbol::got_offsets_): New field.
10828 (Symbol::has_got_offset): Removed.
10829 (Symbol::has_tls_mod_got_offset): Removed.
10830 (Symbol::has_tls_pair_got_offset): Removed.
10831 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10832 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10833 member functions.
10834 (Target_x86_64::Scan::global): Likewise.
10835 (Target_x86_64::Relocate::relocate): Likewise.
10836 (Target_x86_64::Relocate::relocate_tls): Likewise.
10837
bd52eafb
BE
108382008-03-25 Ben Elliston <bje@au.ibm.com>
10839
10840 * yyscript.y: Fix spelling error in comment.
10841
8b105e34
ILT
108422008-03-24 Ian Lance Taylor <iant@google.com>
10843
8ed814a9
ILT
10844 * options.h (class General_options): Define build_id option.
10845 * layout.h (class Layout): Declare write_build_id, create_note,
10846 create_build_id. Add build_id_note_ member.
10847 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10848 "libiberty.h", "md5.h", "sha1.h".
10849 (Layout::Layout): Initialize eh_frame_data_,
10850 eh_frame_hdr_section_, and build_id_note_.
10851 (Layout::finalize): Call create_build_id.
10852 (Layout::create_note): New function, broken out of
10853 Layout::create_gold_note.
10854 (Layout::create_gold_note): Call create_note.
10855 (Layout::create_build_id): New function.
10856 (Layout::write_build_id): New function.
10857 (Close_task_runner::run): Call write_build_id.
10858
8b105e34
ILT
10859 * x86_64.cc: Correct license to GPLv3.
10860
086a1841
ILT
108612008-03-23 Ian Lance Taylor <iant@google.com>
10862
10863 * options.cc: Include "demangle.h".
10864 (parse_optional_string): New function.
10865 (parse_long_option): Handle takes_optional_argument.
10866 (parse_short_option): Update dash_z initializer. Handle
10867 takes_optional_argument.
10868 (General_options::General_options): Initialize do_demangle_.
10869 (General_options::finalize): Set do_demangle_. Handle demangling
10870 style.
10871 * options.h (parse_optional_string): Declare.
10872 (struct One_option): Add optional_arg field. Update constructor.
10873 Update call constructor calls. Add takes_optional_argument
10874 function.
10875 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10876 (DEFINE_optional_string): Define.
10877 (General_options::demangle): Change from DEFINE_bool to
10878 DEFINE_optional_string.
10879 (General_options::no_demangle): New function.
10880 (General_options::do_demangle): New function.
10881 (General_options::set_do_demangle): New function.
10882 (General_options::execstack_status_): Move definition to end of
10883 class definition.
10884 (General_options::static_): Likewise.
10885 (General_options::do_demangle_): New field.
10886 * object.cc (big_endian>::get_symbol_location_info): Call
10887 Options::do_demangle, not Options::demangle.
10888 * symtab.cc (demangle): Likewise.
10889
cbb93e63
ILT
108902008-03-22 Ian Lance Taylor <iant@google.com>
10891
10892 * gold.h: Include <cstddef> and <sys/types.h>
10893 * options.h: Include <cstring>.
10894
ec531623
ILT
108952008-03-21 Ian Lance Taylor <iant@google.com>
10896
10897 * Added source code to GNU binutils.
This page took 0.701664 seconds and 4 git commands to generate.