*** empty log message ***
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
c49875be
ILT
12011-05-29 Ian Lance Taylor <iant@google.com>
2
3 PR gold/12804
4 * testsuite/Makefile.am: Use different file name for two_file_test
5 temporary file for each incremental test.
6 * testsuite/Makefile.in: Rebuild.
7
69d53f7a
ILT
82011-05-29 Ian Lance Taylor <iant@google.com>
9
10 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
11 binary input file is empty.
12
41d0ab5f
ILT
132011-05-27 Ian Lance Taylor <iant@google.com>
14
15 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
16 (ver_test_9.so): Likewise.
17 * testsuite/Makefile.in: Rebuild.
18
89d8a36b
CC
192011-05-26 Cary Coutant <ccoutant@google.com>
20
21 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
22 * incremental.cc (Incremental_inputs::report_input_section): Fix
23 comment, indentation.
24 (Incremental_inputs::report_comdat_group): New function.
25 (Output_section_incremental_inputs::set_final_data_size): Adjust size
26 of data for incremental input file entry.
27 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
28 group count, COMDAT group signatures.
29 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
30 an unchanged input file.
31 * incremental.h (Incremental_object_entry::Incremental_object_entry):
32 Initialize new data member.
33 (Incremental_object_entry::add_comdat_group): New function.
34 (Incremental_object_entry::get_comdat_group_count): New function.
35 (Incremental_object_entry::get_comdat_signature_key): New function.
36 (Incremental_object_entry::groups_): New data member.
37 (Incremental_inputs::report_comdat_group): New function.
38 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
39 data for incremental input file entry.
40 (Incremental_input_entry_reader::get_comdat_group_count): New function.
41 (Incremental_input_entry_reader::get_input_section): Adjust size of
42 data for incremental input file entry.
43 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
44 (Incremental_input_entry_reader::get_comdat_group_signature): New
45 function.
46 * object.cc (Sized_relobj::include_section_group): Report kept
47 COMDAT groups for incremental links.
48
1706a06f
ILT
492011-05-24 David Meyer <pdox@google.com>
50
51 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
52 with name parameter. Add found_name parameter.
53 * fileread.cc (Input_file::find_file): Adjust code accordingly.
54 * dirsearch.h (class Dirsearch): Update declaration.
55
a10ae760
ILT
562011-05-24 Ian Lance Taylor <iant@google.com>
57
58 * archive.cc (Library_base::should_include_member): Pull in object
59 from archive if it defines the entry symbol.
60 * parameters.cc (Parameters::entry): New function.
61 * parameters.h (class Parameters): Declare entry.
62 * output.h (class Output_file_header): Remove entry_ field.
63 * output.cc (Output_file_header::Output_file_header): Remove entry
64 parameter. Change all callers.
65 (Output_file_header::entry): Use parameters->entry.
66 * gold.cc (queue_middle_tasks): Likewise.
67 * plugin.cc (Plugin_hook::run): Likewise.
68
aa92d6ed
CC
692011-05-24 Cary Coutant <ccoutant@google.com>
70
71 * gold.cc (queue_initial_tasks): Pass incremental base filename
72 to Output_file::open_base_file; don't print error message.
73 * incremental-dump.cc (main): Adjust call to
74 Output_file::open_for_modification.
75 * incremental-dump.cc (main): Likewise.
76 * incremental.cc (Incremental_inputs::report_command_line):
77 Ignore --incremental-base option when comparing command lines.
78 Ignore parameter when given as separate argument.
79 * options.h (class General_options): Add --incremental-base.
80 * output.cc (Output_file::Output_file):
81 (Output_file::open_base_file): Add base_name and writable parameters;
82 read base file into new file; print error message here.
83 (Output_file::map_no_anonymous): Add writable parameter; adjust all
84 callers.
85 * output.h (Output_file::open_for_modification): Rename to...
86 (Output_file::open_base_file): ...this; add base_name and
87 writable parameters; adjust all callers.
88 (Output_file::map_no_anonymous): Add writable parameter; adjust all
89 callers.
90 * testsuite/Makefile.am (incremental_test_4): Test
91 --incremental-base.
92 * testsuite/Makefile.in: Regenerate.
93
2eedd706
CC
942011-05-24 Cary Coutant <ccoutant@google.com>
95
96 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
97 incremental_test_4.
98 * testsuite/Makefile.in: Regenerate.
99 * testsuite/two_file_test_1_v1.cc: New test source file.
100 * testsuite/two_file_test_1b_v1.cc: New test source file.
101 * testsuite/two_file_test_2_v1.cc: New test source file.
102
0f1c85a6
CC
1032011-05-24 Cary Coutant <ccoutant@google.com>
104
105 * dynobj.h (Dynobj::do_dynobj): New function.
106 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
107 flag and soname for shared objects.
108 * incremental.cc (Incremental_inputs::report_object): Make
109 either Incremental_object_entry or Incremental_dynobj_entry; add
110 soname to string table.
111 (Incremental_inputs::report_input_section): Add assertion.
112 (Output_section_incremental_inputs::set_final_data_size): Adjust
113 type of input file entry for shared libraries; adjust size of
114 shared library info entry.
115 (Output_section_incremental_inputs::write_input_files): Write
116 as_needed flag for shared libraries.
117 (Output_section_incremental_inputs::write_info_blocks): Adjust type
118 of input file entry for shared libraries; write soname.
119 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
120 soname from incremental info.
121 * incremental.h (enum Incremental_input_flags): Add
122 INCREMENTAL_INPUT_AS_NEEDED.
123 (Incremental_input_entry::Incremental_input_entry): Initialize new
124 data member.
125 (Incremental_input_entry::set_as_needed): New function.
126 (Incremental_input_entry::as_needed): New function.
127 (Incremental_input_entry::do_dynobj_entry): New function.
128 (Incremental_input_entry::as_needed_): New data member.
129 (Incremental_object_entry::Incremental_object_entry): Don't check
130 for shared library.
131 (Incremental_object_entry::do_type): Likewise.
132 (class Incremental_dynobj_entry): New class.
133 (Incremental_input_entry_reader::as_needed): New function.
134 (Incremental_input_entry_reader::get_soname): New function.
135 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
136 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
137 size of shared library info entry.
138 * layout.cc (Layout::finish_dynamic_section): Don't test for
139 incremental link when adding DT_NEEDED entries.
140 * object.h (Object::Object): Initialize new data member.
141 (Object::dynobj): New function.
142 (Object::set_as_needed): New function.
143 (Object::as_needed): New function.
144 (Object::do_dynobj): New function.
145 (Object::as_needed_): New data member.
146
6fa2a40b
CC
1472011-05-24 Cary Coutant <ccoutant@google.com>
148
149 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
150 info; adjust display of GOT entries.
151 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
152 vector of input objects; remove file_status_.
153 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
154 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
155 got_plt reader; call target hooks to reserve GOT entries.
156 (Output_section_incremental_inputs::set_final_data_size): Adjust size
157 of input file info header and GOT info entry.
158 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
159 relocation info.
160 (Got_plt_view_info::got_descriptor): Remove.
161 (Got_plt_view_info::sym_index): New data member.
162 (Got_plt_view_info::input_index): New data member.
163 (Local_got_offset_visitor::visit): Write input file index.
164 (Global_got_offset_visitor::visit): Write 0 for input file index.
165 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
166 with sym_index and input_index.
167 (Output_section_incremental_inputs::write_got_plt): Adjust size of
168 incremental info GOT entry; replace got_descriptor with input_index.
169 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
170 map from input file index to object.
171 (Sized_relobj_incr::do_layout): Replace direct data member reference
172 with accessor function.
173 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
174 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
175 Adjust size of input file info header.
176 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
177 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
178 (Incremental_input_entry_reader::get_input_section): Adjust size of
179 input file info header.
180 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
181 of incremental info GOT entry.
182 (Incremental_got_plt_reader::get_got_desc): Remove.
183 (Incremental_got_plt_reader::get_got_symndx): New function.
184 (Incremental_got_plt_reader::get_got_input_index): New function.
185 (Sized_incremental_binary::Sized_incremental_binary): Remove
186 file_status_; add input_objects_.
187 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
188 (Sized_incremental_binary::set_file_is_unchanged): Remove.
189 (Sized_incremental_binary::file_is_unchanged): Remove.
190 (Sized_incremental_binary::set_input_object): New function.
191 (Sized_incremental_binary::input_object): New function.
192 (Sized_incremental_binary::file_status_): Remove.
193 (Sized_incremental_binary::input_objects_): New data member.
194 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
195 references.
196 (Sized_relobj_incr::invalid_address): Move to base class.
197 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
198 class.
199 (Sized_relobj_incr::do_output_section_offset): Likewise.
200 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
201 (Sized_relobj_incr::section_offsets_): Likewise.
202 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
203 function.
204 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
205 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
206 with accessor function.
207 (Sized_relobj_file::do_layout): Likewise.
208 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
209 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
210 (Sized_relobj_file::compute_final_local_value): Replace refs to
211 section_offsets_ with accessor function.
212 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
213 * object.h (Relobj::Relobj): Initialize new data members.
214 (Relobj::add_dyn_reloc): New function.
215 (Relobj::first_dyn_reloc): New function.
216 (Relobj::dyn_reloc_count): New function.
217 (Relobj::first_dyn_reloc_): New data member.
218 (Relobj::dyn_reloc_count_): New data member.
219 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
220 references.
221 (Sized_relobj::Address): New typedef.
222 (Sized_relobj::invalid_address): Move here from child class.
223 (Sized_relobj::Sized_relobj): Initialize new data members.
224 (Sized_relobj::sized_relobj): New function.
225 (Sized_relobj::is_output_section_offset_invalid): Move here from
226 child class.
227 (Sized_relobj::get_output_section_offset): Likewise.
228 (Sized_relobj::local_has_got_offset): Likewise.
229 (Sized_relobj::local_got_offset): Likewise.
230 (Sized_relobj::set_local_got_offset): Likewise.
231 (Sized_relobj::do_for_all_local_got_entries): Likewise.
232 (Sized_relobj::clear_got_offsets): New function.
233 (Sized_relobj::section_offsets): Move here from child class.
234 (Sized_relobj::do_output_section_offset): Likewise.
235 (Sized_relobj::do_set_section_offset): Likewise.
236 (Sized_relobj::Local_got_offsets): Likewise.
237 (Sized_relobj::local_got_offsets_): Likewise.
238 (Sized_relobj::section_offsets_): Likewise.
239 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
240 references.
241 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
242 class.
243 (Sized_relobj_file::sized_relobj): New function
244 (Sized_relobj_file::local_has_got_offset): Move to base class.
245 (Sized_relobj_file::local_got_offset): Likewise.
246 (Sized_relobj_file::set_local_got_offset): Likewise.
247 (Sized_relobj_file::get_output_section_offset): Likewise.
248 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
249 (Sized_relobj_file::do_output_section_offset): Likewise.
250 (Sized_relobj_file::do_set_section_offset): Likewise.
251 (Sized_relobj_file::Local_got_offsets): Likewise.
252 (Sized_relobj_file::local_got_offsets_): Likewise.
253 (Sized_relobj_file::section_offsets_): Likewise.
254 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
255 (all constructors).
256 (set_needs_dynsym_index): Convert relobj to derived class pointer.
257 (Output_reloc::get_symbol_index): Likewise.
258 (Output_reloc::local_section_offset): Likewise.
259 (Output_reloc::get_address): Likewise.
260 (Output_reloc::symbol_value): Likewise.
261 (Output_data_got::reserve_slot): Move to class definition.
262 (Output_data_got::reserve_local): New function.
263 (Output_data_got::reserve_slot_for_global): Remove.
264 (Output_data_got::reserve_global): New function.
265 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
266 (all constructors, two instantiations).
267 (Output_reloc::get_relobj): New function (two instantiations).
268 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
269 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
270 (Output_data_reloc::add_global): Adjust type of relobj.
271 (Output_data_reloc::add_global_relative): Likewise.
272 (Output_data_reloc::add_symbolless_global_addend): Likewise.
273 (Output_data_reloc::add_local): Likewise.
274 (Output_data_reloc::add_local_relative): Likewise.
275 (Output_data_reloc::add_symbolless_local_addend): Likewise.
276 (Output_data_reloc::add_local_section): Likewise.
277 (Output_data_reloc::add_output_section): Likewise.
278 (Output_data_reloc::add_absolute): Likewise.
279 (Output_data_reloc::add_target_specific): Likewise.
280 (Output_data_got::reserve_slot): Move definition here.
281 (Output_data_got::reserve_local): New function.
282 (Output_data_got::reserve_global): New function.
283 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
284 section_offsets_ with accessor function.
285 (Sized_relobj_file::write_sections): Likewise.
286 (Sized_relobj_file::do_relocate_sections): Likewise.
287 * target.h (Sized_target::reserve_local_got_entry): New function.
288 (Sized_target::reserve_global_got_entry): New function.
289 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
290 (Target_x86_64::reserve_global_got_entry): New function.
291 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
292
4829d394
CC
2932011-05-23 Cary Coutant <ccoutant@google.com>
294
295 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
296 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
297 bit when checking got_type.
298 * incremental.cc (Sized_incremental_binary::setup_readers):
299 Store symbol table and string table locations; initialize bit vector
300 of file status flags.
301 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
302 unchanged files.
303 (Sized_incremental_binary::do_process_got_plt): New function.
304 (Sized_incremental_binary::get_symtab_view): Use stored locations.
305 (Output_section_incremental_inputs::set_final_data_size): Record
306 file index for each input file.
307 (Output_section_incremental_inputs::write_got_plt): Store file index
308 instead of input entry offset for each GOT entry.
309 * incremental.h
310 (Incremental_input_entry::Incremental_input_entry): Initialize new
311 data member.
312 (Incremental_input_entry::set_offset): Store file index.
313 (Incremental_input_entry::get_file_index): New function.
314 (Incremental_input_entry::file_index_): New data member.
315 (Incremental_binary::process_got_plt): New function.
316 (Incremental_binary::do_process_got_plt): New function.
317 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
318 data members.
319 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
320 (Sized_incremental_binary::set_file_is_unchanged): New function.
321 (Sized_incremental_binary::file_is_unchanged): New function.
322 (Sized_incremental_binary::do_process_got_plt): New function.
323 (Sized_incremental_binary::file_status_): New data member.
324 (Sized_incremental_binary::main_symtab_loc_): New data member.
325 (Sized_incremental_binary::main_strtab_loc_): New data member.
326 * output.cc (Output_data_got::Got_entry::write): Add case
327 RESERVED_CODE.
328 (Output_data_got::add_global): Call add_got_entry.
329 (Output_data_got::add_global_plt): Likewise.
330 (Output_data_got::add_global_with_rel): Likewise.
331 (Output_data_got::add_global_with_rela): Likewise.
332 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
333 (Output_data_got::add_global_pair_with_rela): Likewise.
334 (Output_data_got::add_local): Call add_got_entry.
335 (Output_data_got::add_local_plt): Likewise.
336 (Output_data_got::add_local_with_rel): Likewise.
337 (Output_data_got::add_local_with_rela): Likewise.
338 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
339 (Output_data_got::add_local_pair_with_rela): Likewise.
340 (Output_data_got::reserve_slot): New function.
341 (Output_data_got::reserve_slot_for_global): New function.
342 (Output_data_got::add_got_entry): New function.
343 (Output_data_got::add_got_entry_pair): New function.
344 (Output_section::add_output_section_data): Edit FIXME.
345 * output.h
346 (Output_section_data_build::Output_section_data_build): New
347 constructor with size parameter.
348 (Output_data_space::Output_data_space): Likewise.
349 (Output_data_got::Output_data_got): Initialize new data member; new
350 constructor with size parameter.
351 (Output_data_got::add_constant): Call add_got_entry.
352 (Output_data_got::reserve_slot): New function.
353 (Output_data_got::reserve_slot_for_global): New function.
354 (class Output_data_got::Got_entry): Add RESERVED_CODE.
355 (Output_data_got::add_got_entry): New function.
356 (Output_data_got::add_got_entry_pair): New function.
357 (Output_data_got::free_list_): New data member.
358 * target.h (Sized_target::init_got_plt_for_update): New function.
359 (Sized_target::register_global_plt_entry): New function.
360 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
361 Initialize new data member; call init; add constructor with PLT count.
362 (Output_data_plt_x86_64::init): New function.
363 (Output_data_plt_x86_64::add_relocation): New function.
364 (Output_data_plt_x86_64::reserve_slot): New function.
365 (Output_data_plt_x86_64::free_list_): New data member.
366 (Target_x86_64::init_got_plt_for_update): New function.
367 (Target_x86_64::register_global_plt_entry): New function.
368 (Output_data_plt_x86_64::add_entry): Allocate from free list for
369 incremental updates.
370 (Output_data_plt_x86_64::add_relocation): New function.
371 * testsuite/object_unittest.cc (Object_test): Set default options.
372
ec69d6da
ILT
3732011-05-16 Ian Lance Taylor <iant@google.com>
374
375 * options.h (class General_options): Make -i a synonym for -r.
376
732e31de
ILT
3772011-05-16 Ian Lance Taylor <iant@google.com>
378
379 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
380
403676b5
CC
3812011-05-10 Cary Coutant <ccoutant@google.com>
382
383 * object.cc (Sized_relobj::do_count_local_symbols): Check for
384 strip_all (-s).
385
5b7b7d6e
ILT
3862011-05-06 Ian Lance Taylor <iant@google.com>
387
388 * layout.cc (Layout::layout): If the output section flags change,
389 update the ordering.
390
f0f9babf
CC
3912011-04-25 Cary Coutant <ccoutant@google.com>
392
393 * incremental-dump.cc (dump_incremental_inputs): Print local
394 symbol info for each input file.
395 * incremental.cc
396 (Output_section_incremental_inputs::set_final_data_size): Add local
397 symbol info to input file entries in incremental info.
398 (Output_section_incremental_inputs::write_info_blocks): Likewise.
399 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
400 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
401 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
402 implementation.
403 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
404 (Sized_incr_relobj::do_relocate): Write the local symbols.
405 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
406 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
407 Adjust size of input file header.
408 (Incremental_inputs_reader::get_local_symbol_offset): New function.
409 (Incremental_inputs_reader::get_local_symbol_count): New function.
410 (Incremental_inputs_reader::get_input_section): Adjust size of input
411 file header.
412 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
413 (Sized_incr_relobj::This): New typedef.
414 (Sized_incr_relobj::sym_size): New const data member.
415 (Sized_incr_relobj::Local_symbol): New struct.
416 (Sized_incr_relobj::do_output_local_symbol_count): New function.
417 (Sized_incr_relobj::do_local_symbol_offset): New function.
418 (Sized_incr_relobj::local_symbol_count_): New data member.
419 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
420 (Sized_incr_relobj::local_symbol_index_): New data member.
421 (Sized_incr_relobj::local_symbol_offset_): New data member.
422 (Sized_incr_relobj::local_dynsym_offset_): New data member.
423 (Sized_incr_relobj::local_symbols_): New data member.
424 * object.h (Relobj::output_local_symbol_count): New function.
425 (Relobj::local_symbol_offset): New function.
426 (Relobj::do_output_local_symbol_count): New function.
427 (Relobj::do_local_symbol_offset): New function.
428 (Sized_relobj::do_output_local_symbol_count): New function.
429 (Sized_relobj::do_local_symbol_offset): New function.
430
d0a9ace3
ILT
4312011-04-22 Vladimir Simonov <sv@sw.ru>
432
433 * descriptors.cc (set_close_on_exec): New function.
434 (Descriptors::open): Use set_close_on_exec.
435 * output.cc (S_ISLNK): Define if not defined.
436
94a3fc8b
CC
4372011-04-22 Cary Coutant <ccoutant@google.com>
438
439 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
440 global symbol map.
441 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
442 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
443 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
444 relocations.
445 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
446 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
447 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
448 * incremental.h
449 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
450 function.
451 (Incremental_binary::apply_incremental_relocs): New function.
452 (Incremental_binary::do_apply_incremental_relocs): New function.
453 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
454 data member.
455 (Sized_incremental_binary::add_global_symbol): New function.
456 (Sized_incremental_binary::global_symbol): New function.
457 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
458 (Sized_incremental_binary::symbol_map_): New data member.
459 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
460 * target.h (Sized_target::apply_relocation): New function.
461 * target-reloc.h (apply_relocation): New function.
462 * x86_64.cc (Target_x86_64::apply_relocation): New function.
463
c87e4302
DK
4642011-04-22 Doug Kwan <dougkwan@google.com>
465
466 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
467 flag of a SHT_ARM_EXIDX section.
468 * testsuite/Makefile.am (arm_exidx_test): New test rules.
469 * testsuite/Makefile.in: Regenerate.
470 * testsuite/arm_exidx_test.s: New file.
471 * testsuite/arm_exidx_test.sh: Same.
472
e7782cf6
CC
4732011-04-20 Cary Coutant <ccoutant@google.com>
474
475 PR gold/12689
476 * archive.h (Incremental_archive_entry::Archive_member):
477 Initialize arg_serial_ (second constructor).
478
308ecdc7
ILT
4792011-04-17 Ian Lance Taylor <iant@google.com>
480
481 * object.cc (Relocate_info::location): Simplify location string.
482 * errors.cc (Errors::error_at_location): Don't print program
483 name.
484 (Errors::warning_at_location): Likewise.
485 (Errors::undefined_symbol): Likewise.
486 * testsuite/debug_msg.sh: Update accordingly.
487
bec5b579
CC
4882011-04-14 Cary Coutant <ccoutant@google.com>
489
490 * gold/layout.cc (Layout::symtab_section_offset): New function.
491 * gold/layout.h (Layout::symtab_section_offset): New function.
492 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
493
88597d34
ILT
4942011-04-12 Ian Lance Taylor <iant@google.com>
495
496 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
497 with MREMAP_MAYMOVE.
498 * output.h (class Output_file): Add map_is_allocated_ field.
499 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
500 not available, provide stubs. If mremap is not available, #define
501 it to gold_mremap.
502 (MREMAP_MAYMOVE): Define if not defined.
503 (Output_file::Output_file): Initialize map_is_allocated_.
504 (Output_file::resize): Check map_is_allocated_.
505 (Output_file::map_anonymous): If mmap fails, use malloc.
506 (Output_file::unmap): Don't do anything for an anonymous map.
507 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
508 is not available, provide stubs.
509 (File_read::View::~View): Use free rather than delete[].
510 (File_read::make_view): Use malloc rather than new[]. If mmap
511 fails, use malloc.
512 (File_read::find_or_make_view): Use malloc rather than new[].
513 * gold.h: Remove HAVE_REMAP code.
514 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
515 exists. Rename mremap to gold_mremap. If mmap is not available
516 don't do anything.
517 * configure, config.in: Rebuild.
518
11e361bc
ILT
5192011-04-11 Ian Lance Taylor <iant@google.com>
520
521 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
522 initialize local variable v.
523
cdc29364
CC
5242011-04-11 Cary Coutant <ccoutant@google.com>
525
526 * archive.cc (Archive::include_member): Adjust call to
527 report_object.
528 (Add_archive_symbols::run): Track argument serial numbers.
529 (Lib_group::include_member): Likewise.
530 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
531 * archive.h (Incremental_archive_entry::Archive_member):
532 Initialize arg_serial_.
533 (Archive_member::arg_serial_): New data member.
534 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
535 (Sized_dynobj::do_add_symbols): Track symbols when doing an
536 incremental link.
537 (Sized_dynobj::do_for_all_local_got_entries): New function.
538 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
539 function.
540 * fileread.cc (get_mtime): New function.
541 * fileread.h (get_mtime): New function.
542 * gold.cc (queue_initial_tasks): Check for incremental update.
543 (process_incremental_input): New function.
544 (queue_middle_tasks): Don't force valid target for incremental
545 update.
546 * incremental-dump.cc (find_input_containing_global): Adjust
547 size of symbol info entry.
548 (dump_incremental_inputs): Dump argument serial number and
549 in_system_directory flag; bias shndx by 1; print symbol names
550 when dumping per-file symbol lists; use new symbol info readers.
551 * incremental.cc
552 (Output_section_incremental_inputs:update_data_size): New function.
553 (Sized_incremental_binary::setup_readers): Setup input readers
554 for each input file; build maps for files added from libraries
555 and scripts.
556 (Sized_incremental_binary::check_input_args): New function.
557 (Sized_incremental_binary::do_check_inputs): Build map of argument
558 serial numbers to input arguments.
559 (Sized_incremental_binary::do_file_has_changed): Rename
560 do_file_is_unchanged to this; compare file modification times.
561 (Sized_incremental_binary::do_init_layout): New function.
562 (Sized_incremental_binary::do_reserve_layout): New function.
563 (Sized_incremental_binary::do_get_input_reader): Remove.
564 (Sized_incremental_binary::get_symtab_view): New function.
565 (Incremental_checker::can_incrementally_link_output_file): Remove.
566 (Incremental_inputs::report_command_line): Exclude --debug options.
567 (Incremental_inputs::report_archive_begin): Add parameter; track
568 argument serial numbers; don't put input file entry for archive
569 before archive members.
570 (Incremental_inputs::report_archive_end): Put input file entry
571 for archive after archive members.
572 (Incremental_inputs::report_object): Add parameter; track argument
573 serial numbers and in_system_directory flag.
574 (Incremental_inputs::report_script): Add parameter; track argument
575 serial numbers.
576 (Output_section_incremental_inputs::set_final_data_size): Adjust
577 size of symbol info entry; check for forwarding symbols.
578 (Output_section_incremental_inputs::write_input_files): Write
579 in_system_directory flag and argument serial number.
580 (Output_section_incremental_inputs::write_info_blocks): Map section
581 indices between incremental info and original input file; store
582 input section index for each symbol.
583 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
584 change operator() to visit().
585 (class Global_got_offset_visitor): Likewise.
586 (class Global_symbol_visitor_got_plt):
587 (Output_section_incremental_inputs::write_got_plt): Use new visitor
588 classes.
589 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
590 (Sized_incr_relobj::do_read_symbols): New function.
591 (Sized_incr_relobj::do_layout): New function.
592 (Sized_incr_relobj::do_layout_deferred_sections): New function.
593 (Sized_incr_relobj::do_add_symbols): New function.
594 (Sized_incr_relobj::do_should_include_member): New function.
595 (Sized_incr_relobj::do_for_all_global_symbols): New function.
596 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
597 (Sized_incr_relobj::do_section_size): New function.
598 (Sized_incr_relobj::do_section_name): New function.
599 (Sized_incr_relobj::do_section_contents): New function.
600 (Sized_incr_relobj::do_section_flags): New function.
601 (Sized_incr_relobj::do_section_entsize): New function.
602 (Sized_incr_relobj::do_section_address): New function.
603 (Sized_incr_relobj::do_section_type): New function.
604 (Sized_incr_relobj::do_section_link): New function.
605 (Sized_incr_relobj::do_section_info): New function.
606 (Sized_incr_relobj::do_section_addralign): New function.
607 (Sized_incr_relobj::do_initialize_xindex): New function.
608 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
609 (Sized_incr_relobj::do_read_relocs): New function.
610 (Sized_incr_relobj::do_gc_process_relocs): New function.
611 (Sized_incr_relobj::do_scan_relocs): New function.
612 (Sized_incr_relobj::do_count_local_symbols): New function.
613 (Sized_incr_relobj::do_finalize_local_symbols): New function.
614 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
615 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
616 (Sized_incr_relobj::do_relocate): New function.
617 (Sized_incr_relobj::do_set_section_offset): New function.
618 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
619 (Sized_incr_dynobj::do_read_symbols): New function.
620 (Sized_incr_dynobj::do_layout): New function.
621 (Sized_incr_dynobj::do_add_symbols): New function.
622 (Sized_incr_dynobj::do_should_include_member): New function.
623 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
624 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
625 (Sized_incr_dynobj::do_section_size): New function.
626 (Sized_incr_dynobj::do_section_name): New function.
627 (Sized_incr_dynobj::do_section_contents): New function.
628 (Sized_incr_dynobj::do_section_flags): New function.
629 (Sized_incr_dynobj::do_section_entsize): New function.
630 (Sized_incr_dynobj::do_section_address): New function.
631 (Sized_incr_dynobj::do_section_type): New function.
632 (Sized_incr_dynobj::do_section_link): New function.
633 (Sized_incr_dynobj::do_section_info): New function.
634 (Sized_incr_dynobj::do_section_addralign): New function.
635 (Sized_incr_dynobj::do_initialize_xindex): New function.
636 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
637 (make_sized_incremental_object): New function.
638 (Incremental_library::copy_unused_symbols): New function.
639 (Incremental_library::do_for_all_unused_symbols): New function.
640 * incremental.h (enum Incremental_input_flags): New type.
641 (class Incremental_checker): Remove.
642 (Incremental_input_entry::Incremental_input_entry): Add argument
643 serial number.
644 (Incremental_input_entry::arg_serial): New function.
645 (Incremental_input_entry::set_is_in_system_directory): New function.
646 (Incremental_input_entry::is_in_system_directory): New function.
647 (Incremental_input_entry::arg_serial_): New data member.
648 (Incremental_input_entry::is_in_system_directory_): New data member.
649 (class Script_info): Move here from script.h.
650 (Script_info::Script_info): Add filename parameter.
651 (Script_info::filename): New function.
652 (Script_info::filename_): New data member.
653 (Incremental_script_entry::Incremental_script_entry): Add argument
654 serial number.
655 (Incremental_object_entry::Incremental_object_entry): Likewise.
656 (Incremental_object_entry::add_input_section): Build list of input
657 sections with map to original shndx.
658 (Incremental_object_entry::get_input_section_index): New function.
659 (Incremental_object_entry::shndx_): New data member.
660 (Incremental_object_entry::name_key_): Rename; adjust all refs.
661 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
662 (Incremental_archive_entry::Incremental_archive_entry): Add argument
663 serial number.
664 (Incremental_inputs::report_archive_begin): Likewise.
665 (Incremental_inputs::report_object): Likewise.
666 (Incremental_inputs::report_script): Likewise.
667 (class Incremental_global_symbol_reader): New class.
668 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
669 and store flags and input file type.
670 (Incremental_input_entry_reader::arg_serial): New function.
671 (Incremental_input_entry_reader::type): Extract type from flags.
672 (Incremental_input_entry_reader::is_in_system_directory): New function.
673 (Incremental_input_entry_reader::get_input_section_count): Call
674 accessor function for type.
675 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
676 function for type; adjust size of global symbol entry.
677 (Incremental_input_entry_reader::get_global_symbol_count): Call
678 accessor function for type.
679 (Incremental_input_entry_reader::get_object_count): Likewise.
680 (Incremental_input_entry_reader::get_object_offset): Likewise.
681 (Incremental_input_entry_reader::get_member_count): Likewise.
682 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
683 (Incremental_input_entry_reader::get_member_offset): Likewise.
684 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
685 (Incremental_input_entry_reader::Global_symbol_info): Remove.
686 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
687 (Incremental_input_entry_reader::get_global_symbol_reader): New
688 function.
689 (Incremental_input_entry_reader::get_output_symbol_index): New
690 function.
691 (Incremental_input_entry_reader::type_): Remove.
692 (Incremental_input_entry_reader::flags_): New data member.
693 (Incremental_inputs_reader::input_file_offset): New function.
694 (Incremental_inputs_reader::input_file_index): New function.
695 (Incremental_inputs_reader::input_file): Call input_file_offset.
696 (Incremental_inputs_reader::input_file_at_offset): New function.
697 (Incremental_relocs_reader::get_r_type): Reformat.
698 (Incremental_relocs_reader::get_r_shndx): Reformat.
699 (Incremental_relocs_reader::get_r_offset): Reformat.
700 (Incremental_relocs_reader::data): New function.
701 (Incremental_binary::Incremental_binary): Initialize new data members.
702 (Incremental_binary::check_inputs): Add cmdline parameter.
703 (Incremental_binary::file_is_unchanged): Remove.
704 (Input_reader::arg_serial): New function.
705 (Input_reader::get_unused_symbol_count): New function.
706 (Input_reader::get_unused_symbol): New function.
707 (Input_reader::do_arg_serial): New function.
708 (Input_reader::do_get_unused_symbol_count): New function.
709 (Input_reader::do_get_unused_symbol): New function.
710 (Incremental_binary::input_file_count): New function.
711 (Incremental_binary::get_input_reader): Change signature to use
712 index instead of filename.
713 (Incremental_binary::file_has_changed): New function.
714 (Incremental_binary::get_input_argument): New function.
715 (Incremental_binary::get_library): New function.
716 (Incremental_binary::get_script_info): New function.
717 (Incremental_binary::init_layout): New function.
718 (Incremental_binary::reserve_layout): New function.
719 (Incremental_binary::output_file): New function.
720 (Incremental_binary::do_check_inputs): New function.
721 (Incremental_binary::do_file_is_unchanged): Remove.
722 (Incremental_binary::do_file_has_changed): New function.
723 (Incremental_binary::do_init_layout): New function.
724 (Incremental_binary::do_reserve_layout): New function.
725 (Incremental_binary::do_input_file_count): New function.
726 (Incremental_binary::do_get_input_reader): Change signature.
727 (Incremental_binary::input_args_map_): New data member.
728 (Incremental_binary::library_map_): New data member.
729 (Incremental_binary::script_map_): New data member.
730 (Sized_incremental_binary::Sized_incremental_binary): Initialize
731 new data members.
732 (Sized_incremental_binary::output_section): New function.
733 (Sized_incremental_binary::inputs_reader): Add const.
734 (Sized_incremental_binary::symtab_reader): Add const.
735 (Sized_incremental_binary::relocs_reader): Add const.
736 (Sized_incremental_binary::got_plt_reader): Add const.
737 (Sized_incremental_binary::get_symtab_view): New function.
738 (Sized_incremental_binary::Inputs_reader): New typedef.
739 (Sized_incremental_binary::Input_entry_reader): New typedef.
740 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
741 (Sized_incremental_binary::do_file_is_unchanged): Remove.
742 (Sized_incremental_binary::do_file_has_changed): New function.
743 (Sized_incremental_binary::do_init_layout): New function.
744 (Sized_incremental_binary::do_reserve_layout): New function.
745 (Sized_input_reader::Inputs_reader): Remove.
746 (Sized_input_reader::Input_entry_reader): Remove.
747 (Sized_input_reader::do_arg_serial): New function.
748 (Sized_input_reader::do_get_unused_symbol_count): New function.
749 (Sized_input_reader::do_get_unused_symbol): New function.
750 (Sized_incremental_binary::do_input_file_count): New function.
751 (Sized_incremental_binary::do_get_input_reader): Change signature;
752 use index instead of filename.
753 (Sized_incremental_binary::section_map_): New data member.
754 (Sized_incremental_binary::input_entry_readers_): New data member.
755 (class Sized_incr_relobj): New class.
756 (class Sized_incr_dynobj): New class.
757 (make_sized_incremental_object): New function.
758 (class Incremental_library): New class.
759 * layout.cc (Free_list::num_lists): New static data member.
760 (Free_list::num_nodes): New static data member.
761 (Free_list::num_removes): New static data member.
762 (Free_list::num_remove_visits): New static data member.
763 (Free_list::num_allocates): New static data member.
764 (Free_list::num_allocate_visits): New static data member.
765 (Free_list::init): New function.
766 (Free_list::remove): New function.
767 (Free_list::allocate): New function.
768 (Free_list::dump): New function.
769 (Free_list::print_stats): New function.
770 (Layout_task_runner::run): Resize output file for incremental updates.
771 (Layout::Layout): Initialize new data members.
772 (Layout::set_incremental_base): New function.
773 (Layout::init_fixed_output_section): New function.
774 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
775 incremental updates.
776 (Layout::create_gold_note): Do not create gold note section for
777 incremental updates.
778 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
779 for incremental updates.
780 (Layout::set_section_offsets): For incremental updates, allocate space
781 from free list.
782 (Layout::create_symtab_sections): Layout with offsets relative to
783 start of section; for incremental updates, allocate space from free
784 list.
785 (Layout::create_shdrs): For incremental updates, allocate space from
786 free list.
787 (Layout::finish_dynamic_section): For incremental updates, do not
788 check --as-needed (fixed in subsequent patch).
789 * layout.h (class Free_list): New class.
790 (Layout::set_incremental_base): New function.
791 (Layout::incremental_base): New function.
792 (Layout::init_fixed_output_section): New function.
793 (Layout::allocate): New function.
794 (Layout::incremental_base_): New data member.
795 (Layout::free_list_): New data member.
796 * main.cc (main): Print Free_list statistics.
797 * object.cc (Relobj::finalize_incremental_relocs): Add
798 clear_counts parameter; clear counts only when clear_counts is set.
799 (Sized_relobj::Sized_relobj): Initialize new base class.
800 (Sized_relobj::do_layout): Don't report special sections.
801 (Sized_relobj::do_for_all_local_got_entries): New function.
802 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
803 symtab_off to all symbol table offsets.
804 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
805 * object.h (class Got_offset_list): Move to top of file.
806 (Object::Object): Allow case where input_file == NULL.
807 (Object::~Object): Likewise.
808 (Object::input_file): Assert that input_file != NULL.
809 (Object::lock): Allow case where input_file == NULL.
810 (Object::unlock): Likewise.
811 (Object::is_locked): Likewise.
812 (Object::token): Likewise.
813 (Object::release): Likewise.
814 (Object::is_incremental): New function.
815 (Object::get_mtime): New function.
816 (Object::for_all_local_got_entries): New function.
817 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
818 (Object::set_is_in_system_directory): New function.
819 (Object::is_in_system_directory): New function.
820 (Object::do_is_incremental): New function.
821 (Object::do_get_mtime): New function.
822 (Object::do_for_all_local_got_entries): New function.
823 (Object::is_in_system_directory_): New data member.
824 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
825 (class Sized_relobj_base): New class.
826 (class Sized_relobj): Derive from Sized_relobj_base.
827 (class Sized_relobj::Symbols): Redeclare from base class.
828 (class Sized_relobj::local_got_offset_list): Remove.
829 (class Sized_relobj::Output_sections): Redeclare from base class.
830 (class Sized_relobj::do_for_all_local_got_entries): New function.
831 (class Sized_relobj::write_local_symbols): Add offset parameter.
832 (class Sized_relobj::local_symbol_offset_): Update comment.
833 (class Sized_relobj::local_dynsym_offset_): Update comment.
834 * options.cc (Input_arguments::add_file): Remove const.
835 * options.h (Input_file_argument::Input_file_argument):
836 Initialize arg_serial_ (all constructors).
837 (Input_file_argument::set_arg_serial): New function.
838 (Input_file_argument::arg_serial): New function.
839 (Input_file_argument::arg_serial_): New data member.
840 (Input_arguments::Input_arguments): Initialize file_count_.
841 (Input_arguments::add_file): Remove const.
842 (Input_arguments::number_of_input_files): New function.
843 (Input_arguments::file_count_): New data member.
844 (Command_line::number_of_input_files): Call
845 Input_arguments::number_of_input_files.
846 * output.cc (Output_segment_headers::Output_segment_headers):
847 Set current size.
848 (Output_section::Input_section::current_data_size): New function.
849 (Output_section::Output_section): Initialize new data members.
850 (Output_section::add_input_section): Don't do merge sections for
851 an incremental link; allocate space from free list for an
852 incremental update.
853 (Output_section::add_output_section_data): Allocate space from
854 free list for an incremental update.
855 (Output_section::update_data_size): New function.
856 (Output_section::set_fixed_layout): New function.
857 (Output_section::reserve): New function.
858 (Output_segment::set_section_addresses): Remove const.
859 (Output_segment::set_section_list_addresses): Remove const; allocate
860 space from free list for an incremental update.
861 (Output_segment::set_offset): Adjust size of RELRO segment for an
862 incremental update.
863 * output.h (Output_data::current_data_size): Move here from
864 child classes.
865 (Output_data::pre_finalize_data_size): New function.
866 (Output_data::update_data_size): New function.
867 (Output_section_headers::update_data_size): new function.
868 (Output_section_data_build::current_data_size): Move to Output_data.
869 (Output_data_strtab::update_data_size): New function.
870 (Output_section::current_data_size): Move to Output_data.
871 (Output_section::set_fixed_layout): New function.
872 (Output_section::has_fixed_layout): New function.
873 (Output_section::reserve): New function.
874 (Output_section::update_data_size): New function.
875 (Output_section::has_fixed_layout_): New data member.
876 (Output_section::free_list_): New data member.
877 (Output_segment::set_section_addresses): Remove const.
878 (Output_segment::set_section_list_addresses): Remove const.
879 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
880 New function.
881 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
882 New function.
883 * readsyms.cc (Read_symbols::do_read_symbols): Add library
884 parameter when calling Add_symbols constructor; store argument
885 serial number for members of a lib group.
886 (Add_symbols::locks): Allow case where token == NULL.
887 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
888 (Read_member::~Read_member): New function.
889 (Read_member::is_runnable): New function.
890 (Read_member::locks): New function.
891 (Read_member::run): New function.
892 (Check_script::~Check_script): New function.
893 (Check_script::is_runnable): New function.
894 (Check_script::locks): New function.
895 (Check_script::run): New function.
896 (Check_library::~Check_library): New function.
897 (Check_library::is_runnable): New function.
898 (Check_library::locks): New function.
899 (Check_library::run): New function.
900 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
901 (Add_symbols::library_): New data member.
902 (class Read_member): New class.
903 (class Check_script): New class.
904 (class Check_library): New class.
905 * reloc.cc (Read_relocs::is_runnable): Allow case where
906 token == NULL.
907 (Read_relocs::locks): Likewise.
908 (Scan_relocs::locks): Likewise.
909 (Relocate_task::locks): Likewise.
910 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
911 to clear counters.
912 (Sized_relobj::incremental_relocs_scan): Fix comment.
913 (Sized_relobj::do_relocate): Pass output file offset to
914 write_local_symbols.
915 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
916 from class declaration.
917 * script.cc (read_input_script): Allocate Script_info; pass
918 argument serial number to report_script.
919 * script.h (class Script_info): Move to incremental.h.
920 * symtab.cc (Symbol_table::add_from_incrobj): New function.
921 * symtab.h (Symbol_table::add_from_incrobj): New function.
922 (Symbol_table::set_file_offset): New function.
923
b961d0d7
CC
9242011-04-05 Cary Coutant <ccoutant@google.com>
925
926 * incremental-dump.cc (dump_incremental_inputs): Change signature
927 to take a Sized_incremental_binary; change caller. Use readers
928 in Sized_incremental_binary.
929 * incremental.cc
930 (Sized_incremental_binary::find_incremental_inputs_sections):
931 Rename do_find_incremental_inputs_sections to this.
932 (Sized_incremental_binary::setup_readers): New function.
933 (Sized_incremental_binary::do_check_inputs): Check
934 has_incremental_info_ flag; move setup code to setup_readers;
935 use input readers.
936 (Sized_incremental_binary::do_file_is_unchanged): New function.
937 (Sized_incremental_binary::do_get_input_reader): New function.
938 * incremental.h (class Incremental_binary): Move to end of file.
939 (Incremental_binary::file_is_unchanged): New function.
940 (Incremental_binary::do_file_is_unchanged): New function.
941 (Incremental_binary::Input_reader): New class.
942 (Incremental_binary::get_input_reader): New function.
943 (class Sized_incremental_binary): Move to end of file.
944 (Sized_incremental_binary::Sized_incremental_binary): Setup the
945 input section reader classes.
946 (Sized_incremental_binary::has_incremental_info): New function.
947 (Sized_incremental_binary::inputs_reader): New function.
948 (Sized_incremental_binary::symtab_reader): New function.
949 (Sized_incremental_binary::relocs_reader): New function.
950 (Sized_incremental_binary::got_plt_reader): New function.
951 (Sized_incremental_binary::do_file_is_unchanged): New function.
952 (Sized_incremental_binary::Sized_input_reader): New class.
953 (Sized_incremental_binary::get_input_reader): New function.
954 (Sized_incremental_binary::find_incremental_inputs_sections):
955 Rename do_find_incremental_inputs_sections to this.
956 (Sized_incremental_binary::setup_readers): New function.
957 (Sized_incremental_binary::has_incremental_info_): New data member.
958 (Sized_incremental_binary::inputs_reader_): New data member.
959 (Sized_incremental_binary::symtab_reader_): New data member.
960 (Sized_incremental_binary::relocs_reader_): New data member.
961 (Sized_incremental_binary::got_plt_reader_): New data member.
962 (Sized_incremental_binary::current_input_file_): New data member.
963
a869183f
PP
9642011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
965
966 PR gold/12640
967 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
968 violation.
969
9702011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
971
972 * archive.cc (Archive::include_member): Adjust call to report_object.
973 (Add_archive_symbols::run): Add script_info to call to
974 report_archive_begin.
975 (Lib_group::include_member): Adjust call to report_object.
976 (Add_lib_group_symbols::run): Adjust call to report_object.
977 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
978 blocks. Add object count for script input files.
979 * incremental.cc (Incremental_inputs::report_archive_begin): Add
980 script_info parameter; change all callers.
981 (Incremental_inputs::report_object): Add script_info parameter;
982 change all callers.
983 (Incremental_inputs::report_script): Store backpointer to
984 incremental info entry.
985 (Output_section_incremental_inputs::set_final_data_size): Record
986 additional information for scripts.
987 (Output_section_incremental_inputs::write_info_blocks): Likewise.
988 * incremental.h (Incremental_script_entry::add_object): New function.
989 (Incremental_script_entry::get_object_count): New function.
990 (Incremental_script_entry::get_object): New function.
991 (Incremental_script_entry::objects_): New data member; adjust
992 constructor.
993 (Incremental_inputs::report_archive_begin): Add script_info parameter.
994 (Incremental_inputs::report_object): Add script_info parameter.
995 (Incremental_inputs_reader::get_object_count): New function.
996 (Incremental_inputs_reader::get_object_offset): New function.
997 * options.cc (Input_arguments::add_file): Return reference to
998 new input argument.
999 * options.h (Input_argument::set_script_info): New function.
1000 (Input_argument::script_info): New function.
1001 (Input_argument::script_info_): New data member; adjust all
1002 constructors.
1003 (Input_file_group::add_file): Return reference to new input argument.
1004 (Input_file_lib::add_file): Likewise.
1005 (Input_arguments::add_file): Likewise.
1006 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1007 * script.cc (Parser_closure::Parser_closure): Add script_info
1008 parameter; adjust all callers.
1009 (Parser_closure::script_info): New function.
1010 (Parser_closure::script_info_): New data member.
1011 (read_input_script): Report scripts earlier to incremental info.
1012 (script_add_file): Set script_info in Input_argument.
1013 (script_add_library): Likewise.
1014 * script.h (Script_options::Script_info): Rewrite class.
1015
a869183f 10162011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
1017
1018 * archive.cc (Library_base::should_include_member): Move
1019 method here from class Archive.
1020 (Archive::Archive): Initialize base class.
1021 (Archive::should_include_member): Move to base class.
1022 (Archive::do_for_all_unused_symbols): New function.
1023 (Add_archive_symbols::run): Remove redundant access to
1024 incremental_inputs.
1025 (Lib_group::Lib_group): Initialize base class.
1026 (Lib_group::do_filename): New function.
1027 (Lib_group::include_member): Pass pointer to Lib_group to
1028 report_object.
1029 (Lib_group::do_for_all_unused_symbols): New function.
1030 (Add_lib_group_symbols::run): Report archive information for
1031 incremental links.
1032 * archive.h (class Library_base): New base class.
1033 (class Archive): Derive from Library_base.
1034 (Archive::filename): Move to base class.
1035 (Archive::set_incremental_info): Likewise.
1036 (Archive::incremental_info): Likewise.
1037 (Archive::Should_include): Likewise.
1038 (Archive::should_include_member): Likewise.
1039 (Archive::Armap_entry): Remove.
1040 (Archive::Unused_symbol_iterator): Remove.
1041 (Archive::unused_symbols_begin): Remove.
1042 (Archive::unused_symbols_end): Remove.
1043 (Archive::do_filename): New function.
1044 (Archive::do_get_mtime): New function.
1045 (Archive::do_for_all_unused_symbols): New function.
1046 (Archive::task_): Move to base class.
1047 (Archive::incremental_info_): Likewise.
1048 (class Lib_group): Derive from Library_base.
1049 (Lib_group::do_filename): New function.
1050 (Lib_group::do_get_mtime): New function.
1051 (Lib_group::do_for_all_unused_symbols): New function.
1052 (Lib_group::task_): Move to base class.
1053 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1054 function.
1055 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1056 function.
1057 * incremental.cc (Incremental_inputs::report_archive_begin):
1058 Use Library_base; call library's get_mtime; add incremental inputs
1059 entry before members.
1060 (class Unused_symbol_visitor): New class.
1061 (Incremental_inputs::report_archive_end): Use Library_base; use
1062 visitor class to record unused symbols; don't add incremental inputs
1063 entry after members.
1064 (Incremental_inputs::report_object): Use Library_base.
1065 * incremental.h
1066 (Incremental_archive_entry::Incremental_archive_entry): Remove
1067 unused Archive parameter.
1068 (Incremental_inputs::report_archive_begin): Use Library_base.
1069 (Incremental_inputs::report_archive_end): Likewise.
1070 (Incremental_inputs::report_object): Likewise.
1071 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1072 function.
1073 * object.h (Object::for_all_global_symbols): New function.
1074 (Object::do_for_all_global_symbols): New function.
1075 (Sized_relobj::do_for_all_global_symbols): New function.
1076 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1077 function.
1078 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1079 function.
1080
61ab3e40
ILT
10812011-03-27 Ian Lance Taylor <iant@google.com>
1082
1083 * archive.cc (Archive::interpret_header): Return -1 if something
1084 goes wrong. Change callers accordingly.
1085
30e1f9e6
CC
10862011-03-25 Cary Coutant <ccoutant@google.com>
1087
1088 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1089 * testsuite/Makefile.in: Regenerate.
1090
9c793f14
RÁE
10912010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1092
1093 * plugin.cc (get_view): New.
1094 (Plugin::load): Pass get_view to the plugin.
1095 (Plugin_manager::get_view): New.
1096
9312bb0a
ILT
10972011-03-21 Ian Lance Taylor <iant@google.com>
1098
1099 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 1100 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 1101
7e12ba9e
ST
11022011-03-21 Sriraman Tallam <tmsriram@google.com>
1103
1104 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1105 Change == to -eq.
1106 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1107 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1108 Change == to -eq.
1109 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1110 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1111
fd7a005d
ILT
11122011-03-14 Ian Lance Taylor <iant@google.com>
1113
1114 * script-sections.cc (Sort_output_sections::script_compare):
1115 Rename from is_before, change return type.
1116 (Sort_output_sections::operator()): Adjust accordingly.
1117
ed16fd1b
ILT
11182011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1119
1120 PR gold/12572
1121 * testsuite/odr_violation2.cc: Add comment to make all error line
1122 numbers double digits.
1123 * testsuite/debug_msg.sh: Adjust expected errors.
1124
71ff8986
ILT
11252011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1126
1127 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1128 but mark earlier ones as non-canonical
1129 (offset_to_iterator): Update search target and example
1130 (do_addr2line): Return extra lines in a vector*
1131 (format_file_lineno): Extract from do_addr2line
1132 (one_addr2line): Add vector* out-param
1133 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1134 when a lineno entry appeared last for its instruction
1135 (Dwarf_line_info): Add vector* out-param
1136 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1137 * symtab.cc (Odr_violation_compare): Include the lineno in the
1138 comparison again.
1139 (linenos_from_loc): New. Combine the canonical line for an
1140 address with its other lines.
1141 (True_if_intersect): New. Helper functor to make
1142 std::set_intersection a query.
1143 (detect_odr_violations): Compare sets of lines instead of just
1144 one line for each function. This became less deterministic, but
1145 has fewer false positives.
1146 * symtab.h: Declarations.
1147 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1148 mix an optimized and non-optimized object in the same binary
1149 (odr_violation2.so): Same.
1150 * testsuite/Makefile.in: Regenerate from Makefile.am.
1151 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1152 * testsuite/debug_msg.sh: Update line numbers and add
1153 assertions.
1154 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1155 non-optimized context.
1156 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1157 isn't inlined, and use OdrDerived in an optimized context.
1158 * testsuite/odr_header1.h: Defines OdrDerived, where
1159 optimization will change the
1160 first-instruction-in-the-destructor's file and line number.
1161 * testsuite/odr_header2.h: Defines OdrBase.
1162
a19fefdc
ILT
11632011-03-09 Ian Lance Taylor <iant@google.com>
1164
1165 * fileread.cc (File_read::clear_views): Don't delete the whole
1166 file view.
1167
ecb351e9
ILT
11682011-03-08 Ian Lance Taylor <iant@google.com>
1169
1170 PR gold/12525
1171 * fileread.cc: #include <climits>.
1172 (GOLD_IOV_MAX): Define.
1173 (File_read::read_multiple): Limit number of entries by iov_max.
1174 * fileread.h (class File_read): Always set max_readv_entries to
1175 128.
1176
b821d13c
ILT
11772011-03-07 Ian Lance Taylor <iant@google.com>
1178
1179 PR gold/12525
1180 * options.h (class General_options): Add -dy and -dn.
1181
89243142
CC
11822011-03-02 Cary Coutant <ccoutant@google.com>
1183
1184 * testsuite/script_test_9.t: Add TLS segment.
1185
d0773f31
ILT
11862011-03-02 Simon Baldwin <simonb@google.com>
1187
1188 * configure.ac: Add check for gnu_indirect_function support in
1189 the toolchain building binutils.
1190 * configure: Rebuild.
1191
badc8139
RÁE
11922010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1193
1194 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1195 plugin only symbols.
1196 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1197 in plugin files as not needed in the symbol table.
1198
4cf7a849
ST
11992011-02-11 Sriraman Tallam <tmsriram@google.com>
1200
1201 * output.cc (Output_section::add_input_section): Delay fill
1202 generation for section ordering.
1203
b578bd7d
ILT
12042011-02-09 Ian Lance Taylor <iant@google.com>
1205
1206 PR gold/12316
1207 * object.h (class Sized_relobj): Remove clear_local_symbols.
1208 * reloc.cc (Sized_relobj::do_relocate): Don't call
1209 clear_local_symbols.
1210
84ced98a
RÁE
12112010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1212
1213 * plugin.cc (is_visible_from_outside): Return true for symbols
1214 in the -u option.
1215
55382fb7
ILT
12162011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1217
1218 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1219 filename.
1220
4e271fff
ST
12212011-02-02 Sriraman Tallam <tmsriram@google.com>
1222
1223 * icf.h (is_section_foldable_candidate): Change type of parameter
1224 to std::string.
1225 * icf.cc (Icf::find_identical_sections): Change type of local variable
1226 section_name to be std::string.
1227 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1228
d433c3ac
ILT
12292011-01-25 Ian Lance Taylor <iant@google.com>
1230
1231 * script.cc (script_add_extern): Rewrite to use
1232 add_symbol_reference.
1233
880473a6
DK
12342011-01-25 Doug Kwan <dougkwan@google.com>
1235
d433c3ac 1236 * icf.cc (get_section_contents): Always lock section's object.
880473a6 1237
f30f86fa
ILT
12382011-01-24 Ian Lance Taylor <iant@google.com>
1239
1240 * options.h (class General_options): Accept
1241 --no-detect-odr-violations.
1242
8e51a0b9
ILT
12432011-01-24 Ian Lance Taylor <iant@google.com>
1244
1245 * version.cc (version_string): Bump to 1.11.
1246
0f3b89d8
ILT
12472011-01-24 Ian Lance Taylor <iant@google.com>
1248
1249 * plugin.cc (class Plugin_rescan): Define new class.
1250 (Plugin_manager::claim_file): Set any_claimed_.
1251 (Plugin_manager::save_archive): New function.
1252 (Plugin_manager::save_input_group): New function.
1253 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1254 necessary.
1255 (Plugin_manager::new_undefined_symbol): New function.
1256 (Plugin_manager::rescan): New function.
1257 (Plugin_manager::rescannable_defines): New function.
1258 (Plugin_manager::add_input_file): Set any_added_.
1259 * plugin.h (class Plugin_manager): define new fields rescannable_,
1260 undefined_symbols_, any_claimed_, and any_added_. Declare
1261 Plugin_rescan as friend. Declare new functions.
1262 (Plugin_manager::Rescannable): Define type.
1263 (Plugin_manager::Rescannable_list): Define type.
1264 (Plugin_manager::Undefined_symbol_list): Define type.
1265 (Plugin_manager::Plugin_manager): Initialize new fields.
1266 * archive.cc (Archive::defines_symbol): New function.
1267 (Add_archive_symbols::run): Pass archive to plugins if any.
1268 * archive.h (class Archive): Declare defines_symbol.
1269 * readsyms.cc (Input_group::~Input_group): New function.
1270 (Finish_group::run): Pass input_group to plugins if any.
1271 * readsyms.h (class Input_group): Declare destructor.
1272 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1273 any.
1274
3bb951e5
ILT
12752011-01-10 Ian Lance Taylor <iant@google.com>
1276
1277 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1278 section as relro.
1279 (Layout::set_segment_offsets): Reset increase_relro before calling
1280 set_section_addresses a second time.
1281
0aa45fac
CC
12822011-01-04 Cary Coutant <ccoutant@google.com>
1283
1284 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1285 sections before NOBITS sections.
1286
0db46eb4
L
12872011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1288
1289 * version.cc (print_version): Update copyright to 2011.
1290
829c9745
CC
12912010-12-23 Cary Coutant <ccoutant@google.com>
1292
1293 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1294 of OS to this->add. Add OD parameter to second form of the function.
1295
7500420b
ILT
12962010-12-20 Ian Lance Taylor <iant@google.com>
1297
1298 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1299 second of two consecutive entries with same offset.
1300
f8e9a930
RW
13012010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1302
1303 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1304 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1305 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1306 to avoid unneeded links against $(LDADD).
1307 * testsuite/Makefile.in: Regenerate.
1308
2fbb4320
ILT
13092010-12-15 Ian Lance Taylor <iant@google.com>
1310
1311 PR gold/12324
1312 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1313 for R_X86_64_32 and R_X86_64_PC32.
1314 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1315 ver_matching_def_pic.o.
1316 (ver_matching_def_pic.o): New target.
1317
fedb228d
RW
13182010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1319
1320 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1321 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1322 Move definition before File_read::View member definitions.
1323 (File_read::View::~View): Initialize and hold lock before
1324 updating current_mapped_bytes.
1325
9b547ce6
RW
13262010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1327
1328 * dwarf_reader.cc: Remove outdated comment.
1329 * gold-threads.cc: Fix typo in error message.
1330 * archive.cc: Fix typos in comments.
1331 * archive.h: Likewise.
1332 * arm-reloc-property.cc: Likewise.
1333 * arm-reloc-property.h: Likewise.
1334 * arm-reloc.def: Likewise.
1335 * arm.cc: Likewise.
1336 * attributes.h: Likewise.
1337 * cref.cc: Likewise.
1338 * ehframe.cc: Likewise.
1339 * fileread.h: Likewise.
1340 * gold.h: Likewise.
1341 * i386.cc: Likewise.
1342 * icf.cc: Likewise.
1343 * incremental.h: Likewise.
1344 * int_encoding.cc: Likewise.
1345 * layout.h: Likewise.
1346 * main.cc: Likewise.
1347 * merge.h: Likewise.
1348 * object.cc: Likewise.
1349 * object.h: Likewise.
1350 * options.cc: Likewise.
1351 * readsyms.cc: Likewise.
1352 * reduced_debug_output.cc: Likewise.
1353 * reloc.cc: Likewise.
1354 * script-sections.cc: Likewise.
1355 * sparc.cc: Likewise.
1356 * symtab.h: Likewise.
1357 * target-reloc.h: Likewise.
1358 * target.cc: Likewise.
1359 * target.h: Likewise.
1360 * timer.cc: Likewise.
1361 * timer.h: Likewise.
1362 * x86_64.cc: Likewise.
1363
83e17bd5
CC
13642010-12-09 Cary Coutant <ccoutant@google.com>
1365
1366 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1367 stack.
1368 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1369 parameter; change all callers.
1370 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1371 * options.h (warn_execstack): New option.
1372
017257f8
DK
13732010-12-07 Doug Kwan <dougkwan@google.com>
1374
1375 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1376 like function call relocations.
1377
c20cbc06
ILT
13782010-12-07 Ian Lance Taylor <iant@google.com>
1379
1380 * archive.cc (Archive::get_elf_object_for_member): Permit
1381 punconfigured to be NULL.
1382 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1383 (Archive::include_member): Pass NULL to get_elf_object_for_member
1384 if we searched for the archive and this is the first included
1385 object.
1386
4dbfafcc
ILT
13872010-12-01 Ian Lance Taylor <iant@google.com>
1388
1389 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1390 track_relocs_type_ field.
1391 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1392 Set track_relocs_type_.
1393 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1394 contents when using RELA relocs.
1395 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1396 reloc_map_.
1397 * reloc.cc (Track_relocs::next_addend): New function.
1398 * reloc.h (class Track_relocs): Declare next_addend.
1399
e5e19edd
ILT
14002010-12-01 Ian Lance Taylor <iant@google.com>
1401
1402 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1403 virtual destructor.
1404
9a5ce24c
ILT
14052010-12-01 Ian Lance Taylor <iant@google.com>
1406
1407 * README: Update compilers known to work and fail.
1408
c7791212
NC
14092010-11-23 Matthias Klose <doko@ubuntu.com>
1410
1411 * configure.in: For --enable-gold, handle value `default' instead of
1412 `both*'. Always install ld as ld.bfd, install as ld if gold is
1413 not the default.
1414 * configure: Regenerate.
1415
0ad220c9
DK
14162010-11-18 Doug Kwan <dougkwan@google.com>
1417
1418 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1419 and right_alignment to be zero. Store result alignment only if it is
1420 greater than existing alignment.
1421
ab8056e0
CC
14222010-11-16 Cary Coutant <ccoutant@google.com>
1423
1424 PR gold/12220
1425 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1426 Check for ".zdebug_line".
1427
fd064a5b
CC
14282010-11-16 Doug Kwan <dougkwan@google.com>
1429 Cary Coutant <ccoutant@google.com>
1430
1431 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1432 by reference; adjust all callers.
1433 * output.cc (Output_segment::set_section_addresses): Adjust references
1434 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1435 list is empty.
1436 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1437 end at page boundary.
1438
6fc6ea19
CC
14392010-11-16 Cary Coutant <ccoutant@google.com>
1440
1441 PR gold/12220
1442 * layout.cc (Layout::choose_output_section): Transform names of
1443 compressed sections even when using a script with a SECTIONS clause.
1444 (Layout::output_section_name): Remove code to transform
1445 compressed debug section names.
1446 * output.cc (Output_section::add_input_section): Use uncompressed
1447 section size when tracking input sections.
1448
95a2c8d6
RS
14492010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1450
1451 * symtab.h (Symbol::NON_PIC_REF): Remove.
1452 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1453 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1454 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1455 (Symbol::use_plt_offset): Take a flags argument and pass it
1456 directly to needs_dynamic_reloc. Restrict check for undefined
1457 weak symbols to function calls.
1458 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1459 (Target_arm::Scan::global): Use it.
1460 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1461 (Target_arm::Relocate::relocate): Likewise.
1462 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1463 parameter with an r_type parameter. Use get_reference_flags
1464 to get the flags.
1465 (Target_arm::Relocate::relocate): Update accordingly.
1466 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1467 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1468 (Target_i386::Scan::global): Likewise.
1469 (Target_i386::Relocate::relocate): Likewise.
1470 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1471 parameter with an r_type parameter. Use get_reference_flags
1472 to get the flags.
1473 (Target_i386::Relocate::relocate): Update accordingly.
1474 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1475 (Target_powerpc::Scan::global): Use it.
1476 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1477 (Target_powerpc::Relocate::relocate): Likewise.
1478 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1479 (Target_sparc::Scan::global): Use it.
1480 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1481 (Target_sparc::Relocate::relocate): Likewise.
1482 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1483 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1484 (Target_x86_64::Scan::global): Likewise.
1485 (Target_x86_64::Relocate::relocate): Likewise.
1486
f625ae50
DK
14872010-11-08 Doug Kwan <dougkwan@google.com>
1488 Cary Coutant <ccoutant@google.com>
1489
1490 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1491 (Arm_exidx_merge_section::section_contents_): New data member.
1492 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1493 (Arm_input_section::~Arm_input_section): De-allocate memory.
1494 (Arm_input_section::original_contents_): New data member.
1495 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1496 in parameters instead of calling Object::section_contents without
1497 locking.
1498 (Arm_output_section::group_section): New parameter TASK. Pass it
1499 to callees that need locking objects.
1500 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1501 to lock EXIDX input sections. Fix a formatting issue. Call
1502 Arm_exidx_merged_section::build_contents to create merged section
1503 contents.
1504 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1505 to lock object of stub table owner.
1506 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1507 TEXT_SIZE to initialize data member TEXT_SIZE_.
1508 (Arm_exidx_input_section::addralign): Fix typo in comment.
1509 (Arm_exidx_input_section::text_size): New method.
1510 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1511 that require locking objects. Lock objects before scanning for stubs
1512 and updating local symbols.
1513 (Arm_input_section<big_endian>::init): Copy contents of original
1514 input section.
1515 (Arm_input_section<big_endian>::do_write): Use saved contents of
1516 original input section instead of calling Object::section_contents
1517 without locking.
1518 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1519 size without calling Object::section_size().
1520 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1521 for size. Allocate a buffer for merged EXIDX entries.
1522 (Arm_exidx_merged_section::build_contents): New method.
1523 (Arm_exidx_merged_section::do_write): Move merge section contents
1524 building code to Arm_exidx_merged_section::build_contetns. Write
1525 out contetns in buffer instead of building it on the fly.
1526 (Arm_relobj::make_exidx_input_section): Also pass text section size
1527 to Arm_exidx_input_section constructor.
1528 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1529 (Arm_dynobj::do_read_symbols): Fix memory leak.
1530 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1531 * target.h: (class Task): Add forward declaration.
1532 (Target::relax): Add new parameter TASK and pass it to
1533 Target::do_relax().
1534 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1535
5f9bcf58
CC
15362010-11-05 Cary Coutant <ccoutant@google.com>
1537
1538 PR gold/10708
1539 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1540 object when reading from the file.
1541 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1542 second layout pass.
1543 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1544 when reading section contents.
1545 (get_section_contents): Likewise.
1546 (icf::find_identical_sections): Likewise.
1547 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1548 object when reading from the file.
1549 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1550 the object when doing deferred section layout.
1551
e597fa08
NC
15522010-11-03 Nick Clifton <nickc@redhat.com>
1553
1554 PR gold/12001
1555 * script.h (class Symbol_assignment: name): New member. Returns
1556 the name of the symbol.
1557 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1558 Returns true if the given symbol name is on the list of
1559 assignments wating to be processed.
1560 * archive.cc (should_incldue_member): If the symbol is undefined,
1561 check to see if it is on the list of symbols pending assignment.
1562
3f9a3278
ILT
15632010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1564
1565 * script-sections.cc (Script_sections::find_memory_region): Check
1566 for a NULL output section pointer.
1567
d06fb4d1
DK
15682010-10-29 Doug Kwan <dougkwan@google.com>
1569
1570 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1571 Output_section::add_relaxed_input_section.
1572 * output.cc (Output_section::add_relaxed_input_section): Add new
1573 arguments LAYOUT and NAME. Set section order index.
1574 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1575 Copy section order index.
1576 * output.h (Output_section::add_relaxed_input_section): Add new
1577 arguments LAYOUT and NAME.
1578
90e24de5
ILT
15792010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1580
1581 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1582 NATIVE_OR_CROSS_LINKER.
1583 * testsuite/Makefile.in: Regenerate.
1584
c9484ea5
DK
15852010-10-20 Doug Kwan <dougkwan@google.com>
1586
1587 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1588 without SHF_LINK_ORDER flags.
1589 * layout.cc (Layout::choose_output_section): Do not filter
1590 SHF_LINK_ORDER flag in a relocatable link.
1591
5bc2f5be
CC
15922010-10-17 Cary Coutant <ccoutant@google.com>
1593
1594 * output.h (Output_segment::set_section_addresses): Change function
1595 signature. Update all callers.
1596 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1597 sections.
1598 (Output_segment::set_section_addresses): Align after last TLS
1599 section. Add padding before last relro section instead of after.
1600
0c91cf04
DK
16012010-10-17 Doug Kwan <dougkwan@google.com>
1602
1603 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1604 GOT output section to be writable.
1605
8c21d9d3
CC
16062010-10-14 Cary Coutant <ccoutant@google.com>
1607
1608 * debug.h (DEBUG_INCREMENTAL): New flag.
1609 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1610 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1611 mode.
1612 * incremental.cc (report_command_line): Ignore all forms of
1613 --incremental.
1614 * layout.cc (Layout::Layout): Check parameters for incremental link
1615 mode.
1616 * options.cc (General_options::parse_incremental): New function.
1617 (General_options::parse_no_incremental): New function.
1618 (General_options::parse_incremental_full): New function.
1619 (General_options::parse_incremental_update): New function.
1620 (General_options::incremental_mode_): New data member.
1621 (General_options::finalize): Check incremental_mode_.
1622 * options.h (General_options): Update help text for --incremental.
1623 Add --no-incremental, --incremental-full, --incremental-update.
1624 (General_options::Incremental_mode): New enum type.
1625 (General_options::incremental_mode): New function.
1626 (General_options::incremental_mode_): New data member.
1627 * parameters.cc (Parameters::incremental_mode_): New data member.
1628 (Parameters::set_options): Set incremental_mode_.
1629 (Parameters::set_incremental_full): New function.
1630 (Parameters::incremental): New function.
1631 (Parameters::incremental_update): New function.
1632 (set_parameters_incremental_full): New function.
1633 * parameters.h (Parameters::set_incremental_full): New function.
1634 (Parameters::incremental): New function.
1635 (Parameters::incremental_update): New function.
1636 (Parameters::incremental_mode_): New data member.
1637 (set_parameters_incremental_full): New function.
1638 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1639 incremental link mode.
1640 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1641 (Sized_relobj::do_relocate_sections): Likewise.
1642 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1643 option.
1644 * testsuite/Makefile.in: Regenerate.
1645 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1646
bb32aa18 16472010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
1648
1649 * script-sections.h (class Script_sections): Make
1650 Sections_elements typedef public.
1651 * script-sections.cc (class Sort_output_sections): Add elements_
1652 field. Add constructor which sets it; change all callers.
1653 (Sort_output_sections::is_before): New function.
1654 (Sort_output_sections::operator()): Call is_before.
1655 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1656 conditional.
1657 * testsuite/script_test_10.sh: New test. Test script section
1658 order.
1659 * testsuite/script_test_10.t: Likewise.
1660 * testsuite/script_test_10.s: Likewise.
1661 * testsuite/Makefile.am: Wrap the cross linker tests and the
1662 common tests into NATIVE_OR_CROSS_LINKER.
1663 (check_SCRIPTS): Add script_test_10.sh.
1664 (check_DATA): Add script_test_10.stdout.
1665 (script_test_10.o, script_test_10): New targets.
1666 (script_test_10.stdout): New target.
1667 * configure, testsuite/Makefile.in: Regenerate.
1668
3cef7179
ILT
16692010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1670
1671 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1672 error for the deprecated relocations.
1673 (Target_arm::Scan::global): Likewise.
1674 (Target_arm::Relocate::relocate): Likewise.
1675
7411e9a8
RS
16762010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1677
1678 * fileread.cc (Input_file::find_file): Initialize *found_name
1679 and *namep when using the fallback search for case 4.
1680
6a9da32a
CC
16812010-10-11 Cary Coutant <ccoutant@google.com>
1682
1683 * options.h (class General_options): Redefine -z lazy as an alias for
1684 the negation of -z now.
1685
ac897c20
ILT
16862010-10-11 Ian Lance Taylor <iant@google.com>
1687
1688 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1689 binding.
1690
ea5cae92
NC
16912010-10-06 Nick Clifton <nickc@redhat.com>
1692
1693 * script-sections.cc(class Memory_region): Remove
1694 current_lma_offset_ field. Rename current_vma_offset_ to
1695 current_offset_. Add last_section_ field.
1696 (Memory_region::get_current_vma_address): Rename to
1697 get_current_address.
1698 (Memory_region::get_current_lma_address): Delete.
1699 (Memory_region::increment_vma_offset): Rename to
1700 increment_offset.
1701 (Memory_region::increment_lma_offset): Delete.
1702 (Memory_region::attributes_compatible): New method. Returns
1703 true if the provided section is compatible with the region.
1704 (Memory_region::get_last_section): New method. Returns the last
1705 section to use the region.
1706 (Memory_region::set_last_section): New method. Stores the last
1707 section to use the region.
1708 (Script_sections::block_in_region): New method. Returns true if
1709 a block of memory is contained within a region.
1710 (Script_sections::find_memory_region): New method. Locates a
1711 memory region to be used to set a VMA or LMA address.
1712 (Output_section_definition::set_section_addresses): Add code to
1713 check for addresses set by memory regions.
1714 (Output_segment::set_section_addresses): Remove memory region
1715 walking code.
1716 (Script_sections::create_segment): Add a warning if a header
1717 segment is created outside of any region.
1718 * script-sections.h (class Script_sections): Add prototypes for
1719 find_memory_region and block_in_region methods.
1720 * testsuite/memory_test.s: Use .long instead of .word.
1721 * testsuite/memory_test.t: Add some more output sections.
1722 * testsuite/memory_test.sh: Update expected output.
1723
a9bfd952
DK
17242010-10-02 Doug Kwan <dougkwan@google.com>
1725
1726 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1727 defintion to symtab.h
1728 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1729 declaration to defintion.
1730
bacff3ab
NC
17312010-10-01 Nick Clifton <nickc@redhat.com>
1732
1733 * expression.cc (eval): Replace dummy argument with NULL.
1734 (eval_maybe_dot): Check for a NULL result section pointer.
1735 (Symbol_expression::value): Likewise.
1736 (Dot_expression::value): Likewise.
1737 (BINARY_EXPRESSION): Likewise.
1738 (Max_expression::value): Likewise.
1739 (Min_expression::value): Likewise.
1740 (Absolute_expression::value): Likewise.
1741 (Addr_expression::value_from_output_section): Likewise.
1742 (Loaddddr_expression::value_from_output_section): Likewise.
1743 (Segment_start_expression::value): Likewise.
1744 * script-sections.cc
1745 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1746 argument with NULL.
1747 (Sections_elememt_dot_assignment::set_section_addresses):
1748 Likewise.
1749 (Output_data_expression::do_write_to_buffer): Likewise.
1750 (Output_section_definition::finalize_symbols): Likewise.
1751 (Output_section_definition::set_section_addresses): Likewise.
1752
f81bc8b5
DK
17532010-09-30 Doug Kwan <dougkwan@google.com>
1754
1755 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1756
c95e9f27
ST
17572010-09-28 Sriraman Tallam <tmsriram@google.com>
1758
1759 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 1760 function.
c95e9f27
ST
1761 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1762 virtual function.
1763 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1764 virtual function.
1765 * icf.cc (get_section_contents): Inline merge sections only when
1766 target allows it.
1767
3cac54d2
RW
17682010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1769
1770 * configure: Regenerate.
1771
2904037a
ILT
17722010-09-17 Ian Lance Taylor <iant@google.com>
1773
1774 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
1775 * testsuite/Makefile.am (memory_test.o): New target.
1776 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1777 memory_test.t.
1778 * testsuite/Makefile.in: Rebuild.
2904037a 1779
bca7fb63
DK
17802010-09-17 Doug Kwan <dougkwan@google.com>
1781
1782 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1783 defintion if relocation uses GOT entries of the symbol.
1784 * testsuite/icf_safe_test.sh: Fix test.
1785 * testsuite/icf_safe_so_test.sh: Fix test.
1786
4ef28648
CC
17872010-09-16 Cary Coutant <ccoutant@google.com>
1788
1789 * script_sections.cc (class Memory_region): Remove "NULL" from
1790 vector initializations.
1791
793990de
CC
17922010-09-15 Cary Coutant <ccoutant@google.com>
1793
1794 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1795 Resolve forwarding symbols.
1796
81e015e2
DK
17972010-09-15 Doug Kwan <dougkwan@google.com>
1798
1799 * gold/testsuite/script_test_3.t: Add ARM special sections.
1800 * gold/testsuite/script_test_4.t: Same.
1801 * gold/testsuite/script_test_5.t: Same.
1802 * gold/testsuite/script_test_6.t: Same.
1803 * gold/testsuite/script_test_7.t: Same.
1804 * gold/testsuite/script_test_7.t: Same.
1805 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1806
36171d64
CC
18072010-09-14 Cary Coutant <ccoutant@google.com>
1808
1809 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1810 (Target_x86_64::Relocate::relocate_tls): Replace check for
1811 saw_tls_block_reloc_ with test for executable section.
1812
d89051bd
CC
18132010-09-12 Cary Coutant <ccoutant@google.com>
1814
1815 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1816 position-independent executables to shared libraries need dynamic
1817 relocations.
1818 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1819 position-independent executables.
1820 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1821 * testsuite/Makefile.in: Regenerate.
1822
fca41f0f
NC
18232010-09-10 Nick Clifton <nickc@redhat.com>
1824
1825 PR gold/11997
1826 * testsuite/memory_test.t: Discard any sections that are not
1827 needed.
1828
6695e4b3
L
18292010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1830
1831 PR gold/11996
1832 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1833 "This::" to work around a bug in gcc 4.2.
1834
1835 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1836
0f72bf6f
RÁE
18372010-09-09 Rafael Espindola <espindola@google.com>
1838
1839 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1840 sections with different PF_X flags in the same segment.
1841 (Layout::find_first_load_seg): Search all segments to find the first
1842 one.
1843 * options.h (rosegment): New.
1844
18452010-09-08 Rafael Espindola <espindola@google.com>
a6577478 1846
05a79166 1847 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 1848
aa98ff75
DK
18492010-09-08 Doug Kwan <dougkwan@google.com>
1850
1851 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1852 (Arm_relobj::do_relocate_sections): Add new parameter for output
1853 file to match the parent.
1854 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1855 of local symbols instead of input values. Update code to track
1856 changes in gold::relocate_section.
1857 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1858 (Sized_relobj::compute_final_local_value_internal): New methods.
1859 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1860 body into private version of Sized_relobj::compute_final_local_value.
1861 Call the inline method.
1862 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1863 merged symbol value if there is one.
1864 (Symbol_value::has_output_value): New method defintiion.
1865 (Sized_relobj::Compute_final_local_value_status): New enum type.
1866 (Sized_relobj::compute_final_local_value): New methods.
1867 (Sized_relobj::compute_final_local_value_internal): New methods.
1868 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1869 and arm_cortex_a8.sh.
1870 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1871 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1872 New tests.
1873 * Makefile.in: Regenerate.
1874 * testsuite/arm_bl_out_of_range.s: Update test.
1875 * testsuite/thumb_bl_out_of_range.s: Ditto.
1876 * testsuite/thumb_blx_out_of_range.s: Ditto.
1877 * testsuite/arm_branch_out_of_range.sh: New file.
1878 * testsuite/arm_cortex_a8.sh: Ditto.
1879 * testsuite/arm_cortex_a8_b.s: Ditto.
1880 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1881 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1882 * testsuite/arm_cortex_a8_bl.s: Ditto.
1883 * testsuite/arm_cortex_a8_blx.s: Ditto.
1884 * testsuite/arm_cortex_a8_local.s: Ditto.
1885 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1886 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1887
05a79166
L
18882010-09-08 Rafael Espindola <espindola@google.com>
1889
1890 * Makefile.am (memory_test.stdout): Run readelf with -W.
1891 * Makefile.in: Regenerate.
1892 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1893 64 bit output.
1894
33dbc701
RÁE
18952010-09-08 Rafael Espindola <espindola@google.com>
1896
1897 * script-sections.cc (Script_sections::add_memory_region): Convert
1898 field precision to int.
1899 * script.cc (script_set_section_region, script_set_section_region):
1900 Convert field precision to int.
1901
731ca54a
RÁE
19022010-09-08 Rafael Espindola <espindola@google.com>
1903
1904 * arm.cc (do_finalize_sections): Create the __exidx_start and
1905 __exdix_end symbols even when the section is missing.
1906
7f8cd844
NC
19072010-09-08 Nick Clifton <nickc@redhat.com>
1908
1909 * README: Remove claim that MEMORY is not supported.
1910 * expression.cc (script_exp_function_origin)
1911 (script_exp_function_length): Move from here to ...
1912 * script.cc: ... here.
1913 (script_set_section_region, script_add_memory)
1914 (script_parse_memory_attr, script_include_directive): New
1915 functions.
1916 * script-sections.cc
1917 (class Memory_region): New class.
1918 (class Output_section_definition): Add set_memory_region,
1919 set_section_vma, set_section_lma and get_section_name methods.
1920 (class Script_Sections): Add add_memory_region,
1921 find_memory_region, find_memory_region_origin,
1922 find_memory_region_length and set_memory_region methods.
1923 Have set_section_addresses method walk the list of set memory
1924 regions.
1925 Extend the print methos to display memory regions.
1926 * script-sections.h: Add prototypes for new methods.
1927 Add enum for MEMORY region attributes.
1928 * yyscript.y: Add support for parsing MEMORY regions.
1929 * script-c.h: Add prototypes for new functions.
1930 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1931 * testsuite/Makefile.in: Regenerate.
1932 * testsuite/memory_test.sh: New script.
1933 * testsuite/memory_test.s: New assembler source file.
1934 * testsuite/memory_test.t: New linker script.
1935
a4649286
DK
19362010-08-27 Doug Kwan <dougkwan@google.com>
1937
1938 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1939 reference override an existing dynamic weak reference.
1940 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1941 * testsuite/Makefile.in: Regenerate.
1942 * testsuite/dyn_weak_ref.sh: New file.
1943 * testsuite/dyn_weak_ref_1.c: Ditto.
1944 * testsuite/dyn_weak_ref_2.c: Ditto.
1945
b56648ad
ILT
19462010-08-27 Ian Lance Taylor <iant@google.com>
1947
1948 * incremental.h (class Incremental_input_entry): Add virtual
1949 destructor.
1950
809313cb
ILT
19512010-08-27 Ian Lance Taylor <iant@google.com>
1952
1953 * testsuite/start_lib_test_3.c: Mark t3 as used.
1954
11e32464
NC
19552010-08-27 Nick Clifton <nickc@redhat.com>
1956
1957 * options.cc (version_script): Fix small typo in previous
1958 whitespace tidyup.
1959
ca09d69a
NC
19602010-08-25 Nick Clifton <nickc@redhat.com>
1961
1962 * archive.cc: Formatting fixes: Remove whitespace between
1963 typename and following asterisk. Remove whitespace between
1964 function name and opening parenthesis.
1965 * archive.h: Likewise.
1966 * arm.cc: Likewise.
1967 * attributes.cc: Likewise.
1968 * attributes.h: Likewise.
1969 * common.cc: Likewise.
1970 * copy-relocs.cc: Likewise.
1971 * dirsearch.h: Likewise.
1972 * dynobj.cc: Likewise.
1973 * ehframe.cc: Likewise.
1974 * ehframe.h: Likewise.
1975 * expression.cc: Likewise.
1976 * fileread.cc: Likewise.
1977 * fileread.h: Likewise.
1978 * gc.h: Likewise.
1979 * gold-threads.cc: Likewise.
1980 * gold.cc: Likewise.
1981 * i386.cc: Likewise.
1982 * icf.h: Likewise.
1983 * incremental-dump.cc: Likewise.
1984 * incremental.cc: Likewise.
1985 * layout.cc: Likewise.
1986 * layout.h: Likewise.
1987 * main.cc: Likewise.
1988 * merge.cc: Likewise.
1989 * merge.h: Likewise.
1990 * object.cc: Likewise.
1991 * object.h: Likewise.
1992 * options.cc: Likewise.
1993 * options.h: Likewise.
1994 * output.cc: Likewise.
1995 * output.h: Likewise.
1996 * plugin.cc: Likewise.
1997 * plugin.h: Likewise.
1998 * powerpc.cc: Likewise.
1999 * reloc.cc: Likewise.
2000 * script-c.h: Likewise.
2001 * script-sections.cc: Likewise.
2002 * script.cc: Likewise.
2003 * stringpool.cc: Likewise.
2004 * symtab.cc: Likewise.
2005 * symtab.h: Likewise.
2006 * target.cc: Likewise.
2007 * timer.cc: Likewise.
2008 * timer.h: Likewise.
2009 * version.cc: Likewise.
2010 * x86_64.cc: Likewise.
2011
b8fa8750
NC
20122010-08-24 Nick Clifton <nickc@redhat.com>
2013
2014 PR 11899
2015 * layout.cc (segment_precedes): Sort segments by their physical
2016 addresses, if they have been set.
2017
9919d93b
CC
20182010-08-23 Cary Coutant <ccoutant@google.com>
2019
2020 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2021 symbols data.
2022 (Lib_group::include_member): Unlock object after deleting its
2023 symbols data.
2024 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2025 the bug fixed here.
2026
97b4be1c
CC
20272010-08-19 Neil Vachharajani <nvachhar@google.com>
2028 Cary Coutant <ccoutant@google.com>
2029
2030 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2031 constructor, and set_blocker.
2032 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2033 readsyms_blocker_.
2034 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2035 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2036 * testsuite/Makefile.am (start_lib_test): New test case.
2037 * testsuite/Makefile.in: Regenerate.
2038 * testsuite/start_lib_test_main.c: New file.
2039 * testsuite/start_lib_test_1.c: New file.
2040 * testsuite/start_lib_test_2.c: New file.
2041 * testsuite/start_lib_test_3.c: New file.
2042
dd0b1884
ILT
20432010-08-19 Ian Lance Taylor <iant@google.com>
2044
2045 * Makefile.in: Rebuild with automake 1.11.1.
2046 * aclocal.m4: Likewise.
2047 * testsuite/Makefile.in: Likewise.
2048
7223e9ca
ILT
20492010-08-19 Ian Lance Taylor <iant@google.com>
2050
2051 PR 10893
2052 * i386.cc (class Output_data_plt_i386): Update declarations.
2053 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2054 local_ifuncs_ fields.
2055 (Target_i386::do_plt_section_for_global): New function.
2056 (Target_i386::do_plt_section_for_local): New function.
2057 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2058 parameter; change all callers. Initialize global_ifuncs_ and
2059 local_ifuncs_. If doing a static link define __rel_iplt_start and
2060 __rel_iplt_end.
2061 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2062 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2063 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2064 symbols.
2065 (Target_i386::make_plt_section): New function, broken out of
2066 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2067 (Target_i386::make_plt_entry): Call make_plt_section.
2068 (Target_i386::make_local_ifunc_plt_entry): New function.
2069 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2070 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2071 R_386_IRELATIVE to switch.
2072 (Target_i386::Scan::global): Likewise.
2073 (Target_i386::Relocate::relocate): Likewise.
2074 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2075 switch.
2076 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2077 (Target_x86_64::do_plt_section_for_global): New function.
2078 (Target_x86_64::do_plt_section_for_local): New function.
2079 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2080 parameter; change all callers. If doing a static link define
2081 __rela_iplt_start and __rela_iplt_end.
2082 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2083 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2084 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2085 to point to .plt.
2086 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2087 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2088 switch.
2089 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2090 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2091 R_X86_64_IRELATIVE to switch.
2092 (Target_x86_64::Scan::global): Likewise.
2093 (Target_x86_64::Relocate::relocate): Likewise.
2094 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2095 switch.
2096 * target.h (class Target): Add plt_section_for_global and
2097 plt_section_for_local functions. Add do_plt_section_for_global
2098 and do_plt_section_for_local virtual functions.
2099 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2100 clarifying comments.
2101 (Symbol::use_plt_offset): Handle IFUNC symbol.
2102 * object.cc (Sized_relobj::Sized_relobj): Initialize
2103 local_plt_offsets_.
2104 (Sized_relobj::local_has_plt_offset): New function.
2105 (Sized_relobj::local_plt_offset): New function.
2106 (Sized_relobj::set_local_plt_offset): New function.
2107 (Sized_relobj::do_count): Handle IFUNC symbol.
2108 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2109 a bit away from input_shndx_ field. Add set_is_func_symbol and
2110 is_ifunc_symbol functions.
2111 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2112 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2113 local_plt_offsets_ field.
2114 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2115 * output.h (class Output_section_data): Add non-const
2116 output_section function.
2117 (class Output_data_got): Update declarations.
2118 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2119 Add use_plt_offset parameter to global and local constructors.
2120 Change all callers. Change local_sym_index_ field to 31 bits.
2121 Change GSYM_CODE and CONSTANT_CODE accordingly.
2122 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2123 doing a static link don't set sh_link field.
2124 (Output_data_got::Got_entry::write): Use PLT offset if
2125 appropriate.
2126 (Output_data_got::add_global_plt): New function.
2127 (Output_data_got::add_local_plt): New function.
2128 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2129 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2130 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2131 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2132 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2133 IFUNC conditional.
2134 * testsuite/ifunc-sel.h: New file.
2135 * testsuite/ifuncmain1.c: New file.
2136 * testsuite/ifuncmain1vis.c: New file.
2137 * testsuite/ifuncmod1.c: New file.
2138 * testsuite/ifuncdep2.c: New file.
2139 * testsuite/ifuncmain2.c: New file.
2140 * testsuite/ifuncmain3.c: New file.
2141 * testsuite/ifuncmod3.c: New file.
2142 * testsuite/ifuncmain4.c: New file.
2143 * testsuite/ifuncmain5.c: New file.
2144 * testsuite/ifuncmod5.c: New file.
2145 * testsuite/ifuncmain6pie.c: New file.
2146 * testsuite/ifuncmod6.c: New file.
2147 * testsuite/ifuncmain7.c: New file.
2148 * configure, testsuite/Makefile.in: Rebuild.
2149
56f75c03
ILT
21502010-08-18 Ian Lance Taylor <iant@google.com>
2151
2152 * incremental.cc
2153 (Output_section_incremental_inputs::write_input_files): Add cast
2154 to avoid signed/unsigned comparison warning.
2155 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2156
55455f89
CC
21572010-08-12 Cary Coutant <ccoutant@google.com>
2158
2159 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2160
e2054bcb
ILT
21612010-08-13 Ian Lance Taylor <iant@google.com>
2162
2163 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2164
74f67560
DK
21652010-08-12 Cary Coutant <ccoutant@google.com>
2166 Doug Kwan <dougkwan@google.com>
2167
2168 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2169 defintion overrides non-weak undef, remember that the original undef
2170 is not weak.
2171 * symtab.cc (Symbol_table::sized_write_global): For undef without
2172 an original weak binding, set binding to global in output.
2173 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2174 * testsuite/Makefile.in: Regenerate.
2175 * testsuite/strong_ref_weak_def.sh: New file.
2176 * testsuite/strong_ref_weak_def_1.c: Ditto.
2177 * testsuite/strong_ref_weak_def_2.c: Ditto.
2178
d1238d12
CC
21792010-08-12 Cary Coutant <ccoutant@google.com>
2180
2181 * testsuite/incremental_test.sh: Rewrite.
2182 * testsuite/incremental_test_1.c: Rewrite.
2183 * testsuite/incremental_test_2.c: Rewrite.
2184
0e70b911
CC
21852010-08-12 Cary Coutant <ccoutant@google.com>
2186
2187 * arm.cc (Target_arm::got_size): Add const.
2188 (Target_arm::got_entry_count): New function.
2189 (Target_arm::plt_entry_count): New function.
2190 (Target_arm::first_plt_entry_offset): New function.
2191 (Target_arm::plt_entry_size): New function.
2192 (Output_data_plt_arm::entry_count): New function.
2193 (Output_data_plt_arm::first_plt_entry_offset): New function.
2194 (Output_data_plt_arm::get_plt_entry_size): New function.
2195 * i386.cc (Target_i386::got_size): Add const.
2196 (Target_i386::got_entry_count): New function.
2197 (Target_i386::plt_entry_count): New function.
2198 (Target_i386::first_plt_entry_offset): New function.
2199 (Target_i386::plt_entry_size): New function.
2200 (Output_data_plt_i386::entry_count): New function.
2201 (Output_data_plt_i386::first_plt_entry_offset): New function.
2202 (Output_data_plt_i386::get_plt_entry_size): New function.
2203 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2204 find_incremental_inputs_sections. Dump incremental_got_plt section.
2205 * incremental.cc: Include target.h.
2206 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2207 parameter. Adjust all callers. Find incremental_got_plt section.
2208 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2209 section.
2210 (Output_section_incremental_inputs::set_final_data_size): Calculate
2211 size of incremental_got_plt section.
2212 (Output_section_incremental_inputs::do_write): Write the
2213 incremental_got_plt section.
2214 (Got_plt_view_info): New struct.
2215 (Local_got_offset_visitor): New class.
2216 (Global_got_offset_visitor): New class.
2217 (Global_symbol_visitor_got_plt): New class.
2218 (Output_section_incremental_inputs::write_got_plt): New function.
2219 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2220 Add parameter. Adjust all callers.
2221 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2222 (Incremental_inputs::got_plt_section): New function.
2223 (Incremental_inputs::got_plt_section_): New data member.
2224 (Incremental_got_plt_reader): New class.
2225 * layout.cc (Layout::create_incremental_info_sections): Add the
2226 incremental_got_plt section.
2227 * object.h (Got_offset_list::get_list): New function.
2228 (Got offset_list::for_all_got_offsets): New function.
2229 (Sized_relobj::local_got_offset_list): New function.
2230 * powerpc.cc (Target_powerpc::got_size): Add const.
2231 (Target_powerpc::got_entry_count): New function.
2232 (Target_powerpc::plt_entry_count): New function.
2233 (Target_powerpc::first_plt_entry_offset): New function.
2234 (Target_powerpc::plt_entry_size): New function.
2235 (Output_data_plt_powerpc::entry_count): New function.
2236 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2237 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2238 * sparc.cc (Target_sparc::got_size): Add const.
2239 (Target_sparc::got_entry_count): New function.
2240 (Target_sparc::plt_entry_count): New function.
2241 (Target_sparc::first_plt_entry_offset): New function.
2242 (Target_sparc::plt_entry_size): New function.
2243 (Output_data_plt_sparc::entry_count): New function.
2244 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2245 (Output_data_plt_sparc::get_plt_entry_size): New function.
2246 * symtab.h (Symbol::got_offset_list): New function.
2247 (Symbol_table::for_all_symbols): New function.
2248 * target.h (Sized_target::got_entry_count): New function.
2249 (Sized_target::plt_entry_count): New function.
2250 (Sized_target::plt_entry_size): New function.
2251 * x86_64.cc (Target_x86_64::got_size): Add const.
2252 (Target_x86_64::got_entry_count): New function.
2253 (Target_x86_64::plt_entry_count): New function.
2254 (Target_x86_64::first_plt_entry_offset): New function.
2255 (Target_x86_64::plt_entry_size): New function.
2256 (Output_data_plt_x86_64::entry_count): New function.
2257 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2258 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2259
09ec0418
CC
22602010-08-12 Cary Coutant <ccoutant@google.com>
2261
2262 * archive.cc: Include incremental.h.
2263 (Archive::Archive): Initialize incremental_info_.
2264 (Archive::include_member): Record archive members in incremental info.
2265 (Add_archive_symbols::run): Record begin and end of an archive in
2266 incremental info.
2267 (Lib_group::include_member): Record objects in incremental info.
2268 * archive.h (Incremental_archive_entry): Forward declaration.
2269 (Archive::set_incremental_info): New member function.
2270 (Archive::incremental_info): New member function.
2271 (Archive::Unused_symbol_iterator): New class.
2272 (Archive::unused_symbols_begin): New member function.
2273 (Archive::unused_symbols_end): New member function.
2274 (Archive::incremental_info_): New data member.
2275 * incremental-dump.cc (find_input_containing_global): New function.
2276 (dump_incremental_inputs): Dump new incremental info sections.
2277 * incremental.cc: Include symtab.h.
2278 (Output_section_incremental_inputs): New class.
2279 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2280 new incremental info sections.
2281 (Sized_incremental_binary::do_check_inputs): Likewise.
2282 (Incremental_inputs::report_archive): Remove.
2283 (Incremental_inputs::report_archive_begin): New function.
2284 (Incremental_inputs::report_archive_end): New function.
2285 (Incremental_inputs::report_object): New function.
2286 (Incremental_inputs::finalize_inputs): Remove.
2287 (Incremental_inputs::report_input_section): New function.
2288 (Incremental_inputs::report_script): Rewrite.
2289 (Incremental_inputs::finalize): Do nothing but finalize string table.
2290 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2291 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2292 (Incremental_inputs::create_data_sections): New function.
2293 (Incremental_inputs::relocs_entsize): New function.
2294 (Output_section_incremental_inputs::set_final_data_size): New function.
2295 (Output_section_incremental_inputs::do_write): New function.
2296 (Output_section_incremental_inputs::write_header): New function.
2297 (Output_section_incremental_inputs::write_input_files): New function.
2298 (Output_section_incremental_inputs::write_info_blocks): New function.
2299 (Output_section_incremental_inputs::write_symtab): New function.
2300 * incremental.h (Incremental_script_entry): Forward declaration.
2301 (Incremental_object_entry): Forward declaration.
2302 (Incremental_archive_entry): Forward declaration.
2303 (Incremental_inputs): Forward declaration.
2304 (Incremental_inputs_header_data): Remove.
2305 (Incremental_inputs_header): Remove.
2306 (Incremental_inputs_header_write): Remove.
2307 (Incremental_inputs_entry_data): Remove.
2308 (Incremental_inputs_entry): Remove.
2309 (Incremental_inputs_entry_write): Remove.
2310 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2311 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2312 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2313 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2314 Likewise.
2315 (Incremental_input_entry): New class.
2316 (Incremental_script_entry): New class.
2317 (Incremental_object_entry): New class.
2318 (Incremental_archive_entry): New class.
2319 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2320 (Incremental_inputs::report_inputs): Remove.
2321 (Incremental_inputs::report_archive): Remove.
2322 (Incremental_inputs::report_archive_begin): New function.
2323 (Incremental_inputs::report_archive_end): New function.
2324 (Incremental_inputs::report_object): Change prototype.
2325 (Incremental_inputs::report_input_section): New function.
2326 (Incremental_inputs::report_script): Change prototype.
2327 (Incremental_inputs::get_reloc_count): New function.
2328 (Incremental_inputs::set_reloc_count): New function.
2329 (Incremental_inputs::create_data_sections): New function.
2330 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2331 (Incremental_inputs::inputs_section): New function.
2332 (Incremental_inputs::symtab_section): New function.
2333 (Incremental_inputs::relocs_section): New function.
2334 (Incremental_inputs::get_stringpool): Add const.
2335 (Incremental_inputs::command_line): Add const.
2336 (Incremental_inputs::inputs): Remove.
2337 (Incremental_inputs::command_line_key): New function.
2338 (Incremental_inputs::input_file_count): New function.
2339 (Incremental_inputs::input_files): New function.
2340 (Incremental_inputs::relocs_entsize): New function.
2341 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2342 (Incremental_inputs::finalize_inputs): Remove.
2343 (Incremental_inputs::Input_info): Remove.
2344 (Incremental_inputs::lock_): Remove.
2345 (Incremental_inputs::inputs_): Change type.
2346 (Incremental_inputs::inputs_map_): Remove.
2347 (Incremental_inputs::current_object_entry_): New data member.
2348 (Incremental_inputs::inputs_section_): New data member.
2349 (Incremental_inputs::symtab_section_): New data member.
2350 (Incremental_inputs::relocs_section_): New data member.
2351 (Incremental_inputs::reloc_count_): New data member.
2352 (Incremental_inputs_reader): New class.
2353 (Incremental_symtab_reader): New class.
2354 (Incremental_relocs_reader): New class.
2355 * layout.cc (Layout::finalize): Move finalization of incremental info
2356 and creation of incremental info sections to follow finalization of
2357 symbol table. Set offsets for postprocessing sections.
2358 (Layout::create_incremental_info_sections): Call
2359 Incremental_inputs::create_data_sections. Add incremental symtab
2360 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2361 sections to layout after input sections.
2362 * layout.h (struct Timespec): Forward declaration.
2363 (Layout::incremental_inputs): Add const.
2364 (Layout::create_incremental_info_sections): Add parameter.
2365 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2366 * object.cc: Include incremental.h.
2367 (Relobj::finalize_incremental_relocs): New function.
2368 (Sized_relobj::do_layout): Record input sections in incremental info.
2369 * object.h (Object::output_section): New function.
2370 (Object::output_section_offset): Moved from Relobj.
2371 (Object::get_incremental_reloc_base): New function.
2372 (Object::get_incremental_reloc_count): New function.
2373 (Object::do_output_section): New function.
2374 (Object::do_output_section_offset): Moved from Relobj.
2375 (Object::do_get_incremental_reloc_base): New function.
2376 (Object::do_get_incremental_reloc_count): New function.
2377 (Object::Object): Initialize new data members.
2378 (Relobj::output_section): Renamed do_output_section and moved to
2379 protected.
2380 (Relobj::output_section_offset): Moved to Object.
2381 (Relobj::do_get_incremental_reloc_base): New function.
2382 (Relobj::do_get_incremental_reloc_count): New function.
2383 (Relobj::allocate_incremental_reloc_counts): New function.
2384 (Relobj::count_incremental_reloc): New function.
2385 (Relobj::finalize_incremental_relocs): New function.
2386 (Relobj::next_incremental_reloc_index): New function.
2387 (Relobj::reloc_counts_): New data member.
2388 (Relobj::reloc_bases_): New data member.
2389 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2390 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2391 (Sized_relobj::incremental_relocs_scan): New function.
2392 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2393 (Sized_relobj::incremental_relocs_write): New function.
2394 (Sized_relobj::incremental_relocs_write_reltype): New function.
2395 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2396 incremental link.
2397 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2398 archives and object files elsewhere.
2399 (Add_symbols::run): Report object files here.
2400 (Finish_group::run): Report end of archive at end of group.
2401 * reloc.cc: Include layout.h, incremental.h.
2402 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2403 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2404 (Sized_relobj::incremental_relocs_scan): New function.
2405 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2406 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2407 (Sized_relobj::incremental_relocs_write): New function.
2408 (Sized_relobj::incremental_relocs_write_reltype): New function.
2409 * script.cc (read_input_script): Rewrite test for incremental link.
2410 Change call to Incremental_inputs::report_script.
2411 * symtab.h (Symbol_table::first_global_index): New function.
2412 (Symbol_table::output_count): New function.
2413
ce0d1972
DK
24142010-08-12 Doug Kwan <dougkwan@google.com>
2415
2416 * arm.cc (Target_arm::merge_object_attributes): Check command line
2417 options --no-wchar-size-warning and --no-enum-size-warning.
2418 * options.h (General_options): Add ld-compatible options
2419 --no-enum-size-warning and --no-wchar-size-warning.
2420
6e5710ce
ILT
24212010-08-04 Ian Lance Taylor <iant@google.com>
2422
2423 * x86_64.cc (Target_x86_64::Scan::local): Use
2424 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2425 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2426 (Target_x86_64::Scan::global): Likewise.
2427 (Target_x86_64::Relocate::relocate): Likewise.
2428 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2429 Likewise.
2430
fef830db
CC
24312010-08-03 Cary Coutant <ccoutant@google.com>
2432
2433 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2434 to reserve space in merged_strings vector. Keep total input size
2435 for stats.
2436 (Output_merge_string::do_print_merge_stats): Print total input size.
2437 * merge.h (Output_merge_string): Add input_size_ field.
2438 * stringpool.cc (Stringpool_template::string_length): Move
2439 implementations out of Stringpool_template class and place in
2440 stringpool.h.
2441 * stringpool.h (string_length): Move out of Stringpool_template.
2442
1e3811b0
ILT
24432010-08-03 Ian Lance Taylor <iant@google.com>
2444
2445 PR 11712
2446 * layout.cc (relaxation_loop_body): If address of load segment is
2447 set, adjust address to include headers if possible.
2448
7af0c620
ILT
24492010-08-03 Ian Lance Taylor <iant@google.com>
2450
2451 * version.cc (version_string): Bump to 1.10.
2452
22f0da72
ILT
24532010-08-03 Ian Lance Taylor <iant@google.com>
2454
2455 PR 11805
2456 * layout.h (enum Output_section_order): Define.
2457 (class Layout): Update declarations.
2458 * layout.cc (Layout::get_output_section): Add order parameter.
2459 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2460 is_first_non_relro parameters. Change all callers.
2461 (Layout::choose_output_section): Likewise.
2462 (Layout::add_output_section_data): Likewise.
2463 (Layout::make_output_section): Likewise. Set order.
2464 (Layout::default_section_order): New function.
2465 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2466 * output.cc (Output_section::Output_section): Initialize order_.
2467 Don't initialize deleted fields.
2468 (Output_segment::Output_segment): Don't initialize deleted
2469 fields.
2470 (Output_segment::add_output_section_to_load): New function
2471 replacing add_output_section. Change all callers to call this or
2472 add_output_section_to_nonload.
2473 (Output_segment::add_output_section_to_nonload): New function.
2474 (Output_segment::remove_output_section): Rewrite.
2475 (Output_segment::add_initial_output_data): Likewise.
2476 (Output_segment::has_any_data_sections): Likewise.
2477 (Output_segment::is_first_section_relro): Likewise.
2478 (Output_segment::maximum_alignment): Likewise.
2479 (Output_segment::has_dynamic_reloc): New function replacing
2480 dynamic_reloc_count. Change all callers.
2481 (Output_segment::has_dynamic_reloc_list): New function replacing
2482 dynamic_reloc_count_list. Change all callers.
2483 (Output_segment::set_section_addresses): Rewrite.
2484 (Output_segment::set_offset): Rewrite.
2485 (Output_segment::find_first_and_last_list): Remove.
2486 (Output_segment::set_tls_offsets): Rewrite.
2487 (Output_segment::first_section_load_address): Likewise.
2488 (Output_segment::output_section_count): Likewise.
2489 (Output_segment::section_with_lowest_load_address): Likewise.
2490 (Output_segment::write_section_headers): Likewise.
2491 (Output_segment::print_sections_to_map): Likewise.
2492 * output.h (class Output_data): Remove dynamic_reloc_count_
2493 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2494 (Output_data::add_dynamic_reloc): Rewrite.
2495 (Output_data::has_dynamic_reloc): New function.
2496 (Output_data::dynamic_reloc_count): Remove.
2497 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2498 is_last_relro_, is_first_non_relro_, is_interp_,
2499 is_dynamic_linker_section_ fields. Add order and set_order
2500 functions. Remove is_relro_local, set_is_relro_local,
2501 is_last_relro, set_is_last_relro, is_first_non_relro,
2502 set_is_first_non_relro functions, is_interp, set_is_interp,
2503 is_dynamic_linker_section, and set_is_dynamic_linker_section
2504 functions.
2505 (class Output_segment): Change Output_data_list from std::list to
2506 std:;vector. Add output_lists_ field. Remove output_data_ and
2507 output_bss_ fields. Update declarations.
2508
3ff2ccb0
ILT
25092010-08-02 Ian Lance Taylor <iant@google.com>
2510
2511 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2512 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2513 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2514
88a4108b
ILT
25152010-08-02 Ian Lance Taylor <iant@google.com>
2516
2517 PR 11855
2518 * script.cc (Script_options::Script_options): Initialize
2519 symbol_definitions_ and symbol_references_.
2520 (Script_options::add_symbol_assignment): Update
2521 symbol_definitions_ and symbol_references_.
2522 (Script_options::add_symbol_reference): New function.
2523 (script_symbol): New function.
2524 * script.h (class Script_options): Add symbol_definitions_ and
2525 symbol_references_ fields.
2526 (Script_options::referenced_const_iterator): New type.
2527 (Script_options::referenced_begin): New function.
2528 (Script_options::referenced_end): New function.
2529 (Script_options::is_referenced): New function.
2530 (Script_options::any_unreferenced): New function.
2531 * script-c.h (script_symbol): Declare.
2532 * yyscript.y (exp): Call script_symbol.
2533 * symtab.cc: Include "script.h".
2534 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2535 Change all callers. Check symbols referenced by scripts.
2536 (Symbol_table::add_undefined_symbols_from_command_line): Add
2537 layout parameter. Change all callers.
2538 (Symbol_table::do_add_undefined_symbols_from_command_line):
2539 Likewise. Break out loop body. Check symbols referenced by
2540 scripts.
2541 (Symbol_table::add_undefined_symbol_from_command_line): New
2542 function broken out of
2543 do_add_undefined_symbols_from_command_line.
2544 * symtab.h (class Symbol_table): Update declarations.
2545 * archive.cc: Include "layout.h".
2546 (Archive::should_include_member): Add layout parameter. Change
2547 all callers. Check for symbol mentioned in expression.
2548 * archive.h (class Archive): Update declaration.
2549 * object.cc (Sized_relobj::do_should_include_member): Add layout
2550 parameter.
2551 * object.h (Object::should_include_member): Add layout parameter.
2552 Change all callers.
2553 (Object::do_should_include_member): Add layout parameter.
2554 (class Sized_relobj): Update declaration.
2555 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2556 parameter.
2557 * dynobj.h (class Sized_dynobj): Update declaration.
2558 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2559 layout parameter.
2560 * plugin.h (class Sized_pluginobj): Update declaration.
2561
5f1ab67a
ILT
25622010-08-02 Ian Lance Taylor <iant@google.com>
2563
2564 PR 11866
2565 * output.cc (Output_segment::set_offset): Search for the first and
2566 last sections rather than assuming that the list is in order.
2567 (Output_segment::find_first_and_last_list): New function.
2568 * output.h (class Output_segment): Update declarations.
2569 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2570 (relro_strip_test_SOURCES): New variable.
2571 (relro_strip_test_DEPENDENCIES): New variable.
2572 (relro_strip_test_LDFLAGS): New variable.
2573 (relro_strip_test_LDADD): New variable.
2574 (relro_strip_test.so): New target.
2575
a8df5856
ILT
25762010-08-02 Ian Lance Taylor <iant@google.com>
2577
2578 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2579 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2580 (Target_i386::got_tlsdesc_section): New function.
2581 (Target_i386::got_section): Create space for GOT entries for
2582 TLSDESC relocations.
2583 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2584 R_386_TLS_GOTDESC.
2585 (Target_i386::Scan::global): Likewise.
2586 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2587 using TLSDESC GOT.
2588 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2589 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2590 (Target_x86_64::got_tlsdesc_section): New function.
2591 (Target_x86_64::got_section): Create space for GOT entries for
2592 TLSDESC relocations.
2593 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2594 R_386_TLS_GOTDESC.
2595 (Target_x86_64::Scan::global): Likewise.
2596 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2597 using TLSDESC GOT.
2598
0c10a0a6
ILT
25992010-08-02 Ian Lance Taylor <iant@google.com>
2600
2601 * testsuite/final_layout.sh: Use dc to convert from hex to
2602 decimal.
2603
41cbeecc
ST
26042010-07-29 Sriraman Tallam <tmsriram@google.com>
2605
2606 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2607 paramter to the call to gold::gc_process_relocs.
2608 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2609 paramter to the call to gold::gc_process_relocs.
2610 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2611 parameter to the call to gold::gc_process_relocs.
2612 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2613 template parameter to the call to gold::gc_process_relocs.
2614 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2615 paramter to the call to gold::gc_process_relocs.
2616 * gc.h (get_embedded_addend_size): New function.
2617 (gc_process_relocs): Save the size of the reloc for use by ICF.
2618 * icf.cc (get_section_contents): Get the addend from the text section
2619 for SHT_REL relocation sections.
2620 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2621 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2622 * int_encoding.h (read_from_pointer): New overloaded function.
2623 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2624 * testsuite/icf_sht_rel_addend_test.sh: New file.
2625 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2626 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2627
6ea55b82
RW
26282010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2629
2630 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2631 * Makefile.in: Regenerate.
2632 * testsuite/Makefile.in: Regenerate.
2633
9691462b
ILT
26342010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2635
2636 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2637 * gold/testsuite/debug_msg.cc: Likewise.
2638 * gold/testsuite/odr_violation1.cc
2639 * gold/testsuite/odr_violation2.cc
2640
76897331
CC
26412010-07-21 Cary Coutant <ccoutant@google.com>
2642
2643 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2644 string, and length fields.
2645 (Output_merge_string::Merged_strings_list): New type.
2646 (Output_merge_string::Merged_strings_lists): New typedef.
2647 (Output_merge_string): Replace merged_strings_ with
2648 merged_strings_lists_.
2649 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2650 Merged_strings_list per input object and section. Don't store pointer
2651 to the string. Don't store length with each merged string entry.
2652 (Output_merge_string::finalize_merged_data): Loop over list of merged
2653 strings lists. Recompute length of each merged string.
2654
78384e8f
CC
26552010-07-15 Cary Coutant <ccoutant@google.com>
2656
2657 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2658 here.
2659
783659f9
ILT
26602010-07-14 Ian Lance Taylor <iant@google.com>
2661
2662 * descriptors.cc (Descriptors::open): Report correct name in error
2663 message.
2664
131687b4
DK
26652010-07-13 Doug Kwan <dougkwan@google.com>
2666
2667 * arm.cc (Arm_input_section::Arm_input_section): For a
2668 SHT_ARM_EXIDX section, always keeps the input sections.
2669 (Arm_input_section::set_exidx_section_link): New method.
2670 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2671 has_errors_ to false.
2672 (Arm_exidx_input_section::has_errors,
2673 Arm_exidx_input_section::set_has_errors): New methods.
2674 (Arm_exidx_input_section::has_errors_): New data member.
2675 (Arm_relobj::get_exidx_shndx_list): New method.
2676 (Arm_output_section::append_text_sections_to_list): Do not skip
2677 section without SHF_EXECINSTR.
2678 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2679 errors.
2680 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2681 section header. Make error messages more verbose. Check for
2682 a non-executable section linked to an EXIDX section.
2683 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2684 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2685 check that there is no deferred EXIDX section if we exit early.
2686 Instead of not making an EXIDX section in case of an error, make one
2687 and set the has_errors flag of it.
2688 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2689 in a relocatable link.
2690 (Target_arm::do_relax): Look for the EXIDX output section instead of
2691 assuming that it is called .ARM.exidx.
2692 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2693 section list. Do not check for SHF_EXECINSTR section flags but
2694 skip any input section with errors.
2695 * output.cc (Output_section::Output_section): Initialize
2696 always_keeps_input_sections_ to false.
2697 (Output_section::add_input_section): Check for
2698 always_keeps_input_sections_.
2699 * output.h (Output_section::always_keeps_input_sections,
2700 Output_section::set_always_keeps_input_sections): New methods.
2701 (Output_section::always_keeps_input_sections): New data member.
2702
69517287
RÁE
27032010-07-13 Rafael Espindola <espindola@google.com>
2704
2705 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2706 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2707
82742395
ILT
27082010-07-13 Philip Herron <herron.philip@googlemail.com>
2709 Ian Lance Taylor <iant@google.com>
2710
2711 * output.h (Output_section_lookup_maps::add_merge_section):
2712 Correct check of whether value was inserted.
2713 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2714 (Output_section_lookup_maps::add_relaxed_input_section):
2715 Likewise.
2716 * arm.cc (Target_arm::got_section): Remove used local os.
2717 * i386.cc (Target_i386::got_section): Likewise.
2718 * x86_64.cc (Target_x86_64::got_section): Likewise.
2719 * sparc.cc (Target_sparc::got_section): Likewise.
2720 (Target_sparc::relocate): Remove unused local have_got_offset.
2721 * powerpc.cc (Target_powerpc::relocate): Likewise.
2722
f2d707b5
ILT
27232010-07-13 Ian Lance Taylor <iant@google.com>
2724
241531d6
ILT
2725 * compressed_output.cc (zlib_decompress): Fix signature in
2726 !HAVE_ZLIB_H case.
2727
f2d707b5
ILT
2728 * archive.cc (Archive::include_member): Unlock an external member
2729 of a thin archive. Don't bother to delete an object we know is
2730 NULL.
2731
a2e47362
CC
27322010-07-12 Cary Coutant <ccoutant@google.com>
2733
2734 * compressed_output.cc (zlib_decompress): New function.
2735 (get_uncompressed_size): New function.
2736 (decompress_input_section): New function.
2737 * compressed_output.h (get_uncompressed_size): New function.
2738 (decompress_input_section): New function.
2739 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2740 Handle compressed debug sections.
2741 * layout.cc (is_compressed_debug_section): New function.
2742 (Layout::output_section_name): Map compressed section names to
2743 canonical names.
2744 * layout.h (is_compressed_debug_section): New function.
2745 (is_debug_info_section): Recognize compressed debug sections.
2746 * merge.cc: Include compressed_output.h.
2747 (Output_merge_data::do_add_input_section): Handle compressed
2748 debug sections.
2749 (Output_merge_string::do_add_input_section): Handle compressed
2750 debug sections.
2751 * object.cc: Include compressed_output.h.
2752 (Sized_relobj::Sized_relobj): Initialize new data members.
2753 (build_compressed_section_map): New function.
2754 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2755 * object.h (Object::section_is_compressed): New method.
2756 (Object::do_section_is_compressed): New method.
2757 (Sized_relobj::Compressed_section_map): New type.
2758 (Sized_relobj::do_section_is_compressed): New method.
2759 (Sized_relobj::compressed_sections_): New data member.
2760 * output.cc (Output_section::add_input_section): Handle compressed
2761 debug sections.
2762 * reloc.cc: Include compressed_output.h.
2763 (Sized_relobj::write_sections): Handle compressed debug sections.
2764
ce279a62
CC
27652010-07-08 Cary Coutant <ccoutant@google.com>
2766
2767 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2768 weak when resolving to a dynamic def.
2769 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2770 for weak undef/dynamic def cases. Adjust callers.
2771 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2772 undef_binding_weak_.
2773 (Symbol_table::sized_write_globals): Adjust symbol binding.
2774 (Symbol_table::sized_write_symbol): Add binding parameter.
2775 * symtab.h (Symbol::set_undef_binding): New method.
2776 (Symbol::is_undef_binding_weak): New method.
2777 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2778 (Symbol_table::should_override): Add new parameter.
2779 (Symbol_table::sized_write_symbol): Add new parameter.
2780
2781 * testsuite/weak_undef_file1.cc: Add new test case.
2782 * testsuite/weak_undef_file2.cc: Fix header comment.
2783 * testsuite/weak_undef_test.cc: Add new test case.
2784
b2286c10
DK
27852010-06-29 Doug Kwan <dougkwan@google.com>
2786
2787 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2788 Initialize USE_SYMBOL_.
2789 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2790 definition.
2791 (Arm_reloc_property::uses_symbol_): New data member declaration.
2792 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2793 uses symbol value and symbol is undefined but not weakly undefined.
2794
4802450a
RÁE
27952010-06-28 Rafael Espindola <espindola@google.com>
2796
2797 * plugin.cc (Plugin::load): Use dlerror.
2798
e5ca47ba
ILT
27992010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2800
2801 * symtab.cc (detect_odr_violations): When reporting an ODR
2802 violation, report an object where the symbol is defined.
2803
8a75a161
DK
28042010-06-25 Doug Kwan <dougkwan@google.com>
2805
2806 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2807 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2808 definition.
2809 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2810 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2811 target hook to detect function points.
2812 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2813 * icf.h (Icf::check_section_for_function_pointers): Change type of
2814 parameter SECTION_NAME to const reference to std::string. Use
2815 target hook to determine if section may have unsafe pointers.
2816 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2817 method definition.
2818
42218b9f
RÁE
28192010-06-21 Rafael Espindola <espindola@google.com>
2820
2821 * fileread.cc (Input_file::find_fie): New
2822 (Input_file::open): Use Input_file::find_fie.
2823 * fileread.h (Input_file::find_fie): New
2824 * plugin.cc (set_extra_library_path): New.
2825 (Plugin::load): Add set_extra_library_path to the transfer vector.
2826 (Plugin_manager::set_extra_library_path): New.
2827 (Plugin_manager::add_input_file): Use the extra search path if set.
2828 (set_extra_library_path(): New.
2829 * plugin.h (Plugin_manager): Add set_extra_library_path and
2830 extra_search_path_.
2831
a0506cca
CC
28322010-06-19 Cary Coutant <ccoutant@google.com>
2833
2834 * layout.cc (gdb_sections): Add .debug_types.
2835 (lines_only_debug_sections): Likewise.
2836
6508b958
RÁE
28372010-06-18 Rafael Espindola <espindola@google.com>
2838
2839 * plugin.cc (add_input_file,add_input_library)
2840 (Plugin_manager::add_input_file): Make filename arguments const.
2841 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2842 const.
2843
3e235302
DK
28442010-06-16 Doug Kwan <dougkwan@google.com>
2845
2846 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2847 .ARM.attributes section if we have not merged any input
2848 attributes sections.
2849
106e8a6c
DK
28502010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2851
2852 * arm.cc: Allow combining objects with no EABI version
2853 information.
2854
91ff43fe
RÁE
28552010-06-15 Rafael Espindola <espindola@google.com>
2856
2857 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2858
68ed838c
ILT
28592010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2860
2861 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2862 (struct iovec): Correct !HAVE_READV definition.
2863
f3a2388f
CC
28642010-06-10 Cary Coutant <ccoutant@google.com>
2865
2866 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2867 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2868 reloc sections.
2869 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2870
2871 PR 11683
2872 * symtab.h (Symbol::is_placeholder): New member function.
2873 * target-reloc.h (relocate_section): Check for placeholder symbols.
2874
2875 * testsuite/Makefile.am (plugin_test_8): New test.
2876 (plugin_test_9): New test.
2877 * testsuite/Makefile.in: Regenerate.
2878
e1df38aa
NC
28792010-06-09 Nick Clifton <nickc@redhat.com>
2880
2881 * yyscript.y (input_list_element): Allow strings prefixed with
2882 the '-' character. Treat these as libraries.
2883 * script.cc (script_add_library): New function. Adds a library
2884 specified by "-l<name>" found in an input script.
2885 * script-c.h: Add prototype for script_add_library.
2886
25bbe950
DK
28872010-06-07 Doug Kwan <dougkwan@google.com>
2888
2889 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2890 Restrict stub-group size to be within long conditional branch
2891 range when working around cortex-A8 erratum.
2892
0f32ea4c
ILT
28932010-06-07 Damien Diederen <dd@crosstwine.com>
2894
2895 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2896 #ifdef typo.
2897
8fe2a369
ST
28982010-06-03 Sriraman Tallam <tmsriram@google.com>
2899
2900 PR gold/11658
2901 * output.cc
2902 (Output_section::Input_section_sort_entry::compare_section_ordering):
2903 Change to return non-zero correctly.
2904 (Output_section::Input_section_sort_section_order_index_compare
2905 ::operator()): Change to fix ambiguity in comparisons.
2906
6e9ba2ca
ST
29072010-06-01 Sriraman Tallam <tmsriram@google.com>
2908
2909 * gold.h (is_wildcard_string): New function.
2910 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2911 (Layout::layout_eh_frame): Ditto.
2912 (Layout::find_section_order_index): New method.
2913 (Layout::read_layout_from_file): New method.
2914 * layout.h (Layout::find_section_order_index): New method.
2915 (Layout::read_layout_from_file): New method.
2916 (Layout::input_section_position_): New private member.
2917 (Layout::input_section_glob_): New private member.
2918 * main.cc (main): Call read_layout_from_file here.
2919 * options.h (--section-ordering-file): New option.
2920 * output.cc (Output_section::input_section_order_specified_): New
2921 member.
2922 (Output_section::Output_section): Initialize new member.
2923 (Output_section::add_input_section): Add new parameter.
2924 Keep input sections when --section-ordering-file is used.
2925 (Output_section::set_final_data_size): Sort input sections when
2926 section ordering file is specified.
2927 (Output_section::Input_section_sort_entry): Add new parameter.
2928 Check sorting type.
2929 (Output_section::Input_section_sort_entry::compare_section_ordering):
2930 New method.
2931 (Output_section::Input_section_sort_compare::operator()): Change to
2932 consider section_order_index.
2933 (Output_section::Input_section_sort_init_fini_compare::operator()):
2934 Change to consider section_order_index.
2935 (Output_section::Input_section_sort_section_order_index_compare
2936 ::operator()): New method.
2937 (Output_section::sort_attached_input_sections): Change to sort
2938 according to section order when specified.
e1df38aa
NC
2939 (Output_section::add_input_section<32, true>): Add new parameter.
2940 (Output_section::add_input_section<64, true>): Add new parameter.
2941 (Output_section::add_input_section<32, false>): Add new parameter.
2942 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
2943 * output.h (Output_section::add_input_section): Add new parameter.
2944 (Output_section::input_section_order_specified): New
2945 method.
2946 (Output_section::set_input_section_order_specified): New method.
2947 (Input_section::Input_section): Initialize section_order_index_.
2948 (Input_section::section_order_index): New method.
2949 (Input_section::set_section_order_index): New method.
2950 (Input_section::section_order_index_): New member.
2951 (Input_section::Input_section_sort_section_order_index_compare): New
2952 struct.
2953 (Output_section::input_section_order_specified_): New member.
2954 * script-sections.cc (is_wildcard_string): Delete and move modified
2955 method to gold.h.
2956 (Output_section_element_input::Output_section_element_input): Modify
2957 call to is_wildcard_string.
2958 (Output_section_element_input::Input_section_pattern
2959 ::Input_section_pattern): Ditto.
2960 (Output_section_element_input::Output_section_element_input): Ditto.
2961 * testsuite/Makefile.am (final_layout): New test case.
2962 * testsuite/Makefile.in: Regenerate.
2963 * testsuite/final_layout.cc: New file.
2964 * testsuite/final_layout.sh: New file.
2965
3537c84b
RÁE
29662010-06-01 Rafael Espindola <espindola@google.com>
2967
2968 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2969
105b6afd
RÁE
29702010-06-01 Rafael Espindola <espindola@google.com>
2971
2972 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2973 visibility of symbols.
2974
29e11421
DK
29752010-05-27 Doug Kwan <dougkwan@google.com>
2976
2977 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2978 from start of output section instead of address for a local symbol
2979 in a merged or relaxed section when doing a relocatable link.
2980
5e0f337e
RÁE
29812010-05-26 Rafael Espindola <espindola@google.com>
2982
2983 PR 11604
2984 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2985 adding sections the garbage collector removed.
2986 * gold/testsuite/Makefile.am: Add test.
2987 * gold/testsuite/Makefile.in: Regenerate.
2988 * gold/testsuite/plugin_test_7.sh: New.
2989 * gold/testsuite/plugin_test_7_1.c: New.
2990 * gold/testsuite/plugin_test_7_2.c: New.
2991
f4187277
RÁE
29922010-05-26 Rafael Espindola <espindola@google.com>
2993
2994 * script-sections.cc (Output_section_definition::set_section_addresses):
2995 Check for --section-start.
2996
5c388529
DK
29972010-05-26 Doug Kwan <dougkwan@google.com>
2998
2999 * arm.cc (Arm_scan_relocatable_relocs): New class.
3000 (Target_arm::relocate_special_relocatable): New method.
3001 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3002 (Arm_relocate_functions::thumb_branch_common): Same.
3003 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3004 instead of Default_scan_relocatable_relocs.
3005 * target-reloc.h (relocate_for_relocatable): Let target handle
3006 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3007 * target.h (Sized_target::relocate_special_relocatable): New method.
3008
bca1c3ae
ILT
30092010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3010
3011 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3012
0439c796
DK
30132010-05-23 Doug Kwan <dougkwan@google.com>
3014
3015 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3016 instead of a cast.
3017 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3018 with a direct branch, not a conditional branch, to a stub.
3019 * merge.cc (Output_merge_base::record_input_section): New method
3020 defintion.
3021 (Output_merge_data::do_add_input_section): Record input section if
3022 keeps-input-sections flag is set.
3023 (Output_merge_string::do_add_input_section): Ditto.
3024 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3025 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3026 INPUT_SECTIONS_.
3027 (Output_merge_base::keeps_input_sections,
3028 Output_merge_base::set_keeps_input_sections,
3029 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3030 method definitions.
3031 (Output_merge_base::Input_sections): New type declaration.
3032 (Output_merge_base::input_sections_begin,
3033 Output_merge_base::input_sections_end,
3034 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3035 (Output_merge_base::bool keeps_input_sections_,
3036 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3037 Output_merge_base::input_sections_): New data members.
3038 (Output_merge_data::do_set_keeps_input_sections): New method
3039 defintion.
3040 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3041 * output.cc (Output_section::Input_section::relobj): Move method
3042 defintion from class declaration to here and handle merge sections.
3043 (Output_section::Input_section::shndx): Ditto.
3044 (Output_section::Output_section): Remove initializations of removed
3045 data members and initialize new data member LOOKUP_MAPS_.
3046 (Output_section::add_input_section): Set keeps-input-sections flag
3047 for a newly created merge output section as appropriate. Adjust code
3048 to use Output_section_lookup_maps class.
3049 (Output_section::add_relaxed_input_section): Adjst code for lookup
3050 maps code refactoring.
3051 (Output_section::add_merge_input_section): Add a new parameter
3052 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3053 class. If adding input section to a newly created merge output
3054 section fails, remove the new merge section.
3055 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 3056 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
3057 (Output_section::find_merge_section): Ditto.
3058 (Output_section::build_lookup_maps): New method defintion.
3059 (Output_section::find_relaxed_input_section): Adjust code to use
3060 Output_section_lookup_maps class.
3061 (Output_section::get_input_sections): Export merge sections. Adjust
3062 code to use Output_section_lookup_maps class.
3063 (Output_section:::add_script_input_section): Adjust code to use
3064 Output_section_lookup_maps class. Update lookup maps for merge
3065 sections also.
3066 (Output_section::discard_states): Use Output_section_lookup_maps.
3067 (Output_section::restore_states): Same.
3068 * output.h (Merge_section_properties): Move class defintion out of
3069 Output_section.
3070 (Output_section_lookup_maps): New class.
3071 (Output_section::Input_section::is_merge_section): New method
3072 defintion.
3073 (Output_section::Input_section::relobj): Move defintion out of class
3074 defintion. Declare method only.
3075 (Output_section::Input_section::shndx): Ditto.
3076 (Output_section::Input_section::output_merge_base): New method defintion.
3077 (Output_section::Input_section::u2_.pomb): New union field.
3078 (Output_section::Merge_section_by_properties_map,
3079 Output_section::Output_section_data_by_input_section_map,
3080 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3081 Remove types.
3082 (Output_section::add_merge_input_section): Add new parameter
3083 KEEPS_INPUT_SECTIONS.
3084 (Output_section::build_lookup_maps): New method declaration.
3085 (Output_section::merge_section_map_,
3086 Output_section::merge_section_by_properties_map_,
3087 Output_section::relaxed_input_section_map_,
3088 Output_section::is_relaxed_input_section_map_valid_): Remove data
3089 members.
3090 (Output_section::lookup_maps_): New data member.
3091
76295588
L
30922010-05-21 Doug Kwan <dougkwan@google.com>
3093
3094 PR gold/11619
3095 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3096 avoid a compilation error.
3097
d103a984
RÁE
30982010-05-19 Rafael Espindola <espindola@google.com>
3099
3100 * script-sections.cc (Output_section_definition::allocate_to_segment):
3101 Update the phdrs_list even when the output section is NULL.
3102 * testsuite/Makefile.am: Add test.
3103 * testsuite/Makefile.in: Regenerate.
3104 * testsuite/script_test_9.cc: New.
3105 * testsuite/script_test_9.sh: New.
3106 * testsuite/script_test_9.t: New.
3107
6625d24e
DK
31082010-05-19 Doug Kwan <dougkwan@google.com>
3109
3110 * arm.cc (Arm_input_section::original_size): New method.
3111 (Arm_input_section::do_addralign): Add a cast.
3112 (Arm_input_section::do_output_offset): Remove static cast.
3113 (Arm_input_section::original_addralign,
3114 Arm_input_section::original_size_): Change type to uint32_t.
3115 (Arm_input_section::init): Add safe casts for section alignment
3116 and size.
3117 (Arm_input_section::set_final_data_size): Do not set address and
3118 offset of stub table.
3119 (Arm_output_section::fix_exidx_coverage): Change use of of
3120 Output_section::Simple_input_section to that of
3121 Output_section::Input_section.
3122 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3123 except for the first pass.
3124 * output.cc (Output_section::get_input_sections): Change type of
3125 input_sections to std::list<Input_section>.
3126 (Output_section::add_script_input_section): Rename from
3127 Output_section::add_simple_input_section. Change type of SIS
3128 parameter from Simple_input_section to Input_section.
3129 * output.h (Output_section::Simple_input_section): Remove class.
3130 (Output_section::Input_section): Change class visibility to public.
3131 (Output_section::Input_section::addralign): Use stored alignments
3132 for special input sections if set.
3133 (Output_section::Input_section::set_addralign): New method.
3134 (Output_section::get_input_sections): Change parameter type from
3135 list of Simple_input_section to list of Input_section.
3136 (Output_section::add_script_input_section): Rename from
3137 Output_section::add_simple_input_section. Change first parameter's
3138 type from Simple_input_section to Input_section and remove the
3139 second and third parameters.
3140 * script-sections.cc (Input_section::Input_section_list): Change
3141 type to list of Output_section::Input_section/
3142 (Input_section_info::Input_section_info): Change parameter type of
3143 INPUT_SECTION to Output_section::Input_section.
3144 (Input_section_info::input_section): Change return type.
3145 (Input_section_info::input_section_): Change type to
3146 Output_section::Input_section.
3147 (Output_section_element_input::set_section_addresses): Adjust code
3148 to use Output_section::Input_section instead of
3149 Output_section::Simple_input_section. Adjust code for renaming
3150 of Output_section::add_simple_input_section.
3151 (Orphan_output_section::set_section_addresses): Ditto.
3152
e1e82ea4
RW
31532010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3154
3155 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3156 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3157
91e75c8a
RÁE
31582010-05-18 Rafael Espindola <espindola@google.com>
3159
3160 * options.cc (General_options::finalize): Handle -nostdlib.
3161 * options.h (nostdlib): New option.
3162 * script.cc (script_add_search_dir): Handle -nostdlib.
3163
da59ad79
DK
31642010-05-12 Doug Kwan <dougkwan@google.com>
3165
3166 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3167 attributes section only if there no attributes section after merging.
3168 (Target_arm::merge_object_attributes): Move value of
e1df38aa 3169 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
3170 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3171 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3172 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3173 and arm_attr_merge_7.stdout.
3174 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3175 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3176 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3177 arm_attr_merge_7b.o): New rules.
3178 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3179 arm_attr_merge_7
3180 * testsuite/Makefile.in: Regenerate.
3181 * testsuite/arm_attr_merge.sh: New file.
3182 * testsuite/arm_attr_merge_[67][ab].s: Same.
3183
3e01a7fd
NC
31842010-05-05 Nick Clifton <nickc@redhat.com>
3185
3186 * po/es.po: Updated Spanish translation.
3187
7ad2014a
L
31882010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3189
3190 * Makefile.am (install-exec-local): Properly install gold as
3191 default cross linker.
3192 * Makefile.in: Regenerated.
3193
4fda8867
NC
31942010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3195 Nick Clifton <nickc@redhat.com>
3196
3197 * configure.ac (install_as_default): Define and set to false
3198 unless --enable-gold or --enable-gold=both/gold has been
3199 specified.
3200 * configure: Regenerate.
3201
3202 * Makefile.am (install-exec-local): Install the executable as
3203 'ld.gold'. If install_as_default is true then also install it as
3204 'ld'.
3205 * Makefile.in: Regenerated.
3206
bd288ea2
ILT
32072010-04-24 Ian Lance Taylor <iant@google.com>
3208
3209 * layout.cc (Layout::layout_reloc): In relocatable link don't
3210 combine reloc sections for grouped sections.
3211
ef38fd8a
ST
32122010-04-23 Sriraman Tallam <tmsriram@google.com>
3213
3214 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3215 sections that are not ordinary to icf.
3216 * icf.cc (get_section_contents): Handle relocation pointing to section
3217 with no object or shndx information.
3218 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3219 * testsuite/Makefile.in: Regenerate.
3220 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3221 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3222
f6973bdc
ILT
32232010-04-22 Ian Lance Taylor <iant@google.com>
3224
3225 * expression.cc (Expression::Expression_eval_info): Add
3226 result_alignment_pointer field.
3227 (Expression::eval_with_dot): Add result_alignment_pointer
3228 parameter. Change all callers.
3229 (Expression::eval_maybe_dot): Likewise.
3230 (class Binary_expression): Add alignment_pointer parameter to
3231 left_value and right_value. Change all callers.
3232 (BINARY_EXPRESSION): Set result alignment.
3233 (class Trinary_expression): Add alignment_pointer parameter to
3234 arg2_value and arg3_value. Change all callers.
3235 (Trinary_cond::value): Set result alignment.
3236 (Max_expression::value, Min_expression::value): Likewise.
3237 (Align_expression::value): Likewise.
3238 * script-sections.cc (class Sections_element): Add dot_alignment
3239 parameter to set_section_addresses virtual function. Update
3240 instantiations.
3241 (class Output_section_element): Likewise.
3242 (Script_sections::create_segments): Add dot_alignment parameter.
3243 Change all callers.
3244 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3245 (Script_sections::set_phdrs_clause_addresses): Likewise.
3246 * script-sections.h: Update declarations.
3247 * script.h: Update declarations.
3248 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3249 min_p_align.
3250 * testsuite/script_test_3.t: Set large alignment.
3251 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3252 segment has expected alignment.
3253
9c9c98a5
NC
32542010-04-22 Nick Clifton <nickc@redhat.com>
3255
3256 * po/gold.pot: Updated by the Translation project.
3257 * po/vi.po: Updated Vietnamese translation.
3258
2253bfba
L
32592010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3260
3261 * testsuite/Makefile.am (check_PROGRAMS): Add
3262 icf_virtual_function_folding_test.
3263 * testsuite/Makefile.in: Regenerated.
3264
85fdf906
AH
32652010-04-15 Andrew Haley <aph@redhat.com>
3266
3267 * options.h (merge_exidx_entries): New option.
3268 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3269 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3270 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3271 (Target_arm::merge_exidx_entries): New function.
3272 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3273 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3274 to Arm_exidx_fixup constructor.
3275 Add new arg, merge_exidx_entries.
3276 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3277 Arm_output_section::fix_exidx_coverage.
3278
ce97fa81
ST
32792010-04-18 Sriraman Tallam <tmsriram@google.com>
3280
3281 * icf.cc (get_section_contents): Check for preemptible functions.
3282 Ignore addend when appropriate.
3283 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3284 section folded.
3285 (add_from_relobj): Check for section folded.
3286 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3287 * symtab.h (should_add_dynsym_entry): Add new parameter.
3288 * target-reloc.h (scan_relocs): Check for section folded.
3289 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3290 Check reloc types for function pointers in shared objects.
3291 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3292 case.
3293 (icf_preemptible_functions_test): New test case.
3294 (icf_string_merge_test): New test case.
3295 * testsuite.Makefile.in: Regenerate.
3296 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3297 bar_glob. Refactor code.
3298 * testsuite/icf_preemptible_functions_test.cc: New file.
3299 * testsuite/icf_preemptible_functions_test.sh: New file.
3300 * testsuite/icf_string_merge_test.cc: New file.
3301 * testsuite/icf_string_merge_test.sh: New file.
3302 * testsuite/icf_virtual_function_folding_test.cc: New file.
3303 * testsuite/icf_virtual_function_folding_test.sh: New file.
3304
04ceb17c
DK
33052010-04-14 Doug Kwan <dougkwan@google.com>
3306
3307 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3308 for local symbol recounting if we remove a section due to ICF.
3309 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3310 there are no regular objects in input.
3311
153e7da4
DK
33122010-04-13 Doug Kwan <dougkwan@google.com>
3313
3314 * arm.cc (Arm_input_section::set_final_data_size): Compute
3315 accurate final data size instead of using current data size.
3316
4dbd9faf
DK
33172010-04-09 Doug Kwan <dougkwan@google.com>
3318
3319 * layout.cc (Layout::choose_output_section): Handle script section
3320 types.
3321 (Layout::make_output_section_for_script): Add section type parameter.
3322 Handle script section types.
3323 * layout.h (Layout::make_output_section_for_script): Add section
3324 type parameter.
3325 * output.cc (Output_section::Output_section): Initialize data member
3326 is_noload_.
3327 (Output_section::do_reset_address_and_file_offset): Do not set address
3328 to 0 if section is a NOLOAD section.
3329 * output.h (Output_section::is_noload): New method.
3330 (Output_section::set_is_noload): Ditto.
3331 (Output_section::is_noload_): New data member.
3332 * script-c.h (Script_section_type): New enum type.
3333 (struct Parser_output_section_header): Add new file section_type.
3334 * script-sections.cc (Sections_element::output_section_name): Add
3335 parameter for returning script section type.
3336 (Output_section_definition::output_section_name): Ditto.
3337 (Output_section_definition::section_type)P; New method.
3338 (Output_section_definiton::script_section_type_name): Ditto.
3339 (Output_section_definition::script_section_type_): New data member.
3340 (Output_section_definition::Output_section_definition): Initialize
3341 data member Output_section_definition::script_section_type_.
3342 (Output_section_definition::create_sections): Pass script section type
3343 to Layout::make_output_section_for_script.
3344 (Output_section_definition::output_section_name): Return script
3345 section type to caller.
3346 (Output_section_definition::set_section_address): Do not advance
3347 dot value and load address if section type is NOLOAD. Set address
3348 of NOLOAD sections regardless of section flags.
3349 (Output_section_definition::print): Print section type if it is
3350 not SCRIPT_SECTION_TYPE_NONE.
3351 (Output_section_definition::section_type): New method.
3352 (Output_section_definition::script_section_type_name): Ditto.
3353 (Script_sections::output_section_name): Add new parameter
3354 PSECTION_TYPE for returning script section type. Pass it to
3355 section elements. Handle discard sections.
3356 (Sort_output_sections::operator()): Handle NOLOAD sections.
3357 * script-sections.h (Script_sections::Section_type): New enum type.
3358 (Script_sections::output_section_name): Add a new parameter for
3359 returning script section type.
3360 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3361 INFO and NOLOAD.
3362 * yyscript.y (union): Add new field SECTION_TYPE.
3363 (COPY, DSECT, INFO, NOLOAD): New tokens.
3364 (opt_address_and_section_type): Change type to output_section_header.
3365 (section_type): New non-terminal
3366 (section_header): Handle section type.
2253bfba 3367 (opt_address_and_section_type): Return section type value.
4dbd9faf 3368
721ea635
L
33692010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3370
3371 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3372 * testsuite/plugin_common_test_2.c (foo): Likewise.
3373
6bf924b0
DK
33742010-04-08 Doug Kwan <dougkwan@google.com>
3375
3376 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3377 Output_merge_data.
3378 * output.cc (Output_section::add_merge_input_section): Simplify
3379 code and return status of Output_merge_base::add_input_section.
e1df38aa 3380 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
3381 returns true.
3382
24af6f92
DK
33832010-04-07 Doug Kwan <dougkwan@google.com>
3384
3385 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3386 if section is marked as containing instructions but has no mapping
3387 symbols.
3388 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3389 correct section index.
3390 (Arm_relobj::find_linked_text_section): Ditto.
3391
00698fc5
CC
33922010-04-07 Cary Coutant <ccoutant@google.com>
3393
3394 * archive.cc (include_member): Destroy Read_symbols_data object before
3395 releasing file.
3396 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3397 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3398 (Read_symbols_data::~Read_symbols_data) New destructor.
3399 (Section_relocs::Section_relocs) New constructor.
3400 (Section_relocs::~Section_relocs) New destructor.
3401 (Read_relocs_data::Read_relocs_data) New constructor.
3402 (Read_relocs_data::~Read_relocs_data) New destructor.
3403 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3404 pointers to NULL after deleting.
3405
7296d933
DK
34062010-04-07 Doug Kwan <dougkwan@google.com>
3407
3408 * arm.cc: Replace "endianity" with "endianness" in comments.
3409 (Arm_exidx_cantunwind): Ditto.
3410 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3411 (Arm_relobj::merge_flags_and_attributes): New method.
3412 (Arm_relobj::merge_flags_and_attributes_): New data member.
3413 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3414 (Arm_relobj::scan_sections_for_stubs): Ditto.
3415 (Arm_relobj::do_read_symbols): Check to see if we really want to
3416 merge processor-specific flags and attributes. Exit early if
3417 an object is empty except for section names and the undefined symbol.
3418 (Target_arm::do_finalize_sections): Move check for ELF format to
3419 Arm_relobj::do_read_symbols. Merge processor specific flags and
3420 attributes from a regular object only when we have determined that
3421 it is aapropriate. Do not create an .ARM.attributes section in
3422 output if there is no regular input object.
3423 (Target_arm::merge_processor_specific_flags): Check
3424 --warn-mismatch before printing any error.
3425 (Target_arm::merge_object_attributes): Ditto.
3426 * gold.cc (queue_middle_tasks): Handle the case in which there is
3427 no regular object in input.
3428 * options.cc (General_options::parse_EB): New method.
3429 (General_options::parse_EL): Same.
3430 (General_options::General_options): Initialize endianness_.
3431 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3432 New options.
3433 (General_options::Endianness): New enum.
3434 (General_options::endianness): New method.
3435 (General_options::endianness_): New data member.
3436 * parameters.cc (Parameters::set_options): Check target endianness.
3437 (Parameters::set_target_once): Ditto.
3438 (Parameters::check_target_endianness): New method.
3439 (parameters_force_valid_target): If either -EL or -EB is specified,
3440 use it to define endianness of default target.
3441 * parameters.h (Parameters::check_target_endianness): New method
3442 declaration.
3443 * target.h (class Target): Change "endianity" to "endianness"
3444 in comments.
3445
efc8d4f2
RW
34462010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3447
3448 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3449 * configure: Regenerate.
3450 * Makefile.in: Regenerate.
3451 * testsuite/Makefile.in: Regenerate.
3452
be234d88
CC
34532010-04-06 Cary Coutant <ccoutant@google.com>
3454
3455 gcc PR lto/42757
3456 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3457 prevailing definitions of common symbols.
3458 * testsuite/plugin_test_6.sh: New test case.
3459 * testsuite/plugin_common_test_1.c: New test case.
3460 * testsuite/plugin_common_test_2.c: New test case.
3461 * testsuite/Makefile.am (plugin_test_6): New test case.
3462 * testsuite/Makefile.in: Regenerate.
3463
bd32c6bd
NC
34642010-04-06 Nick Clifton <nickc@redhat.com>
3465
3466 * po/vi.po: New Vietnamese translation.
3467
323c532f
DK
34682010-03-30 Doug Kwan <dougkwan@google.com>
3469
3470 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3471
4fcd97eb
DK
34722010-03-25 Doug Kwan <dougkwan@google.com>
3473
3474 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3475 to avoid a conversion warning on a 32-bit host.
3476
4ebf39db
ILT
34772010-03-24 Ian Lance Taylor <iant@google.com>
3478
3479 * testsuite/script_test_3.t: Add a TLS segment.
3480 * testsuite/Makefile.am (check_PROGRAMS): Add
3481 tls_phdrs_script_test.
3482 (tls_phdrs_script_test_SOURCES): Define.
3483 (tls_phdrs_script_test_DEPENDENCIES): Define.
3484 (tls_phdrs_script_test_LDFLAGS): Define.
3485 (tls_phdrs_script_test_LDADD): Define.
3486 * testsuite/Makefile.in: Rebuild.
3487
4a599bdd
CC
34882010-03-23 Cary Coutant <ccoutant@google.com>
3489
3490 * fileread.cc (find_or_make_view): Fix comment.
3491
6c93b22c
ILT
34922010-03-23 Ian Lance Taylor <iant@google.com>
3493
3494 * script-sections.cc (class Orphan_section_placement): Define
3495 PLACE_TLS and PLACE_TLS_BSS.
3496 (Orphan_section_placement::Orphan_section_placement): Initialize
3497 new places.
3498 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3499 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3500 (tls_script_test_SOURCES): Define.
3501 (tls_script_test_DEPENDENCIES): Define.
3502 (tls_script_test_LDFLAGS): Define.
3503 (tls_script_test_LDADD): Define.
3504 * testsuite/Makefile.in: Rebuild.
3505
a2c7281b
DK
35062010-03-22 Doug Kwan <dougkwan@google.com>
3507
3508 * arm.cc (Arm_relocate_functions::abs8,
3509 Arm_relocate_functions::abs16): Use correct check for overflow
3510 specified in the ARM ELF specs.
3511 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3512 target of a BLX instruction specially.
3513 (Reloc_stub::stub_type_for_reloc): Ditto.
3514 (Relocate::relocate): Use symbolic names instead of numeric relocation
3515 codes to report error.
3516 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3517 workaround.
3518 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3519 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3520 thumb2_blx_out_of_range.stdout
3521 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3522 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3523 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3524 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3525 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3526 thumb2_blx_in_range, thumb2_blx_in_range.o,
3527 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3528 thumb2_blx_out_of_range.o): New rules.
3529 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3530 thumb2_blx_in_range and thumb2_blx_out_of_range.
3531 * testsuite/Makefile.in: Regenerate.
3532 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3533 * testsuite/thumb_blx_in_range.s: New file.
3534 * testsuite/thumb_blx_out_of_range.s: New file.
3535
b0193076
RÁE
35362010-03-22 Rafael Espindola <espindola@google.com>
3537
3538 * archive.cc (Should_include): Move to archive.h.
3539 (should_include_member): Make it a member of Archive.
3540 (Lib_group): New.
3541 (Add_lib_group_symbols): New.
3542 * archive.h: Include options.h.
3543 (Archive_member): Moved from Archive.
3544 (Should_include): Moved from archive.cc.
3545 (Lib_group): New.
3546 (Add_lib_group_symbols): New.
3547 * dynobj.cc (do_should_include_member): New.
3548 * dynobj.h (do_should_include_member): New.
3549 * gold.cc (queue_initial_tasks): Update call to queue.
3550 * main.cc (main): Print lib group stats.
3551 * object.cc (do_should_include_member): New.
3552 * object.h: Include archive.h.
3553 (Object::should_include_member): New.
3554 (Object::do_should_include_member): New.
3555 (Sized_relobj::do_should_include_member): New.
3556 * options.cc (General_options::parse_start_lib): New.
3557 (General_options::parse_end_lib): New.
3558 (Input_arguments::add_file): Handle lib groups.
3559 (Input_arguments::start_group): Check we are not in a lib.
3560 (Input_arguments::start_lib): New.
3561 (Input_arguments::end_lib): New.
3562 * options.h (General_options): Add start_lib and end_lib.
3563 (Input_argument::lib_): New.
3564 (Input_argument::lib): New.
3565 (Input_argument::is_lib): New.
3566 (Input_file_lib): New.
3567 (Input_arguments::in_lib_): New.
3568 (Input_arguments::in_lib): New.
3569 (Input_arguments::start_lib): New.
3570 (Input_arguments::end_lib_): New.
3571 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3572 in unused members as preempted.
3573 (Sized_pluginobj::do_should_include_member): New.
3574 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3575 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3576 return the blocker.
3577 (Read_symbols::do_whole_lib_group): New.
3578 (Read_symbols::do_lib_group): New.
3579 (Read_symbols::do_read_symbols): Handle lib groups.
3580 (Read_symbols::get_name): Handle lib groups.
3581 * readsyms.h (Read_symbols): Add an archive member pointer.
3582 (Read_symbols::do_whole_lib_group): New.
3583 (Read_symbols::do_lib_group): New.
3584 (Read_symbols::member_): New.
3585 * script.cc (read_input_script): Update call to queue_soon.
3586
d099120c
DK
35872010-03-19 Doug Kwan <dougkwan@google.com>
3588
3589 * arm.cc (Stub_table::Stub_table): Initialize new data members
3590 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3591 (Stub_table::add_reloc_stub): Assign stub offset and update
3592 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3593 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3594 New data members.
3595 (Stub_table::update_data_size_and_addralign): Use
3596 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3597 instead of going over all reloc stubs.
3598 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3599 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3600 Stringpool_template::offset_ to size of Stringpool_char.
3601 (Stringpool_template::new_key_offset): Remove code to initialize
3602 Stringpool_template::offset_.
3603 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3604 Stringpool_template::offset_ to zero.
3605
1aa37384
DK
36062010-03-15 Doug Kwan <dougkwan@google.com>
3607
3608 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3609 offset_.
3610 (Stringpool_template::new_key_offset): New method.
3611 (Stringpool_template::add_string): Assign offsets when adding new
3612 strings.
3613 (Stringpool_template::set_string_offsets): Do not set string offsets
3614 when not optimizing.
3615 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3616 member size_.
3617 (Chunked_vector::clear): Clear size_.
3618 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3619 (Chunked_vector::size): Return size_.
3620 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 3621 (Chunked_vector::size_): New data member.
1aa37384
DK
3622 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3623 (Stringpool_template::new_key_offset): New method declaration.
3624 (Stringpool_template::offset_): New data member.
3625
b672b057
RÁE
36262010-03-15 Rafael Espindola <espindola@google.com>
3627
3628 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3629 Add_symbols' constructor.
3630 * readsyms.h (Add_symbols): Remove the input_group member.
3631
b6848d3c
ILT
36322010-03-10 Ian Lance Taylor <iant@google.com>
3633
3634 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3635 target to ask whether a reference to a symbol requires a stack
3636 split.
3637 * target.h (Target::is_call_to_non_split): New function.
3638 (Target::do_is_call_to_non_split): Declare virtual function.
3639 * target.cc: Include "symtab.h".
3640 (Target::do_is_call_to_non_split): New function.
3641 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3642
a2a5469e
CC
36432010-03-10 Cary Coutant <ccoutant@google.com>
3644
3645 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3646 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3647 (File_read::open[2]): Add whole_file_view_ to list of views.
3648 (File_read::make_view): Remove test of whole_file_view_.
3649 (File_read::find_or_make_view): Create whole_file_view_ if
3650 necessary.
3651 (File_read::clear_views): Replace bool parameter with enum;
3652 adjust all callers. Don't delete views with permanent data;
3653 do delete cached views and views from archives if
3654 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3655 if clearing the corresponding view.
3656 * fileread.h (File_read::Clear_views_mode): New enum.
3657 (File_read::View::is_permanent_view): New method.
3658 (File_read::clear_views): Replace bool parameter
3659 with enum; adjust all callers.
3660 * options.h (General_options): Change keep_files_mapped option;
3661 add map_whole_files.
3662 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3663 releasing the file.
3664 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3665 the file.
3666
8861f32b
DM
36672010-03-10 David S. Miller <davem@davemloft.net>
3668
3669 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3670
d62d0f5f
ST
36712010-03-09 Sriraman Tallam <tmsriram@google.com>
3672
3673 * icf.cc (get_section_contents): Add '@' marker after processing the
3674 merge reloc.
3675
9177756d
DK
36762010-03-08 Doug Kwan <dougkwan@google.com>
3677
3678 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3679 due to a conversion warning.
3680 (Arm_relobj::update_output_local_symbol_count): Check for local
3681 symbol with unset output index.
3682
9e9e071b
ILT
36832010-03-05 Ian Lance Taylor <iant@google.com>
3684
3685 * options.h (class General_options): Add --spare-dynamic-tags.
3686 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3687 --spare-dynamic-tags.
3688
a81ee015
ILT
36892010-03-05 Ian Lance Taylor <iant@google.com>
3690
3691 * incremental.cc: Include "libiberty.h".
3692
44ec90b9
RO
36932010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3694
3695 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3696 function, is_info_ member.
3697 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3698 (Versions::Versions): Update caller.
3699 (Versions::define_base_version): Likewise.
3700 (Versions::add_def): Likewise.
3701
0897ed3b
ST
37022010-03-03 Sriraman Tallam <tmsriram@google.com>
3703
3704 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3705 (Scan::possible_function_pointer_reloc): New function.
3706 (Scan::local_reloc_may_be_function_pointer): Change to call
3707 possible_function_pointer_reloc.
3708 (Scan::global_reloc_may_be_function_pointer): Ditto.
3709 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3710 relocations in ".data.rel.ro._ZTV" section.
3711 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3712 * testsuite/icf_safe_so_test.cc: Ditto.
3713 * testsuite/icf_safe_test.cc: Ditto.
3714 * testsuite/icf_safe_test.sh: Ditto.
3715
d3bbad62
ILT
37162010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3717 Ian Lance Taylor <iant@google.com>
3718
3719 * target-reloc.h (relocate_section): Check the symbol table index
3720 for -1U before setting the local symbol index.
3721 (scan_relocatable_relocs): If copying the relocation, record that
3722 the local symbol is required.
3723 * object.h (Symbol_value::is_output_symtab_index_set): New
3724 function.
3725 (Symbol_value::may_be_discarded_from_output_symtab): New
3726 function.
3727 (Symbol_value::has_output_symtab_entry): New function.
3728 (Symbol_value::needs_output_symtab_entry): Remove.
3729 (Symbol_value::output_symtab_index): Make sure the symbol index is
3730 set.
3731 (Symbol_value::set_output_symtab_index): Make sure the symbol
3732 index is not set. Make sure the new index is valid.
3733 (Symbol_value::set_must_have_output_symtab_entry): New function.
3734 (Symbol_value::has_output_dynsym_entry): New function.
3735 (Symbol_value::set_output_dynsym_index): Make sure the new index
3736 is valid.
3737 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3738 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3739 local symbol if permitted.
3740 (Sized_relobj::do_finalize_local_symbols): Call
3741 is_output_symtab_index_set rather than needs_output_symtab_entry.
3742 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3743 rather than needs_output_symtab_entry. Call
3744 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3745 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3746 is_output_symtab_index_set rather than needs_output_symtab_entry.
3747 * testsuite/discard_locals_relocatable_test.c: New file.
3748 * testsuite/discard_locals_test.sh: Test -r.
3749 * testsuite/Makefile.am (check_DATA): Add
3750 discard_locals_relocatable_test1.syms,
3751 discard_local_relocatable_test2.syms.
3752 (MOSTLYCLEANFILES): Likewise. Also add
3753 discard_locals_relocatable_test1.lout and
3754 discard_locals_relocatable_test2.out.
3755 (discard_locals_relocatable_test1.syms): New target.
3756 (discard_locals_relocatable_test.o): New target.
3757 (discard_locals_relocatable_test1.out): New target.
3758 (discard_locals_relocatable_test2.syms): New target.
3759 (discard_locals_relocatable_test2.out): New target.
3760 (various): Add missing ../ld-new dependencies.
3761 * testsuite/Makefile.in: Rebuild.
3762
7e8ccf26
NC
37632010-03-03 Nick Clifton <nickc@redhat.com>
3764
3765 * po/fi.po: New Finnish translation.
3766
2a0ff005
DK
37672010-03-01 Doug Kwan <dougkwan@google.com>
3768
3769 * layout.cc (Layout::Layout): Force section types of .init_array*,
3770 .preinit_array* and .fini_array* sections.
3771 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3772 Fix check of return value of std::string::find.().
3773 (Output_section::Input_section_sort_compare::operator()): Remove
3774 comment about .init_array.
3775 (Output_section::Input_section_sort_init_fini_compare::operator()):
3776 New method.
3777 (Output_section::sort_attached_input_sections): Handle .init_array
3778 and .fini_array specially.
3779 * output.h (Output_section::Inut_section_sort_compare): Update
3780 comment.
3781 (Output_section::Input_section_sort_init_fini_compare): New struct.
3782
c3e4ae29
DK
37832010-02-26 Doug Kwan <dougkwan@google.com>
3784
3785 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3786 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3787 * testsuite/debug_msg.sh: Avoid matching source line number for
3788 use of global variable undef_int.
3789
2fd9ae7a
DK
37902010-02-26 Doug Kwan <dougkwan@google.com>
3791
3792 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3793 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3794 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3795 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3796 * options.cc (General_options::General_options): Initialize member
3797 fix_v4bx_.
3798 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3799 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3800 and rm_no_fix_v4bx.stdout
3801 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3802 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3803 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3804 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3805 and arm_no_fix_v4bx.
3806 * Makefile.in: Regenerate.
3807 * testsuite/arm_fix_v4bx.s: New file.
3808 * testsuite/arm_fix_v4bx.sh: Ditto.
3809
67ec7d0b
DK
38102010-02-24 Doug Kwan <dougkwan@google.com>
3811
3812 * arm.cc (Target_arm::got_section): Make the .got section the first
3813 non RELRO section in the data segment.
3814 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3815 suffixes of section names.
3816
10165461
DK
38172010-02-24 Doug Kwan <dougkwan@google.com>
3818
3819 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3820 flags and attributes merging if an input file is a binary file.
3821 * fileread.cc (Input_file::open): Record format of original file.
3822 * fileread.h (Input_file::Format): New enum type.
3823 (Input_file::Input_file): Initialize data member format_.
3824 (Input_file::format): New method definition.
3825 (Input_file::format_):: New data member.
3826
4a54abbb
DK
38272010-02-24 Doug Kwan <dougkwan@google.com>
3828
3829 * arm.cc (Arm_output_data_got): New class.
3830 (ARM_TCB_SIZE): New constant
3831 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3832 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3833 If user uses a script with a SECTIONS clause, issue only a warning
3834 for a misplaced EXIDX input section. Otherwise, issue an error.
3835 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3836 garbage collection.
3837 (Target_arm::got_mode_index_entry): Handle static linking.
3838 (Target_arm::Scan::local): Ditto.
3839 (Target_arm::Scan::global): Ditto.
3840 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3841 all incorrectly implemented relocations.
e1df38aa 3842 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
3843 Arm_output_section::fix_exidx_coverage.
3844 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3845 from ".ARM.exidx." and ".ARM.extab.".
3846
ca419a6f
ILT
38472010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3848
3849 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3850 section if it does not already exist.
3851 * attributes.cc (Attributes_section_data::Attributes_section_data):
3852 Don't crash if size is zero.
3853
135b9c78
ILT
38542010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3855 Ian Lance Taylor <iant@google.com>
3856
3857 * gold.cc (queue_middle_tasks): If no input files were opened,
3858 exit.
3859 * workqueue.h (Task_function::Task_function): Assert that there is
3860 a blocker.
3861
bb0bfe4f
DK
38622010-02-22 Doug Kwan <dougkwan@google.com>
3863
3864 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3865 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3866 types to avoid warnings due to different uint64_t implementations
3867 on different hosts.
3868
2a2b6d42
DK
38692010-02-21 Doug Kwan <dougkwan@google.com>
3870
3871 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3872 handling of the maximum backward branch offset.
3873 (Arm_relocate_functions::thumb_branch_common): Ditto.
3874 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3875 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 3876 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
3877 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3878 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3879 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3880 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3881 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3882 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3883 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3884 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3885 thumb2_bl_out_of_range.o): New rules.
3886 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3887 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3888 thumb2_bl_out_of_range
3889 * testsuite/Makefile.in: Regenerate.
3890 * testsuite/arm_bl_in_range.s: New file.
3891 * testsuite/arm_bl_out_of_range.s: Ditto.
3892 * testsuite/arm_branch_in_range.sh: Ditto.
3893 * testsuite/arm_branch_range.t: Ditto.
3894 * testsuite/thumb2_branch_range.t: Ditto.
3895 * testsuite/thumb_bl_in_range.s: Ditto.
3896 * testsuite/thumb_bl_out_of_range.s: Ditto.
3897 * testsuite/thumb_branch_range.t: Ditto.
3898
b487ad64
ST
38992010-02-20 Sriraman Tallam <tmsriram@google.com>
3900
3901 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3902 Add reloc offset information.
3903 * icf.cc (get_section_contents): Change iterators to point to the new
3904 vectors. Add reloc offset information to the contents.
3905 * icf.h (Icf::Sections_reachable_info): New typedef.
3906 (Icf::Sections_reachable_list): New typedef.
3907 (Icf::Offset_info): New typedef.
3908 (Icf::Reloc_info): New struct typedef.
3909 (Icf::Reloc_info_list): New typedef.
3910 (Icf::symbol_reloc_list): Delete method.
3911 (Icf::addend_reloc_list): Delete method.
3912 (Icf::section_reloc_list): Delete method.
3913 (Icf::reloc_info_list): New method.
3914 (Icf::reloc_info_list_): New member.
3915
f96accdf
DK
39162010-02-19 Doug Kwan <dougkwan@google.com>
3917
3918 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3919 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3920 * arm.cc (Arm_relocation_functions): New forward declaration.
3921 (Target_arm::Target_arm): Initialize new data members
3922 got_mod_index_offset_ and tls_base_symbol_defined_.
3923 (Target_arm::Relocate::relocate_tls): New method.
3924 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3925 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3926 New methods.
3927 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3928 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3929 (Target_arm::got_mod_index_offset_,
3930 Target_arm::tls_base_symbol_defined_): New data members.
3931 (Target_arm::Scan::local, Target::Scan::global,
3932 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3933 relocations.
3934
c8761b9a
DK
39352010-02-18 Doug Kwan <dougkwan@google.com>
3936
3937 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3938 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3939 text section as a parameter becuase some broken tools may not set
3940 the link in section header.
3941 (Target_arm::has_got_section): New method.
3942 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3943 without any mapping symbol as data only. Remove warning.
3944 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3945 link in its section header, try to discover the link by inspecting the
3946 REL31 relocation at the beginning of the section.
3947 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3948 in error message.
3949 (Target_arm::Scan::global): Treat any reference to the symbol
3950 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3951
21bb3914
ST
39522010-02-12 Sriraman Tallam <tmsriram@google.com>
3953
3954 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3955 (Scan::global_reloc_may_be_function_pointer): New function.
3956 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3957 (Scan::global_reloc_may_be_function_pointer): New function.
3958 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3959 (Scan::global_reloc_may_be_function_pointer): New function.
3960 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3961 (Scan::global_reloc_may_be_function_pointer): New function.
3962 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3963 (Scan::global_reloc_may_be_function_pointer): New function.
3964 (Scan::possible_function_pointer_reloc): New function.
3965 (Target_x86_64::can_check_for_function_pointers): New function.
3966 * gc.h (gc_process_relocs): Scan relocation types to determine if
3967 function pointers were taken for targets that support it.
3968 * icf.cc (Icf::find_identical_sections): Include functions for
3969 folding in safe ICF whose pointer is not taken.
3970 * icf.h (Secn_fptr_taken_set): New typedef.
3971 (fptr_section_id_): New member.
3972 (section_has_function_pointers): New function.
3973 (set_section_has_function_pointers): New function.
3974 (check_section_for_function_pointers): New function.
3975 * options.h: Fix comment for safe ICF option.
3976 * target.h (can_check_for_function_pointers): New function.
3977 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3978 Modify icf_safe_test for X86-64.
3979 * testsuite/Makefile.in: Regenerate.
3980 * testsuite/icf_safe_so_test.cc: New file.
3981 * testsuite/icf_safe_so_test.sh: New file.
3982 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3983 (main): Change to take pointer to function kept_func_3.
3984 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3985 folding is done correctly for X86-64.
3986
0da6fa6c
DM
39872010-02-12 David S. Miller <davem@davemloft.net>
3988
3989 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3990 is_symbolless parameter.
3991 (Output_reloc<SHT_REL>::is_symbolless): New.
3992 (Output_reloc<SHT_REL>::is_symbolless_): New.
3993 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3994 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3995 (Output_reloc<SHT_RELA>::is_symbolless): New.
3996 (Output_data_reloc::add_global): Handle is_symbolless.
3997 (Output_data_reloc::add_global_relative): Likewise.
3998 (Output_data_reloc::add_local): Likewise.
3999 (Output_data_reloc::add_local_relative): Likewise.
4000 (Output_data_reloc::add_symbolless_global_addend): New.
4001 (Output_data_reloc::add_symbolless_local_addend): New.
4002 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4003 is_symbolless.
4004 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4005 instead of ->is_relative_
4006 (Output_reloc::write): Likewise.
4007 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4008 (Output_reloc::write_rel): Simplify.
4009
4010 * sparc.cc (Target_sparc::Scan::local): Use
4011 ->add_symbolless_local_addend as needed.
4012 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4013 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4014 based upon relocation offset.
4015
e4782e83
DK
40162010-02-11 Doug Kwan <dougkwan@google.com>
4017
4018 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4019 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4020 beginning of function.
4021 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4022 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4023 parameter is_32bit in calls to should_apply_static_reloc.
4024 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4025 (check_DATA): Add arm_abs_global.stdout.
4026 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4027 arm_abs_global.stdout): New rules.
4028 (MOSTLLYCLEANFILES): Add arm_abs_global
4029 * Makefile.in: Regenerate.
4030 * testsuite/arm_abs_global.s: New file.
4031 * testsuite/arm_abs_global.sh: Ditto.
4032 * testsuite/arm_abs_lib.s: Ditto.
4033
93ceb764
ILT
40342010-02-11 Ian Lance Taylor <iant@google.com>
4035
4036 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4037 Read_relocs task.
4038 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4039 Allocate_commons_task first.
4040 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4041 task, rather than symtab_lock_.
4042 (Gc_process_relocs::~Gc_process_relocs): New function.
4043 (Gc_process_relocs::is_runnable): Check this_blocker_.
4044 (Gc_process_relocs::locks): Use next_blocker_ rather than
4045 blocker_.
4046 (Scan_relocs::~Scan_relocs): New function.
4047 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4048 symtab_lock_.
4049 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4050 next_blocker_.
4051 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4052 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4053 constructor accordingly.
4054 (class Gc_process_relocs): Likewise.
4055 (class Scan_relocs): Likewise.
4056 * common.h (class Allocate_commons_task): Remove symtab_lock_
4057 field, and corresponding constructor parameter.
4058 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4059 symtab_lock_.
4060 (Allocate_commons_task::locks): Likewise.
4061
114dfbe1
ILT
40622010-02-11 Ian Lance Taylor <iant@google.com>
4063
4064 * gold-threads.h (class Once): Define.
4065 (class Initialize_lock): Rewrite as child of Once.
4066 * gold-threads.cc (class Once_initialize): Define.
4067 (once_pointer_control): New static variable.
4068 (once_pointer, once_arg): New static variables.
4069 (c_run_once): New static function.
4070 (Once::Once, Once::run_once, Once::internal_run): New functions.
4071 (class Initialize_lock_once): Remove.
4072 (initialize_lock_control): Remove.
4073 (initialize_lock_pointer): Remove.
4074 (initialize_lock_once): Remove.
4075 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4076 (Initialize_lock::initialize): Rewrite.
4077 (Initialize_lock::do_run_once): New function.
4078 * archive.cc (Archive::interpret_header): Only clear name if it is
4079 not already empty.
4080 * fileread.cc: Include "gold-threads.h"
4081 (file_counts_lock): New static variable.
4082 (file_counts_initialize_lock): Likewise.
4083 (File_read::release): Only increment counts when using --stats.
4084 Use a lock around the increment.
4085 * parameters.cc (class Set_parameters_target_once): Define.
4086 (set_parameters_target_once): New static variable.
4087 (Parameters::Parameters): Move here from parameters.h.
4088 (Parameters::set_target): Rewrite.
4089 (Parameters::set_target_once): New function.
4090 (Parameters::clear_target): Move here and rewrite.
4091 * parameters.h (class Parameters): Update declarations. Add
4092 set_parameters_target_once_ field.
4093 (Parameters::Parameters): Move to parameters.cc.
4094 (Parameters::clear_target): Likewise.
4095 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4096 task.
4097 (Start_group::~Start_group): New function.
4098 (Start_group::is_runnable): New function.
4099 (Start_group::locks, Start_group::run): New functions.
4100 (Finish_group::run): Change saw_undefined to size_t.
4101 * readsyms.h (class Start_group): Define.
4102 (class Finish_group): Change saw_undefined_ field to size_t.
4103 (Finish_group::Finish_group): Remove saw_undefined and
4104 this_blocker parameters. Change all callers.
4105 (Finish_group::set_saw_undefined): New function.
4106 (Finish_group::set_blocker): New function.
4107 * symtab.h (class Symbol_table): Change saw_undefined to return
4108 size_t. Change saw_undefined_ field to size_t.
4109 * target-select.cc (Set_target_once::do_run_once): New function.
4110 (Target_selector::Target_selector): Initialize set_target_once_
4111 field. Don't initialize lock_ and initialize_lock_ fields.
4112 (Target_selector::instantiate_target): Rewrite.
4113 (Target_selector::set_target): New function.
4114 * target-select.h (class Set_target_once): Define.
4115 (class Target_selector): Update declarations. Make
4116 Set_target_once a friend. Remove lock_ and initialize_lock_
4117 fields. Add set_target_once_ field.
4118
fa17a3f4
ILT
41192010-02-10 Ian Lance Taylor <iant@google.com>
4120
4121 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4122 queueing any tasks.
4123 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4124 (queue_middle_tasks): Add all blockers before queueing any tasks.
4125 (queue_final_tasks): Likewise.
4126 * token.h (Task_token::add_blockers): New function.
4127 * object.h (Input_objects::number_of_relobjs): New function.
4128
c7177d31
ILT
41292010-02-10 Ian Lance Taylor <iant@google.com>
4130
5de0e392
ILT
4131 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4132 shared, not if not position independent.
4133 * x86_64.cc (Relocate::relocate_tls): Likewise.
4134 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4135 (tls_pie_pic_test): New target.
4136 * testsuite/Makefile.in: Rebuild.
4137
c7177d31
ILT
4138 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4139 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4140 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4141 * testsuite/Makefile.in: Rebuild.
4142
684b268a
DM
41432010-02-09 David S. Miller <davem@davemloft.net>
4144
4145 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4146 R_SPARC_RELATIVE using ->add_local_relative().
4147 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4148
612a8d3d
DM
4149 * output.h (Output_data_dynamic::add_section_size): New method
4150 that takes two Output_data objects.
4151 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4152 entry param. Handle it in initializers.
4153 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4154 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4155 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4156 arg.
4157 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4158 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4159 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4160 for dynrel_includes_plt.
4161 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4162 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4163 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4164 before .rela.plt
4165 (Target_sparc::do_finalize_sections): Update to pass true for
4166 dynrel_includes_plt.
4167 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4168 output before .rela.plt
4169 (Target_powerpc::do_finalize_sections): Update to pass true for
4170 dynrel_includes_plt when 32-bit.
4171
cb1be87e
DK
41722010-02-08 Doug Kwan <dougkwan@google.com>
4173
4174 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4175 method.
4176 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4177 Arm_relobj::scan_section_for_cortex_a8_stubs,
4178 Arm_relobj::do_relocation_section): Instead of calling
4179 Output_section::output_address, use faster
4180 Arm_relobj::simple_input_section_output_address.
4181
705b5121
DM
41822010-02-08 David S. Miller <davem@davemloft.net>
4183
4184 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4185 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4186 relocation helper function.
4187
024c4466
DM
4188 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4189 just like R_SPARC_GOT{10,13,22}.
4190 (Target_sparc::Scan::local): Likewise.
4191 (Target_sparc::Relocate:relocate): Likewise.
4192
9109c078
ILT
41932010-02-06 Ian Lance Taylor <iant@google.com>
4194
4195 * configure.ac: Rewrite targetobjs duplicate removal code to use
4196 only shell constructs.
4197 * configure: Rebuild.
4198
cf846138
DK
41992010-02-05 Doug Kwan <dougkwan@google.com>
4200
4201 PR 11247
4202 * arm.cc (Arm_relobj::section_is_scannable): New method.
4203 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4204 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4205
6cfaf60b
DK
42062010-02-04 Doug Kwan <dougkwan@google.com>
4207
4208 PR 11247
4209 * arm-reloc-property.cc (cstdio): Include.
4210 * configure.ac (targetobjs): Remove duplicates.
4211 * configure: Regenerate.
4212 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4213 big and little endian version for a given address size.
4214
5c57f1be
DK
42152010-02-03 Doug Kwan <dougkwan@google.com>
4216
4217 * arm-reloc-property.cc
4218 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4219 definition.
4220 * arm-reloc-property.h
4221 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4222 New method definition.
4223 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4224 declaration.
4225 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4226 overflow to N.
4227 (GOT_PREL): Change implemented to Y.
4228 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4229 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4230 (Arm_relocate_functions::movw_abs_nc): Remove method.
4231 (Arm_relocate_functions::movt_abs): Ditto.
4232 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4233 (Arm_relocate_functions::thm_movt_abs): Ditto.
4234 (Arm_relocate_functions::movw_rel_nc): Ditto.
4235 (Arm_relocate_functions::movw_rel): Ditto.
4236 (Arm_relocate_functions::movt_rel): Ditto.
4237 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4238 (Arm_relocate_functions:thm_movw_rel): Ditto.
4239 (Arm_relocate_functions:thm_movt_rel): Ditto.
4240 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4241 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4242 New method definitions.
4243 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4244 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4245 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4246 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4247 (Target_arm::Relocate::relocate): Check for non-static or
4248 unimplemented relocation code and exit early. Change calls to
4249 Target_arm::reloc_uses_thumb_bit and
4250 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4251 instead. Refactor code to handle similar relocations to increase
4252 code sharing. Remove check for unsupported relocation code in switch
4253 statement.
4254 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4255 relocation property table to find out size. Change error message to
4256 print out the name of a relocation code instead of the numeric value.
4257 (Target_arm::scan_reloc_for_stub): Use relocation property table
4258 instead of calling Target_arm::reloc_uses_thumb_bit().
4259
218c5831
DK
42602010-02-02 Doug Kwan <dougkwan@google.com>
4261
4262 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4263 types of relaxed input section.
4264
0d31c79d
DK
42652010-02-02 Doug Kwan <dougkwan@google.com>
4266
4267 * Makefile.am (HFILES): Add arm-reloc-property.h.
4268 (DEFFILES): New.
4269 (TARGETSOURCES): Add arm-reloc-property.cc
4270 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4271 (libgold_a_SOURCES): $(DEFFILES)
4272 * Makefile.in: Regenerate.
4273 * arm-reloc-property.cc: New file.
4274 * arm-reloc-property.h: New file.
4275 * arm-reloc.def: New file.
4276 * arm.cc: Update comments.
4277 (arm-reloc-property.h): New included header.
4278 (arm_reloc_property_table): New global variable.
4279 (Target_arm::do_select_as_default_target): New method definition.
4280 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4281 arm-reloc-property to targ_extra_obj.
4282 * parameters.cc (set_parameters_target): Call
4283 Target::select_as_default_target().
4284 * target.h (Target::select_as_default_target): New method definition.
4285 (Target::do_select_as_default_target): Same.
4286
546c7457
DK
42872010-02-01 Doug Kwan <dougkwan@google.com>
4288
4289 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4290 first_output_text_section_.
4291 (Arm_exidx_fixup::first_output_text_section): New method definition.
4292 (Arm_exidx_fixup::first_output_text_section_): New data member.
4293 (Arm_exidx_fixup::process_exidx_section): Record the first text
4294 output section seen.
4295 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4296 and entsize in output section header.
4297
11b861d5
DK
42982010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4299
4300 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4301 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4302 (Arm_relocate_functions::thm_alu11): New Method.
4303 (Arm_relocate_functions::thm_pc8): New Method.
4304 (Arm_relocate_functions::thm_pc12): New Method.
4305 (Target_arm::Scan::local): Handle the relocations.
4306 (Target_arm::Scan::global): Likewise.
4307 (Target_arm::Relocate::relocate): Likewise.
4308 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4309
c9a2c125
DK
43102010-01-29 Doug Kwan <dougkwan@google.com>
4311
4312 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4313 of relocation types as ld.
4314
1521477a
DK
43152010-01-29 Doug Kwan <dougkwan@google.com>
4316
4317 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4318 to public.
4319 (Arm_relocate_functions::thumb_branch_common): Ditto.
4320 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4321 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4322 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4323 Arm_relocate_functions::jump24): Remove.
4324 (Target_arm::Relocate::relocate): Adjust code to call
4325 Arm_relocation_functions::arm_branch_common and
4326 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 4327 wrappers. Merge switch-cases together to reduce source code size.
1521477a 4328
e7eca48c
DK
43292010-01-29 Doug Kwan <dougkwan@google.com>
4330
4331 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4332 output_local_symbol_count_needs_update_.
4333 (Arm_relobj::output_local_symbol_count_needs_update,
4334 Arm_relobj::set_output_local_symbol_count_needs_update,
4335 Arm_relobj::update_output_local_symbol_count): New methods.
4336 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4337 member.
4338 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4339 of pointed function as in a R_ARM_PREL31 relocation.
4340 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4341 for output local symbol count updating.
4342 (Target_arm::do_relax): Update output local symbol counts in objects
4343 if necessary.
4344 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4345
02961d7e
ILT
43462010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4347
4348 * arm.cc: Added support for the ARM relocations:
4349 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4350 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4351 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4352 movw_prel_nc).
4353 (Arm_relocate_functions::movw_rel): New method.
4354 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4355 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4356 thm_movw_prel_nc).
4357 (Arm_relocate_functions::thm_movw_rel): New method.
4358 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4359 thm_movt_prel).
4360 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4361 relocations.
4362 (Target_arm::Scan::global): Likewise.
4363 (Target_arm::Relocate::relocate): Likewise.
4364 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4365 Likewise.
4366
b10d2873
ILT
43672010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4368
4369 * arm.cc: Added support for ARM group relocations.
4370 (Target_arm::reloc_needs_sym_origin): New method.
4371 (Arm_relocate_functions::calc_grp_kn): New method.
4372 (Arm_relocate_functions::calc_grp_residual): New method.
4373 (Arm_relocate_functions::calc_grp_gn): New method.
4374 (Arm_relocate_functions::arm_grp_alu): New Method.
4375 (Arm_relocate_functions::arm_grp_ldr): New Method.
4376 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4377 (Arm_relocate_functions::arm_grp_ldc): New Method.
4378 (Target_arm::Scan::local): Handle the ARM group relocations.
4379 (Target_arm::Scan::global): Likewise.
4380 (Target_arm::Relocate::relocate): Likewise.
4381 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4382 Likewise.
4383
2b328d4e
DK
43842010-01-26 Doug Kwan <dougkwan@google.com>
4385
4386 * arm.cc (set): Include.
4387 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4388 pointer type.
4389 (Arm_output_section::Text_section_list): New type.
4390 (Arm_output_section::append_text_sections_to_list): New method.
4391 (Arm_output_section::fix_exidx_coverage): Ditto.
4392 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4393 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4394 Relobj::set_section_offset() instead of
4395 Sized_relobj::invalidate_section_offset().
4396 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4397 parameter for section headers. Ignore relocation sections for
4398 unallocated sections and EXIDX sections.
4399 (Target_arm::fix_exidx_coverage): New method.
4400 (Target_arm::output_section_address_less_than): New type.
4401 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4402 linked text section instead of the EXIDX section.
4403 (Arm_output_section::create_stub_group): Add an assertion to check
4404 that this is not an EXIDX output section.
4405 (Arm_output_section::append_text_sections_to_list): New method.
4406 (Arm_output_section::fix_exidx_coverage): Ditto.
4407 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4408 Arm_relobj::section_needs_reloc_stub_scanning.
4409 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4410 first pass.
4411 (Target_arm::fix_exidx_coverage): New method.
4412 * object.h (Relobj::set_output_section): New method.
4413 (Sized_relobj::invalidate_section_offset): Remove method.
4414 (Sized_relobj::do_invalidate_section_offset): Remove method.
4415 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4416
c7f3c371
DK
44172010-01-25 Doug Kwan <dougkwan@google.com>
4418
4419 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4420 Fix warning due to signed and unsigned comparison on a 32-bit host.
4421
8923b24c
DK
44222010-01-22 Doug Kwan <dougkwan@google.com>
4423
4424 * arm.cc (Target_arm::do_relax): Record an output section for section
4425 offset adjustment it contains any stub table that has changed.
4426 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4427 offsets in an output section if necessary.
4428 * output.cc (Output_section::Output_section): Initialize
4429 section_offsets_need_adjustments_.
4430 (Output_section::add_input_section_for_script): Renamed to
4431 Output_section::add_simple_input_section.
4432 (Output_section::save_states): Add a comment.
4433 (Output_section::discard_states): New method defintion.
4434 (Output_section::adjust_section_offsets): Same.
4435 * output.h (Output_section::add_input_section_for_script): Renamed to
4436 Output_section::add_simple_input_section.
4437 (Output_section::discard_states): New method declaration.
4438 (Output_section::adjust_section_offsets): Same.
4439 (Output_section::section_offsets_need_adjustment,
4440 Output_section::set_section_offsets_need_adjustment): New method
4441 definitions.
4442 (Output_section::section_offsets_need_adjustment_): New data member.
4443 * script-sections.cc
4444 (Output_section_element_input::set_section_address): Adjust code for
4445 renaming of Output_section::add_input_section_for_script.
4446 (Orphan_output_section::set_section_address): Same.
4447
9b2fd367
DK
44482010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4449
4450 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4451 Fix_v4bx enum values .
4452 * gold/options.h (General_options): New option definitions.
4453 (General_options::fix_v4bx): New method.
4454 (General_options::Fix_v4bx): New enum.
4455 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4456 (General_options::parse_fix_v4bx_interworking): New method.
4457
80d0d023
DK
44582010-01-22 Doug Kwan <dougkwan@google.com>
4459
4460 * arm.cc (Arm_exidx_fixup): New class.
4461
af2cdeae
DK
44622010-01-21 Doug Kwan <dougkwan@google.com>
4463
4464 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4465 classes.
4466 (Arm_exidx_section_offset_map): New type.
4467
993d07c1
DK
44682010-01-21 Doug Kwan <dougkwan@google.com>
4469
4470 * arm.cc (Arm_exidx_input_section): New class.
4471 (Arm_relobj::exidx_input_section_by_link,
4472 Arm_relobj::exidx_input_section_by_shndx,
4473 Arm_relobj::make_exidx_input_section): New methods.
4474 (read_arm_attributes_section): Remove.
4475 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4476 information about them.
4477 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4478 to here.
4479
5ac169d4
DK
44802010-01-20 Doug Kwan <dougkwan@google.com>
4481
4482 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4483 Input_section_specifier to Section_id.
4484 (Target_arm::new_arm_input_section: Adjust code for change of key
4485 type.
4486 (Target_arm::find_arm_input_section): Ditto.
4487 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4488 (Section_id): Remove.
4489 (Garbage_collection::Section_id_hash): Remove.
4490 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4491 (Section_id): Remove.
4492 (Icf::Section_id_hash): Remove.
4493 * object.h (Section_id, Const_section_id, Section_id_hash,
4494 Const_section_id_hash): New type definitions.
4495 * output.cc (Output_section::add_relaxed_input_section): Change to
4496 use Const_section_id instead of Input_section_specifier as key type.
4497 (Output_section::add_merge_input_section): Ditto.
4498 (Output_section::build_relaxation_map): Change to use Section_id
4499 instead of Input_section_specifier as key type.
4500 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4501 Ditto.
4502 (Output_section::convert_input_sections_to_relaxed_sections): Change
4503 to use Const_section_id instead of Input_section_specifier as key type.
4504 (Output_section::find_merge_section): Ditto.
4505 (Output_section::find_relaxed_input_section): Ditto.
4506 * output.h (Input_section_specifier): Remove class.
4507 (Output_section::Output_section_data_by_input_section_map): Change
4508 key type to Const_section_id.
4509 (Output_section::Output_relaxed_input_section_by_input_section_map):
4510 Ditto.
4511 (Output_section::Relaxation_map): Change key type to Section_id.
4512
a2162063
ILT
45132010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4514
4515 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4516 (class Arm_v4bx_stub): New class.
4517 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4518 (Stub_factory::make_arm_v4bx_stub): New method.
4519 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4520 (Stub_table::empty): Handle v4bx stubs.
4521 (Stub_table::add_arm_v4bx_stub): New method.
4522 (Stub_table::find_arm_v4bx_stub): New method.
4523 (Arm_relocate_functions::v4bx): New method.
4524 (Target_arm::fix_v4bx): New method.
4525 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4526 (Stub_table::relocate_stubs): Likewise.
4527 (Stub_table::do_write): Likewise.
4528 (Stub_table::update_data_size_and_addralign): Likewise.
4529 (Stub_table::finalize_stubs): Likewise.
4530 (Target_arm::Scan::local): Likewise.
4531 (Target_arm::Scan::global): Likewise.
4532 (Target_arm::do_finalize_sections): Likewise.
4533 (Target_arm::Relocate::relocate): Likewise.
4534 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4535 Likewise.
4536 (Target_arm::scan_reloc_for_stub): Likewise.
4537 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4538
5696ab0b
ILT
45392010-01-19 Ian Lance Taylor <iant@google.com>
4540
4541 * output.cc (Output_section_headers::do_sized_write): Write large
4542 segment count to sh_info field.
4543 (Output_file_header::do_sized_write): For large segment count,
4544 write PN_XNUM to e_phnum field.
4545
800d0f56
ILT
45462010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4547
4548 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4549 (Arm_relocate_functions::thm_jump8): New function.
4550 (Arm_relocate_functions::thm_jump11): New function.
4551 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4552 R_ARM_THM_JUMP11.
4553 (Target_arm::Scan::global): Likewise.
4554 (Target_arm::Relocate::relocate): Likewise.
4555 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4556 Likewise.
4557
41263c05
DK
45582010-01-14 Doug Kwan <dougkwan@google.com>
4559
4560 * arm.cc (map, utility): Include headers.
4561 (Target_arm::apply_cortex_a8_workaround): New method.
4562 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4563 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4564 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4565 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4566 the --[no-]fix-cortex-a8 command line options.
4567 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4568 (Target_arm::relocate_stub): Use addend in instruction template.
4569 * options.h (DEFINE_bool): Set the user-set flag.
4570 (General_options): Add --[no-]-fix-cortex options.
4571 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 4572 : Update fast look-up map after conversion.
41263c05 4573
459e9b03
ST
45742010-01-14 Sriraman Tallam <tmsriram@google.com>
4575
4576 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4577 in the first pass of do_layout.
4578
b521dfe4
DK
45792010-01-13 Doug Kwan <dougkwan@google.com>
4580
4581 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4582 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4583 apparent compiler problem of not folding static constant integral
4584 data members of elfcpp::Elf_sizes<32>.
4585
44272192
DK
45862010-01-13 Doug Kwan <dougkwan@google.com>
4587
4588 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4589 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4590 Arm_relobj::scan_section_for_cortex_a8_erratum,
4591 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4592 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4593 sections to scan for relocation stubs into a new method
4594 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4595 relocation and Cortex-A8 stub scanning.
4596 (Target_arm::do_relax): Force stubs to be after stubbed sections
4597 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 4598 the beginning of a new relaxation pass. Update a comment.
44272192
DK
4599 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4600
44b71ece
ILT
46012010-01-12 Ian Lance Taylor <iant@google.com>
4602
4603 * target-reloc.h (visibility_error): New inline function.
4604 (relocate_section): Call visibility_error.
4605 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4606 (MOSTLYCLEANFILES): Likewise.
4607 (protected_4_pic.o, protected_3.err): New targets.
4608 * testsuite/protected_4.cc: New file.
4609
a120bc7f
DK
46102010-01-12 Doug Kwan <dougkwan@google.com>
4611
4612 * arm.cc (Cortex_a8_reloc): New class.
4613 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4614 and cortex_a8_relocs_info_.
4615 (Target_arm::fix_cortex_a8): New method definition.
4616 (Target_arm::Cortex_a8_relocs_info): New type.
4617 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4618 New data member declarations.
4619 (Target_arm::scan_reloc_for_stub): Record information about
4620 relocations for THUMB branches that might be exempted from the
4621 Cortex-A8 workaround.
4622 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4623 at the beginning of a relaxation pass.
4624
20138696
DK
46252010-01-12 Doug Kwan <dougkwan@google.com>
4626
4627 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4628 (Arm_relobj::Mapping_symbol_position,
4629 Arm_reloj::Mapping_symbol_position_less,
4630 Arm_relobj::Mapping_symbols_info): New types.
4631 (Target_arm::is_mapping_symbol_name): New method definition.
4632 (Arm_relobj::do_count_local_symbols): Save information about mapping
4633 symbols.
4634
089d69dc
DK
46352010-01-11 Doug Kwan <dougkwan@google.com>
4636
4637 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4638 Arm_relocate_functions::thumb32_branch_upper,
4639 Arm_relocate_functions::thumb32_branch_lower,
4640 Arm_relocate_functions::thumb32_cond_branch_offset,
4641 Arm_relocate_functions::thumb32_cond_branch_upper,
4642 Arm_relocate_functions::thumb32_cond_branch_lower,
4643 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4644 branch offset encoding.
4645 (Arm_relocate_functions::thumb_branch_common): Use new branch
4646 offset encoding methods to avoid code duplication.
4647 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4648 (Stub_addend_reader::operator()): Use new branch encoding method
4649 to avoid code duplication.
4650
99e5bff2
DK
46512010-01-11 Doug Kwan <dougkwan@google.com>
4652
4653 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4654 (Target_arm::do_finalize_sections): Define special EXIDX section
4655 symbols only if referenced.
4656 * gc.h (Garbage_collection::add_reference): New method.
4657 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4658 code duplication.
4659
98e090bd
ILT
46602010-01-11 Ian Lance Taylor <iant@google.com>
4661
d0a91bd8
ILT
4662 * script.cc (Version_script_info::build_expression_list_lookup):
4663 Change complaing about duplicate wildcard match from error to
4664 warning.
4665
98e090bd
ILT
4666 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4667 of 2009-12-30.
4668 (Version_script_info::Version_script_info): Initialize globs_,
4669 default_version_, default_is_global_, and exact_. Don't
4670 initialize globals_ or locals_.
4671 (Version_script_info::build_lookup_tables): Build local symbols
4672 first.
4673 (Version_script_info::unquote): New function.
4674 (Version_script_info::add_exact_match): New function.
4675 (Version_script_info::build_expression_list_lookup): Remove lookup
4676 parameter. Add is_global parameter. Change all callers. Handle
4677 wildcard pattern specially. Unquote pattern. Call
4678 add_exact_match.
4679 (Version_script_info::get_name_to_match): New function.
4680 (Version_script_info::get_symbol_version): New function.
4681 (Version_script_info::get_symbol_version_helper): Remove.
4682 (Version_script_info::check_unmatched_names): Call unquote.
4683 * script.h (class Version_script_info): Change get_symbol_version
4684 to be non-inline and add is_global parameter; change all callers.
4685 Rewrite symbol_is_local. Update declarations. Define struct
4686 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4687 Remove globals_ and locals_ members. Add exact_, globs_,
4688 default_version_, is_global_.
4689 (Version_script_info::Glob): Remove pattern, add expression and
4690 is_global. Update constructor. Change all callers.
4691 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4692 default version.
4693 (Versions::symbol_section_contents): If a symbol is undefined, or
4694 defined in a dynamic object, set the version index to
4695 VER_NDX_LOCAL.
4696 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4697 symbol_is_local.
4698 (Symbol_table::add_from_pluginobj): Likewise.
4699 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4700
d56962d3
DK
47012010-01-11 Doug Kwan <dougkwan@google.com>
4702
4703 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4704 (incremental_dump_LDADD): Add linking option for libintl.
4705 * Makefile.in: Regenerate.
4706
94e6ee91
L
47072010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4708
4709 PR gold/11144
4710 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4711 instead of -Ds.
4712 * testsuite/Makefile.in: Regenerated.
4713
e96c574b
DK
47142010-01-10 Doug Kwan <dougkwan@google.com>
4715
4716 * options.h (DEFINE_var): Use parentheses around argument varname__
4717 in macro body to avoid any unintended subsequent substitutions.
4718
7198066b
ILT
47192010-01-10 Ian Lance Taylor <iant@google.com>
4720
ba4d53bf
ILT
4721 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4722 candidates before doing symbol resolution.
4723
7198066b
ILT
4724 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4725 ODR candidates if only one is weak.
4726
a2beed37
ILT
47272010-01-08 Ian Lance Taylor <iant@google.com>
4728
4729 * script.cc (Version_script_info::build_expression_list_lookup):
4730 Don't warn about ambiguous version, just record the ambiguity.
4731 (Version_script_info::get_symbol_version_helper): Give error if
4732 version is ambiguous.
4733
2fb7225c
DK
47342010-01-08 Doug Kwan <dougkwan@google.com>
4735
4736 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4737 prev_data_size_ and prev_addralign_. Remove initializer for
4738 deleted data member has_been_changed_.
4739 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4740 to determine if the table is empty.
4741 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4742 Remove.
4743 (Stub_table::add_reloc_stub): Define method in class definition
4744 instead of just declaring it there.
4745 (Stub_table::add_cortex_a8_stub): New method definition.
4746 (Stub_table::update_data_size_and_addralign): Ditto.
4747 (Stub_table::finalize_stubs): Ditto.
4748 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4749 (Stub_table::do_addralign_): Return address alignment in the
4750 (Stub_table::do_reset_address_and_file_offset): Define method in
4751 class definition instead of declaring it there. Set current data
4752 size to be the data size of the previous pass.
4753 (Stub_table::set_final_data_size): Use current data size as the
4754 final data size.
4755 (Stub_table::relocate_stub): Change parameter type of stub from
4756 Reloc_stub pointer to Stub pointer.
4757 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4758 (Stub_table::Cortex_a8_stub_list): New typedef.
4759 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4760 Stub_table::prev_addralign_): New data member.
4761 (Arm_relobj::Arm_relobj): Initialize data member
4762 section_has_cortex_a8_workaround_.
4763 (Arm_relobj::section_has_cortex_a8_workaround,
4764 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4765 definitions.
4766 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4767 declarations.
4768 (Target_arm::relocate_stub): Change parameter type of stub from
4769 Reloc_stub pointer to Stub pointer.
4770 (Insn_template::size, Insn_template::alignment): Handle
4771 THUMB16_SPECIAL_TYPE.
4772 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4773 Stub_table::update_data_size_and_addralign,
4774 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4775 definitions.
4776 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4777 (Stub_table::do_write): Ditto.
4778 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4779
880cd20d
ILT
47802010-01-08 Ian Lance Taylor <iant@google.com>
4781
4782 PR 11108
4783 * symtab.h (class Symbol): Remove fields is_target_special_ and
4784 has_plt_offset_. Add field is_defined_in_discarded_section_.
4785 (Symbol::is_defined_in_discarded_section): New function.
4786 (Symbol::set_is_defined_in_discarded_section): New function.
4787 (Symbol::has_plt_offset): Rewrite.
4788 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4789 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4790 Don't initialize is_target_special_ or has_plt_offset_.
4791 Initialize is_defined_in_discarded_section_.
4792 (Symbol_table::add_from_relobj): If appropriate, set
4793 is_defined_in_discarded_section.
4794 * resolve.cc (Symbol::override_base_with_special): Don't test
4795 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4796 * target-reloc.h (relocate_section): Do special handling for
4797 symbols defined in discarded sections for global symbols as well
4798 as local symbols.
4799
2703e3eb
ILT
48002010-01-08 Ian Lance Taylor <iant@google.com>
4801
4802 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4803 the SHT_SYMTAB case.
4804
339d40a3
ILT
48052010-01-08 Ian Lance Taylor <iant@google.com>
4806
4807 * object.cc (Sized_relobj::do_layout): Don't get confused if
4808 layout_eh_frame returns NULL.
4809
abecea76
ILT
48102010-01-08 Ian Lance Taylor <iant@google.com>
4811
4812 PR 11084
4813 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4814 dynamic symbol table, use the normal symbol table.
4815 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4816 symbol table.
4817
6b7dd3f3
ILT
48182010-01-08 Ian Lance Taylor <iant@google.com>
4819
4820 PR 11072
4821 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4822 sections.
4823
36c50e63
L
48242010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4825
4826 * version.cc (print_version): Change to "Copyright 2010".
4827
e291e7b9
ILT
48282010-01-08 Ian Lance Taylor <iant@google.com>
4829
4830 PR 10287
4831 PR 11063
4832 * i386.cc (class Target_i386): Change return type of plt_section
4833 to be non-const.
4834 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4835 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4836 tls_desc_rel_ field.
4837 (Output_data_plt_i386::rel_tls_desc): New function.
4838 (Target_i386::rel_tls_desc_section): New function.
4839 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4840 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4841 R_386_TLS_DESC reloc in rel_tls_desc_section.
4842 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4843 Define struct Tlsdesc_info.
4844 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4845 (Target_x86_64::do_reloc_symbol_index): New function.
4846 (Target_x86_64::add_tlsdesc_info): New function.
4847 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4848 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4849 tlsdesc_rel_ field.
4850 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4851 all callers.
4852 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4853 (Target_x86_64::rela_tlsdesc_section): New function.
4854 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4855 handling.
4856 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4857 (Target_x86_64::do_reloc_addend): New function.
4858 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4859 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4860 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4861 (Output_reloc::type): New function.
4862 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4863 (Output_reloc::is_target_specific): New function.
4864 (Output_reloc::target_arg): New function.
4865 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4866 absolute relocs and target specific relocs.
4867 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4868 add_target_specific.
4869 (class Output_data_reloc) [SHT_RELA]: Likewise.
4870 * output.cc (Output_reloc::Output_reloc): Add four new versions
4871 for absolute relocs and target specific relocs.
4872 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4873 (Output_reloc::get_symbol_index): Likewise.
4874 (Output_reloc::local_section_offset): Check that local_sym_index_
4875 is not TARGET_CODE or 0.
4876 (Output_reloc::symbol_value): Likewise.
4877 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4878 reloc.
4879 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4880 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4881 functions.
4882 * layout.cc (add_target_dynamic_tags): Use output section for
4883 DT_PLTRELSZ and DT_JMPREL.
4884
3a44184e
ILT
48852010-01-07 Ian Lance Taylor <iant@google.com>
4886
4887 PR 11061
4888 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4889 function.
4890 (class Output_data_reloc_generic): Define.
4891 (class Output_data_reloc_base): Change base class to
4892 Output_data_reloc_generic. Change add() method to call
4893 bump_relative_reloc_count for a relative reloc. Remove
4894 sort_relocs_ field.
4895 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4896 to sort_relocs().
4897 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4898 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4899 appropriate.
4900 * layout.h (class Layout): Update declaration.
4901
ea715a34
ILT
49022010-01-07 Ian Lance Taylor <iant@google.com>
4903
4904 * output.h (class Output_data): Add const version of
4905 output_section and do_output_section.
4906 (class Output_section_data): Add const version of
4907 do_output_section.
4908 (class Output_section): Likewise.
4909 * layout.cc (Layout::add_target_dynamic_tags): New function.
4910 * layout.h (class Layout): Update declarations.
4911 * arm.cc (Target_arm::do_finalize_sections): Use
4912 add_target_dynamic_tags.
4913 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4914 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4915 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4916 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4917
659948a4
ILT
49182010-01-07 Ian Lance Taylor <iant@google.com>
4919
4920 PR 11042
4921 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4922 object as needed.
4923
9d3b86f6
ILT
49242010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4925 Ian Lance Taylor <iant@google.com>
4926
4927 PR 11019
4928 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4929 Xindex::read_symtab_xindex.
4930
bb0d3eb0
DK
49312010-01-07 Doug Kwan <dougkwan@google.com>
4932
4933 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4934 (Insn_template::thumb16_bcond_insn): New method declaration.
4935 (Insn_template): Fix spelling.
4936 (Stub::thumb16_special): New method declaration.
4937 (Stub::do_write): Define virtual method which was previously pure
4938 virtual.
4939 (Stub::do_thumb16_special): New method declaration.
4940 (Stub::do_fixed_endian_write): New template member.
4941 (Reloc_stub::do_write): Remove.
4942 (Reloc_stub::do_fixed_endian_write): Remove.
4943 (Cortex_a8_stub): New class definition.
4944 (Stub_factory::make_cortex_a8_stub): New method definition.
4945 (Stub_factory::Stub_factory): Add missing static storage class
4946 qualifier for elf32_arm_stub_a8_veneer_blx.
4947
ffeef7df
ILT
49482010-01-07 Ian Lance Taylor <iant@google.com>
4949
dc3f80fe
ILT
4950 PR 10980
4951 * options.h (class General_options): Add --warn-unresolved-symbols
4952 and --error-unresolved-symbols.
4953 * errors.cc (Errors::undefined_symbol): Implement
4954 --warn-unresolved-symbols.
4955
ffeef7df
ILT
4956 * options.h (class General_options): Add -z text and -z textoff.
4957 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4958
f1ec9ded
ST
49592010-01-06 Sriraman Tallam <tmsriram@google.com>
4960
4961 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4962 (Garbage_collection::cident_sections): New function.
4963 (Garbage_collection::add_cident_section): New function.
4964 (Garbage_collection::cident_sections_): New member.
4965 (gc_process_relocs): Add references to sections whose names are C
4966 identifiers.
4967 * gold.h (cident_section_start_prefix): New constant.
4968 (cident_section_stop_prefix): New constant.
4969 (is_cident): New function.
4970 * layout.cc (Layout::define_section_symbols): Replace string constants
4971 with the newly defined constants.
4972 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4973 C identifiers.
4974 * testsuite/Makefile.am: Add gc_orphan_section_test.
4975 * testsuite/Makefile.in: Regenerate.
4976 * testsuite/gc_orphan_section_test.cc: New file.
4977 * testsuite/gc_orphan_section_test.sh: New file.
4978
6eda8c29
ILT
49792010-01-06 Ian Lance Taylor <iant@google.com>
4980
b9674e17
ILT
4981 PR 10980
4982 * options.h (class General_options): Add --warn-shared-textrel.
4983 * layout.cc (Layout::finish_dynamic_section): Implement
4984 --warn-shared-textrel.
4985
6eda8c29
ILT
4986 PR 10980
4987 * options.h (class General_options): Add --warn-multiple-gp.
4988
32dcd44e
ILT
49892010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4990
4991 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4992 $(THREADSLIB) and $(LIBDL).
4993 * Makefile.in: Rebuild.
4994
a192ba05
ILT
49952010-01-06 Ian Lance Taylor <iant@google.com>
4996
4997 PR 10980
4998 * options.cc (General_options::parse_section_start): New function.
4999 (General_options::section_start): New function.
5000 (General_options::General_options): Initialize all members.
5001 * options.h: Include <map>
5002 (class General_options): Add --section-start. Add section_starts_
5003 member.
5004 * layout.cc (Layout::attach_allocated_section_to_segment): If
5005 --section-start was used, set the address of the segment. Remove
5006 local sort_sections.
5007 (Layout::relaxation_loop_body): If the address of the load segment
5008 has been set by --section-start, don't use it.
5009 * output.h (Output_segment::update_flags_for_output_section): New
5010 function.
5011 * output.cc (Output_segment::add_output_section): Call
5012 update_flags_for_output_section.
5013
dde3f402
ILT
50142010-01-05 Ian Lance Taylor <iant@google.com>
5015
62dfdd4d
ILT
5016 PR 10980
5017 * options.h (class General_options): Add --undefined-version.
5018 * script.cc (struct Version_expression): Add was_matched_by_symbol
5019 field.
5020 (Version_script_info::matched_symbol): New function.
5021 (Version_script_info::get_symbol_version_helper): Call
5022 matched_symbol.
5023 (Version_script_info::check_unmatched_names): New function.
5024 * script.h (class Version_script_info): Update declarations.
5025 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5026
9c4ae156
ILT
5027 * options.h (class General_options): Use DEFINE_bool_alias for
5028 allow_multiple_definition.
5029 * resolve.cc (Symbol_table::should_override): Don't test
5030 allow_multiple_definition.
5031
dde3f402
ILT
5032 PR 10980
5033 * options.h (class General_options): Add --cref.
5034 * main.cc (main): Print cref table if --cref. Don't close mapfile
5035 until after printing cref table.
5036 * cref.cc: Include "symtab.h".
5037 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5038 (Cref_table_compare::operator()): New function.
5039 (Cref_inputs::gather_cref): New function.
5040 (filecol): New static const.
5041 (Cref_inputs::print_cref): New function.
5042 (Cref::print_cref): New function.
5043 * cref.h: Include <cstdio>.
5044 (class Cref): Update declarations.
5045 * mapfile.h (Mapfile::file): New function.
5046 * object.h (class Object): Define Symbols. Declare virtual
5047 do_get_global_symbols.
5048 (Object::get_global_symbols): New function.
5049 * object.cc (Input_objects::add_object): Pass object to cref_ if
5050 --cref.
5051 (Input_objects::archive_start): Likewise.
5052 (Input_objects::archive_stop): Likewise.
5053 (Input_objects::print_cref): New function.
5054 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5055 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5056 --cref.
5057 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5058 function.
5059 * plugin.h (class Sized_pluginobj): Update declarations.
5060
8781f709
ILT
50612010-01-05 Ian Lance Taylor <iant@google.com>
5062
5063 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5064 to is_default_version. Rename insdef to insdefault.
5065 (Symbol_table::add_from_relobj): Rename def to is_default_version
5066 and local to is_forced_local.
5067 (Symbol_table::add_from_pluginobj): Likewise.
5068 (Symbol_table::add_from_dynobj): Likewise.
5069 (Symbol_table::define_special_symbol): Rename insdef to
5070 insdefault.
5071
fe35d28d
ILT
50722010-01-04 Ian Lance Taylor <iant@google.com>
5073
30bc8c46
ILT
5074 PR 10980
5075 * options.h (class General_options): Add
5076 --allow-multiple-definition and -z muldefs.
5077 * resolve.cc (Symbol_table::should_override): Don't warn about a
5078 multiple symbol definition if --allow-multiple-definition or -z
5079 muldefs.
5080
7eaea549
ILT
5081 PR 10980
5082 * options.h (class General_options): Add --add-needed and
5083 --copy-dt-needed-entries. Tweak --as-needed help entry.
5084 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5085 error if --copy-dt-needed-entries aka --add-needed is used and
5086 would cause a change in behaviour.
5087
fe35d28d
ILT
5088 PR 10980
5089 * options.h (class General_options): Add -G as a short version of
5090 --shared. Add no-op options -assert, -g, and -i.
5091
55a2bb35
ST
50922010-01-04 Sriraman Tallam <tmsriram@google.com>
5093
5094 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5095 check for .text or .gnu.linkonce.t sections.
5096 * icf.cc (Icf::find_identical_sections): Ditto.
5097 Change the detection for mangled function name within the section
5098 name.
5099 * icf.h (is_section_foldable_candidate): New function.
5100
719328e1
ILT
51012009-12-30 Ian Lance Taylor <iant@google.com>
5102
5103 PR 10980
5104 * options.h (class General_options): Permit two dashes with
5105 --retain-symbols-file.
5106
d7bb5745
ILT
51072009-12-30 Ian Lance Taylor <iant@google.com>
5108
403a15dd
ILT
5109 PR 10979
5110 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5111 don't put the file header and segment headers in the text
5112 segment.
5113
eda294df
ILT
5114 PR 10979
5115 * common.cc (Sort_commons::operator()): Stabilize sort when both
5116 entries are NULL.
5117 (Symbol_table::do_allocate_commons_list): When allocating common
5118 symbols, skip a symbol which is no longer common.
5119 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5120 an object before checking its type.
5121 * testsuite/common_test_2.c: New file.
5122 * testsuite/common_test_3.c: New file.
5123 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5124 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5125 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5126 (common_test_2_pic.o, common_test_2.so): New targets.
5127 (common_test_3_pic.o, common_test_3.so): New targets.
5128 * testsuite/Makefile.in: Rebuild.
5129
d7bb5745
ILT
5130 PR 10979
5131 * script.cc (read_input_script): If we see a new SECTIONS clause,
5132 and we have added an input section, give an error.
5133 * layout.h (class Layout): Add have_added_input_section function.
5134 Add have_added_input_section_ field.
5135 * layout.cc (Layout::Layout): Initialize
5136 have_added_input_section_.
5137 (Layout::layout): Set have_added_input_section_.
5138 (Layout::layout_eh_frame): Likewise.
5139
fc59c572
ILT
51402009-12-30 Ian Lance Taylor <iant@google.com>
5141
5142 PR 10931
5143 * options.h (class General_options): Add --sort-common option.
5144 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5145 * common.cc (Sort_common): Add sort_order parameter to
5146 constructor. Add sort_order_ field.
5147 (Sort_commons::operator): Check sort_order_.
5148 (Symbol_table::allocate_commons): Determine the sort order.
5149 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5150 Change all callers.
5151 (Symbol_table::do_allocate_commons_list): Likewise.
5152
1c74fab0
ILT
51532009-12-30 Ian Lance Taylor <iant@google.com>
5154
5155 PR 10916
5156 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5157 symbols from this object, don't change the visibility of an
5158 undefined symbol.
5159 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5160
6affe781
ILT
51612009-12-30 Ian Lance Taylor <iant@google.com>
5162
5163 PR 10861
5164 * script.h (class Version_script_info): Define Language enum.
5165 Update declarations. Define Glob, Exact, and Lookup types. Add
5166 new fields globals_, locals_, and is_finalized_.
5167 * script.cc: Various formatting fixes.
5168 (class Parser_closure): Change language_stack_ from a vector of
5169 std::string to one of Version_script_info::Language. Adjust all
5170 uses accordingly.
5171 (class Lazy_demangler): Remove.
5172 (struct Version_expression): Change language from std::string to
5173 Version_script_info::Language.
5174 (Version_script_info::Version_script_info): New function.
5175 (Version_script_info::~Version_script_info): Don't call clear.
5176 (Version_script_info::finalize): New function.
5177 (Version_script_info::build_lookup_tables): New function.
5178 (Version_script_info::build_expression_list_lookup): New
5179 function.
5180 (Version_script_info::get_symbol_version_helper): Rewrite to use
5181 lookup tables.
5182 (Version_script_info::print_expression_list): Adjust to use
5183 Version_script_info::Language.
5184 (script_push_lex_into_version_mode): Check that the version script
5185 has not been finalized.
5186 (version_script_push_lang): Change language string to
5187 Version_script_info::Language.
5188 * options.cc (Command_line::version_script): New function.
5189 * options.h (class General_options): Add finalize_dynamic_list
5190 function. Change version_script from declaration to definition.
5191 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5192 * testsuite/version_script.map: Remove duplicate def of foo.
5193 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5194 version_script.map.
5195 * testsuite/Makefile.in: Rebuild.
5196
818bf354
ILT
51972009-12-30 Ian Lance Taylor <iant@google.com>
5198
5199 PR 10843
5200 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5201 if the input symbol index is 0, make the output symbol index 0.
5202
ebcc8304
ILT
52032009-12-30 Ian Lance Taylor <iant@google.com>
5204
5205 PR 10670
5206 * options.h (class General_options): Add -x/--discard-all.
5207 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5208 --discard-all. If the local symbol needs a dynamic entry, check
5209 that before handling --discard-locals.
5210
176fe33f
ILT
52112009-12-30 Ian Lance Taylor <iant@google.com>
5212
bb321bb1
ILT
5213 PR 10450
5214 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5215 flags to PF_R.
5216 (Output_segment::add_output_section): Don't change the flags if
5217 the type is PT_TLS.
5218
176fe33f
ILT
5219 PR 10450
5220 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5221 GNU hash table if they need a dynamic value. Otherwise, don't add
5222 them if they are defined in a dynamic object or are forced local.
5223
e8cd95c7
ILT
52242009-12-29 Ian Lance Taylor <iant@google.com>
5225
1b81fb71
ILT
5226 PR 10450
5227 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5228 .gnu.hash table for a 32-bit target.
5229
8d6d383d
ILT
5230 PR 10450
5231 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5232 regular and a dynamic object only needs a dynamic symbol table
5233 entry if it is externally visible.
5234
e785ec03
ILT
5235 PR 10450
5236 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5237 constructor. Add global_offset_table_ field.
5238 (Target_i386::got_section): Set global_offset_table_.
5239 (Target_i386::do_finalize_sections): Set global_offset_table_
5240 size.
5241 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5242 in constructor. Add global_offset_table_ field.
5243 (Target_x86_64::got_section): Set global_offset_table_.
5244 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5245 size.
5246
1a2dff53
ILT
5247 * layout.cc (Layout::Layout): Initialize increase_relro_.
5248 (Layout::get_output_section): Add is_relro, is_last_relro, and
5249 is_first_non_relro parameters. Change all callers.
5250 (Layout::choose_output_section): Likewise.
5251 (Layout::add_output_section_data): Likewise.
5252 (Layout::make_output_section): Likewise.
5253 (Layout::set_segment_offsets): Clear increase_relro when using a
5254 linker script.
5255 * layout.h (class Layout): Add increase_relro method. Add
5256 increase_relro_ field. Update declarations.
5257 * output.cc (Output_section::Output_section): Initialize
5258 is_last_relro_ and is_first_non_relro_.
5259 (Output_segment::add_output_section): Group relro sections is
5260 do_sort is true. Handle is_last_relro and is_first_non_relro.
5261 (Output_segment::maximum_alignment): Remove relro handling.
5262 (Output_segment::set_section_addresses): Add increase_relro
5263 parameter. Change all callers. Add initial alignment to align
5264 relro sections on separate page. Remove old relro handling.
5265 (Output_segment::set_section_list_addresses): Remove in_relro
5266 parameter. Change all callers.
5267 (Output_segment::set_offset): Add increase parameter. Change all
5268 callers. Remove old relro handling.
5269 * output.h (class Output_section): Add new methods: is_last_relro,
5270 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5271 Add is_last_relro_ and is_first_non_relro_ fields.
5272 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5273 Create separate .got.plt section. Call increase_relro.
5274 * x86_64.cc (Target_x86_64::got_section): Likewise.
5275 * testsuite/relro_script_test.t: Add .got.plt.
5276
f0ba79e2
ILT
5277 PR 10450
5278 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5279 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5280 (Layout::finalize): Call set_dynamic_symbol_size.
5281 (Layout::set_dynamic_symbol_size): New function.
5282 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5283 set_dynamic_symbol_size.
5284
e8cd95c7
ILT
5285 PR 10450
5286 * output.h (class Output_section): Add is_entsize_zero_ field.
5287 * output.cc (Output_section::Output_section): Initialize
5288 is_entsize_zero_.
5289 (Output_section::set_entsize): If two different entsizes are
5290 requested, force it to zero.
5291 (Output_section::add_input_section): Set flags for .debug_str
5292 before updating section flags. Set entsize.
5293 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5294 and SHF_STRING if all input sections have those flags.
5295
3e1b9a8a
RÁE
52962009-12-29 Rafael Espindola <espindola@google.com>
5297
5298 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
5299 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5300 reporting.
3e1b9a8a 5301
3dcad376
ST
53022009-12-29 Sriraman Tallam <tmsriram@google.com>
5303
5304 * options.cc (General_options::parse_version): Allow -v to exit
5305 without an error if there is nothing to link.
5306
084e2665
ILT
53072009-12-29 Ian Lance Taylor <iant@google.com>
5308
5309 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5310 using a version of gcc before 4.1.
5311 * configure: Rebuild.
5312
250acde3
CD
53132009-12-28 Chris Demetriou <cgd@google.com>
5314
5315 * attributes.cc (Output_attributes_section_data::do_write): Use
5316 std::vector::front rather than std::vector::data.
5317
99fff23b
ILT
53182009-12-28 Ian Lance Taylor <iant@google.com>
5319
5320 * symtab.h (class Symbol_table): Add enum Defined.
5321 * resolve.cc (Symbol_table::should_override): Add defined
5322 parameter. Change all callers. Test whether object is NULL
5323 before calling a method on it.
5324 (Symbol_table::report_resolve_problem): Add defined parameter.
5325 Change all callers.
5326 (Symbol_table::should_override_with_special): Likewise.
5327 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5328 parameter. Change all callers.
5329 (Symbol_table::do_define_in_output_data): Likewise.
5330 (Symbol_table::define_in_output_segment): Likewise.
5331 (Symbol_table::do_define_in_output_segment): Likewise.
5332 (Symbol_table::define_as_constant): Likewise.
5333 (Symbol_table::do_define_as_constant): Likewise.
5334 * script.h (class Symbol_assignment): Add is_defsym parameter to
5335 constructor; change all callers.
5336 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5337 parameter. Change all callers. Add is_defsym_ field.
5338 (class Parser_closure): Add parsing_defsym parameter to
5339 constructor; change all callers. Add parsing_defsym accessor
5340 function. Add parsing_defsym_ field.
5341
556bd683
ILT
53422009-12-28 Ian Lance Taylor <iant@google.com>
5343
5344 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 5345 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 5346
1782c879
ILT
53472009-12-23 Ian Lance Taylor <iant@google.com>
5348
5349 * i386.cc (Target_i386::do_calls_non_split): Recognize
5350 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
5351 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5352 -fsplit-stack prologue when using %r11.
1782c879 5353
329ca2b1
ST
53542009-12-21 Sriraman Tallam <tmsriram@google.com>
5355
5356 * options.cc (General_options::parse_version): Make -v continue and do
5357 the link like GNU ld does.
5358
d675ff46
RÁE
53592009-12-17 Rafael Avila de Espindola <espindola@google.com>
5360
5361 * Makefile.am (CCFILES): Add timer.cc.
5362 (HFILES): Add timer.h.
5363 * configure.ac: Check for sysconf and times.
5364 * main.cc: include timer.h.
5365 (main): Use Timer instead of get_run_time.
5366 * timer.cc: New.
5367 * timer.h: New.
5368 * workqueue.cc: include timer.h.
5369 (Workqueue::find_and_run_task):
5370 Report user, sys and wall time.
5371 * Makefile.in: Regenerate.
5372 * config.in: Regenerate.
5373 * configure: Regenerate.
5374
d6344fb5
DK
53752009-12-16 Doug Kwan <dougkwan@google.com>
5376
5377 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5378 sections.
5379 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5380 relaxed input sections.
5381 * output.cc (Output_section::find_relaxed_input_section): Change
5382 return type to Output_relaxed_input_section pointer. Adjust code
5383 for new type of relaxed_input_section_map_.
5384 * output.h (Output_section::find_relaxed_input_section): Change
5385 return type to Output_relaxed_input_section pointer.
5386 (Output_section::Output_relaxed_input_section_by_input_section_map):
5387 New type.
5388 (Output_section::relaxed_input_section_map_): Change type to
5389 Output_section::Output_relaxed_input_section_by_input_section_map.
5390 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5391 input section.
5392
0e0d5469
ILT
53932009-12-15 Ian Lance Taylor <iant@google.com>
5394
5395 * layout.cc (Layout::create_shstrtab): Only write out after input
5396 sections if we are compressing debug sections.
5397
0649a889
ILT
53982009-12-15 Ian Lance Taylor <iant@google.com>
5399
5400 * archive.cc (Archive::add_symbols): Only look up a symbol without
5401 a version if there is, in fact, a version.
5402
2ea97941
ILT
54032009-12-14 Ian Lance Taylor <iant@google.com>
5404
5405 Revert -Wshadow changes, all changes from:
5406 2009-12-11 Doug Kwan <dougkwan@google.com>
5407 2009-12-11 Nick Clifton <nickc@redhat.com>
5408 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5409
b0eec2cc
DK
54102009-12-11 Doug Kwan <dougkwan@google.com>
5411
5412 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5413 due to -Wshadow.
5414 * attributes.cc (Object_attribute::size): Ditto.
5415 (Attributes_section_data::size): Ditto.
5416 (Attributes_section_data::Attributes_section_data): Ditto.
5417 (Output_attributes_section_data::do_write): Ditto.
5418 * attributes.h (Object_attribute::set_type): Ditto.
5419 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5420
91d6fa6a
NC
54212009-12-11 Nick Clifton <nickc@redhat.com>
5422
5423 * archive.cc: Fix shadowed variable warnings.
5424 * arm.cc: Likewise.
5425 * compressed_output.cc: Likewise.
5426 * compressed_output.h: Likewise.
5427 * configure: Likewise.
5428 * dwarf_reader.cc: Likewise.
5429 * dynobj.cc: Likewise.
5430 * dynobj.h: Likewise.
5431 * ehframe.cc: Likewise.
5432 * ehframe.h: Likewise.
5433 * errors.cc: Likewise.
5434 * expression.cc: Likewise.
5435 * fileread.cc: Likewise.
5436 * fileread.h: Likewise.
5437 * freebsd.h: Likewise.
5438 * i386.cc: Likewise.
5439 * icf.cc: Likewise.
5440 * incremental.h: Likewise.
5441 * layout.cc: Likewise.
5442 * layout.h: Likewise.
5443 * mapfile.cc: Likewise.
5444 * merge.cc: Likewise.
5445 * merge.h: Likewise.
5446 * object.cc: Likewise.
5447 * object.h: Likewise.
5448 * options.h: Likewise.
5449 * output.cc: Likewise.
5450 * output.h: Likewise.
5451 * parameters.cc: Likewise.
5452 * plugin.cc: Likewise.
5453 * powerpc.cc: Likewise.
5454 * reduced_debug_output.cc: Likewise.
5455 * reduced_debug_output.h: Likewise.
5456 * reloc.cc: Likewise.
5457 * reloc.h: Likewise.
5458 * resolve.cc: Likewise.
5459 * script-sections.cc: Likewise.
5460 * script.cc: Likewise.
5461 * script.h: Likewise.
5462 * sparc.cc: Likewise.
5463 * symtab.cc: Likewise.
5464 * symtab.h: Likewise.
5465 * target-select.cc: Likewise.
5466 * target-select.h: Likewise.
5467 * token.h: Likewise.
5468 * workqueue.cc: Likewise.
5469 * workqueue.h: Likewise.
5470 * x86_64.cc: Likewise.
5471
a0351a69
DK
54722009-12-10 Doug Kwan <dougkwan@google.com>
5473
5474 * arm.cc (attributes.h): New include.
5475 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5476 (Arm_relobj::~Arm_relobj): Delete object pointed by
5477 attributes_section_data_.
5478 (Arm_relobj::attributes_section_data): New method definition.
5479 (Arm_relobj::attributes_section_data_): New data member declaration.
5480 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5481 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5482 attributes_section_data_.
5483 (Arm_dynobj::attributes_section_data): New method definition.
5484 (Arm_dynobj::attributes_section_data_): New data member declaration.
5485 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5486 initialization value of may_use_blx_ to false.
5487 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5488 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5489 object attributes to compute results instead of hard-coding.
5490 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5491 Target_arm::get_secondary_compatible_arch,
5492 Target_arm::set_secondary_compatible_arch
5493 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5494 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5495 New method declarations.
5496 (Target_arm::get_aeabi_object_attribute): New method definition.
5497 (Target_arm::attributes_section_data_): New data member declaration.
5498 (read_arm_attributes_section): New template definition.
5499 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5500 (Arm_dynobj::do_read_symbols): Ditto.
5501 (Target_arm::do_finalize_sections): Merge attributes sections from
5502 input. Check for BLX use after attributes section merging.
5503 Fix __exidx_start and __exidx_end visibility. Create an
5504 .ARM.attributes section if necessary.
5505 (Target_arm::get_secondary_compatible_arch,
5506 Target_arm::set_secondary_compatible_arch,
5507 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5508 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 5509 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
5510 New method definitions.
5511
b59befec
ILT
55122009-12-09 Ian Lance Taylor <iant@google.com>
5513
5514 * plugin.cc (Plugin::load): Don't cast from void* to a function
5515 pointer.
5516
1276bc89
ILT
55172009-12-09 Ian Lance Taylor <iant@google.com>
5518
5519 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5520 information fields.
5521
2f2de248
L
55222009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5523
5524 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5525 Replace two_file_shared_1.so with two_file_shared_2.so.
5526 * testsuite/Makefile.in: Regenerated.
5527
4f787271
DK
55282009-12-08 Doug Kwan <dougkwan@google.com>
5529
5530 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5531 (HFILES): Add attributes.h and int_encoding.h.
5532 * Makefile.in: Regenerate.
5533 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5534 function definitions to int_encoding.cc
5535 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5536 prototypes to int_encoding.h
5537 * reduced_debug_output.cc (int_encoding.h): New include.
5538 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5539 function definitions to int_encoding.cc
5540 (insert_into_vector, read_from_pointer): Move template definitions to
5541 int_encoding.h
5542 * attributes.cc: New file.
5543 * attributes.h: New file.
5544 * int_encoding.cc: New file.
5545 * int_encoding.h: New file.
5546
20b52f1a
RÁE
55472009-12-07 Rafael Avila de Espindola <espindola@google.com>
5548
5549 PR gold/11055
5550 * incremental-dump.cc (dump_incremental_inputs): New.
5551 (main): Use dump_incremental_inputs.
5552
53d7974c
L
55532009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5554
5555 PR gold/10893
5556 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5557 checking elfcpp::STT_FUNC.
5558 (Target_i386::Relocate::relocate): Likewise.
5559 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5560
5561 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5562 symbols from shared libraries into normal FUNC symbols.
5563
5564 * symtab.h (Symbol): Add is_func and use it.
5565
05a352e6
DK
55662009-12-05 Doug Kwan <dougkwan@google.com>
5567
5568 * arm.cc (Target_arm::arm_info): Initialize new fields
5569 attributes_section and attributes_vendor.
5570 * i386.cc (Target_i386::i386_info): Same.
5571 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5572 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5573 fields attributes_section and attributes_vendor.
53d7974c 5574 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
5575 * target.h (Target::attributes_section, Target::attributes_vendor,
5576 Target::is_attributes_section, Target::attribute_arg_type,
5577 Target::attributes_order): New method definitions.
5578 (Target::Target_info::attributes_section,
5579 Target::Target_info::attributes_vendor): New fields.
5580 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5581 virtual method definitions.
5582 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5583 attributes_section and attributes_vendor.
5584 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5585
f4e5969c
DK
55862009-12-05 Doug Kwan <dougkwan@google.com>
5587
5588 * arm.cc: Update comments about interworking and stub generation.
5589 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5590 considered as non-PIC.
5591 (Arm_relocate_functions::base_abs): Fix formatting.
5592 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5593 of function to use GOT entry address instead of offset.
5594 (Target_arm::Scan::global): Issue an error if a symbol would need a
5595 PLT does not get one because it is untyped. Remove code to create
5596 dynamic symbols for relative branches.
5597 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5598 takes unsigned integer instead of boolean.
5599
1abce4a6
L
56002009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5601
5602 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5603 (two_file_test_LDADD): Likewise.
5604 (common_test_1_LDADD): Likewise.
5605 (exception_test_LDADD) Likewise.
5606 (weak_test_LDADD): Likewise.
5607 (many_sections_test_LDADD): Likewise.
5608 (initpri1_LDADD): Likewise.
5609 (script_test_1_LDADD): Likewise.
5610 (script_test_2_LDADD): Likewise.
5611 (justsyms_LDADD): Likewise.
5612 (binary_test_LDADD): Likewise.
5613 (large_LDADD): Likewise.
5614 * testsuite/Makefile.in: Regenerated.
5615
adcf2816 56162009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 5617
adcf2816
L
5618 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5619 (Symbol_table::override_with_special): Likewise.
5620 (Symbol_table::add_from_object): Likewise.
5621
28e67f5d
RÁE
56222009-12-04 Rafael Avila de Espindola <espindola@google.com>
5623
5624 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5625 Don't set the data_offset twice.
5626
ae10a101
RÁE
56272009-12-04 Rafael Avila de Espindola <espindola@google.com>
5628
5629 * testsuite/Makefile.in: Regenerate.
5630
f59f41f3
DK
56312009-12-03 Doug Kwan <dougkwan@google.com>
5632
5633 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5634 (Target_arm::do_finalize_sections): Add parameter for symbol table
5635 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5636 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5637 parameter for symbol table pointer.
5638 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5639 an additional parameter for a pointer to symbol table.
5640 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5641 parameter for a symbol table pointer.
5642 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5643 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5644 Ditto.
5645 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5646 parameter for a symbol table pointer.
5647
ca55d848
RÁE
56482009-12-03 Rafael Avila de Espindola <espindola@google.com>
5649
5650 * incremental.cc (Incremental_inputs_header)
5651 (Incremental_inputs_header_write, Incremental_inputs_entry)
5652 (Incremental_inputs_entry_write): Move ...
5653 * incremental.h (Incremental_inputs_header)
5654 (Incremental_inputs_header_write, Incremental_inputs_entry)
5655 (Incremental_inputs_entry_write): here.
5656
3aec4f9c
RÁE
56572009-12-02 Rafael Avila de Espindola <espindola@google.com>
5658
5659 * incremental.cc (make_sized_incremental_binary): Set the target.
5660 Error if it is incompatible.
5661 * output.h (Output_file): Add filename method.
5662
9c0ae74d
RÁE
56632009-12-02 Rafael Avila de Espindola <espindola@google.com>
5664
5665 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5666 from the get_* methods.
5667
a45500ae
RÁE
56682009-12-02 Rafael Avila de Espindola <espindola@google.com>
5669
5670 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5671 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5672 Write 0 for the data_offset of scripts.
5673
325e6408
RÁE
56742009-12-02 Rafael Avila de Espindola <espindola@google.com>
5675
5676 * testsuite/Makefile.am: Add the incremental_test.sh test.
5677 * testsuite/incremental_test.sh: New.
5678 * testsuite/incremental_test_1.c: New.
5679 * testsuite/incremental_test_2.c: New.
5680
954c3e2e
RÁE
56812009-12-01 Rafael Avila de Espindola <espindola@google.com>
5682
5683 * incremental-dump.cc (main): Fix typos.
5684
f8086623
RÁE
56852009-11-27 Rafael Avila de Espindola <espindola@google.com>
5686
5687 PR gold/11025
5688 * incremental-dump.cc (main): Use llu to print 64 bit values.
5689
3b0dd6ac
L
56902009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5691 H.J. Lu <hongjiu.lu@intel.com>
5692
5693 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5694 $(LIBDL).
5695 (incremental_dump_LDADD): Likewise.
5696 * Makefile.in: Regenerated.
5697
a6d1ef57 56982009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 5699
a6d1ef57
DK
5700 Revert:
5701
5702 2009-11-25 Doug Kwan <dougkwan@google.com>
5703
5704 * arm.cc (Target_arm::Target_arm): Move method definition
5705 outside of class definition. Add code to handle
5706 --target1-rel, --target1-abs and --target2= options.
5707 (Target_arm::get_reloc_reloc_type): Change method to be
5708 non-static and const.
5709 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5710 New data member declaration.
5711 (Target_arm::Scan::local, Target_arm::Scan::global,
5712 Target_arm::Relocate::relocate,
5713 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5714 Adjust call to Target_arm::get_real_reloc_type.
5715 (Target_arm::get_real_reloc_type): Use command line options
5716 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5717 * options.h (--target1-rel, --target1-abs, --target2): New
5718 ARM-only options.
5719
50aeb7d4
DK
57202009-11-25 Doug Kwan <dougkwan@google.com>
5721
5722 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5723 class definition. Add code to handle --target1-rel, --target1-abs
5724 and --target2= options.
5725 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5726 and const.
5727 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5728 member declaration.
5729 (Target_arm::Scan::local, Target_arm::Scan::global,
5730 Target_arm::Relocate::relocate,
5731 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5732 call to Target_arm::get_real_reloc_type.
5733 (Target_arm::get_real_reloc_type): Use command line options to
5734 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5735 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5736 options.
5737
51938283
DK
57382009-11-25 Doug Kwan <dougkwan@google.com>
5739
5740 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5741 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5742 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5743 formatting.
5744 (Arm_relocate_functions::thm_call): Replace body with a call to
5745 Arm_relocate_functions::thumb_branch_common.
5746 (Arm_relocate_functions::thm_jump24,
5747 Arm_relocate_functions::thm_xpc22): New method definitions.
5748 (Arm_relocate_functions::thumb_branch_common): New method definition.
5749 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5750 operator.
5751 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5752 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5753
e2b8f3c4
RÁE
57542009-11-24 Rafael Avila de Espindola <espindola@google.com>
5755
5756 * Makefile.am: Build incremental-dump
5757 * Makefile.in: Regenerate.
5758 * incremental-dump.cc: New.
5759 * incremental.cc (Incremental_inputs_header_data,
5760 Incremental_inputs_entry_data): Move to incremental.h
5761 * incremental.h: (Incremental_inputs_header_data,
5762 Incremental_inputs_entry_data): Move from incremental.cc
5763
bcba9aec
RÁE
57642009-11-24 Rafael Avila de Espindola <espindola@google.com>
5765
5766 * incremental.cc (Incremental_inputs_header,
5767 Incremental_inputs_header_write, Incremental_inputs_entry,
5768 Incremental_inputs_entry_write): Add a typedef with the data type.
5769
7c3afe08
RÁE
57702009-11-24 Rafael Avila de Espindola <espindola@google.com>
5771
5772 * incremental.cc (Incremental_inputs_header,
5773 Incremental_inputs_header_write, Incremental_inputs_entry,
5774 Incremental_inputs_entry_write): Update comment about which
5775 type has the filed descriptions.
5776
d204b6e9
DK
57772009-11-15 Doug Kwan <dougkwan@google.com>
5778
5779 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5780 (Arm_relocate_functions::arm_branch_common): Change method defintion
5781 in class definition to a method declaration and update list of formal
5782 parameters.
5783 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5784 Arm_relocation_functions::jump24): Adjust call to
5785 Arm_relocate_functions::arm_branch_common. Update list of formal
5786 parameters.
5787 (Arm_relocate_functions::xpc25): New method definition.
5788 (Arm_relocate_functions::arm_branch_common): Move method defintion
5789 out from class definition. Use stubs for mode-switching and extending
5790 branch ranges.
5791 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5792 specially. Change code to enable use of stubs in ARM branches.
5793
43d12afe
DK
57942009-11-10 Doug Kwan <dougkwan@google.com>
5795
5796 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5797 in method declaration.
5798 (Target_arm::relocate_stub): New method declaration.
5799 (Target_arm::default_target): Change to return a pointer instead of
5800 a const reference.
5801 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5802 Target_arm::default_target.
5803 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5804 method definition.
5805 (Target_arm::relocate_section): Adjust view.
5806 (Target_arm::relocate_stub): New method definition.
5807
ac33a407
DK
58082009-11-10 Doug Kwan <dougkwan@google.com>
5809
5810 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5811 a format warning.
5812 * incremental.cc (open_incremental_binary): Initialized local
5813 variables to avoid warnings.
5814 * object.cc (make_elf_object): Ditto.
5815 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5816 a format warning.
e1df38aa 5817
88ee28e9
L
5818009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5819
5820 PR gold/10930
5821 * testsuite/plugin_test.c: Include "config.h".
5822
2daedcd6
DK
58232009-11-09 Doug Kwan <dougkwan@google.com>
5824
5825 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5826 (arm_symbol_value): Remove.
5827 (Arm_relocate_functions::arm_branch_common,
5828 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5829 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5830 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5831 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5832 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5833 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5834 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5835 Arm_relocate_functions::thm_mobw_abs_nc,
5836 Arm_relocate_functions::thm_mov_abs,
5837 Arm_relocate_functions::movw_prel_nc,
5838 Arm_relocate_functions::thm_movt_abs,
5839 Arm_relocate_functions::movt_prel,
5840 Arm_relocate_functions::thm_movw_prel_nc,
5841 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5842 (Target_arm::Relocate::relocate): Only decompose address into two
5843 parts if relocation type uses the thumb-bit and pass the actual
5844 bit instead of a flag indicating that the thumb-bit is used. Adjust
5845 calls to methods in Arm_relocate_functions for this change.
5846
1276bc89 58472009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
5848
5849 PR 10925
5850 * reloc.cc: Instantiate
5851 Sized_relobj::initialize_input_to_output_maps and
5852 Sized_relobj:free_input_to_output_maps.
5853
e53ad1b5
ILT
58542009-11-06 Ian Lance Taylor <iant@google.com>
5855
5856 PR 10876
5857 * defstd.cc (in_segment): Set only_if_ref true for "end".
5858
eb44217c
DK
58592009-11-06 Doug Kwan <dougkwan@google.com>
5860
5861 * arm.cc (class Reloc_stub): Correct a comment.
5862 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5863 (Target_arm::scan_section_for_stubs): New method declaration.
5864 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5865 Change methods from private to protected.
5866 (Target_arm::do_may_relax): New method definition.
5867 (Target_arm::do_relax, Target_arm::group_sections,
5868 Target_arm::scan_reloc_for_stub,
5869 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5870 (Target_arm::arm_input_section_map_): New data member declaration.
5871 (Target_arm::scan_reloc_for_stub,
5872 Target_arm::scan_reloc_section_for_stubs,
5873 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5874 Target_arm::do_relax): New method definitions.
5875
5d329b7d
ILT
58762009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5877
5878 * configure.ac: Check for (struct stat)::st_mtim
5879 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5880 * config.in: Regenerate.
5881 * configure: Regenerate.
5882
96a0d71b
ILT
58832009-11-05 Ian Lance Taylor <iant@google.com>
5884
5885 PR 10910
5886 * output.cc (Output_segment::add_output_section): Add missing
5887 return statement.
5888
594c8e5e
ILT
58892009-11-04 Ian Lance Taylor <iant@google.com>
5890
5891 PR 10880
5892 * object.h (class Object): Add is_needed and set_is_needed
5893 methods. Add is_needed_ field. Make bool fields into bitfields.
5894 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5895 defined in a dynamic object and referenced by a regular object,
5896 set is_needed for the dynamic object.
5897 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5898 if the file is marked with as_needed and it is not needed.
5899
22b127cc
ILT
59002009-11-04 Ian Lance Taylor <iant@google.com>
5901
5902 PR 10887
5903 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5904 tags if data is discarded by linker script.
5905 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5906 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5907 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5908 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5909
f5c870d2
ILT
59102009-11-04 Ian Lance Taylor <iant@google.com>
5911
5912 * layout.cc (Layout::get_output_section): Add is_interp and
5913 is_dynamic_linker_section parameters. Change all callers.
5914 (Layout::choose_output_section): Likewise.
5915 (Layout::make_output_section): Likewise.
5916 (Layout::add_output_section_data): Add is_dynamic_linker_section
5917 parameter. Change all callers.
5918 * layout.h (class Layout): Update declarations.
5919 * output.h (class Output_section): Add is_interp, set_is_interp,
5920 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5921 Add is_interp_, is_dynamic_linker_section_ fields. Change
5922 generate_code_fills_at_write_ to a bitfield.
5923 * output.cc (Output_section::Output_sections): Initialize new
5924 fields.
5925 (Output_segment::add_output_section): Add do_sort parameter.
5926 Change all callers.
5927
1ae4d23b
ILT
59282009-11-03 Ian Lance Taylor <iant@google.com>
5929
5930 PR 10860
5931 * options.h (class General_options): Add --warn-common.
5932 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5933 merging two common symbols.
5934 (Symbol_table::should_override): Handle --warn-common when merging
5935 a common symbol with a defined symbol. Use report_resolve_problem
5936 for multiple definitions.
5937 (Symbol_table::report_resolve_problem): New function.
5938 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5939
55da9579
DK
59402009-11-03 Doug Kwan <dougkwan@google.com>
5941
5942 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5943 stub_factory_.
5944 (Target_arm::stub_factory): New method definition.
5945 (Target_arm::new_arm_input_section,
5946 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5947 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 5948 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
5949 New type definitions.
5950 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5951 member declarations.
5952 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5953 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5954 New method definitions.
5955
37a9ac43
ILT
59562009-11-03 Ian Lance Taylor <iant@google.com>
5957
5958 * options.h (class General_options): Add --warn_constructors.
5959
b3d6a3d4
ILT
59602009-11-03 Ian Lance Taylor <iant@google.com>
5961
5962 PR 10893
5963 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5964 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5965
934b01dd
ILT
59662009-11-03 Ian Lance Taylor <iant@google.com>
5967
5968 PR 10895
5969 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5970 --msgid-bugs-address.
5971 (install-pdf): New target.
5972 (install-data_yes): Look up one directory to find mkinstalldirs.
5973
03c1939b
L
59742009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5975
5976 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5977 tree.
5978
ebd95253
DK
59792009-10-30 Doug Kwan <dougkwan@google.com>
5980
5981 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5982
e9bbb538
DK
59832009-10-30 Doug Kwan <dougkwan@google.com>
5984
5985 * arm.cc (Stub_addend_reader): New struct template definition
5986 and partial specializations.
5987 (Stub_addend_reader::operator()): New method definition for a
5988 partially specialized template.
5989
d5b40221
DK
59902009-10-30 Doug Kwan <dougkwan@google.com>
5991
5992 * arm.cc (Arm_relobj::processor_specific_flags): New method
5993 definition.
5994 (Arm_relobj::do_read_symbols): New method declaration.
5995 (Arm_relobj::processor_specific_flags_): New data member declaration.
5996 (Arm_dynobj): New class definition.
5997 (Target_arm::do_finalize_sections): Add input_objects parameter.
5998 (Target_arm::do_adjust_elf_header): New method declaration.
5999 (Target_arm::are_eabi_versions_compatible,
6000 (Target_arm::merge_processor_specific_flags): New method declaration.
6001 (Target_arm::do_make_elf_object): New overloaded method definitions
6002 and declaration.
6003 (Arm_relobj::do_read_symbols): New method definition.
6004 (Arm_dynobj::do_read_symbols): Ditto.
6005 (Target_arm::do_finalize_sections): Add input_objects parameters.
6006 Merge processor-specific flags from all input objects.
6007 (Target_arm::are_eabi_versions_compatible,
6008 Target_arm::merge_processor_specific_flags,
6009 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6010 New method definitions.
6011 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6012 Input_objects pointer type parameter.
6013 * layout.cc (Layout::finalize): Pass input objects to target's.
6014 finalize_sections function.
6015 * output.cc (Output_file_header::do_sized_write): Set ELF file
6016 header's processor-specific flags.
6017 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6018 Input_objects pointer type parameter.
6019 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6020 * target.h (Input_objects): New forward class declaration.
6021 (Target::processor_specific_flags,
6022 Target::are_processor_specific_flags_sect): New method definitions.
6023 (Target::finalize_sections): Add input_objects parameter.
6024 (Target::Target): Initialize processor_specific_flags_ and
6025 are_processor_specific_flags_set_.
6026 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6027 parameter.
6028 (Target::set_processor_specific_flags): New method definition.
6029 (Target::processor_specific_flags_,
6030 Target::are_processor_specific_flags_set_): New data member
6031 declarations.
6032 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6033 Input_objects pointer type parameter.
6034
ebabffbd
DK
60352009-10-30 Doug Kwan <dougkwan@google.com>
6036
6037 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6038
ad0f2072
ILT
60392009-10-28 Ian Lance Taylor <iant@google.com>
6040
6041 * object.h (class Relobj): Drop options parameter from
6042 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6043 do_scan_relocs, do_relocate. Change all callers.
6044 (class Sized_relobj): Drop options parameters from
6045 do_gc_process_relocs, do_scan_relocs, do_relocate,
6046 do_relocate_sections, relocate_sections, emit_relocs_scan,
6047 emit_relocs_scan_reltype. Change all callers.
6048 (struct Relocate_info): Remove options field and all references to
6049 it.
6050 * reloc.h (class Read_relocs): Remove options constructor
6051 parameter and options_ field. Change all callers.
6052 (class Gc_process_relocs, class Scan_relocs): Likewise.
6053 (class Relocate_task): Likewise.
6054 * target-reloc.h (scan_relocs): Remove options parameter. Change
6055 all callers.
6056 (scan_relocatable_relocs): Likewise.
6057 * target.h (class Sized_target): Remove options parameter from
6058 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6059 all callers.
6060 * gc.h (gc_process_relocs): Remove options parameter. Change all
6061 callers.
6062 * arm.cc: Update functions to remove options parameters.
6063 * i386.cc: Likewise.
6064 * powerpc.cc: Likewise.
6065 * sparc.cc: Likewise.
6066 * x86_64.cc: Likewise.
6067 * testsuite/testfile.cc: Likewise.
6068
8ffa3667
DK
60692009-10-28 Doug Kwan <dougkwan@google.com>
6070
6071 * arm.cc (Arm_relobj): New class definition.
e1df38aa 6072 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
6073 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6074 New method definitions.
6075
40f36857
CC
60762009-10-28 Cary Coutant <ccoutant@google.com>
6077
6078 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6079 (Plugin::cleanup_done_): New member.
6080 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6081 (Plugin_manager::cleanup_done_): Remove.
6082 (Plugin_manager::add_input_file): Edit error message.
6083 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6084 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6085
2c849493
ILT
60862009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6087
6088 * fileread.cc: (File_read::View::~View): Use the new
6089 data_ownership_ filed.
6090 (File_read::~File_read): Dispose the new whole_file_view_.
6091 (File_read::open): Mmap the whole file if needed.
6092 (File_read::open): Use whole_file_view_ instead of contents_.
6093 (File_read::find_view): Use whole_file_view_ if applicable.
6094 (File_read::do_read): Use whole_file_view_ instead of contents_.
6095 (File_read::make_view): Use whole_file_view_ instead of contents_,
6096 update File_read::View::View call.
6097 (File_read::find_or_make_view): Update File_read::View::View
6098 call.
6099 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6100 remove contents_
6101 (File_read::View::Data_ownership): New enum.
6102 (File_read::View::View): Replace bool mapped_ with Data_ownership
6103 argument.
6104 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6105 (File_read::View::data_ownership_): New field.
6106 (File_read::contents_): Remove (replaced by whole_file_view_).
6107 (File_read::whole_file_view_): New field.
6108 * options.h (class General_options): Add --keep-files-mapped.
6109
24998053
CC
61102009-10-27 Cary Coutant <ccoutant@google.com>
6111
6112 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6113 * testsuite/Makefile.am (plugin_test_5): New test case.
6114 * testsuite/Makefile.in: Regenerate.
6115
72adc4fa
DK
61162009-10-25 Doug Kwan <dougkwan@google.com>
6117
6118 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6119 from private to protected to allow access by child class.
6120 (Sized_relobj::do_relocate_sections): New method declaration.
6121 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 6122 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
6123 Sized_relobj::relocate_sections. Instantiate template explicitly
6124 for different target sizes and endianity.
6125
07f508a2
DK
61262009-10-24 Doug Kwan <dougkwan@google.com>
6127
6128 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6129 (Arm_input_section::as_arm_input_section): New method.
6130 (Arm_output_section): New class definition.
6131 (Arm_output_section::create_stub_group,
6132 Arm_output_section::group_sections): New method definitions.
6133
10ad9fe5
DK
61342009-10-22 Doug Kwan <dougkwan@google.com>
6135
6136 * arm.cc (Arm_input_section): New class definition.
6137 (Arm_input_section::init, Arm_input_section:do_write,
6138 Arm_input_section::set_final_data_size,
6139 Arm_input_section::do_reset_address_and_file_offset): New method
6140 definitions.
6141
56ee5e00
DK
61422009-10-21 Doug Kwan <dougkwan@google.com>
6143
6144 * arm.cc (Stub_table, Arm_input_section): New forward class
6145 declarations.
6146 (Stub_table): New class defintion.
6147 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6148 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6149 New method definition.
6150
b569affa
DK
61512009-10-21 Doug Kwan <dougkwan@google.com>
6152
6153 * arm.cc: Update copyright comments.
6154 (Target_arm): New forward class template declaration.
6155 (Arm_address): New type.
6156 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6157 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6158 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6159 constants.
6160 (Insn_template): Same.
6161 (DEF_STUBS): New macro.
6162 (Stub_type): New enum type.
6163 (Stub_template): New class definition.
6164 (Stub): Same.
6165 (Reloc_stub): Same.
6166 (Stub_factory): Same.
6167 (Target_arm::Target_arm): Initialize may_use_blx_ and
6168 should_force_pic_veneer_.
6169 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6170 Target_arm::should_force_pic_veneer,
6171 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6172 Target_arm::using_thumb_only, Target_arm:;default_target): New
6173 method defintions.
6174 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6175 New data member declarations.
6176 (Insn_template::size, Insn_template::alignment): New method defintions.
6177 (Stub_template::Stub_template): New method definition.
6178 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6179 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6180 (Stub_factory::Stub_factory): New method definition.
6181 * gold.h (string_hash): New template.
6182 * output.h (Input_section_specifier::hash_value): Use
6183 gold::string_hash.
6184 (Input_section_specifier::string_hash): Remove.
6185 * stringpool.cc (Stringpool_template::string_hash): Use
6186 gold::string_hash.
6187
6c172549
DK
61882009-10-20 Doug Kwan <dougkwan@google.com>
6189
6190 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6191 symbols of relaxed input sections.
6192 * output.h (Output_section::find_relaxed_input_section): Make
6193 method public.
6194
c5617f2f
DK
61952009-10-16 Doug Kwan <dougkwan@google.com>
6196
6197 * dynobj.cc (Versions::Versions): Initialize version_script_.
6198 Only insert base version symbol definition for a shared object
6199 if version script defines any version versions.
6200 (Versions::define_base_version): New method definition.
6201 (Versions::add_def): Check that base version is not needed.
6202 (Versions::add_need): Define base version lazily.
6203 * dynobj.h (Versions::define_base_version): New method declaration.
6204 (Versions::needs_base_version_): New data member declaration.
6205 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6206 (check_DATA): Add no_version_test.stdout.
6207 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6208 New make rules.
6209 * testsuite/Makefile.in: Regenerate.
6210 * testsuite/no_version_test.c: New file.
6211 * testsuite/no_version_test.sh: Ditto.
6212
3c12dcdb
DK
62132009-10-16 Doug Kwan <dougkwan@google.com>
6214
6215 * expression.cc (class Segment_start_expression): New class definition.
6216 (Segment_start_expression::value): New method definition.
6217 (script_exp_function_segment_start): Return a new
6218 Segment_start_expression.
6219 * gold/script-c.h (script_saw_segment_start_expression): New function
6220 prototype.
6221 * script-sections.cc (Script_sections::Script_sections): Initialize
6222 SAW_SEGMENT_START_EXPRESSION_ to false.
6223 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6224 and -Tbbs options to specify section addresses if given in
6225 command line and no SEGMENT_START expression is seen in a script.
6226 * script-sections.h (Script_sections::saw_segment_start_expression,
6227 Script_sections::set_saw_segment_start_expression): New method
6228 definition.
6229 (Script_sections::saw_segment_start_expression_): New data member
6230 declaration.
6231 * script.cc (script_saw_segment_start_expression): New function.
6232 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6233 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6234 script_test_7.sh and script_test_8.sh.
6235 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6236 script_test_8.stdout.
6237 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6238 (script_test_6, script_test_6.stdout, script_test_7,
6239 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6240 * Makefile.in: Regenerate.
6241 * testsuite/script_test_6.sh: New file.
6242 * testsuite/script_test_6.t: Same.
6243 * testsuite/script_test_7.sh: Same.
6244 * testsuite/script_test_7.t: Same.
6245 * testsuite/script_test_8.sh: Same.
6246
64b1ae37
DK
62472009-10-16 Doug Kwan <dougkwan@google.com>
6248
6249 * output.cc (Output_segment::set_section_list_address): Cast
6250 expressions to unsigned long long type to avoid format warnings.
6251
661be1e2
ILT
62522009-10-15 Ian Lance Taylor <iant@google.com>
6253
12edd763 6254 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 6255 dot assignment to script_sections_.
12edd763
ILT
6256 * script-sections.cc (Script_sections::add_dot_assignment):
6257 Initialize if necessary.
6258
68b6574b
ILT
6259 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6260 program headers with no load segment if there is a linker script.
6261
661be1e2
ILT
6262 * layout.cc (Layout::set_segment_offsets): Align the file offset
6263 to the segment aligment for -N or -n with no load segment.
6264 * output.cc (Output_segment::add_output_section): Don't crash if
6265 the first section is a TLS section.
6266 (Output_segment::set_section_list_addresses): Print an error
6267 message if the address moves backward in a linker script.
6268 * script-sections.cc
6269 (Output_section_element_input::set_section_addresses): Don't
6270 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6271 (Orphan_output_section::set_section_addresses): Likewise.
6272
f15f61a7
DK
62732009-10-15 Doug Kwan <dougkwan@google.com>
6274
6275 * layout.cc (Layout::finish_dynamic_section): Generate tags
6276 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6277 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6278 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6279
82bb573a
ILT
62802009-10-14 Ian Lance Taylor <iant@google.com>
6281
6282 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6283 fields.
6284 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6285 data_shdr fields of relinfo.
6286 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6287 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6288 R_386_TLS_LDO_32, adjust based on section flags.
6289 (Target_i386::Relocate::fix_up_ldo): Remove.
6290
374ad285
ILT
62912009-10-13 Ian Lance Taylor <iant@google.com>
6292
6293 Add support for -pie.
6294 * options.h (class General_options): Add -pie and
6295 --pic-executable.
6296 (General_options::output_is_position_independent): Test -pie.
6297 (General_options::output_is_executable): Return true if not shared
6298 and not relocatable.
6299 (General_options::output_is_pie): Remove.
6300 * options.cc (General_options::finalize): Reject incompatible uses
6301 of -pie.
6302 * gold.cc (queue_middle_tasks): A -pie link is not static.
6303 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6304 * symtab.cc (Symbol::final_value_is_known): Return false if
6305 output_is_position_independent.
6306 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6307 output_is_position_independent.
6308 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6309 output_is_position_independent.
6310 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6311 output_is_position_independent.
6312 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6313 two_file_pie_test.
6314 (basic_pie_test.o, basic_pie_test): New targets.
6315 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6316 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6317 (two_file_pie_test): New target.
6318 * testsuite/Makefile.in: Rebuild.
6319 * README: Remove note saying that -pie is not supported.
6320
c6585162
ILT
63212009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6322
6323 * options.h (class General_options): Add -init and -fini.
6324 * layout.cc (Layout::finish_dynamic_section): Emit
6325 given init and fini functions.
6326
032ce4e9
ST
63272009-10-13 Sriraman Tallam <tmsriram@google.com>
6328
6329 * gc.h (gc_process_relocs): Check if icf is enabled using new
6330 function.
6331 * gold.cc (queue_initial_tasks): Likewise.
6332 (queue_middle_tasks): Likewise.
6333 * object.cc (do_layout): Likewise.
6334 * symtab.cc (is_section_folded): Likewise.
6335 * main.cc (main): Likewise.
6336 * reloc.cc (Read_relocs::run): Likewise.
6337 (Sized_relobj::do_scan_relocs): Likewise.
6338 * icf.cc (is_function_ctor_or_dtor): New function.
6339 (Icf::find_identical_sections): Check if function is ctor or dtor when
6340 safe icf is chosen.
6341 * options.h (General_options::icf): Change option to be an enum.
6342 (Icf_status): New enum.
6343 (icf_enabled): New method.
6344 (icf_safe_folding): New method.
6345 (set_icf_status): New method.
6346 (icf_status_): New variable.
6347 * (options.cc) (General_options::finalize): Set icf_status_.
6348 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6349 icf_test and icf_keep_unique_test to use the --icf enum flag.
6350 * testsuite/icf_safe_test.sh: New file.
e1df38aa 6351 * testsuite/icf_safe_test.cc: New file.
032ce4e9 6352
f345227a
ST
63532009-10-12 Sriraman Tallam <tmsriram@google.com>
6354
6355 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6356 includes to gc.h and icf.h.
6357 * arm.cc: Include gc.h.
6358 * gold.cc: Likewise.
6359 * i386.cc: Likewise.
6360 * powerpc.cc: Likewise.
6361 * sparc.cc: Likewise.
6362 * x86_64.cc: Likewise.
6363 * gc.h: Include icf.h.
6364
1c7814ed
ILT
63652009-10-11 Ian Lance Taylor <iant@google.com>
6366
6367 * plugin.cc: Include "gold.h" before other header files.
6368
ae3b5189
CD
63692009-10-10 Chris Demetriou <cgd@google.com>
6370
6371 * options.h (Input_file_argument::Input_file_type): New enum.
6372 (Input_file_argument::is_lib_): Replace with...
6373 (Input_file_argument::type_): New member.
6374 (Input_file_argument::Input_file_argument): Take Input_file_type
6375 'type' rather than boolean 'is_lib' as second argument.
6376 (Input_file_argument::is_lib): Use type_.
6377 (Input_file_argument::is_searched_file): New function.
6378 (Input_file_argument::may_need_search): Handle is_searched_file.
6379 * options.cc (General_options::parse_library): Support -l:filename.
6380 (General_options::parse_just_symbols): Update for Input_file_argument
6381 changes.
6382 (Command_line::process): Likewise.
6383 * archive.cc (Archive::get_file_and_offset): Likewise.
6384 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6385 * script.cc (read_script_file, script_add_file): Likewise.
6386 * fileread.cc (Input_file::Input_file): Likewise.
6387 (Input_file::will_search_for): Handle is_searched_file.
6388 (Input_file::open): Likewise.
6389 * readsyms.cc (Read_symbols::get_name): Likewise.
6390 * testsuite/Makefile.am (searched_file_test): New test.
6391 * testsuite/Makefile.in: Regenerate.
6392 * testsuite/searched_file_test.cc: New file.
6393 * testsuite/searched_file_test_lib.cc: New file.
6394
f3048a1d
ILT
63952009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6396 Ian Lance Taylor <iant@google.com>
6397
6398 * descriptor.cc: Include <cstdio> and "binary-io.h".
6399 (Descriptors::open): Open the files in binary mode always.
6400 * script.cc (Lex::get_token): Treat \r as whitespace.
6401
d4780e57
ILT
64022009-10-09 Ian Lance Taylor <iant@google.com>
6403
6404 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6405
d9a893b8
ILT
64062009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6407 Ian Lance Taylor <iant@google.com>
6408
6409 * configure.ac: Check for readv function also.
6410 * fileread.cc (readv): Define if not HAVE_READV.
6411 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6412 does not exist.
6413 * config.in: Regenerate.
6414 * configure: Regenerate.
6415
c0a62865
DK
64162009-10-09 Doug Kwan <dougkwan@google.com>
6417
6418 * layout.cc (Layout::make_output_section): Call target hook to make
6419 ordinary output section.
6420 (Layout::finalize): Adjust parameter list of call the
6421 Target::may_relax().
6422 * layout.h (class Layout::section_list): New method.
6423 * merge.h (Output_merge_base::entsize): Change visibility to public.
6424 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6425 New methods.
6426 (Output_merge_string::do_is_string): New method.
6427 * object.cc (Sized_relobj::do_setup): renamed from
6428 Sized_relobj::set_up.
6429 * object.h (Sized_relobj::adjust_shndx,
6430 Sized_relobj::initializ_input_to_output_maps,
6431 Sized_relobj::free_input_to_output_maps): Change visibilities to
6432 protected.
6433 (Sized_relobj::setup): Virtualize.
6434 (Sized_relobj::do_setup): New method declaration.
6435 (Sized_relobj::invalidate_section_offset,
6436 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6437 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6438 * options.cc (parse_int): New function.
6439 * options.h (parse_int): New declaration.
6440 (DEFINE_int): New macro.
6441 (stub_group_size): New option.
6442 * output.cc (Output_section::Output_section): Initialize memebers
6443 merge_section_map_, merge_section_by_properties_map_,
6444 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6445 (Output_section::add_input_section): Handled deferred code-fill
6446 generation and remove an old comment.
6447 (Output_section::add_relaxed_input_section): New method definition.
6448 (Output_section::add_merge_input_section): Use merge section by
6449 properties map to speed to search. Update merge section maps
6450 as appropriate.
6451 (Output_section::build_relaxation_map): New method definition.
6452 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6453 Same.
6454 (Output_section::relax_input_section): Renamed to
6455 Output_section::convert_input_sections_to_relaxed_sections and change
6456 interface to take a vector of pointers to relaxed sections.
6457 (Output_section::find_merge_section,
6458 Output_section::find_relaxed_input_section): New method definitions.
6459 (Output_section::is_input_address_mapped,
6460 Output_section::output_offset, Output_section::output_address):
6461 Use output section data maps to speed up searching.
6462 (Output_section::find_starting_output_address): Add comments.
6463 (Output_section::do_write,
6464 Output_section::write_to_postprocessing_buffer): Do code-fill
6465 generation as appropriate.
6466 (Output_section::get_input_sections): Invalidate relaxed input section
6467 map.
6468 (Output_section::restore_states): Adjust type of checkpoint .
6469 Invalidate relaxed input section map.
6470 * output.h (Output_merge_base): New class declaration.
6471 (Input_section_specifier): New class defintion.
6472 (class Output_relaxed_input_section) Change base class to
6473 Output_section_data_build.
6474 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6475 base class initializer.
6476 (Output_section::add_relaxed_input_section): New method declaration.
6477 (Output_section::Input_section): Change visibility to protected.
6478 (Output_section::Input_section::relobj,
6479 Output_section::Input_section::shndx): Handle relaxed input sections.
6480 Output_section::input_sections) Change visibility to protected. Also
6481 define overload to return a non-const pointer.
6482 (Output_section::Merge_section_properties): New class defintion.
6483 (Output_section::Merge_section_by_properties_map,
6484 Output_section::Output_section_data_by_input_section_map,
6485 Output_section::Relaxation_map): New types.
6486 (Output_section::relax_input_section): Rename method to
6487 Output_section::convert_input_sections_to_relaxed_sections and change
6488 interface to take a vector of relaxed section pointers.
6489 (Output_section::find_merge_section,
6490 Output_section::find_relaxed_input_section,
6491 Output_section::build_relaxation_map,
6492 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6493 New method declarations.
6494 (Output_section::merge_section_map_
6495 Output_section::merge_section_by_properties_map_,
6496 Output_section::relaxed_input_section_map_,
6497 Output_section::is_relaxed_input_section_map_valid_,
6498 Output_section::generate_code_fills_at_write_): New data members.
6499 * script-sections.cc
6500 (Output_section_element_input::set_section_addresses): Call
6501 current_data_size and addralign methods of relaxed input sections.
6502 (Orphan_output_section::set_section_addresses): Call current_data_size
6503 and addralign methods of relaxed input sections.
6504 * symtab.cc (Symbol_table::compute_final_value): Extract template
6505 from the body of Symbol_table::sized_finalize_symbol.
6506 (Symbol_table::sized_finalized_symbol): Call
6507 Symbol_table::compute_final_value.
6508 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6509 (Symbol_table::compute_final_value): New templated method declaration.
6510 * target.cc (Target::do_make_output_section): New method defintion.
6511 * target.h (Target::make_output_section): New method declaration.
6512 (Target::relax): Add more parameters for input objects, symbol table
6513 and layout. Adjust call to do_relax.
6514 (Target::do_make_output_section): New method declaration.
6515 (Target::do_relax): Add parameters for input objects, symbol table
6516 and layout.
6517
d446d6c4
ILT
65182009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6519
6520 * pread.c: Include stdio.h.
6521
bc06c745
ILT
65222009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6523
6524 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6525 defined.
6526
75aea3d0
ILT
65272009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6528
6529 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6530 Change read_shndx type to unsigned int.
6531 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6532 int.
6533 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6534 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6535 Change read_shndx type to unsigned int.
6536 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6537 int.
6538 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6539 * layout.cc (Layout::create_symtab_sections): Cast the result of
6540 local_symcount * symsize to off_t in the gold_assert.
6541
be8fcb75
ILT
65422009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6543
6544 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6545 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6546 R_ARM_BASE_ABS.
6547 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6548 (Arm_relocate_functions::thm_abs5): New function.
6549 (Arm_relocate_functions::abs12): New function.
6550 (Arm_relocate_functions::abs16): New function.
6551 (Arm_relocate_functions::base_abs): New function.
6552 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6553 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6554 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6555 R_ARM_BASE_ABS.
6556 (Scan::global): Likewise.
6557 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6558 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6559 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6560 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6561 R_ARM_BASE_ABS.
6562
c2a122b6
ILT
65632009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6564
6565 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6566 (Arm_relocate_functions::movt_prel): New function.
6567 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6568 (Arm_relocate_functions::thm_movt_prel): New function.
6569 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6570 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6571 (Scan::global, Relocate::relocate): Likewise.
6572 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6573
c4aa1e2d
ILT
65742009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6575
6576 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6577 Incremental_checker.
6578 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6579 unsigned int.
6580 (class Incremental_inputs_header): New class.
6581 (Incremental_inputs_header_writer): Edit comment.
6582 (Incremental_inputs_entry): New class.
6583 (Incremental_inputs_entry_writer): Edit comment.
6584 (Sized_incremental_binary::do_find_incremental_inputs_section):
6585 Add *strtab_shndx parameter, fill it.
6586 (Sized_incremental_binary::do_check_inputs): New method.
6587 (Incremental_checker::can_incrementally_link_output_file): Use
6588 Sized_incremental_binary::check_inputs.
6589 (Incremental_inputs::report_command_line): Save command line in
6590 command_line_.
6591 * incremental.h:
6592 (Incremental_binary::find_incremental_inputs_section): New
6593 method.
6594 (Incremental_binary::do_find_incremental_inputs_section): Add
6595 strtab_shndx parameter.
6596 (Incremental_binary::do_check_inputs): New pure virtual method.
6597 (Sized_incremental_binary::do_check_inputs): Declare.
6598 (Incremental_checker::Incremental_checker): Add incremental_inputs
6599 parameter, use it to initialize incremental_inputs_.
6600 (Incremental_checker::incremental_inputs_): New field.
6601 (Incremental_checker::command_line): New method.
6602 (Incremental_checker::inputs): New method.
6603 (Incremental_checker::command_line_): New field.
6604
c549a694
ILT
66052009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6606
6607 * incremental.cc: Include <cstdarg> and "target-select.h".
6608 (vexplain_no_incremental): New function.
6609 (explain_no_incremental): New function.
6610 (Incremental_binary::error): New method.
6611 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6612 method.
6613 (make_sized_incremental_binary): New function.
6614 (open_incremental_binary): New function.
6615 (can_incrementally_link_file): Add checks if output is ELF and has
6616 inputs section.
6617 * incremental.h: Include "elfcpp_file.h" and "output.h".
6618 (Incremental_binary): New class.
6619 (Sized_incremental_binary): New class.
6620 (open_incremental_binary): Declare.
6621 * object.cc (is_elf_object): Use
6622 elfcpp::Elf_recognizer::is_elf_file.
6623 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6624 * output.h (Output_file::filesize): New method.
6625
fd3c5f0b
ILT
66262009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6627
6628 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6629 New function.
6630 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6631 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6632 function.
6633 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6634 function.
6635 (Arm_relocate_functions::movw_abs_nc): New function.
6636 (Arm_relocate_functions::movt_abs): New function.
6637 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6638 (Arm_relocate_functions::thm_movt_abs): New function.
6639 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6640 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6641 (Scan::global): Likewise.
6642 (Relocate::relocate): Likewise.
6643 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6644
7f5309a5
ILT
66452009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6646
6647 * arm.cc (Arm_relocate_functions::got_prel) New function.
6648 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6649 (Relocate::relocate): Likewise.
6650 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6651
364c7fa5
ILT
66522009-10-06 Ian Lance Taylor <iant@google.com>
6653
6654 * options.h (class General_options): Define
6655 split_stack_adjust_size parameter.
6656 * object.h (class Object): Add uses_split_stack_ and
6657 has_no_split_stack_ fields. Add uses_split_stack and
6658 has_no_split_stack accessor functions. Declare
6659 handle_split_stack_section.
6660 (class Reloc_symbol_changes): Define.
6661 (class Sized_relobj): Define Function_offsets. Declare
6662 split_stack_adjust, split_stack_adjust_reltype, and
6663 find_functions.
6664 * object.cc (Object::handle_split_stack_section): New function.
6665 (Sized_relobj::do_layout): Call handle_split_stack_section.
6666 * dynobj.cc (Sized_dynobj::do_layout): Call
6667 handle_split_stack_section.
6668 * reloc.cc (Sized_relobj::relocate_sections): Call
6669 split_stack_adjust for executable sections in split_stack
6670 objects. Pass reloc_map to relocate_section.
6671 (Sized_relobj::split_stack_adjust): New function.
6672 (Sized_relobj::split_stack_adjust_reltype): New function.
6673 (Sized_relobj::find_functions): New function.
6674 * target-reloc.h: Include "object.h".
6675 (relocate_section): Add reloc_symbol_changes parameter. Change
6676 all callers.
6677 * target.h (class Target): Add calls_non_split method. Declare
6678 do_calls_non_split virtual method. Declare match_view and
6679 set_view_to_nop.
6680 * target.cc: Include "elfcpp.h".
6681 (Target::do_calls_non_split): New function.
6682 (Target::match_view): New function.
6683 (Target::set_view_to_nop): New function.
6684 * gold.cc (queue_middle_tasks): Give an error if mixing
6685 split-stack and non-split-stack objects with -r.
6686 * i386.cc (Target_i386::relocate_section): Add
6687 reloc_symbol_changes parameter.
6688 (Target_i386::do_calls_non_split): New function.
6689 * x86_64.cc (Target_x86_64::relocate_section): Add
6690 reloc_symbol_changes parameter.
6691 (Target_x86_64::do_calls_non_split): New function.
6692 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6693 parameter.
6694 * powerpc.cc (Target_powerpc::relocate_section): Add
6695 reloc_symbol_changes parameter.
6696 * sparc.cc (Target_sparc::relocate_section): Add
6697 reloc_symbol_changes parameter.
6698 * configure.ac: Call AM_CONDITIONAL for the default target.
6699 * configure: Rebuild.
6700 * testsuite/Makefile.am (TEST_AS): New variable.
6701 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6702 (check_DATA): Add split_i386 and split_x86_64 files.
6703 (SPLIT_DEFSYMS): Define.
6704 (split_i386_[1234n].o): New targets.
6705 (split_i386_[124]): New targets.
6706 (split_i386_[1234r].stdout): New targets.
6707 (split_x86_64_[1234n].o): New targets.
6708 (split_x86_64_[124]): New targets.
6709 (split_x86_64_[1234r].stdout): New targets.
6710 (MOSTLYCLEANFILES): Add new executables.
6711 * testsuite/split_i386.sh: New file.
6712 * testsuite/split_x86_64.sh: New file.
6713 * testsuite/split_i386_1.s: New file.
6714 * testsuite/split_i386_2.s: New file.
6715 * testsuite/split_i386_3.s: New file.
6716 * testsuite/split_i386_4.s: New file.
6717 * testsuite/split_i386_n.s: New file.
6718 * testsuite/split_x86_64_1.s: New file.
6719 * testsuite/split_x86_64_2.s: New file.
6720 * testsuite/split_x86_64_3.s: New file.
6721 * testsuite/split_x86_64_4.s: New file.
6722 * testsuite/split_x86_64_n.s: New file.
6723 * testsuite/testfile.cc (Target_test): Update relocation_section
6724 function.
6725 * testsuite/Makefile.in: Rebuild.
6726
e8a9fcda
ILT
67272009-10-06 Ian Lance Taylor <iant@google.com>
6728
6729 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6730 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6731 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6732 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6733 the address on ldo_addrs_.
6734 (Target_i386::Relocate::fix_up_ldo): New function.
6735
e99daf92
ILT
67362009-10-06 Rafael Espindola <espindola@google.com>
6737
6738 * plugin.cc (add_input_library): New.
6739 (Plugin::load): Add add_input_library to tv.
6740 (Plugin_manager::add_input_file): Add the is_lib argument.
6741 (add_input_file): Update call to Plugin_manager::add_input_file.
6742 (add_input_library): New.
6743 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6744
966d4097
DK
67452009-09-30 Doug Kwan <dougkwan@google.com>
6746
6747 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6748 symbol and call Symbol::may_need_copy_reloc to determine if
6749 a copy reloc is needed.
6750 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6751 nocopyreloc is given in command line.
6752 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6753 given in command line.
6754 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6755 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6756 of the removed Target_i386::may_need_copy_reloc.
6757 * options.h (copyreloc): New option with default value false.
6758 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6759 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6760 instead of the removed Target_powerpc::may_need_copy_reloc.
6761 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6762 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6763 instead of the removed Target_sparc::may_need_copy_reloc.
6764 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6765 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6766 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6767 instead of the removed Target_x86_64::may_need_copy_reloc.
6768
029ba973
ILT
67692009-09-30 Ian Lance Taylor <iant@google.com>
6770
6771 * object.h (class Object): Remove target_ field, and target,
6772 sized_target, and set_target methods.
6773 (Object::sized_target): Remove.
6774 (class Sized_relobj): Update declarations. Remove sized_target.
6775 * object.cc (Sized_relobj::setup): Remove target parameter.
6776 Change all callers.
6777 (Input_objects::add_object): Don't do anything with the target.
6778 (make_elf_sized_object): Add punconfigured parameter. Change all
6779 callers. Set or test parameter target.
6780 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6781 Change all callers.
6782 * parameters.cc (Parameters::set_target): Change parameter type to
6783 be non-const.
6784 (Parameters::default_target): Remove.
6785 (set_parameters_target): Change parameter type to be non-const.
6786 (parameters_force_valid_target): New function.
6787 (parameters_clear_target): New function.
6788 * parameters.h (class Parameters): Update declarations. Remove
6789 default_target method. Add sized_target and clear_target
6790 methods. Change target_ to be non-const.
6791 (set_parameters_target): Update declaration.
6792 (parameters_force_valid_target): Declare.
6793 (parameters_clear_target): Declare.
6794 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6795 as NULL if we aren't searching.
6796 (Add_symbols::run): Don't check for compatible target.
6797 * fileread.cc (Input_file::open_binary): Call
6798 parameters_force_valid_target.
6799 * gold.cc (queue_middle_tasks): Likewise.
6800 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6801 set_target on object.
6802 * dynobj.h (class Sized_dynobj): Update declarations.
6803 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6804 make_elf_object returns NULL.
6805 (Archive::include_member): Don't check whether object target is
6806 compatible.
6807 * output.cc (Output_section::add_input_section): Get target from
6808 parameters.
6809 (Output_section::relax_input_section): Likewise.
6810 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6811 parameters.
6812 (Sized_relobj::do_scan_relocs): Likewise.
6813 (Sized_relobj::relocate_sections): Likewise.
6814 * resolve.cc (Symbol_table::resolve): Likewise.
6815 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6816 parameter. Change all callers.
6817 (Symbol_table::add_from_object): Get target from parameters.
6818 (Symbol_table::add_from_relobj): Don't check object target.
6819 (Symbol_table::add_from_dynobj): Likewise.
6820 (Symbol_table::define_special_symbol): Get target from
6821 parameters.
6822 * symtab.h (class Symbol_table): Update declaration.
6823 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6824 parameter. Change all callers. Clear parameter target.
6825 (Binary_test): Test target here.
6826 * testsuite/object_unittest.cc (gold_testsuite): Remove
6827 target_test_pointer parameter. Change all callers.
6828 (Object_test): Test target here.
6829
a6a22b83
ILT
68302009-09-26 Ian Lance Taylor <iant@google.com>
6831
6832 * testsuite/initpri1.c: Don't try to use constructor priorities if
6833 compiling with gcc before 4.3.
6834
6a8f49fe
ILT
68352009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6836
6837 * testsuite/retain_symbols_file_test.sh (check_present): Change
6838 output file name to retain_symbols_file_test.stdout.
6839 (check_absent): Likewise.
6840
8c604651
CS
68412009-09-18 Craig Silverstein <csilvers@google.com>
6842
6843 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6844 * options.cc: Include <cerrno> and <fstream>.
6845 (General_options::finalize): Parse -retain-symbols-file tag.
6846 * options.h: New flag.
6847 (General_options): New method should_retain_symbol, new
6848 variable symbols_to_retain.
6849 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6850 should_retain_symbol map.
6851 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6852 * testsuite/Makefile.in: Regenerate.
6853 * testsuite/retain_symbols_file_test.sh: New file.
6854
ca58b19f
NC
68552009-09-18 Nick Clifton <nickc@redhat.com>
6856
6857 * po/es.po: Updated Spanish translation.
6858
20e6d0d6
DK
68592009-09-17 Doug Kwan <dougkwan@google.com>
6860
6861 * debug.h (DEBUG_RELAXATION): New constant.
6862 (DEBUG_ALL): Add DEBUG_RELAXATION.
6863 (debug_string_to_enum): Add relaxation debug option.
6864 * layout.cc
6865 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6866 Layout::Relaxation_debug_check::read_sections,
6867 Layout::Relaxation_debug_check::read_sections): New method definitions.
6868 (Layout::Layout): Initialize data members
6869 record_output_section_data_from_scrips_,
6870 script_output_section_data_list_ and relaxation_debug_check_.
6871 (Layout::save_segments, Layout::restore_segments,
6872 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6873 Layout::relaxation_loop_body): New method definitions.
6874 (Layout::finalize): Support relaxation. Move section layout code to
6875 Layout::relaxation_loop_body.
6876 (Layout::set_asection_address_from_script): Move code for orphan
6877 section placement out.
6878 (Layout::place_orphan_sections_in_script): New method definition.
6879 * layout.h (Output_segment_headers, Output_file_header):
6880 New forward class declarations.
6881 (Layout::~Layout): Define.
6882 (Layout::new_output_section_data_from_script): New method definition.
6883 (Layout::place_orphan_sections_in_script): New method declaration.
6884 (Layout::Segment_states): New type declaration.
6885 (Layout::save_segments, Layout::restore_segments,
6886 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6887 Layout::relaxation_loop_body): New method declarations.
6888 (Layout::Output_section_data_list): New type declaration.
6889 (Layout::Relaxation_debug_check): New class definition.
6890 (Layout::record_output_section_data_from_script_,
6891 Layout::script_output_section_data_list_, Layout::segment_states_,
6892 Layout::relaxation_debug_check_): New data members.
6893 * output.cc: (Output_section_headers::do_size): New method definition.
6894 (Output_section_headers::Output_section_headers): Move size
6895 computation to Output_section_headers::do_size.
6896 (Output_segment_headers::do_size): New method definition.
e1df38aa 6897 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
6898 Output_file_header::do_size and call it.
6899 (Output_file_header::do_size): New method definition.
6900 (Output_data_group::Output_data_group): Adjust call to
6901 Output_section_data.
6902 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6903 (Output_symtab_xindex::do_write): Add array bound check.
6904 (Output_section::Input_section::print_to_mapfile): Handle
6905 RELAXED_INPUT_SECTION_CODE.
6906 (Output_section::Output_section): Initialize data member checkpoint_.
6907 (Output_section::~Output_section): Delete checkpoint object pointed
6908 by checkpoint_.
6909 (Output_section::add_input_section): Always add an Input_section if
6910 relaxing.
6911 (Output_section::add_merge_input_section): Add assert.
6912 (Output_section::relax_input_section): New method definition.
6913 (Output_section::set_final_data_size): Set load address to zero for
6914 an unallocated section.
6915 (Output_section::do_address_and_file_offset_have_reset_values):
6916 New method definition.
6917 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6918 Handle relaxed input section.
6919 (Output_section::sort_attached_input_sections): Checkpoint input
6920 section list lazily.
6921 (Output_section::get_input_sections): Change type of input_sections to
6922 list of Simple_input_section pointers. Checkpoint input section list
6923 lazily. Also handle relaxed input sections.
6924 (Output_section::add_input_section_for_script): Take a reference to
6925 a Simple_input_section object instead of Relobj pointer and section
6926 index as parameter. Handle relaxed input sections.
6927 (Output_section::save_states, Output_section::restore_states): New
6928 method definitions.
6929 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6930 (Output_data::is_data_size_fixed): New method definition.
6931 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6932 if it is fixed.
6933 (Output_data::address_and_file_offset_have_reset_values): New method
6934 definition.
6935 (Output_data::do_address_and_file_offset_have_reset_values): New method
6936 definition.
6937 (Output_data::set_data_size): Check that data size is not fixed.
6938 (Output_data::fix_data_size): New method definition.
6939 (Output_data::is_data_size_fixed_): New data member.
6940 (Output_section_headers::set_final_data_size): New method definition.
6941 (Output_section_headers::do_size): New method declaration.
6942 (Output_segment_headers::set_final_data_size): New method definition.
6943 (Output_segment_headers::do_size): New method declaration.
6944 (Output_file_header::set_final_data_size)::New method definition.
6945 (Output_file_header::do_size)::New method declaration.
6946 (Output_section_data::Output_section_data): Add new parameter
6947 is_data_size_fixed and use it to fix data size.
6948 (Output_data_const::Output_data_const): Adjust call to base class
6949 constructor and fix data size.
6950 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6951 base class constructor and fix data size.
6952 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6953 base class constructor and fix data size.
6954 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6955 class constructor and fix data size.
6956 (Output_data_group::set_final_data_size): New method definition.
6957 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6958 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6959 class constructor and fix data size.
6960 (Output_relaxed_input_section): New class definition.
6961 (Output_section::Simple_input_section): New class definition.
6962 (Output_section::get_input_sections): Adjust parameter list.
6963 (Output_section::add_input_section_for_script): Same.
6964 (Output_section::save_states, Output_section::restore_states,
6965 Output_section::do_address_and_file_offset_have_reset_values,
6966 (Output_section::Input_section::Input_section): Handle
6967 RELAXED_INPUT_SECTION_CODE. Add new overload for
6968 Output_relaxed_input_section.
6969 (Output_section::Input_section::is_input_section,
6970 Output_section::Input_section::set_output_section): Handle relaxed
6971 input section.
6972 (Output_section::Input_section::is_relaxed_input_section,
6973 Output_section::Input_section::output_section_data,
6974 Output_section::Input_section::relaxed_input_section): New method
6975 definitions.
6976 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6977 value.
6978 (Output_section::Input_section::u1_): Update comments.
6979 (Output_section::Input_section::u2_): Add new union member poris.
6980 (Output_section::Checkpoint_output_section): New classs definition.
6981 (Output_section::relax_input_section): New method declaration.
6982 (Output_section::checkpoint_): New data member.
6983 (Output_segment): Update comments.
6984 (Output_segment::Output_segment): Un-privatize copy constructor.
6985 (Output_segment::operator=): Un-privatize.
6986 * script-sections.cc (Output_section_element::Input_section_list):
6987 Change element type to Output_section::Simple_input_section.
6988 (Output_section_element_dot_assignment::set_section_addresses):
6989 Register output section data for relaxation clean up.
6990 (Output_data_exression::Output_data_expression): Adjust call to base
6991 constructor to fix data size.
6992 (Output_section_element_data::set_section_addresses): Register
6993 Output_data_expression object for relaxation clean up.
6994 (struct Input_section_info): Replace Relobj pointer and section index
6995 pair with Output_section::Simple_input_section and Convert struct to a
6996 class.
6997 (Input_section_sorter::operator()): Adjust access to
e1df38aa 6998 Input_section_info data member to use accessors.
20e6d0d6
DK
6999 (Output_section_element_input::set_section_addresses): Use layout
7000 parameter. Adjust code to use Output_section::Simple_input_section
7001 and Input_secction_info classes. Register filler for relaxation
7002 clean up.
7003 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7004 and section index pair with Output_section::Simple_input_section
7005 class. Adjust code accordingly.
7006 (Phdrs_element::release_segment): New method definition.
7007 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7008 segment list.
7009 (Script_sections::release_segments): New method definition.
7010 * gold/script-sections.h (Script_sections::release_segments): New
7011 method declaration.
7012 * gold/target.h (Target::may_relax, Target::relax,
7013 Target::do_may_relax, Target::do_relax): New method definitions.
7014
5e445df6
ILT
70152009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7016
7017 * arm.cc (has_signed_unsigned_overflow): New function.
7018 (Arm_relocate_functions::abs8): New function.
7019 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7020 (Target_arm::Scan::global): Likewise.
7021 (Target_arm::relocate::relocate): Likewise.
7022 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7023 Likewise.
7024
8c604651 70252009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
7026
7027 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7028 * testsuite/Makefile.in: Regenerate.
7029
1e9cc1c2
NC
70302009-09-11 Nick Clifton <nickc@redhat.com>
7031
7032 * po/gold.pot: Updated by the Translation project.
7033
6a89f575
CC
70342009-09-08 Cary Coutant <ccoutant@google.com>
7035
7036 * output.cc (Output_file::open): Add execute permission to empty file.
7037 * testsuite/Makefile.am (permission_test): New test.
7038 * testsuite/Makefile.in: Regenerate.
7039
fdcac5af
ILT
70402009-09-02 Ian Lance Taylor <iant@google.com>
7041
7042 * output.cc (Output_file::resize): Call map_no_anonymous rather
7043 than map.
7044
44453f85
ILT
70452009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7046
7047 * gold.cc: Include "incremental.h".
7048 (queue_initial_tasks): Call Incremental_checker methods.
7049 * incremental.cc: Include "output.h".
7050 (Incremental_checker::can_incrementally_link_output_file): New
7051 method.
7052 * incremental.h (Incremental_checker): New class.
7053
7054 * output.cc (Output_file::open_for_modification): New method.
7055 (Output_file::map_anonymous): Changed return type to bool. Record
7056 map in base_ field.
7057 (Output_file::map_no_anonymous): New method, broken out of map.
7058 (Output_file::map): Use map_no_anonymous and map_anonymous.
7059 * output.h (class Output_file): Update declarations.
7060
293c1386
CC
70612009-08-24 Cary Coutant <ccoutant@google.com>
7062
7063 * options.h (Command_line::Pre_options): New class.
7064 (Command_line::pre_options): New member.
7065 * options.cc (gold::options::ready_to_register): New variable.
7066 (One_option::register_option): Do nothing if not registering options.
7067 Assert if same short option registered twice.
7068 (General_options::General_options): Turn off option registration when
7069 done constructing.
7070 (Command_line::Pre_options::Pre_options): New constructor.
7071
f773f3d2
CC
70722009-08-24 Cary Coutant <ccoutant@google.com>
7073
06a73cfe
CC
7074 * options.h (General_options::no_keep_memory): Remove incorrect
7075 short option.
f773f3d2 7076
a15af8e2
RW
70772009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7078
7079 * Makefile.am (am__skiplex, am__skipyacc): New.
7080 * Makefile.in: Regenerate.
7081
c462b41b
RW
70822009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7083
14ec8efd
RW
7084 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7085 (INCLUDES): ... this.
7086 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7087 (AM_CPPFLAGS): Renamed from ...
7088 (INCLUDE): ... this.
7089 * Makefile.in, testsuite/Makefile.in: Regenerate.
7090
81ecdfbb
RW
7091 * Makefile.in: Regenerate.
7092 * aclocal.m4: Likewise.
7093 * config.in: Likewise.
7094 * configure: Likewise.
7095 * testsuite/Makefile.in: Likewise.
7096
c462b41b
RW
7097 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7098 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7099 * Makefile.in: Regenerate.
7100 * testsuite/Makefile.in: Regenerate.
7101
2da73f13
CC
71022009-08-19 Cary Coutant <ccoutant@google.com>
7103
7104 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7105 symbols in shared libraries overridden by hidden or internal symbols
7106 in the main program.
7107
2db70501
CD
71082009-08-19 Chris Demetriou <cgd@google.com>
7109
7110 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7111 checking source file names in error messages.
7112
f733487b
DK
71132009-08-18 Doug Kwan <dougkwan@google.com>
7114
7115 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7116 an elcpp::Ehdr as parameter. Adjust call to set_target.
7117 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7118 an elfcpp::Ehdr as parameter.
7119 * object.cc (Object::set_target): Remove the version that looks up
7120 a target and sets it.
7121 (Sized_relobj::setup): Take a Target object instead of
7122 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7123 (make_elf_sized_object): Find target and ask target to
7124 make an ELF object.
7125 * object.h: (Object::set_target): Remove the version that looks up
7126 a target and sets it.
7127 (Sized_relobj::setup): Take a Target object instead of
7128 an elfcpp:Ehdr as parameter.
7129 * target.cc: Include dynobj.h.
7130 (Target::do_make_elf_object_implementation): New.
7131 (Target::do_make_elf_object): New.
7132 * target.h (Target::make_elf_object): New template declaration.
7133 (Target::do_make_elf_object): New method declarations.
7134 (Target::do_make_elf_object_implementation): New template declaration.
7135
cc70f101
ILT
71362009-08-14 Ian Lance Taylor <iant@google.com>
7137
7138 * gold.h (FUNCTION_NAME): Define.
7139 (gold_unreachable): Use FUNCTION_NAME.
7140
ef5e0cb1
ST
71412009-08-12 Sriraman Tallam <tmsriram@google.com>
7142
7143 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7144 symbol in the --keep-unique list is not found.
7145
48c187ce
ST
71462009-08-12 Sriraman Tallam <tmsriram@google.com>
7147
7148 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7149 been maked as --keep-unique.
7150 (Icf::unfold_section): New function.
7151 * icf.h (Icf::unfold_section): New function.
7152 * options.h (General_options::keep_unique): New option.
7153 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7154 * testsuite/Makefile.in: Regenerate.
7155 * testsuite/icf_keep_unique_test.sh: New file.
7156 * testsuite/icf_keep_unique_test.cc: New file.
7157
645afe0c
CC
71582009-08-12 Cary Coutant <ccoutant@google.com>
7159
7160 PR 10471
7161 * resolve.cc (Symbol_table::resolve): Check for references from
7162 dynamic objects to hidden and internal symbols.
7163 * testsuite/Makefile.am (hidden_test.sh): New test.
7164 * testsuite/Makefile.in: Regenerate.
7165 * testsuite/hidden_test.sh: New script.
7166 * testsuite/hidden_test_1.c: New test source.
7167 * testsuite/hidden_test_main.c: New test source.
7168
11af873f
DK
71692009-08-11 Doug Kwan <dougkwan@google.com>
7170
7171 * arm.cc: Update comments.
7172 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7173 segment to locate the .ARM.exidx section if present.
7174
b9f7d72d
DK
71752009-08-09 Doug Kwan <dougkwan@google.com>
7176
7177 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7178 patch.
7179
ddd3c53c
ST
71802009-08-07 Sriraman Tallam <tmsriram@google.com>
7181 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7182 compiler warnings.
7183
27721062
ST
71842009-08-06 Sriraman Tallam <tmsriram@google.com>
7185
7186 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7187 valid tls_segment only for non-debug-section relocations.
7188 * testsuite/Makefile.am: Add gc_tls_test.
7189 * testsuite/Makefile.in: Regenerate.
7190 * testsuite/gc_tls_test.cc: New file.
7191 * testsuite/gc_tls_test.sh: New file.
7192
ef15dade 71932009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 7194
ef15dade
ST
7195 * icf.cc: New file.
7196 * icf.h: New file.
7197 * Makefile.am (CCFILES): Add icf.cc.
7198 (HFILES): Add icf.h
7199 * Makefile.in: Regenerate.
7200 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7201 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7202 section, symbol and addend information for the relocs.
7203 * gold.cc (queue_middle_tasks): Call identical code folding.
7204 * gold.h: Add defines for multimap.
7205 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7206 to the call of finalize_local_symbols.
7207 * main.cc (main): Create object of class Icf.
7208 * object.cc (Sized_relobj::do_layout): Allow this function to be
7209 called twice during icf.
7210 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7211 to sections marked as identical by icf.
7212 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7213 when available.
7214 (Sized_relobj::do_section_entsize): New function.
7215 * object.h (Object::section_entsize): New function.
7216 (Object::do_section_entsize): New pure virtual function.
7217 (Relobj::finalize_local_symbols): Add new parameter.
7218 (Relobj::do_section_entsize): New function.
7219 * options.h (General_options::icf): New option.
7220 (General_options::icf_iterations): New option.
7221 (General_options::print_icf_sections): New option.
7222 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7223 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7224 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7225 icf.
7226 * symtab.cc (Symbol_table::is_section_folded): New function.
7227 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7228 to sections marked as identical by icf.
7229 * symtab.h (Symbol_table::set_icf): New function.
7230 (Symbol_table::icf): New function.
7231 (Symbol_table::is_section_folded): New function.
7232 (Symbol_table::icf_): New data member.
7233 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7234 * testsuite/Makefile.am: Add commands to build icf_test.
7235 * testsuite/Makefile.in: Regenerate.
7236 * testsuite/icf_test.sh: New file.
7237 * testsuite/icf_test.cc: New file.
7238
c3b65ac4
CD
72392009-07-24 Chris Demetriou <cgd@google.com>
7240
7241 * layout.cc (is_compressible_debug_section): Fix incorrect
7242 comment about compressed section names.
7243
1caf2c51
ILT
72442009-07-20 Ian Lance Taylor <ian@airs.com>
7245
7246 PR 10419
7247 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7248
1ef4d87f
ILT
72492009-07-16 Ian Lance Taylor <iant@google.com>
7250
7251 PR 10400
7252 * layout.h: #include <map>.
7253 (class Kept_section): Change from struct to class. Add accessors
7254 and setters. Add section size to Comdat_group mapping. Change
7255 Comdat_group to std::map. Add is_comdat_ field. Add
7256 linkonce_size field in union.
7257 (class Layout): Update declaration of find_or_add_kept_section.
7258 Don't declare find_kept_object.
7259 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7260 parameter. Add object, shndx, is_comdat, and is_group_name
7261 parameters. Change all callers. Adjust for new Kept_section.
7262 (Layout::find_kept_object): Remove.
7263 * object.cc (Sized_relobj::include_section_group): Update use of
7264 Kept_section. Rename secnum to shndx. Only record
7265 Kept_comdat_section if sections are the same size.
7266 (Sized_relobj::include_linkonce_section): Update use of
7267 Kept_section. Only record Kept_comdat_section if sections are the
7268 same size. Set size of linkonce section.
7269 (Sized_relobj::map_to_kept_section): Update call to
7270 get_kept_comdat_section.
7271 * object.h (class Sized_relobj): Rename fields in
7272 Kept_comdat_section to drop trailing underscores; change object
7273 field to Relobj*. Change Kept_comdat_section_table to store
7274 struct rather than pointer.
7275 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7276 Add kept_object and kept_shndx parameters. Change all callers.
7277 (Sized_relobj::get_kept_comdat_section): Change return type to
7278 bool. Add kept_object and kept_shndx parameters. Change all
7279 callers.
7280 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7281 Layout::find_or_add_kept_section.
7282
37c3b7b0
ILT
72832009-07-09 Ian Lance Taylor <iant@google.com>
7284
7285 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7286 Reserve space in the hash table.
7287
98fa85cb
ILT
72882009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7289
7290 * fileread.cc (File_read::get_mtime): New method.
7291 * fileread.h (Timespec): New structure.
7292 (File_read::get_mtime): New method.
7293 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7294 Renamed from timestamp_nsec.
7295 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7296 Elf_Xword.
e1df38aa 7297 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 7298 timestamp_nsec.
e1df38aa 7299 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
7300 (Incremental_inputs::report_obejct): Save mtime; style fix.
7301 (Incremental_inputs::report_script): Save mtime; style fix.
7302 (Incremental_inputs::finalize_inputs): Style fix.
7303 (Incremental_inputs::finalize): Style fix.
7304 (Incremental_inputs::create_input_section_data): Store inputs
7305 mtime.
7306 * incremental.h (Incremental_inputs::report_script): Add mtime
7307 argument.
7308 (Incremental_inputs::Input_info::Input_info): Intialize only one
7309 union member.
7310 (Incremental_inputs::Input_info::archive): Move to nameless
7311 union.
7312 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7313 (Incremental_inputs::Input_info::script): Move to nameless union.
7314 (Incremental_inputs::mtime): New field.
7315 * script.cc (read_input_script): Pass file mtime to
7316 Incremental_input.
7317 * script.h (Script_info::inputs): Style fix.
7318
c9d70757
ILT
73192009-07-01 Ian Lance Taylor <ian@airs.com>
7320
7321 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7322 instead of 32.
7323
9c547ec3
ILT
73242009-06-24 Ian Lance Taylor <iant@google.com>
7325
7326 PR 10156
7327 * layout.cc (Layout::choose_output_section): If we find an
7328 existing section, update the flags.
7329 (Layout::create_notes): New function, broken out of
7330 Layout::finalize.
7331 (Layout::finalize): Don't create note sections.
7332 (Layout::create_note): Don't crash if linker script discards
7333 section.
7334 (Layout::create_gold_note): Likewise.
7335 (Layout::create_build_id): Likewise. Don't set
7336 after_input_sections on the section.
7337 (Layout::create_executable_stack_info): Remove target parameter.
7338 Change caller.
7339 * layout.h (class Layout): Declare create_notes. Update
7340 declaration of create_executable_stack_info.
7341 * gold.cc (queue_middle_tasks): Call create_notes.
7342 * output.cc (Output_section::update_flags_for_input_section): Move
7343 here from output.h. If SHF_ALLOC flag is newly set, mark address
7344 invalid.
7345 * output.h (Output_data::mark_address_invalid): New function.
7346 (class Output_section): Only declare, not define,
7347 update_flags_for_input_section. Remove set_flags.
7348
55458500
ILT
73492009-06-24 Ian Lance Taylor <iant@google.com>
7350
7351 * script-sections.cc (Output_section_definition::
7352 set_section_addresses): Rename shadowing local load_address to
7353 laddr.
7354
1307d6cd
ILT
73552009-06-24 Ian Lance Taylor <iant@google.com>
7356
7357 PR 10244
7358 * reloc.cc (relocate_sections): Skip empty relocation sections.
7359
ec3f783e
ILT
73602009-06-23 Ian Lance Taylor <iant@google.com>
7361
7362 PR 10156
7363 * layout.cc (Layout::create_note): Use choose_output_section
7364 rather than make_output_section.
7365
459c9f1c
ILT
73662009-06-23 Ian Lance Taylor <iant@google.com>
7367
7368 PR 10237
7369 * options.cc (General_options::parse_V): Set printed_version_.
7370 (General_options::General_options): Initialize printed_version_.
7371 * options.h (class General_options): Add printed_version_ field.
7372 * gold.cc (queue_initial_tasks): If there are no input files,
7373 don't give a fatal error if we printed the version information.
7374 (queue_middle_tasks): If using -r with a shared object, give a
7375 fatal error rather than an ordinary error.
7376
1518dc8f
ILT
73772009-06-23 Ian Lance Taylor <iant@google.com>
7378
7379 PR 10219
7380 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7381 (Layout::make_output_section): Set have_stabstr_section_ if we see
7382 a .stab*str section.
7383 (Layout::finalize): Call link_stabs_sections.
7384 (Layout::link_stabs_sections): New file.
7385 * layout.h (class Layout): Add have_stabstr_section_ field.
7386 Declare link_stabs_sections.
7387
3d857b98
DK
73882009-06-23 Doug Kwan <dougkwan@google.com>
7389
7390 * Makefile.am (libgold_a_LIBADD): New.
7391 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7392 * Makefile.in: Regenerate.
7393 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7394 * configure: Regenerate.
7395 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7396 * fileread.cc: Include sys/state.h
7397 * gold.h: Declare memmem and strndup if found missing.
7398 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7399
0639a6f6
ILT
74002009-06-23 Ian Lance Taylor <iant@google.com>
7401
7402 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7403 * configure: Rebuild.
7404
8d63875c
ILT
74052009-06-23 Ian Lance Taylor <iant@google.com>
7406
7407 PR 10147
7408 * object.cc (Object::section_contents): Don't try to get a view if
7409 the section has length zero.
7410 (Object::handle_gnu_warning_section): If the section is empty, use
7411 the name of the section as the warning.
7412
f7c8a183
ILT
74132009-06-23 Ian Lance Taylor <iant@google.com>
7414
7415 PR 10133
7416 * stringpool.h (class Stringpool_template): Add optimize_ field.
7417 (Stringpool_template::set_optimize): New function.
7418 * stringpool.cc (Stringpool_template::Stringpool_template):
7419 Initialize optimize_ field.
7420 (Stringpool_template::set_string_offsets): Test local optimize
7421 fild rather than parameter.
7422 * layout.cc (Layout::Layout): Call set_optimize on the section
7423 name stringpool.
7424
e6a307ba
ILT
74252009-06-22 Ian Lance Taylor <iant@google.com>
7426
7427 PR 10030
7428 * yyscript.y: Parse TARGET.
7429 * script.cc (script_set_target): New function.
7430 * script-c.h (script_set_target): Declare.
7431 * options.cc (General_options::string_to_object_format): Rename
7432 from string_to_object_format in anonymous namespace. Change
7433 callers.
7434 * options.h (class General_options): Declare
7435 string_to_object_format.
7436
3ee173de
ILT
74372009-06-22 Ian Lance Taylor <iant@google.com>
7438
7439 * script-sections.cc (Script_sections::create_segments): Don't put
7440 program headers in a PT_LOAD segment if -n or -N.
7441
74422009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
7443
7444 PR 10141
7445 * options.h (class General_options): Add -z lazy and -z now. Sort
7446 -z options into alphabetical order.
7447 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7448
cd6739a1 74492009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
7450
7451 * layout.cc (Layout::make_output_section): Call
7452 Target::new_output_section.
7453 (Layout::attach_allocated_section_to_segment): Put large section
7454 sections in a separate load segment with the large segment flag
7455 set.
7456 (Layout::segment_precedes): Sort large data segments after other
7457 load segments.
7458 (align_file_offset): New static function.
7459 (Layout::set_segment_offsets): Use align_file_offset.
7460 * output.h (class Output_section): Add is_small_section_ and
7461 is_large_section_ fields.
7462 (Output_section::is_small_section): New function.
7463 (Output_section::set_is_small_section): New function.
7464 (Output_section::is_large_section): New function.
7465 (Output_section::set_is_large_section): New function.
7466 (Output_section::is_large_data_section): New function.
7467 (class Output_segment): Add is_large_data_segment_ field.
7468 (Output_segment::is_large_data_segment): New function.
7469 (Output_segment::set_is_large_data_segment): New function.
7470 * output.cc (Output_section::Output_section): Initialize new
7471 fields.
7472 (Output_segment::Output_segment): Likewise.
7473 (Output_segment::add_output_section): Add assertion that large
7474 data sections always go in large data segments. Force small data
7475 sections to the end of the list of data sections. Force small BSS
7476 sections to the start of the list of BSS sections. For large BSS
7477 sections to the end of the list of BSS sections.
7478 * symtab.h (class Symbol): Declare is_common_shndx.
7479 (Symbol::is_defined): Check Symbol::is_common_shndx.
7480 (Symbol::is_common): Likewise.
7481 (class Symbol_table): Define enum Commons_section_type. Update
7482 declarations. Add small_commons_ and large_commons_ fields.
7483 * symtab.cc (Symbol::is_common_shndx): New function.
7484 (Symbol_table::Symbol_table): Initialize new fields.
7485 (Symbol_table::add_from_object): Put small and large common
7486 symbols in the right list.
7487 (Symbol_table::sized_finalized_symbol): Check
7488 Symbol::is_common_shndx.
7489 (Symbol_table::sized_write_globals): Likewise.
7490 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7491 common symbol lists. Don't call do_allocate_commons_list if the
7492 list is empty.
7493 (Symbol_table::do_allocate_commons_list): Remove is_tls
7494 parameter. Add comons_section_type parameter. Change all
7495 callers. Handle small and large common symbols.
7496 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7497 Symbol::is_common_shndx.
7498 * resolve.cc (symbol_to_bits): Likewise.
7499 * target.h (Target::small_common_shndx): New function.
7500 (Target::small_common_section_flags): New function.
7501 (Target::large_common_shndx): New function.
7502 (Target::large_common_section_flags): New function.
7503 (Target::new_output_section): New function.
7504 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7505 small_common_section_flags, and large_common_section_flags
7506 fields.
7507 (Target::do_new_output_section): New virtual function.
7508 * arm.cc (Target_arm::arm_info): Initialize new fields.
7509 * i386.cc (Target_i386::i386_info): Likewise.
7510 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7511 Likewise.
7512 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7513 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7514 (Target_x86_64::do_new_output_section): New function.
7515 * configure.ac: Define conditional MCMODEL_MEDIUM.
7516 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7517 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7518 (large_LDFLAGS): Define.
7519 * testsuite/large.c: New file.
7520 * testsuite/testfile.cc (Target_test::test_target_info):
7521 Initialize new fields.
7522 * configure, testsuite/Makefile.in: Rebuild.
7523
bb04269c
DK
75242009-06-05 Doug Kwan <dougkwan@google.com>
7525
7526 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 7527 * Makefile.in: Regenerate.
bb04269c
DK
7528 * i386.cc (class Target_i386): Define new virtual method to
7529 override do_is_local_label_name in parent.
7530 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7531 local symbols if --discard-locals or -X is given.
7532 * options.h (class General_options): Declare new options
7533 '--discard-locals' and '-X' for discarding locals.
7534 * target.h (class Target): Define new methods is_local_label_name.
7535 Declare new virtual method do_is_local_label_name.
7536 * target.cc: New file.
7537 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7538 (check_SCRIPTS): Add discard_locals_test.sh.
7539 (check_DATA): Add discard_local_tests.syms.
7540 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7541 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7542 * testsuite/Makefile.in: Regenerate.
7543 * testsuite/discard_locals_test.c: New file.
7544 * testsuite/discard_locals_test.sh: Same.
7545
805bb01c
DK
75462009-06-05 Doug Kwan <dougkwan@google.com>
7547
7548 * object.cc (Sized_relobj::Sized_relobj): Initialize
7549 discarded_eh_frame_shndx_ to -1U.
7550 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7551 section.
7552 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7553 a discarded .eh_frame section.
7554 (Sized_relobj::do_finalize_local_symbols): Ditto.
7555 * object.h (class Sized_relobj): Declare new member
7556 discarded_eh_frame_shndx_.
7557 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7558 (local_labels_test.o, local_labels_test): New rules.
7559 * testsuite/Makefile.in: Regenerate.
7560
1dcd334d
DK
75612009-06-04 Doug Kwan <dougkwan@google.com>
7562
7563 * layout.cc (Layout::section_name_mapping): Add mapping for
7564 special ARM sections.
7565
96d49306
DK
75662009-06-03 Doug Kwan <dougkwan@google.com>
7567
7568 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7569 (utils::has_overflow): Same.
7570
dff16297
ILT
75712009-06-03 Ian Lance Taylor <iant@google.com>
7572
7573 * layout.cc (Layout::section_name_mapping): New array, replacing
7574 Layout::linkonce_mapping.
7575 (Layout::section_name_mapping_count): New variable, replacing
7576 Layout::linkonce_mapping_count.
7577 (Layout::linkonce_output_name): Remove.
7578 (Layout::output_section_name): Rewrite.
7579 * layout.h (class Layout): Rename Linkonce_mapping to
7580 Section_name_mapping, linkonce_mapping to section_name_mapping,
7581 linkonce_mapping_count to section_name_mapping_count. Don't
7582 declare linkonce_output_name.
7583
c121c671
DK
75842009-06-03 Doug Kwan <dougkwan@google.com>
7585
7586 * gold/arm.cc (namespace utils): New.
7587 (Target_arm::reloc_is_non_pic): Define new method.
7588 (class Arm_relocate_functions): New.
7589 (Target_arm::Relocate::relocate): Handle relocation types used by
7590 Android.
7591
07800fab
ILT
75922009-06-03 Ian Lance Taylor <iant@google.com>
7593
7594 * arm.cc (Target_arm::scan::global): Use || instead of |.
7595
c121c671
DK
75962009-06-02 Doug Kwan <dougkwan@google.com>
7597
7598 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7599 issued_non_pic_error_.
7600 (class Target_arm::Scan): Declare new method check_non_pic.
7601 Define new method symbol_needs_plt_entry.
7602 Declare new data member issued_non_pic_error_.
7603 (class Target_arm::Relocate): Declare new method
7604 should_apply_static_reloc.
7605 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7606 (Target_arm::Scan::check_non_pic): Define new method.
7607 (Target_arm::Scan::local): Handle a small subset of reloc types used
7608 by Android.
7609 (Target_arm::Scan::local): Same.
7610 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7611
b19b0c6d
ILT
76122009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7613
7614 * incremental.cc (Incremental_inputs::report_command_line): Filter
7615 out --incremental-* options.
7616
94cdfcff
DK
76172009-05-29 Doug Kwan <dougkwan@google.com>
7618
7619 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7620 template class.
7621 (class Target_arm): Update comment.
7622 (Target_arm::Target_arm): Initialize new data members GOT_,
7623 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7624 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7625 and Target_arm::rel_dyn_section.
7626 Declare new_enum Target_arm::Got_type.
7627 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7628 and DYNBSS_.
7629 Update commments for member do_dynsym_value.
7630 (Target_arm::got_size, Target_arm::plt_section,
7631 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7632 new methods inside class defintion.
7633 (Target_arm::got_section): Define new method.
7634 (Target_arm::rel_dyn_section): Same.
7635 (Output_data_plt_arm): New template class.
7636 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7637 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7638 (Output_data_plt_arm::add_entry): Same.
7639 (Output_data_plt_arm::first_plt_entry): Define new
7640 static data member for PLT instruction template.
7641 (Output_data_plt_arm::plt_entry): Same.
7642 (Output_data_plt_arm::do_write): Define new method.
7643 (Target_arm::make_plt_entry): Same.
7644 (Target_arm::do_finalize_sections): Same.
7645 (Target_arm::do_dynsym_value): Same.
7646
4a657b0d
DK
76472009-05-28 Doug Kwan <dougkwan@google.com>
7648
7649 * Makefile.am (TARGETSOURCES): Add arm.cc.
7650 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7651 * Makefile.in: Regenerate.
7652 * arm.cc: New file.
7653 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7654
e7ae8c36
DK
76552009-05-26 Doug Kwan <dougkwan@google.com>
7656
7657 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7658 (General_options::check_excluded_libs): Strip off directories in
7659 archive name before matching like GNU ld does.
7660 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7661 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7662 (exclude_libs_test_LDFLAGS): Add linker option
7663 -Wl,--exclude-libs,libexclude_libs_test_3
7664 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7665 an explicit archive without using -l.
7666 (alt/libexclude_libs_test_3.a): New make rule.
7667 * testsuite/Makefile.in: Regenerate.
7668 * testsuite/exclude_libs_test.c : Declare lib3_default().
7669 (main): Call it.
7670 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7671 * exclude_libs_test_3.c: New file.
7672
f12e7348
NC
76732009-05-26 Nick Clifton <nickc@redhat.com>
7674
7675 * po/id.po: New Indonesian translation.
7676 * po/gold.pot: Updated template file.
7677
4daadc0d
ST
76782009-05-22 Sriraman Tallam <tmsriram@google.com>
7679
e1df38aa 7680 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
7681 gc_comdat_test files. Add -Wl,--gc-sections to build
7682 gc_comdat_test.
7683 * testsuite/Makefile.in: Regenerate.
7684 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7685
531813ad
ST
76862009-05-21 Sriraman Tallam <tmsriram@google.com>
7687
7688 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7689 kept comdat section was garbage collected.
7690 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7691 * testsuite/Makefile.in: Regenerate.
7692 * testsuite/gc_comdat_test.sh: New file.
7693 * testsuite/gc_comdat_test_1.cc: New file.
7694 * testsuite/gc_comdat_test_2.cc: New file.
7695
65514900
CC
76962009-05-19 Doug Kwan <dougkwan@google.com>
7697
7698 * archive.cc (Archive::Archive): Move constructor from archive.h
7699 to here. Initialize no_export_.
7700 (Archive::get_elf_object_for_member): Set no_export flag of object.
7701 * archive.h (Archive::Archive): Move constructor body to
7702 archive.cc.
7703 (Archive::no_export): New method.
7704 (Archive::no_export_): New field.
7705 * object.h (Object::Object): Initialize no_export_ to false.
7706 (Object::no_export, Object::set_no_export): New methods.
7707 (Object::no_export_): New field.
7708 * options.cc (General_options::parse_exclude_libs): New method.
7709 (General_options::check_excluded_libs) Same.
7710 * options.h (exclude_libs): New option.
7711 (General_options::check_excluded_libs): New method declaration.
7712 (General_options::excluded_libs_): New field.
7713 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7714 default or protected visibility if an object has no-export flag set.
7715 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7716 (check_SCRIPTS): Add exclude_libs_test.sh.
7717 (check_DATA): Add exclude_libs_test.syms.
7718 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7719 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7720 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7721 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7722 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7723 libexclude_libs_test_2.a): New rules.
7724 * testsuite/Makefile.in: Regenerate.
7725 * testsuite/exclude_libs_test.c: New file.
7726 * testsuite/exclude_libs_test.sh: Ditto.
7727 * testsuite/exclude_libs_test_1.c: Ditto.
7728 * testsuite/exclude_libs_test_2.c: Ditto.
7729
1b77ea50
ILT
77302009-05-15 Ian Lance Taylor <iant@google.com>
7731
7732 * configure.ac: Check for declarations for cases where libiberty.h
7733 checks HAVE_DECL_xxx.
7734 * configure, config.in: Rebuild.
7735
072fe7ce
ILT
77362009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7737
7738 * gold.h (Incremental_argument_list): Remove (invalid) forward
7739 declaration.
7740 * incremental.cc (Incremental_inputs::report_achive): New method.
7741 (Incremental_inputs::report_object): New method.
7742 (Incremental_inputs::report_script): New method.
7743 (Incremental_inputs::finalize_inputs): New method.
7744 (Incremental_inputs::finalize): Call finalize_inputs().
7745 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7746 Create inputs entries.
7747 * incremental.h (Incremental_input_type): New enum.
7748 (Incremental_inputs::Incremental_input): Initialize new fields.
7749 (Incremental_inputs::report_inputs): New method.
7750 (Incremental_inputs::report_achive): New method.
7751 (Incremental_inputs::report_object): New method.
7752 (Incremental_inputs::report_script): New method.
7753 (Incremental_inputs::finalize_inputs): New method.
7754 (Incremental_inputs::Input_info): New struct.
7755 (Incremental_inputs::Input_info_map): New typedef.
7756 (Incremental_inputs::lock_): New field.
7757 (Incremental_inputs::Inputs_): New field.
7758 (Incremental_inputs::Inputs_map): New field.
7759 * main.cc (main): Call Incremental_input::report_inputs.
7760 * options.h (Input_argument_list): Typedef moved from
7761 Input_arguments.
7762 (Input_file_group::Files): Remove, use ::Input_argument_list.
7763 (Input_file_group::Input_argument_list): Remove, use
7764 ::Input_argument_list.
7765 * plugin.cc (Plugin_manager::add_input_file): Add error in
7766 incremental build.
7767 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7768 functions.
7769 * script.cc (read_input_script): Call
7770 Incremental_input::report_script.
7771 * script.h (Script_info): New class.
7772
b0481b0b
ILT
77732009-04-27 Ian Lance Taylor <iant@google.com>
7774
7775 * x86_64.cc (do_adjust_output_section): Set entsize to
7776 plt_entry_size.
7777
b22a5a41 77782009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
7779
7780 * output.cc (Output_file::close): After short writes, continue
7781 writing from the correct offset in the buffer being written.
7782
40fde488
CD
77832009-04-23 Chris Demetriou <cgd@google.com>
7784
7785 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7786 * configure: Regenerate.
7787 * config.in: Regenerate.
7788 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7789 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7790
3ce2c28e
ILT
77912009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7792
7793 * incremental.cc (Incremental_inputs_header_data): Renamed from
7794 Incremental_input_header_data.
7795 (Incremental_inputs_header_data::data_size): New field.
7796 (Incremental_inputs_header_data::put_input_file_count): Renamed
7797 from input_file_count.
7798 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7799 from command_line_offset.
7800 (Incremental_inputs_header_data::put_reserved): Renamed from
7801 put_reserved.
7802 (Incremental_inputs_entry_data): Renamed from
7803 Incremental_input_entry_data.
7804 (Incremental_inputs_entry_data::data_size): New field.
7805 (Incremental_inputs::report_command_line): New method.
7806 (Incremental_inputs::finalize): New method.
7807 (Incremental_inputs::create_incremental_inputs_data): New method.
7808 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7809 * incremental.h: New file.
7810 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7811 (Layout::finalize): Create incremental inputs section in
7812 incremental builds.
7813 (Layout::create_incremental_info_sections): New method.
7814 * layout.h (Layout::incremental_inputs): New method.
7815 (Layout::create_incremental_info_sections): New method.
7816 (Layout::incremental_inputs_): New field.
7817 * main.cc (main): Notify Incremental_input of the command line.
7818
e55bde5e
ILT
78192009-04-01 Ian Lance Taylor <iant@google.com>
7820 Mikolaj Zalewski <mikolajz@google.com>
7821
7822 * gold.h (reserve_unordered_map): Define, three versions, one for
7823 each version of Unordered_map.
7824 * layout.cc (Layout::Layout): Remove options parameter. Add
7825 number_of_input_files parameter. Don't initialize options_.
7826 Initialize number_of_input_files_ and resized_signatures_. Move
7827 sections_are_attached_.
7828 (Layout::layout_group): Reserve space for group_signatures_.
7829 (Layout::find_or_add_kept_section): Change name parameter to be a
7830 reference. Resize signatures_ map when it gets large enough.
7831 (Layout::layout_eh_frame): Use parameters->options() instead of
7832 this->options_.
7833 (Layout::make_output_section): Likewise.
7834 (Layout::attach_allocated_section_to_segment): Likewise.
7835 (Layout::finalize, Layout::create_executable_stack): Likewise.
7836 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7837 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7838 * layout.h (class Layout): Update declarations. Remove options_
7839 field. Add number_of_input_files_ and resized_signatures_
7840 fields. Move sections_are_attached_ field.
7841 * main.cc (main): Pass number of input files to Layout
7842 constructor. Don't pass options.
7843
154b857c
ILT
78442009-03-30 Ian Lance Taylor <iant@google.com>
7845
7846 * ffsll.c (ffsll): Correct implementation.
7847
2f35ab9b
ILT
78482009-03-27 Ian Lance Taylor <iant@google.com>
7849
fd03461a
ILT
7850 * ffsll.c: New file.
7851 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7852 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7853 * ftruncate.c (ftruncate): Declare before definition.
7854 * mremap.c (mremap): Likewise.
7855 * pread.c (pread): Likewise.
7856 * configure, Makefile.in, config.in: Rebuild.
7857
2f35ab9b
ILT
7858 * mremap.c: New file.
7859 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7860 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7861 (mremap): Declare if HAVE_MREMAP is not defined.
7862 * configure, Makefile.in, config.in: Rebuild.
7863
33aea2fd
CC
78642009-03-27 Cary Coutant <ccoutant@google.com>
7865
7866 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7867 position independent.
7868 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7869 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7870
6d479619
CC
78712009-03-24 Cary Coutant <ccoutant@google.com>
7872
7873 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7874 an executable.
7875 (needs_dynamic_reloc): Likewise.
7876
afc06bb8
ILT
78772009-03-24 Ian Lance Taylor <iant@google.com>
7878
7879 * yyscript.y (file_cmd): Recognize EXTERN.
7880 (extern_name_list, extern_name_list_body): New nonterminals.
7881 * script.cc (script_add_extern): Define.
7882 * script-c.h (script_add_extern): Declare.
7883
f6060a4d
ILT
78842009-03-24 Rafael Avila de Espindola <espindola@google.com>
7885
7886 * object.cc (is_elf_object): Define.
7887 * object.h (is_elf_object): Declare.
7888 * archive.cc (Archive::get_elf_object_for_member): Call
7889 is_elf_object.
33aea2fd 7890 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 7891
26736d8e
ILT
78922009-03-24 Elliott Hughes <enh@google.com>
7893
7894 * output.cc (Output_file::map_anonymous): Define.
7895 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7896 try an anonymous one. Report the size if the mmap fails.
7897 * output.h (class Output_file): Declare map_anonymous.
7898
22fd9730
ILT
78992009-03-24 Ian Lance Taylor <iant@google.com>
7900
7901 * target-select.cc (instantiate_target): Don't acquire the lock if
7902 the instantiated_target_ field has already been set.
7903
cb010894
ILT
79042009-03-23 Ian Lance Taylor <iant@google.com>
7905
7f055c20
ILT
7906 * gold-threads.h (class Initialize_lock): Define.
7907 * gold-threads.cc (class Initialize_lock_once): Define.
7908 (initialize_lock_control): New static variable.
7909 (initialize_lock_pointer): New static variable.
7910 (initialize_lock_once): New static function.
7911 (Initialize_lock::Initialize_lock): Define.
7912 (Initialize_lock::initialize): Define.
7913 * target-select.h: Include "gold-threads.h".
7914 (class Target_selector): Add lock_ and initialize_lock_ fields.
7915 Don't define instantiate_target, just declare it.
7916 * target-select.cc (Target_selector::Target_selector): Initialize
7917 new fields.
7918 (Target_selector::instantiate_target): Define.
7919 * descriptors.h: Include "gold-threads.h".
7920 (class Descriptors): Add initialize_lock_ field.
7921 * descriptors.cc (Descriptors::Descriptors): Initialize new
7922 field.
7923 (Descriptors::open): Use initialize_lock_ field
7924 * errors.h (class Errors): Add initialize_lock_ field.
7925 * errors.cc (Errors::Errors): Initialize new field.
7926 (Errors::initialize_lock): Use initialize_lock_ field.
7927 * powerpc.cc (class Target_selector_powerpc): Remove
7928 instantiated_target_ field. In do_recognize call
7929 instantiate_target rather than do_instantiate_target. In
7930 do_instantiate_target just allocate a new target.
7931 * sparc.cc (class Target_selector_sparc): Likewise.
7932
36959681
ILT
7933 * freebsd.h: New file.
7934 * i386.cc: Include "freebsd.h".
7935 (Target_i386): Derive from Target_freebsd rather than
7936 Sized_target.
7937 (Target_selector_i386): Derive from Target_selector_freebsd rather
7938 than Target_selector.
7939 * x86_64.cc: Include "freebsd.h".
7940 (Target_x86_64): Derive from Target_freebsd rather than
7941 Sized_target.
7942 (Target_selector_x86_64): Derive from Target_selector_freebsd
7943 rather than Target_selector.
7944 * target.h (class Target): Add adjust_elf_header and
7945 do_adjust_elf_header.
7946 * output.cc (Output_file_header:: do_sized_write): Call target
7947 adjust_elf_header routine.
7948 * configure.tgt: Set targ_osabi.
7949 * configure.ac: Define GOLD_DEFAULT_OSABI.
7950 * parameters.cc (Parameters::default_target): Pass
7951 GOLD_DEFAULT_OSABI to select_target.
7952 * target-select.h (class Target_selector): Make instantiate_target
7953 protected rather than private.
7954 * Makefile.am (HFILES): Add freebsd.h.
7955 * configure, Makefile.in, config.in: Rebuild.
7956
cb010894
ILT
7957 * merge.cc (do_add_input_section): Correct pend value. Change
7958 message about last entry not being null terminated from error to
7959 warning.
7960
0e879927
ILT
79612009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7962
7963 * incremental.cc: New file.
7964 * Makefile.am (CCFILES): Add incremental.cc.
7965 * Makefile.in: Rebuild.
7966
41105937
PP
79672009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7968
7969 * layout.cc (Layout::output_section_name): Preserve names
7970 of '.note.' sections.
e1df38aa 7971
60439920
ILT
79722009-03-19 Ian Lance Taylor <iant@google.com>
7973
7974 * descriptors.cc (Descriptors::open): Check that the options are
7975 valid before using them.
7976
0d371ad3
ILT
79772009-03-18 Ian Lance Taylor <iant@google.com>
7978
7979 * script-sections.h: Include <list>.
7980 (class Script_sections): Change Sections_elements from std::vector
7981 to std::list. Typedef public Elements_iterator. Add
7982 orphan_section_placement_, data_segment_align_start_, and
7983 saw_data_segment_align_ fields. Remove data_segment_align_index_
7984 field.
7985 * script-sections.cc (class Orphan_section_placement): New class.
7986 (class Sections_element): Add virtual functions is_relro and
7987 orphan_section_init. Remove virtual function place_orphan_here.
7988 (class Output_section_definition): Add is_relro and
7989 orphan_section_init. Remove place_orphan_here.
7990 (class Orphan_output_section): Likewise.
7991 (Script_sections::Script_sections): Update for field changes.
7992 (Script_sections::data_segment_align): Set saw_data_segment_align_
7993 and data_segment_align_start_, not data_segment_align_index.
7994 (Script_sections::data_segment_relro_end): Check
7995 saw_data_segment_align_. Use data_segment_align_start_ rather
7996 than data_segment_align_index_.
7997 (Script_sections::place_orphan): Rewrite to use
7998 Orphan_section_placement.
7999
9201d894
ILT
80002009-03-17 Ian Lance Taylor <iant@google.com>
8001
9c5b8369
ILT
8002 * archive.cc (Archive::add_symbols): Check for a version attached
8003 to the symbol name in the archive map.
8004 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8005 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8006 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8007 (ver_test_11.a): New target.
8008 * testsuite/Makefile.in: Rebuild.
8009
9201d894
ILT
8010 * configure.ac: Check for chsize and posix_fallocate. Replace
8011 ftruncate.
8012 * ftruncate.c: New file, from gnulib.
8013 * output.cc (posix_fallocate): Define dummy version if not
8014 HAVE_POSIX_FALLOCATE.
8015 (Output_file::map): Call posix_fallocate rather than lseek and
8016 write.
8017 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8018 * configure, Makefile.in, config.in: Rebuild.
8019
ef4ab7a8 80202009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 8021
ef4ab7a8
PP
8022 * layout.h (Layout::create_note): Add section_name parameter.
8023 * layout.cc (Layout::create_note): Likewise.
8024 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 8025
8c500701
ILT
80262009-03-17 Ian Lance Taylor <iant@google.com>
8027
e85b18e1
ILT
8028 * descriptors.cc: Include "options.h".
8029 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8030 (Descriptors::open): Always use O_CLOEXEC when opening a new
8031 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8032 then set FD_CLOEXEC.
8033
9efe6174
ILT
8034 * sparc.cc (class Target_sparc): Add has_got_section.
8035 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8036 make sure we have a GOT section.
8037
8038 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8039 (Target_sparc::Scan::local): Likewise.
8040 (Target_sparc::Scan::global): Likewise.
8041 (Target_sparc::Relocate::relocate): Likewise.
8042 (Target_sparc::Relocate::relocate_tls): Likewise.
8043
8c500701
ILT
8044 * symtab.cc (Symbol_table::define_default_version): New function,
8045 broken out of add_from_object.
8046 (Symbol_table::add_from_object): Call define_default_version.
8047 (Symbol_table::define_special_symbol): Add resolve_oldsym
8048 parameter. Change all callers. If the version for a symbol comes
8049 from a version script, resolve it with the symbol with the same
8050 name with no version. Also add the symbol without a version if
8051 appropriate.
8052 (do_define_in_output_data): If resolving with oldsym, don't delete
8053 sym.
8054 (do_define_in_output_segment): Likewise.
8055 (do_define_as_constant): Likewise.
8056 * symtab.h (class Symbol_table): Update declarations.
8057
f1ed28fb
ILT
80582009-03-13 Ian Lance Taylor <iant@google.com>
8059
15f8229b
ILT
8060 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8061 (Read_symbols::requeue): New function.
8062 (Read_symbols::do_read_symbols): If make_elf_object fails because
8063 the target type is not configured, and the file was searched for,
8064 issue a warning and retry with the next directory.
8065 (Add_symbols::run): If the file has an incompatible format, and
8066 it was searched for, requeue the Read_symbols task. On error,
8067 release the object.
8068 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8069 dirindex parameter to constructor. Change all callers. Declare
8070 incompatible_warning and requeue.
8071 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8072 input_argument_ and input_group_ fields. Add them to
8073 constructor. Change all callers.
8074 (class Read_script): Add dirindex_ field. Add it to constructor.
8075 Change all callers.
8076 * archive.cc (Archive::setup): Remove input_objects parameter.
8077 Change all callers.
8078 (Archive::get_file_and_offset): Likewise.
8079 (Archive::read_all_symbols): Likewise.
8080 (Archive::read_symbols): Likewise.
8081 (Archive::get_elf_object_for_member): Remove input_objects
8082 parameter. Add punconfigured parameter. Change all callers.
8083 (Archive::add_symbols): Change return type to bool. Check return
8084 value of include_member.
8085 (Archive::include_all_members): Likewise.
8086 (Archive::include_member): Change return type to bool. Return
8087 false if first included object has incompatible target. Set
8088 included_member_ field.
8089 (Add_archive_symbols::run): If add_symbols returns false, requeue
8090 Read_symbols task.
8091 * archive.h (class Archive): Add included_member_ field.
8092 Initialize it in constructor. Add input_file and searched_for
8093 methods. Update declarations.
8094 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8095 input_argument_ fields. Add them to constructor. Change all
8096 callers.
8097 * script.cc: Include "target-select.h".
8098 (class Parser_closure): Add skip_on_incompatible_target_ and
8099 found_incompatible_target_ fields. Add
8100 skip_on_incompatible_target parameter to constructor. Change all
8101 callers. Add methods skip_on_incompatible_target,
8102 clear_skip_on_incompatible_target, found_incompatible_target, and
8103 set_found_incompatible_target.
8104 (read_input_script): Add dirindex parameter. Change all callers.
8105 If parser finds an incompatible target, requeue Read_symbols
8106 task.
8107 (script_set_symbol): Clear skip_on_incompatible_target in
8108 closure.
8109 (script_add_assertion, script_parse_option): Likewise.
8110 (script_start_sections, script_add_phdr): Likewise.
8111 (script_check_output_format): New function.
8112 * script.h (read_input_script): Update declaration.
8113 * script-c.h (script_check_output_format): Declare.
8114 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8115 (ignore_cmd): Remove OUTPUT_FORMAT.
8116 * fileread.cc (Input_file::Input_file): Add explicit this.
8117 (Input_file::will_search_for): New function.
8118 (Input_file::open): Add pindex parameter. Change all callers.
8119 * fileread.h (class Input_file): Add input_file_argument method.
8120 Declare will_search_for. Update declarations.
8121 * object.cc (make_elf_object): Add punconfigured parameter.
8122 Change all callers.
8123 * object.h (class Object): Make input_file public. Add
8124 searched_for method.
8125 (make_elf_object): Update declaration.
8126 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8127 restart search.
8128 * dirsearch.h (class Dirsearch): Update declaration.
8129 * options.h (class General_options): Add --warn-search-mismatch.
8130 * parameters.cc (Parameters::is_compatible_target): New function.
8131 * parameters.h (class Parameters): Declare is_compatible_target.
8132 * workqueue.cc (Workqueue::add_blocker): New function.
8133 * workqueue.h (class Workqueue): Declare add_blocker.
8134
f1ed28fb
ILT
8135 * fileread.cc (Input_file::open): Remove options parameter.
8136 Change all callers.
8137 (Input_file::open_binary): Likewise.
8138 * script.cc (read_input_script): Likewise.
8139 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8140 options parameter from constructor. Change all callers.
8141 (class Read_script): Likewise.
8142 * fileread.h (class Input_file): Update declarations.
8143 * script.h (read_input_script): Update declaration.
8144
34dd024a
NC
81452009-03-10 Nick Clifton <nickc@redhat.com>
8146
8147 * po/es.po: New Spanish translation.
8148
6d71b17c
CC
81492009-03-06 Cary Coutant <ccoutant@google.com>
8150
8151 * options.cc (parse_short_option): Keep dash_z from registering itself.
8152
031cdbed
ILT
81532009-03-03 Ian Lance Taylor <iant@google.com>
8154
8155 PR 9918
8156 * target-reloc.h (relocate_section): Pass output_section to
8157 relocate.
8158 * i386.cc (Target_i386::should_apply_static_reloc): Add
8159 output_section parameter. Change all callers.
8160 (Target_i386::Relocate::relocate): Add output_section parameter.
8161 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8162 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8163 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8164 * testsuite/two_file_shared.sh: New script.
8165 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8166 (check_DATA): Add two_file_shared.dbg.
8167 (two_file_shared.dbg): New target.
8168 * testsuite/Makefile.in: Rebuild.
8169
15d5fa16
ILT
81702009-03-01 Ian Lance Taylor <iant@google.com>
8171
8172 * configure.ac: Check for byteswap.h.
8173 * configure: Rebuild.
8174 * config.in: Rebuild.
8175
8a4c0b0d
ILT
81762009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8177
8178 * layout.cc (Layout::find_or_add_kept_section): New function.
8179 (Layout::add_comdat): Removed.
8180 * layout.h (struct Kept_section): Move out of class Layout.
8181 Remove trailing underscores from field names. Add group_sections
8182 field. Rename group_ field to is_group. Change all uses.
8183 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8184 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8185 comdat_groups_ field.
8186 (Sized_relobj::include_section_group): Use
8187 find_or_add_kept_section and Kept_section::group_sections.
8188 (Sized_relobj::include_linkonce_section): Likewise.
8189 * object.cc (class Sized_relobj): Don't define Comdat_group or
8190 Comdat_group_table. Remove find_comdat_group and
8191 add_comdat_group. Remove comdat_groups_ field.
8192 * plugin.cc (include_comdat_group): Use
8193 Layout::find_or_add_kept_section.
8194
b4ecf66b
ILT
81952009-02-28 Ian Lance Taylor <iant@google.com>
8196
14359ca0
ILT
8197 * README: --gc-sections and map files are now supported. Document
8198 some build requirements.
8199
b4ecf66b
ILT
8200 PR 6992
8201 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8202 relocatable link set the value of the section symbol to zero.
8203 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8204 relocatable link don't include the section address in the local
8205 symbol value.
8206
0602e05a
ILT
82072009-02-27 Ian Lance Taylor <iant@google.com>
8208
fd9d194f
ILT
8209 PR 6811
8210 * options.h (class Search_directory): Add is_system_directory.
8211 (class General_options): Declare is_in_system_directory.
8212 * options.cc (get_relative_sysroot): Make static.
8213 (get_default_sysroot): Make static.
8214 (General_optoins::is_in_system_directory): New function.
8215 * fileread.cc (Input_file::is_in_system_directory): New function.
8216 * fileread.h (class Input_file): Declare is_in_system_directory.
8217 * object.h (class Object): Add is_in_system_directory.
8218 (class Input_objects): Remove system_library_directory_ field.
8219 * object.cc (Input_objects::add_object): Don't set
8220 system_library_directory_.
8221 (input_objects::found_in_system_library_directory): Remove.
8222 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8223 parameter. Change all callers.
8224 (Symbol_table::sized_write_globals): Likewise.
8225 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8226 Call Object::is_in_system_directory.
8227 * symtab.h (class Symbol_table): Update declarations.
8228
61edd21f
ILT
8229 PR 5990
8230 * descriptors.h (Open_descriptor): Add is_on_stack field.
8231 * descriptors.cc (Descriptors::open): If the descriptor is on the
8232 top of the stack, remove it. Initialize is_on_stack field.
8233 (Descriptors::release): Only add pod to stack if it is not on the
8234 stack already.
8235 (Descriptors::close_some_descriptor): Clear stack_next and
8236 is_on_stack fields.
8237
e29e076a
ILT
8238 PR 7091
8239 * output.cc (Output_section::find_starting_output_address): Rename
8240 from starting_output_address; add PADDR parameter; change return
8241 type.
8242 * output.h (class Output_section): Declare
8243 find_starting_output_address instead of starting_output_address.
8244 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8245 section symbol for which we can't find a merge section.
8246
0602e05a
ILT
8247 PR 9836
8248 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8249 hidden or internal, force the symbol to be local.
8250 * resolve.cc (Symbol::override_visibility): Define.
8251 (Symbol::override_base): Use override_visibility.
8252 (Symbol_table::resolve): Likewise.
8253 (Symbol::override_base_with_special): Likewise.
8254 (Symbol_table::override_with_special): If the visibility is hidden
8255 or internal, force the symbol to be local.
8256 * symtab.h (class Symbol): Add set_visibility and
8257 override_visibility.
8258 * testsuite/ver_test_1.sh: New file.
8259 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8260 (check_DATA): Add ver_test_1.syms.
8261 (ver_test_1.syms): New target.
8262 * testsuite/Makefile.in: Rebuild.
8263
401a9a73
CC
82642009-02-25 Cary Coutant <ccoutant@google.com>
8265
8266 * layout.cc (Layout::choose_output_section): Don't rename sections
8267 when using a linker script that has a SECTIONS clause.
8268 * Makefile.in: Regenerate.
8269
8270 * testsuite/Makefile.am (script_test_5.sh): New test case.
8271 * testsuite/Makefile.in: Regenerate.
8272 * testsuite/script_test_5.cc: New file.
8273 * testsuite/script_test_5.sh: New file.
8274 * testsuite/script_test_5.t: New file.
8275
f488e4b0
CC
82762009-02-13 Rafael Avila de Espindola <espindola@google.com>
8277
8278 * archive.cc (Archive::include_member): Update calls to add_symbols.
8279 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8280 the Layout argument.
8281 * dynobj.h (do_add_symbols): Add the Layout argument.
8282 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8283 Layout argument.
8284 * object.h (Object::add_symbols): Add the Layout argument.
8285 (Object::do_add_symbols): Add the Layout argument.
8286 (Sized_relobj::do_add_symbols): Add the Layout argument.
8287 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8288 Unify the two versions.
8289 (Add_plugin_symbols): Remove.
8290 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8291 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8292 (Add_plugin_symbols): Remove.
8293 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8294 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8295 (Add_symbols::run): Make it work with Pulginobj.
8296
89dd1680
ILT
82972009-02-06 Ian Lance Taylor <iant@google.com>
8298
8299 * object.cc (Sized_relobj::do_layout): Make info message start
8300 with lower case letter.
8301
266d0a74
ILT
83022009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8303
602b464e
ILT
8304 * binary.cc: Fix file comment.
8305
266d0a74
ILT
8306 * options.h (enum Incremental_disposition): Define.
8307 (class General_options): Add new options: --incremental,
8308 --incremental_changed, --incremental_unchanged,
8309 --incremental_unknown. Add incremental_disposition_ and
8310 implicit_incremental_ fields.
8311 (General_options::incremental_disposition): New function.
8312 (class Position_dependent_options): Add incremental_disposition
8313 option.
8314 (Position_dependent_options::copy_from_options): Set incremental
8315 dispositions.
8316 * options.cc (General_options::parse_incremental_changed): New
8317 function.
8318 (General_options::parse_incremental_unchanged): New function.
8319 (General_options::parse_incremental_unknown): New function.
8320 (General_options::General_options): Initialize new fields
8321 incremental_disposition_ and implicit_incremental_.
8322 (General_options::finalize): Check for uasge of --incremental-*
8323 without --incremental.
8324
f073bbf7
CD
83252009-02-06 Chris Demetriou <cgd@google.com>
8326
8327 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8328 pointer and to report location as the file name associated with
8329 the symbol.
8330 (gold_undefined_symbol_at_location): New function to replace the
8331 old gold_undefined_symbol functionality.
8332 * target-reloc.h (relocate_section): Update to use
8333 gold_undefined_symbol_at_location.
8334 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8335 Call gold_undefined_symbol function rather than gold_error.
8336 * errors.h (Errors::undefined_symbol): Take location as a
8337 string, rather than calculating it from a relocation.
8338 * errors.cc (Errors::fatal): Print "fatal error:" before the
8339 formatted message.
8340 (Errors::error, Errors::error_at_location): Print "error: "
8341 before the formatted message.
8342 (Errors::undefined_symbol): Take location as a string, rather
8343 than calculating it from a relocation.
8344 (gold_undefined_symbol_at_location): New function akin to
8345 old gold_undefined_symbol, calculates location from relocation.
8346 (gold_undefined_symbol): Change to take only a Symbol pointer
8347 and to report location as the file name associated with the symbol.
8348 * testsuite/debug_msg.sh: Update for changed error messages.
8349 * testsuite/undef_symbol.sh: Likewise.
8350
8e94a90c
ILT
83512009-02-04 Duncan Sands <baldrick@free.fr>
8352
8353 PR 9812
8354 * reduced_debug_output.h
8355 (Output_reduced_debug_abbrev_section::failed): Use format for
8356 gold_warning.
8357 (Output_reduced_debug_info_section::faild): Likewise.
8358
88a0e15b
ILT
83592009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8360
8361 * script.cc (Lazy_demangler): New class.
8362 (Version_script_info::get_symbol_version_helper): Demangle a
8363 symbol only once.
8364
5efc7cd2
CC
83652009-01-29 Cary Coutant <ccoutant@google.com>
8366
8367 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8368 to __tls_get_addr.
8369 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8370
e0ebcf42
ILT
83712009-01-28 Ian Lance Taylor <iant@google.com>
8372
5efc7cd2 8373 * version.cc (version_string): Bump to 1.9.
75fe7426 8374
e0ebcf42
ILT
8375 * gold.h: Include <cstring> and <stdint.h>.
8376 * version.cc: Include <cstdio>.
8377 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8378 warning.
8379 * reduced_debug_output.cc (insert_into_vector): Rename from
8380 Insert_into_vector; change all callers. Use Swap_unaligned to
8381 avoid aliasing issue; remove union since it is unnecessary.
8382
8e2813be 83832009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
8384
8385 * Makefile.am (CCFILES): Add gc.cc.
8386 (HFILES): Add gc.h.
8387 * Makefile.in: Regenerate.
8388 * gold.cc (Gc_runner): New class.
8389 (queue_initial_tasks): Call garbage collection related tasks
8390 when corresponding options are invoked.
8391 (queue_middle_gc_tasks): New function.
8392 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8393 processed early before laying out sections during garbage collection.
8394 * gold.h (queue_middle_gc_tasks): New function.
8395 (is_prefix_of): Move from "layout.cc".
8396 * i386.cc (Target_i386::gc_process_relocs): New function.
8397 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8398 * main.cc (main): Create object of class "Garbage_collection".
8399 * object.cc (Relobj::copy_symbols_data): New function.
8400 (Relobj::is_section_name_included): New function.
e1df38aa
NC
8401 (Sized_relobj::do_layout): Allow this function to be called twice
8402 during garbage collection and defer layout of section during the
6d03d481
ST
8403 first call.
8404 * object.h (Relobj::get_symbols_data): New function.
8405 (Relobj::is_section_name_included): New function.
8406 (Relobj::copy_symbols_data): New function.
8407 (Relobj::set_symbols_data): New function.
8408 (Relobj::get_relocs_data): New function.
8409 (Relobj::set_relocs_data): New function.
8410 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8411 (Relobj::gc_process_relocs): New function.
8412 (Relobj::do_gc_process_relocs): New pure virtual function.
8413 (Relobj::sd_): New data member.
8414 (Sized_relobj::is_output_section_offset_invalid): New function.
8415 (Sized_relobj::do_gc_process_relocs): New function.
8416 * options.h (General_options::gc_sections): Modify to not be a no-op.
8417 (General_options::print_gc_sections): New option.
8418 * plugin.cc (Plugin_finish::run): Remove function call to
8419 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8420 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8421 * reloc.cc (Read_relocs::run): Add task to process relocs and
8422 determine unreferenced sections when doing garbage collection.
8423 (Gc_process_relocs): New class.
8424 (Sized_relobj::do_gc_process_relocs): New function.
8425 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8426 sections that are garbage collected.
8427 * reloc.h (Gc_process_relocs): New class.
8428 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8429 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8430 symbols whose corresponding sections are garbage collected.
8431 (Symbol_table::Symbol_table): Add new parameter for the garbage
8432 collection object.
8433 (Symbol_table::gc_mark_undef_symbols): New function.
8434 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8435 (Symbol_table::gc_mark_dyn_syms): New function.
8436 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8437 as garbage.
8438 (Symbol_table::add_from_object): Likewise.
8439 (Symbol_table::add_from_relobj): When building shared objects, do not
8440 treat externally visible symbols as garbage.
8441 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8442 table information for static and relocatable links.
8443 * symtab.h (Symbol_table::set_gc): New function.
8444 (Symbol_table::gc): New function.
8445 (Symbol_table::gc_mark_undef_symbols): New function.
8446 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8447 (Symbol_table::gc_mark_dyn_syms): New function.
8448 (Symbol_table::gc_): New data member.
e1df38aa 8449 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
8450 function.
8451 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8452 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8453
3b293544
CF
84542009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8455
8456 * options.h (General_options::gc_sections): Define as a no-op for now.
8457 (General_options::no_keep_memory): Ditto.
8458 (General_options::Bshareable): Define.
8459 * options.cc (General_options::finalize): Honor -Bshareable.
8460
83d22aa8
AS
84612009-01-20 Andreas Schwab <schwab@suse.de>
8462
8463 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8464 read the value in the contents, since we don't use it. Use the
8465 template endianness when writing.
8466 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8467
cd536b21
AS
84682009-01-19 Andreas Schwab <schwab@suse.de>
8469
8470 * configure.tgt (powerpc64-*): Fix targ_obj.
8471
99e9a495
ILT
84722009-01-15 Ian Lance Taylor <iant@google.com>
8473
8474 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8475 local symbols when stripping all symbols.
8476
bbbfea06
CC
84772009-01-14 Cary Coutant <ccoutant@google.com>
8478
99e9a495 8479 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 8480
0f7c0701
CC
84812009-01-14 Cary Coutant <ccoutant@google.com>
8482
8483 * archive.cc (Archive::get_elf_object_for_member): Remove call
8484 to File_read::claim_for_plugin.
8485 * descriptors.cc (Descriptors::open): Remove reference to
8486 is_claimed.
8487 (Descriptors::claim_for_plugin): Remove.
8488 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8489 (Descriptors::is_claimed): Remove.
8490 (claim_descriptor_for_plugin): Remove.
8491 * fileread.cc (File_read::claim_for_plugin): Remove.
8492 * fileread.h (File_read::claim_for_plugin): Remove.
8493 (File_read::descriptor): Reopen descriptor if necessary.
8494 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8495 (Plugin_manager::all_symbols_read): Add task parameter. Change
8496 all callers.
8497 (Plugin_manager::get_input_file): New function.
8498 (Plugin_manager::release_input_file): New function.
8499 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8500 corresponding data member.
8501 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8502 and pass to base constructor. Change all callers.
8503 (get_input_file, release_input_file): New functions.
8504 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8505 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8506 (Plugin_manager::all_symbols_read): Add task parameter.
8507 (Plugin_manager::get_input_file): New function.
8508 (Plugin_manager::release_input_file): New function.
8509 (Plugin_manager::task_): New data member.
8510 (Pluginobj::Pluginobj): Add filesize parameter.
8511 (Pluginobj::filename): New function.
8512 (Pluginobj::descriptor): New function.
8513 (Pluginobj::filesize): New function.
8514 (Pluginobj::filesize_): New data member.
8515 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8516 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8517 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8518
8519 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8520 with archive libraries.
8521 * testsuite/Makefile.in: Regenerate.
8522 * testsuite/plugin_test.c (struct sym_info): New type.
8523 (get_input_file, release_input_file): New static variables.
8524 (onload): Capture new transfer vector entries.
8525 (claim_file_hook): Stop reading at end of file according to filesize.
8526 Factor out parsing of readelf output into separate function.
8527 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8528 APIs and get the source file name from the symbol table. Convert
8529 source file name to corresponding object file name. Print info
8530 message when adding new input files.
8531 (parse_readelf_line): New function.
8532 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8533 * testsuite/plugin_test_2.sh: Likewise.
8534 * testsuite/plugin_test_3.sh: Likewise.
8535 * testsuite/plugin_test_4.sh: New test case.
8536
62a6d109
ILT
85372009-01-07 Ian Lance Taylor <iant@google.com>
8538
8539 * version.cc (version_string): Bump to 1.8.
8540
483620e8
CC
85412008-12-23 Cary Coutant <ccoutant@google.com>
8542
8543 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8544 * plugin.cc (Plugin_manager::finish): Rename as
8545 layout_deferred_objects. Move cleanup to separate function.
8546 (Plugin_manager::cleanup): New function.
8547 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8548 separately.
8549 * plugin.h (Plugin_manager::finish): Rename as
8550 layout_deferred_objects.
8551 (Plugin_manager::cleanup): New function.
8552 (Plugin_manager::cleanup_done): New field.
8553
d66a9eb3
CC
85542008-12-23 Cary Coutant <ccoutant@google.com>
8555
8556 * plugin.cc (is_visible_from_outside): New function.
8557 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8558 so we don't return "IR only" status for exported symbols or -r links.
8559
8560 * testsuite/Makefile.am (plugin_test_3): New test case.
8561 * testsuite/Makefile.in: Regenerate.
8562 * testsuite/plugin_test_3.sh: New file.
8563
5995b570
CC
85642008-12-22 Cary Coutant <ccoutant@google.com>
8565
8566 * object.cc (Sized_relobj::layout_section): New function.
8567 (Sized_relobj::do_layout): Defer layout of input sections until after
8568 plugin has provided replacement files.
8569 (Sized_relobj::do_layout_deferred_sections): New function.
8570 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8571 (Relobj::layout_deferred_sections): New function.
8572 (Relobj::do_layout_deferred_sections): New function.
8573 (Sized_relobj::do_layout_deferred_sections): New function.
8574 (Sized_relobj::layout_section): New function.
8575 (Sized_relobj::Deferred_layout): New structure.
8576 (Sized_relobj::deferred_layout_): New field.
8577 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8578 Change all callers. Layout deferred sections.
8579 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8580 references.
8581 (Plugin_hook::run): Move code from do_plugin_hook inline.
8582 (Plugin_hook::do_plugin_hook): Remove.
8583 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8584 (Plugin_manager::finish): Renamed, was cleanup.
8585 (Plugin_manager::should_defer_layout): New function.
8586 (Plugin_manager::add_deferred_layout_object): New function.
8587 (Plugin_manager::Deferred_layout_list): New type.
8588 (Plugin_manager::deferred_layout_objects_): New field.
8589 (Plugin_hook::do_plugin_hook): Remove.
8590
ee769c88
ILT
85912008-12-17 Ian Lance Taylor <iant@google.com>
8592
8593 * options.h (class General_options): Add --no case for
8594 --export-dynamic.
8595
abc8dcba
CC
85962008-12-16 Cary Coutant <ccoutant@google.com>
8597
8598 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8599 vector.
8600 (Plugin_manager::claim_file): Create plugin object even if
8601 plugin did not call the add_symbols callback.
8602 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8603 asking for more symbols than were added.
8604 * testsuite/Makefile.am (plugin_test_1): Add test case with
8605 no global symbols.
8606 (empty.syms): New target.
8607 * testsuite/Makefile.in: Regenerate.
8608 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8609 message. Don't call add_symbols if no globals.
8610 (all_symbols_read_hook): Don't provide replacement for empty
8611 claimed file.
8612
b0074644
ILT
86132008-12-12 Ian Lance Taylor <iant@google.com>
8614
68943102
ILT
8615 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8616 r_type == 0 for a local symbol with r_sym == 0.
8617 (scan_relocatable_relocs): Pass r_sym to
8618 local_non_section_strategy.
8619 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8620 r_sym parameter.
8621
b0074644
ILT
8622 * configure.ac: Update test for TLS descriptors: they are
8623 supported as of glibc 2.9.
8624 * configure: Rebuild.
8625
c2508178
ILT
86262008-12-11 Ian Lance Taylor <iant@google.com>
8627
8628 PR 7091
8629 * target-reloc.h (Default_scan_relocatable_relocs): For each
8630 function, map r_type == 0 to RELOC_DISCARD.
8631
2756a258
CC
86322008-12-10 Cary Coutant <ccoutant@google.com>
8633
8634 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8635 object to override a kept COMDAT group from a plugin object.
8636
bb6f53d3
ILT
86372008-12-09 Ian Lance Taylor <iant@google.com>
8638
fbc558e1
ILT
8639 PR 7088
8640 * yyscript.y (file_cmd): Handle INPUT.
8641
bb6f53d3
ILT
8642 * testsuite/initpri1.c: Change all declarations to be full
8643 prototypes by adding void, to avoid compiler warnings.
8644
4674ecfc
CC
86452008-12-05 Rafael Avila de Espindola <espindola@google.com>
8646
8647 * options.cc (General_options::parse_plugin_opt): New.
8648 (General_options::add_plugin): The argument now is just the filename.
8649 (General_options::add_plugin_option): New.
8650 * options.h (plugin_opt): New.
8651 (add_plugin): Change argument name.
8652 (add_plugin_option): New.
8653 * plugin.cc (Plugin::load): Don't parse the plugin option.
8654 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8655 (Plugin::add_option): New.
8656 (Plugin::args_): Change type.
8657 (Plugin::filename_): New.
8658 (Plugin_manager::add_plugin_option): New.
8659 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8660 * testsuite/Makefile.in: Regenerate.
8661
fd06b4aa
CC
86622008-12-05 Cary Coutant <ccoutant@google.com>
8663
8664 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8665 Handle --strip-lto-sections option.
8666 * options.h (strip_lto_sections): New option.
8667
6c52134c
CC
86682008-12-01 Cary Coutant <ccoutant@google.com>
8669
8670 * plugin.cc (ld_plugin_message): Change format parameter to const.
8671 Fix mismatch between new[] and delete.
8672
a45248e0
CC
86732008-11-14 Cary Coutant <ccoutant@google.com>
8674
8675 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8676 instead of -1U.
8677
c82fbeee
CS
86782008-11-05 Craig Silverstein <csilvers@google.com>
8679
8680 * options.cc (General_options::parse_dynamic_list): New function.
8681 * options.h (General_options): New flags dynamic_list,
8682 dynamic_list_data, dynamic_list_cpp_new, and
8683 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8684 (General_options::in_dynamic_list): New function.
8685 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8686 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8687 (Lex::can_continue_name): Likewise.
8688 (yylex): Likewise.
8689 (read_script_file): New parameter script_options.
8690 (read_dynamic_list): New function.
8691 (Script_options::define_dynamic_list): New function.
8692 (dynamic_list_keyword_parsecodes): New variable.
8693 (dynamic_list_keywords): New variable.
8694 * script.h (Script_options::define_dynamic_list): New function
8695 prototype.
8696 (read_dynamic_list): New function prototype.
8697 * symtab.cc (strprefix): New macro.
8698 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8699 dynamic_list_data, dynamic_list_cpp_new, and
8700 dynamic_list_cpp_typeinfo.
8701 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8702 (dynamic_list_expr): New rule.
8703 (dynamic_list_nodes): Likewise.
8704 (dynamic_list_node): Likewise.
8705 * testsuite/Makefile.am (dynamic_list): New test.
8706 * testsuite/Makefile.in: Regenerated.
8707 * testsuite/dynamic_list.t: New file.
8708 * testsuite/dynamic_list.sh: New file.
8709
e0bb29a5
CS
87102008-11-05 Craig Silverstein <csilvers@google.com>
8711
8712 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8713 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8714 (t11_last): Likewise.
8715 * testsuite/ver_test_6.c (main): Likewise.
8716
4e1e25e0
CC
87172008-10-07 Cary Coutant <ccoutant@google.com>
8718
8719 * options.c (General_options::finalize): Add check for -static and
8720 -shared.
8721 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8722 is not empty.
8723
92f03fcb
CC
87242008-10-02 Cary Coutant <ccoutant@google.com>
8725
8726 * plugin.cc (make_sized_plugin_object): Fix conditional
8727 compilation to work when not all targets are enabled.
8728
fbd8a257
CC
87292008-09-29 Cary Coutant <ccoutant@google.com>
8730
8731 * archive.cc (Archive::get_file_and_offset): Use filename instead
8732 of name to get library path.
8733 (Archive::include_member): Unlock external member of a thin archive.
8734
8735 * testsuite/Makefile.am (TEST_AR): New variable.
8736 (thin_archive_test_1): New test.
8737 (thin_archive_test_2): New test.
81636b3f
CC
8738 * testsuite/Makefile.in: Regenerate.
8739 * testsuite/thin_archive_main.cc: New file.
8740 * testsuite/thin_archive_test_1.cc: New file.
8741 * testsuite/thin_archive_test_2.cc: New file.
8742 * testsuite/thin_archive_test_3.cc: New file.
8743 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 8744
eff45813
CC
87452008-09-29 Cary Coutant <ccoutant@google.com>
8746
8747 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8748 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8749 instead of -1U.
8750 (Sized_relobj::do_finalize_local_symbols): Likewise.
8751 (Sized_relobj::map_to_kept_section): Likewise.
8752 * object.h (Sized_relobj::invalid_address): New constant.
8753 (Sized_relobj::do_output_section_offset): Check for invalid_address
8754 and return -1ULL.
8755 * output.cc (Output_reloc::local_section_offset): Use constant
8756 invalid_address instead of -1U.
8757 (Output_reloc::get_address): Likewise.
8758 (Output_section::output_address): Change -1U to -1ULL.
8759 * output.h (Output_reloc::invalid_address): New constant.
8760 * reloc.cc (Sized_relobj::write_sections): Use constant
8761 invalid_address instead of -1U.
8762 (Sized_relobj::relocate_sections): Likewise.
8763 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8764 values for merge sections.
8765 * target-reloc.h (relocate_for_relocatable): Use constant
8766 invalid_address instead of -1U.
8767
89fc3421
CC
87682008-09-19 Cary Coutant <ccoutant@google.com>
8769
8770 Add plugin functionality for link-time optimization (LTO).
8771 * configure.ac (plugins): Add --enable-plugins option.
8772 * configure: Regenerate.
8773 * config.in: Regenerate.
8774 * Makefile.am (LIBDL): New variable.
8775 (CCFILES): Add plugin.cc.
8776 (HFILES): Add plugin.h.
8777 (ldadd_var): Add LIBDL.
8778 * Makefile.in: Regenerate.
8779
8780 * archive.cc: Include "plugin.h".
8781 (Archive::setup): Don't preread archive symbols when using a plugin.
8782 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8783 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8784 files.
8785 (Archive::include_member): Add symbols from plugin objects.
8786 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8787 * descriptors.cc (Descriptors::open): Check for file descriptors
8788 abandoned by plugins.
8789 (Descriptors::claim_for_plugin): New function.
8790 * descriptors.h (Descriptors::claim_for_plugin): New function.
8791 (Open_descriptor::is_claimed): New field.
8792 (claim_descriptor_for_plugin): New function.
8793 * fileread.cc (File_read::claim_for_plugin): New function.
8794 * fileread.h (File_read::claim_for_plugin): New function.
8795 (File_read::descriptor): New function.
8796 * gold.cc: Include "plugin.h".
8797 (queue_initial_tasks): Add task to call plugin hooks for generating
8798 new object files.
8799 * main.cc: Include "plugin.h".
8800 (main): Load plugin libraries.
8801 * object.h (Pluginobj): Declare.
8802 (Object::pluginobj): New function.
8803 (Object::do_pluginobj): New function.
8804 (Object::set_target): New function.
8805 * options.cc: Include "plugin.h".
8806 (General_options::parse_plugin): New function.
8807 (General_options::General_options): Initialize plugins_ field.
8808 (General_options::add_plugin): New function.
8809 * options.h (Plugin_manager): Declare.
8810 (General_options): Add --plugin option.
8811 (General_options::has_plugins): New function.
8812 (General_options::plugins): New function.
8813 (General_options::add_plugin): New function.
8814 (General_options::plugins_): New field.
8815 * plugin.cc: New file.
8816 * plugin.h: New file.
8817 * readsyms.cc: Include "plugin.h".
8818 (Read_symbols::do_read_symbols): Check for archive before checking
8819 for ELF file. Call plugin hooks to claim files.
8820 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8821 from a real object file; force override when processing replacement
8822 files.
8823 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8824 (Symbol::init_base_object): Likewise.
8825 (Symbol::init_base_output_data): Likewise.
8826 (Symbol::init_base_output_segment): Likewise.
8827 (Symbol::init_base_constant): Likewise.
8828 (Symbol::init_base_undefined): Likewise.
8829 (Symbol::output_section): Assert that object is not a plugin.
8830 (Symbol_table::add_from_pluginobj): New function.
8831 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8832 undefined.
8833 (Symbol_table::sized_write_globals): Likewise.
8834 (Symbol_table::add_from_pluginobj): Instantiate template.
8835 * symtab.h (Sized_pluginobj): Declare.
8836 (Symbol::in_real_elf): New function.
8837 (Symbol::set_in_real_elf): New function.
8838 (Symbol::in_real_elf_): New field.
8839 (Symbol_table::add_from_pluginobj): New function.
8840
8841 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8842 (LIBDL): New variable.
8843 (LDADD): Add LIBDL.
8844 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8845 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8846 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8847 (MOSTLYCLEANFILES): Likewise.
8848 * testsuite/Makefile.in: Regenerate.
8849 * testsuite/plugin_test.c: New file.
8850 * testsuite/plugin_test_1.sh: New file.
8851 * testsuite/plugin_test_2.sh: New file.
8852
de31bda5
ILT
88532008-09-16 Ian Lance Taylor <iant@google.com>
8854
9c2d0ef9
ILT
8855 * target-reloc.h (relocate_section): Check whether a symbol is
8856 defined by the ABI before reporting an undefined symbol error.
8857 * target.h (Target::is_defined_by_abi): Make parameter const.
8858 (Target::do_is_defined_by_abi): Likewise.
8859 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8860 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8861 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8862 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8863 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8864 * testsuite/Makefile.in: Rebuild.
8865
de31bda5
ILT
8866 * fileread.cc (make_view): Add casts to avoid warning.
8867
9fa33bee
AO
88682008-09-16 Alexandre Oliva <aoliva@redhat.com>
8869
8870 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8871 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8872
183fd0e3
AO
88732008-09-16 Alexandre Oliva <aoliva@redhat.com>
8874
8875 * options.h (General_options::output_is_executable): New.
8876 (General_options::output_is_pie): New.
8877 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8878 for shared libraries.
8879 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8880
7be8330a
CD
88812008-09-11 Chris Demetriou <cgd@google.com>
8882
8883 * options.h (origin): New -z option.
8884 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8885 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8886 in DT_FLAGS_1.
8887
a9caad02
CC
88882008-09-05 Cary Coutant <ccoutant@google.com>
8889
8890 * fileread.cc (File_read::make_view): Add check for attempt to map
8891 beyond end of file.
8892
ae6dce4d
CC
88932008-09-05 Cary Coutant <ccoutant@google.com>
8894
8895 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8896 explicit instantiations.
8897
d7ab2a47
KVH
88982008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8899
8900 PR gold/6858
8901 * options.cc (General_options::finalize): Allow undefined symbols
8902 in shlibs if linking -shared.
8903
8904 PR gold/6859
8905 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8906 symbols as not needing a dynsym entry.
8907
1e52a9c1
CS
89082008-08-20 Craig Silverstein <csilvers@google.com>
8909
8910 * fileread.cc (File_read::open): Do not lock the file unless it
8911 was successfully opened.
8912
d85c80a3
CC
89132008-08-14 Cary Coutant <ccoutant@google.com>
8914
8915 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8916 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8917 * testsuite/tls_test.cc (struct int128): 128-bit struct
8918 for testing TLS relocs with non-zero addend.
8919 (v12): New TLS variable.
8920 (t12): New test.
8921 (t_last): Add check for v12.
8922 * testsuite/tls_test.h (t12): New function.
8923 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8924
2d924fd9
ILT
89252008-08-13 Ian Lance Taylor <iant@google.com>
8926
8927 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8928 set tls_segment_ or relro_segment_.
8929 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8930 when appropriate.
8931 * output.h (Output_section::clear_is_relro): New function.
8932 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8933 sections specially even when output_data_ is empty.
8934 (Output_segment::maximum_alignment): When first section is relro,
8935 only force alignment for PT_LOAD segments.
8936 * script.cc (script_data_segment_align): New function.
8937 (script_data_segment_relro_end): New function.
8938 * script-c.h (script_data_segment_align): Declare.
8939 (script_data_segment_relro_end): Declare.
8940 * script-sections.h (class Script_sections): Declare
8941 data_segment_align and data_segment_relro_end. Add fields
8942 segment_align_index_ and saw_relro_end_.
8943 * script-sections.cc (class Sections_element): Add set_is_relro
8944 virtual function. Add new bool* parameter to place_orphan_here.
8945 Add get_output_section virtual function.
8946 (class Output_section_definition): Add set_is_relro. Add new
8947 bool* parameter to place_orphan_here. Add get_output_section.
8948 Add is_relro_ field.
8949 (Output_section_definition::Output_section_definition): Initialize
8950 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8951 and is_relro_ fields.
8952 (Output_section_definition::place_orphan_here): Add is_relro
8953 parameter.
8954 (Output_section_definition::set_section_addresses): Set relro for
8955 output section.
8956 (Output_section_definition::alternate_constraint): Likewise.
8957 (class Orphan_output_section): Add new bool* parameter to
8958 place_orphan_here. Add get_output_section.
8959 (Orphan_output_section::place_orphan_here): Add is_relro
8960 parameter.
8961 (Script_sections::Script_sections): Initialize
8962 data_segment_align_index_ and saw_relro_end_.
8963 (Script_sections::data_segment_align): New function.
8964 (Script_sections::data_segment_relro_end): New function.
8965 (Script_sections::place_orphan): Set or clear is_relro.
8966 (Script_sections::set_section_addresses): Force alignment of first
8967 TLS section.
8968 * yyscript.y (exp): Call script_data_segment_align and
8969 script_data_segment_relro_end.
8970 * testsuite/relro_script_test.t: New file.
8971 * testsuite/relro_test.cc (using_script): Declare.
8972 (t1, t2): Test using_script.
8973 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8974 (relro_script_test_SOURCES): Define.
8975 (relro_script_test_DEPENDENCIES): Define.
8976 (relro_script_test_LDFLAGS): Define.
8977 (relro_script_test_LDADD): Define.
8978 (relro_script_test.so): New target.
8979 * testsuite/Makefile.in: Rebuild.
8980
f827c9a9
CC
89812008-08-06 Cary Coutant <ccoutant@google.com>
8982
8983 * archive.cc (Archive::total_archives, Archive::total_members)
8984 (Archive::total_members_loaded): New variables.
8985 (Archive::setup): Add parameter. Add option to preread
8986 archive symbols.
8987 (Archive::read_armap): Add counter.
8988 (Archive::get_file_and_offset): New function.
8989 (Archive::get_elf_object_for_member): New function.
8990 (Archive::read_all_symbols): New function.
8991 (Archive::read_symbols): New function.
8992 (Archive::add_symbols): Add counters.
8993 (Archive::include_all_members): Use armap to find members if it's
8994 already built.
8995 (Archive::include_member): Skip reading symbols if already read.
8996 Factored code into Archive::get_file_and_offset and
8997 Archive::get_elf_object_for_member. Changed call to
8998 Mapfile::report_include_archive_member.
8999 (Archive::print_stats): New function.
9000 * archive.h: Declare Object and Read_symbols_data classes.
9001 (Archive::Archive): Add initializers for new members.
9002 (Archive::setup): Add parameter.
9003 (Archive::print_stats): New function.
9004 (Archive::total_archives, Archive::total_members)
9005 (Archive::total_members_loaded): New variables.
9006 (Archive::get_file_and_offset): New function.
9007 (Archive::get_elf_object_for_member): New function.
9008 (Archive::read_all_symbols): New function.
9009 (Archive::read_symbols): New function.
9010 (Archive::Archive_member): New class.
9011 (Archive::members_): New member.
9012 (Archive::num_members_): New member.
9013 * main.cc: Include archive.h.
9014 (main): Call Archive::print_stats.
9015 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9016 archive parameter; member_name is now the fully-decorated name.
9017 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9018 * options.h: (General_options): Add --preread-archive-symbols option.
9019 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9020 Archive::setup.
9021
de4c45bd
ILT
90222008-08-04 Ian Lance Taylor <iant@google.com>
9023
9024 * symtab.h (Symbol::use_plt_offset): New function.
9025 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9026 * powerpc.cc (Relocate::relocate): Likewise.
9027 * sparc.cc (Relocate::relocate): Likewise.
9028 * x86_64.cc (Relocate::relocate): Likewise.
9029 * testsuite/weak_plt.sh: New test.
9030 * testsuite/weak_plt_main.cc: New test.
9031 * testsuite/weak_plt_shared.cc: New test.
9032 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9033 (check_PROGRAMS): Add weak_plt.
9034 (check_DATA): Add weak_plt_shared.so.
9035 (weak_plt_main_pic.o, weak_plt): New targets.
9036 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9037 * testsuite/Makefile.in: Rebuild.
9038
9039 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9040 gcctestdir/ld.
9041 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9042 * testsuite/Makefile.in: Rebuild.
9043
323ee3f4
AM
90442008-08-04 Alan Modra <amodra@bigpond.net.au>
9045
9046 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9047 * Makefile.in: Regenerate.
9048 * po/POTFILES.in: Regenerate.
9049
7c07ecec
ILT
90502008-07-29 Ian Lance Taylor <iant@google.com>
9051
9052 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9053 symbols before other symbols.
9054 * testsuite/script_test_2.cc (test_addr): Declare.
9055 (test_addr_alias): Declare.
9056 (main): Check that test_addr and test_addr_alias have the right
cd536b21 9057 values.
7c07ecec
ILT
9058 * testsuite/script_test_2.t: Define test_addr_alias and
9059 test_addr.
9060
5778530e
ILT
90612008-07-24 Ian Lance Taylor <iant@google.com>
9062
2a00e4fb
ILT
9063 PR 5990
9064 * descriptors.cc: New file.
9065 * descriptors.h: New file.
9066 * gold-threads.h (class Hold_optional_lock): New class.
9067 * fileread.cc: Include "descriptors.h".
9068 (File_read::~File_read): Release descriptor rather than closing
9069 it.
9070 (File_read::open) [file]: Call open_descriptor rather than open.
9071 Set is_descriptor_opened_.
9072 (File_read::open) [memory]: Assert that descriptor is not open.
9073 (File_read::reopen_descriptor): New function.
9074 (File_read::release): Release descriptor.
9075 (File_read::do_read): Make non-const. Reopen descriptor.
9076 (File_read::read): Make non-const.
9077 (File_read::make_view): Reopen descriptor.
9078 (File_read::do_readv): Likewise.
9079 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9080 Update declarations.
9081 * layout.cc: Include "descriptors.h".
9082 (Layout::create_build_id): Use open_descriptor rather than open.
9083 * output.cc: Include "descriptors.h".
9084 (Output_file::open): Use open_descriptor rather than open.
9085 * archive.cc (Archive::const_iterator): Change Archive to be
9086 non-const.
9087 (Archive::begin, Archive::end): Make non-const.
9088 (Archive::count_members): Likewise.
9089 * archive.h (class Archive): Update declarations.
9090 * object.h (Object::read): Make non-const.
9091 * Makefile.am (CCFILES): Add descriptors.cc.
9092 (HFILES): Add descriptors.h.
9093 * Makefile.in: Rebuild.
9094
801647d1
ILT
9095 PR 6716
9096 * gold.h: Always include <clocale>. Add Solaris workarounds
9097 following code in binutils/sysdep.h.
9098
5edd166e
ILT
9099 PR 6048
9100 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9101 this->eh_frame_hdr_ is NULL before using it.
9102
c89ad728
ILT
9103 * dynobj.cc (Versions::Versions): Update comment.
9104
aa86f06b
ILT
9105 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9106 the base version name.
9107
5778530e
ILT
9108 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9109 array size plus one.
9110 (Stringpool_template::set_string_offsets): Subtract one from key
9111 before using it as an array index.
9112 (Stringpool_template::get_offset_with_length): Likewise.
9113 (Stringpool_template::write_to_buffer): Likewise.
9114 * stringpool.h (Stringpool_template::get_offset_from_key):
9115 Likewise.
9116
057ead22
ILT
91172008-07-23 Ian Lance Taylor <iant@google.com>
9118
7f649c59
ILT
9119 PR 6658
9120 * object.h (Merged_symbol_value::value): Do our best to handle a
9121 negative addend.
9122
057ead22
ILT
9123 PR 6647
9124 * script.cc (Version_script_info::get_versions): Don't add empty
9125 version tag to return value.
9126 (Version_script_info::get_symbol_version_helper): Change return
9127 type to bool. Add pversion parameter. Change all callers.
9128 (script_register_vers_node): Don't require a non-NULL tag.
9129 * script.h (class Version_script_info): Update declarations.
9130 (Version_script_info::get_symbol_version): Change return type to
9131 bool. Add version parameter. Change all callers.
9132 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9133 handling. Handle an empty version from a version script.
9134 (Symbol_table::define_special_symbol): Likewise.
9135 * testsuite/ver_test_10.script: New file.
9136 * testsuite/ver_test_10.sh: New file.
9137 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9138 (check_DATA): Add ver_test_10.syms.
9139 (ver_test_10.syms, ver_test_10.so): New target.
9140 * testsuite/Makefile.in: Rebuild.
9141
58e54ac2
CD
91422008-07-23 Simon Baldwin <simonb@google.com>
9143
9144 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9145 to zero for undefined symbols from dynamic libraries.
9146
95d14cd3
ILT
91472008-07-23 Ian Lance Taylor <iant@google.com>
9148
9149 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9150 Change all callers.
9151 * symtab.h (class Symbol_table): Update declaration.
9152 * testsuite/ver_test_9.cc: New file.
9153 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9154 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9155 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9156 (ver_test_9.so, ver_test_9.o): New targets.
9157 * testsuite/Makefile.in: Rebuild.
9158
92de84a6
ILT
91592008-07-22 Ian Lance Taylor <iant@google.com>
9160
34810851
ILT
9161 * options.h (class General_options): Define --check-sections.
9162 * layout.cc (Layout::set_segment_offsets): Handle
9163 --check-sections.
9164
af6156ef
ILT
9165 * options.h (class General_options): Define -n/--nmagic and
9166 -N/--omagic.
9167 * options.cc (General_options::finalize): For -n/--nmagic or
9168 -N/--omagic, set -static.
9169 * layout.cc (Layout::attach_allocated_section_to_segment): If
9170 -N/--omagic, don't put read-only and read-write sections in
9171 different segments.
9172 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9173 finding a read-only segment.
9174 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9175 don't set the minimum segment alignment to the common page size,
9176 and don't set the file offset to the address modulo the page size.
9177 * script-sections.cc (Script_sections::create_segments): If
9178 -n/--omagic, don't put read-only and read-write sections in
9179 different segments.
9180
92de84a6
ILT
9181 * cref.cc: New file.
9182 * cref.h: New file.
9183 * options.h (class General_options): Add --print-symbol-counts.
9184 * main.cc (main): Issue defined symbol report if requested.
9185 * archive.cc (Archive::interpret_header): Make into a const member
9186 function.
9187 (Archive::add_symbols): Call Input_objects::archive_start and
9188 archive_stop.
9189 (Archive::const_iterator): Define new class.
9190 (Archive::begin, Archive::end): New functions.
9191 (Archive::include_all_members): Rewrite to use iterator.
9192 (Archive::count_members): New function.
9193 * archive.h (class Archive): Update declarations.
9194 (Archive::filename): New function.
9195 * object.cc: Include "cref.h".
9196 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9197 (Sized_relobj::do_get_global_symbol_counts): New function.
9198 (Input_objects::add_object): Add object to cross-referencer.
9199 (Input_objects::archive_start): New function.
9200 (Input_objects::archive_stop): New function.
9201 (Input_objects::print_symbol_counts): New function.
9202 * object.h: Declare Cref and Archive.
9203 (Object::get_global_symbol_counts): New function.
9204 (Object::do_get_global_symbol_counts): New pure virtual function.
9205 (class Sized_relobj): Add defined_count_ field. Update
9206 declarations.
9207 (class Input_objects): Add cref_ field. Update constructor.
9208 Update declarations.
9209 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9210 defined_count_.
9211 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9212 symbol counts.
9213 (Sized_dynobj::do_get_global_symbol_counts): New function.
9214 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9215 defined_count_. Update declarations. Define Symbols typedef.
9216 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9217 parameter. Change all callers.
9218 (Symbol_table::add_from_dynobj): Add sympointers and defined
9219 parameters. Change all callers.
9220 * symtab.h (class Symbol_table): Update declarations.
9221 * Makefile.am (CCFILES): Add cref.cc.
9222 (HFILES): Add cref.h.
9223 * Makefile.in: Rebuild.
9224
3f7c5e1d
CD
92252008-07-22 Simon Baldwin <simonb@google.com>
9226
9227 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9228 to zero when writing undefined symbols.
9229
e0b64032
ILT
92302008-07-22 Ian Lance Taylor <iant@google.com>
9231
9232 * output.cc (Output_section::add_input_section): Don't try to
9233 merge empty merge sections.
9234
096b02cf
CS
92352008-07-21 Craig Silverstein <csilvers@google.com>
9236
9237 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9238 Include symbol version in error message.
cd536b21 9239
1d1f116d
CD
92402008-07-20 Chris Demetriou <cgd@google.com>
9241
cd536b21 9242 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
9243 (RANDOM_SEED_CFLAGS): New substituted variable.
9244 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9245 * configure: Rebuild.
9246 * Makefile.in: Likewise.
9247 * testsuite/Makefile.in: Likewise.
9248
a18f591e
ILT
92492008-07-18 Ian Lance Taylor <iant@google.com>
9250
9251 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9252 where we see NAME/NULL and NAME/VERSION as separate symbols.
9253 * testsuite/ver_test_main.cc (main): Call t4.
9254 (t4, t4_2a): Define.
9255 * testsuite/ver_test_2.cc (t4_2): Define.
9256 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9257 * testsuite/ver_test_4.cc (t4_2a): Define.
9258 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9259 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9260
c6e3f6ed
ILT
92612008-07-17 Ian Lance Taylor <iant@google.com>
9262
9263 * dynobj.cc (Versions::add_def): If we give an error about a
9264 missing version, go ahead and create the version anyhow.
9265
ef9beddf
ILT
92662008-07-10 Ian Lance Taylor <iant@google.com>
9267
9268 Handle output sections with more than 0x7fffffff bytes.
9269 * object.h (class Relobj): Change map_to_output_ to
9270 output_sections_, and just keep a section pointer. Change all
9271 uses. Move comdat group support to Sized_relobj.
9272 (Relobj::is_section_specially_mapped): Remove.
9273 (Relobj::output_section): Remove poff parameter. Change all
9274 callers.
9275 (Relobj::output_section_offset): New function.
9276 (Relobj::set_section_offset): Rewrite.
9277 (Relobj::map_to_output): Remove.
9278 (Relobj::output_sections): New function.
9279 (Relobj::do_output_section_offset): New pure virtual function.
9280 (Relobj::do_set_section_offset): Likewise.
9281 (class Sized_relobj): Add section_offsets_ field. Add comdat
9282 group support from Relobj. Update declarations.
9283 (Sized_relobj::get_output_section_offset): New function.
9284 (Sized_relobj::do_output_section_offset): New function.
9285 (Sized_relobj::do_set_section_offset): New function.
9286 * object.cc (Relobj::output_section_address): Remove.
9287 (Sized_relobj::Sized_relobj): Initialize new fields.
9288 (Sized_relobj::include_section_group): Cast find_kept_object to
9289 Sized_relobj.
9290 (Sized_relobj::include_linkonce_section): Likewise.
9291 (Sized_relobj::do_layout): Use separate arrays for output section
9292 and output offset.
9293 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9294 output_sections.
9295 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9296 output_sections and section_offsets.
9297 (Sized_relobj::write_local_symbols): Likewise.
9298 (map_to_kept_section): Compute output address directly.
9299 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9300 output_sections and section_offsets.
9301 (Sized_relobj::write_sections): Likewise.
9302 (Sized_relobj::relocate_sections): Likewise.
9303 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9304 * output.h (class Output_reloc): Update declarations. Change
9305 u2_.relobj to Sized_relobj*.
9306 (class Output_data_reloc): Change add functions to use
9307 Sized_relobj*.
9308 * output.cc (Output_reloc::Output_reloc): Change relobj to
9309 Sized_relobj*.
9310 (Output_reloc::local_section_offset): Change return type to
9311 Elf_Addr. Use get_output_section_offset.
9312 (Output_reloc::get_address): Likewise.
9313 (Output_section::is_input_address_mapped): Don't call
9314 is_section_specially_mapped.
9315 (Output_section::output_offset): Likewise.
9316 (Output_section::output_address): Likewise.
9317 (Output_section::starting_output_address): Likewise.
9318 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9319 parameter to Sized_relobj*.
9320 (Copy_relocs::need_copy_reloc): Likewise.
9321 (Copy_relocs::save): Likewise.
9322 * copy-relocs.h (class Copy_relocs): Update declarations.
9323 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9324 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9325 * target-reloc.h (relocate_for_relocatable): Change
9326 offset_in_output_section type to Elf_Addr. Change code that uses
9327 it as well.
9328 * layout.cc (Layout::layout): Always set *off.
9329 * mapfile.cc (Mapfile::print_input_section): Use
9330 output_section_offset.
9331 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9332 Sized_relobj*.
9333 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9334 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9335 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9336
5cb66f97
ILT
93372008-07-03 Ian Lance Taylor <iant@google.com>
9338
9339 * layout.cc (Layout::include_section): Do not discard unrecognized
9340 SHT_STRTAB sections.
9341
afe47622
CS
93422008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9343
9344 * script.cc (Lex::can_continue_name): Make '?' allowable in
9345 version-script names.
9346 * testsuite/version_script.map: Change glob pattern to use '?'
9347
5adf9721
ILT
93482008-06-30 Manish Singh <yosh@gimp.org>
9349
9350 PR 6585
9351 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9352 Correct typo.
9353
e6fde208
ILT
93542008-06-30 Ian Lance Taylor <iant@google.com>
9355
9356 PR 6660
9357 PR 6682
9358 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9359 versions]: Don't try to read the value in the contents, since we
9360 don't use it. Use the template endianness when writing.
9361
3f2e6a2d
CC
93622008-06-25 Cary Coutant <ccoutant@google.com>
9363
9364 * fileread.cc (File_read::make_view): Assert on zero-length view.
9365 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9366 symbol table when there are no symbols to read.
9367
c43d3a48
CS
93682008-06-23 Craig Silverstein <csilvers@google.com>
9369
9370 * version.cc (version_string): Bump to 1.7
9371
5f494ea0
CS
93722008-06-18 Craig Silverstein <csilvers@google.com>
9373
9374 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9375 constant 0xFFFF to type Valtype.
9376 (Powerpc_relocate_functions::rel16_ha): Likewise.
9377
c42e122e
ILT
93782008-06-17 Ian Lance Taylor <iant@google.com>
9379
f34787f8
ILT
9380 * output.h (Output_section::Input_section): Initialize p2align_ to
9381 zero for Output_section_data constructors.
9382 (Output_section::Input_section::addralign): If not an input
9383 section, return the alignment of the Output_section_data.
9384 * testsuite/copy_test.cc: New file.
9385 * testsuite/copy_test_1.cc: New file.
9386 * testsuite/copy_test_2.cc: New file.
9387 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9388 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9389 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9390 (copy_test_1_pic.o, copy_test_1.so): New targets.
9391 (copy_test_2_pic.o, copy_test_2.so): New targets.
9392 * testsuite/Makefile.in: Rebuild.
9393
c42e122e
ILT
9394 * script-sections.cc (Script_sections::place_orphan): Initialize
9395 local variable exact.
9396
ce3ac18a
DE
93972008-06-13 David Edelsohn <edelsohn@gnu.org>
9398
9399 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9400
42cacb20
DE
94012008-06-12 David Edelsohn <edelsohn@gnu.org>
9402 David S. Miller <davem@davemloft.net>
9403
9404 * powerpc.cc: New file.
9405 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9406 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9407 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9408 * Makefile.in: Rebuild.
9409
7b308235
ILT
94102008-06-09 Ian Lance Taylor <iant@google.com>
9411
9412 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9413 <exception>.
9414 (throwing, orig_terminate): New static variables.
9415 (terminate_handler): New static function.
9416 (t2): Set terminate handler.
9417
f0b886e3
ILT
94182008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9419
9420 PR 6584
cd536b21 9421 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
9422 alignment.
9423
3e90f135
CC
94242008-05-30 Cary Coutant <ccoutant@google.com>
9425
9426 * archive.cc (Archive::include_all_members) Correct to step
9427 over symbol table and extended name table in thin archives.
9428
e09ad04a
ILT
94292008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9430
9431 PR 6407
9432 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9433 calculation.
9434
62b01cb5
ILT
94352008-05-28 Caleb Howe <cshowe@google.com>
9436
9437 * reduced_debug_output.cc: New file.
9438 * reduced_debug_output.h: New file.
92de84a6 9439 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
9440 * options.cc (General_options::finalize): Add strip_debug_non_line
9441 to the strip heirarchy.
9442 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9443 fields.
9444 * layout.cc: Include "reduced_debug_output.h".
9445 (Layout::Layout): Initialize new fields.
9446 (line_only_debug_sections): New static array.
9447 (is_lines_only_debug_sections): New static inline function.
9448 (Layout::include_section): Handle --strip-debug-non-line.
9449 (Layout::make_output_section): If --strip-debug-non-line, build
9450 new output sections for .debug_abbrev and .debug_info.
9451 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9452 gold. Warn about possible overflow.
9453 (read_signed_LEB_128): Likewise.
9454 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9455 (read_signed_LEB_128): Declare.
9456 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9457 (HFILES): Add reduced_debug_output.h.
9458 * Makefile.in: Rebuild.
9459
7d9e3d98
ILT
94602008-05-21 Ian Lance Taylor <iant@google.com>
9461
9462 * mapfile.cc: New file.
9463 * mapfile.h: New file.
9464 * options.h (class General_options): Add -M/--print-map and -Map.
9465 * options.cc (General_options::finalize): Make -M equivalent to
9466 -Map -.
9467 * main.cc: Include <cstdio> and "mapfile.h".
9468 (main): Open mapfile if requested.
9469 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9470 constructor. Change caller.
9471 (queue_initial_tasks): Add mapfile parameter. Change caller.
9472 (queue_middle_tasks): Likewise.
9473 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9474 declarations.
9475 * archive.cc: Include "mapfile.h".
9476 (Archive::add_symbols): Add mapfile parameter. Change all
9477 callers. Pass mapfile, symbol, and reason to include_member.
9478 (Archive::include_all_members): Add mapfile parameter. Change all
9479 callers.
9480 (Archive::include_member): Add mapfile, sym, and why parameters.
9481 Change all callers. Report inclusion to map file.
9482 * archive.h: Include "fileread.h".
9483 (class Archive): Update declarations.
9484 (Archive::file): New const method.
9485 (class Add_archive_symbols): Add mapfile_ field. Update
9486 constructor. Change all callers.
9487 * readsyms.h (class Read_symbols): Likewise.
9488 (class Finish_group): Likewise.
9489 (class Read_script): Likewise.
9490 * common.cc: Include "mapfile.h".
9491 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9492 all callers.
9493 (Symbol_table::do_allocate_commons): Likewise.
9494 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9495 symbol allocation to mapfile.
9496 * common.h (class Allocate_commons_task): Add mapfile_ field.
9497 Update constructor. Change all callers.
9498 * symtab.h (class Symbol_table): Update declarations.
9499 * layout.cc: Include "mapfile.h".
9500 (Layout_task_runner::run): Print information to mapfile.
9501 (Layout::create_gold_note): Change Output_data_fixed_space to
9502 Output_data_zero_fill.
9503 (Layout::create_build_id): Likewise.
9504 (Layout::print_to_mapfile): New function.
9505 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9506 constructor. Change caller.
9507 (class Layout): Declare print_to_mapfile.
9508 * output.cc (Output_section::Input_section::print_to_mapfile): New
9509 function.
9510 (Output_section::add_input_section): If producing a map, always
9511 add to input_sections_ list.
9512 (Output_section::do_print_to_mapfile): New function.
9513 (Output_segment::print_sections_to_mapfile): New function.
9514 (Output_segment::print_section_list_to_mapfile): New function.
9515 * output.h: Include "mapfile.h".
9516 (Output_data::print_to_mapfile): New function.
9517 (Output_data::do_print_to_mapfile): New virtual function.
9518 (Output_segment_headers::do_print_to_mapfile): New function.
9519 (Output_file_header::do_print_to_mapfile): New function.
9520 (Output_data_const::do_print_to_mapfile): New function.
9521 (class Output_data_const_buffer): Add map_name_ field. Update
9522 constructor. Change all callers. Add do_print_to_mapfile
9523 function.
9524 (class Output_data_fixed_space): Likewise.
9525 (class Output_data_space): Likewise.
9526 (class Output_data_zero_fill): New class.
9527 (Output_data_strtab::do_print_to_mapfile): New function.
9528 (Output_data_reloc_base::do_print_to_mapfile): New function.
9529 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9530 (Output_data_group::do_print_to_mapfile): New function.
9531 (Output_data_got::do_print_to_mapfile): New function.
9532 (Output_data_dynamic::do_print_to_mapfile): New function.
9533 (Output_symtab_xindex::do_print_to_mapfile): New function.
9534 (class Output_section): Declare do_print_to_mapflie. Declare
9535 print_to_mapfile in Input_section.
9536 (class Output_segment): Declare new functions.
9537 * object.h (Sized_relobj::symbol_count): New function.
9538 * script-sections.cc
9539 (Output_section_element_dot_assignment::set_section_addresses):
9540 Change Output_data_fixed_space to Output_data_zero_fill.
9541 (Output_data_expression::do_print_to_mapfile): New function.
9542 * script.cc (read_input_script): Add mapfile parameter. Change
9543 all callers.
9544 * script.h (read_input_script): Update declaration.
9545 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9546 (Eh_frame::do_print_to_mapfile): New function.
9547 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9548 (Output_merge_string::do_print_to_mapfile): New function.
9549 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9550 function.
9551 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9552 function.
9553 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9554 function.
9555 * Makefile.am (CCFILES): Add mapfile.cc.
9556 (HFILES): Add mapfile.h.
9557 * Makefile.in: Rebuild.
9558
9f1d377b
ILT
95592008-05-19 Ian Lance Taylor <iant@google.com>
9560
9561 * options.h (class General_options): Add -z relro.
9562 * layout.cc (Layout::Layout): Initialize relro_segment_.
9563 (Layout::add_output_section_data): Return the output section.
9564 (Layout::make_output_section): Rcognize relro sections and mark
9565 them appropriately.
9566 (Layout::attach_allocated_section_to_segment): Put relro sections
9567 in a PT_GNU_RELRO segment.
9568 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9569 section as relro.
9570 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9571 PT_TLS segments.
9572 (Layout::linkonce_mapping): Map d.rel.ro.local to
9573 .data.rel.ro.local.
9574 (Layout::output_section_name): Us .data.rel.ro.local for any
9575 section which begins with that.
9576 * layout.h (class Layout): Update add_output_section_data
9577 declaration. Add relro_segment_ field.
9578 * output.cc (Output_section::Output_section): Initialize is_relro_
9579 and is_relro_local_ fields.
9580 (Output_segment::add_output_section): Group relro sections.
9581 (Output_segment::is_first_section_relro): New function.
9582 (Output_segment::maximum_alignment): If there is a relro section,
9583 align the segment to the common page size.
9584 (Output_segment::set_section_addresses): Track whether we are
9585 looking at relro sections. If the last section is a relro
9586 section, align to the common page size.
9587 (Output_segment::set_section_list_addresses): Add in_relro
9588 parameter. Change all callers. Align to the page size when
9589 moving from relro to non-relro section.
9590 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9591 segment.
9592 * output.h (class Output_section): Add is_relro_ and
9593 is_relro_local_ fields.
9594 (Output_section::is_relro): New function.
9595 (Output_section::set_is_relro): New function.
9596 (Output_section::is_relro_local): New function.
9597 (Output_section::set_is_relro_local): New function.
9598 (class Output_segment): Update declarations.
9599 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9600 * sparc.cc (Target_sparc::got_section): Likewise.
9601 * x86_64.cc (Target_x86_64::got_section): Likewise.
9602 * testsuite/relro_test_main.cc: New file.
9603 * testsuite/relro_test.cc: New file.
9604 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9605 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9606 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9607 (relro_test.so, relro_test_pic.o): New targets.
9608 * testsuite/Makefile.in: Rebuild.
9609
a984ee1d
ILT
96102008-05-16 Ian Lance Taylor <iant@google.com>
9611
01676dcd
ILT
9612 * output.cc (Output_segment::add_output_section): Remove front
9613 parameter.
9614 * output.h (class Output_segment): Remove
9615 add_initial_output_section and overloaded add_output_section.
9616 Update declaration of remaining add_output_section.
9617 * layout.cc (Layout::create_interp): Call add_output_section
9618 rather than add_initial_output_section.
9619 (Layout::finish_dynamic_section): Likewise.
9620
497897f9
ILT
9621 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9622 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9623 know the dynamic type.
9624 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9625 field. Initialize it in constructor.
9626 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9627 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9628 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9629 reloc.
9630
a984ee1d
ILT
9631 * output.cc (Output_reloc::get_address): Change return type to
9632 Elf_Addr.
9633 * output.h (class Output_reloc): Update get_address declaration.
9634 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9635 for section addresses.
9636
55ba0940
ILT
96372008-05-09 Ian Lance Taylor <iant@google.com>
9638
9639 PR 6493
9640 * gold.cc (gold_nomem): Use return value of write.
9641
75517b77
ILT
96422008-05-08 Ian Lance Taylor <iant@google.com>
9643
9644 * symtab.c (Symbol::init_base_output_data): Add version
9645 parameter. Change all callers.
9646 (Symbol::init_base_output_segment): Likewise.
9647 (Symbol::init_base_constant): Likewise.
9648 (Symbol::init_base_undefined): Likewise.
9649 (Sized_symbol::init_output_data): Likewise.
9650 (Sized_symbol::init_output_segment): Likewise.
9651 (Sized_symbol::init_constant): Likewise.
9652 (Sized_symbol::init_undefined): Likewise.
9653 (Symbol_table::do_define_in_output_data): If the new symbol has a
9654 version, mark it as the default.
9655 (Symbol_table::do_define_in_output_segment): Likewise.
9656 (Symbol_table::do_define_as_constant): Likewise.
9657 * symtab.h (class Symbol): Update declarations.
9658 (class Sized_symbol): Likewise.
9659 * resolve.cc (Symbol::override_version): New function.
c42e122e 9660 (Symbol::override_base): Call override_version.
75517b77
ILT
9661 (Symbol::override_base_with_special): Likewise.
9662 * testsuite/ver_script_8.script: New file.
9663 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9664 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9665 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9666 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9667
f1f70eae
ILT
96682008-05-06 Ian Lance Taylor <iant@google.com>
9669
f3e9c5c5
ILT
9670 PR 6049
9671 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9672 functions.
9673 (class General_options): Remove existing --undefined, and add
9674 --no-undefined instead. Add new --undefined as synonym for -u.
9675 * archive.cc (Archive::add_symbols): Check whether symbol was
9676 named with -u.
9677 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9678 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9679 all uses. Add IS_UNDEFINED. Update declarations to split
9680 different versions of init_base. Declare init_base_undefined.
9681 (Symbol::is_defined): Handle IS_UNDEFINED.
9682 (Symbol::is_undefined): Likewise.
9683 (Symbol::is_weak_undefined): Call is_undefined.
9684 (Symbol::is_absolute): Handle IS_CONSTANT.
9685 (class Sized_symbol): Update declarations to split different
9686 versions of init. Declare init_undefined.
9687 (class Symbol_table): Declare new functions.
9688 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9689 Change all callers.
9690 (Symbol::init_base_output_data): Likewise.
9691 (Symbol::init_base_output_segment): Likewise.
9692 (Symbol::init_base_constant): Likewise.
9693 (Symbol::init_base_undefined): New function.
9694 (Sized_symbol::init_object): Rename from init. Change all
9695 callers.
9696 (Sized_symbol::init_output_data): Likewise.
9697 (Sized_symbol::init_output_segment): Likewise.
9698 (Sized_symbol::init_constant): Likewise.
9699 (Sized_symbol::init_undefined): New function.
9700 (Symbol_table::add_undefined_symbols_from_command_line): New
9701 function.
9702 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9703 function.
9704 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9705 (Symbol::output_section): Likewise.
9706 (Symbol::set_output_section): Likewise.
9707 (Symbol_table::sized_finalize_symbol): Likewise.
9708 (Symbol_table::sized_write_globals): Likewise.
9709 * resolve.cc (Symbol_table::should_override): Likewise.
9710 (Symbol::override_base_with_special): Likewise.
9711
8bdcdf2c
ILT
9712 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9713 symbol, change it to have default visibility.
9714 * testsuite/protected_1.cc: New file.
9715 * testsuite/protected_2.cc: New file.
9716 * testsuite/protected_3.cc: New file.
9717 * testsuite/protected_main_1.cc: New file.
9718 * testsuite/protected_main_2.cc: New file.
9719 * testsuite/protected_main_3.cc: New file.
9720 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9721 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9722 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9723 (protected_1.so): New target.
9724 (protected_1_pic.o, protected_2_pic.o): New targets.
9725 (protected_3_pic.o): New target.
9726 (check_PROGRAMS): Add protected_2.
9727 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9728 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9729 * testsuite/Makefile.in: Rebuild.
9730
2b706932
ILT
9731 * options.h (DEFINE_var): Add set_user_set_##varname__.
9732 (DEFINE_bool_alias): New macro.
9733 (class General_options): Define -Bstatic using DEFINE_bool_alias
9734 rather than DEFINE_special. Add --undefined as an alias for -z
9735 defs.
9736 * options.cc (General_options::parse_Bstatic): Remove.
9737
d82a5bcc
ILT
9738 * options.h (class General_options): Add --fatal-warnings.
9739 * main.cc (main): Implement --fatal-warnings.
9740 * errors.h (Errors::warning_count): New function.
9741
f1f70eae
ILT
9742 * options.h (class General_options): Add -Bsymbolic-functions.
9743 * symtab.h (Symbol::is_preemptible): Check for
9744 -Bsymbolic-functions.
9745
8825ac63
ILT
97462008-05-05 Ian Lance Taylor <iant@google.com>
9747
d98bc257
ILT
9748 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9749 as noVARNAME rather than no-VARNAME.
9750 (class General_options): Add option -z combreloc.
9751 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9752 get_address.
9753 (Output_reloc::sort_before) [SHT_REL]: New function.
9754 (Output_reloc::sort_before) [SHT_RELA]: New function.
9755 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9756 Sort_relocs_comparison.
9757 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9758 parameter. Change all callers.
9759 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9760 sort_relocs parameter. Change all callers.
9761 * output.cc (Output_reloc::get_address): New function, broken out
9762 of write_rel.
9763 (Output_reloc::write_rel): Call it.
9764 (Output_reloc::compare): New function.
9765 (Output_data_reloc_base::do_write): Optionally sort relocs.
9766
60b2b4e7
ILT
9767 * configure.ac: If targ_extra_obj is set, link it in.
9768 * configure.tgt: Initialize all variables.
9769 (x86_64*): Set targ_extra_obj and targ_extra_size.
9770 * configure: Rebuild.
9771
8825ac63
ILT
9772 * object.cc (Sized_relobj::include_section_group): Adjust section
9773 indexes read from group data. Build vector to pass to
9774 layout_group.
9775 * layout.cc (Layout::layout_group): Add flags and shndxes
9776 parameters. Remove contents parameter. Change caller. Update
9777 explicit instantiations.
9778 * layout.h (class Layout): Update layout_group declaration.
9779 * output.cc (Output_data_group::Output_data_group): Add flags and
9780 input_shndxes parameters. Remove contents parameter. Change
9781 caller.
9782 (Output_data_group::do_write): Change input_sections_ to
9783 input_shndxes_.
9784 * output.h (class Output_data_group): Update constructor
9785 declaration. Rename input_sections_ to input_shndxes_.
9786 * testsuite/many_sections_test.cc: Add template.
9787
e94cf127
CC
97882008-04-30 Cary Coutant <ccoutant@google.com>
9789
4418b2d5
CC
9790 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9791
e94cf127
CC
9792 * layout.cc (Layout::include_section): Refactored check for debug
9793 info section.
9794 (Layout::add_comdat): Add new parameters. Change type
9795 of signature parameter. Add object and shndx to signatures table.
9796 (Layout::find_kept_object): New function.
9797 * layout.h: Include <cstring>.
9798 (Layout::is_debug_info_section): New function.
9799 (Layout::add_comdat): Add new parameters.
9800 (Layout::find_kept_object): New function.
9801 (Layout::Kept_section): New struct.
9802 (Layout::Signatures): Change type of map range.
9803 * object.cc (Relobj::output_section_address): New function.
9804 (Sized_relobj::include_section_group): Add new parameters. Change
9805 calls to Layout::add_comdat. Change to build table of kept comdat
9806 groups and table mapping discarded sections to kept sections.
9807 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9808 (Sized_relobj::do_layout): Change calls to include_section_group and
9809 include_linkonce_section.
9810 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9811 value to zero when section is discarded.
9812 (Sized_relobj::map_to_kept_section): New function.
9813 * object.h (Relobj::output_section_address): New function.
9814 (Relobj::Comdat_group): New type.
9815 (Relobj::find_comdat_group): New function.
9816 (Relobj::Comdat_group_table): New type.
9817 (Relobj::Kept_comdat_section): New type.
9818 (Relobj::Kept_comdat_section_table): New type.
9819 (Relobj::add_comdat_group): New function.
9820 (Relobj::set_kept_comdat_section): New function.
9821 (Relobj::get_kept_comdat_section): New function.
9822 (Relobj::comdat_groups_): New field.
9823 (Relobj::kept_comdat_sections_): New field.
9824 (Symbol_value::input_value): Update comment.
9825 (Sized_relobj::map_to_kept_section) New function.
9826 (Sized_relobj::include_linkonce_section): Add new parameter.
9827 * target-reloc.h (Comdat_behavior): New type.
9828 (get_comdat_behavior): New function.
9829 (relocate_section): Add code to map a discarded section to the
9830 corresponding kept section when applying a relocation.
9831
e4e5049b
CS
98322008-04-30 Craig Silverstein <csilvers@google.com>
9833
9834 * dwarf_reader.cc (next_generation_count): New static var.
9835 (Addr2line_cache_entry): New struct.
9836 (addr2line_cache): New static var.
9837 (Dwarf_line_info::one_addr2line): Added caching.
9838 (Dwarf_line_info::clear_addr2line_cache): New function.
9839 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9840 cache-size parameter.
9841 (Dwarf_line_info::one_addr2line_cache): New function.
9842 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9843 new cache-size argument to one_addr2line(), and clear cache.
9844
d09e9154
CC
98452008-04-28 Cary Coutant <ccoutant@google.com>
9846
9847 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9848 R_386_PC8 relocations.
9849
7ef73768
ILT
98502008-04-23 Ian Lance Taylor <iant@google.com>
9851
55438702
ILT
9852 * object.cc (Sized_relobj::include_section_group): Check for
9853 invalid section group.
9854
c165fb93
ILT
9855 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9856 header size.
9857
7ef73768
ILT
9858 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9859 than read for file header.
9860 * archive.cc (Archive::include_member): Likewise.
9861
6194aaab
L
98622008-04-23 Paolo Bonzini <bonzini@gnu.org>
9863
9864 * aclocal.m4: Regenerate.
9865 * configure: Regenerate.
9866
d491d34e
ILT
98672008-04-19 Ian Lance Taylor <iant@google.com>
9868
5ea2bac6
ILT
9869 * version.cc (version_string): Bump to 1.6.
9870
7bc3e21a
ILT
9871 * testsuite/Makefile.am (many_sections_r_test): New target.
9872 (many_sections_r_test_SOURCES): Remove.
9873 (many_sections_r_test_DEPENDENCIES): Remove.
9874 (many_sections_r_test_LDFLAGS): Remove.
9875 (many_sections_r_test_LDADD): Remove.
9876
7fcd3aa9
ILT
9877 * object.cc (Sized_relobj::do_add_symbols): Always pass
9878 local_symbol_count_ to add_from_relobj.
9879
4c94d6ae
ILT
9880 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9881 every thousand variables.
9882 * testsuite/Makefile.in: Rebuild.
9883
d491d34e
ILT
9884 * object.cc (Xindex::initialize_symtab_xindex): New function.
9885 (Xindex::read_symtab_xindex): New function.
9886 (Xindex::sym_xindex_to_shndx): New function.
9887 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9888 available.
9889 (Sized_relobj::do_initialize_xindex): New function.
9890 (Sized_relobj::do_read_symbols): Adjust section links.
9891 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9892 parameter. Change all callers.
9893 (Sized_relobj::include_section_group): Adjust section links and
9894 symbol section indexes.
9895 (Sized_relobj::do_layout): Adjust section links.
9896 (Sized_relobj::do_count_local_symbols): Adjust section links and
9897 symbol section indexes.
9898 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9899 ordinary and special symbols.
9900 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9901 dynsym_xindex parameters. Change all callers. Adjust section
9902 links. Use SHN_XINDEX when needed.
9903 (Sized_relobj::get_symbol_location_info): Adjust section links.
9904 Don't get fooled by special symbols.
9905 * object.h (class Xindex): Define.
9906 (class Object): Add xindex_ parameter. Declare virtual functoin
9907 do_initialize_xindex.
9908 (Object::adjust_sym_shndx): New function.
9909 (Object::set_xindex): New protected function.
9910 (class Symbol_value): Add is_ordinary_shndx_ field.
9911 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9912 (Symbol_value::value): Assert ordinary section.
9913 (Symbol_value::initialize_input_to_output_map): Likewise.
9914 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9915 Change all callers.
9916 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9917 all callers.
9918 (class Sized_relobj): Update declarations.
9919 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9920 parameter. Change all callers.
9921 (Sized_relobj::adjust_shndx): New function.
9922 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9923 field.
9924 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9925 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9926 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9927 (Sized_dynobj::read_dynsym_section): Adjust section links.
9928 (Sized_dynobj::read_dynamic): Likewise.
9929 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9930 section links.
9931 (Sized_dynobj::do_initialize_xindex): New function.
9932 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9933 do_initialize_xindex.
9934 (Sized_dynobj::adjust_shndx): New function.
9935 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9936 dynsym_xindex_ fields.
9937 (Layout::finalize): Add a call to set_section_indexes before
9938 creating the symtab sections.
9939 (Layout::set_section_indexes): Don't do anything if the section
9940 already has a section index.
9941 (Layout::create_symtab_sections): Add shnum parameter. Change
9942 caller. Create .symtab_shndx section if needed.
9943 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9944 caller.
9945 (Layout::allocated_output_section_count): New function.
9946 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9947 needed.
9948 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9949 fields. Update declarations.
9950 (Layout::symtab_xindex): New function.
9951 (Layout::dynsym_xindex): New function.
9952 (class Write_symbols_task): Add layout_ field.
9953 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9954 Change caller.
9955 * output.cc (Output_section_headers::Output_section_headers): Add
9956 shstrtab_section parameter. Change all callers.
9957 (Output_section_headers::do_sized_write): Store overflow values
9958 for section count and section string table section index in
9959 section header zero.
9960 (Output_file_header::do_sized_write): Check for overflow of
9961 section count and section string table section index.
9962 (Output_symtab_xindex::do_write): New function.
9963 (Output_symtab_xindex::endian_do_write): New function.
9964 * output.h (class Output_section_headers): Add shstrtab_section_.
9965 Update declarations.
9966 (class Output_symtab_xindex): Define.
9967 (Output_section::has_out_shndx): New function.
9968 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9969 field.
9970 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9971 Change all callers.
9972 (Sized_symbol::init): Likewise.
9973 (Symbol::output_section): Check for ordinary symbol.
9974 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9975 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9976 callers.
9977 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9978 Change all callers. Simplify handling of symbols from sections
9979 not included in the link.
9980 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9981 distinction.
9982 (Weak_alias_sorter::operator()): Assert that symbols are
9983 ordinary.
9984 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9985 distinction.
9986 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9987 parameters. Change all callers.
9988 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9989 symbol distinction. Use SHN_XINDEX when needed.
9990 (Symbol_table::write_section_symbol): Add symtab_xindex
9991 parameter. Change all callers.
9992 (Symbol_table::sized_write_section_symbol): Likewise. Use
9993 SHN_XINDEX when needed.
9994 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9995 declarations.
9996 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9997 (Symbol::is_defined): Check is_ordinary.
9998 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9999 (Symbol::is_absolute, Symbol::is_common): Likewise.
10000 (class Sized_symbol): Update declarations.
10001 (class Symbol_table): Update declarations.
10002 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10003 parameters. Change all callers.
10004 (Sized_symbol::override): Likewise.
10005 (Symbol_table::override): Likewise.
10006 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10007 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10008 is_ordinary, and orig_st_shndx parameters. Change all callers.
10009 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10010 to be in an ordinary section.
10011 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10012 object and is_ordinary parameters. Change all callers.
10013 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10014 Change all callers. Don't add undefined or non-ordinary symbols
10015 to reloc_map_.
10016 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10017 Change all callers.
10018 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10019 declarations.
10020 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10021 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10022 (Sized_relobj::relocate_sections): Likewise.
10023 * target-reloc.h (scan_relocs): Adjust section symbol index.
10024 (scan_relocatable_relocs): Likewise.
10025 * i386.cc (Scan::local): Check for ordinary symbols.
10026 * sparc.cc (Scan::local): Likewise.
10027 * x86_64.cc (Scan::local): Likewise.
10028 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10029 to symbol_section_and_value.
10030 * testsuite/many_sections_test.cc: New file.
10031 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10032 (check_PROGRAMS): Add many_sections_test.
10033 (many_sections_test_SOURCES): Define.
10034 (many_sections_test_DEPENDENCIES): Define.
10035 (many_sections_test_LDFLAGS): Define.
10036 (BUILT_SOURCES): Add many_sections_define.h.
10037 (many_sections_define.h): New target.
10038 (BUILT_SOURCES): Add many_sections_check.h.
10039 (many_sections_check.h): New target.
10040 (check_PROGRAMS): Add many_sections_r_test.
10041 (many_sections_r_test_SOURCES): Define.
10042 (many_sections_r_test_DEPENDENCIES): Define.
10043 (many_sections_r_test_LDFLAGS): Define.
10044 (many_sections_r_test_LDADD): Define.
10045 (many_sections_r_test.o): New target.
10046 * testsuite/Makefile.in: Rebuild.
10047
c5818ff1
CC
100482008-04-17 Cary Coutant <ccoutant@google.com>
10049
10050 * errors.cc (Errors::info): New function.
10051 (gold_info): New function.
10052 * errors.h (Errors::info): New function.
10053 * gold.h (gold_info): New function.
10054 * object.cc (Input_objects::add_object): Print trace output.
10055 * options.cc (options::parse_set): New function.
10056 (General_options::parse_wrap): Deleted.
10057 (General_options::General_options): Deleted initializer.
10058 * options.h (options::String_set): New typedef.
10059 (options::parse_set): New function.
10060 (DEFINE_set): New macro.
10061 (General_options::wrap): Changed to use DEFINE_set. Changed
10062 callers of any_wrap_symbols and is_wrap_symbol.
10063 (General_options::trace, General_options::trace_symbol):
10064 New options.
10065 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10066 (General_options::wrap_symbols_): Deleted.
10067 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10068
b5be4a7c
DM
100692008-04-17 David S. Miller <davem@davemloft.net>
10070
10071 * options.cc (General_options::parse_V): New function.
10072 * options.h: Add entries for -V and -Qy.
10073
155a0dd7
ILT
100742008-04-17 Ian Lance Taylor <iant@google.com>
10075
10076 * common.cc (Symbol_table::allocate_commons): Remove options
10077 parameter. Change caller.
10078 (Symbol_table::do_allocate_commons): Remove options parameter.
10079 Change caller. Just call do_allocate_commons_list twice.
10080 (Symbol_table::do_allocate_commons_list): New function, broken out
10081 of do_allocate_commons.
10082 * common.h (class Allocate_commons_task): Remove options_ field.
10083 Update constructor.
10084 * symtab.cc (Symbol_table::Symbol_table): Initialize
10085 tls_commons_.
10086 (Symbol_table::add_from_object): Put TLS common symbols on
10087 tls_commons_ list.
10088 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10089 which are IN_OUTPUT_DATA.
10090 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10091 allocate_commons and do_allocate_commons declarations. Declare
10092 do_allocate_commons_list.
10093 * gold.cc (queue_middle_tasks): Update creation of
10094 Allocate_commons_task to not pass options.
10095 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10096 (TLS_TEST_C_FLAGS): New variable.
10097 (tls_test_c_pic.o): New target.
10098 (tls_test_shared.so): Link in tls_test_c_pic.o.
10099 (tls_test_c_pic_ie.o): New target.
10100 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10101 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10102 (tls_test_c.o): New target.
10103 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10104 (tls_pic_test_LDADD): Likewise.
10105 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10106 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10107 (tls_test_c_gnu2.o): New target.
10108 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10109 tls_test_c_gnu2.o.
10110 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10111 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10112 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10113 * testsuite/tls_test.cc: Include "config.h".
10114 (t_last): Call t11_last.
10115 * testsuite/tls_test.h (t11, t11_last): Declare.
10116 * testsuite/tls_test_c.c: New file.
10117 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10118 * configure.ac: Check for OpenMP support.
10119 * configure, config.in, Makefile.in: Rebuild.
10120 * testsuite/Makefile.in: Rebuild.
10121
edfbb029
CC
101222008-04-16 Cary Coutant <ccoutant@google.com>
10123
10124 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10125 (Target_i386::tls_base_symbol_defined_): New field.
10126 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10127 (Target_i386::Scan::global): Likewise.
10128 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10129 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10130 (Target_x86_64::tls_base_symbol_defined_): New field.
10131 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10132 (Target_x86_64::Scan::global): Likewise.
10133
f3c69fca
CC
101342008-04-16 Cary Coutant <ccoutant@google.com>
10135
10136 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10137 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10138 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10139 building shared libraries.
10140 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10141 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10142 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10143 * testsuite/Makefile.in: Rebuild.
10144 * testsuite/weak_undef.h: New file.
10145 * testsuite/weak_undef_file1.cc: Add extra test cases.
10146 * testsuite/weak_undef_file2.cc: Likewise.
10147 * testsuite/weak_undef_test.cc: Likewise.
10148
7c414435
DM
101492008-04-16 David S. Miller <davem@davemloft.net>
10150
32b769e1
DM
10151 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10152 Add issued_non_pic_error_ field. Declare check_non_pic.
10153 (Target_sparc::Scan::check_non_pic): New function.
10154 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10155 (Target_sparc::Scan::global): Likewise.
10156
11936fb1
DM
10157 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10158 * configure: Rebuild.
10159
7c414435
DM
10160 * options.h (DEFINE_enable): New macro.
10161 (new_dtags): New enable option.
10162 (initfirst, interpose, loadfltr, nodefaultlib,
10163 nodelete, nodlopen, nodump): New -z options.
10164 * layout.cc (Layout:finish_dynamic_section): If new
10165 dtags enabled, emit DT_RUNPATH. Also, emit a
10166 DT_FLAGS_1 containing any specified -z flags.
10167
85c7bf8b
ILT
101682008-04-16 Ian Lance Taylor <iant@google.com>
10169
12c0daef
ILT
10170 * copy-relocs.cc: New file.
10171 * copy-relocs.h: New file.
10172 * reloc.cc: Remove Copy_relocs code.
10173 * reloc.h: Likewise.
10174 * reloc-types.h (struct Reloc_types) [both versions]: Add
10175 get_reloc_addend_noerror.
10176 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10177 variants of add_global which take an addend which must be zero.
10178 * i386.cc: Include "copy-relocs.h".
10179 (class Target_i386): Change type of copy_relocs_ to variable,
10180 update initializer.
10181 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10182 Change all callers.
10183 (Target_i386::do_finalize_sections): Change handling of
10184 copy_relocs_.
10185 * sparc.cc: Include "copy-relocs.h".
10186 (class Target_sparc): Change type of copy_relocs_ to variable,
10187 update initializer.
10188 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10189 Change all callers.
10190 (Target_sparc::do_finalize_sections): Change handling of
10191 copy_relocs_.
10192 * x86_64.cc: Include "copy-relocs.h".
10193 (class Target_x86_64): Change type of copy_relocs_ to variable,
10194 update initializer.
10195 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10196 class. Change all callers.
10197 (Target_x86_64::do_finalize_sections): Change handling of
10198 copy_relocs_.
10199 * Makefile.am (CCFILES): Add copy-relocs.cc.
10200 (HFILES): Add copy-relocs.h.
10201
4f4995b6
ILT
10202 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10203
85c7bf8b
ILT
10204 * testsuite/script_test_4.sh: Permit leading zeroes.
10205
4f2a9edd
ILT
102062008-04-15 Ian Lance Taylor <iant@google.com>
10207
e6188289
ILT
10208 * script-sections.cc (Script_sections::create_segments): Use
10209 header_size_adjustment even when there is enough room for the
10210 headers.
10211 * testsuite/script_test_4.sh: New file.
10212 * testsuite/script_test_4.t: New file.
10213 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10214 (check_DATA): Add script_test_4.stdout.
10215 (MOSTLYCLEANFILES): Likewise.
10216 (script_test_4): New target.
10217 (script_test_4.stdout): New target.
10218 * testsuite/Makefile.in: Rebuild.
10219
4f2a9edd
ILT
10220 * sparc.cc: Add definitions for Output_data_plt_sparc class
10221 constants.
10222
f5314dd5
DM
102232008-04-14 David S. Miller <davem@davemloft.net>
10224
10225 * sparc.cc: New file.
10226 * Makefile.am (TARGETSOURCES): Add sparc.cc
10227 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10228 * configure.tgt: Document targ_extra_size and
10229 targ_extra_big_endian. Add entries for sparc-* and
10230 sparc64-*.
10231 * configure.ac: Handle targ_extra_size and
10232 targ_extra_big_endian.
10233 * Makefile.in: Rebuild.
10234 * configure: Likewise.
10235 * po/POTFILES.in: Likewise.
10236 * po/gold.pot: Likewise.
10237
154e0e9a
ILT
102382008-04-14 Ian Lance Taylor <iant@google.com>
10239
10240 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10241 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10242 in the name/type/flags to section mapping. Don't call
10243 allocate_output_section.
10244 (Layout::choose_output_section): Change parameter from adjust_name
10245 to is_input_section. Don't permit input sections after sections
10246 are attached to segments. Don't call allocate_output_section.
10247 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10248 not write_enable_output_section.
10249 (Layout::make_output_section): Don't push to
10250 unattached_section_list_ nor call attach_to_segment. Call
10251 attach_section_to_segment if sections are attached.
10252 (Layout::attach_sections_to_segments): New function.
10253 (Layout::attach_section_to_segment): New function.
10254 (Layout::attach_allocated_section_to_segment): Rename from
10255 attach_to_segment. Remove flags parameter.
10256 (Layout::allocate_output_section): Remove function.
10257 (Layout::write_enable_output_section): Remove function.
10258 * layout.h (class Layout): Update for above changes. Add new
10259 field sections_are_attached_.
10260 * output.h (Output_section::update_flags_for_input_section): New
10261 function.
10262 * output.cc (Output_section::add_input_section): Call
10263 update_flags_for_input_section.
10264 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10265
009a67a2
CC
102662008-04-11 Cary Coutant <ccoutant@google.com>
10267
10268 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10269 thought unnecessary.
10270 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10271
759b1a24
ILT
102722008-04-11 Ian Lance Taylor <iant@google.com>
10273
10274 * output.h (class Output_section_data): Remove inline definition
10275 of set_addralign.
10276 * output.cc (Output_section_data::set_addralign): New function.
10277
c2b45e22
CC
102782008-04-11 Cary Coutant <ccoutant@google.com>
10279
10280 Add support for TLS descriptors for i386 and x86_64.
10281 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10282 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10283 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10284 GOT_TYPE_TLS_DESC.
10285 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10286 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10287 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10288 relocations.
10289 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10290 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10291 Fix problem with initial-exec relocations.
10292 (Target_i386::Relocate::relocate_tls): Likewise.
10293 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10294 relaxation.
10295 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10296 support for section-plus-offset dynamic table entries.
10297 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10298 (Output_data_dynamic::Dynamic_entry): Add support for
10299 section-plus-offset dynamic table entries.
10300 (Output_data_dynamic::Classification): Likewise.
10301 (Output_data_dynamic::classification_): Renamed offset_.
10302 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10303 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10304 (Target_x86_64::make_plt_section): New function.
10305 (Target_x86_64::reserve_tlsdesc_entries): New function.
10306 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10307 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10308 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10309 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10310 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10311 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10312 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10313 add extra PLT entry for TLS descriptors.
10314 (Output_data_plt_x86_64::got_): New field.
10315 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10316 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10317 fields.
10318 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10319 descriptors.
10320 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10321 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10322 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10323 R_386_TLS_DESC_CALL relocations.
10324 (Target_x86_64::Scan::global): Likewise.
10325 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10326 for TLS descriptors.
10327 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10328 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10329 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10330 GD-to-IE relaxation.
10331 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10332 and TLS_DESCRIPTORS.
10333 * Makefile.in: Rebuild.
10334 * configure: Rebuild.
10335 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10336 (tls_test_shared2.so): New target.
10337 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10338 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10339 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10340 (tls_shared_gd_to_ie_test_LDADD): New variable.
10341 (tls_shared_gnu2_gd_to_ie_test): New target.
10342 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10343 New targets.
10344 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10345 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10346 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10347 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10348 (tls_shared_gnu2_test): New target.
10349 (tls_test_gnu2_shared.so): New target.
10350 (tls_shared_gnu2_test_SOURCES): New variable.
10351 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10352 (tls_shared_gnu2_test_LDFLAGS): New variable.
10353 (tls_shared_gnu2_test_LDADD): New variable.
10354 * testsuite/Makefile.in: Rebuild.
10355 * testsuite/Makefile.
10356
83bfb6b7
ILT
103572008-04-11 Ian Lance Taylor <iant@google.com>
10358
10359 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10360 justsyms.t.
10361 * testsuite/Makefile.in: Rebuild.
10362
10363 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10364 long.
10365 * testsuite/script_test_2.cc (main): Adjust test.
10366
706e1f5e
ILT
103672008-04-11 David S. Miller <davem@davemloft.net>
10368 Ian Lance Taylor <iant@google.com>
10369
10370 * options.h (General_options): Add entries for '-Y' and
10371 '-relax'.
10372 * options.cc (General_options:finalize): If -Y was used, add those
10373 entries to the library path instead of the default "/lib" and
10374 "/usr/lib".
10375
7c98e6bb
DM
103762008-04-11 David S. Miller <davem@davemloft.net>
10377
10378 * testsuite/justsyms.t: Start at 0x100.
10379 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
10380 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10381 long.
10382 * testsuite/script_test_2.cc: Adjust string and section length
10383 checks.
7c98e6bb 10384
99a37bfd
ILT
103852008-04-09 Ian Lance Taylor <iant@google.com>
10386
2cefc357
ILT
10387 PR gold/5996
10388 * script-sections.cc (Sections_element::allocate_to_segment): Add
10389 orphan parameter.
10390 (Output_section_definition::allocate_to_segment): Likewise.
10391 (Orphan_output_section::allocate_to_segment): Likewise.
10392 (Script_sections::attach_sections_using_phdrs_clause): Don't
10393 propagate non-PT_LOAD segments to orphan sections.
10394 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10395 readelf rather than objdump.
10396 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10397 .interp section and PT_INTERP segment are the same size.
10398 * testsuite/Makefile.in: Rebuild.
10399
99a37bfd
ILT
10400 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10401 aliases for symbols defined in the same object.
10402 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10403 (weak_alias_test_SOURCES): New variable.
10404 (weak_alias_test_DEPENDENCIES): New variable.
10405 (weak_alias_test_LDFLAGS): New variable.
10406 (weak_alias_test_LDADD): New variable.
10407 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10408 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10409 (weak_alias_test_3.o): New target.
10410 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10411 * testsuite/weak_alias_test_main.cc: New file.
10412 * testsuite/weak_alias_test_1.cc: New file.
10413 * testsuite/weak_alias_test_2.cc: New file.
10414 * testsuite/weak_alias_test_3.cc: New file.
10415
780e49c5
ILT
104162008-04-08 Ian Lance Taylor <iant@google.com>
10417
cdb0b8f5
ILT
10418 * options.h (class General_options): Add --noinhibit-exec option.
10419 * main.cc (main): Check --noinhibit-exec.
10420
0864d551
ILT
10421 * options.h (class General_options): Define --wrap as a special
10422 option. Add wrap_symbols_ field.
10423 (General_options::any_wrap_symbols): New function.
10424 (General_options::is_wrap_symbol): New function.
10425 * options.cc (General_options::parse_wrap): New function.
10426 (General_options::General_options): Initialize wrap_symbols_.
10427 * symtab.cc (Symbol_table::wrap_symbol): New function.
10428 (Symbol_table::add_from_object): Handle --wrap.
10429 * symtab.h (class Symbol_table): Declare wrap_symbol.
10430 * target.h (Target::wrap_char): New function.
10431 (Target::Target_info): Add wrap_char field.
10432 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10433 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10434 * testsuite/testfile.cc (Target_test::test_target_info):
10435 Likewise.
10436
789aa6de
ILT
10437 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10438 there is one.
10439
2c38906f
ILT
10440 * layout.h (class Layout): Add added_eh_frame_data_ field.
10441 * layout.cc (Layout::Layout): Initialize new field.
10442 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10443 output section until we find a section we merged successfully.
10444 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10445 that the size be non-zero.
10446
780e49c5
ILT
10447 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10448 qualifier.
10449
7fcd0256
ILT
104502008-04-08 Craig Silverstein <csilvers@google.com>
10451
10452 * configure.ac: Export new conditional variable HAVE_ZLIB.
10453 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10454 on HAVE_ZLIB.
10455 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10456 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10457
6835af53
ILT
104582008-04-07 Ian Lance Taylor <iant@google.com>
10459
e24f324c
ILT
10460 * version.cc (version_string): Set to "1.5".
10461
a036edd8
ILT
10462 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10463 Add issued_non_pic_error_ field. Declare check_non_pic.
10464 (Target_x86_64::Scan::check_non_pic): New function.
10465 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10466 (Target_x86_64::Scan::global): Likewise.
10467
624f8810
ILT
10468 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10469 addend parameter. Change caller. Handle merge sections.
10470 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10471 Address to Addend. Don't add in the result of
10472 local_section_offset, pass down the addend and use the returned
10473 value.
10474 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10475 Update declarations of local_section_offset and symbol_value.
10476 * testsuite/two_file_test_1.cc (t18): New function.
10477 * testsuite/two_file_test_2.cc (f18): New function.
10478 * testsuite/two_file_test_main.cc (main): Call t18.
10479 * testsuite/two_file_test.h (t18, f18): Declare.
10480
6835af53
ILT
10481 * configure.ac: Don't test for objdump, c++filt, or readelf.
10482 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10483 conditionals.
10484 (TEST_READELF): New variable.
10485 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10486 (check_PROGRAMS): Add two_file_strip_test.
10487 (two_file_strip_test): New target.
10488 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10489 (two_file_same_shared_strip_test_SOURCES): New variable.
10490 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10491 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10492 (two_file_same_shared_strip_test_LDADD): New variable.
10493 (two_file_shared_strip.so): New target.
10494 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10495 (ver_test_5.syms, ver_test_7.syms): Likewise.
10496 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10497 (strip_test_3.stdout): Use TEST_OBJDUMP.
10498 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10499
86925eef
CC
105002008-04-04 Cary Coutant <ccoutant@google.com>
10501
10502 * symtab.h (Symbol::is_weak_undefined): New function.
10503 (Symbol::is_strong_undefined): New function.
10504 (Symbol::is_absolute): New function.
10505 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10506 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10507 absolute symbols.
10508 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10509 (weak_undef_test): New target.
10510 * testsuite/Makefile.in: Rebuild.
10511 * testsuite/weak_undef_file1.cc: New file.
10512 * testsuite/weak_undef_file2.cc: New file.
10513 * testsuite/weak_undef_test.cc: New file.
10514
126f3ece
ILT
105152008-04-03 Craig Silverstein <csilvers@google.com>
10516
10517 * compressed_output.h (class Output_compressed_section): Use
10518 unsigned buffer.
10519 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10520 add zlib header.
10521 (zlib_compressed_suffix): Removed.
10522 (Output_compressed_section::set_final_data_size): Use unsigned
10523 buffers.
10524 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10525 Fix linker invocation.
10526 (flagstest_o_specialfile_and_compress_debug_sections):
10527 Likewise.
10528 * testsuite/Makefile.in: Regenerated.
10529
deae2a14
DM
105302008-04-02 David S. Miller <davem@davemloft.net>
10531
10532 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10533 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10534
70752818
ILT
105352008-04-02 Craig Silverstein <csilvers@google.com>
10536
10537 * TODO: New file.
10538
39d0cb0e
ILT
105392008-04-02 Ian Lance Taylor <iant@google.com>
10540
10541 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10542 parameters. Update for new key type to views_. Change all
10543 callers.
10544 (File_read::read): Adjust for byteshift in returned view.
10545 (File_read::add_view): New function, broken out of
10546 find_and_make_view.
10547 (File_read::make_view): New function, broken out of
10548 find_and_make_view.
10549 (File_read::find_or_make_view): Add offset and aligned
10550 parameters. Rewrite accordingly. Change all callers.
10551 (File_read::get_view): Add offset and aligned parameters. Adjust
10552 for byteshift in return value.
10553 (File_read::get_lasting_view): Likewise.
10554 * fileread.h (class File_read): Update declarations.
10555 (class File_read::View): Add byteshift_ field. Add byteshift to
10556 constructor. Add byteshift method.
10557 * archive.h (Archive::clear_uncached_views): New function.
10558 (Archive::get_view): Add aligned parameter. Change all callers.
10559 * object.h (Object::get_view): Add aligned parameter. Change all
10560 callers.
10561 (Object::get_lasting_view): Likewise.
10562
10563 * fileread.cc (File_read::release): Don't call clear_views if
10564 there are multiple objects.
10565 * fileread.h (File_read::clear_uncached_views): New function.
10566 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10567 on the archive.
10568
a1207466
CC
105692008-03-31 Cary Coutant <ccoutant@google.com>
10570
10571 Add thin archive support.
10572 * archive.cc (Archive::armagt): New const.
10573 (Archive::setup): Remove task parameter and calls to unlock.
10574 (Archive::unlock_nested_archives): New function.
10575 (Archive::read_header): Add nested_off parameter. Change
10576 all callers.
10577 (Archive::interpret_header): Likewise.
10578 (Archive::include_all_members): Change to handle thin
10579 archives.
10580 (Archive::include_member): Likewise.
10581 * archive.h (Archive::Archive): Add new parameters and
10582 initializers.
10583 (Archive::armagt): New const.
10584 (Archive::setup): Remove task parameter.
10585 (Archive::unlock_nested_archives): New function.
10586 (Archive::read_header): Add nested_off parameter.
10587 (Archive::interpret_header): Likewise.
10588 (Archive::Nested_archive_table): New typedef.
10589 (Archive::is_thin_archive_): New field.
10590 (Archive::nested_archives_): New field.
10591 (Archive::options_): New field.
10592 (Archive::dirpath_): New field.
10593 (Archive::task_): New field.
10594 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10595 for thin archives. Pass additional parameters to
10596 Archive::Archive. Unlock the archive file after calling
10597 Archive::setup.
cd536b21 10598
479f6503
ILT
105992008-03-29 Ian Lance Taylor <iant@google.com>
10600
686c8caf
ILT
10601 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10602 version symbol to be local.
10603 * testsuite/ver_test_4.sh: New file.
10604 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10605 (check_DATA): Add ver_test_4.syms.
10606 (ver_test_4.syms): New target.
10607 * testsuite/Makefile.in: Rebuild.
10608
ab794b6b
ILT
10609 * output.cc
10610 (Output_section::Input_section_sort_entry::has_priority): New
10611 function.
10612 (Output_section::Input_section_sort_entry::match_file_name): New
10613 function.
10614 (Output_section::Input_section_sort_entry::match_section_name):
10615 Remove.
10616 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10617 Remove.
10618 (Output_section::Input_section_sort_entry::match_section_file):
10619 Remove.
10620 (Output_section::Input_section_sort_compare::operator()): Rewrite
10621 using new Input_section_sort_entry functions. Sort crtbegin and
10622 crtend first. Sort sections with no priority before sections with
10623 a priority.
10624 * testsuite/initpri1.c (d3): Check j != 4.
10625 (cd5): New constructor/destructor function.
10626 (main): Check j != 2.
10627
479f6503
ILT
10628 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10629 new symbol when resolving, don't call set_is_default.
10630 * testsuite/ver_test_7.cc: New file.
10631 * testsuite/ver_test_7.sh: New file.
10632 * testsuite/Makefile.am (ver_test_7.so): New target.
10633 (ver_test_7.o): New target.
10634 (check_SCRIPTS): Add ver_test_7.sh.
10635 (check_DATA): Add ver_test_7.syms.
10636 (ver_test_7.syms): New target.
10637
2fd32231
ILT
106382008-03-28 Ian Lance Taylor <iant@google.com>
10639
10640 * layout.cc (Layout::layout): If we see an input section with a
10641 name that needs sorting, set the must_sort flag for the output
10642 section.
10643 (Layout::make_output_section): If the name of the output section
10644 indicates that it might require sorting, set the may_sort flag.
10645 * output.h (Output_section::may_sort_attached_input_sections): New
10646 function.
10647 (Output_section::set_may_sort_attached_input_sections): New
10648 function.
10649 (Output_section::must_sort_attached_input_sections): New
10650 function.
10651 (Output_section::set_must_sort_attached_input_sections): New
10652 function.
10653 (class Output_section): Declare Input_section_sort_entry. Define
10654 Input_section_sort_compare. Declare
10655 sort_attached_input_sections. Add new fields:
10656 may_sort_attached_input_sections_,
10657 must_sort_attached_input_sections_,
10658 attached_input_sections_are_sorted_.
10659 * output.cc (Output_section::Output_section): Initialize new
10660 fields.
10661 (Output_section::add_input_section): Add an entry to
10662 input_sections_ if may_sort or must_sort are true.
10663 (Output_section::set_final_data_size): Call
10664 sort_attached_input_sections if necessary.
10665 (Output_section::Input_section_sort_entry): Define new class.
10666 (Output_section::Input_section_sort_compare::operator()): New
10667 function.
10668 (Output_section::sort_attached_input_sections): New function.
10669 * configure.ac: Check whether the compiler supports constructor
10670 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10671 * testsuite/initpri1.c: New file.
10672 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10673 CONSTRUCTOR_PRIORITY.
10674 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10675 (initpri1_LDFLAGS): New variable.
10676 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10677
18e6b24e
ILT
106782008-03-27 Ian Lance Taylor <iant@google.com>
10679
49bdd526
ILT
10680 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10681 * testsuite/common_test_1.c: New file.
10682 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10683 (common_test_1_SOURCES): New variable.
10684 (common_test_1_DEPENDENCIES): New variable.
10685 (common_test_1_LDFLAGS): New variable.
10686
18e6b24e
ILT
10687 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10688 and commons_ correctly when NAME/VERSION does not override
10689 NAME/NULL.
10690 * testsuite/ver_test_6.c: New file.
10691 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10692 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10693 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10694
04bf7072
ILT
106952008-03-26 Ian Lance Taylor <iant@google.com>
10696
5871526f
ILT
10697 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10698 of an undefined symbol from a version script.
10699 * testsuite/Makefile.am (ver_test_5.so): New target.
10700 (ver_test_5.o): New target.
10701 (check_SCRIPTS): Add ver_test_5.sh.
10702 (check_DATA): Add ver_test_5.syms.
10703 (ver_test_5.syms): New target.
10704 * testsuite/ver_test_5.cc: New file.
10705 * testsuite/ver_test_5.script: New file.
10706 * testsuite/ver_test_5.sh: New file.
10707 * Makefile.in, testsuite/Makefile.in: Rebuild.
10708
04bf7072
ILT
10709 PR gold/5986
10710 Fix problems building gold with gcc 4.3.0.
10711 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10712 (gold_error_at_location, gold_warning_at_location): Use it.
10713 * configure.ac: Check whether we can compile and use a template
10714 function with a printf attribute.
10715 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10716 when jumping over bytes.
10717 * object.cc: Instantiate Object::read_section_data.
10718 * debug.h: Include <cstring>
10719 * dwarf_reader.cc: Include <algorithm>
10720 * main.cc: Include <cstring>.
10721 * options.cc: Include <cstring>.
10722 * output.cc: Include <cstring>.
10723 * script.cc: Include <cstring>.
10724 * script.h: Include <string>.
10725 * symtab.cc: Include <cstring> and <algorithm>.
10726 * target-select.cc: Include <cstring>.
10727 * version.cc: Include <string>.
10728 * testsuite/testmain.cc: Include <cstdlib>.
10729 * configure, config.in: Rebuild.
10730
874c5b28
ILT
107312008-03-25 Ian Lance Taylor <iant@google.com>
10732
819d6c3a
ILT
10733 * options.cc: Include "../bfd/bfdver.h".
10734 (options::help): Print bug reporting address.
10735
f4b2c6f5
ILT
10736 * version.cc (print_version): Adjust output for current value of
10737 BFD_VERSION_STRING.
10738
10739 * NEWS: New file.
10740
e96caa79
ILT
10741 * options.cc (options::help): Print list of supported targets.
10742 * target-select.h: Include <vector>.
10743 (class Target_selector): Make machine_, size_, and is_big_endian_
10744 fields const. Add bfd_name_ and instantiated_target_ fields.
10745 (Target_selector::Target_selector): Add bfd_name parameter.
10746 (Target_selector::recognize): Make non-virtual, call
10747 do_recognize.
10748 (Target_selector::recognize_by_name): Make non-virtual, call
10749 do_recognize_by_name.
10750 (Target_selector::supported_names): New function.
10751 (Target_selector::bfd_name): New function.
10752 (Target_selector::do_instantiate_target): New pure virtual
10753 function.
10754 (Target_selector::do_recognize): New virtual function.
10755 (Target_selector::do_recognize_by_name): New virtual function.
10756 (Target_selector::instantiate_target): New private function.
10757 (supported_target_names): Declare.
10758 * target-select.cc (Target_selector::Target_selector): Update for
10759 new parameter and fields.
10760 (select_target_by_name): Check that the name matches before
10761 calling recognize_by_name.
10762 (supported_target_names): New function.
10763 * i386.cc (class Target_selector_i386): Update Target_selector
10764 constructor call. Remove recognize and recognize_by_name. Add
10765 do_instantiate_target.
10766 * x86_64.cc (class Target_selector_x86_64): Likewise.
10767 * testsuite/testfile.cc (class Target_selector_test): Update for
10768 changes to Target_selector.
10769
874c5b28
ILT
10770 * README: Rewrite, with some notes on unsupported features.
10771
0a65a3a7
CC
107722008-03-24 Cary Coutant <ccoutant@google.com>
10773
10774 * i386.cc (Target_i386::Got_type): New enum declaration.
10775 (Target_i386::Scan::local): Updated callers of Output_data_got
10776 member functions.
10777 (Target_i386::Scan::global): Likewise.
10778 (Target_i386::Relocate::relocate): Likewise.
10779 (Target_i386::Relocate::relocate_tls): Likewise.
10780 * object.h (Got_offset_list): New class.
10781 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10782 (Sized_relobj::local_got_offset): Likewise.
10783 (Sized_relobj::set_local_got_offset): Likewise.
10784 (Sized_relobj::local_has_tls_got_offset): Removed.
10785 (Sized_relobj::local_tls_got_offset): Removed.
10786 (Sized_relobj::set_local_tls_got_offset): Removed.
10787 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10788 * output.cc (Output_data_got::add_global): Added got_type parameter.
10789 (Output_data_got::add_global_with_rel): Likewise.
10790 (Output_data_got::add_global_with_rela): Likewise.
10791 (Output_data_got::add_global_pair_with_rel): New function.
10792 (Output_data_got::add_global_pair_with_rela): New function.
10793 (Output_data_got::add_local): Added got_type parameter.
10794 (Output_data_got::add_local_with_rel): Likewise.
10795 (Output_data_got::add_local_with_rela): Likewise.
10796 (Output_data_got::add_local_pair_with_rel): New function.
10797 (Output_data_got::add_local_pair_with_rela): New function.
10798 (Output_data_got::add_global_tls): Removed.
10799 (Output_data_got::add_global_tls_with_rel): Removed.
10800 (Output_data_got::add_global_tls_with_rela): Removed.
10801 (Output_data_got::add_local_tls): Removed.
10802 (Output_data_got::add_local_tls_with_rel): Removed.
10803 (Output_data_got::add_local_tls_with_rela): Removed.
10804 * output.h (Output_data_got::add_global): Added got_type parameter.
10805 (Output_data_got::add_global_with_rel): Likewise.
10806 (Output_data_got::add_global_with_rela): Likewise.
10807 (Output_data_got::add_global_pair_with_rel): New function.
10808 (Output_data_got::add_global_pair_with_rela): New function.
10809 (Output_data_got::add_local): Added got_type parameter.
10810 (Output_data_got::add_local_with_rel): Likewise.
10811 (Output_data_got::add_local_with_rela): Likewise.
10812 (Output_data_got::add_local_pair_with_rel): New function.
10813 (Output_data_got::add_local_pair_with_rela): New function.
10814 (Output_data_got::add_global_tls): Removed.
10815 (Output_data_got::add_global_tls_with_rel): Removed.
10816 (Output_data_got::add_global_tls_with_rela): Removed.
10817 (Output_data_got::add_local_tls): Removed.
10818 (Output_data_got::add_local_tls_with_rel): Removed.
10819 (Output_data_got::add_local_tls_with_rela): Removed.
10820 * resolve.cc (Symbol::override_base_with_special): Removed
10821 reference to has_got_offset_ field.
10822 * symtab.cc (Symbol::init_fields): Replaced initialization
10823 of got_offset_ with got_offsets_. Removed initialization
10824 of has_got_offset_
53fcba31 10825 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
10826 (Symbol::got_offset): Likewise.
10827 (Symbol::set_got_offset): Likewise.
10828 (Symbol::has_tls_got_offset): Removed.
10829 (Symbol::tls_got_offset): Removed.
10830 (Symbol::set_tls_got_offset): Removed.
10831 (Symbol::got_offset_): Removed.
10832 (Symbol::tls_mod_got_offset_): Removed.
10833 (Symbol::tls_pair_got_offset_): Removed.
10834 (Symbol::got_offsets_): New field.
10835 (Symbol::has_got_offset): Removed.
10836 (Symbol::has_tls_mod_got_offset): Removed.
10837 (Symbol::has_tls_pair_got_offset): Removed.
10838 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10839 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10840 member functions.
10841 (Target_x86_64::Scan::global): Likewise.
10842 (Target_x86_64::Relocate::relocate): Likewise.
10843 (Target_x86_64::Relocate::relocate_tls): Likewise.
10844
bd52eafb
BE
108452008-03-25 Ben Elliston <bje@au.ibm.com>
10846
10847 * yyscript.y: Fix spelling error in comment.
10848
8b105e34
ILT
108492008-03-24 Ian Lance Taylor <iant@google.com>
10850
8ed814a9
ILT
10851 * options.h (class General_options): Define build_id option.
10852 * layout.h (class Layout): Declare write_build_id, create_note,
10853 create_build_id. Add build_id_note_ member.
10854 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10855 "libiberty.h", "md5.h", "sha1.h".
10856 (Layout::Layout): Initialize eh_frame_data_,
10857 eh_frame_hdr_section_, and build_id_note_.
10858 (Layout::finalize): Call create_build_id.
10859 (Layout::create_note): New function, broken out of
10860 Layout::create_gold_note.
10861 (Layout::create_gold_note): Call create_note.
10862 (Layout::create_build_id): New function.
10863 (Layout::write_build_id): New function.
10864 (Close_task_runner::run): Call write_build_id.
10865
8b105e34
ILT
10866 * x86_64.cc: Correct license to GPLv3.
10867
086a1841
ILT
108682008-03-23 Ian Lance Taylor <iant@google.com>
10869
10870 * options.cc: Include "demangle.h".
10871 (parse_optional_string): New function.
10872 (parse_long_option): Handle takes_optional_argument.
10873 (parse_short_option): Update dash_z initializer. Handle
10874 takes_optional_argument.
10875 (General_options::General_options): Initialize do_demangle_.
10876 (General_options::finalize): Set do_demangle_. Handle demangling
10877 style.
10878 * options.h (parse_optional_string): Declare.
10879 (struct One_option): Add optional_arg field. Update constructor.
10880 Update call constructor calls. Add takes_optional_argument
10881 function.
10882 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10883 (DEFINE_optional_string): Define.
10884 (General_options::demangle): Change from DEFINE_bool to
10885 DEFINE_optional_string.
10886 (General_options::no_demangle): New function.
10887 (General_options::do_demangle): New function.
10888 (General_options::set_do_demangle): New function.
10889 (General_options::execstack_status_): Move definition to end of
10890 class definition.
10891 (General_options::static_): Likewise.
10892 (General_options::do_demangle_): New field.
10893 * object.cc (big_endian>::get_symbol_location_info): Call
10894 Options::do_demangle, not Options::demangle.
10895 * symtab.cc (demangle): Likewise.
10896
cbb93e63
ILT
108972008-03-22 Ian Lance Taylor <iant@google.com>
10898
10899 * gold.h: Include <cstddef> and <sys/types.h>
10900 * options.h: Include <cstring>.
10901
ec531623
ILT
109022008-03-21 Ian Lance Taylor <iant@google.com>
10903
10904 * Added source code to GNU binutils.
This page took 0.633174 seconds and 4 git commands to generate.