* object.cc (Sized_relobj_file::do_layout): Keep warning sections
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
a29b0dad
ILT
12011-06-17 Ian Lance Taylor <iant@google.com>
2
e588ea8d
ILT
3 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4 when making a shared library.
5
62011-06-17 Ian Lance Taylor <iant@google.com>
7
8 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
9 parameter. Change all callers. Don't issue warning about PC32
10 against locally defined symbol.
a29b0dad 11
9d3b0698
ILT
122011-06-16 Ian Lance Taylor <iant@google.com>
13
14 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
15 occurs in same object.
16
85b0f90c
AM
172011-06-14 Alan Modra <amodra@gmail.com>
18
19 * po/POTFILES.in: Regenerate.
20
a94907d9
ILT
212011-06-09 Ian Lance Taylor <iant@google.com>
22
23 * script-sections.cc
24 (Orphan_output_section::set_section_addresses): For a relocatable
25 link set address to 0.
26
4fb3a1c3
CC
272011-06-09 Cary Coutant <ccoutant@google.com>
28
29 PR gold/12804
30 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
31 used with --compress-debug-sections.
32 * gold/object.cc (Sized_relobj_file::do_layout): Report
33 uncompressed size of compressed input sections.
34
61220854
CC
352011-06-08 Cary Coutant <ccoutant@google.com>
36
37 PR gold/12804
38 * testsuite/two_file_test_2_v1.cc: Change initialization of
39 v2 to keep it in .data.
40
e6455dfb
CC
412011-06-07 Cary Coutant <ccoutant@google.com>
42
43 * common.cc (Symbol_table::do_allocate_commons_list): Call
44 gold_fallback.
45 * errors.cc (Errors::fatal): Adjust call to gold_exit.
46 (Errors::fallback): New function.
47 (gold_fallback): New function.
48 * errors.h (Errors::fallback): New function.
49 * gold.cc (gold_exit): Change status parameter to enum; adjust
50 all callers.
51 (queue_initial_tasks): Call gold_fallback.
52 * gold.h: Include cstdlib.
53 (Exit_status): New enum type.
54 (gold_exit): Change status parameter to enum.
55 (gold_fallback): New function.
56 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
57 (Layout::create_symtab_sections): Likewise.
58 (Layout::create_shdrs): Likewise.
59 * main.cc (main): Adjust call to gold_exit.
60 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
61 (Output_data_got::add_got_entry_pair): Likewise.
62 (Output_section::add_input_section): Likewise.
63 (Output_section::add_output_section_data): Likewise.
64 (Output_segment::set_section_list_addresses): Likewise.
65 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
66
fb0e076f
CC
672011-06-07 Cary Coutant <ccoutant@google.com>
68
69 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
70 for incremental links.
71 * output.cc (Output_segment::set_section_list_addresses): Remove
72 FIXME and test for TLS or BSS.
73
a5ee4d5d
CC
742011-06-07 Cary Coutant <ccoutant@google.com>
75
76 * testsuite/Makefile.am: Add incremental_copy_test,
77 incremental_common_test_1.
78 * testsuite/Makefile.in: Regenerate.
79 * testsuite/common_test_1_v1.c: New source file.
80 * testsuite/common_test_1_v2.c: New source file.
81 * testsuite/copy_test_v1.cc: New source file.
82
5146f448
CC
832011-06-07 Cary Coutant <ccoutant@google.com>
84
85 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
86 update, allocate common from bss section's free list.
87 * incremental-dump.cc (dump_incremental_inputs): Print flag for
88 linker-defined symbols.
89 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
90 Skip GOT and PLT entries that are no longer referenced.
91 (Output_section_incremental_inputs::write_info_blocks): Mark
92 linker-defined symbols.
93 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
94 * output.cc (Output_section::allocate): New function.
95 * output.h (Output_section::allocate): New function.
96 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
97 linker-defined symbols.
98 (Symbol::override_base_with_special): Copy is_predefined_ flag.
99 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
100 (Symbol::init_base_output_data): Likewise.
101 (Symbol::init_base_output_segment): Likewise.
102 (Symbol::init_base_constant): Likewise.
103 (Sized_symbol::init_output_data): Likewise.
104 (Sized_symbol::init_output_segment): Likewise.
105 (Sized_symbol::init_constant): Likewise.
106 (Symbol_table::do_define_in_output_data): Likewise.
107 (Symbol_table::do_define_in_output_segment): Likewise.
108 (Symbol_table::do_define_as_constant): Likewise.
109 * symtab.h (Symbol::is_predefined): New function.
110 (Symbol::init_base_output_data): Add is_predefined parameter.
111 (Symbol::init_base_output_segment): Likewise.
112 (Symbol::init_base_constant): Likewise.
113 (Symbol::is_predefined_): New data member.
114 (Sized_symbol::init_output_data): Add is_predefined parameter.
115 (Sized_symbol::init_output_segment): Likewise.
116 (Sized_symbol::init_constant): Likewise.
117 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
118
26d3c67d
CC
1192011-06-07 Cary Coutant <ccoutant@google.com>
120
121 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
122 instead of emit_copy_reloc.
123 (Copy_relocs::emit_copy_reloc): Refactor.
124 (Copy_relocs::make_copy_reloc): New function.
125 (Copy_relocs::add_copy_reloc): Remove.
126 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
127 section.
128 (Copy_relocs::make_copy_reloc): New function.
129 (Copy_relocs::add_copy_reloc): Remove.
130 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
131 unchanged input files.
132 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
133 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
134 Reserve BSS space for COPY relocations.
135 (Sized_incremental_binary::do_emit_copy_relocs): New function.
136 (Output_section_incremental_inputs::write_info_blocks): Record
137 whether a symbol is copied from a shared object.
138 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
139 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
140 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
141 (Incremental_input_entry_reader::get_output_symbol_index): Add
142 is_copy parameter.
143 (Incremental_binary::emit_copy_relocs): New function.
144 (Incremental_binary::do_emit_copy_relocs): New function.
145 (Sized_incremental_binary::Sized_incremental_binary): Initialize
146 new data member.
147 (Sized_incremental_binary::add_copy_reloc): New function.
148 (Sized_incremental_binary::do_emit_copy_relocs): New function.
149 (Sized_incremental_binary::Copy_reloc): New struct.
150 (Sized_incremental_binary::Copy_relocs): New typedef.
151 (Sized_incremental_binary::copy_relocs_): New data member.
152 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
153 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
154 * target.h (Sized_target::emit_copy_reloc): New function.
155 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
156
7cdb37d9
CC
1572011-06-02 Cary Coutant <ccoutant@google.com>
158
159 PR gold/12163
160 * gold/archive.cc (Archive::Archive): Initialize new data member.
161 (Archive::include_all_members): Return if archive has already been
162 included.
163 * gold/archive.h (Archive::include_all_members_): New data member.
164
cc643b88
NC
1652011-06-02 Nick Clifton <nickc@redhat.com>
166
167 * dynobj.h: Fix spelling mistake in comment.
168 * output.cc: Likewise.
169
f62a3ca7
DK
1702011-05-31 Doug Kwan <dougkwan@google.com>
171 Asier Llano
172
173 PR gold/12826
cc643b88 174 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
175 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
176 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
177 redundant arm_exidx_test.so.
178 * testsuite/Makefile.in: Regenerate.
179 (check_SCRIPTS): Add pr12826.sh
180 (check_DATA): Add pr12826.stdout
181 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
182 * testsuite/pr12826.sh: New file.
183 * testsuite/pr12826_1.s: Ditto.
184 * testsuite/pr12826_1.s: Ditto.
185
8dbe1edc
ILT
1862011-05-30 Ian Lance Taylor <iant@google.com>
187
188 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
189 sections.
190
c49875be
ILT
1912011-05-29 Ian Lance Taylor <iant@google.com>
192
193 PR gold/12804
194 * testsuite/Makefile.am: Use different file name for two_file_test
195 temporary file for each incremental test.
196 * testsuite/Makefile.in: Rebuild.
197
69d53f7a
ILT
1982011-05-29 Ian Lance Taylor <iant@google.com>
199
200 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
201 binary input file is empty.
202
41d0ab5f
ILT
2032011-05-27 Ian Lance Taylor <iant@google.com>
204
205 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
206 (ver_test_9.so): Likewise.
207 * testsuite/Makefile.in: Rebuild.
208
89d8a36b
CC
2092011-05-26 Cary Coutant <ccoutant@google.com>
210
211 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
212 * incremental.cc (Incremental_inputs::report_input_section): Fix
213 comment, indentation.
214 (Incremental_inputs::report_comdat_group): New function.
215 (Output_section_incremental_inputs::set_final_data_size): Adjust size
216 of data for incremental input file entry.
217 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
218 group count, COMDAT group signatures.
219 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
220 an unchanged input file.
221 * incremental.h (Incremental_object_entry::Incremental_object_entry):
222 Initialize new data member.
223 (Incremental_object_entry::add_comdat_group): New function.
224 (Incremental_object_entry::get_comdat_group_count): New function.
225 (Incremental_object_entry::get_comdat_signature_key): New function.
226 (Incremental_object_entry::groups_): New data member.
227 (Incremental_inputs::report_comdat_group): New function.
228 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
229 data for incremental input file entry.
230 (Incremental_input_entry_reader::get_comdat_group_count): New function.
231 (Incremental_input_entry_reader::get_input_section): Adjust size of
232 data for incremental input file entry.
233 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
234 (Incremental_input_entry_reader::get_comdat_group_signature): New
235 function.
236 * object.cc (Sized_relobj::include_section_group): Report kept
237 COMDAT groups for incremental links.
238
1706a06f
ILT
2392011-05-24 David Meyer <pdox@google.com>
240
241 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
242 with name parameter. Add found_name parameter.
243 * fileread.cc (Input_file::find_file): Adjust code accordingly.
244 * dirsearch.h (class Dirsearch): Update declaration.
245
a10ae760
ILT
2462011-05-24 Ian Lance Taylor <iant@google.com>
247
248 * archive.cc (Library_base::should_include_member): Pull in object
249 from archive if it defines the entry symbol.
250 * parameters.cc (Parameters::entry): New function.
251 * parameters.h (class Parameters): Declare entry.
252 * output.h (class Output_file_header): Remove entry_ field.
253 * output.cc (Output_file_header::Output_file_header): Remove entry
254 parameter. Change all callers.
255 (Output_file_header::entry): Use parameters->entry.
256 * gold.cc (queue_middle_tasks): Likewise.
257 * plugin.cc (Plugin_hook::run): Likewise.
258
aa92d6ed
CC
2592011-05-24 Cary Coutant <ccoutant@google.com>
260
261 * gold.cc (queue_initial_tasks): Pass incremental base filename
262 to Output_file::open_base_file; don't print error message.
263 * incremental-dump.cc (main): Adjust call to
264 Output_file::open_for_modification.
265 * incremental-dump.cc (main): Likewise.
266 * incremental.cc (Incremental_inputs::report_command_line):
267 Ignore --incremental-base option when comparing command lines.
268 Ignore parameter when given as separate argument.
269 * options.h (class General_options): Add --incremental-base.
270 * output.cc (Output_file::Output_file):
271 (Output_file::open_base_file): Add base_name and writable parameters;
272 read base file into new file; print error message here.
273 (Output_file::map_no_anonymous): Add writable parameter; adjust all
274 callers.
275 * output.h (Output_file::open_for_modification): Rename to...
276 (Output_file::open_base_file): ...this; add base_name and
277 writable parameters; adjust all callers.
278 (Output_file::map_no_anonymous): Add writable parameter; adjust all
279 callers.
280 * testsuite/Makefile.am (incremental_test_4): Test
281 --incremental-base.
282 * testsuite/Makefile.in: Regenerate.
283
2eedd706
CC
2842011-05-24 Cary Coutant <ccoutant@google.com>
285
286 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
287 incremental_test_4.
288 * testsuite/Makefile.in: Regenerate.
289 * testsuite/two_file_test_1_v1.cc: New test source file.
290 * testsuite/two_file_test_1b_v1.cc: New test source file.
291 * testsuite/two_file_test_2_v1.cc: New test source file.
292
0f1c85a6
CC
2932011-05-24 Cary Coutant <ccoutant@google.com>
294
295 * dynobj.h (Dynobj::do_dynobj): New function.
296 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
297 flag and soname for shared objects.
298 * incremental.cc (Incremental_inputs::report_object): Make
299 either Incremental_object_entry or Incremental_dynobj_entry; add
300 soname to string table.
301 (Incremental_inputs::report_input_section): Add assertion.
302 (Output_section_incremental_inputs::set_final_data_size): Adjust
303 type of input file entry for shared libraries; adjust size of
304 shared library info entry.
305 (Output_section_incremental_inputs::write_input_files): Write
306 as_needed flag for shared libraries.
307 (Output_section_incremental_inputs::write_info_blocks): Adjust type
308 of input file entry for shared libraries; write soname.
309 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
310 soname from incremental info.
311 * incremental.h (enum Incremental_input_flags): Add
312 INCREMENTAL_INPUT_AS_NEEDED.
313 (Incremental_input_entry::Incremental_input_entry): Initialize new
314 data member.
315 (Incremental_input_entry::set_as_needed): New function.
316 (Incremental_input_entry::as_needed): New function.
317 (Incremental_input_entry::do_dynobj_entry): New function.
318 (Incremental_input_entry::as_needed_): New data member.
319 (Incremental_object_entry::Incremental_object_entry): Don't check
320 for shared library.
321 (Incremental_object_entry::do_type): Likewise.
322 (class Incremental_dynobj_entry): New class.
323 (Incremental_input_entry_reader::as_needed): New function.
324 (Incremental_input_entry_reader::get_soname): New function.
325 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
326 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
327 size of shared library info entry.
328 * layout.cc (Layout::finish_dynamic_section): Don't test for
329 incremental link when adding DT_NEEDED entries.
330 * object.h (Object::Object): Initialize new data member.
331 (Object::dynobj): New function.
332 (Object::set_as_needed): New function.
333 (Object::as_needed): New function.
334 (Object::do_dynobj): New function.
335 (Object::as_needed_): New data member.
336
6fa2a40b
CC
3372011-05-24 Cary Coutant <ccoutant@google.com>
338
339 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
340 info; adjust display of GOT entries.
341 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
342 vector of input objects; remove file_status_.
343 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
344 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
345 got_plt reader; call target hooks to reserve GOT entries.
346 (Output_section_incremental_inputs::set_final_data_size): Adjust size
347 of input file info header and GOT info entry.
348 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
349 relocation info.
350 (Got_plt_view_info::got_descriptor): Remove.
351 (Got_plt_view_info::sym_index): New data member.
352 (Got_plt_view_info::input_index): New data member.
353 (Local_got_offset_visitor::visit): Write input file index.
354 (Global_got_offset_visitor::visit): Write 0 for input file index.
355 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
356 with sym_index and input_index.
357 (Output_section_incremental_inputs::write_got_plt): Adjust size of
358 incremental info GOT entry; replace got_descriptor with input_index.
359 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
360 map from input file index to object.
361 (Sized_relobj_incr::do_layout): Replace direct data member reference
362 with accessor function.
363 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
364 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
365 Adjust size of input file info header.
366 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
367 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
368 (Incremental_input_entry_reader::get_input_section): Adjust size of
369 input file info header.
370 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
371 of incremental info GOT entry.
372 (Incremental_got_plt_reader::get_got_desc): Remove.
373 (Incremental_got_plt_reader::get_got_symndx): New function.
374 (Incremental_got_plt_reader::get_got_input_index): New function.
375 (Sized_incremental_binary::Sized_incremental_binary): Remove
376 file_status_; add input_objects_.
377 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
378 (Sized_incremental_binary::set_file_is_unchanged): Remove.
379 (Sized_incremental_binary::file_is_unchanged): Remove.
380 (Sized_incremental_binary::set_input_object): New function.
381 (Sized_incremental_binary::input_object): New function.
382 (Sized_incremental_binary::file_status_): Remove.
383 (Sized_incremental_binary::input_objects_): New data member.
384 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
385 references.
386 (Sized_relobj_incr::invalid_address): Move to base class.
387 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
388 class.
389 (Sized_relobj_incr::do_output_section_offset): Likewise.
390 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
391 (Sized_relobj_incr::section_offsets_): Likewise.
392 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
393 function.
394 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
395 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
396 with accessor function.
397 (Sized_relobj_file::do_layout): Likewise.
398 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
399 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
400 (Sized_relobj_file::compute_final_local_value): Replace refs to
401 section_offsets_ with accessor function.
402 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
403 * object.h (Relobj::Relobj): Initialize new data members.
404 (Relobj::add_dyn_reloc): New function.
405 (Relobj::first_dyn_reloc): New function.
406 (Relobj::dyn_reloc_count): New function.
407 (Relobj::first_dyn_reloc_): New data member.
408 (Relobj::dyn_reloc_count_): New data member.
409 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
410 references.
411 (Sized_relobj::Address): New typedef.
412 (Sized_relobj::invalid_address): Move here from child class.
413 (Sized_relobj::Sized_relobj): Initialize new data members.
414 (Sized_relobj::sized_relobj): New function.
415 (Sized_relobj::is_output_section_offset_invalid): Move here from
416 child class.
417 (Sized_relobj::get_output_section_offset): Likewise.
418 (Sized_relobj::local_has_got_offset): Likewise.
419 (Sized_relobj::local_got_offset): Likewise.
420 (Sized_relobj::set_local_got_offset): Likewise.
421 (Sized_relobj::do_for_all_local_got_entries): Likewise.
422 (Sized_relobj::clear_got_offsets): New function.
423 (Sized_relobj::section_offsets): Move here from child class.
424 (Sized_relobj::do_output_section_offset): Likewise.
425 (Sized_relobj::do_set_section_offset): Likewise.
426 (Sized_relobj::Local_got_offsets): Likewise.
427 (Sized_relobj::local_got_offsets_): Likewise.
428 (Sized_relobj::section_offsets_): Likewise.
429 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
430 references.
431 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
432 class.
433 (Sized_relobj_file::sized_relobj): New function
434 (Sized_relobj_file::local_has_got_offset): Move to base class.
435 (Sized_relobj_file::local_got_offset): Likewise.
436 (Sized_relobj_file::set_local_got_offset): Likewise.
437 (Sized_relobj_file::get_output_section_offset): Likewise.
438 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
439 (Sized_relobj_file::do_output_section_offset): Likewise.
440 (Sized_relobj_file::do_set_section_offset): Likewise.
441 (Sized_relobj_file::Local_got_offsets): Likewise.
442 (Sized_relobj_file::local_got_offsets_): Likewise.
443 (Sized_relobj_file::section_offsets_): Likewise.
444 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
445 (all constructors).
446 (set_needs_dynsym_index): Convert relobj to derived class pointer.
447 (Output_reloc::get_symbol_index): Likewise.
448 (Output_reloc::local_section_offset): Likewise.
449 (Output_reloc::get_address): Likewise.
450 (Output_reloc::symbol_value): Likewise.
451 (Output_data_got::reserve_slot): Move to class definition.
452 (Output_data_got::reserve_local): New function.
453 (Output_data_got::reserve_slot_for_global): Remove.
454 (Output_data_got::reserve_global): New function.
455 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
456 (all constructors, two instantiations).
457 (Output_reloc::get_relobj): New function (two instantiations).
458 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
459 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
460 (Output_data_reloc::add_global): Adjust type of relobj.
461 (Output_data_reloc::add_global_relative): Likewise.
462 (Output_data_reloc::add_symbolless_global_addend): Likewise.
463 (Output_data_reloc::add_local): Likewise.
464 (Output_data_reloc::add_local_relative): Likewise.
465 (Output_data_reloc::add_symbolless_local_addend): Likewise.
466 (Output_data_reloc::add_local_section): Likewise.
467 (Output_data_reloc::add_output_section): Likewise.
468 (Output_data_reloc::add_absolute): Likewise.
469 (Output_data_reloc::add_target_specific): Likewise.
470 (Output_data_got::reserve_slot): Move definition here.
471 (Output_data_got::reserve_local): New function.
472 (Output_data_got::reserve_global): New function.
473 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
474 section_offsets_ with accessor function.
475 (Sized_relobj_file::write_sections): Likewise.
476 (Sized_relobj_file::do_relocate_sections): Likewise.
477 * target.h (Sized_target::reserve_local_got_entry): New function.
478 (Sized_target::reserve_global_got_entry): New function.
479 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
480 (Target_x86_64::reserve_global_got_entry): New function.
481 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
482
4829d394
CC
4832011-05-23 Cary Coutant <ccoutant@google.com>
484
485 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
486 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
487 bit when checking got_type.
488 * incremental.cc (Sized_incremental_binary::setup_readers):
489 Store symbol table and string table locations; initialize bit vector
490 of file status flags.
491 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
492 unchanged files.
493 (Sized_incremental_binary::do_process_got_plt): New function.
494 (Sized_incremental_binary::get_symtab_view): Use stored locations.
495 (Output_section_incremental_inputs::set_final_data_size): Record
496 file index for each input file.
497 (Output_section_incremental_inputs::write_got_plt): Store file index
498 instead of input entry offset for each GOT entry.
499 * incremental.h
500 (Incremental_input_entry::Incremental_input_entry): Initialize new
501 data member.
502 (Incremental_input_entry::set_offset): Store file index.
503 (Incremental_input_entry::get_file_index): New function.
504 (Incremental_input_entry::file_index_): New data member.
505 (Incremental_binary::process_got_plt): New function.
506 (Incremental_binary::do_process_got_plt): New function.
507 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
508 data members.
509 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
510 (Sized_incremental_binary::set_file_is_unchanged): New function.
511 (Sized_incremental_binary::file_is_unchanged): New function.
512 (Sized_incremental_binary::do_process_got_plt): New function.
513 (Sized_incremental_binary::file_status_): New data member.
514 (Sized_incremental_binary::main_symtab_loc_): New data member.
515 (Sized_incremental_binary::main_strtab_loc_): New data member.
516 * output.cc (Output_data_got::Got_entry::write): Add case
517 RESERVED_CODE.
518 (Output_data_got::add_global): Call add_got_entry.
519 (Output_data_got::add_global_plt): Likewise.
520 (Output_data_got::add_global_with_rel): Likewise.
521 (Output_data_got::add_global_with_rela): Likewise.
522 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
523 (Output_data_got::add_global_pair_with_rela): Likewise.
524 (Output_data_got::add_local): Call add_got_entry.
525 (Output_data_got::add_local_plt): Likewise.
526 (Output_data_got::add_local_with_rel): Likewise.
527 (Output_data_got::add_local_with_rela): Likewise.
528 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
529 (Output_data_got::add_local_pair_with_rela): Likewise.
530 (Output_data_got::reserve_slot): New function.
531 (Output_data_got::reserve_slot_for_global): New function.
532 (Output_data_got::add_got_entry): New function.
533 (Output_data_got::add_got_entry_pair): New function.
534 (Output_section::add_output_section_data): Edit FIXME.
535 * output.h
536 (Output_section_data_build::Output_section_data_build): New
537 constructor with size parameter.
538 (Output_data_space::Output_data_space): Likewise.
539 (Output_data_got::Output_data_got): Initialize new data member; new
540 constructor with size parameter.
541 (Output_data_got::add_constant): Call add_got_entry.
542 (Output_data_got::reserve_slot): New function.
543 (Output_data_got::reserve_slot_for_global): New function.
544 (class Output_data_got::Got_entry): Add RESERVED_CODE.
545 (Output_data_got::add_got_entry): New function.
546 (Output_data_got::add_got_entry_pair): New function.
547 (Output_data_got::free_list_): New data member.
548 * target.h (Sized_target::init_got_plt_for_update): New function.
549 (Sized_target::register_global_plt_entry): New function.
550 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
551 Initialize new data member; call init; add constructor with PLT count.
552 (Output_data_plt_x86_64::init): New function.
553 (Output_data_plt_x86_64::add_relocation): New function.
554 (Output_data_plt_x86_64::reserve_slot): New function.
555 (Output_data_plt_x86_64::free_list_): New data member.
556 (Target_x86_64::init_got_plt_for_update): New function.
557 (Target_x86_64::register_global_plt_entry): New function.
558 (Output_data_plt_x86_64::add_entry): Allocate from free list for
559 incremental updates.
560 (Output_data_plt_x86_64::add_relocation): New function.
561 * testsuite/object_unittest.cc (Object_test): Set default options.
562
ec69d6da
ILT
5632011-05-16 Ian Lance Taylor <iant@google.com>
564
565 * options.h (class General_options): Make -i a synonym for -r.
566
732e31de
ILT
5672011-05-16 Ian Lance Taylor <iant@google.com>
568
569 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
570
403676b5
CC
5712011-05-10 Cary Coutant <ccoutant@google.com>
572
573 * object.cc (Sized_relobj::do_count_local_symbols): Check for
574 strip_all (-s).
575
5b7b7d6e
ILT
5762011-05-06 Ian Lance Taylor <iant@google.com>
577
578 * layout.cc (Layout::layout): If the output section flags change,
579 update the ordering.
580
f0f9babf
CC
5812011-04-25 Cary Coutant <ccoutant@google.com>
582
583 * incremental-dump.cc (dump_incremental_inputs): Print local
584 symbol info for each input file.
585 * incremental.cc
586 (Output_section_incremental_inputs::set_final_data_size): Add local
587 symbol info to input file entries in incremental info.
588 (Output_section_incremental_inputs::write_info_blocks): Likewise.
589 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
590 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
591 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
592 implementation.
593 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
594 (Sized_incr_relobj::do_relocate): Write the local symbols.
595 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
596 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
597 Adjust size of input file header.
598 (Incremental_inputs_reader::get_local_symbol_offset): New function.
599 (Incremental_inputs_reader::get_local_symbol_count): New function.
600 (Incremental_inputs_reader::get_input_section): Adjust size of input
601 file header.
602 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
603 (Sized_incr_relobj::This): New typedef.
604 (Sized_incr_relobj::sym_size): New const data member.
605 (Sized_incr_relobj::Local_symbol): New struct.
606 (Sized_incr_relobj::do_output_local_symbol_count): New function.
607 (Sized_incr_relobj::do_local_symbol_offset): New function.
608 (Sized_incr_relobj::local_symbol_count_): New data member.
609 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
610 (Sized_incr_relobj::local_symbol_index_): New data member.
611 (Sized_incr_relobj::local_symbol_offset_): New data member.
612 (Sized_incr_relobj::local_dynsym_offset_): New data member.
613 (Sized_incr_relobj::local_symbols_): New data member.
614 * object.h (Relobj::output_local_symbol_count): New function.
615 (Relobj::local_symbol_offset): New function.
616 (Relobj::do_output_local_symbol_count): New function.
617 (Relobj::do_local_symbol_offset): New function.
618 (Sized_relobj::do_output_local_symbol_count): New function.
619 (Sized_relobj::do_local_symbol_offset): New function.
620
d0a9ace3
ILT
6212011-04-22 Vladimir Simonov <sv@sw.ru>
622
623 * descriptors.cc (set_close_on_exec): New function.
624 (Descriptors::open): Use set_close_on_exec.
625 * output.cc (S_ISLNK): Define if not defined.
626
94a3fc8b
CC
6272011-04-22 Cary Coutant <ccoutant@google.com>
628
629 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
630 global symbol map.
631 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
632 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
633 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
634 relocations.
635 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
636 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
637 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
638 * incremental.h
639 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
640 function.
641 (Incremental_binary::apply_incremental_relocs): New function.
642 (Incremental_binary::do_apply_incremental_relocs): New function.
643 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
644 data member.
645 (Sized_incremental_binary::add_global_symbol): New function.
646 (Sized_incremental_binary::global_symbol): New function.
647 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
648 (Sized_incremental_binary::symbol_map_): New data member.
649 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
650 * target.h (Sized_target::apply_relocation): New function.
651 * target-reloc.h (apply_relocation): New function.
652 * x86_64.cc (Target_x86_64::apply_relocation): New function.
653
c87e4302
DK
6542011-04-22 Doug Kwan <dougkwan@google.com>
655
656 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
657 flag of a SHT_ARM_EXIDX section.
658 * testsuite/Makefile.am (arm_exidx_test): New test rules.
659 * testsuite/Makefile.in: Regenerate.
660 * testsuite/arm_exidx_test.s: New file.
661 * testsuite/arm_exidx_test.sh: Same.
662
e7782cf6
CC
6632011-04-20 Cary Coutant <ccoutant@google.com>
664
665 PR gold/12689
666 * archive.h (Incremental_archive_entry::Archive_member):
667 Initialize arg_serial_ (second constructor).
668
308ecdc7
ILT
6692011-04-17 Ian Lance Taylor <iant@google.com>
670
671 * object.cc (Relocate_info::location): Simplify location string.
672 * errors.cc (Errors::error_at_location): Don't print program
673 name.
674 (Errors::warning_at_location): Likewise.
675 (Errors::undefined_symbol): Likewise.
676 * testsuite/debug_msg.sh: Update accordingly.
677
bec5b579
CC
6782011-04-14 Cary Coutant <ccoutant@google.com>
679
680 * gold/layout.cc (Layout::symtab_section_offset): New function.
681 * gold/layout.h (Layout::symtab_section_offset): New function.
682 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
683
88597d34
ILT
6842011-04-12 Ian Lance Taylor <iant@google.com>
685
686 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
687 with MREMAP_MAYMOVE.
688 * output.h (class Output_file): Add map_is_allocated_ field.
689 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
690 not available, provide stubs. If mremap is not available, #define
691 it to gold_mremap.
692 (MREMAP_MAYMOVE): Define if not defined.
693 (Output_file::Output_file): Initialize map_is_allocated_.
694 (Output_file::resize): Check map_is_allocated_.
695 (Output_file::map_anonymous): If mmap fails, use malloc.
696 (Output_file::unmap): Don't do anything for an anonymous map.
697 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
698 is not available, provide stubs.
699 (File_read::View::~View): Use free rather than delete[].
700 (File_read::make_view): Use malloc rather than new[]. If mmap
701 fails, use malloc.
702 (File_read::find_or_make_view): Use malloc rather than new[].
703 * gold.h: Remove HAVE_REMAP code.
704 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
705 exists. Rename mremap to gold_mremap. If mmap is not available
706 don't do anything.
707 * configure, config.in: Rebuild.
708
11e361bc
ILT
7092011-04-11 Ian Lance Taylor <iant@google.com>
710
711 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
712 initialize local variable v.
713
cdc29364
CC
7142011-04-11 Cary Coutant <ccoutant@google.com>
715
716 * archive.cc (Archive::include_member): Adjust call to
717 report_object.
718 (Add_archive_symbols::run): Track argument serial numbers.
719 (Lib_group::include_member): Likewise.
720 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
721 * archive.h (Incremental_archive_entry::Archive_member):
722 Initialize arg_serial_.
723 (Archive_member::arg_serial_): New data member.
724 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
725 (Sized_dynobj::do_add_symbols): Track symbols when doing an
726 incremental link.
727 (Sized_dynobj::do_for_all_local_got_entries): New function.
728 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
729 function.
730 * fileread.cc (get_mtime): New function.
731 * fileread.h (get_mtime): New function.
732 * gold.cc (queue_initial_tasks): Check for incremental update.
733 (process_incremental_input): New function.
734 (queue_middle_tasks): Don't force valid target for incremental
735 update.
736 * incremental-dump.cc (find_input_containing_global): Adjust
737 size of symbol info entry.
738 (dump_incremental_inputs): Dump argument serial number and
739 in_system_directory flag; bias shndx by 1; print symbol names
740 when dumping per-file symbol lists; use new symbol info readers.
741 * incremental.cc
742 (Output_section_incremental_inputs:update_data_size): New function.
743 (Sized_incremental_binary::setup_readers): Setup input readers
744 for each input file; build maps for files added from libraries
745 and scripts.
746 (Sized_incremental_binary::check_input_args): New function.
747 (Sized_incremental_binary::do_check_inputs): Build map of argument
748 serial numbers to input arguments.
749 (Sized_incremental_binary::do_file_has_changed): Rename
750 do_file_is_unchanged to this; compare file modification times.
751 (Sized_incremental_binary::do_init_layout): New function.
752 (Sized_incremental_binary::do_reserve_layout): New function.
753 (Sized_incremental_binary::do_get_input_reader): Remove.
754 (Sized_incremental_binary::get_symtab_view): New function.
755 (Incremental_checker::can_incrementally_link_output_file): Remove.
756 (Incremental_inputs::report_command_line): Exclude --debug options.
757 (Incremental_inputs::report_archive_begin): Add parameter; track
758 argument serial numbers; don't put input file entry for archive
759 before archive members.
760 (Incremental_inputs::report_archive_end): Put input file entry
761 for archive after archive members.
762 (Incremental_inputs::report_object): Add parameter; track argument
763 serial numbers and in_system_directory flag.
764 (Incremental_inputs::report_script): Add parameter; track argument
765 serial numbers.
766 (Output_section_incremental_inputs::set_final_data_size): Adjust
767 size of symbol info entry; check for forwarding symbols.
768 (Output_section_incremental_inputs::write_input_files): Write
769 in_system_directory flag and argument serial number.
770 (Output_section_incremental_inputs::write_info_blocks): Map section
771 indices between incremental info and original input file; store
772 input section index for each symbol.
773 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
774 change operator() to visit().
775 (class Global_got_offset_visitor): Likewise.
776 (class Global_symbol_visitor_got_plt):
777 (Output_section_incremental_inputs::write_got_plt): Use new visitor
778 classes.
779 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
780 (Sized_incr_relobj::do_read_symbols): New function.
781 (Sized_incr_relobj::do_layout): New function.
782 (Sized_incr_relobj::do_layout_deferred_sections): New function.
783 (Sized_incr_relobj::do_add_symbols): New function.
784 (Sized_incr_relobj::do_should_include_member): New function.
785 (Sized_incr_relobj::do_for_all_global_symbols): New function.
786 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
787 (Sized_incr_relobj::do_section_size): New function.
788 (Sized_incr_relobj::do_section_name): New function.
789 (Sized_incr_relobj::do_section_contents): New function.
790 (Sized_incr_relobj::do_section_flags): New function.
791 (Sized_incr_relobj::do_section_entsize): New function.
792 (Sized_incr_relobj::do_section_address): New function.
793 (Sized_incr_relobj::do_section_type): New function.
794 (Sized_incr_relobj::do_section_link): New function.
795 (Sized_incr_relobj::do_section_info): New function.
796 (Sized_incr_relobj::do_section_addralign): New function.
797 (Sized_incr_relobj::do_initialize_xindex): New function.
798 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
799 (Sized_incr_relobj::do_read_relocs): New function.
800 (Sized_incr_relobj::do_gc_process_relocs): New function.
801 (Sized_incr_relobj::do_scan_relocs): New function.
802 (Sized_incr_relobj::do_count_local_symbols): New function.
803 (Sized_incr_relobj::do_finalize_local_symbols): New function.
804 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
805 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
806 (Sized_incr_relobj::do_relocate): New function.
807 (Sized_incr_relobj::do_set_section_offset): New function.
808 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
809 (Sized_incr_dynobj::do_read_symbols): New function.
810 (Sized_incr_dynobj::do_layout): New function.
811 (Sized_incr_dynobj::do_add_symbols): New function.
812 (Sized_incr_dynobj::do_should_include_member): New function.
813 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
814 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
815 (Sized_incr_dynobj::do_section_size): New function.
816 (Sized_incr_dynobj::do_section_name): New function.
817 (Sized_incr_dynobj::do_section_contents): New function.
818 (Sized_incr_dynobj::do_section_flags): New function.
819 (Sized_incr_dynobj::do_section_entsize): New function.
820 (Sized_incr_dynobj::do_section_address): New function.
821 (Sized_incr_dynobj::do_section_type): New function.
822 (Sized_incr_dynobj::do_section_link): New function.
823 (Sized_incr_dynobj::do_section_info): New function.
824 (Sized_incr_dynobj::do_section_addralign): New function.
825 (Sized_incr_dynobj::do_initialize_xindex): New function.
826 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
827 (make_sized_incremental_object): New function.
828 (Incremental_library::copy_unused_symbols): New function.
829 (Incremental_library::do_for_all_unused_symbols): New function.
830 * incremental.h (enum Incremental_input_flags): New type.
831 (class Incremental_checker): Remove.
832 (Incremental_input_entry::Incremental_input_entry): Add argument
833 serial number.
834 (Incremental_input_entry::arg_serial): New function.
835 (Incremental_input_entry::set_is_in_system_directory): New function.
836 (Incremental_input_entry::is_in_system_directory): New function.
837 (Incremental_input_entry::arg_serial_): New data member.
838 (Incremental_input_entry::is_in_system_directory_): New data member.
839 (class Script_info): Move here from script.h.
840 (Script_info::Script_info): Add filename parameter.
841 (Script_info::filename): New function.
842 (Script_info::filename_): New data member.
843 (Incremental_script_entry::Incremental_script_entry): Add argument
844 serial number.
845 (Incremental_object_entry::Incremental_object_entry): Likewise.
846 (Incremental_object_entry::add_input_section): Build list of input
847 sections with map to original shndx.
848 (Incremental_object_entry::get_input_section_index): New function.
849 (Incremental_object_entry::shndx_): New data member.
850 (Incremental_object_entry::name_key_): Rename; adjust all refs.
851 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
852 (Incremental_archive_entry::Incremental_archive_entry): Add argument
853 serial number.
854 (Incremental_inputs::report_archive_begin): Likewise.
855 (Incremental_inputs::report_object): Likewise.
856 (Incremental_inputs::report_script): Likewise.
857 (class Incremental_global_symbol_reader): New class.
858 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
859 and store flags and input file type.
860 (Incremental_input_entry_reader::arg_serial): New function.
861 (Incremental_input_entry_reader::type): Extract type from flags.
862 (Incremental_input_entry_reader::is_in_system_directory): New function.
863 (Incremental_input_entry_reader::get_input_section_count): Call
864 accessor function for type.
865 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
866 function for type; adjust size of global symbol entry.
867 (Incremental_input_entry_reader::get_global_symbol_count): Call
868 accessor function for type.
869 (Incremental_input_entry_reader::get_object_count): Likewise.
870 (Incremental_input_entry_reader::get_object_offset): Likewise.
871 (Incremental_input_entry_reader::get_member_count): Likewise.
872 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
873 (Incremental_input_entry_reader::get_member_offset): Likewise.
874 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
875 (Incremental_input_entry_reader::Global_symbol_info): Remove.
876 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
877 (Incremental_input_entry_reader::get_global_symbol_reader): New
878 function.
879 (Incremental_input_entry_reader::get_output_symbol_index): New
880 function.
881 (Incremental_input_entry_reader::type_): Remove.
882 (Incremental_input_entry_reader::flags_): New data member.
883 (Incremental_inputs_reader::input_file_offset): New function.
884 (Incremental_inputs_reader::input_file_index): New function.
885 (Incremental_inputs_reader::input_file): Call input_file_offset.
886 (Incremental_inputs_reader::input_file_at_offset): New function.
887 (Incremental_relocs_reader::get_r_type): Reformat.
888 (Incremental_relocs_reader::get_r_shndx): Reformat.
889 (Incremental_relocs_reader::get_r_offset): Reformat.
890 (Incremental_relocs_reader::data): New function.
891 (Incremental_binary::Incremental_binary): Initialize new data members.
892 (Incremental_binary::check_inputs): Add cmdline parameter.
893 (Incremental_binary::file_is_unchanged): Remove.
894 (Input_reader::arg_serial): New function.
895 (Input_reader::get_unused_symbol_count): New function.
896 (Input_reader::get_unused_symbol): New function.
897 (Input_reader::do_arg_serial): New function.
898 (Input_reader::do_get_unused_symbol_count): New function.
899 (Input_reader::do_get_unused_symbol): New function.
900 (Incremental_binary::input_file_count): New function.
901 (Incremental_binary::get_input_reader): Change signature to use
902 index instead of filename.
903 (Incremental_binary::file_has_changed): New function.
904 (Incremental_binary::get_input_argument): New function.
905 (Incremental_binary::get_library): New function.
906 (Incremental_binary::get_script_info): New function.
907 (Incremental_binary::init_layout): New function.
908 (Incremental_binary::reserve_layout): New function.
909 (Incremental_binary::output_file): New function.
910 (Incremental_binary::do_check_inputs): New function.
911 (Incremental_binary::do_file_is_unchanged): Remove.
912 (Incremental_binary::do_file_has_changed): New function.
913 (Incremental_binary::do_init_layout): New function.
914 (Incremental_binary::do_reserve_layout): New function.
915 (Incremental_binary::do_input_file_count): New function.
916 (Incremental_binary::do_get_input_reader): Change signature.
917 (Incremental_binary::input_args_map_): New data member.
918 (Incremental_binary::library_map_): New data member.
919 (Incremental_binary::script_map_): New data member.
920 (Sized_incremental_binary::Sized_incremental_binary): Initialize
921 new data members.
922 (Sized_incremental_binary::output_section): New function.
923 (Sized_incremental_binary::inputs_reader): Add const.
924 (Sized_incremental_binary::symtab_reader): Add const.
925 (Sized_incremental_binary::relocs_reader): Add const.
926 (Sized_incremental_binary::got_plt_reader): Add const.
927 (Sized_incremental_binary::get_symtab_view): New function.
928 (Sized_incremental_binary::Inputs_reader): New typedef.
929 (Sized_incremental_binary::Input_entry_reader): New typedef.
930 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
931 (Sized_incremental_binary::do_file_is_unchanged): Remove.
932 (Sized_incremental_binary::do_file_has_changed): New function.
933 (Sized_incremental_binary::do_init_layout): New function.
934 (Sized_incremental_binary::do_reserve_layout): New function.
935 (Sized_input_reader::Inputs_reader): Remove.
936 (Sized_input_reader::Input_entry_reader): Remove.
937 (Sized_input_reader::do_arg_serial): New function.
938 (Sized_input_reader::do_get_unused_symbol_count): New function.
939 (Sized_input_reader::do_get_unused_symbol): New function.
940 (Sized_incremental_binary::do_input_file_count): New function.
941 (Sized_incremental_binary::do_get_input_reader): Change signature;
942 use index instead of filename.
943 (Sized_incremental_binary::section_map_): New data member.
944 (Sized_incremental_binary::input_entry_readers_): New data member.
945 (class Sized_incr_relobj): New class.
946 (class Sized_incr_dynobj): New class.
947 (make_sized_incremental_object): New function.
948 (class Incremental_library): New class.
949 * layout.cc (Free_list::num_lists): New static data member.
950 (Free_list::num_nodes): New static data member.
951 (Free_list::num_removes): New static data member.
952 (Free_list::num_remove_visits): New static data member.
953 (Free_list::num_allocates): New static data member.
954 (Free_list::num_allocate_visits): New static data member.
955 (Free_list::init): New function.
956 (Free_list::remove): New function.
957 (Free_list::allocate): New function.
958 (Free_list::dump): New function.
959 (Free_list::print_stats): New function.
960 (Layout_task_runner::run): Resize output file for incremental updates.
961 (Layout::Layout): Initialize new data members.
962 (Layout::set_incremental_base): New function.
963 (Layout::init_fixed_output_section): New function.
964 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
965 incremental updates.
966 (Layout::create_gold_note): Do not create gold note section for
967 incremental updates.
968 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
969 for incremental updates.
970 (Layout::set_section_offsets): For incremental updates, allocate space
971 from free list.
972 (Layout::create_symtab_sections): Layout with offsets relative to
973 start of section; for incremental updates, allocate space from free
974 list.
975 (Layout::create_shdrs): For incremental updates, allocate space from
976 free list.
977 (Layout::finish_dynamic_section): For incremental updates, do not
978 check --as-needed (fixed in subsequent patch).
979 * layout.h (class Free_list): New class.
980 (Layout::set_incremental_base): New function.
981 (Layout::incremental_base): New function.
982 (Layout::init_fixed_output_section): New function.
983 (Layout::allocate): New function.
984 (Layout::incremental_base_): New data member.
985 (Layout::free_list_): New data member.
986 * main.cc (main): Print Free_list statistics.
987 * object.cc (Relobj::finalize_incremental_relocs): Add
988 clear_counts parameter; clear counts only when clear_counts is set.
989 (Sized_relobj::Sized_relobj): Initialize new base class.
990 (Sized_relobj::do_layout): Don't report special sections.
991 (Sized_relobj::do_for_all_local_got_entries): New function.
992 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
993 symtab_off to all symbol table offsets.
994 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
995 * object.h (class Got_offset_list): Move to top of file.
996 (Object::Object): Allow case where input_file == NULL.
997 (Object::~Object): Likewise.
998 (Object::input_file): Assert that input_file != NULL.
999 (Object::lock): Allow case where input_file == NULL.
1000 (Object::unlock): Likewise.
1001 (Object::is_locked): Likewise.
1002 (Object::token): Likewise.
1003 (Object::release): Likewise.
1004 (Object::is_incremental): New function.
1005 (Object::get_mtime): New function.
1006 (Object::for_all_local_got_entries): New function.
1007 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1008 (Object::set_is_in_system_directory): New function.
1009 (Object::is_in_system_directory): New function.
1010 (Object::do_is_incremental): New function.
1011 (Object::do_get_mtime): New function.
1012 (Object::do_for_all_local_got_entries): New function.
1013 (Object::is_in_system_directory_): New data member.
1014 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1015 (class Sized_relobj_base): New class.
1016 (class Sized_relobj): Derive from Sized_relobj_base.
1017 (class Sized_relobj::Symbols): Redeclare from base class.
1018 (class Sized_relobj::local_got_offset_list): Remove.
1019 (class Sized_relobj::Output_sections): Redeclare from base class.
1020 (class Sized_relobj::do_for_all_local_got_entries): New function.
1021 (class Sized_relobj::write_local_symbols): Add offset parameter.
1022 (class Sized_relobj::local_symbol_offset_): Update comment.
1023 (class Sized_relobj::local_dynsym_offset_): Update comment.
1024 * options.cc (Input_arguments::add_file): Remove const.
1025 * options.h (Input_file_argument::Input_file_argument):
1026 Initialize arg_serial_ (all constructors).
1027 (Input_file_argument::set_arg_serial): New function.
1028 (Input_file_argument::arg_serial): New function.
1029 (Input_file_argument::arg_serial_): New data member.
1030 (Input_arguments::Input_arguments): Initialize file_count_.
1031 (Input_arguments::add_file): Remove const.
1032 (Input_arguments::number_of_input_files): New function.
1033 (Input_arguments::file_count_): New data member.
1034 (Command_line::number_of_input_files): Call
1035 Input_arguments::number_of_input_files.
1036 * output.cc (Output_segment_headers::Output_segment_headers):
1037 Set current size.
1038 (Output_section::Input_section::current_data_size): New function.
1039 (Output_section::Output_section): Initialize new data members.
1040 (Output_section::add_input_section): Don't do merge sections for
1041 an incremental link; allocate space from free list for an
1042 incremental update.
1043 (Output_section::add_output_section_data): Allocate space from
1044 free list for an incremental update.
1045 (Output_section::update_data_size): New function.
1046 (Output_section::set_fixed_layout): New function.
1047 (Output_section::reserve): New function.
1048 (Output_segment::set_section_addresses): Remove const.
1049 (Output_segment::set_section_list_addresses): Remove const; allocate
1050 space from free list for an incremental update.
1051 (Output_segment::set_offset): Adjust size of RELRO segment for an
1052 incremental update.
1053 * output.h (Output_data::current_data_size): Move here from
1054 child classes.
1055 (Output_data::pre_finalize_data_size): New function.
1056 (Output_data::update_data_size): New function.
1057 (Output_section_headers::update_data_size): new function.
1058 (Output_section_data_build::current_data_size): Move to Output_data.
1059 (Output_data_strtab::update_data_size): New function.
1060 (Output_section::current_data_size): Move to Output_data.
1061 (Output_section::set_fixed_layout): New function.
1062 (Output_section::has_fixed_layout): New function.
1063 (Output_section::reserve): New function.
1064 (Output_section::update_data_size): New function.
1065 (Output_section::has_fixed_layout_): New data member.
1066 (Output_section::free_list_): New data member.
1067 (Output_segment::set_section_addresses): Remove const.
1068 (Output_segment::set_section_list_addresses): Remove const.
1069 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1070 New function.
1071 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1072 New function.
1073 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1074 parameter when calling Add_symbols constructor; store argument
1075 serial number for members of a lib group.
1076 (Add_symbols::locks): Allow case where token == NULL.
1077 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1078 (Read_member::~Read_member): New function.
1079 (Read_member::is_runnable): New function.
1080 (Read_member::locks): New function.
1081 (Read_member::run): New function.
1082 (Check_script::~Check_script): New function.
1083 (Check_script::is_runnable): New function.
1084 (Check_script::locks): New function.
1085 (Check_script::run): New function.
1086 (Check_library::~Check_library): New function.
1087 (Check_library::is_runnable): New function.
1088 (Check_library::locks): New function.
1089 (Check_library::run): New function.
1090 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1091 (Add_symbols::library_): New data member.
1092 (class Read_member): New class.
1093 (class Check_script): New class.
1094 (class Check_library): New class.
1095 * reloc.cc (Read_relocs::is_runnable): Allow case where
1096 token == NULL.
1097 (Read_relocs::locks): Likewise.
1098 (Scan_relocs::locks): Likewise.
1099 (Relocate_task::locks): Likewise.
1100 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1101 to clear counters.
1102 (Sized_relobj::incremental_relocs_scan): Fix comment.
1103 (Sized_relobj::do_relocate): Pass output file offset to
1104 write_local_symbols.
1105 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1106 from class declaration.
1107 * script.cc (read_input_script): Allocate Script_info; pass
1108 argument serial number to report_script.
1109 * script.h (class Script_info): Move to incremental.h.
1110 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1111 * symtab.h (Symbol_table::add_from_incrobj): New function.
1112 (Symbol_table::set_file_offset): New function.
1113
b961d0d7
CC
11142011-04-05 Cary Coutant <ccoutant@google.com>
1115
1116 * incremental-dump.cc (dump_incremental_inputs): Change signature
1117 to take a Sized_incremental_binary; change caller. Use readers
1118 in Sized_incremental_binary.
1119 * incremental.cc
1120 (Sized_incremental_binary::find_incremental_inputs_sections):
1121 Rename do_find_incremental_inputs_sections to this.
1122 (Sized_incremental_binary::setup_readers): New function.
1123 (Sized_incremental_binary::do_check_inputs): Check
1124 has_incremental_info_ flag; move setup code to setup_readers;
1125 use input readers.
1126 (Sized_incremental_binary::do_file_is_unchanged): New function.
1127 (Sized_incremental_binary::do_get_input_reader): New function.
1128 * incremental.h (class Incremental_binary): Move to end of file.
1129 (Incremental_binary::file_is_unchanged): New function.
1130 (Incremental_binary::do_file_is_unchanged): New function.
1131 (Incremental_binary::Input_reader): New class.
1132 (Incremental_binary::get_input_reader): New function.
1133 (class Sized_incremental_binary): Move to end of file.
1134 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1135 input section reader classes.
1136 (Sized_incremental_binary::has_incremental_info): New function.
1137 (Sized_incremental_binary::inputs_reader): New function.
1138 (Sized_incremental_binary::symtab_reader): New function.
1139 (Sized_incremental_binary::relocs_reader): New function.
1140 (Sized_incremental_binary::got_plt_reader): New function.
1141 (Sized_incremental_binary::do_file_is_unchanged): New function.
1142 (Sized_incremental_binary::Sized_input_reader): New class.
1143 (Sized_incremental_binary::get_input_reader): New function.
1144 (Sized_incremental_binary::find_incremental_inputs_sections):
1145 Rename do_find_incremental_inputs_sections to this.
1146 (Sized_incremental_binary::setup_readers): New function.
1147 (Sized_incremental_binary::has_incremental_info_): New data member.
1148 (Sized_incremental_binary::inputs_reader_): New data member.
1149 (Sized_incremental_binary::symtab_reader_): New data member.
1150 (Sized_incremental_binary::relocs_reader_): New data member.
1151 (Sized_incremental_binary::got_plt_reader_): New data member.
1152 (Sized_incremental_binary::current_input_file_): New data member.
1153
a869183f
PP
11542011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1155
1156 PR gold/12640
1157 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1158 violation.
1159
11602011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
1161
1162 * archive.cc (Archive::include_member): Adjust call to report_object.
1163 (Add_archive_symbols::run): Add script_info to call to
1164 report_archive_begin.
1165 (Lib_group::include_member): Adjust call to report_object.
1166 (Add_lib_group_symbols::run): Adjust call to report_object.
1167 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1168 blocks. Add object count for script input files.
1169 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1170 script_info parameter; change all callers.
1171 (Incremental_inputs::report_object): Add script_info parameter;
1172 change all callers.
1173 (Incremental_inputs::report_script): Store backpointer to
1174 incremental info entry.
1175 (Output_section_incremental_inputs::set_final_data_size): Record
1176 additional information for scripts.
1177 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1178 * incremental.h (Incremental_script_entry::add_object): New function.
1179 (Incremental_script_entry::get_object_count): New function.
1180 (Incremental_script_entry::get_object): New function.
1181 (Incremental_script_entry::objects_): New data member; adjust
1182 constructor.
1183 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1184 (Incremental_inputs::report_object): Add script_info parameter.
1185 (Incremental_inputs_reader::get_object_count): New function.
1186 (Incremental_inputs_reader::get_object_offset): New function.
1187 * options.cc (Input_arguments::add_file): Return reference to
1188 new input argument.
1189 * options.h (Input_argument::set_script_info): New function.
1190 (Input_argument::script_info): New function.
1191 (Input_argument::script_info_): New data member; adjust all
1192 constructors.
1193 (Input_file_group::add_file): Return reference to new input argument.
1194 (Input_file_lib::add_file): Likewise.
1195 (Input_arguments::add_file): Likewise.
1196 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1197 * script.cc (Parser_closure::Parser_closure): Add script_info
1198 parameter; adjust all callers.
1199 (Parser_closure::script_info): New function.
1200 (Parser_closure::script_info_): New data member.
1201 (read_input_script): Report scripts earlier to incremental info.
1202 (script_add_file): Set script_info in Input_argument.
1203 (script_add_library): Likewise.
1204 * script.h (Script_options::Script_info): Rewrite class.
1205
a869183f 12062011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
1207
1208 * archive.cc (Library_base::should_include_member): Move
1209 method here from class Archive.
1210 (Archive::Archive): Initialize base class.
1211 (Archive::should_include_member): Move to base class.
1212 (Archive::do_for_all_unused_symbols): New function.
1213 (Add_archive_symbols::run): Remove redundant access to
1214 incremental_inputs.
1215 (Lib_group::Lib_group): Initialize base class.
1216 (Lib_group::do_filename): New function.
1217 (Lib_group::include_member): Pass pointer to Lib_group to
1218 report_object.
1219 (Lib_group::do_for_all_unused_symbols): New function.
1220 (Add_lib_group_symbols::run): Report archive information for
1221 incremental links.
1222 * archive.h (class Library_base): New base class.
1223 (class Archive): Derive from Library_base.
1224 (Archive::filename): Move to base class.
1225 (Archive::set_incremental_info): Likewise.
1226 (Archive::incremental_info): Likewise.
1227 (Archive::Should_include): Likewise.
1228 (Archive::should_include_member): Likewise.
1229 (Archive::Armap_entry): Remove.
1230 (Archive::Unused_symbol_iterator): Remove.
1231 (Archive::unused_symbols_begin): Remove.
1232 (Archive::unused_symbols_end): Remove.
1233 (Archive::do_filename): New function.
1234 (Archive::do_get_mtime): New function.
1235 (Archive::do_for_all_unused_symbols): New function.
1236 (Archive::task_): Move to base class.
1237 (Archive::incremental_info_): Likewise.
1238 (class Lib_group): Derive from Library_base.
1239 (Lib_group::do_filename): New function.
1240 (Lib_group::do_get_mtime): New function.
1241 (Lib_group::do_for_all_unused_symbols): New function.
1242 (Lib_group::task_): Move to base class.
1243 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1244 function.
1245 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1246 function.
1247 * incremental.cc (Incremental_inputs::report_archive_begin):
1248 Use Library_base; call library's get_mtime; add incremental inputs
1249 entry before members.
1250 (class Unused_symbol_visitor): New class.
1251 (Incremental_inputs::report_archive_end): Use Library_base; use
1252 visitor class to record unused symbols; don't add incremental inputs
1253 entry after members.
1254 (Incremental_inputs::report_object): Use Library_base.
1255 * incremental.h
1256 (Incremental_archive_entry::Incremental_archive_entry): Remove
1257 unused Archive parameter.
1258 (Incremental_inputs::report_archive_begin): Use Library_base.
1259 (Incremental_inputs::report_archive_end): Likewise.
1260 (Incremental_inputs::report_object): Likewise.
1261 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1262 function.
1263 * object.h (Object::for_all_global_symbols): New function.
1264 (Object::do_for_all_global_symbols): New function.
1265 (Sized_relobj::do_for_all_global_symbols): New function.
1266 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1267 function.
1268 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1269 function.
1270
61ab3e40
ILT
12712011-03-27 Ian Lance Taylor <iant@google.com>
1272
1273 * archive.cc (Archive::interpret_header): Return -1 if something
1274 goes wrong. Change callers accordingly.
1275
30e1f9e6
CC
12762011-03-25 Cary Coutant <ccoutant@google.com>
1277
1278 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1279 * testsuite/Makefile.in: Regenerate.
1280
9c793f14
RÁE
12812010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1282
1283 * plugin.cc (get_view): New.
1284 (Plugin::load): Pass get_view to the plugin.
1285 (Plugin_manager::get_view): New.
1286
9312bb0a
ILT
12872011-03-21 Ian Lance Taylor <iant@google.com>
1288
1289 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 1290 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 1291
7e12ba9e
ST
12922011-03-21 Sriraman Tallam <tmsriram@google.com>
1293
1294 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1295 Change == to -eq.
1296 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1297 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1298 Change == to -eq.
1299 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1300 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1301
fd7a005d
ILT
13022011-03-14 Ian Lance Taylor <iant@google.com>
1303
1304 * script-sections.cc (Sort_output_sections::script_compare):
1305 Rename from is_before, change return type.
1306 (Sort_output_sections::operator()): Adjust accordingly.
1307
ed16fd1b
ILT
13082011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1309
1310 PR gold/12572
1311 * testsuite/odr_violation2.cc: Add comment to make all error line
1312 numbers double digits.
1313 * testsuite/debug_msg.sh: Adjust expected errors.
1314
71ff8986
ILT
13152011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1316
1317 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1318 but mark earlier ones as non-canonical
1319 (offset_to_iterator): Update search target and example
1320 (do_addr2line): Return extra lines in a vector*
1321 (format_file_lineno): Extract from do_addr2line
1322 (one_addr2line): Add vector* out-param
1323 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1324 when a lineno entry appeared last for its instruction
1325 (Dwarf_line_info): Add vector* out-param
1326 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1327 * symtab.cc (Odr_violation_compare): Include the lineno in the
1328 comparison again.
1329 (linenos_from_loc): New. Combine the canonical line for an
1330 address with its other lines.
1331 (True_if_intersect): New. Helper functor to make
1332 std::set_intersection a query.
1333 (detect_odr_violations): Compare sets of lines instead of just
1334 one line for each function. This became less deterministic, but
1335 has fewer false positives.
1336 * symtab.h: Declarations.
1337 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1338 mix an optimized and non-optimized object in the same binary
1339 (odr_violation2.so): Same.
1340 * testsuite/Makefile.in: Regenerate from Makefile.am.
1341 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1342 * testsuite/debug_msg.sh: Update line numbers and add
1343 assertions.
1344 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1345 non-optimized context.
1346 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1347 isn't inlined, and use OdrDerived in an optimized context.
1348 * testsuite/odr_header1.h: Defines OdrDerived, where
1349 optimization will change the
1350 first-instruction-in-the-destructor's file and line number.
1351 * testsuite/odr_header2.h: Defines OdrBase.
1352
a19fefdc
ILT
13532011-03-09 Ian Lance Taylor <iant@google.com>
1354
1355 * fileread.cc (File_read::clear_views): Don't delete the whole
1356 file view.
1357
ecb351e9
ILT
13582011-03-08 Ian Lance Taylor <iant@google.com>
1359
1360 PR gold/12525
1361 * fileread.cc: #include <climits>.
1362 (GOLD_IOV_MAX): Define.
1363 (File_read::read_multiple): Limit number of entries by iov_max.
1364 * fileread.h (class File_read): Always set max_readv_entries to
1365 128.
1366
b821d13c
ILT
13672011-03-07 Ian Lance Taylor <iant@google.com>
1368
1369 PR gold/12525
1370 * options.h (class General_options): Add -dy and -dn.
1371
89243142
CC
13722011-03-02 Cary Coutant <ccoutant@google.com>
1373
1374 * testsuite/script_test_9.t: Add TLS segment.
1375
d0773f31
ILT
13762011-03-02 Simon Baldwin <simonb@google.com>
1377
1378 * configure.ac: Add check for gnu_indirect_function support in
1379 the toolchain building binutils.
1380 * configure: Rebuild.
1381
badc8139
RÁE
13822010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1383
1384 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1385 plugin only symbols.
1386 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1387 in plugin files as not needed in the symbol table.
1388
4cf7a849
ST
13892011-02-11 Sriraman Tallam <tmsriram@google.com>
1390
1391 * output.cc (Output_section::add_input_section): Delay fill
1392 generation for section ordering.
1393
b578bd7d
ILT
13942011-02-09 Ian Lance Taylor <iant@google.com>
1395
1396 PR gold/12316
1397 * object.h (class Sized_relobj): Remove clear_local_symbols.
1398 * reloc.cc (Sized_relobj::do_relocate): Don't call
1399 clear_local_symbols.
1400
84ced98a
RÁE
14012010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1402
1403 * plugin.cc (is_visible_from_outside): Return true for symbols
1404 in the -u option.
1405
55382fb7
ILT
14062011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1407
1408 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1409 filename.
1410
4e271fff
ST
14112011-02-02 Sriraman Tallam <tmsriram@google.com>
1412
1413 * icf.h (is_section_foldable_candidate): Change type of parameter
1414 to std::string.
1415 * icf.cc (Icf::find_identical_sections): Change type of local variable
1416 section_name to be std::string.
1417 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1418
d433c3ac
ILT
14192011-01-25 Ian Lance Taylor <iant@google.com>
1420
1421 * script.cc (script_add_extern): Rewrite to use
1422 add_symbol_reference.
1423
880473a6
DK
14242011-01-25 Doug Kwan <dougkwan@google.com>
1425
d433c3ac 1426 * icf.cc (get_section_contents): Always lock section's object.
880473a6 1427
f30f86fa
ILT
14282011-01-24 Ian Lance Taylor <iant@google.com>
1429
1430 * options.h (class General_options): Accept
1431 --no-detect-odr-violations.
1432
8e51a0b9
ILT
14332011-01-24 Ian Lance Taylor <iant@google.com>
1434
1435 * version.cc (version_string): Bump to 1.11.
1436
0f3b89d8
ILT
14372011-01-24 Ian Lance Taylor <iant@google.com>
1438
1439 * plugin.cc (class Plugin_rescan): Define new class.
1440 (Plugin_manager::claim_file): Set any_claimed_.
1441 (Plugin_manager::save_archive): New function.
1442 (Plugin_manager::save_input_group): New function.
1443 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1444 necessary.
1445 (Plugin_manager::new_undefined_symbol): New function.
1446 (Plugin_manager::rescan): New function.
1447 (Plugin_manager::rescannable_defines): New function.
1448 (Plugin_manager::add_input_file): Set any_added_.
1449 * plugin.h (class Plugin_manager): define new fields rescannable_,
1450 undefined_symbols_, any_claimed_, and any_added_. Declare
1451 Plugin_rescan as friend. Declare new functions.
1452 (Plugin_manager::Rescannable): Define type.
1453 (Plugin_manager::Rescannable_list): Define type.
1454 (Plugin_manager::Undefined_symbol_list): Define type.
1455 (Plugin_manager::Plugin_manager): Initialize new fields.
1456 * archive.cc (Archive::defines_symbol): New function.
1457 (Add_archive_symbols::run): Pass archive to plugins if any.
1458 * archive.h (class Archive): Declare defines_symbol.
1459 * readsyms.cc (Input_group::~Input_group): New function.
1460 (Finish_group::run): Pass input_group to plugins if any.
1461 * readsyms.h (class Input_group): Declare destructor.
1462 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1463 any.
1464
3bb951e5
ILT
14652011-01-10 Ian Lance Taylor <iant@google.com>
1466
1467 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1468 section as relro.
1469 (Layout::set_segment_offsets): Reset increase_relro before calling
1470 set_section_addresses a second time.
1471
0aa45fac
CC
14722011-01-04 Cary Coutant <ccoutant@google.com>
1473
1474 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1475 sections before NOBITS sections.
1476
0db46eb4
L
14772011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1478
1479 * version.cc (print_version): Update copyright to 2011.
1480
829c9745
CC
14812010-12-23 Cary Coutant <ccoutant@google.com>
1482
1483 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1484 of OS to this->add. Add OD parameter to second form of the function.
1485
7500420b
ILT
14862010-12-20 Ian Lance Taylor <iant@google.com>
1487
1488 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1489 second of two consecutive entries with same offset.
1490
f8e9a930
RW
14912010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1492
1493 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1494 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1495 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1496 to avoid unneeded links against $(LDADD).
1497 * testsuite/Makefile.in: Regenerate.
1498
2fbb4320
ILT
14992010-12-15 Ian Lance Taylor <iant@google.com>
1500
1501 PR gold/12324
1502 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1503 for R_X86_64_32 and R_X86_64_PC32.
1504 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1505 ver_matching_def_pic.o.
1506 (ver_matching_def_pic.o): New target.
1507
fedb228d
RW
15082010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1509
1510 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1511 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1512 Move definition before File_read::View member definitions.
1513 (File_read::View::~View): Initialize and hold lock before
1514 updating current_mapped_bytes.
1515
9b547ce6
RW
15162010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1517
1518 * dwarf_reader.cc: Remove outdated comment.
1519 * gold-threads.cc: Fix typo in error message.
1520 * archive.cc: Fix typos in comments.
1521 * archive.h: Likewise.
1522 * arm-reloc-property.cc: Likewise.
1523 * arm-reloc-property.h: Likewise.
1524 * arm-reloc.def: Likewise.
1525 * arm.cc: Likewise.
1526 * attributes.h: Likewise.
1527 * cref.cc: Likewise.
1528 * ehframe.cc: Likewise.
1529 * fileread.h: Likewise.
1530 * gold.h: Likewise.
1531 * i386.cc: Likewise.
1532 * icf.cc: Likewise.
1533 * incremental.h: Likewise.
1534 * int_encoding.cc: Likewise.
1535 * layout.h: Likewise.
1536 * main.cc: Likewise.
1537 * merge.h: Likewise.
1538 * object.cc: Likewise.
1539 * object.h: Likewise.
1540 * options.cc: Likewise.
1541 * readsyms.cc: Likewise.
1542 * reduced_debug_output.cc: Likewise.
1543 * reloc.cc: Likewise.
1544 * script-sections.cc: Likewise.
1545 * sparc.cc: Likewise.
1546 * symtab.h: Likewise.
1547 * target-reloc.h: Likewise.
1548 * target.cc: Likewise.
1549 * target.h: Likewise.
1550 * timer.cc: Likewise.
1551 * timer.h: Likewise.
1552 * x86_64.cc: Likewise.
1553
83e17bd5
CC
15542010-12-09 Cary Coutant <ccoutant@google.com>
1555
1556 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1557 stack.
1558 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1559 parameter; change all callers.
1560 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1561 * options.h (warn_execstack): New option.
1562
017257f8
DK
15632010-12-07 Doug Kwan <dougkwan@google.com>
1564
1565 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1566 like function call relocations.
1567
c20cbc06
ILT
15682010-12-07 Ian Lance Taylor <iant@google.com>
1569
1570 * archive.cc (Archive::get_elf_object_for_member): Permit
1571 punconfigured to be NULL.
1572 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1573 (Archive::include_member): Pass NULL to get_elf_object_for_member
1574 if we searched for the archive and this is the first included
1575 object.
1576
4dbfafcc
ILT
15772010-12-01 Ian Lance Taylor <iant@google.com>
1578
1579 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1580 track_relocs_type_ field.
1581 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1582 Set track_relocs_type_.
1583 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1584 contents when using RELA relocs.
1585 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1586 reloc_map_.
1587 * reloc.cc (Track_relocs::next_addend): New function.
1588 * reloc.h (class Track_relocs): Declare next_addend.
1589
e5e19edd
ILT
15902010-12-01 Ian Lance Taylor <iant@google.com>
1591
1592 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1593 virtual destructor.
1594
9a5ce24c
ILT
15952010-12-01 Ian Lance Taylor <iant@google.com>
1596
1597 * README: Update compilers known to work and fail.
1598
c7791212
NC
15992010-11-23 Matthias Klose <doko@ubuntu.com>
1600
1601 * configure.in: For --enable-gold, handle value `default' instead of
1602 `both*'. Always install ld as ld.bfd, install as ld if gold is
1603 not the default.
1604 * configure: Regenerate.
1605
0ad220c9
DK
16062010-11-18 Doug Kwan <dougkwan@google.com>
1607
1608 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1609 and right_alignment to be zero. Store result alignment only if it is
1610 greater than existing alignment.
1611
ab8056e0
CC
16122010-11-16 Cary Coutant <ccoutant@google.com>
1613
1614 PR gold/12220
1615 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1616 Check for ".zdebug_line".
1617
fd064a5b
CC
16182010-11-16 Doug Kwan <dougkwan@google.com>
1619 Cary Coutant <ccoutant@google.com>
1620
1621 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1622 by reference; adjust all callers.
1623 * output.cc (Output_segment::set_section_addresses): Adjust references
1624 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1625 list is empty.
1626 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1627 end at page boundary.
1628
6fc6ea19
CC
16292010-11-16 Cary Coutant <ccoutant@google.com>
1630
1631 PR gold/12220
1632 * layout.cc (Layout::choose_output_section): Transform names of
1633 compressed sections even when using a script with a SECTIONS clause.
1634 (Layout::output_section_name): Remove code to transform
1635 compressed debug section names.
1636 * output.cc (Output_section::add_input_section): Use uncompressed
1637 section size when tracking input sections.
1638
95a2c8d6
RS
16392010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1640
1641 * symtab.h (Symbol::NON_PIC_REF): Remove.
1642 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1643 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1644 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1645 (Symbol::use_plt_offset): Take a flags argument and pass it
1646 directly to needs_dynamic_reloc. Restrict check for undefined
1647 weak symbols to function calls.
1648 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1649 (Target_arm::Scan::global): Use it.
1650 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1651 (Target_arm::Relocate::relocate): Likewise.
1652 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1653 parameter with an r_type parameter. Use get_reference_flags
1654 to get the flags.
1655 (Target_arm::Relocate::relocate): Update accordingly.
1656 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1657 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1658 (Target_i386::Scan::global): Likewise.
1659 (Target_i386::Relocate::relocate): Likewise.
1660 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1661 parameter with an r_type parameter. Use get_reference_flags
1662 to get the flags.
1663 (Target_i386::Relocate::relocate): Update accordingly.
1664 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1665 (Target_powerpc::Scan::global): Use it.
1666 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1667 (Target_powerpc::Relocate::relocate): Likewise.
1668 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1669 (Target_sparc::Scan::global): Use it.
1670 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1671 (Target_sparc::Relocate::relocate): Likewise.
1672 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1673 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1674 (Target_x86_64::Scan::global): Likewise.
1675 (Target_x86_64::Relocate::relocate): Likewise.
1676
f625ae50
DK
16772010-11-08 Doug Kwan <dougkwan@google.com>
1678 Cary Coutant <ccoutant@google.com>
1679
1680 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1681 (Arm_exidx_merge_section::section_contents_): New data member.
1682 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1683 (Arm_input_section::~Arm_input_section): De-allocate memory.
1684 (Arm_input_section::original_contents_): New data member.
1685 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1686 in parameters instead of calling Object::section_contents without
1687 locking.
1688 (Arm_output_section::group_section): New parameter TASK. Pass it
1689 to callees that need locking objects.
1690 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1691 to lock EXIDX input sections. Fix a formatting issue. Call
1692 Arm_exidx_merged_section::build_contents to create merged section
1693 contents.
1694 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1695 to lock object of stub table owner.
1696 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1697 TEXT_SIZE to initialize data member TEXT_SIZE_.
1698 (Arm_exidx_input_section::addralign): Fix typo in comment.
1699 (Arm_exidx_input_section::text_size): New method.
1700 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1701 that require locking objects. Lock objects before scanning for stubs
1702 and updating local symbols.
1703 (Arm_input_section<big_endian>::init): Copy contents of original
1704 input section.
1705 (Arm_input_section<big_endian>::do_write): Use saved contents of
1706 original input section instead of calling Object::section_contents
1707 without locking.
1708 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1709 size without calling Object::section_size().
1710 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1711 for size. Allocate a buffer for merged EXIDX entries.
1712 (Arm_exidx_merged_section::build_contents): New method.
1713 (Arm_exidx_merged_section::do_write): Move merge section contents
1714 building code to Arm_exidx_merged_section::build_contetns. Write
1715 out contetns in buffer instead of building it on the fly.
1716 (Arm_relobj::make_exidx_input_section): Also pass text section size
1717 to Arm_exidx_input_section constructor.
1718 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1719 (Arm_dynobj::do_read_symbols): Fix memory leak.
1720 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1721 * target.h: (class Task): Add forward declaration.
1722 (Target::relax): Add new parameter TASK and pass it to
1723 Target::do_relax().
1724 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1725
5f9bcf58
CC
17262010-11-05 Cary Coutant <ccoutant@google.com>
1727
1728 PR gold/10708
1729 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1730 object when reading from the file.
1731 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1732 second layout pass.
1733 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1734 when reading section contents.
1735 (get_section_contents): Likewise.
1736 (icf::find_identical_sections): Likewise.
1737 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1738 object when reading from the file.
1739 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1740 the object when doing deferred section layout.
1741
e597fa08
NC
17422010-11-03 Nick Clifton <nickc@redhat.com>
1743
1744 PR gold/12001
1745 * script.h (class Symbol_assignment: name): New member. Returns
1746 the name of the symbol.
1747 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1748 Returns true if the given symbol name is on the list of
1749 assignments wating to be processed.
1750 * archive.cc (should_incldue_member): If the symbol is undefined,
1751 check to see if it is on the list of symbols pending assignment.
1752
3f9a3278
ILT
17532010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1754
1755 * script-sections.cc (Script_sections::find_memory_region): Check
1756 for a NULL output section pointer.
1757
d06fb4d1
DK
17582010-10-29 Doug Kwan <dougkwan@google.com>
1759
1760 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1761 Output_section::add_relaxed_input_section.
1762 * output.cc (Output_section::add_relaxed_input_section): Add new
1763 arguments LAYOUT and NAME. Set section order index.
1764 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1765 Copy section order index.
1766 * output.h (Output_section::add_relaxed_input_section): Add new
1767 arguments LAYOUT and NAME.
1768
90e24de5
ILT
17692010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1770
1771 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1772 NATIVE_OR_CROSS_LINKER.
1773 * testsuite/Makefile.in: Regenerate.
1774
c9484ea5
DK
17752010-10-20 Doug Kwan <dougkwan@google.com>
1776
1777 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1778 without SHF_LINK_ORDER flags.
1779 * layout.cc (Layout::choose_output_section): Do not filter
1780 SHF_LINK_ORDER flag in a relocatable link.
1781
5bc2f5be
CC
17822010-10-17 Cary Coutant <ccoutant@google.com>
1783
1784 * output.h (Output_segment::set_section_addresses): Change function
1785 signature. Update all callers.
1786 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1787 sections.
1788 (Output_segment::set_section_addresses): Align after last TLS
1789 section. Add padding before last relro section instead of after.
1790
0c91cf04
DK
17912010-10-17 Doug Kwan <dougkwan@google.com>
1792
1793 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1794 GOT output section to be writable.
1795
8c21d9d3
CC
17962010-10-14 Cary Coutant <ccoutant@google.com>
1797
1798 * debug.h (DEBUG_INCREMENTAL): New flag.
1799 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1800 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1801 mode.
1802 * incremental.cc (report_command_line): Ignore all forms of
1803 --incremental.
1804 * layout.cc (Layout::Layout): Check parameters for incremental link
1805 mode.
1806 * options.cc (General_options::parse_incremental): New function.
1807 (General_options::parse_no_incremental): New function.
1808 (General_options::parse_incremental_full): New function.
1809 (General_options::parse_incremental_update): New function.
1810 (General_options::incremental_mode_): New data member.
1811 (General_options::finalize): Check incremental_mode_.
1812 * options.h (General_options): Update help text for --incremental.
1813 Add --no-incremental, --incremental-full, --incremental-update.
1814 (General_options::Incremental_mode): New enum type.
1815 (General_options::incremental_mode): New function.
1816 (General_options::incremental_mode_): New data member.
1817 * parameters.cc (Parameters::incremental_mode_): New data member.
1818 (Parameters::set_options): Set incremental_mode_.
1819 (Parameters::set_incremental_full): New function.
1820 (Parameters::incremental): New function.
1821 (Parameters::incremental_update): New function.
1822 (set_parameters_incremental_full): New function.
1823 * parameters.h (Parameters::set_incremental_full): New function.
1824 (Parameters::incremental): New function.
1825 (Parameters::incremental_update): New function.
1826 (Parameters::incremental_mode_): New data member.
1827 (set_parameters_incremental_full): New function.
1828 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1829 incremental link mode.
1830 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1831 (Sized_relobj::do_relocate_sections): Likewise.
1832 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1833 option.
1834 * testsuite/Makefile.in: Regenerate.
1835 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1836
bb32aa18 18372010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
1838
1839 * script-sections.h (class Script_sections): Make
1840 Sections_elements typedef public.
1841 * script-sections.cc (class Sort_output_sections): Add elements_
1842 field. Add constructor which sets it; change all callers.
1843 (Sort_output_sections::is_before): New function.
1844 (Sort_output_sections::operator()): Call is_before.
1845 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1846 conditional.
1847 * testsuite/script_test_10.sh: New test. Test script section
1848 order.
1849 * testsuite/script_test_10.t: Likewise.
1850 * testsuite/script_test_10.s: Likewise.
1851 * testsuite/Makefile.am: Wrap the cross linker tests and the
1852 common tests into NATIVE_OR_CROSS_LINKER.
1853 (check_SCRIPTS): Add script_test_10.sh.
1854 (check_DATA): Add script_test_10.stdout.
1855 (script_test_10.o, script_test_10): New targets.
1856 (script_test_10.stdout): New target.
1857 * configure, testsuite/Makefile.in: Regenerate.
1858
3cef7179
ILT
18592010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1860
1861 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1862 error for the deprecated relocations.
1863 (Target_arm::Scan::global): Likewise.
1864 (Target_arm::Relocate::relocate): Likewise.
1865
7411e9a8
RS
18662010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1867
1868 * fileread.cc (Input_file::find_file): Initialize *found_name
1869 and *namep when using the fallback search for case 4.
1870
6a9da32a
CC
18712010-10-11 Cary Coutant <ccoutant@google.com>
1872
1873 * options.h (class General_options): Redefine -z lazy as an alias for
1874 the negation of -z now.
1875
ac897c20
ILT
18762010-10-11 Ian Lance Taylor <iant@google.com>
1877
1878 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1879 binding.
1880
ea5cae92
NC
18812010-10-06 Nick Clifton <nickc@redhat.com>
1882
1883 * script-sections.cc(class Memory_region): Remove
1884 current_lma_offset_ field. Rename current_vma_offset_ to
1885 current_offset_. Add last_section_ field.
1886 (Memory_region::get_current_vma_address): Rename to
1887 get_current_address.
1888 (Memory_region::get_current_lma_address): Delete.
1889 (Memory_region::increment_vma_offset): Rename to
1890 increment_offset.
1891 (Memory_region::increment_lma_offset): Delete.
1892 (Memory_region::attributes_compatible): New method. Returns
1893 true if the provided section is compatible with the region.
1894 (Memory_region::get_last_section): New method. Returns the last
1895 section to use the region.
1896 (Memory_region::set_last_section): New method. Stores the last
1897 section to use the region.
1898 (Script_sections::block_in_region): New method. Returns true if
1899 a block of memory is contained within a region.
1900 (Script_sections::find_memory_region): New method. Locates a
1901 memory region to be used to set a VMA or LMA address.
1902 (Output_section_definition::set_section_addresses): Add code to
1903 check for addresses set by memory regions.
1904 (Output_segment::set_section_addresses): Remove memory region
1905 walking code.
1906 (Script_sections::create_segment): Add a warning if a header
1907 segment is created outside of any region.
1908 * script-sections.h (class Script_sections): Add prototypes for
1909 find_memory_region and block_in_region methods.
1910 * testsuite/memory_test.s: Use .long instead of .word.
1911 * testsuite/memory_test.t: Add some more output sections.
1912 * testsuite/memory_test.sh: Update expected output.
1913
a9bfd952
DK
19142010-10-02 Doug Kwan <dougkwan@google.com>
1915
1916 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1917 defintion to symtab.h
1918 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1919 declaration to defintion.
1920
bacff3ab
NC
19212010-10-01 Nick Clifton <nickc@redhat.com>
1922
1923 * expression.cc (eval): Replace dummy argument with NULL.
1924 (eval_maybe_dot): Check for a NULL result section pointer.
1925 (Symbol_expression::value): Likewise.
1926 (Dot_expression::value): Likewise.
1927 (BINARY_EXPRESSION): Likewise.
1928 (Max_expression::value): Likewise.
1929 (Min_expression::value): Likewise.
1930 (Absolute_expression::value): Likewise.
1931 (Addr_expression::value_from_output_section): Likewise.
1932 (Loaddddr_expression::value_from_output_section): Likewise.
1933 (Segment_start_expression::value): Likewise.
1934 * script-sections.cc
1935 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1936 argument with NULL.
1937 (Sections_elememt_dot_assignment::set_section_addresses):
1938 Likewise.
1939 (Output_data_expression::do_write_to_buffer): Likewise.
1940 (Output_section_definition::finalize_symbols): Likewise.
1941 (Output_section_definition::set_section_addresses): Likewise.
1942
f81bc8b5
DK
19432010-09-30 Doug Kwan <dougkwan@google.com>
1944
1945 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1946
c95e9f27
ST
19472010-09-28 Sriraman Tallam <tmsriram@google.com>
1948
1949 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 1950 function.
c95e9f27
ST
1951 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1952 virtual function.
1953 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1954 virtual function.
1955 * icf.cc (get_section_contents): Inline merge sections only when
1956 target allows it.
1957
3cac54d2
RW
19582010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1959
1960 * configure: Regenerate.
1961
2904037a
ILT
19622010-09-17 Ian Lance Taylor <iant@google.com>
1963
1964 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
1965 * testsuite/Makefile.am (memory_test.o): New target.
1966 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1967 memory_test.t.
1968 * testsuite/Makefile.in: Rebuild.
2904037a 1969
bca7fb63
DK
19702010-09-17 Doug Kwan <dougkwan@google.com>
1971
1972 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1973 defintion if relocation uses GOT entries of the symbol.
1974 * testsuite/icf_safe_test.sh: Fix test.
1975 * testsuite/icf_safe_so_test.sh: Fix test.
1976
4ef28648
CC
19772010-09-16 Cary Coutant <ccoutant@google.com>
1978
1979 * script_sections.cc (class Memory_region): Remove "NULL" from
1980 vector initializations.
1981
793990de
CC
19822010-09-15 Cary Coutant <ccoutant@google.com>
1983
1984 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1985 Resolve forwarding symbols.
1986
81e015e2
DK
19872010-09-15 Doug Kwan <dougkwan@google.com>
1988
1989 * gold/testsuite/script_test_3.t: Add ARM special sections.
1990 * gold/testsuite/script_test_4.t: Same.
1991 * gold/testsuite/script_test_5.t: Same.
1992 * gold/testsuite/script_test_6.t: Same.
1993 * gold/testsuite/script_test_7.t: Same.
1994 * gold/testsuite/script_test_7.t: Same.
1995 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1996
36171d64
CC
19972010-09-14 Cary Coutant <ccoutant@google.com>
1998
1999 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2000 (Target_x86_64::Relocate::relocate_tls): Replace check for
2001 saw_tls_block_reloc_ with test for executable section.
2002
d89051bd
CC
20032010-09-12 Cary Coutant <ccoutant@google.com>
2004
2005 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2006 position-independent executables to shared libraries need dynamic
2007 relocations.
2008 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2009 position-independent executables.
2010 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2011 * testsuite/Makefile.in: Regenerate.
2012
fca41f0f
NC
20132010-09-10 Nick Clifton <nickc@redhat.com>
2014
2015 PR gold/11997
2016 * testsuite/memory_test.t: Discard any sections that are not
2017 needed.
2018
6695e4b3
L
20192010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2020
2021 PR gold/11996
2022 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2023 "This::" to work around a bug in gcc 4.2.
2024
2025 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2026
0f72bf6f
RÁE
20272010-09-09 Rafael Espindola <espindola@google.com>
2028
2029 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2030 sections with different PF_X flags in the same segment.
2031 (Layout::find_first_load_seg): Search all segments to find the first
2032 one.
2033 * options.h (rosegment): New.
2034
20352010-09-08 Rafael Espindola <espindola@google.com>
a6577478 2036
05a79166 2037 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 2038
aa98ff75
DK
20392010-09-08 Doug Kwan <dougkwan@google.com>
2040
2041 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2042 (Arm_relobj::do_relocate_sections): Add new parameter for output
2043 file to match the parent.
2044 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2045 of local symbols instead of input values. Update code to track
2046 changes in gold::relocate_section.
2047 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2048 (Sized_relobj::compute_final_local_value_internal): New methods.
2049 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2050 body into private version of Sized_relobj::compute_final_local_value.
2051 Call the inline method.
2052 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2053 merged symbol value if there is one.
2054 (Symbol_value::has_output_value): New method defintiion.
2055 (Sized_relobj::Compute_final_local_value_status): New enum type.
2056 (Sized_relobj::compute_final_local_value): New methods.
2057 (Sized_relobj::compute_final_local_value_internal): New methods.
2058 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2059 and arm_cortex_a8.sh.
2060 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2061 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2062 New tests.
2063 * Makefile.in: Regenerate.
2064 * testsuite/arm_bl_out_of_range.s: Update test.
2065 * testsuite/thumb_bl_out_of_range.s: Ditto.
2066 * testsuite/thumb_blx_out_of_range.s: Ditto.
2067 * testsuite/arm_branch_out_of_range.sh: New file.
2068 * testsuite/arm_cortex_a8.sh: Ditto.
2069 * testsuite/arm_cortex_a8_b.s: Ditto.
2070 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2071 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2072 * testsuite/arm_cortex_a8_bl.s: Ditto.
2073 * testsuite/arm_cortex_a8_blx.s: Ditto.
2074 * testsuite/arm_cortex_a8_local.s: Ditto.
2075 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2076 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2077
05a79166
L
20782010-09-08 Rafael Espindola <espindola@google.com>
2079
2080 * Makefile.am (memory_test.stdout): Run readelf with -W.
2081 * Makefile.in: Regenerate.
2082 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2083 64 bit output.
2084
33dbc701
RÁE
20852010-09-08 Rafael Espindola <espindola@google.com>
2086
2087 * script-sections.cc (Script_sections::add_memory_region): Convert
2088 field precision to int.
2089 * script.cc (script_set_section_region, script_set_section_region):
2090 Convert field precision to int.
2091
731ca54a
RÁE
20922010-09-08 Rafael Espindola <espindola@google.com>
2093
2094 * arm.cc (do_finalize_sections): Create the __exidx_start and
2095 __exdix_end symbols even when the section is missing.
2096
7f8cd844
NC
20972010-09-08 Nick Clifton <nickc@redhat.com>
2098
2099 * README: Remove claim that MEMORY is not supported.
2100 * expression.cc (script_exp_function_origin)
2101 (script_exp_function_length): Move from here to ...
2102 * script.cc: ... here.
2103 (script_set_section_region, script_add_memory)
2104 (script_parse_memory_attr, script_include_directive): New
2105 functions.
2106 * script-sections.cc
2107 (class Memory_region): New class.
2108 (class Output_section_definition): Add set_memory_region,
2109 set_section_vma, set_section_lma and get_section_name methods.
2110 (class Script_Sections): Add add_memory_region,
2111 find_memory_region, find_memory_region_origin,
2112 find_memory_region_length and set_memory_region methods.
2113 Have set_section_addresses method walk the list of set memory
2114 regions.
2115 Extend the print methos to display memory regions.
2116 * script-sections.h: Add prototypes for new methods.
2117 Add enum for MEMORY region attributes.
2118 * yyscript.y: Add support for parsing MEMORY regions.
2119 * script-c.h: Add prototypes for new functions.
2120 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2121 * testsuite/Makefile.in: Regenerate.
2122 * testsuite/memory_test.sh: New script.
2123 * testsuite/memory_test.s: New assembler source file.
2124 * testsuite/memory_test.t: New linker script.
2125
a4649286
DK
21262010-08-27 Doug Kwan <dougkwan@google.com>
2127
2128 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2129 reference override an existing dynamic weak reference.
2130 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2131 * testsuite/Makefile.in: Regenerate.
2132 * testsuite/dyn_weak_ref.sh: New file.
2133 * testsuite/dyn_weak_ref_1.c: Ditto.
2134 * testsuite/dyn_weak_ref_2.c: Ditto.
2135
b56648ad
ILT
21362010-08-27 Ian Lance Taylor <iant@google.com>
2137
2138 * incremental.h (class Incremental_input_entry): Add virtual
2139 destructor.
2140
809313cb
ILT
21412010-08-27 Ian Lance Taylor <iant@google.com>
2142
2143 * testsuite/start_lib_test_3.c: Mark t3 as used.
2144
11e32464
NC
21452010-08-27 Nick Clifton <nickc@redhat.com>
2146
2147 * options.cc (version_script): Fix small typo in previous
2148 whitespace tidyup.
2149
ca09d69a
NC
21502010-08-25 Nick Clifton <nickc@redhat.com>
2151
2152 * archive.cc: Formatting fixes: Remove whitespace between
2153 typename and following asterisk. Remove whitespace between
2154 function name and opening parenthesis.
2155 * archive.h: Likewise.
2156 * arm.cc: Likewise.
2157 * attributes.cc: Likewise.
2158 * attributes.h: Likewise.
2159 * common.cc: Likewise.
2160 * copy-relocs.cc: Likewise.
2161 * dirsearch.h: Likewise.
2162 * dynobj.cc: Likewise.
2163 * ehframe.cc: Likewise.
2164 * ehframe.h: Likewise.
2165 * expression.cc: Likewise.
2166 * fileread.cc: Likewise.
2167 * fileread.h: Likewise.
2168 * gc.h: Likewise.
2169 * gold-threads.cc: Likewise.
2170 * gold.cc: Likewise.
2171 * i386.cc: Likewise.
2172 * icf.h: Likewise.
2173 * incremental-dump.cc: Likewise.
2174 * incremental.cc: Likewise.
2175 * layout.cc: Likewise.
2176 * layout.h: Likewise.
2177 * main.cc: Likewise.
2178 * merge.cc: Likewise.
2179 * merge.h: Likewise.
2180 * object.cc: Likewise.
2181 * object.h: Likewise.
2182 * options.cc: Likewise.
2183 * options.h: Likewise.
2184 * output.cc: Likewise.
2185 * output.h: Likewise.
2186 * plugin.cc: Likewise.
2187 * plugin.h: Likewise.
2188 * powerpc.cc: Likewise.
2189 * reloc.cc: Likewise.
2190 * script-c.h: Likewise.
2191 * script-sections.cc: Likewise.
2192 * script.cc: Likewise.
2193 * stringpool.cc: Likewise.
2194 * symtab.cc: Likewise.
2195 * symtab.h: Likewise.
2196 * target.cc: Likewise.
2197 * timer.cc: Likewise.
2198 * timer.h: Likewise.
2199 * version.cc: Likewise.
2200 * x86_64.cc: Likewise.
2201
b8fa8750
NC
22022010-08-24 Nick Clifton <nickc@redhat.com>
2203
2204 PR 11899
2205 * layout.cc (segment_precedes): Sort segments by their physical
2206 addresses, if they have been set.
2207
9919d93b
CC
22082010-08-23 Cary Coutant <ccoutant@google.com>
2209
2210 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2211 symbols data.
2212 (Lib_group::include_member): Unlock object after deleting its
2213 symbols data.
2214 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2215 the bug fixed here.
2216
97b4be1c
CC
22172010-08-19 Neil Vachharajani <nvachhar@google.com>
2218 Cary Coutant <ccoutant@google.com>
2219
2220 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2221 constructor, and set_blocker.
2222 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2223 readsyms_blocker_.
2224 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2225 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2226 * testsuite/Makefile.am (start_lib_test): New test case.
2227 * testsuite/Makefile.in: Regenerate.
2228 * testsuite/start_lib_test_main.c: New file.
2229 * testsuite/start_lib_test_1.c: New file.
2230 * testsuite/start_lib_test_2.c: New file.
2231 * testsuite/start_lib_test_3.c: New file.
2232
dd0b1884
ILT
22332010-08-19 Ian Lance Taylor <iant@google.com>
2234
2235 * Makefile.in: Rebuild with automake 1.11.1.
2236 * aclocal.m4: Likewise.
2237 * testsuite/Makefile.in: Likewise.
2238
7223e9ca
ILT
22392010-08-19 Ian Lance Taylor <iant@google.com>
2240
2241 PR 10893
2242 * i386.cc (class Output_data_plt_i386): Update declarations.
2243 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2244 local_ifuncs_ fields.
2245 (Target_i386::do_plt_section_for_global): New function.
2246 (Target_i386::do_plt_section_for_local): New function.
2247 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2248 parameter; change all callers. Initialize global_ifuncs_ and
2249 local_ifuncs_. If doing a static link define __rel_iplt_start and
2250 __rel_iplt_end.
2251 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2252 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2253 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2254 symbols.
2255 (Target_i386::make_plt_section): New function, broken out of
2256 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2257 (Target_i386::make_plt_entry): Call make_plt_section.
2258 (Target_i386::make_local_ifunc_plt_entry): New function.
2259 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2260 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2261 R_386_IRELATIVE to switch.
2262 (Target_i386::Scan::global): Likewise.
2263 (Target_i386::Relocate::relocate): Likewise.
2264 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2265 switch.
2266 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2267 (Target_x86_64::do_plt_section_for_global): New function.
2268 (Target_x86_64::do_plt_section_for_local): New function.
2269 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2270 parameter; change all callers. If doing a static link define
2271 __rela_iplt_start and __rela_iplt_end.
2272 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2273 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2274 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2275 to point to .plt.
2276 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2277 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2278 switch.
2279 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2280 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2281 R_X86_64_IRELATIVE to switch.
2282 (Target_x86_64::Scan::global): Likewise.
2283 (Target_x86_64::Relocate::relocate): Likewise.
2284 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2285 switch.
2286 * target.h (class Target): Add plt_section_for_global and
2287 plt_section_for_local functions. Add do_plt_section_for_global
2288 and do_plt_section_for_local virtual functions.
2289 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2290 clarifying comments.
2291 (Symbol::use_plt_offset): Handle IFUNC symbol.
2292 * object.cc (Sized_relobj::Sized_relobj): Initialize
2293 local_plt_offsets_.
2294 (Sized_relobj::local_has_plt_offset): New function.
2295 (Sized_relobj::local_plt_offset): New function.
2296 (Sized_relobj::set_local_plt_offset): New function.
2297 (Sized_relobj::do_count): Handle IFUNC symbol.
2298 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2299 a bit away from input_shndx_ field. Add set_is_func_symbol and
2300 is_ifunc_symbol functions.
2301 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2302 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2303 local_plt_offsets_ field.
2304 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2305 * output.h (class Output_section_data): Add non-const
2306 output_section function.
2307 (class Output_data_got): Update declarations.
2308 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2309 Add use_plt_offset parameter to global and local constructors.
2310 Change all callers. Change local_sym_index_ field to 31 bits.
2311 Change GSYM_CODE and CONSTANT_CODE accordingly.
2312 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2313 doing a static link don't set sh_link field.
2314 (Output_data_got::Got_entry::write): Use PLT offset if
2315 appropriate.
2316 (Output_data_got::add_global_plt): New function.
2317 (Output_data_got::add_local_plt): New function.
2318 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2319 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2320 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2321 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2322 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2323 IFUNC conditional.
2324 * testsuite/ifunc-sel.h: New file.
2325 * testsuite/ifuncmain1.c: New file.
2326 * testsuite/ifuncmain1vis.c: New file.
2327 * testsuite/ifuncmod1.c: New file.
2328 * testsuite/ifuncdep2.c: New file.
2329 * testsuite/ifuncmain2.c: New file.
2330 * testsuite/ifuncmain3.c: New file.
2331 * testsuite/ifuncmod3.c: New file.
2332 * testsuite/ifuncmain4.c: New file.
2333 * testsuite/ifuncmain5.c: New file.
2334 * testsuite/ifuncmod5.c: New file.
2335 * testsuite/ifuncmain6pie.c: New file.
2336 * testsuite/ifuncmod6.c: New file.
2337 * testsuite/ifuncmain7.c: New file.
2338 * configure, testsuite/Makefile.in: Rebuild.
2339
56f75c03
ILT
23402010-08-18 Ian Lance Taylor <iant@google.com>
2341
2342 * incremental.cc
2343 (Output_section_incremental_inputs::write_input_files): Add cast
2344 to avoid signed/unsigned comparison warning.
2345 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2346
55455f89
CC
23472010-08-12 Cary Coutant <ccoutant@google.com>
2348
2349 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2350
e2054bcb
ILT
23512010-08-13 Ian Lance Taylor <iant@google.com>
2352
2353 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2354
74f67560
DK
23552010-08-12 Cary Coutant <ccoutant@google.com>
2356 Doug Kwan <dougkwan@google.com>
2357
2358 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2359 defintion overrides non-weak undef, remember that the original undef
2360 is not weak.
2361 * symtab.cc (Symbol_table::sized_write_global): For undef without
2362 an original weak binding, set binding to global in output.
2363 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2364 * testsuite/Makefile.in: Regenerate.
2365 * testsuite/strong_ref_weak_def.sh: New file.
2366 * testsuite/strong_ref_weak_def_1.c: Ditto.
2367 * testsuite/strong_ref_weak_def_2.c: Ditto.
2368
d1238d12
CC
23692010-08-12 Cary Coutant <ccoutant@google.com>
2370
2371 * testsuite/incremental_test.sh: Rewrite.
2372 * testsuite/incremental_test_1.c: Rewrite.
2373 * testsuite/incremental_test_2.c: Rewrite.
2374
0e70b911
CC
23752010-08-12 Cary Coutant <ccoutant@google.com>
2376
2377 * arm.cc (Target_arm::got_size): Add const.
2378 (Target_arm::got_entry_count): New function.
2379 (Target_arm::plt_entry_count): New function.
2380 (Target_arm::first_plt_entry_offset): New function.
2381 (Target_arm::plt_entry_size): New function.
2382 (Output_data_plt_arm::entry_count): New function.
2383 (Output_data_plt_arm::first_plt_entry_offset): New function.
2384 (Output_data_plt_arm::get_plt_entry_size): New function.
2385 * i386.cc (Target_i386::got_size): Add const.
2386 (Target_i386::got_entry_count): New function.
2387 (Target_i386::plt_entry_count): New function.
2388 (Target_i386::first_plt_entry_offset): New function.
2389 (Target_i386::plt_entry_size): New function.
2390 (Output_data_plt_i386::entry_count): New function.
2391 (Output_data_plt_i386::first_plt_entry_offset): New function.
2392 (Output_data_plt_i386::get_plt_entry_size): New function.
2393 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2394 find_incremental_inputs_sections. Dump incremental_got_plt section.
2395 * incremental.cc: Include target.h.
2396 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2397 parameter. Adjust all callers. Find incremental_got_plt section.
2398 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2399 section.
2400 (Output_section_incremental_inputs::set_final_data_size): Calculate
2401 size of incremental_got_plt section.
2402 (Output_section_incremental_inputs::do_write): Write the
2403 incremental_got_plt section.
2404 (Got_plt_view_info): New struct.
2405 (Local_got_offset_visitor): New class.
2406 (Global_got_offset_visitor): New class.
2407 (Global_symbol_visitor_got_plt): New class.
2408 (Output_section_incremental_inputs::write_got_plt): New function.
2409 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2410 Add parameter. Adjust all callers.
2411 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2412 (Incremental_inputs::got_plt_section): New function.
2413 (Incremental_inputs::got_plt_section_): New data member.
2414 (Incremental_got_plt_reader): New class.
2415 * layout.cc (Layout::create_incremental_info_sections): Add the
2416 incremental_got_plt section.
2417 * object.h (Got_offset_list::get_list): New function.
2418 (Got offset_list::for_all_got_offsets): New function.
2419 (Sized_relobj::local_got_offset_list): New function.
2420 * powerpc.cc (Target_powerpc::got_size): Add const.
2421 (Target_powerpc::got_entry_count): New function.
2422 (Target_powerpc::plt_entry_count): New function.
2423 (Target_powerpc::first_plt_entry_offset): New function.
2424 (Target_powerpc::plt_entry_size): New function.
2425 (Output_data_plt_powerpc::entry_count): New function.
2426 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2427 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2428 * sparc.cc (Target_sparc::got_size): Add const.
2429 (Target_sparc::got_entry_count): New function.
2430 (Target_sparc::plt_entry_count): New function.
2431 (Target_sparc::first_plt_entry_offset): New function.
2432 (Target_sparc::plt_entry_size): New function.
2433 (Output_data_plt_sparc::entry_count): New function.
2434 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2435 (Output_data_plt_sparc::get_plt_entry_size): New function.
2436 * symtab.h (Symbol::got_offset_list): New function.
2437 (Symbol_table::for_all_symbols): New function.
2438 * target.h (Sized_target::got_entry_count): New function.
2439 (Sized_target::plt_entry_count): New function.
2440 (Sized_target::plt_entry_size): New function.
2441 * x86_64.cc (Target_x86_64::got_size): Add const.
2442 (Target_x86_64::got_entry_count): New function.
2443 (Target_x86_64::plt_entry_count): New function.
2444 (Target_x86_64::first_plt_entry_offset): New function.
2445 (Target_x86_64::plt_entry_size): New function.
2446 (Output_data_plt_x86_64::entry_count): New function.
2447 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2448 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2449
09ec0418
CC
24502010-08-12 Cary Coutant <ccoutant@google.com>
2451
2452 * archive.cc: Include incremental.h.
2453 (Archive::Archive): Initialize incremental_info_.
2454 (Archive::include_member): Record archive members in incremental info.
2455 (Add_archive_symbols::run): Record begin and end of an archive in
2456 incremental info.
2457 (Lib_group::include_member): Record objects in incremental info.
2458 * archive.h (Incremental_archive_entry): Forward declaration.
2459 (Archive::set_incremental_info): New member function.
2460 (Archive::incremental_info): New member function.
2461 (Archive::Unused_symbol_iterator): New class.
2462 (Archive::unused_symbols_begin): New member function.
2463 (Archive::unused_symbols_end): New member function.
2464 (Archive::incremental_info_): New data member.
2465 * incremental-dump.cc (find_input_containing_global): New function.
2466 (dump_incremental_inputs): Dump new incremental info sections.
2467 * incremental.cc: Include symtab.h.
2468 (Output_section_incremental_inputs): New class.
2469 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2470 new incremental info sections.
2471 (Sized_incremental_binary::do_check_inputs): Likewise.
2472 (Incremental_inputs::report_archive): Remove.
2473 (Incremental_inputs::report_archive_begin): New function.
2474 (Incremental_inputs::report_archive_end): New function.
2475 (Incremental_inputs::report_object): New function.
2476 (Incremental_inputs::finalize_inputs): Remove.
2477 (Incremental_inputs::report_input_section): New function.
2478 (Incremental_inputs::report_script): Rewrite.
2479 (Incremental_inputs::finalize): Do nothing but finalize string table.
2480 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2481 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2482 (Incremental_inputs::create_data_sections): New function.
2483 (Incremental_inputs::relocs_entsize): New function.
2484 (Output_section_incremental_inputs::set_final_data_size): New function.
2485 (Output_section_incremental_inputs::do_write): New function.
2486 (Output_section_incremental_inputs::write_header): New function.
2487 (Output_section_incremental_inputs::write_input_files): New function.
2488 (Output_section_incremental_inputs::write_info_blocks): New function.
2489 (Output_section_incremental_inputs::write_symtab): New function.
2490 * incremental.h (Incremental_script_entry): Forward declaration.
2491 (Incremental_object_entry): Forward declaration.
2492 (Incremental_archive_entry): Forward declaration.
2493 (Incremental_inputs): Forward declaration.
2494 (Incremental_inputs_header_data): Remove.
2495 (Incremental_inputs_header): Remove.
2496 (Incremental_inputs_header_write): Remove.
2497 (Incremental_inputs_entry_data): Remove.
2498 (Incremental_inputs_entry): Remove.
2499 (Incremental_inputs_entry_write): Remove.
2500 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2501 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2502 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2503 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2504 Likewise.
2505 (Incremental_input_entry): New class.
2506 (Incremental_script_entry): New class.
2507 (Incremental_object_entry): New class.
2508 (Incremental_archive_entry): New class.
2509 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2510 (Incremental_inputs::report_inputs): Remove.
2511 (Incremental_inputs::report_archive): Remove.
2512 (Incremental_inputs::report_archive_begin): New function.
2513 (Incremental_inputs::report_archive_end): New function.
2514 (Incremental_inputs::report_object): Change prototype.
2515 (Incremental_inputs::report_input_section): New function.
2516 (Incremental_inputs::report_script): Change prototype.
2517 (Incremental_inputs::get_reloc_count): New function.
2518 (Incremental_inputs::set_reloc_count): New function.
2519 (Incremental_inputs::create_data_sections): New function.
2520 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2521 (Incremental_inputs::inputs_section): New function.
2522 (Incremental_inputs::symtab_section): New function.
2523 (Incremental_inputs::relocs_section): New function.
2524 (Incremental_inputs::get_stringpool): Add const.
2525 (Incremental_inputs::command_line): Add const.
2526 (Incremental_inputs::inputs): Remove.
2527 (Incremental_inputs::command_line_key): New function.
2528 (Incremental_inputs::input_file_count): New function.
2529 (Incremental_inputs::input_files): New function.
2530 (Incremental_inputs::relocs_entsize): New function.
2531 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2532 (Incremental_inputs::finalize_inputs): Remove.
2533 (Incremental_inputs::Input_info): Remove.
2534 (Incremental_inputs::lock_): Remove.
2535 (Incremental_inputs::inputs_): Change type.
2536 (Incremental_inputs::inputs_map_): Remove.
2537 (Incremental_inputs::current_object_entry_): New data member.
2538 (Incremental_inputs::inputs_section_): New data member.
2539 (Incremental_inputs::symtab_section_): New data member.
2540 (Incremental_inputs::relocs_section_): New data member.
2541 (Incremental_inputs::reloc_count_): New data member.
2542 (Incremental_inputs_reader): New class.
2543 (Incremental_symtab_reader): New class.
2544 (Incremental_relocs_reader): New class.
2545 * layout.cc (Layout::finalize): Move finalization of incremental info
2546 and creation of incremental info sections to follow finalization of
2547 symbol table. Set offsets for postprocessing sections.
2548 (Layout::create_incremental_info_sections): Call
2549 Incremental_inputs::create_data_sections. Add incremental symtab
2550 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2551 sections to layout after input sections.
2552 * layout.h (struct Timespec): Forward declaration.
2553 (Layout::incremental_inputs): Add const.
2554 (Layout::create_incremental_info_sections): Add parameter.
2555 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2556 * object.cc: Include incremental.h.
2557 (Relobj::finalize_incremental_relocs): New function.
2558 (Sized_relobj::do_layout): Record input sections in incremental info.
2559 * object.h (Object::output_section): New function.
2560 (Object::output_section_offset): Moved from Relobj.
2561 (Object::get_incremental_reloc_base): New function.
2562 (Object::get_incremental_reloc_count): New function.
2563 (Object::do_output_section): New function.
2564 (Object::do_output_section_offset): Moved from Relobj.
2565 (Object::do_get_incremental_reloc_base): New function.
2566 (Object::do_get_incremental_reloc_count): New function.
2567 (Object::Object): Initialize new data members.
2568 (Relobj::output_section): Renamed do_output_section and moved to
2569 protected.
2570 (Relobj::output_section_offset): Moved to Object.
2571 (Relobj::do_get_incremental_reloc_base): New function.
2572 (Relobj::do_get_incremental_reloc_count): New function.
2573 (Relobj::allocate_incremental_reloc_counts): New function.
2574 (Relobj::count_incremental_reloc): New function.
2575 (Relobj::finalize_incremental_relocs): New function.
2576 (Relobj::next_incremental_reloc_index): New function.
2577 (Relobj::reloc_counts_): New data member.
2578 (Relobj::reloc_bases_): New data member.
2579 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2580 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2581 (Sized_relobj::incremental_relocs_scan): New function.
2582 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2583 (Sized_relobj::incremental_relocs_write): New function.
2584 (Sized_relobj::incremental_relocs_write_reltype): New function.
2585 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2586 incremental link.
2587 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2588 archives and object files elsewhere.
2589 (Add_symbols::run): Report object files here.
2590 (Finish_group::run): Report end of archive at end of group.
2591 * reloc.cc: Include layout.h, incremental.h.
2592 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2593 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2594 (Sized_relobj::incremental_relocs_scan): New function.
2595 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2596 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2597 (Sized_relobj::incremental_relocs_write): New function.
2598 (Sized_relobj::incremental_relocs_write_reltype): New function.
2599 * script.cc (read_input_script): Rewrite test for incremental link.
2600 Change call to Incremental_inputs::report_script.
2601 * symtab.h (Symbol_table::first_global_index): New function.
2602 (Symbol_table::output_count): New function.
2603
ce0d1972
DK
26042010-08-12 Doug Kwan <dougkwan@google.com>
2605
2606 * arm.cc (Target_arm::merge_object_attributes): Check command line
2607 options --no-wchar-size-warning and --no-enum-size-warning.
2608 * options.h (General_options): Add ld-compatible options
2609 --no-enum-size-warning and --no-wchar-size-warning.
2610
6e5710ce
ILT
26112010-08-04 Ian Lance Taylor <iant@google.com>
2612
2613 * x86_64.cc (Target_x86_64::Scan::local): Use
2614 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2615 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2616 (Target_x86_64::Scan::global): Likewise.
2617 (Target_x86_64::Relocate::relocate): Likewise.
2618 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2619 Likewise.
2620
fef830db
CC
26212010-08-03 Cary Coutant <ccoutant@google.com>
2622
2623 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2624 to reserve space in merged_strings vector. Keep total input size
2625 for stats.
2626 (Output_merge_string::do_print_merge_stats): Print total input size.
2627 * merge.h (Output_merge_string): Add input_size_ field.
2628 * stringpool.cc (Stringpool_template::string_length): Move
2629 implementations out of Stringpool_template class and place in
2630 stringpool.h.
2631 * stringpool.h (string_length): Move out of Stringpool_template.
2632
1e3811b0
ILT
26332010-08-03 Ian Lance Taylor <iant@google.com>
2634
2635 PR 11712
2636 * layout.cc (relaxation_loop_body): If address of load segment is
2637 set, adjust address to include headers if possible.
2638
7af0c620
ILT
26392010-08-03 Ian Lance Taylor <iant@google.com>
2640
2641 * version.cc (version_string): Bump to 1.10.
2642
22f0da72
ILT
26432010-08-03 Ian Lance Taylor <iant@google.com>
2644
2645 PR 11805
2646 * layout.h (enum Output_section_order): Define.
2647 (class Layout): Update declarations.
2648 * layout.cc (Layout::get_output_section): Add order parameter.
2649 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2650 is_first_non_relro parameters. Change all callers.
2651 (Layout::choose_output_section): Likewise.
2652 (Layout::add_output_section_data): Likewise.
2653 (Layout::make_output_section): Likewise. Set order.
2654 (Layout::default_section_order): New function.
2655 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2656 * output.cc (Output_section::Output_section): Initialize order_.
2657 Don't initialize deleted fields.
2658 (Output_segment::Output_segment): Don't initialize deleted
2659 fields.
2660 (Output_segment::add_output_section_to_load): New function
2661 replacing add_output_section. Change all callers to call this or
2662 add_output_section_to_nonload.
2663 (Output_segment::add_output_section_to_nonload): New function.
2664 (Output_segment::remove_output_section): Rewrite.
2665 (Output_segment::add_initial_output_data): Likewise.
2666 (Output_segment::has_any_data_sections): Likewise.
2667 (Output_segment::is_first_section_relro): Likewise.
2668 (Output_segment::maximum_alignment): Likewise.
2669 (Output_segment::has_dynamic_reloc): New function replacing
2670 dynamic_reloc_count. Change all callers.
2671 (Output_segment::has_dynamic_reloc_list): New function replacing
2672 dynamic_reloc_count_list. Change all callers.
2673 (Output_segment::set_section_addresses): Rewrite.
2674 (Output_segment::set_offset): Rewrite.
2675 (Output_segment::find_first_and_last_list): Remove.
2676 (Output_segment::set_tls_offsets): Rewrite.
2677 (Output_segment::first_section_load_address): Likewise.
2678 (Output_segment::output_section_count): Likewise.
2679 (Output_segment::section_with_lowest_load_address): Likewise.
2680 (Output_segment::write_section_headers): Likewise.
2681 (Output_segment::print_sections_to_map): Likewise.
2682 * output.h (class Output_data): Remove dynamic_reloc_count_
2683 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2684 (Output_data::add_dynamic_reloc): Rewrite.
2685 (Output_data::has_dynamic_reloc): New function.
2686 (Output_data::dynamic_reloc_count): Remove.
2687 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2688 is_last_relro_, is_first_non_relro_, is_interp_,
2689 is_dynamic_linker_section_ fields. Add order and set_order
2690 functions. Remove is_relro_local, set_is_relro_local,
2691 is_last_relro, set_is_last_relro, is_first_non_relro,
2692 set_is_first_non_relro functions, is_interp, set_is_interp,
2693 is_dynamic_linker_section, and set_is_dynamic_linker_section
2694 functions.
2695 (class Output_segment): Change Output_data_list from std::list to
2696 std:;vector. Add output_lists_ field. Remove output_data_ and
2697 output_bss_ fields. Update declarations.
2698
3ff2ccb0
ILT
26992010-08-02 Ian Lance Taylor <iant@google.com>
2700
2701 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2702 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2703 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2704
88a4108b
ILT
27052010-08-02 Ian Lance Taylor <iant@google.com>
2706
2707 PR 11855
2708 * script.cc (Script_options::Script_options): Initialize
2709 symbol_definitions_ and symbol_references_.
2710 (Script_options::add_symbol_assignment): Update
2711 symbol_definitions_ and symbol_references_.
2712 (Script_options::add_symbol_reference): New function.
2713 (script_symbol): New function.
2714 * script.h (class Script_options): Add symbol_definitions_ and
2715 symbol_references_ fields.
2716 (Script_options::referenced_const_iterator): New type.
2717 (Script_options::referenced_begin): New function.
2718 (Script_options::referenced_end): New function.
2719 (Script_options::is_referenced): New function.
2720 (Script_options::any_unreferenced): New function.
2721 * script-c.h (script_symbol): Declare.
2722 * yyscript.y (exp): Call script_symbol.
2723 * symtab.cc: Include "script.h".
2724 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2725 Change all callers. Check symbols referenced by scripts.
2726 (Symbol_table::add_undefined_symbols_from_command_line): Add
2727 layout parameter. Change all callers.
2728 (Symbol_table::do_add_undefined_symbols_from_command_line):
2729 Likewise. Break out loop body. Check symbols referenced by
2730 scripts.
2731 (Symbol_table::add_undefined_symbol_from_command_line): New
2732 function broken out of
2733 do_add_undefined_symbols_from_command_line.
2734 * symtab.h (class Symbol_table): Update declarations.
2735 * archive.cc: Include "layout.h".
2736 (Archive::should_include_member): Add layout parameter. Change
2737 all callers. Check for symbol mentioned in expression.
2738 * archive.h (class Archive): Update declaration.
2739 * object.cc (Sized_relobj::do_should_include_member): Add layout
2740 parameter.
2741 * object.h (Object::should_include_member): Add layout parameter.
2742 Change all callers.
2743 (Object::do_should_include_member): Add layout parameter.
2744 (class Sized_relobj): Update declaration.
2745 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2746 parameter.
2747 * dynobj.h (class Sized_dynobj): Update declaration.
2748 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2749 layout parameter.
2750 * plugin.h (class Sized_pluginobj): Update declaration.
2751
5f1ab67a
ILT
27522010-08-02 Ian Lance Taylor <iant@google.com>
2753
2754 PR 11866
2755 * output.cc (Output_segment::set_offset): Search for the first and
2756 last sections rather than assuming that the list is in order.
2757 (Output_segment::find_first_and_last_list): New function.
2758 * output.h (class Output_segment): Update declarations.
2759 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2760 (relro_strip_test_SOURCES): New variable.
2761 (relro_strip_test_DEPENDENCIES): New variable.
2762 (relro_strip_test_LDFLAGS): New variable.
2763 (relro_strip_test_LDADD): New variable.
2764 (relro_strip_test.so): New target.
2765
a8df5856
ILT
27662010-08-02 Ian Lance Taylor <iant@google.com>
2767
2768 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2769 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2770 (Target_i386::got_tlsdesc_section): New function.
2771 (Target_i386::got_section): Create space for GOT entries for
2772 TLSDESC relocations.
2773 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2774 R_386_TLS_GOTDESC.
2775 (Target_i386::Scan::global): Likewise.
2776 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2777 using TLSDESC GOT.
2778 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2779 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2780 (Target_x86_64::got_tlsdesc_section): New function.
2781 (Target_x86_64::got_section): Create space for GOT entries for
2782 TLSDESC relocations.
2783 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2784 R_386_TLS_GOTDESC.
2785 (Target_x86_64::Scan::global): Likewise.
2786 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2787 using TLSDESC GOT.
2788
0c10a0a6
ILT
27892010-08-02 Ian Lance Taylor <iant@google.com>
2790
2791 * testsuite/final_layout.sh: Use dc to convert from hex to
2792 decimal.
2793
41cbeecc
ST
27942010-07-29 Sriraman Tallam <tmsriram@google.com>
2795
2796 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2797 paramter to the call to gold::gc_process_relocs.
2798 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2799 paramter to the call to gold::gc_process_relocs.
2800 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2801 parameter to the call to gold::gc_process_relocs.
2802 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2803 template parameter to the call to gold::gc_process_relocs.
2804 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2805 paramter to the call to gold::gc_process_relocs.
2806 * gc.h (get_embedded_addend_size): New function.
2807 (gc_process_relocs): Save the size of the reloc for use by ICF.
2808 * icf.cc (get_section_contents): Get the addend from the text section
2809 for SHT_REL relocation sections.
2810 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2811 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2812 * int_encoding.h (read_from_pointer): New overloaded function.
2813 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2814 * testsuite/icf_sht_rel_addend_test.sh: New file.
2815 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2816 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2817
6ea55b82
RW
28182010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2819
2820 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2821 * Makefile.in: Regenerate.
2822 * testsuite/Makefile.in: Regenerate.
2823
9691462b
ILT
28242010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2825
2826 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2827 * gold/testsuite/debug_msg.cc: Likewise.
2828 * gold/testsuite/odr_violation1.cc
2829 * gold/testsuite/odr_violation2.cc
2830
76897331
CC
28312010-07-21 Cary Coutant <ccoutant@google.com>
2832
2833 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2834 string, and length fields.
2835 (Output_merge_string::Merged_strings_list): New type.
2836 (Output_merge_string::Merged_strings_lists): New typedef.
2837 (Output_merge_string): Replace merged_strings_ with
2838 merged_strings_lists_.
2839 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2840 Merged_strings_list per input object and section. Don't store pointer
2841 to the string. Don't store length with each merged string entry.
2842 (Output_merge_string::finalize_merged_data): Loop over list of merged
2843 strings lists. Recompute length of each merged string.
2844
78384e8f
CC
28452010-07-15 Cary Coutant <ccoutant@google.com>
2846
2847 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2848 here.
2849
783659f9
ILT
28502010-07-14 Ian Lance Taylor <iant@google.com>
2851
2852 * descriptors.cc (Descriptors::open): Report correct name in error
2853 message.
2854
131687b4
DK
28552010-07-13 Doug Kwan <dougkwan@google.com>
2856
2857 * arm.cc (Arm_input_section::Arm_input_section): For a
2858 SHT_ARM_EXIDX section, always keeps the input sections.
2859 (Arm_input_section::set_exidx_section_link): New method.
2860 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2861 has_errors_ to false.
2862 (Arm_exidx_input_section::has_errors,
2863 Arm_exidx_input_section::set_has_errors): New methods.
2864 (Arm_exidx_input_section::has_errors_): New data member.
2865 (Arm_relobj::get_exidx_shndx_list): New method.
2866 (Arm_output_section::append_text_sections_to_list): Do not skip
2867 section without SHF_EXECINSTR.
2868 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2869 errors.
2870 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2871 section header. Make error messages more verbose. Check for
2872 a non-executable section linked to an EXIDX section.
2873 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2874 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2875 check that there is no deferred EXIDX section if we exit early.
2876 Instead of not making an EXIDX section in case of an error, make one
2877 and set the has_errors flag of it.
2878 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2879 in a relocatable link.
2880 (Target_arm::do_relax): Look for the EXIDX output section instead of
2881 assuming that it is called .ARM.exidx.
2882 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2883 section list. Do not check for SHF_EXECINSTR section flags but
2884 skip any input section with errors.
2885 * output.cc (Output_section::Output_section): Initialize
2886 always_keeps_input_sections_ to false.
2887 (Output_section::add_input_section): Check for
2888 always_keeps_input_sections_.
2889 * output.h (Output_section::always_keeps_input_sections,
2890 Output_section::set_always_keeps_input_sections): New methods.
2891 (Output_section::always_keeps_input_sections): New data member.
2892
69517287
RÁE
28932010-07-13 Rafael Espindola <espindola@google.com>
2894
2895 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2896 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2897
82742395
ILT
28982010-07-13 Philip Herron <herron.philip@googlemail.com>
2899 Ian Lance Taylor <iant@google.com>
2900
2901 * output.h (Output_section_lookup_maps::add_merge_section):
2902 Correct check of whether value was inserted.
2903 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2904 (Output_section_lookup_maps::add_relaxed_input_section):
2905 Likewise.
2906 * arm.cc (Target_arm::got_section): Remove used local os.
2907 * i386.cc (Target_i386::got_section): Likewise.
2908 * x86_64.cc (Target_x86_64::got_section): Likewise.
2909 * sparc.cc (Target_sparc::got_section): Likewise.
2910 (Target_sparc::relocate): Remove unused local have_got_offset.
2911 * powerpc.cc (Target_powerpc::relocate): Likewise.
2912
f2d707b5
ILT
29132010-07-13 Ian Lance Taylor <iant@google.com>
2914
241531d6
ILT
2915 * compressed_output.cc (zlib_decompress): Fix signature in
2916 !HAVE_ZLIB_H case.
2917
f2d707b5
ILT
2918 * archive.cc (Archive::include_member): Unlock an external member
2919 of a thin archive. Don't bother to delete an object we know is
2920 NULL.
2921
a2e47362
CC
29222010-07-12 Cary Coutant <ccoutant@google.com>
2923
2924 * compressed_output.cc (zlib_decompress): New function.
2925 (get_uncompressed_size): New function.
2926 (decompress_input_section): New function.
2927 * compressed_output.h (get_uncompressed_size): New function.
2928 (decompress_input_section): New function.
2929 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2930 Handle compressed debug sections.
2931 * layout.cc (is_compressed_debug_section): New function.
2932 (Layout::output_section_name): Map compressed section names to
2933 canonical names.
2934 * layout.h (is_compressed_debug_section): New function.
2935 (is_debug_info_section): Recognize compressed debug sections.
2936 * merge.cc: Include compressed_output.h.
2937 (Output_merge_data::do_add_input_section): Handle compressed
2938 debug sections.
2939 (Output_merge_string::do_add_input_section): Handle compressed
2940 debug sections.
2941 * object.cc: Include compressed_output.h.
2942 (Sized_relobj::Sized_relobj): Initialize new data members.
2943 (build_compressed_section_map): New function.
2944 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2945 * object.h (Object::section_is_compressed): New method.
2946 (Object::do_section_is_compressed): New method.
2947 (Sized_relobj::Compressed_section_map): New type.
2948 (Sized_relobj::do_section_is_compressed): New method.
2949 (Sized_relobj::compressed_sections_): New data member.
2950 * output.cc (Output_section::add_input_section): Handle compressed
2951 debug sections.
2952 * reloc.cc: Include compressed_output.h.
2953 (Sized_relobj::write_sections): Handle compressed debug sections.
2954
ce279a62
CC
29552010-07-08 Cary Coutant <ccoutant@google.com>
2956
2957 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2958 weak when resolving to a dynamic def.
2959 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2960 for weak undef/dynamic def cases. Adjust callers.
2961 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2962 undef_binding_weak_.
2963 (Symbol_table::sized_write_globals): Adjust symbol binding.
2964 (Symbol_table::sized_write_symbol): Add binding parameter.
2965 * symtab.h (Symbol::set_undef_binding): New method.
2966 (Symbol::is_undef_binding_weak): New method.
2967 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2968 (Symbol_table::should_override): Add new parameter.
2969 (Symbol_table::sized_write_symbol): Add new parameter.
2970
2971 * testsuite/weak_undef_file1.cc: Add new test case.
2972 * testsuite/weak_undef_file2.cc: Fix header comment.
2973 * testsuite/weak_undef_test.cc: Add new test case.
2974
b2286c10
DK
29752010-06-29 Doug Kwan <dougkwan@google.com>
2976
2977 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2978 Initialize USE_SYMBOL_.
2979 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2980 definition.
2981 (Arm_reloc_property::uses_symbol_): New data member declaration.
2982 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2983 uses symbol value and symbol is undefined but not weakly undefined.
2984
4802450a
RÁE
29852010-06-28 Rafael Espindola <espindola@google.com>
2986
2987 * plugin.cc (Plugin::load): Use dlerror.
2988
e5ca47ba
ILT
29892010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2990
2991 * symtab.cc (detect_odr_violations): When reporting an ODR
2992 violation, report an object where the symbol is defined.
2993
8a75a161
DK
29942010-06-25 Doug Kwan <dougkwan@google.com>
2995
2996 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2997 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2998 definition.
2999 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3000 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3001 target hook to detect function points.
3002 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3003 * icf.h (Icf::check_section_for_function_pointers): Change type of
3004 parameter SECTION_NAME to const reference to std::string. Use
3005 target hook to determine if section may have unsafe pointers.
3006 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3007 method definition.
3008
42218b9f
RÁE
30092010-06-21 Rafael Espindola <espindola@google.com>
3010
3011 * fileread.cc (Input_file::find_fie): New
3012 (Input_file::open): Use Input_file::find_fie.
3013 * fileread.h (Input_file::find_fie): New
3014 * plugin.cc (set_extra_library_path): New.
3015 (Plugin::load): Add set_extra_library_path to the transfer vector.
3016 (Plugin_manager::set_extra_library_path): New.
3017 (Plugin_manager::add_input_file): Use the extra search path if set.
3018 (set_extra_library_path(): New.
3019 * plugin.h (Plugin_manager): Add set_extra_library_path and
3020 extra_search_path_.
3021
a0506cca
CC
30222010-06-19 Cary Coutant <ccoutant@google.com>
3023
3024 * layout.cc (gdb_sections): Add .debug_types.
3025 (lines_only_debug_sections): Likewise.
3026
6508b958
RÁE
30272010-06-18 Rafael Espindola <espindola@google.com>
3028
3029 * plugin.cc (add_input_file,add_input_library)
3030 (Plugin_manager::add_input_file): Make filename arguments const.
3031 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3032 const.
3033
3e235302
DK
30342010-06-16 Doug Kwan <dougkwan@google.com>
3035
3036 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3037 .ARM.attributes section if we have not merged any input
3038 attributes sections.
3039
106e8a6c
DK
30402010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3041
3042 * arm.cc: Allow combining objects with no EABI version
3043 information.
3044
91ff43fe
RÁE
30452010-06-15 Rafael Espindola <espindola@google.com>
3046
3047 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3048
68ed838c
ILT
30492010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3050
3051 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3052 (struct iovec): Correct !HAVE_READV definition.
3053
f3a2388f
CC
30542010-06-10 Cary Coutant <ccoutant@google.com>
3055
3056 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3057 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3058 reloc sections.
3059 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3060
3061 PR 11683
3062 * symtab.h (Symbol::is_placeholder): New member function.
3063 * target-reloc.h (relocate_section): Check for placeholder symbols.
3064
3065 * testsuite/Makefile.am (plugin_test_8): New test.
3066 (plugin_test_9): New test.
3067 * testsuite/Makefile.in: Regenerate.
3068
e1df38aa
NC
30692010-06-09 Nick Clifton <nickc@redhat.com>
3070
3071 * yyscript.y (input_list_element): Allow strings prefixed with
3072 the '-' character. Treat these as libraries.
3073 * script.cc (script_add_library): New function. Adds a library
3074 specified by "-l<name>" found in an input script.
3075 * script-c.h: Add prototype for script_add_library.
3076
25bbe950
DK
30772010-06-07 Doug Kwan <dougkwan@google.com>
3078
3079 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3080 Restrict stub-group size to be within long conditional branch
3081 range when working around cortex-A8 erratum.
3082
0f32ea4c
ILT
30832010-06-07 Damien Diederen <dd@crosstwine.com>
3084
3085 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3086 #ifdef typo.
3087
8fe2a369
ST
30882010-06-03 Sriraman Tallam <tmsriram@google.com>
3089
3090 PR gold/11658
3091 * output.cc
3092 (Output_section::Input_section_sort_entry::compare_section_ordering):
3093 Change to return non-zero correctly.
3094 (Output_section::Input_section_sort_section_order_index_compare
3095 ::operator()): Change to fix ambiguity in comparisons.
3096
6e9ba2ca
ST
30972010-06-01 Sriraman Tallam <tmsriram@google.com>
3098
3099 * gold.h (is_wildcard_string): New function.
3100 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3101 (Layout::layout_eh_frame): Ditto.
3102 (Layout::find_section_order_index): New method.
3103 (Layout::read_layout_from_file): New method.
3104 * layout.h (Layout::find_section_order_index): New method.
3105 (Layout::read_layout_from_file): New method.
3106 (Layout::input_section_position_): New private member.
3107 (Layout::input_section_glob_): New private member.
3108 * main.cc (main): Call read_layout_from_file here.
3109 * options.h (--section-ordering-file): New option.
3110 * output.cc (Output_section::input_section_order_specified_): New
3111 member.
3112 (Output_section::Output_section): Initialize new member.
3113 (Output_section::add_input_section): Add new parameter.
3114 Keep input sections when --section-ordering-file is used.
3115 (Output_section::set_final_data_size): Sort input sections when
3116 section ordering file is specified.
3117 (Output_section::Input_section_sort_entry): Add new parameter.
3118 Check sorting type.
3119 (Output_section::Input_section_sort_entry::compare_section_ordering):
3120 New method.
3121 (Output_section::Input_section_sort_compare::operator()): Change to
3122 consider section_order_index.
3123 (Output_section::Input_section_sort_init_fini_compare::operator()):
3124 Change to consider section_order_index.
3125 (Output_section::Input_section_sort_section_order_index_compare
3126 ::operator()): New method.
3127 (Output_section::sort_attached_input_sections): Change to sort
3128 according to section order when specified.
e1df38aa
NC
3129 (Output_section::add_input_section<32, true>): Add new parameter.
3130 (Output_section::add_input_section<64, true>): Add new parameter.
3131 (Output_section::add_input_section<32, false>): Add new parameter.
3132 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
3133 * output.h (Output_section::add_input_section): Add new parameter.
3134 (Output_section::input_section_order_specified): New
3135 method.
3136 (Output_section::set_input_section_order_specified): New method.
3137 (Input_section::Input_section): Initialize section_order_index_.
3138 (Input_section::section_order_index): New method.
3139 (Input_section::set_section_order_index): New method.
3140 (Input_section::section_order_index_): New member.
3141 (Input_section::Input_section_sort_section_order_index_compare): New
3142 struct.
3143 (Output_section::input_section_order_specified_): New member.
3144 * script-sections.cc (is_wildcard_string): Delete and move modified
3145 method to gold.h.
3146 (Output_section_element_input::Output_section_element_input): Modify
3147 call to is_wildcard_string.
3148 (Output_section_element_input::Input_section_pattern
3149 ::Input_section_pattern): Ditto.
3150 (Output_section_element_input::Output_section_element_input): Ditto.
3151 * testsuite/Makefile.am (final_layout): New test case.
3152 * testsuite/Makefile.in: Regenerate.
3153 * testsuite/final_layout.cc: New file.
3154 * testsuite/final_layout.sh: New file.
3155
3537c84b
RÁE
31562010-06-01 Rafael Espindola <espindola@google.com>
3157
3158 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3159
105b6afd
RÁE
31602010-06-01 Rafael Espindola <espindola@google.com>
3161
3162 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3163 visibility of symbols.
3164
29e11421
DK
31652010-05-27 Doug Kwan <dougkwan@google.com>
3166
3167 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3168 from start of output section instead of address for a local symbol
3169 in a merged or relaxed section when doing a relocatable link.
3170
5e0f337e
RÁE
31712010-05-26 Rafael Espindola <espindola@google.com>
3172
3173 PR 11604
3174 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3175 adding sections the garbage collector removed.
3176 * gold/testsuite/Makefile.am: Add test.
3177 * gold/testsuite/Makefile.in: Regenerate.
3178 * gold/testsuite/plugin_test_7.sh: New.
3179 * gold/testsuite/plugin_test_7_1.c: New.
3180 * gold/testsuite/plugin_test_7_2.c: New.
3181
f4187277
RÁE
31822010-05-26 Rafael Espindola <espindola@google.com>
3183
3184 * script-sections.cc (Output_section_definition::set_section_addresses):
3185 Check for --section-start.
3186
5c388529
DK
31872010-05-26 Doug Kwan <dougkwan@google.com>
3188
3189 * arm.cc (Arm_scan_relocatable_relocs): New class.
3190 (Target_arm::relocate_special_relocatable): New method.
3191 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3192 (Arm_relocate_functions::thumb_branch_common): Same.
3193 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3194 instead of Default_scan_relocatable_relocs.
3195 * target-reloc.h (relocate_for_relocatable): Let target handle
3196 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3197 * target.h (Sized_target::relocate_special_relocatable): New method.
3198
bca1c3ae
ILT
31992010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3200
3201 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3202
0439c796
DK
32032010-05-23 Doug Kwan <dougkwan@google.com>
3204
3205 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3206 instead of a cast.
3207 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3208 with a direct branch, not a conditional branch, to a stub.
3209 * merge.cc (Output_merge_base::record_input_section): New method
3210 defintion.
3211 (Output_merge_data::do_add_input_section): Record input section if
3212 keeps-input-sections flag is set.
3213 (Output_merge_string::do_add_input_section): Ditto.
3214 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3215 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3216 INPUT_SECTIONS_.
3217 (Output_merge_base::keeps_input_sections,
3218 Output_merge_base::set_keeps_input_sections,
3219 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3220 method definitions.
3221 (Output_merge_base::Input_sections): New type declaration.
3222 (Output_merge_base::input_sections_begin,
3223 Output_merge_base::input_sections_end,
3224 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3225 (Output_merge_base::bool keeps_input_sections_,
3226 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3227 Output_merge_base::input_sections_): New data members.
3228 (Output_merge_data::do_set_keeps_input_sections): New method
3229 defintion.
3230 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3231 * output.cc (Output_section::Input_section::relobj): Move method
3232 defintion from class declaration to here and handle merge sections.
3233 (Output_section::Input_section::shndx): Ditto.
3234 (Output_section::Output_section): Remove initializations of removed
3235 data members and initialize new data member LOOKUP_MAPS_.
3236 (Output_section::add_input_section): Set keeps-input-sections flag
3237 for a newly created merge output section as appropriate. Adjust code
3238 to use Output_section_lookup_maps class.
3239 (Output_section::add_relaxed_input_section): Adjst code for lookup
3240 maps code refactoring.
3241 (Output_section::add_merge_input_section): Add a new parameter
3242 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3243 class. If adding input section to a newly created merge output
3244 section fails, remove the new merge section.
3245 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 3246 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
3247 (Output_section::find_merge_section): Ditto.
3248 (Output_section::build_lookup_maps): New method defintion.
3249 (Output_section::find_relaxed_input_section): Adjust code to use
3250 Output_section_lookup_maps class.
3251 (Output_section::get_input_sections): Export merge sections. Adjust
3252 code to use Output_section_lookup_maps class.
3253 (Output_section:::add_script_input_section): Adjust code to use
3254 Output_section_lookup_maps class. Update lookup maps for merge
3255 sections also.
3256 (Output_section::discard_states): Use Output_section_lookup_maps.
3257 (Output_section::restore_states): Same.
3258 * output.h (Merge_section_properties): Move class defintion out of
3259 Output_section.
3260 (Output_section_lookup_maps): New class.
3261 (Output_section::Input_section::is_merge_section): New method
3262 defintion.
3263 (Output_section::Input_section::relobj): Move defintion out of class
3264 defintion. Declare method only.
3265 (Output_section::Input_section::shndx): Ditto.
3266 (Output_section::Input_section::output_merge_base): New method defintion.
3267 (Output_section::Input_section::u2_.pomb): New union field.
3268 (Output_section::Merge_section_by_properties_map,
3269 Output_section::Output_section_data_by_input_section_map,
3270 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3271 Remove types.
3272 (Output_section::add_merge_input_section): Add new parameter
3273 KEEPS_INPUT_SECTIONS.
3274 (Output_section::build_lookup_maps): New method declaration.
3275 (Output_section::merge_section_map_,
3276 Output_section::merge_section_by_properties_map_,
3277 Output_section::relaxed_input_section_map_,
3278 Output_section::is_relaxed_input_section_map_valid_): Remove data
3279 members.
3280 (Output_section::lookup_maps_): New data member.
3281
76295588
L
32822010-05-21 Doug Kwan <dougkwan@google.com>
3283
3284 PR gold/11619
3285 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3286 avoid a compilation error.
3287
d103a984
RÁE
32882010-05-19 Rafael Espindola <espindola@google.com>
3289
3290 * script-sections.cc (Output_section_definition::allocate_to_segment):
3291 Update the phdrs_list even when the output section is NULL.
3292 * testsuite/Makefile.am: Add test.
3293 * testsuite/Makefile.in: Regenerate.
3294 * testsuite/script_test_9.cc: New.
3295 * testsuite/script_test_9.sh: New.
3296 * testsuite/script_test_9.t: New.
3297
6625d24e
DK
32982010-05-19 Doug Kwan <dougkwan@google.com>
3299
3300 * arm.cc (Arm_input_section::original_size): New method.
3301 (Arm_input_section::do_addralign): Add a cast.
3302 (Arm_input_section::do_output_offset): Remove static cast.
3303 (Arm_input_section::original_addralign,
3304 Arm_input_section::original_size_): Change type to uint32_t.
3305 (Arm_input_section::init): Add safe casts for section alignment
3306 and size.
3307 (Arm_input_section::set_final_data_size): Do not set address and
3308 offset of stub table.
3309 (Arm_output_section::fix_exidx_coverage): Change use of of
3310 Output_section::Simple_input_section to that of
3311 Output_section::Input_section.
3312 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3313 except for the first pass.
3314 * output.cc (Output_section::get_input_sections): Change type of
3315 input_sections to std::list<Input_section>.
3316 (Output_section::add_script_input_section): Rename from
3317 Output_section::add_simple_input_section. Change type of SIS
3318 parameter from Simple_input_section to Input_section.
3319 * output.h (Output_section::Simple_input_section): Remove class.
3320 (Output_section::Input_section): Change class visibility to public.
3321 (Output_section::Input_section::addralign): Use stored alignments
3322 for special input sections if set.
3323 (Output_section::Input_section::set_addralign): New method.
3324 (Output_section::get_input_sections): Change parameter type from
3325 list of Simple_input_section to list of Input_section.
3326 (Output_section::add_script_input_section): Rename from
3327 Output_section::add_simple_input_section. Change first parameter's
3328 type from Simple_input_section to Input_section and remove the
3329 second and third parameters.
3330 * script-sections.cc (Input_section::Input_section_list): Change
3331 type to list of Output_section::Input_section/
3332 (Input_section_info::Input_section_info): Change parameter type of
3333 INPUT_SECTION to Output_section::Input_section.
3334 (Input_section_info::input_section): Change return type.
3335 (Input_section_info::input_section_): Change type to
3336 Output_section::Input_section.
3337 (Output_section_element_input::set_section_addresses): Adjust code
3338 to use Output_section::Input_section instead of
3339 Output_section::Simple_input_section. Adjust code for renaming
3340 of Output_section::add_simple_input_section.
3341 (Orphan_output_section::set_section_addresses): Ditto.
3342
e1e82ea4
RW
33432010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3344
3345 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3346 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3347
91e75c8a
RÁE
33482010-05-18 Rafael Espindola <espindola@google.com>
3349
3350 * options.cc (General_options::finalize): Handle -nostdlib.
3351 * options.h (nostdlib): New option.
3352 * script.cc (script_add_search_dir): Handle -nostdlib.
3353
da59ad79
DK
33542010-05-12 Doug Kwan <dougkwan@google.com>
3355
3356 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3357 attributes section only if there no attributes section after merging.
3358 (Target_arm::merge_object_attributes): Move value of
e1df38aa 3359 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
3360 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3361 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3362 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3363 and arm_attr_merge_7.stdout.
3364 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3365 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3366 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3367 arm_attr_merge_7b.o): New rules.
3368 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3369 arm_attr_merge_7
3370 * testsuite/Makefile.in: Regenerate.
3371 * testsuite/arm_attr_merge.sh: New file.
3372 * testsuite/arm_attr_merge_[67][ab].s: Same.
3373
3e01a7fd
NC
33742010-05-05 Nick Clifton <nickc@redhat.com>
3375
3376 * po/es.po: Updated Spanish translation.
3377
7ad2014a
L
33782010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3379
3380 * Makefile.am (install-exec-local): Properly install gold as
3381 default cross linker.
3382 * Makefile.in: Regenerated.
3383
4fda8867
NC
33842010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3385 Nick Clifton <nickc@redhat.com>
3386
3387 * configure.ac (install_as_default): Define and set to false
3388 unless --enable-gold or --enable-gold=both/gold has been
3389 specified.
3390 * configure: Regenerate.
3391
3392 * Makefile.am (install-exec-local): Install the executable as
3393 'ld.gold'. If install_as_default is true then also install it as
3394 'ld'.
3395 * Makefile.in: Regenerated.
3396
bd288ea2
ILT
33972010-04-24 Ian Lance Taylor <iant@google.com>
3398
3399 * layout.cc (Layout::layout_reloc): In relocatable link don't
3400 combine reloc sections for grouped sections.
3401
ef38fd8a
ST
34022010-04-23 Sriraman Tallam <tmsriram@google.com>
3403
3404 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3405 sections that are not ordinary to icf.
3406 * icf.cc (get_section_contents): Handle relocation pointing to section
3407 with no object or shndx information.
3408 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3409 * testsuite/Makefile.in: Regenerate.
3410 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3411 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3412
f6973bdc
ILT
34132010-04-22 Ian Lance Taylor <iant@google.com>
3414
3415 * expression.cc (Expression::Expression_eval_info): Add
3416 result_alignment_pointer field.
3417 (Expression::eval_with_dot): Add result_alignment_pointer
3418 parameter. Change all callers.
3419 (Expression::eval_maybe_dot): Likewise.
3420 (class Binary_expression): Add alignment_pointer parameter to
3421 left_value and right_value. Change all callers.
3422 (BINARY_EXPRESSION): Set result alignment.
3423 (class Trinary_expression): Add alignment_pointer parameter to
3424 arg2_value and arg3_value. Change all callers.
3425 (Trinary_cond::value): Set result alignment.
3426 (Max_expression::value, Min_expression::value): Likewise.
3427 (Align_expression::value): Likewise.
3428 * script-sections.cc (class Sections_element): Add dot_alignment
3429 parameter to set_section_addresses virtual function. Update
3430 instantiations.
3431 (class Output_section_element): Likewise.
3432 (Script_sections::create_segments): Add dot_alignment parameter.
3433 Change all callers.
3434 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3435 (Script_sections::set_phdrs_clause_addresses): Likewise.
3436 * script-sections.h: Update declarations.
3437 * script.h: Update declarations.
3438 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3439 min_p_align.
3440 * testsuite/script_test_3.t: Set large alignment.
3441 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3442 segment has expected alignment.
3443
9c9c98a5
NC
34442010-04-22 Nick Clifton <nickc@redhat.com>
3445
3446 * po/gold.pot: Updated by the Translation project.
3447 * po/vi.po: Updated Vietnamese translation.
3448
2253bfba
L
34492010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3450
3451 * testsuite/Makefile.am (check_PROGRAMS): Add
3452 icf_virtual_function_folding_test.
3453 * testsuite/Makefile.in: Regenerated.
3454
85fdf906
AH
34552010-04-15 Andrew Haley <aph@redhat.com>
3456
3457 * options.h (merge_exidx_entries): New option.
3458 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3459 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3460 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3461 (Target_arm::merge_exidx_entries): New function.
3462 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3463 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3464 to Arm_exidx_fixup constructor.
3465 Add new arg, merge_exidx_entries.
3466 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3467 Arm_output_section::fix_exidx_coverage.
3468
ce97fa81
ST
34692010-04-18 Sriraman Tallam <tmsriram@google.com>
3470
3471 * icf.cc (get_section_contents): Check for preemptible functions.
3472 Ignore addend when appropriate.
3473 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3474 section folded.
3475 (add_from_relobj): Check for section folded.
3476 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3477 * symtab.h (should_add_dynsym_entry): Add new parameter.
3478 * target-reloc.h (scan_relocs): Check for section folded.
3479 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3480 Check reloc types for function pointers in shared objects.
3481 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3482 case.
3483 (icf_preemptible_functions_test): New test case.
3484 (icf_string_merge_test): New test case.
3485 * testsuite.Makefile.in: Regenerate.
3486 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3487 bar_glob. Refactor code.
3488 * testsuite/icf_preemptible_functions_test.cc: New file.
3489 * testsuite/icf_preemptible_functions_test.sh: New file.
3490 * testsuite/icf_string_merge_test.cc: New file.
3491 * testsuite/icf_string_merge_test.sh: New file.
3492 * testsuite/icf_virtual_function_folding_test.cc: New file.
3493 * testsuite/icf_virtual_function_folding_test.sh: New file.
3494
04ceb17c
DK
34952010-04-14 Doug Kwan <dougkwan@google.com>
3496
3497 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3498 for local symbol recounting if we remove a section due to ICF.
3499 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3500 there are no regular objects in input.
3501
153e7da4
DK
35022010-04-13 Doug Kwan <dougkwan@google.com>
3503
3504 * arm.cc (Arm_input_section::set_final_data_size): Compute
3505 accurate final data size instead of using current data size.
3506
4dbd9faf
DK
35072010-04-09 Doug Kwan <dougkwan@google.com>
3508
3509 * layout.cc (Layout::choose_output_section): Handle script section
3510 types.
3511 (Layout::make_output_section_for_script): Add section type parameter.
3512 Handle script section types.
3513 * layout.h (Layout::make_output_section_for_script): Add section
3514 type parameter.
3515 * output.cc (Output_section::Output_section): Initialize data member
3516 is_noload_.
3517 (Output_section::do_reset_address_and_file_offset): Do not set address
3518 to 0 if section is a NOLOAD section.
3519 * output.h (Output_section::is_noload): New method.
3520 (Output_section::set_is_noload): Ditto.
3521 (Output_section::is_noload_): New data member.
3522 * script-c.h (Script_section_type): New enum type.
3523 (struct Parser_output_section_header): Add new file section_type.
3524 * script-sections.cc (Sections_element::output_section_name): Add
3525 parameter for returning script section type.
3526 (Output_section_definition::output_section_name): Ditto.
3527 (Output_section_definition::section_type)P; New method.
3528 (Output_section_definiton::script_section_type_name): Ditto.
3529 (Output_section_definition::script_section_type_): New data member.
3530 (Output_section_definition::Output_section_definition): Initialize
3531 data member Output_section_definition::script_section_type_.
3532 (Output_section_definition::create_sections): Pass script section type
3533 to Layout::make_output_section_for_script.
3534 (Output_section_definition::output_section_name): Return script
3535 section type to caller.
3536 (Output_section_definition::set_section_address): Do not advance
3537 dot value and load address if section type is NOLOAD. Set address
3538 of NOLOAD sections regardless of section flags.
3539 (Output_section_definition::print): Print section type if it is
3540 not SCRIPT_SECTION_TYPE_NONE.
3541 (Output_section_definition::section_type): New method.
3542 (Output_section_definition::script_section_type_name): Ditto.
3543 (Script_sections::output_section_name): Add new parameter
3544 PSECTION_TYPE for returning script section type. Pass it to
3545 section elements. Handle discard sections.
3546 (Sort_output_sections::operator()): Handle NOLOAD sections.
3547 * script-sections.h (Script_sections::Section_type): New enum type.
3548 (Script_sections::output_section_name): Add a new parameter for
3549 returning script section type.
3550 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3551 INFO and NOLOAD.
3552 * yyscript.y (union): Add new field SECTION_TYPE.
3553 (COPY, DSECT, INFO, NOLOAD): New tokens.
3554 (opt_address_and_section_type): Change type to output_section_header.
3555 (section_type): New non-terminal
3556 (section_header): Handle section type.
2253bfba 3557 (opt_address_and_section_type): Return section type value.
4dbd9faf 3558
721ea635
L
35592010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3560
3561 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3562 * testsuite/plugin_common_test_2.c (foo): Likewise.
3563
6bf924b0
DK
35642010-04-08 Doug Kwan <dougkwan@google.com>
3565
3566 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3567 Output_merge_data.
3568 * output.cc (Output_section::add_merge_input_section): Simplify
3569 code and return status of Output_merge_base::add_input_section.
e1df38aa 3570 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
3571 returns true.
3572
24af6f92
DK
35732010-04-07 Doug Kwan <dougkwan@google.com>
3574
3575 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3576 if section is marked as containing instructions but has no mapping
3577 symbols.
3578 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3579 correct section index.
3580 (Arm_relobj::find_linked_text_section): Ditto.
3581
00698fc5
CC
35822010-04-07 Cary Coutant <ccoutant@google.com>
3583
3584 * archive.cc (include_member): Destroy Read_symbols_data object before
3585 releasing file.
3586 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3587 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3588 (Read_symbols_data::~Read_symbols_data) New destructor.
3589 (Section_relocs::Section_relocs) New constructor.
3590 (Section_relocs::~Section_relocs) New destructor.
3591 (Read_relocs_data::Read_relocs_data) New constructor.
3592 (Read_relocs_data::~Read_relocs_data) New destructor.
3593 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3594 pointers to NULL after deleting.
3595
7296d933
DK
35962010-04-07 Doug Kwan <dougkwan@google.com>
3597
3598 * arm.cc: Replace "endianity" with "endianness" in comments.
3599 (Arm_exidx_cantunwind): Ditto.
3600 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3601 (Arm_relobj::merge_flags_and_attributes): New method.
3602 (Arm_relobj::merge_flags_and_attributes_): New data member.
3603 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3604 (Arm_relobj::scan_sections_for_stubs): Ditto.
3605 (Arm_relobj::do_read_symbols): Check to see if we really want to
3606 merge processor-specific flags and attributes. Exit early if
3607 an object is empty except for section names and the undefined symbol.
3608 (Target_arm::do_finalize_sections): Move check for ELF format to
3609 Arm_relobj::do_read_symbols. Merge processor specific flags and
3610 attributes from a regular object only when we have determined that
3611 it is aapropriate. Do not create an .ARM.attributes section in
3612 output if there is no regular input object.
3613 (Target_arm::merge_processor_specific_flags): Check
3614 --warn-mismatch before printing any error.
3615 (Target_arm::merge_object_attributes): Ditto.
3616 * gold.cc (queue_middle_tasks): Handle the case in which there is
3617 no regular object in input.
3618 * options.cc (General_options::parse_EB): New method.
3619 (General_options::parse_EL): Same.
3620 (General_options::General_options): Initialize endianness_.
3621 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3622 New options.
3623 (General_options::Endianness): New enum.
3624 (General_options::endianness): New method.
3625 (General_options::endianness_): New data member.
3626 * parameters.cc (Parameters::set_options): Check target endianness.
3627 (Parameters::set_target_once): Ditto.
3628 (Parameters::check_target_endianness): New method.
3629 (parameters_force_valid_target): If either -EL or -EB is specified,
3630 use it to define endianness of default target.
3631 * parameters.h (Parameters::check_target_endianness): New method
3632 declaration.
3633 * target.h (class Target): Change "endianity" to "endianness"
3634 in comments.
3635
efc8d4f2
RW
36362010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3637
3638 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3639 * configure: Regenerate.
3640 * Makefile.in: Regenerate.
3641 * testsuite/Makefile.in: Regenerate.
3642
be234d88
CC
36432010-04-06 Cary Coutant <ccoutant@google.com>
3644
3645 gcc PR lto/42757
3646 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3647 prevailing definitions of common symbols.
3648 * testsuite/plugin_test_6.sh: New test case.
3649 * testsuite/plugin_common_test_1.c: New test case.
3650 * testsuite/plugin_common_test_2.c: New test case.
3651 * testsuite/Makefile.am (plugin_test_6): New test case.
3652 * testsuite/Makefile.in: Regenerate.
3653
bd32c6bd
NC
36542010-04-06 Nick Clifton <nickc@redhat.com>
3655
3656 * po/vi.po: New Vietnamese translation.
3657
323c532f
DK
36582010-03-30 Doug Kwan <dougkwan@google.com>
3659
3660 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3661
4fcd97eb
DK
36622010-03-25 Doug Kwan <dougkwan@google.com>
3663
3664 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3665 to avoid a conversion warning on a 32-bit host.
3666
4ebf39db
ILT
36672010-03-24 Ian Lance Taylor <iant@google.com>
3668
3669 * testsuite/script_test_3.t: Add a TLS segment.
3670 * testsuite/Makefile.am (check_PROGRAMS): Add
3671 tls_phdrs_script_test.
3672 (tls_phdrs_script_test_SOURCES): Define.
3673 (tls_phdrs_script_test_DEPENDENCIES): Define.
3674 (tls_phdrs_script_test_LDFLAGS): Define.
3675 (tls_phdrs_script_test_LDADD): Define.
3676 * testsuite/Makefile.in: Rebuild.
3677
4a599bdd
CC
36782010-03-23 Cary Coutant <ccoutant@google.com>
3679
3680 * fileread.cc (find_or_make_view): Fix comment.
3681
6c93b22c
ILT
36822010-03-23 Ian Lance Taylor <iant@google.com>
3683
3684 * script-sections.cc (class Orphan_section_placement): Define
3685 PLACE_TLS and PLACE_TLS_BSS.
3686 (Orphan_section_placement::Orphan_section_placement): Initialize
3687 new places.
3688 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3689 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3690 (tls_script_test_SOURCES): Define.
3691 (tls_script_test_DEPENDENCIES): Define.
3692 (tls_script_test_LDFLAGS): Define.
3693 (tls_script_test_LDADD): Define.
3694 * testsuite/Makefile.in: Rebuild.
3695
a2c7281b
DK
36962010-03-22 Doug Kwan <dougkwan@google.com>
3697
3698 * arm.cc (Arm_relocate_functions::abs8,
3699 Arm_relocate_functions::abs16): Use correct check for overflow
3700 specified in the ARM ELF specs.
3701 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3702 target of a BLX instruction specially.
3703 (Reloc_stub::stub_type_for_reloc): Ditto.
3704 (Relocate::relocate): Use symbolic names instead of numeric relocation
3705 codes to report error.
3706 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3707 workaround.
3708 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3709 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3710 thumb2_blx_out_of_range.stdout
3711 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3712 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3713 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3714 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3715 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3716 thumb2_blx_in_range, thumb2_blx_in_range.o,
3717 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3718 thumb2_blx_out_of_range.o): New rules.
3719 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3720 thumb2_blx_in_range and thumb2_blx_out_of_range.
3721 * testsuite/Makefile.in: Regenerate.
3722 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3723 * testsuite/thumb_blx_in_range.s: New file.
3724 * testsuite/thumb_blx_out_of_range.s: New file.
3725
b0193076
RÁE
37262010-03-22 Rafael Espindola <espindola@google.com>
3727
3728 * archive.cc (Should_include): Move to archive.h.
3729 (should_include_member): Make it a member of Archive.
3730 (Lib_group): New.
3731 (Add_lib_group_symbols): New.
3732 * archive.h: Include options.h.
3733 (Archive_member): Moved from Archive.
3734 (Should_include): Moved from archive.cc.
3735 (Lib_group): New.
3736 (Add_lib_group_symbols): New.
3737 * dynobj.cc (do_should_include_member): New.
3738 * dynobj.h (do_should_include_member): New.
3739 * gold.cc (queue_initial_tasks): Update call to queue.
3740 * main.cc (main): Print lib group stats.
3741 * object.cc (do_should_include_member): New.
3742 * object.h: Include archive.h.
3743 (Object::should_include_member): New.
3744 (Object::do_should_include_member): New.
3745 (Sized_relobj::do_should_include_member): New.
3746 * options.cc (General_options::parse_start_lib): New.
3747 (General_options::parse_end_lib): New.
3748 (Input_arguments::add_file): Handle lib groups.
3749 (Input_arguments::start_group): Check we are not in a lib.
3750 (Input_arguments::start_lib): New.
3751 (Input_arguments::end_lib): New.
3752 * options.h (General_options): Add start_lib and end_lib.
3753 (Input_argument::lib_): New.
3754 (Input_argument::lib): New.
3755 (Input_argument::is_lib): New.
3756 (Input_file_lib): New.
3757 (Input_arguments::in_lib_): New.
3758 (Input_arguments::in_lib): New.
3759 (Input_arguments::start_lib): New.
3760 (Input_arguments::end_lib_): New.
3761 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3762 in unused members as preempted.
3763 (Sized_pluginobj::do_should_include_member): New.
3764 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3765 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3766 return the blocker.
3767 (Read_symbols::do_whole_lib_group): New.
3768 (Read_symbols::do_lib_group): New.
3769 (Read_symbols::do_read_symbols): Handle lib groups.
3770 (Read_symbols::get_name): Handle lib groups.
3771 * readsyms.h (Read_symbols): Add an archive member pointer.
3772 (Read_symbols::do_whole_lib_group): New.
3773 (Read_symbols::do_lib_group): New.
3774 (Read_symbols::member_): New.
3775 * script.cc (read_input_script): Update call to queue_soon.
3776
d099120c
DK
37772010-03-19 Doug Kwan <dougkwan@google.com>
3778
3779 * arm.cc (Stub_table::Stub_table): Initialize new data members
3780 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3781 (Stub_table::add_reloc_stub): Assign stub offset and update
3782 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3783 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3784 New data members.
3785 (Stub_table::update_data_size_and_addralign): Use
3786 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3787 instead of going over all reloc stubs.
3788 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3789 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3790 Stringpool_template::offset_ to size of Stringpool_char.
3791 (Stringpool_template::new_key_offset): Remove code to initialize
3792 Stringpool_template::offset_.
3793 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3794 Stringpool_template::offset_ to zero.
3795
1aa37384
DK
37962010-03-15 Doug Kwan <dougkwan@google.com>
3797
3798 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3799 offset_.
3800 (Stringpool_template::new_key_offset): New method.
3801 (Stringpool_template::add_string): Assign offsets when adding new
3802 strings.
3803 (Stringpool_template::set_string_offsets): Do not set string offsets
3804 when not optimizing.
3805 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3806 member size_.
3807 (Chunked_vector::clear): Clear size_.
3808 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3809 (Chunked_vector::size): Return size_.
3810 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 3811 (Chunked_vector::size_): New data member.
1aa37384
DK
3812 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3813 (Stringpool_template::new_key_offset): New method declaration.
3814 (Stringpool_template::offset_): New data member.
3815
b672b057
RÁE
38162010-03-15 Rafael Espindola <espindola@google.com>
3817
3818 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3819 Add_symbols' constructor.
3820 * readsyms.h (Add_symbols): Remove the input_group member.
3821
b6848d3c
ILT
38222010-03-10 Ian Lance Taylor <iant@google.com>
3823
3824 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3825 target to ask whether a reference to a symbol requires a stack
3826 split.
3827 * target.h (Target::is_call_to_non_split): New function.
3828 (Target::do_is_call_to_non_split): Declare virtual function.
3829 * target.cc: Include "symtab.h".
3830 (Target::do_is_call_to_non_split): New function.
3831 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3832
a2a5469e
CC
38332010-03-10 Cary Coutant <ccoutant@google.com>
3834
3835 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3836 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3837 (File_read::open[2]): Add whole_file_view_ to list of views.
3838 (File_read::make_view): Remove test of whole_file_view_.
3839 (File_read::find_or_make_view): Create whole_file_view_ if
3840 necessary.
3841 (File_read::clear_views): Replace bool parameter with enum;
3842 adjust all callers. Don't delete views with permanent data;
3843 do delete cached views and views from archives if
3844 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3845 if clearing the corresponding view.
3846 * fileread.h (File_read::Clear_views_mode): New enum.
3847 (File_read::View::is_permanent_view): New method.
3848 (File_read::clear_views): Replace bool parameter
3849 with enum; adjust all callers.
3850 * options.h (General_options): Change keep_files_mapped option;
3851 add map_whole_files.
3852 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3853 releasing the file.
3854 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3855 the file.
3856
8861f32b
DM
38572010-03-10 David S. Miller <davem@davemloft.net>
3858
3859 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3860
d62d0f5f
ST
38612010-03-09 Sriraman Tallam <tmsriram@google.com>
3862
3863 * icf.cc (get_section_contents): Add '@' marker after processing the
3864 merge reloc.
3865
9177756d
DK
38662010-03-08 Doug Kwan <dougkwan@google.com>
3867
3868 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3869 due to a conversion warning.
3870 (Arm_relobj::update_output_local_symbol_count): Check for local
3871 symbol with unset output index.
3872
9e9e071b
ILT
38732010-03-05 Ian Lance Taylor <iant@google.com>
3874
3875 * options.h (class General_options): Add --spare-dynamic-tags.
3876 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3877 --spare-dynamic-tags.
3878
a81ee015
ILT
38792010-03-05 Ian Lance Taylor <iant@google.com>
3880
3881 * incremental.cc: Include "libiberty.h".
3882
44ec90b9
RO
38832010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3884
3885 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3886 function, is_info_ member.
3887 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3888 (Versions::Versions): Update caller.
3889 (Versions::define_base_version): Likewise.
3890 (Versions::add_def): Likewise.
3891
0897ed3b
ST
38922010-03-03 Sriraman Tallam <tmsriram@google.com>
3893
3894 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3895 (Scan::possible_function_pointer_reloc): New function.
3896 (Scan::local_reloc_may_be_function_pointer): Change to call
3897 possible_function_pointer_reloc.
3898 (Scan::global_reloc_may_be_function_pointer): Ditto.
3899 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3900 relocations in ".data.rel.ro._ZTV" section.
3901 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3902 * testsuite/icf_safe_so_test.cc: Ditto.
3903 * testsuite/icf_safe_test.cc: Ditto.
3904 * testsuite/icf_safe_test.sh: Ditto.
3905
d3bbad62
ILT
39062010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3907 Ian Lance Taylor <iant@google.com>
3908
3909 * target-reloc.h (relocate_section): Check the symbol table index
3910 for -1U before setting the local symbol index.
3911 (scan_relocatable_relocs): If copying the relocation, record that
3912 the local symbol is required.
3913 * object.h (Symbol_value::is_output_symtab_index_set): New
3914 function.
3915 (Symbol_value::may_be_discarded_from_output_symtab): New
3916 function.
3917 (Symbol_value::has_output_symtab_entry): New function.
3918 (Symbol_value::needs_output_symtab_entry): Remove.
3919 (Symbol_value::output_symtab_index): Make sure the symbol index is
3920 set.
3921 (Symbol_value::set_output_symtab_index): Make sure the symbol
3922 index is not set. Make sure the new index is valid.
3923 (Symbol_value::set_must_have_output_symtab_entry): New function.
3924 (Symbol_value::has_output_dynsym_entry): New function.
3925 (Symbol_value::set_output_dynsym_index): Make sure the new index
3926 is valid.
3927 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3928 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3929 local symbol if permitted.
3930 (Sized_relobj::do_finalize_local_symbols): Call
3931 is_output_symtab_index_set rather than needs_output_symtab_entry.
3932 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3933 rather than needs_output_symtab_entry. Call
3934 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3935 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3936 is_output_symtab_index_set rather than needs_output_symtab_entry.
3937 * testsuite/discard_locals_relocatable_test.c: New file.
3938 * testsuite/discard_locals_test.sh: Test -r.
3939 * testsuite/Makefile.am (check_DATA): Add
3940 discard_locals_relocatable_test1.syms,
3941 discard_local_relocatable_test2.syms.
3942 (MOSTLYCLEANFILES): Likewise. Also add
3943 discard_locals_relocatable_test1.lout and
3944 discard_locals_relocatable_test2.out.
3945 (discard_locals_relocatable_test1.syms): New target.
3946 (discard_locals_relocatable_test.o): New target.
3947 (discard_locals_relocatable_test1.out): New target.
3948 (discard_locals_relocatable_test2.syms): New target.
3949 (discard_locals_relocatable_test2.out): New target.
3950 (various): Add missing ../ld-new dependencies.
3951 * testsuite/Makefile.in: Rebuild.
3952
7e8ccf26
NC
39532010-03-03 Nick Clifton <nickc@redhat.com>
3954
3955 * po/fi.po: New Finnish translation.
3956
2a0ff005
DK
39572010-03-01 Doug Kwan <dougkwan@google.com>
3958
3959 * layout.cc (Layout::Layout): Force section types of .init_array*,
3960 .preinit_array* and .fini_array* sections.
3961 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3962 Fix check of return value of std::string::find.().
3963 (Output_section::Input_section_sort_compare::operator()): Remove
3964 comment about .init_array.
3965 (Output_section::Input_section_sort_init_fini_compare::operator()):
3966 New method.
3967 (Output_section::sort_attached_input_sections): Handle .init_array
3968 and .fini_array specially.
3969 * output.h (Output_section::Inut_section_sort_compare): Update
3970 comment.
3971 (Output_section::Input_section_sort_init_fini_compare): New struct.
3972
c3e4ae29
DK
39732010-02-26 Doug Kwan <dougkwan@google.com>
3974
3975 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3976 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3977 * testsuite/debug_msg.sh: Avoid matching source line number for
3978 use of global variable undef_int.
3979
2fd9ae7a
DK
39802010-02-26 Doug Kwan <dougkwan@google.com>
3981
3982 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3983 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3984 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3985 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3986 * options.cc (General_options::General_options): Initialize member
3987 fix_v4bx_.
3988 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3989 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3990 and rm_no_fix_v4bx.stdout
3991 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3992 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3993 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3994 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3995 and arm_no_fix_v4bx.
3996 * Makefile.in: Regenerate.
3997 * testsuite/arm_fix_v4bx.s: New file.
3998 * testsuite/arm_fix_v4bx.sh: Ditto.
3999
67ec7d0b
DK
40002010-02-24 Doug Kwan <dougkwan@google.com>
4001
4002 * arm.cc (Target_arm::got_section): Make the .got section the first
4003 non RELRO section in the data segment.
4004 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4005 suffixes of section names.
4006
10165461
DK
40072010-02-24 Doug Kwan <dougkwan@google.com>
4008
4009 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4010 flags and attributes merging if an input file is a binary file.
4011 * fileread.cc (Input_file::open): Record format of original file.
4012 * fileread.h (Input_file::Format): New enum type.
4013 (Input_file::Input_file): Initialize data member format_.
4014 (Input_file::format): New method definition.
4015 (Input_file::format_):: New data member.
4016
4a54abbb
DK
40172010-02-24 Doug Kwan <dougkwan@google.com>
4018
4019 * arm.cc (Arm_output_data_got): New class.
4020 (ARM_TCB_SIZE): New constant
4021 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4022 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4023 If user uses a script with a SECTIONS clause, issue only a warning
4024 for a misplaced EXIDX input section. Otherwise, issue an error.
4025 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4026 garbage collection.
4027 (Target_arm::got_mode_index_entry): Handle static linking.
4028 (Target_arm::Scan::local): Ditto.
4029 (Target_arm::Scan::global): Ditto.
4030 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4031 all incorrectly implemented relocations.
e1df38aa 4032 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
4033 Arm_output_section::fix_exidx_coverage.
4034 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4035 from ".ARM.exidx." and ".ARM.extab.".
4036
ca419a6f
ILT
40372010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4038
4039 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4040 section if it does not already exist.
4041 * attributes.cc (Attributes_section_data::Attributes_section_data):
4042 Don't crash if size is zero.
4043
135b9c78
ILT
40442010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4045 Ian Lance Taylor <iant@google.com>
4046
4047 * gold.cc (queue_middle_tasks): If no input files were opened,
4048 exit.
4049 * workqueue.h (Task_function::Task_function): Assert that there is
4050 a blocker.
4051
bb0bfe4f
DK
40522010-02-22 Doug Kwan <dougkwan@google.com>
4053
4054 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4055 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4056 types to avoid warnings due to different uint64_t implementations
4057 on different hosts.
4058
2a2b6d42
DK
40592010-02-21 Doug Kwan <dougkwan@google.com>
4060
4061 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4062 handling of the maximum backward branch offset.
4063 (Arm_relocate_functions::thumb_branch_common): Ditto.
4064 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4065 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 4066 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
4067 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4068 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4069 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4070 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4071 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4072 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4073 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4074 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4075 thumb2_bl_out_of_range.o): New rules.
4076 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4077 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4078 thumb2_bl_out_of_range
4079 * testsuite/Makefile.in: Regenerate.
4080 * testsuite/arm_bl_in_range.s: New file.
4081 * testsuite/arm_bl_out_of_range.s: Ditto.
4082 * testsuite/arm_branch_in_range.sh: Ditto.
4083 * testsuite/arm_branch_range.t: Ditto.
4084 * testsuite/thumb2_branch_range.t: Ditto.
4085 * testsuite/thumb_bl_in_range.s: Ditto.
4086 * testsuite/thumb_bl_out_of_range.s: Ditto.
4087 * testsuite/thumb_branch_range.t: Ditto.
4088
b487ad64
ST
40892010-02-20 Sriraman Tallam <tmsriram@google.com>
4090
4091 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4092 Add reloc offset information.
4093 * icf.cc (get_section_contents): Change iterators to point to the new
4094 vectors. Add reloc offset information to the contents.
4095 * icf.h (Icf::Sections_reachable_info): New typedef.
4096 (Icf::Sections_reachable_list): New typedef.
4097 (Icf::Offset_info): New typedef.
4098 (Icf::Reloc_info): New struct typedef.
4099 (Icf::Reloc_info_list): New typedef.
4100 (Icf::symbol_reloc_list): Delete method.
4101 (Icf::addend_reloc_list): Delete method.
4102 (Icf::section_reloc_list): Delete method.
4103 (Icf::reloc_info_list): New method.
4104 (Icf::reloc_info_list_): New member.
4105
f96accdf
DK
41062010-02-19 Doug Kwan <dougkwan@google.com>
4107
4108 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4109 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4110 * arm.cc (Arm_relocation_functions): New forward declaration.
4111 (Target_arm::Target_arm): Initialize new data members
4112 got_mod_index_offset_ and tls_base_symbol_defined_.
4113 (Target_arm::Relocate::relocate_tls): New method.
4114 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4115 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4116 New methods.
4117 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4118 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4119 (Target_arm::got_mod_index_offset_,
4120 Target_arm::tls_base_symbol_defined_): New data members.
4121 (Target_arm::Scan::local, Target::Scan::global,
4122 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4123 relocations.
4124
c8761b9a
DK
41252010-02-18 Doug Kwan <dougkwan@google.com>
4126
4127 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4128 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4129 text section as a parameter becuase some broken tools may not set
4130 the link in section header.
4131 (Target_arm::has_got_section): New method.
4132 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4133 without any mapping symbol as data only. Remove warning.
4134 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4135 link in its section header, try to discover the link by inspecting the
4136 REL31 relocation at the beginning of the section.
4137 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4138 in error message.
4139 (Target_arm::Scan::global): Treat any reference to the symbol
4140 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4141
21bb3914
ST
41422010-02-12 Sriraman Tallam <tmsriram@google.com>
4143
4144 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4145 (Scan::global_reloc_may_be_function_pointer): New function.
4146 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4147 (Scan::global_reloc_may_be_function_pointer): New function.
4148 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4149 (Scan::global_reloc_may_be_function_pointer): New function.
4150 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4151 (Scan::global_reloc_may_be_function_pointer): New function.
4152 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4153 (Scan::global_reloc_may_be_function_pointer): New function.
4154 (Scan::possible_function_pointer_reloc): New function.
4155 (Target_x86_64::can_check_for_function_pointers): New function.
4156 * gc.h (gc_process_relocs): Scan relocation types to determine if
4157 function pointers were taken for targets that support it.
4158 * icf.cc (Icf::find_identical_sections): Include functions for
4159 folding in safe ICF whose pointer is not taken.
4160 * icf.h (Secn_fptr_taken_set): New typedef.
4161 (fptr_section_id_): New member.
4162 (section_has_function_pointers): New function.
4163 (set_section_has_function_pointers): New function.
4164 (check_section_for_function_pointers): New function.
4165 * options.h: Fix comment for safe ICF option.
4166 * target.h (can_check_for_function_pointers): New function.
4167 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4168 Modify icf_safe_test for X86-64.
4169 * testsuite/Makefile.in: Regenerate.
4170 * testsuite/icf_safe_so_test.cc: New file.
4171 * testsuite/icf_safe_so_test.sh: New file.
4172 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4173 (main): Change to take pointer to function kept_func_3.
4174 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4175 folding is done correctly for X86-64.
4176
0da6fa6c
DM
41772010-02-12 David S. Miller <davem@davemloft.net>
4178
4179 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4180 is_symbolless parameter.
4181 (Output_reloc<SHT_REL>::is_symbolless): New.
4182 (Output_reloc<SHT_REL>::is_symbolless_): New.
4183 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4184 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4185 (Output_reloc<SHT_RELA>::is_symbolless): New.
4186 (Output_data_reloc::add_global): Handle is_symbolless.
4187 (Output_data_reloc::add_global_relative): Likewise.
4188 (Output_data_reloc::add_local): Likewise.
4189 (Output_data_reloc::add_local_relative): Likewise.
4190 (Output_data_reloc::add_symbolless_global_addend): New.
4191 (Output_data_reloc::add_symbolless_local_addend): New.
4192 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4193 is_symbolless.
4194 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4195 instead of ->is_relative_
4196 (Output_reloc::write): Likewise.
4197 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4198 (Output_reloc::write_rel): Simplify.
4199
4200 * sparc.cc (Target_sparc::Scan::local): Use
4201 ->add_symbolless_local_addend as needed.
4202 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4203 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4204 based upon relocation offset.
4205
e4782e83
DK
42062010-02-11 Doug Kwan <dougkwan@google.com>
4207
4208 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4209 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4210 beginning of function.
4211 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4212 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4213 parameter is_32bit in calls to should_apply_static_reloc.
4214 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4215 (check_DATA): Add arm_abs_global.stdout.
4216 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4217 arm_abs_global.stdout): New rules.
4218 (MOSTLLYCLEANFILES): Add arm_abs_global
4219 * Makefile.in: Regenerate.
4220 * testsuite/arm_abs_global.s: New file.
4221 * testsuite/arm_abs_global.sh: Ditto.
4222 * testsuite/arm_abs_lib.s: Ditto.
4223
93ceb764
ILT
42242010-02-11 Ian Lance Taylor <iant@google.com>
4225
4226 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4227 Read_relocs task.
4228 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4229 Allocate_commons_task first.
4230 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4231 task, rather than symtab_lock_.
4232 (Gc_process_relocs::~Gc_process_relocs): New function.
4233 (Gc_process_relocs::is_runnable): Check this_blocker_.
4234 (Gc_process_relocs::locks): Use next_blocker_ rather than
4235 blocker_.
4236 (Scan_relocs::~Scan_relocs): New function.
4237 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4238 symtab_lock_.
4239 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4240 next_blocker_.
4241 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4242 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4243 constructor accordingly.
4244 (class Gc_process_relocs): Likewise.
4245 (class Scan_relocs): Likewise.
4246 * common.h (class Allocate_commons_task): Remove symtab_lock_
4247 field, and corresponding constructor parameter.
4248 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4249 symtab_lock_.
4250 (Allocate_commons_task::locks): Likewise.
4251
114dfbe1
ILT
42522010-02-11 Ian Lance Taylor <iant@google.com>
4253
4254 * gold-threads.h (class Once): Define.
4255 (class Initialize_lock): Rewrite as child of Once.
4256 * gold-threads.cc (class Once_initialize): Define.
4257 (once_pointer_control): New static variable.
4258 (once_pointer, once_arg): New static variables.
4259 (c_run_once): New static function.
4260 (Once::Once, Once::run_once, Once::internal_run): New functions.
4261 (class Initialize_lock_once): Remove.
4262 (initialize_lock_control): Remove.
4263 (initialize_lock_pointer): Remove.
4264 (initialize_lock_once): Remove.
4265 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4266 (Initialize_lock::initialize): Rewrite.
4267 (Initialize_lock::do_run_once): New function.
4268 * archive.cc (Archive::interpret_header): Only clear name if it is
4269 not already empty.
4270 * fileread.cc: Include "gold-threads.h"
4271 (file_counts_lock): New static variable.
4272 (file_counts_initialize_lock): Likewise.
4273 (File_read::release): Only increment counts when using --stats.
4274 Use a lock around the increment.
4275 * parameters.cc (class Set_parameters_target_once): Define.
4276 (set_parameters_target_once): New static variable.
4277 (Parameters::Parameters): Move here from parameters.h.
4278 (Parameters::set_target): Rewrite.
4279 (Parameters::set_target_once): New function.
4280 (Parameters::clear_target): Move here and rewrite.
4281 * parameters.h (class Parameters): Update declarations. Add
4282 set_parameters_target_once_ field.
4283 (Parameters::Parameters): Move to parameters.cc.
4284 (Parameters::clear_target): Likewise.
4285 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4286 task.
4287 (Start_group::~Start_group): New function.
4288 (Start_group::is_runnable): New function.
4289 (Start_group::locks, Start_group::run): New functions.
4290 (Finish_group::run): Change saw_undefined to size_t.
4291 * readsyms.h (class Start_group): Define.
4292 (class Finish_group): Change saw_undefined_ field to size_t.
4293 (Finish_group::Finish_group): Remove saw_undefined and
4294 this_blocker parameters. Change all callers.
4295 (Finish_group::set_saw_undefined): New function.
4296 (Finish_group::set_blocker): New function.
4297 * symtab.h (class Symbol_table): Change saw_undefined to return
4298 size_t. Change saw_undefined_ field to size_t.
4299 * target-select.cc (Set_target_once::do_run_once): New function.
4300 (Target_selector::Target_selector): Initialize set_target_once_
4301 field. Don't initialize lock_ and initialize_lock_ fields.
4302 (Target_selector::instantiate_target): Rewrite.
4303 (Target_selector::set_target): New function.
4304 * target-select.h (class Set_target_once): Define.
4305 (class Target_selector): Update declarations. Make
4306 Set_target_once a friend. Remove lock_ and initialize_lock_
4307 fields. Add set_target_once_ field.
4308
fa17a3f4
ILT
43092010-02-10 Ian Lance Taylor <iant@google.com>
4310
4311 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4312 queueing any tasks.
4313 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4314 (queue_middle_tasks): Add all blockers before queueing any tasks.
4315 (queue_final_tasks): Likewise.
4316 * token.h (Task_token::add_blockers): New function.
4317 * object.h (Input_objects::number_of_relobjs): New function.
4318
c7177d31
ILT
43192010-02-10 Ian Lance Taylor <iant@google.com>
4320
5de0e392
ILT
4321 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4322 shared, not if not position independent.
4323 * x86_64.cc (Relocate::relocate_tls): Likewise.
4324 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4325 (tls_pie_pic_test): New target.
4326 * testsuite/Makefile.in: Rebuild.
4327
c7177d31
ILT
4328 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4329 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4330 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4331 * testsuite/Makefile.in: Rebuild.
4332
684b268a
DM
43332010-02-09 David S. Miller <davem@davemloft.net>
4334
4335 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4336 R_SPARC_RELATIVE using ->add_local_relative().
4337 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4338
612a8d3d
DM
4339 * output.h (Output_data_dynamic::add_section_size): New method
4340 that takes two Output_data objects.
4341 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4342 entry param. Handle it in initializers.
4343 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4344 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4345 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4346 arg.
4347 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4348 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4349 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4350 for dynrel_includes_plt.
4351 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4352 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4353 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4354 before .rela.plt
4355 (Target_sparc::do_finalize_sections): Update to pass true for
4356 dynrel_includes_plt.
4357 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4358 output before .rela.plt
4359 (Target_powerpc::do_finalize_sections): Update to pass true for
4360 dynrel_includes_plt when 32-bit.
4361
cb1be87e
DK
43622010-02-08 Doug Kwan <dougkwan@google.com>
4363
4364 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4365 method.
4366 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4367 Arm_relobj::scan_section_for_cortex_a8_stubs,
4368 Arm_relobj::do_relocation_section): Instead of calling
4369 Output_section::output_address, use faster
4370 Arm_relobj::simple_input_section_output_address.
4371
705b5121
DM
43722010-02-08 David S. Miller <davem@davemloft.net>
4373
4374 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4375 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4376 relocation helper function.
4377
024c4466
DM
4378 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4379 just like R_SPARC_GOT{10,13,22}.
4380 (Target_sparc::Scan::local): Likewise.
4381 (Target_sparc::Relocate:relocate): Likewise.
4382
9109c078
ILT
43832010-02-06 Ian Lance Taylor <iant@google.com>
4384
4385 * configure.ac: Rewrite targetobjs duplicate removal code to use
4386 only shell constructs.
4387 * configure: Rebuild.
4388
cf846138
DK
43892010-02-05 Doug Kwan <dougkwan@google.com>
4390
4391 PR 11247
4392 * arm.cc (Arm_relobj::section_is_scannable): New method.
4393 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4394 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4395
6cfaf60b
DK
43962010-02-04 Doug Kwan <dougkwan@google.com>
4397
4398 PR 11247
4399 * arm-reloc-property.cc (cstdio): Include.
4400 * configure.ac (targetobjs): Remove duplicates.
4401 * configure: Regenerate.
4402 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4403 big and little endian version for a given address size.
4404
5c57f1be
DK
44052010-02-03 Doug Kwan <dougkwan@google.com>
4406
4407 * arm-reloc-property.cc
4408 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4409 definition.
4410 * arm-reloc-property.h
4411 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4412 New method definition.
4413 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4414 declaration.
4415 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4416 overflow to N.
4417 (GOT_PREL): Change implemented to Y.
4418 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4419 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4420 (Arm_relocate_functions::movw_abs_nc): Remove method.
4421 (Arm_relocate_functions::movt_abs): Ditto.
4422 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4423 (Arm_relocate_functions::thm_movt_abs): Ditto.
4424 (Arm_relocate_functions::movw_rel_nc): Ditto.
4425 (Arm_relocate_functions::movw_rel): Ditto.
4426 (Arm_relocate_functions::movt_rel): Ditto.
4427 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4428 (Arm_relocate_functions:thm_movw_rel): Ditto.
4429 (Arm_relocate_functions:thm_movt_rel): Ditto.
4430 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4431 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4432 New method definitions.
4433 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4434 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4435 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4436 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4437 (Target_arm::Relocate::relocate): Check for non-static or
4438 unimplemented relocation code and exit early. Change calls to
4439 Target_arm::reloc_uses_thumb_bit and
4440 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4441 instead. Refactor code to handle similar relocations to increase
4442 code sharing. Remove check for unsupported relocation code in switch
4443 statement.
4444 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4445 relocation property table to find out size. Change error message to
4446 print out the name of a relocation code instead of the numeric value.
4447 (Target_arm::scan_reloc_for_stub): Use relocation property table
4448 instead of calling Target_arm::reloc_uses_thumb_bit().
4449
218c5831
DK
44502010-02-02 Doug Kwan <dougkwan@google.com>
4451
4452 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4453 types of relaxed input section.
4454
0d31c79d
DK
44552010-02-02 Doug Kwan <dougkwan@google.com>
4456
4457 * Makefile.am (HFILES): Add arm-reloc-property.h.
4458 (DEFFILES): New.
4459 (TARGETSOURCES): Add arm-reloc-property.cc
4460 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4461 (libgold_a_SOURCES): $(DEFFILES)
4462 * Makefile.in: Regenerate.
4463 * arm-reloc-property.cc: New file.
4464 * arm-reloc-property.h: New file.
4465 * arm-reloc.def: New file.
4466 * arm.cc: Update comments.
4467 (arm-reloc-property.h): New included header.
4468 (arm_reloc_property_table): New global variable.
4469 (Target_arm::do_select_as_default_target): New method definition.
4470 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4471 arm-reloc-property to targ_extra_obj.
4472 * parameters.cc (set_parameters_target): Call
4473 Target::select_as_default_target().
4474 * target.h (Target::select_as_default_target): New method definition.
4475 (Target::do_select_as_default_target): Same.
4476
546c7457
DK
44772010-02-01 Doug Kwan <dougkwan@google.com>
4478
4479 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4480 first_output_text_section_.
4481 (Arm_exidx_fixup::first_output_text_section): New method definition.
4482 (Arm_exidx_fixup::first_output_text_section_): New data member.
4483 (Arm_exidx_fixup::process_exidx_section): Record the first text
4484 output section seen.
4485 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4486 and entsize in output section header.
4487
11b861d5
DK
44882010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4489
4490 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4491 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4492 (Arm_relocate_functions::thm_alu11): New Method.
4493 (Arm_relocate_functions::thm_pc8): New Method.
4494 (Arm_relocate_functions::thm_pc12): New Method.
4495 (Target_arm::Scan::local): Handle the relocations.
4496 (Target_arm::Scan::global): Likewise.
4497 (Target_arm::Relocate::relocate): Likewise.
4498 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4499
c9a2c125
DK
45002010-01-29 Doug Kwan <dougkwan@google.com>
4501
4502 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4503 of relocation types as ld.
4504
1521477a
DK
45052010-01-29 Doug Kwan <dougkwan@google.com>
4506
4507 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4508 to public.
4509 (Arm_relocate_functions::thumb_branch_common): Ditto.
4510 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4511 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4512 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4513 Arm_relocate_functions::jump24): Remove.
4514 (Target_arm::Relocate::relocate): Adjust code to call
4515 Arm_relocation_functions::arm_branch_common and
4516 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 4517 wrappers. Merge switch-cases together to reduce source code size.
1521477a 4518
e7eca48c
DK
45192010-01-29 Doug Kwan <dougkwan@google.com>
4520
4521 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4522 output_local_symbol_count_needs_update_.
4523 (Arm_relobj::output_local_symbol_count_needs_update,
4524 Arm_relobj::set_output_local_symbol_count_needs_update,
4525 Arm_relobj::update_output_local_symbol_count): New methods.
4526 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4527 member.
4528 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4529 of pointed function as in a R_ARM_PREL31 relocation.
4530 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4531 for output local symbol count updating.
4532 (Target_arm::do_relax): Update output local symbol counts in objects
4533 if necessary.
4534 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4535
02961d7e
ILT
45362010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4537
4538 * arm.cc: Added support for the ARM relocations:
4539 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4540 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4541 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4542 movw_prel_nc).
4543 (Arm_relocate_functions::movw_rel): New method.
4544 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4545 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4546 thm_movw_prel_nc).
4547 (Arm_relocate_functions::thm_movw_rel): New method.
4548 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4549 thm_movt_prel).
4550 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4551 relocations.
4552 (Target_arm::Scan::global): Likewise.
4553 (Target_arm::Relocate::relocate): Likewise.
4554 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4555 Likewise.
4556
b10d2873
ILT
45572010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4558
4559 * arm.cc: Added support for ARM group relocations.
4560 (Target_arm::reloc_needs_sym_origin): New method.
4561 (Arm_relocate_functions::calc_grp_kn): New method.
4562 (Arm_relocate_functions::calc_grp_residual): New method.
4563 (Arm_relocate_functions::calc_grp_gn): New method.
4564 (Arm_relocate_functions::arm_grp_alu): New Method.
4565 (Arm_relocate_functions::arm_grp_ldr): New Method.
4566 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4567 (Arm_relocate_functions::arm_grp_ldc): New Method.
4568 (Target_arm::Scan::local): Handle the ARM group relocations.
4569 (Target_arm::Scan::global): Likewise.
4570 (Target_arm::Relocate::relocate): Likewise.
4571 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4572 Likewise.
4573
2b328d4e
DK
45742010-01-26 Doug Kwan <dougkwan@google.com>
4575
4576 * arm.cc (set): Include.
4577 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4578 pointer type.
4579 (Arm_output_section::Text_section_list): New type.
4580 (Arm_output_section::append_text_sections_to_list): New method.
4581 (Arm_output_section::fix_exidx_coverage): Ditto.
4582 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4583 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4584 Relobj::set_section_offset() instead of
4585 Sized_relobj::invalidate_section_offset().
4586 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4587 parameter for section headers. Ignore relocation sections for
4588 unallocated sections and EXIDX sections.
4589 (Target_arm::fix_exidx_coverage): New method.
4590 (Target_arm::output_section_address_less_than): New type.
4591 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4592 linked text section instead of the EXIDX section.
4593 (Arm_output_section::create_stub_group): Add an assertion to check
4594 that this is not an EXIDX output section.
4595 (Arm_output_section::append_text_sections_to_list): New method.
4596 (Arm_output_section::fix_exidx_coverage): Ditto.
4597 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4598 Arm_relobj::section_needs_reloc_stub_scanning.
4599 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4600 first pass.
4601 (Target_arm::fix_exidx_coverage): New method.
4602 * object.h (Relobj::set_output_section): New method.
4603 (Sized_relobj::invalidate_section_offset): Remove method.
4604 (Sized_relobj::do_invalidate_section_offset): Remove method.
4605 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4606
c7f3c371
DK
46072010-01-25 Doug Kwan <dougkwan@google.com>
4608
4609 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4610 Fix warning due to signed and unsigned comparison on a 32-bit host.
4611
8923b24c
DK
46122010-01-22 Doug Kwan <dougkwan@google.com>
4613
4614 * arm.cc (Target_arm::do_relax): Record an output section for section
4615 offset adjustment it contains any stub table that has changed.
4616 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4617 offsets in an output section if necessary.
4618 * output.cc (Output_section::Output_section): Initialize
4619 section_offsets_need_adjustments_.
4620 (Output_section::add_input_section_for_script): Renamed to
4621 Output_section::add_simple_input_section.
4622 (Output_section::save_states): Add a comment.
4623 (Output_section::discard_states): New method defintion.
4624 (Output_section::adjust_section_offsets): Same.
4625 * output.h (Output_section::add_input_section_for_script): Renamed to
4626 Output_section::add_simple_input_section.
4627 (Output_section::discard_states): New method declaration.
4628 (Output_section::adjust_section_offsets): Same.
4629 (Output_section::section_offsets_need_adjustment,
4630 Output_section::set_section_offsets_need_adjustment): New method
4631 definitions.
4632 (Output_section::section_offsets_need_adjustment_): New data member.
4633 * script-sections.cc
4634 (Output_section_element_input::set_section_address): Adjust code for
4635 renaming of Output_section::add_input_section_for_script.
4636 (Orphan_output_section::set_section_address): Same.
4637
9b2fd367
DK
46382010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4639
4640 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4641 Fix_v4bx enum values .
4642 * gold/options.h (General_options): New option definitions.
4643 (General_options::fix_v4bx): New method.
4644 (General_options::Fix_v4bx): New enum.
4645 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4646 (General_options::parse_fix_v4bx_interworking): New method.
4647
80d0d023
DK
46482010-01-22 Doug Kwan <dougkwan@google.com>
4649
4650 * arm.cc (Arm_exidx_fixup): New class.
4651
af2cdeae
DK
46522010-01-21 Doug Kwan <dougkwan@google.com>
4653
4654 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4655 classes.
4656 (Arm_exidx_section_offset_map): New type.
4657
993d07c1
DK
46582010-01-21 Doug Kwan <dougkwan@google.com>
4659
4660 * arm.cc (Arm_exidx_input_section): New class.
4661 (Arm_relobj::exidx_input_section_by_link,
4662 Arm_relobj::exidx_input_section_by_shndx,
4663 Arm_relobj::make_exidx_input_section): New methods.
4664 (read_arm_attributes_section): Remove.
4665 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4666 information about them.
4667 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4668 to here.
4669
5ac169d4
DK
46702010-01-20 Doug Kwan <dougkwan@google.com>
4671
4672 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4673 Input_section_specifier to Section_id.
4674 (Target_arm::new_arm_input_section: Adjust code for change of key
4675 type.
4676 (Target_arm::find_arm_input_section): Ditto.
4677 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4678 (Section_id): Remove.
4679 (Garbage_collection::Section_id_hash): Remove.
4680 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4681 (Section_id): Remove.
4682 (Icf::Section_id_hash): Remove.
4683 * object.h (Section_id, Const_section_id, Section_id_hash,
4684 Const_section_id_hash): New type definitions.
4685 * output.cc (Output_section::add_relaxed_input_section): Change to
4686 use Const_section_id instead of Input_section_specifier as key type.
4687 (Output_section::add_merge_input_section): Ditto.
4688 (Output_section::build_relaxation_map): Change to use Section_id
4689 instead of Input_section_specifier as key type.
4690 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4691 Ditto.
4692 (Output_section::convert_input_sections_to_relaxed_sections): Change
4693 to use Const_section_id instead of Input_section_specifier as key type.
4694 (Output_section::find_merge_section): Ditto.
4695 (Output_section::find_relaxed_input_section): Ditto.
4696 * output.h (Input_section_specifier): Remove class.
4697 (Output_section::Output_section_data_by_input_section_map): Change
4698 key type to Const_section_id.
4699 (Output_section::Output_relaxed_input_section_by_input_section_map):
4700 Ditto.
4701 (Output_section::Relaxation_map): Change key type to Section_id.
4702
a2162063
ILT
47032010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4704
4705 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4706 (class Arm_v4bx_stub): New class.
4707 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4708 (Stub_factory::make_arm_v4bx_stub): New method.
4709 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4710 (Stub_table::empty): Handle v4bx stubs.
4711 (Stub_table::add_arm_v4bx_stub): New method.
4712 (Stub_table::find_arm_v4bx_stub): New method.
4713 (Arm_relocate_functions::v4bx): New method.
4714 (Target_arm::fix_v4bx): New method.
4715 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4716 (Stub_table::relocate_stubs): Likewise.
4717 (Stub_table::do_write): Likewise.
4718 (Stub_table::update_data_size_and_addralign): Likewise.
4719 (Stub_table::finalize_stubs): Likewise.
4720 (Target_arm::Scan::local): Likewise.
4721 (Target_arm::Scan::global): Likewise.
4722 (Target_arm::do_finalize_sections): Likewise.
4723 (Target_arm::Relocate::relocate): Likewise.
4724 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4725 Likewise.
4726 (Target_arm::scan_reloc_for_stub): Likewise.
4727 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4728
5696ab0b
ILT
47292010-01-19 Ian Lance Taylor <iant@google.com>
4730
4731 * output.cc (Output_section_headers::do_sized_write): Write large
4732 segment count to sh_info field.
4733 (Output_file_header::do_sized_write): For large segment count,
4734 write PN_XNUM to e_phnum field.
4735
800d0f56
ILT
47362010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4737
4738 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4739 (Arm_relocate_functions::thm_jump8): New function.
4740 (Arm_relocate_functions::thm_jump11): New function.
4741 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4742 R_ARM_THM_JUMP11.
4743 (Target_arm::Scan::global): Likewise.
4744 (Target_arm::Relocate::relocate): Likewise.
4745 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4746 Likewise.
4747
41263c05
DK
47482010-01-14 Doug Kwan <dougkwan@google.com>
4749
4750 * arm.cc (map, utility): Include headers.
4751 (Target_arm::apply_cortex_a8_workaround): New method.
4752 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4753 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4754 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4755 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4756 the --[no-]fix-cortex-a8 command line options.
4757 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4758 (Target_arm::relocate_stub): Use addend in instruction template.
4759 * options.h (DEFINE_bool): Set the user-set flag.
4760 (General_options): Add --[no-]-fix-cortex options.
4761 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 4762 : Update fast look-up map after conversion.
41263c05 4763
459e9b03
ST
47642010-01-14 Sriraman Tallam <tmsriram@google.com>
4765
4766 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4767 in the first pass of do_layout.
4768
b521dfe4
DK
47692010-01-13 Doug Kwan <dougkwan@google.com>
4770
4771 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4772 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4773 apparent compiler problem of not folding static constant integral
4774 data members of elfcpp::Elf_sizes<32>.
4775
44272192
DK
47762010-01-13 Doug Kwan <dougkwan@google.com>
4777
4778 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4779 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4780 Arm_relobj::scan_section_for_cortex_a8_erratum,
4781 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4782 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4783 sections to scan for relocation stubs into a new method
4784 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4785 relocation and Cortex-A8 stub scanning.
4786 (Target_arm::do_relax): Force stubs to be after stubbed sections
4787 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 4788 the beginning of a new relaxation pass. Update a comment.
44272192
DK
4789 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4790
44b71ece
ILT
47912010-01-12 Ian Lance Taylor <iant@google.com>
4792
4793 * target-reloc.h (visibility_error): New inline function.
4794 (relocate_section): Call visibility_error.
4795 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4796 (MOSTLYCLEANFILES): Likewise.
4797 (protected_4_pic.o, protected_3.err): New targets.
4798 * testsuite/protected_4.cc: New file.
4799
a120bc7f
DK
48002010-01-12 Doug Kwan <dougkwan@google.com>
4801
4802 * arm.cc (Cortex_a8_reloc): New class.
4803 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4804 and cortex_a8_relocs_info_.
4805 (Target_arm::fix_cortex_a8): New method definition.
4806 (Target_arm::Cortex_a8_relocs_info): New type.
4807 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4808 New data member declarations.
4809 (Target_arm::scan_reloc_for_stub): Record information about
4810 relocations for THUMB branches that might be exempted from the
4811 Cortex-A8 workaround.
4812 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4813 at the beginning of a relaxation pass.
4814
20138696
DK
48152010-01-12 Doug Kwan <dougkwan@google.com>
4816
4817 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4818 (Arm_relobj::Mapping_symbol_position,
4819 Arm_reloj::Mapping_symbol_position_less,
4820 Arm_relobj::Mapping_symbols_info): New types.
4821 (Target_arm::is_mapping_symbol_name): New method definition.
4822 (Arm_relobj::do_count_local_symbols): Save information about mapping
4823 symbols.
4824
089d69dc
DK
48252010-01-11 Doug Kwan <dougkwan@google.com>
4826
4827 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4828 Arm_relocate_functions::thumb32_branch_upper,
4829 Arm_relocate_functions::thumb32_branch_lower,
4830 Arm_relocate_functions::thumb32_cond_branch_offset,
4831 Arm_relocate_functions::thumb32_cond_branch_upper,
4832 Arm_relocate_functions::thumb32_cond_branch_lower,
4833 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4834 branch offset encoding.
4835 (Arm_relocate_functions::thumb_branch_common): Use new branch
4836 offset encoding methods to avoid code duplication.
4837 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4838 (Stub_addend_reader::operator()): Use new branch encoding method
4839 to avoid code duplication.
4840
99e5bff2
DK
48412010-01-11 Doug Kwan <dougkwan@google.com>
4842
4843 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4844 (Target_arm::do_finalize_sections): Define special EXIDX section
4845 symbols only if referenced.
4846 * gc.h (Garbage_collection::add_reference): New method.
4847 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4848 code duplication.
4849
98e090bd
ILT
48502010-01-11 Ian Lance Taylor <iant@google.com>
4851
d0a91bd8
ILT
4852 * script.cc (Version_script_info::build_expression_list_lookup):
4853 Change complaing about duplicate wildcard match from error to
4854 warning.
4855
98e090bd
ILT
4856 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4857 of 2009-12-30.
4858 (Version_script_info::Version_script_info): Initialize globs_,
4859 default_version_, default_is_global_, and exact_. Don't
4860 initialize globals_ or locals_.
4861 (Version_script_info::build_lookup_tables): Build local symbols
4862 first.
4863 (Version_script_info::unquote): New function.
4864 (Version_script_info::add_exact_match): New function.
4865 (Version_script_info::build_expression_list_lookup): Remove lookup
4866 parameter. Add is_global parameter. Change all callers. Handle
4867 wildcard pattern specially. Unquote pattern. Call
4868 add_exact_match.
4869 (Version_script_info::get_name_to_match): New function.
4870 (Version_script_info::get_symbol_version): New function.
4871 (Version_script_info::get_symbol_version_helper): Remove.
4872 (Version_script_info::check_unmatched_names): Call unquote.
4873 * script.h (class Version_script_info): Change get_symbol_version
4874 to be non-inline and add is_global parameter; change all callers.
4875 Rewrite symbol_is_local. Update declarations. Define struct
4876 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4877 Remove globals_ and locals_ members. Add exact_, globs_,
4878 default_version_, is_global_.
4879 (Version_script_info::Glob): Remove pattern, add expression and
4880 is_global. Update constructor. Change all callers.
4881 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4882 default version.
4883 (Versions::symbol_section_contents): If a symbol is undefined, or
4884 defined in a dynamic object, set the version index to
4885 VER_NDX_LOCAL.
4886 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4887 symbol_is_local.
4888 (Symbol_table::add_from_pluginobj): Likewise.
4889 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4890
d56962d3
DK
48912010-01-11 Doug Kwan <dougkwan@google.com>
4892
4893 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4894 (incremental_dump_LDADD): Add linking option for libintl.
4895 * Makefile.in: Regenerate.
4896
94e6ee91
L
48972010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4898
4899 PR gold/11144
4900 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4901 instead of -Ds.
4902 * testsuite/Makefile.in: Regenerated.
4903
e96c574b
DK
49042010-01-10 Doug Kwan <dougkwan@google.com>
4905
4906 * options.h (DEFINE_var): Use parentheses around argument varname__
4907 in macro body to avoid any unintended subsequent substitutions.
4908
7198066b
ILT
49092010-01-10 Ian Lance Taylor <iant@google.com>
4910
ba4d53bf
ILT
4911 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4912 candidates before doing symbol resolution.
4913
7198066b
ILT
4914 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4915 ODR candidates if only one is weak.
4916
a2beed37
ILT
49172010-01-08 Ian Lance Taylor <iant@google.com>
4918
4919 * script.cc (Version_script_info::build_expression_list_lookup):
4920 Don't warn about ambiguous version, just record the ambiguity.
4921 (Version_script_info::get_symbol_version_helper): Give error if
4922 version is ambiguous.
4923
2fb7225c
DK
49242010-01-08 Doug Kwan <dougkwan@google.com>
4925
4926 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4927 prev_data_size_ and prev_addralign_. Remove initializer for
4928 deleted data member has_been_changed_.
4929 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4930 to determine if the table is empty.
4931 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4932 Remove.
4933 (Stub_table::add_reloc_stub): Define method in class definition
4934 instead of just declaring it there.
4935 (Stub_table::add_cortex_a8_stub): New method definition.
4936 (Stub_table::update_data_size_and_addralign): Ditto.
4937 (Stub_table::finalize_stubs): Ditto.
4938 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4939 (Stub_table::do_addralign_): Return address alignment in the
4940 (Stub_table::do_reset_address_and_file_offset): Define method in
4941 class definition instead of declaring it there. Set current data
4942 size to be the data size of the previous pass.
4943 (Stub_table::set_final_data_size): Use current data size as the
4944 final data size.
4945 (Stub_table::relocate_stub): Change parameter type of stub from
4946 Reloc_stub pointer to Stub pointer.
4947 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4948 (Stub_table::Cortex_a8_stub_list): New typedef.
4949 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4950 Stub_table::prev_addralign_): New data member.
4951 (Arm_relobj::Arm_relobj): Initialize data member
4952 section_has_cortex_a8_workaround_.
4953 (Arm_relobj::section_has_cortex_a8_workaround,
4954 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4955 definitions.
4956 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4957 declarations.
4958 (Target_arm::relocate_stub): Change parameter type of stub from
4959 Reloc_stub pointer to Stub pointer.
4960 (Insn_template::size, Insn_template::alignment): Handle
4961 THUMB16_SPECIAL_TYPE.
4962 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4963 Stub_table::update_data_size_and_addralign,
4964 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4965 definitions.
4966 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4967 (Stub_table::do_write): Ditto.
4968 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4969
880cd20d
ILT
49702010-01-08 Ian Lance Taylor <iant@google.com>
4971
4972 PR 11108
4973 * symtab.h (class Symbol): Remove fields is_target_special_ and
4974 has_plt_offset_. Add field is_defined_in_discarded_section_.
4975 (Symbol::is_defined_in_discarded_section): New function.
4976 (Symbol::set_is_defined_in_discarded_section): New function.
4977 (Symbol::has_plt_offset): Rewrite.
4978 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4979 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4980 Don't initialize is_target_special_ or has_plt_offset_.
4981 Initialize is_defined_in_discarded_section_.
4982 (Symbol_table::add_from_relobj): If appropriate, set
4983 is_defined_in_discarded_section.
4984 * resolve.cc (Symbol::override_base_with_special): Don't test
4985 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4986 * target-reloc.h (relocate_section): Do special handling for
4987 symbols defined in discarded sections for global symbols as well
4988 as local symbols.
4989
2703e3eb
ILT
49902010-01-08 Ian Lance Taylor <iant@google.com>
4991
4992 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4993 the SHT_SYMTAB case.
4994
339d40a3
ILT
49952010-01-08 Ian Lance Taylor <iant@google.com>
4996
4997 * object.cc (Sized_relobj::do_layout): Don't get confused if
4998 layout_eh_frame returns NULL.
4999
abecea76
ILT
50002010-01-08 Ian Lance Taylor <iant@google.com>
5001
5002 PR 11084
5003 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5004 dynamic symbol table, use the normal symbol table.
5005 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5006 symbol table.
5007
6b7dd3f3
ILT
50082010-01-08 Ian Lance Taylor <iant@google.com>
5009
5010 PR 11072
5011 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5012 sections.
5013
36c50e63
L
50142010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5015
5016 * version.cc (print_version): Change to "Copyright 2010".
5017
e291e7b9
ILT
50182010-01-08 Ian Lance Taylor <iant@google.com>
5019
5020 PR 10287
5021 PR 11063
5022 * i386.cc (class Target_i386): Change return type of plt_section
5023 to be non-const.
5024 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5025 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5026 tls_desc_rel_ field.
5027 (Output_data_plt_i386::rel_tls_desc): New function.
5028 (Target_i386::rel_tls_desc_section): New function.
5029 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5030 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5031 R_386_TLS_DESC reloc in rel_tls_desc_section.
5032 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5033 Define struct Tlsdesc_info.
5034 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5035 (Target_x86_64::do_reloc_symbol_index): New function.
5036 (Target_x86_64::add_tlsdesc_info): New function.
5037 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5038 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5039 tlsdesc_rel_ field.
5040 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5041 all callers.
5042 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5043 (Target_x86_64::rela_tlsdesc_section): New function.
5044 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5045 handling.
5046 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5047 (Target_x86_64::do_reloc_addend): New function.
5048 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5049 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5050 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5051 (Output_reloc::type): New function.
5052 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5053 (Output_reloc::is_target_specific): New function.
5054 (Output_reloc::target_arg): New function.
5055 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5056 absolute relocs and target specific relocs.
5057 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5058 add_target_specific.
5059 (class Output_data_reloc) [SHT_RELA]: Likewise.
5060 * output.cc (Output_reloc::Output_reloc): Add four new versions
5061 for absolute relocs and target specific relocs.
5062 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5063 (Output_reloc::get_symbol_index): Likewise.
5064 (Output_reloc::local_section_offset): Check that local_sym_index_
5065 is not TARGET_CODE or 0.
5066 (Output_reloc::symbol_value): Likewise.
5067 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5068 reloc.
5069 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5070 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5071 functions.
5072 * layout.cc (add_target_dynamic_tags): Use output section for
5073 DT_PLTRELSZ and DT_JMPREL.
5074
3a44184e
ILT
50752010-01-07 Ian Lance Taylor <iant@google.com>
5076
5077 PR 11061
5078 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5079 function.
5080 (class Output_data_reloc_generic): Define.
5081 (class Output_data_reloc_base): Change base class to
5082 Output_data_reloc_generic. Change add() method to call
5083 bump_relative_reloc_count for a relative reloc. Remove
5084 sort_relocs_ field.
5085 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5086 to sort_relocs().
5087 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5088 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5089 appropriate.
5090 * layout.h (class Layout): Update declaration.
5091
ea715a34
ILT
50922010-01-07 Ian Lance Taylor <iant@google.com>
5093
5094 * output.h (class Output_data): Add const version of
5095 output_section and do_output_section.
5096 (class Output_section_data): Add const version of
5097 do_output_section.
5098 (class Output_section): Likewise.
5099 * layout.cc (Layout::add_target_dynamic_tags): New function.
5100 * layout.h (class Layout): Update declarations.
5101 * arm.cc (Target_arm::do_finalize_sections): Use
5102 add_target_dynamic_tags.
5103 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5104 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5105 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5106 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5107
659948a4
ILT
51082010-01-07 Ian Lance Taylor <iant@google.com>
5109
5110 PR 11042
5111 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5112 object as needed.
5113
9d3b86f6
ILT
51142010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5115 Ian Lance Taylor <iant@google.com>
5116
5117 PR 11019
5118 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5119 Xindex::read_symtab_xindex.
5120
bb0d3eb0
DK
51212010-01-07 Doug Kwan <dougkwan@google.com>
5122
5123 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5124 (Insn_template::thumb16_bcond_insn): New method declaration.
5125 (Insn_template): Fix spelling.
5126 (Stub::thumb16_special): New method declaration.
5127 (Stub::do_write): Define virtual method which was previously pure
5128 virtual.
5129 (Stub::do_thumb16_special): New method declaration.
5130 (Stub::do_fixed_endian_write): New template member.
5131 (Reloc_stub::do_write): Remove.
5132 (Reloc_stub::do_fixed_endian_write): Remove.
5133 (Cortex_a8_stub): New class definition.
5134 (Stub_factory::make_cortex_a8_stub): New method definition.
5135 (Stub_factory::Stub_factory): Add missing static storage class
5136 qualifier for elf32_arm_stub_a8_veneer_blx.
5137
ffeef7df
ILT
51382010-01-07 Ian Lance Taylor <iant@google.com>
5139
dc3f80fe
ILT
5140 PR 10980
5141 * options.h (class General_options): Add --warn-unresolved-symbols
5142 and --error-unresolved-symbols.
5143 * errors.cc (Errors::undefined_symbol): Implement
5144 --warn-unresolved-symbols.
5145
ffeef7df
ILT
5146 * options.h (class General_options): Add -z text and -z textoff.
5147 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5148
f1ec9ded
ST
51492010-01-06 Sriraman Tallam <tmsriram@google.com>
5150
5151 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5152 (Garbage_collection::cident_sections): New function.
5153 (Garbage_collection::add_cident_section): New function.
5154 (Garbage_collection::cident_sections_): New member.
5155 (gc_process_relocs): Add references to sections whose names are C
5156 identifiers.
5157 * gold.h (cident_section_start_prefix): New constant.
5158 (cident_section_stop_prefix): New constant.
5159 (is_cident): New function.
5160 * layout.cc (Layout::define_section_symbols): Replace string constants
5161 with the newly defined constants.
5162 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5163 C identifiers.
5164 * testsuite/Makefile.am: Add gc_orphan_section_test.
5165 * testsuite/Makefile.in: Regenerate.
5166 * testsuite/gc_orphan_section_test.cc: New file.
5167 * testsuite/gc_orphan_section_test.sh: New file.
5168
6eda8c29
ILT
51692010-01-06 Ian Lance Taylor <iant@google.com>
5170
b9674e17
ILT
5171 PR 10980
5172 * options.h (class General_options): Add --warn-shared-textrel.
5173 * layout.cc (Layout::finish_dynamic_section): Implement
5174 --warn-shared-textrel.
5175
6eda8c29
ILT
5176 PR 10980
5177 * options.h (class General_options): Add --warn-multiple-gp.
5178
32dcd44e
ILT
51792010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5180
5181 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5182 $(THREADSLIB) and $(LIBDL).
5183 * Makefile.in: Rebuild.
5184
a192ba05
ILT
51852010-01-06 Ian Lance Taylor <iant@google.com>
5186
5187 PR 10980
5188 * options.cc (General_options::parse_section_start): New function.
5189 (General_options::section_start): New function.
5190 (General_options::General_options): Initialize all members.
5191 * options.h: Include <map>
5192 (class General_options): Add --section-start. Add section_starts_
5193 member.
5194 * layout.cc (Layout::attach_allocated_section_to_segment): If
5195 --section-start was used, set the address of the segment. Remove
5196 local sort_sections.
5197 (Layout::relaxation_loop_body): If the address of the load segment
5198 has been set by --section-start, don't use it.
5199 * output.h (Output_segment::update_flags_for_output_section): New
5200 function.
5201 * output.cc (Output_segment::add_output_section): Call
5202 update_flags_for_output_section.
5203
dde3f402
ILT
52042010-01-05 Ian Lance Taylor <iant@google.com>
5205
62dfdd4d
ILT
5206 PR 10980
5207 * options.h (class General_options): Add --undefined-version.
5208 * script.cc (struct Version_expression): Add was_matched_by_symbol
5209 field.
5210 (Version_script_info::matched_symbol): New function.
5211 (Version_script_info::get_symbol_version_helper): Call
5212 matched_symbol.
5213 (Version_script_info::check_unmatched_names): New function.
5214 * script.h (class Version_script_info): Update declarations.
5215 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5216
9c4ae156
ILT
5217 * options.h (class General_options): Use DEFINE_bool_alias for
5218 allow_multiple_definition.
5219 * resolve.cc (Symbol_table::should_override): Don't test
5220 allow_multiple_definition.
5221
dde3f402
ILT
5222 PR 10980
5223 * options.h (class General_options): Add --cref.
5224 * main.cc (main): Print cref table if --cref. Don't close mapfile
5225 until after printing cref table.
5226 * cref.cc: Include "symtab.h".
5227 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5228 (Cref_table_compare::operator()): New function.
5229 (Cref_inputs::gather_cref): New function.
5230 (filecol): New static const.
5231 (Cref_inputs::print_cref): New function.
5232 (Cref::print_cref): New function.
5233 * cref.h: Include <cstdio>.
5234 (class Cref): Update declarations.
5235 * mapfile.h (Mapfile::file): New function.
5236 * object.h (class Object): Define Symbols. Declare virtual
5237 do_get_global_symbols.
5238 (Object::get_global_symbols): New function.
5239 * object.cc (Input_objects::add_object): Pass object to cref_ if
5240 --cref.
5241 (Input_objects::archive_start): Likewise.
5242 (Input_objects::archive_stop): Likewise.
5243 (Input_objects::print_cref): New function.
5244 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5245 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5246 --cref.
5247 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5248 function.
5249 * plugin.h (class Sized_pluginobj): Update declarations.
5250
8781f709
ILT
52512010-01-05 Ian Lance Taylor <iant@google.com>
5252
5253 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5254 to is_default_version. Rename insdef to insdefault.
5255 (Symbol_table::add_from_relobj): Rename def to is_default_version
5256 and local to is_forced_local.
5257 (Symbol_table::add_from_pluginobj): Likewise.
5258 (Symbol_table::add_from_dynobj): Likewise.
5259 (Symbol_table::define_special_symbol): Rename insdef to
5260 insdefault.
5261
fe35d28d
ILT
52622010-01-04 Ian Lance Taylor <iant@google.com>
5263
30bc8c46
ILT
5264 PR 10980
5265 * options.h (class General_options): Add
5266 --allow-multiple-definition and -z muldefs.
5267 * resolve.cc (Symbol_table::should_override): Don't warn about a
5268 multiple symbol definition if --allow-multiple-definition or -z
5269 muldefs.
5270
7eaea549
ILT
5271 PR 10980
5272 * options.h (class General_options): Add --add-needed and
5273 --copy-dt-needed-entries. Tweak --as-needed help entry.
5274 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5275 error if --copy-dt-needed-entries aka --add-needed is used and
5276 would cause a change in behaviour.
5277
fe35d28d
ILT
5278 PR 10980
5279 * options.h (class General_options): Add -G as a short version of
5280 --shared. Add no-op options -assert, -g, and -i.
5281
55a2bb35
ST
52822010-01-04 Sriraman Tallam <tmsriram@google.com>
5283
5284 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5285 check for .text or .gnu.linkonce.t sections.
5286 * icf.cc (Icf::find_identical_sections): Ditto.
5287 Change the detection for mangled function name within the section
5288 name.
5289 * icf.h (is_section_foldable_candidate): New function.
5290
719328e1
ILT
52912009-12-30 Ian Lance Taylor <iant@google.com>
5292
5293 PR 10980
5294 * options.h (class General_options): Permit two dashes with
5295 --retain-symbols-file.
5296
d7bb5745
ILT
52972009-12-30 Ian Lance Taylor <iant@google.com>
5298
403a15dd
ILT
5299 PR 10979
5300 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5301 don't put the file header and segment headers in the text
5302 segment.
5303
eda294df
ILT
5304 PR 10979
5305 * common.cc (Sort_commons::operator()): Stabilize sort when both
5306 entries are NULL.
5307 (Symbol_table::do_allocate_commons_list): When allocating common
5308 symbols, skip a symbol which is no longer common.
5309 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5310 an object before checking its type.
5311 * testsuite/common_test_2.c: New file.
5312 * testsuite/common_test_3.c: New file.
5313 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5314 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5315 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5316 (common_test_2_pic.o, common_test_2.so): New targets.
5317 (common_test_3_pic.o, common_test_3.so): New targets.
5318 * testsuite/Makefile.in: Rebuild.
5319
d7bb5745
ILT
5320 PR 10979
5321 * script.cc (read_input_script): If we see a new SECTIONS clause,
5322 and we have added an input section, give an error.
5323 * layout.h (class Layout): Add have_added_input_section function.
5324 Add have_added_input_section_ field.
5325 * layout.cc (Layout::Layout): Initialize
5326 have_added_input_section_.
5327 (Layout::layout): Set have_added_input_section_.
5328 (Layout::layout_eh_frame): Likewise.
5329
fc59c572
ILT
53302009-12-30 Ian Lance Taylor <iant@google.com>
5331
5332 PR 10931
5333 * options.h (class General_options): Add --sort-common option.
5334 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5335 * common.cc (Sort_common): Add sort_order parameter to
5336 constructor. Add sort_order_ field.
5337 (Sort_commons::operator): Check sort_order_.
5338 (Symbol_table::allocate_commons): Determine the sort order.
5339 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5340 Change all callers.
5341 (Symbol_table::do_allocate_commons_list): Likewise.
5342
1c74fab0
ILT
53432009-12-30 Ian Lance Taylor <iant@google.com>
5344
5345 PR 10916
5346 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5347 symbols from this object, don't change the visibility of an
5348 undefined symbol.
5349 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5350
6affe781
ILT
53512009-12-30 Ian Lance Taylor <iant@google.com>
5352
5353 PR 10861
5354 * script.h (class Version_script_info): Define Language enum.
5355 Update declarations. Define Glob, Exact, and Lookup types. Add
5356 new fields globals_, locals_, and is_finalized_.
5357 * script.cc: Various formatting fixes.
5358 (class Parser_closure): Change language_stack_ from a vector of
5359 std::string to one of Version_script_info::Language. Adjust all
5360 uses accordingly.
5361 (class Lazy_demangler): Remove.
5362 (struct Version_expression): Change language from std::string to
5363 Version_script_info::Language.
5364 (Version_script_info::Version_script_info): New function.
5365 (Version_script_info::~Version_script_info): Don't call clear.
5366 (Version_script_info::finalize): New function.
5367 (Version_script_info::build_lookup_tables): New function.
5368 (Version_script_info::build_expression_list_lookup): New
5369 function.
5370 (Version_script_info::get_symbol_version_helper): Rewrite to use
5371 lookup tables.
5372 (Version_script_info::print_expression_list): Adjust to use
5373 Version_script_info::Language.
5374 (script_push_lex_into_version_mode): Check that the version script
5375 has not been finalized.
5376 (version_script_push_lang): Change language string to
5377 Version_script_info::Language.
5378 * options.cc (Command_line::version_script): New function.
5379 * options.h (class General_options): Add finalize_dynamic_list
5380 function. Change version_script from declaration to definition.
5381 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5382 * testsuite/version_script.map: Remove duplicate def of foo.
5383 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5384 version_script.map.
5385 * testsuite/Makefile.in: Rebuild.
5386
818bf354
ILT
53872009-12-30 Ian Lance Taylor <iant@google.com>
5388
5389 PR 10843
5390 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5391 if the input symbol index is 0, make the output symbol index 0.
5392
ebcc8304
ILT
53932009-12-30 Ian Lance Taylor <iant@google.com>
5394
5395 PR 10670
5396 * options.h (class General_options): Add -x/--discard-all.
5397 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5398 --discard-all. If the local symbol needs a dynamic entry, check
5399 that before handling --discard-locals.
5400
176fe33f
ILT
54012009-12-30 Ian Lance Taylor <iant@google.com>
5402
bb321bb1
ILT
5403 PR 10450
5404 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5405 flags to PF_R.
5406 (Output_segment::add_output_section): Don't change the flags if
5407 the type is PT_TLS.
5408
176fe33f
ILT
5409 PR 10450
5410 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5411 GNU hash table if they need a dynamic value. Otherwise, don't add
5412 them if they are defined in a dynamic object or are forced local.
5413
e8cd95c7
ILT
54142009-12-29 Ian Lance Taylor <iant@google.com>
5415
1b81fb71
ILT
5416 PR 10450
5417 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5418 .gnu.hash table for a 32-bit target.
5419
8d6d383d
ILT
5420 PR 10450
5421 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5422 regular and a dynamic object only needs a dynamic symbol table
5423 entry if it is externally visible.
5424
e785ec03
ILT
5425 PR 10450
5426 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5427 constructor. Add global_offset_table_ field.
5428 (Target_i386::got_section): Set global_offset_table_.
5429 (Target_i386::do_finalize_sections): Set global_offset_table_
5430 size.
5431 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5432 in constructor. Add global_offset_table_ field.
5433 (Target_x86_64::got_section): Set global_offset_table_.
5434 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5435 size.
5436
1a2dff53
ILT
5437 * layout.cc (Layout::Layout): Initialize increase_relro_.
5438 (Layout::get_output_section): Add is_relro, is_last_relro, and
5439 is_first_non_relro parameters. Change all callers.
5440 (Layout::choose_output_section): Likewise.
5441 (Layout::add_output_section_data): Likewise.
5442 (Layout::make_output_section): Likewise.
5443 (Layout::set_segment_offsets): Clear increase_relro when using a
5444 linker script.
5445 * layout.h (class Layout): Add increase_relro method. Add
5446 increase_relro_ field. Update declarations.
5447 * output.cc (Output_section::Output_section): Initialize
5448 is_last_relro_ and is_first_non_relro_.
5449 (Output_segment::add_output_section): Group relro sections is
5450 do_sort is true. Handle is_last_relro and is_first_non_relro.
5451 (Output_segment::maximum_alignment): Remove relro handling.
5452 (Output_segment::set_section_addresses): Add increase_relro
5453 parameter. Change all callers. Add initial alignment to align
5454 relro sections on separate page. Remove old relro handling.
5455 (Output_segment::set_section_list_addresses): Remove in_relro
5456 parameter. Change all callers.
5457 (Output_segment::set_offset): Add increase parameter. Change all
5458 callers. Remove old relro handling.
5459 * output.h (class Output_section): Add new methods: is_last_relro,
5460 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5461 Add is_last_relro_ and is_first_non_relro_ fields.
5462 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5463 Create separate .got.plt section. Call increase_relro.
5464 * x86_64.cc (Target_x86_64::got_section): Likewise.
5465 * testsuite/relro_script_test.t: Add .got.plt.
5466
f0ba79e2
ILT
5467 PR 10450
5468 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5469 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5470 (Layout::finalize): Call set_dynamic_symbol_size.
5471 (Layout::set_dynamic_symbol_size): New function.
5472 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5473 set_dynamic_symbol_size.
5474
e8cd95c7
ILT
5475 PR 10450
5476 * output.h (class Output_section): Add is_entsize_zero_ field.
5477 * output.cc (Output_section::Output_section): Initialize
5478 is_entsize_zero_.
5479 (Output_section::set_entsize): If two different entsizes are
5480 requested, force it to zero.
5481 (Output_section::add_input_section): Set flags for .debug_str
5482 before updating section flags. Set entsize.
5483 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5484 and SHF_STRING if all input sections have those flags.
5485
3e1b9a8a
RÁE
54862009-12-29 Rafael Espindola <espindola@google.com>
5487
5488 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
5489 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5490 reporting.
3e1b9a8a 5491
3dcad376
ST
54922009-12-29 Sriraman Tallam <tmsriram@google.com>
5493
5494 * options.cc (General_options::parse_version): Allow -v to exit
5495 without an error if there is nothing to link.
5496
084e2665
ILT
54972009-12-29 Ian Lance Taylor <iant@google.com>
5498
5499 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5500 using a version of gcc before 4.1.
5501 * configure: Rebuild.
5502
250acde3
CD
55032009-12-28 Chris Demetriou <cgd@google.com>
5504
5505 * attributes.cc (Output_attributes_section_data::do_write): Use
5506 std::vector::front rather than std::vector::data.
5507
99fff23b
ILT
55082009-12-28 Ian Lance Taylor <iant@google.com>
5509
5510 * symtab.h (class Symbol_table): Add enum Defined.
5511 * resolve.cc (Symbol_table::should_override): Add defined
5512 parameter. Change all callers. Test whether object is NULL
5513 before calling a method on it.
5514 (Symbol_table::report_resolve_problem): Add defined parameter.
5515 Change all callers.
5516 (Symbol_table::should_override_with_special): Likewise.
5517 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5518 parameter. Change all callers.
5519 (Symbol_table::do_define_in_output_data): Likewise.
5520 (Symbol_table::define_in_output_segment): Likewise.
5521 (Symbol_table::do_define_in_output_segment): Likewise.
5522 (Symbol_table::define_as_constant): Likewise.
5523 (Symbol_table::do_define_as_constant): Likewise.
5524 * script.h (class Symbol_assignment): Add is_defsym parameter to
5525 constructor; change all callers.
5526 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5527 parameter. Change all callers. Add is_defsym_ field.
5528 (class Parser_closure): Add parsing_defsym parameter to
5529 constructor; change all callers. Add parsing_defsym accessor
5530 function. Add parsing_defsym_ field.
5531
556bd683
ILT
55322009-12-28 Ian Lance Taylor <iant@google.com>
5533
5534 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 5535 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 5536
1782c879
ILT
55372009-12-23 Ian Lance Taylor <iant@google.com>
5538
5539 * i386.cc (Target_i386::do_calls_non_split): Recognize
5540 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
5541 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5542 -fsplit-stack prologue when using %r11.
1782c879 5543
329ca2b1
ST
55442009-12-21 Sriraman Tallam <tmsriram@google.com>
5545
5546 * options.cc (General_options::parse_version): Make -v continue and do
5547 the link like GNU ld does.
5548
d675ff46
RÁE
55492009-12-17 Rafael Avila de Espindola <espindola@google.com>
5550
5551 * Makefile.am (CCFILES): Add timer.cc.
5552 (HFILES): Add timer.h.
5553 * configure.ac: Check for sysconf and times.
5554 * main.cc: include timer.h.
5555 (main): Use Timer instead of get_run_time.
5556 * timer.cc: New.
5557 * timer.h: New.
5558 * workqueue.cc: include timer.h.
5559 (Workqueue::find_and_run_task):
5560 Report user, sys and wall time.
5561 * Makefile.in: Regenerate.
5562 * config.in: Regenerate.
5563 * configure: Regenerate.
5564
d6344fb5
DK
55652009-12-16 Doug Kwan <dougkwan@google.com>
5566
5567 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5568 sections.
5569 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5570 relaxed input sections.
5571 * output.cc (Output_section::find_relaxed_input_section): Change
5572 return type to Output_relaxed_input_section pointer. Adjust code
5573 for new type of relaxed_input_section_map_.
5574 * output.h (Output_section::find_relaxed_input_section): Change
5575 return type to Output_relaxed_input_section pointer.
5576 (Output_section::Output_relaxed_input_section_by_input_section_map):
5577 New type.
5578 (Output_section::relaxed_input_section_map_): Change type to
5579 Output_section::Output_relaxed_input_section_by_input_section_map.
5580 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5581 input section.
5582
0e0d5469
ILT
55832009-12-15 Ian Lance Taylor <iant@google.com>
5584
5585 * layout.cc (Layout::create_shstrtab): Only write out after input
5586 sections if we are compressing debug sections.
5587
0649a889
ILT
55882009-12-15 Ian Lance Taylor <iant@google.com>
5589
5590 * archive.cc (Archive::add_symbols): Only look up a symbol without
5591 a version if there is, in fact, a version.
5592
2ea97941
ILT
55932009-12-14 Ian Lance Taylor <iant@google.com>
5594
5595 Revert -Wshadow changes, all changes from:
5596 2009-12-11 Doug Kwan <dougkwan@google.com>
5597 2009-12-11 Nick Clifton <nickc@redhat.com>
5598 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5599
b0eec2cc
DK
56002009-12-11 Doug Kwan <dougkwan@google.com>
5601
5602 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5603 due to -Wshadow.
5604 * attributes.cc (Object_attribute::size): Ditto.
5605 (Attributes_section_data::size): Ditto.
5606 (Attributes_section_data::Attributes_section_data): Ditto.
5607 (Output_attributes_section_data::do_write): Ditto.
5608 * attributes.h (Object_attribute::set_type): Ditto.
5609 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5610
91d6fa6a
NC
56112009-12-11 Nick Clifton <nickc@redhat.com>
5612
5613 * archive.cc: Fix shadowed variable warnings.
5614 * arm.cc: Likewise.
5615 * compressed_output.cc: Likewise.
5616 * compressed_output.h: Likewise.
5617 * configure: Likewise.
5618 * dwarf_reader.cc: Likewise.
5619 * dynobj.cc: Likewise.
5620 * dynobj.h: Likewise.
5621 * ehframe.cc: Likewise.
5622 * ehframe.h: Likewise.
5623 * errors.cc: Likewise.
5624 * expression.cc: Likewise.
5625 * fileread.cc: Likewise.
5626 * fileread.h: Likewise.
5627 * freebsd.h: Likewise.
5628 * i386.cc: Likewise.
5629 * icf.cc: Likewise.
5630 * incremental.h: Likewise.
5631 * layout.cc: Likewise.
5632 * layout.h: Likewise.
5633 * mapfile.cc: Likewise.
5634 * merge.cc: Likewise.
5635 * merge.h: Likewise.
5636 * object.cc: Likewise.
5637 * object.h: Likewise.
5638 * options.h: Likewise.
5639 * output.cc: Likewise.
5640 * output.h: Likewise.
5641 * parameters.cc: Likewise.
5642 * plugin.cc: Likewise.
5643 * powerpc.cc: Likewise.
5644 * reduced_debug_output.cc: Likewise.
5645 * reduced_debug_output.h: Likewise.
5646 * reloc.cc: Likewise.
5647 * reloc.h: Likewise.
5648 * resolve.cc: Likewise.
5649 * script-sections.cc: Likewise.
5650 * script.cc: Likewise.
5651 * script.h: Likewise.
5652 * sparc.cc: Likewise.
5653 * symtab.cc: Likewise.
5654 * symtab.h: Likewise.
5655 * target-select.cc: Likewise.
5656 * target-select.h: Likewise.
5657 * token.h: Likewise.
5658 * workqueue.cc: Likewise.
5659 * workqueue.h: Likewise.
5660 * x86_64.cc: Likewise.
5661
a0351a69
DK
56622009-12-10 Doug Kwan <dougkwan@google.com>
5663
5664 * arm.cc (attributes.h): New include.
5665 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5666 (Arm_relobj::~Arm_relobj): Delete object pointed by
5667 attributes_section_data_.
5668 (Arm_relobj::attributes_section_data): New method definition.
5669 (Arm_relobj::attributes_section_data_): New data member declaration.
5670 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5671 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5672 attributes_section_data_.
5673 (Arm_dynobj::attributes_section_data): New method definition.
5674 (Arm_dynobj::attributes_section_data_): New data member declaration.
5675 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5676 initialization value of may_use_blx_ to false.
5677 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5678 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5679 object attributes to compute results instead of hard-coding.
5680 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5681 Target_arm::get_secondary_compatible_arch,
5682 Target_arm::set_secondary_compatible_arch
5683 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5684 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5685 New method declarations.
5686 (Target_arm::get_aeabi_object_attribute): New method definition.
5687 (Target_arm::attributes_section_data_): New data member declaration.
5688 (read_arm_attributes_section): New template definition.
5689 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5690 (Arm_dynobj::do_read_symbols): Ditto.
5691 (Target_arm::do_finalize_sections): Merge attributes sections from
5692 input. Check for BLX use after attributes section merging.
5693 Fix __exidx_start and __exidx_end visibility. Create an
5694 .ARM.attributes section if necessary.
5695 (Target_arm::get_secondary_compatible_arch,
5696 Target_arm::set_secondary_compatible_arch,
5697 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5698 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 5699 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
5700 New method definitions.
5701
b59befec
ILT
57022009-12-09 Ian Lance Taylor <iant@google.com>
5703
5704 * plugin.cc (Plugin::load): Don't cast from void* to a function
5705 pointer.
5706
1276bc89
ILT
57072009-12-09 Ian Lance Taylor <iant@google.com>
5708
5709 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5710 information fields.
5711
2f2de248
L
57122009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5713
5714 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5715 Replace two_file_shared_1.so with two_file_shared_2.so.
5716 * testsuite/Makefile.in: Regenerated.
5717
4f787271
DK
57182009-12-08 Doug Kwan <dougkwan@google.com>
5719
5720 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5721 (HFILES): Add attributes.h and int_encoding.h.
5722 * Makefile.in: Regenerate.
5723 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5724 function definitions to int_encoding.cc
5725 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5726 prototypes to int_encoding.h
5727 * reduced_debug_output.cc (int_encoding.h): New include.
5728 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5729 function definitions to int_encoding.cc
5730 (insert_into_vector, read_from_pointer): Move template definitions to
5731 int_encoding.h
5732 * attributes.cc: New file.
5733 * attributes.h: New file.
5734 * int_encoding.cc: New file.
5735 * int_encoding.h: New file.
5736
20b52f1a
RÁE
57372009-12-07 Rafael Avila de Espindola <espindola@google.com>
5738
5739 PR gold/11055
5740 * incremental-dump.cc (dump_incremental_inputs): New.
5741 (main): Use dump_incremental_inputs.
5742
53d7974c
L
57432009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5744
5745 PR gold/10893
5746 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5747 checking elfcpp::STT_FUNC.
5748 (Target_i386::Relocate::relocate): Likewise.
5749 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5750
5751 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5752 symbols from shared libraries into normal FUNC symbols.
5753
5754 * symtab.h (Symbol): Add is_func and use it.
5755
05a352e6
DK
57562009-12-05 Doug Kwan <dougkwan@google.com>
5757
5758 * arm.cc (Target_arm::arm_info): Initialize new fields
5759 attributes_section and attributes_vendor.
5760 * i386.cc (Target_i386::i386_info): Same.
5761 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5762 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5763 fields attributes_section and attributes_vendor.
53d7974c 5764 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
5765 * target.h (Target::attributes_section, Target::attributes_vendor,
5766 Target::is_attributes_section, Target::attribute_arg_type,
5767 Target::attributes_order): New method definitions.
5768 (Target::Target_info::attributes_section,
5769 Target::Target_info::attributes_vendor): New fields.
5770 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5771 virtual method definitions.
5772 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5773 attributes_section and attributes_vendor.
5774 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5775
f4e5969c
DK
57762009-12-05 Doug Kwan <dougkwan@google.com>
5777
5778 * arm.cc: Update comments about interworking and stub generation.
5779 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5780 considered as non-PIC.
5781 (Arm_relocate_functions::base_abs): Fix formatting.
5782 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5783 of function to use GOT entry address instead of offset.
5784 (Target_arm::Scan::global): Issue an error if a symbol would need a
5785 PLT does not get one because it is untyped. Remove code to create
5786 dynamic symbols for relative branches.
5787 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5788 takes unsigned integer instead of boolean.
5789
1abce4a6
L
57902009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5791
5792 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5793 (two_file_test_LDADD): Likewise.
5794 (common_test_1_LDADD): Likewise.
5795 (exception_test_LDADD) Likewise.
5796 (weak_test_LDADD): Likewise.
5797 (many_sections_test_LDADD): Likewise.
5798 (initpri1_LDADD): Likewise.
5799 (script_test_1_LDADD): Likewise.
5800 (script_test_2_LDADD): Likewise.
5801 (justsyms_LDADD): Likewise.
5802 (binary_test_LDADD): Likewise.
5803 (large_LDADD): Likewise.
5804 * testsuite/Makefile.in: Regenerated.
5805
adcf2816 58062009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 5807
adcf2816
L
5808 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5809 (Symbol_table::override_with_special): Likewise.
5810 (Symbol_table::add_from_object): Likewise.
5811
28e67f5d
RÁE
58122009-12-04 Rafael Avila de Espindola <espindola@google.com>
5813
5814 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5815 Don't set the data_offset twice.
5816
ae10a101
RÁE
58172009-12-04 Rafael Avila de Espindola <espindola@google.com>
5818
5819 * testsuite/Makefile.in: Regenerate.
5820
f59f41f3
DK
58212009-12-03 Doug Kwan <dougkwan@google.com>
5822
5823 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5824 (Target_arm::do_finalize_sections): Add parameter for symbol table
5825 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5826 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5827 parameter for symbol table pointer.
5828 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5829 an additional parameter for a pointer to symbol table.
5830 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5831 parameter for a symbol table pointer.
5832 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5833 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5834 Ditto.
5835 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5836 parameter for a symbol table pointer.
5837
ca55d848
RÁE
58382009-12-03 Rafael Avila de Espindola <espindola@google.com>
5839
5840 * incremental.cc (Incremental_inputs_header)
5841 (Incremental_inputs_header_write, Incremental_inputs_entry)
5842 (Incremental_inputs_entry_write): Move ...
5843 * incremental.h (Incremental_inputs_header)
5844 (Incremental_inputs_header_write, Incremental_inputs_entry)
5845 (Incremental_inputs_entry_write): here.
5846
3aec4f9c
RÁE
58472009-12-02 Rafael Avila de Espindola <espindola@google.com>
5848
5849 * incremental.cc (make_sized_incremental_binary): Set the target.
5850 Error if it is incompatible.
5851 * output.h (Output_file): Add filename method.
5852
9c0ae74d
RÁE
58532009-12-02 Rafael Avila de Espindola <espindola@google.com>
5854
5855 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5856 from the get_* methods.
5857
a45500ae
RÁE
58582009-12-02 Rafael Avila de Espindola <espindola@google.com>
5859
5860 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5861 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5862 Write 0 for the data_offset of scripts.
5863
325e6408
RÁE
58642009-12-02 Rafael Avila de Espindola <espindola@google.com>
5865
5866 * testsuite/Makefile.am: Add the incremental_test.sh test.
5867 * testsuite/incremental_test.sh: New.
5868 * testsuite/incremental_test_1.c: New.
5869 * testsuite/incremental_test_2.c: New.
5870
954c3e2e
RÁE
58712009-12-01 Rafael Avila de Espindola <espindola@google.com>
5872
5873 * incremental-dump.cc (main): Fix typos.
5874
f8086623
RÁE
58752009-11-27 Rafael Avila de Espindola <espindola@google.com>
5876
5877 PR gold/11025
5878 * incremental-dump.cc (main): Use llu to print 64 bit values.
5879
3b0dd6ac
L
58802009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5881 H.J. Lu <hongjiu.lu@intel.com>
5882
5883 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5884 $(LIBDL).
5885 (incremental_dump_LDADD): Likewise.
5886 * Makefile.in: Regenerated.
5887
a6d1ef57 58882009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 5889
a6d1ef57
DK
5890 Revert:
5891
5892 2009-11-25 Doug Kwan <dougkwan@google.com>
5893
5894 * arm.cc (Target_arm::Target_arm): Move method definition
5895 outside of class definition. Add code to handle
5896 --target1-rel, --target1-abs and --target2= options.
5897 (Target_arm::get_reloc_reloc_type): Change method to be
5898 non-static and const.
5899 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5900 New data member declaration.
5901 (Target_arm::Scan::local, Target_arm::Scan::global,
5902 Target_arm::Relocate::relocate,
5903 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5904 Adjust call to Target_arm::get_real_reloc_type.
5905 (Target_arm::get_real_reloc_type): Use command line options
5906 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5907 * options.h (--target1-rel, --target1-abs, --target2): New
5908 ARM-only options.
5909
50aeb7d4
DK
59102009-11-25 Doug Kwan <dougkwan@google.com>
5911
5912 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5913 class definition. Add code to handle --target1-rel, --target1-abs
5914 and --target2= options.
5915 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5916 and const.
5917 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5918 member declaration.
5919 (Target_arm::Scan::local, Target_arm::Scan::global,
5920 Target_arm::Relocate::relocate,
5921 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5922 call to Target_arm::get_real_reloc_type.
5923 (Target_arm::get_real_reloc_type): Use command line options to
5924 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5925 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5926 options.
5927
51938283
DK
59282009-11-25 Doug Kwan <dougkwan@google.com>
5929
5930 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5931 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5932 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5933 formatting.
5934 (Arm_relocate_functions::thm_call): Replace body with a call to
5935 Arm_relocate_functions::thumb_branch_common.
5936 (Arm_relocate_functions::thm_jump24,
5937 Arm_relocate_functions::thm_xpc22): New method definitions.
5938 (Arm_relocate_functions::thumb_branch_common): New method definition.
5939 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5940 operator.
5941 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5942 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5943
e2b8f3c4
RÁE
59442009-11-24 Rafael Avila de Espindola <espindola@google.com>
5945
5946 * Makefile.am: Build incremental-dump
5947 * Makefile.in: Regenerate.
5948 * incremental-dump.cc: New.
5949 * incremental.cc (Incremental_inputs_header_data,
5950 Incremental_inputs_entry_data): Move to incremental.h
5951 * incremental.h: (Incremental_inputs_header_data,
5952 Incremental_inputs_entry_data): Move from incremental.cc
5953
bcba9aec
RÁE
59542009-11-24 Rafael Avila de Espindola <espindola@google.com>
5955
5956 * incremental.cc (Incremental_inputs_header,
5957 Incremental_inputs_header_write, Incremental_inputs_entry,
5958 Incremental_inputs_entry_write): Add a typedef with the data type.
5959
7c3afe08
RÁE
59602009-11-24 Rafael Avila de Espindola <espindola@google.com>
5961
5962 * incremental.cc (Incremental_inputs_header,
5963 Incremental_inputs_header_write, Incremental_inputs_entry,
5964 Incremental_inputs_entry_write): Update comment about which
5965 type has the filed descriptions.
5966
d204b6e9
DK
59672009-11-15 Doug Kwan <dougkwan@google.com>
5968
5969 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5970 (Arm_relocate_functions::arm_branch_common): Change method defintion
5971 in class definition to a method declaration and update list of formal
5972 parameters.
5973 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5974 Arm_relocation_functions::jump24): Adjust call to
5975 Arm_relocate_functions::arm_branch_common. Update list of formal
5976 parameters.
5977 (Arm_relocate_functions::xpc25): New method definition.
5978 (Arm_relocate_functions::arm_branch_common): Move method defintion
5979 out from class definition. Use stubs for mode-switching and extending
5980 branch ranges.
5981 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5982 specially. Change code to enable use of stubs in ARM branches.
5983
43d12afe
DK
59842009-11-10 Doug Kwan <dougkwan@google.com>
5985
5986 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5987 in method declaration.
5988 (Target_arm::relocate_stub): New method declaration.
5989 (Target_arm::default_target): Change to return a pointer instead of
5990 a const reference.
5991 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5992 Target_arm::default_target.
5993 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5994 method definition.
5995 (Target_arm::relocate_section): Adjust view.
5996 (Target_arm::relocate_stub): New method definition.
5997
ac33a407
DK
59982009-11-10 Doug Kwan <dougkwan@google.com>
5999
6000 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6001 a format warning.
6002 * incremental.cc (open_incremental_binary): Initialized local
6003 variables to avoid warnings.
6004 * object.cc (make_elf_object): Ditto.
6005 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6006 a format warning.
e1df38aa 6007
88ee28e9
L
6008009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6009
6010 PR gold/10930
6011 * testsuite/plugin_test.c: Include "config.h".
6012
2daedcd6
DK
60132009-11-09 Doug Kwan <dougkwan@google.com>
6014
6015 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6016 (arm_symbol_value): Remove.
6017 (Arm_relocate_functions::arm_branch_common,
6018 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6019 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6020 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6021 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6022 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6023 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6024 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6025 Arm_relocate_functions::thm_mobw_abs_nc,
6026 Arm_relocate_functions::thm_mov_abs,
6027 Arm_relocate_functions::movw_prel_nc,
6028 Arm_relocate_functions::thm_movt_abs,
6029 Arm_relocate_functions::movt_prel,
6030 Arm_relocate_functions::thm_movw_prel_nc,
6031 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6032 (Target_arm::Relocate::relocate): Only decompose address into two
6033 parts if relocation type uses the thumb-bit and pass the actual
6034 bit instead of a flag indicating that the thumb-bit is used. Adjust
6035 calls to methods in Arm_relocate_functions for this change.
6036
1276bc89 60372009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
6038
6039 PR 10925
6040 * reloc.cc: Instantiate
6041 Sized_relobj::initialize_input_to_output_maps and
6042 Sized_relobj:free_input_to_output_maps.
6043
e53ad1b5
ILT
60442009-11-06 Ian Lance Taylor <iant@google.com>
6045
6046 PR 10876
6047 * defstd.cc (in_segment): Set only_if_ref true for "end".
6048
eb44217c
DK
60492009-11-06 Doug Kwan <dougkwan@google.com>
6050
6051 * arm.cc (class Reloc_stub): Correct a comment.
6052 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6053 (Target_arm::scan_section_for_stubs): New method declaration.
6054 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6055 Change methods from private to protected.
6056 (Target_arm::do_may_relax): New method definition.
6057 (Target_arm::do_relax, Target_arm::group_sections,
6058 Target_arm::scan_reloc_for_stub,
6059 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6060 (Target_arm::arm_input_section_map_): New data member declaration.
6061 (Target_arm::scan_reloc_for_stub,
6062 Target_arm::scan_reloc_section_for_stubs,
6063 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6064 Target_arm::do_relax): New method definitions.
6065
5d329b7d
ILT
60662009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6067
6068 * configure.ac: Check for (struct stat)::st_mtim
6069 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6070 * config.in: Regenerate.
6071 * configure: Regenerate.
6072
96a0d71b
ILT
60732009-11-05 Ian Lance Taylor <iant@google.com>
6074
6075 PR 10910
6076 * output.cc (Output_segment::add_output_section): Add missing
6077 return statement.
6078
594c8e5e
ILT
60792009-11-04 Ian Lance Taylor <iant@google.com>
6080
6081 PR 10880
6082 * object.h (class Object): Add is_needed and set_is_needed
6083 methods. Add is_needed_ field. Make bool fields into bitfields.
6084 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6085 defined in a dynamic object and referenced by a regular object,
6086 set is_needed for the dynamic object.
6087 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6088 if the file is marked with as_needed and it is not needed.
6089
22b127cc
ILT
60902009-11-04 Ian Lance Taylor <iant@google.com>
6091
6092 PR 10887
6093 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6094 tags if data is discarded by linker script.
6095 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6096 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6097 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6098 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6099
f5c870d2
ILT
61002009-11-04 Ian Lance Taylor <iant@google.com>
6101
6102 * layout.cc (Layout::get_output_section): Add is_interp and
6103 is_dynamic_linker_section parameters. Change all callers.
6104 (Layout::choose_output_section): Likewise.
6105 (Layout::make_output_section): Likewise.
6106 (Layout::add_output_section_data): Add is_dynamic_linker_section
6107 parameter. Change all callers.
6108 * layout.h (class Layout): Update declarations.
6109 * output.h (class Output_section): Add is_interp, set_is_interp,
6110 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6111 Add is_interp_, is_dynamic_linker_section_ fields. Change
6112 generate_code_fills_at_write_ to a bitfield.
6113 * output.cc (Output_section::Output_sections): Initialize new
6114 fields.
6115 (Output_segment::add_output_section): Add do_sort parameter.
6116 Change all callers.
6117
1ae4d23b
ILT
61182009-11-03 Ian Lance Taylor <iant@google.com>
6119
6120 PR 10860
6121 * options.h (class General_options): Add --warn-common.
6122 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6123 merging two common symbols.
6124 (Symbol_table::should_override): Handle --warn-common when merging
6125 a common symbol with a defined symbol. Use report_resolve_problem
6126 for multiple definitions.
6127 (Symbol_table::report_resolve_problem): New function.
6128 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6129
55da9579
DK
61302009-11-03 Doug Kwan <dougkwan@google.com>
6131
6132 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6133 stub_factory_.
6134 (Target_arm::stub_factory): New method definition.
6135 (Target_arm::new_arm_input_section,
6136 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6137 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 6138 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
6139 New type definitions.
6140 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6141 member declarations.
6142 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6143 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6144 New method definitions.
6145
37a9ac43
ILT
61462009-11-03 Ian Lance Taylor <iant@google.com>
6147
6148 * options.h (class General_options): Add --warn_constructors.
6149
b3d6a3d4
ILT
61502009-11-03 Ian Lance Taylor <iant@google.com>
6151
6152 PR 10893
6153 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6154 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6155
934b01dd
ILT
61562009-11-03 Ian Lance Taylor <iant@google.com>
6157
6158 PR 10895
6159 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6160 --msgid-bugs-address.
6161 (install-pdf): New target.
6162 (install-data_yes): Look up one directory to find mkinstalldirs.
6163
03c1939b
L
61642009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6165
6166 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6167 tree.
6168
ebd95253
DK
61692009-10-30 Doug Kwan <dougkwan@google.com>
6170
6171 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6172
e9bbb538
DK
61732009-10-30 Doug Kwan <dougkwan@google.com>
6174
6175 * arm.cc (Stub_addend_reader): New struct template definition
6176 and partial specializations.
6177 (Stub_addend_reader::operator()): New method definition for a
6178 partially specialized template.
6179
d5b40221
DK
61802009-10-30 Doug Kwan <dougkwan@google.com>
6181
6182 * arm.cc (Arm_relobj::processor_specific_flags): New method
6183 definition.
6184 (Arm_relobj::do_read_symbols): New method declaration.
6185 (Arm_relobj::processor_specific_flags_): New data member declaration.
6186 (Arm_dynobj): New class definition.
6187 (Target_arm::do_finalize_sections): Add input_objects parameter.
6188 (Target_arm::do_adjust_elf_header): New method declaration.
6189 (Target_arm::are_eabi_versions_compatible,
6190 (Target_arm::merge_processor_specific_flags): New method declaration.
6191 (Target_arm::do_make_elf_object): New overloaded method definitions
6192 and declaration.
6193 (Arm_relobj::do_read_symbols): New method definition.
6194 (Arm_dynobj::do_read_symbols): Ditto.
6195 (Target_arm::do_finalize_sections): Add input_objects parameters.
6196 Merge processor-specific flags from all input objects.
6197 (Target_arm::are_eabi_versions_compatible,
6198 Target_arm::merge_processor_specific_flags,
6199 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6200 New method definitions.
6201 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6202 Input_objects pointer type parameter.
6203 * layout.cc (Layout::finalize): Pass input objects to target's.
6204 finalize_sections function.
6205 * output.cc (Output_file_header::do_sized_write): Set ELF file
6206 header's processor-specific flags.
6207 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6208 Input_objects pointer type parameter.
6209 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6210 * target.h (Input_objects): New forward class declaration.
6211 (Target::processor_specific_flags,
6212 Target::are_processor_specific_flags_sect): New method definitions.
6213 (Target::finalize_sections): Add input_objects parameter.
6214 (Target::Target): Initialize processor_specific_flags_ and
6215 are_processor_specific_flags_set_.
6216 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6217 parameter.
6218 (Target::set_processor_specific_flags): New method definition.
6219 (Target::processor_specific_flags_,
6220 Target::are_processor_specific_flags_set_): New data member
6221 declarations.
6222 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6223 Input_objects pointer type parameter.
6224
ebabffbd
DK
62252009-10-30 Doug Kwan <dougkwan@google.com>
6226
6227 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6228
ad0f2072
ILT
62292009-10-28 Ian Lance Taylor <iant@google.com>
6230
6231 * object.h (class Relobj): Drop options parameter from
6232 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6233 do_scan_relocs, do_relocate. Change all callers.
6234 (class Sized_relobj): Drop options parameters from
6235 do_gc_process_relocs, do_scan_relocs, do_relocate,
6236 do_relocate_sections, relocate_sections, emit_relocs_scan,
6237 emit_relocs_scan_reltype. Change all callers.
6238 (struct Relocate_info): Remove options field and all references to
6239 it.
6240 * reloc.h (class Read_relocs): Remove options constructor
6241 parameter and options_ field. Change all callers.
6242 (class Gc_process_relocs, class Scan_relocs): Likewise.
6243 (class Relocate_task): Likewise.
6244 * target-reloc.h (scan_relocs): Remove options parameter. Change
6245 all callers.
6246 (scan_relocatable_relocs): Likewise.
6247 * target.h (class Sized_target): Remove options parameter from
6248 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6249 all callers.
6250 * gc.h (gc_process_relocs): Remove options parameter. Change all
6251 callers.
6252 * arm.cc: Update functions to remove options parameters.
6253 * i386.cc: Likewise.
6254 * powerpc.cc: Likewise.
6255 * sparc.cc: Likewise.
6256 * x86_64.cc: Likewise.
6257 * testsuite/testfile.cc: Likewise.
6258
8ffa3667
DK
62592009-10-28 Doug Kwan <dougkwan@google.com>
6260
6261 * arm.cc (Arm_relobj): New class definition.
e1df38aa 6262 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
6263 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6264 New method definitions.
6265
40f36857
CC
62662009-10-28 Cary Coutant <ccoutant@google.com>
6267
6268 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6269 (Plugin::cleanup_done_): New member.
6270 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6271 (Plugin_manager::cleanup_done_): Remove.
6272 (Plugin_manager::add_input_file): Edit error message.
6273 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6274 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6275
2c849493
ILT
62762009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6277
6278 * fileread.cc: (File_read::View::~View): Use the new
6279 data_ownership_ filed.
6280 (File_read::~File_read): Dispose the new whole_file_view_.
6281 (File_read::open): Mmap the whole file if needed.
6282 (File_read::open): Use whole_file_view_ instead of contents_.
6283 (File_read::find_view): Use whole_file_view_ if applicable.
6284 (File_read::do_read): Use whole_file_view_ instead of contents_.
6285 (File_read::make_view): Use whole_file_view_ instead of contents_,
6286 update File_read::View::View call.
6287 (File_read::find_or_make_view): Update File_read::View::View
6288 call.
6289 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6290 remove contents_
6291 (File_read::View::Data_ownership): New enum.
6292 (File_read::View::View): Replace bool mapped_ with Data_ownership
6293 argument.
6294 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6295 (File_read::View::data_ownership_): New field.
6296 (File_read::contents_): Remove (replaced by whole_file_view_).
6297 (File_read::whole_file_view_): New field.
6298 * options.h (class General_options): Add --keep-files-mapped.
6299
24998053
CC
63002009-10-27 Cary Coutant <ccoutant@google.com>
6301
6302 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6303 * testsuite/Makefile.am (plugin_test_5): New test case.
6304 * testsuite/Makefile.in: Regenerate.
6305
72adc4fa
DK
63062009-10-25 Doug Kwan <dougkwan@google.com>
6307
6308 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6309 from private to protected to allow access by child class.
6310 (Sized_relobj::do_relocate_sections): New method declaration.
6311 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 6312 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
6313 Sized_relobj::relocate_sections. Instantiate template explicitly
6314 for different target sizes and endianity.
6315
07f508a2
DK
63162009-10-24 Doug Kwan <dougkwan@google.com>
6317
6318 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6319 (Arm_input_section::as_arm_input_section): New method.
6320 (Arm_output_section): New class definition.
6321 (Arm_output_section::create_stub_group,
6322 Arm_output_section::group_sections): New method definitions.
6323
10ad9fe5
DK
63242009-10-22 Doug Kwan <dougkwan@google.com>
6325
6326 * arm.cc (Arm_input_section): New class definition.
6327 (Arm_input_section::init, Arm_input_section:do_write,
6328 Arm_input_section::set_final_data_size,
6329 Arm_input_section::do_reset_address_and_file_offset): New method
6330 definitions.
6331
56ee5e00
DK
63322009-10-21 Doug Kwan <dougkwan@google.com>
6333
6334 * arm.cc (Stub_table, Arm_input_section): New forward class
6335 declarations.
6336 (Stub_table): New class defintion.
6337 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6338 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6339 New method definition.
6340
b569affa
DK
63412009-10-21 Doug Kwan <dougkwan@google.com>
6342
6343 * arm.cc: Update copyright comments.
6344 (Target_arm): New forward class template declaration.
6345 (Arm_address): New type.
6346 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6347 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6348 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6349 constants.
6350 (Insn_template): Same.
6351 (DEF_STUBS): New macro.
6352 (Stub_type): New enum type.
6353 (Stub_template): New class definition.
6354 (Stub): Same.
6355 (Reloc_stub): Same.
6356 (Stub_factory): Same.
6357 (Target_arm::Target_arm): Initialize may_use_blx_ and
6358 should_force_pic_veneer_.
6359 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6360 Target_arm::should_force_pic_veneer,
6361 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6362 Target_arm::using_thumb_only, Target_arm:;default_target): New
6363 method defintions.
6364 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6365 New data member declarations.
6366 (Insn_template::size, Insn_template::alignment): New method defintions.
6367 (Stub_template::Stub_template): New method definition.
6368 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6369 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6370 (Stub_factory::Stub_factory): New method definition.
6371 * gold.h (string_hash): New template.
6372 * output.h (Input_section_specifier::hash_value): Use
6373 gold::string_hash.
6374 (Input_section_specifier::string_hash): Remove.
6375 * stringpool.cc (Stringpool_template::string_hash): Use
6376 gold::string_hash.
6377
6c172549
DK
63782009-10-20 Doug Kwan <dougkwan@google.com>
6379
6380 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6381 symbols of relaxed input sections.
6382 * output.h (Output_section::find_relaxed_input_section): Make
6383 method public.
6384
c5617f2f
DK
63852009-10-16 Doug Kwan <dougkwan@google.com>
6386
6387 * dynobj.cc (Versions::Versions): Initialize version_script_.
6388 Only insert base version symbol definition for a shared object
6389 if version script defines any version versions.
6390 (Versions::define_base_version): New method definition.
6391 (Versions::add_def): Check that base version is not needed.
6392 (Versions::add_need): Define base version lazily.
6393 * dynobj.h (Versions::define_base_version): New method declaration.
6394 (Versions::needs_base_version_): New data member declaration.
6395 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6396 (check_DATA): Add no_version_test.stdout.
6397 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6398 New make rules.
6399 * testsuite/Makefile.in: Regenerate.
6400 * testsuite/no_version_test.c: New file.
6401 * testsuite/no_version_test.sh: Ditto.
6402
3c12dcdb
DK
64032009-10-16 Doug Kwan <dougkwan@google.com>
6404
6405 * expression.cc (class Segment_start_expression): New class definition.
6406 (Segment_start_expression::value): New method definition.
6407 (script_exp_function_segment_start): Return a new
6408 Segment_start_expression.
6409 * gold/script-c.h (script_saw_segment_start_expression): New function
6410 prototype.
6411 * script-sections.cc (Script_sections::Script_sections): Initialize
6412 SAW_SEGMENT_START_EXPRESSION_ to false.
6413 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6414 and -Tbbs options to specify section addresses if given in
6415 command line and no SEGMENT_START expression is seen in a script.
6416 * script-sections.h (Script_sections::saw_segment_start_expression,
6417 Script_sections::set_saw_segment_start_expression): New method
6418 definition.
6419 (Script_sections::saw_segment_start_expression_): New data member
6420 declaration.
6421 * script.cc (script_saw_segment_start_expression): New function.
6422 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6423 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6424 script_test_7.sh and script_test_8.sh.
6425 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6426 script_test_8.stdout.
6427 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6428 (script_test_6, script_test_6.stdout, script_test_7,
6429 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6430 * Makefile.in: Regenerate.
6431 * testsuite/script_test_6.sh: New file.
6432 * testsuite/script_test_6.t: Same.
6433 * testsuite/script_test_7.sh: Same.
6434 * testsuite/script_test_7.t: Same.
6435 * testsuite/script_test_8.sh: Same.
6436
64b1ae37
DK
64372009-10-16 Doug Kwan <dougkwan@google.com>
6438
6439 * output.cc (Output_segment::set_section_list_address): Cast
6440 expressions to unsigned long long type to avoid format warnings.
6441
661be1e2
ILT
64422009-10-15 Ian Lance Taylor <iant@google.com>
6443
12edd763 6444 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 6445 dot assignment to script_sections_.
12edd763
ILT
6446 * script-sections.cc (Script_sections::add_dot_assignment):
6447 Initialize if necessary.
6448
68b6574b
ILT
6449 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6450 program headers with no load segment if there is a linker script.
6451
661be1e2
ILT
6452 * layout.cc (Layout::set_segment_offsets): Align the file offset
6453 to the segment aligment for -N or -n with no load segment.
6454 * output.cc (Output_segment::add_output_section): Don't crash if
6455 the first section is a TLS section.
6456 (Output_segment::set_section_list_addresses): Print an error
6457 message if the address moves backward in a linker script.
6458 * script-sections.cc
6459 (Output_section_element_input::set_section_addresses): Don't
6460 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6461 (Orphan_output_section::set_section_addresses): Likewise.
6462
f15f61a7
DK
64632009-10-15 Doug Kwan <dougkwan@google.com>
6464
6465 * layout.cc (Layout::finish_dynamic_section): Generate tags
6466 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6467 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6468 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6469
82bb573a
ILT
64702009-10-14 Ian Lance Taylor <iant@google.com>
6471
6472 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6473 fields.
6474 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6475 data_shdr fields of relinfo.
6476 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6477 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6478 R_386_TLS_LDO_32, adjust based on section flags.
6479 (Target_i386::Relocate::fix_up_ldo): Remove.
6480
374ad285
ILT
64812009-10-13 Ian Lance Taylor <iant@google.com>
6482
6483 Add support for -pie.
6484 * options.h (class General_options): Add -pie and
6485 --pic-executable.
6486 (General_options::output_is_position_independent): Test -pie.
6487 (General_options::output_is_executable): Return true if not shared
6488 and not relocatable.
6489 (General_options::output_is_pie): Remove.
6490 * options.cc (General_options::finalize): Reject incompatible uses
6491 of -pie.
6492 * gold.cc (queue_middle_tasks): A -pie link is not static.
6493 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6494 * symtab.cc (Symbol::final_value_is_known): Return false if
6495 output_is_position_independent.
6496 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6497 output_is_position_independent.
6498 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6499 output_is_position_independent.
6500 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6501 output_is_position_independent.
6502 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6503 two_file_pie_test.
6504 (basic_pie_test.o, basic_pie_test): New targets.
6505 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6506 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6507 (two_file_pie_test): New target.
6508 * testsuite/Makefile.in: Rebuild.
6509 * README: Remove note saying that -pie is not supported.
6510
c6585162
ILT
65112009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6512
6513 * options.h (class General_options): Add -init and -fini.
6514 * layout.cc (Layout::finish_dynamic_section): Emit
6515 given init and fini functions.
6516
032ce4e9
ST
65172009-10-13 Sriraman Tallam <tmsriram@google.com>
6518
6519 * gc.h (gc_process_relocs): Check if icf is enabled using new
6520 function.
6521 * gold.cc (queue_initial_tasks): Likewise.
6522 (queue_middle_tasks): Likewise.
6523 * object.cc (do_layout): Likewise.
6524 * symtab.cc (is_section_folded): Likewise.
6525 * main.cc (main): Likewise.
6526 * reloc.cc (Read_relocs::run): Likewise.
6527 (Sized_relobj::do_scan_relocs): Likewise.
6528 * icf.cc (is_function_ctor_or_dtor): New function.
6529 (Icf::find_identical_sections): Check if function is ctor or dtor when
6530 safe icf is chosen.
6531 * options.h (General_options::icf): Change option to be an enum.
6532 (Icf_status): New enum.
6533 (icf_enabled): New method.
6534 (icf_safe_folding): New method.
6535 (set_icf_status): New method.
6536 (icf_status_): New variable.
6537 * (options.cc) (General_options::finalize): Set icf_status_.
6538 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6539 icf_test and icf_keep_unique_test to use the --icf enum flag.
6540 * testsuite/icf_safe_test.sh: New file.
e1df38aa 6541 * testsuite/icf_safe_test.cc: New file.
032ce4e9 6542
f345227a
ST
65432009-10-12 Sriraman Tallam <tmsriram@google.com>
6544
6545 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6546 includes to gc.h and icf.h.
6547 * arm.cc: Include gc.h.
6548 * gold.cc: Likewise.
6549 * i386.cc: Likewise.
6550 * powerpc.cc: Likewise.
6551 * sparc.cc: Likewise.
6552 * x86_64.cc: Likewise.
6553 * gc.h: Include icf.h.
6554
1c7814ed
ILT
65552009-10-11 Ian Lance Taylor <iant@google.com>
6556
6557 * plugin.cc: Include "gold.h" before other header files.
6558
ae3b5189
CD
65592009-10-10 Chris Demetriou <cgd@google.com>
6560
6561 * options.h (Input_file_argument::Input_file_type): New enum.
6562 (Input_file_argument::is_lib_): Replace with...
6563 (Input_file_argument::type_): New member.
6564 (Input_file_argument::Input_file_argument): Take Input_file_type
6565 'type' rather than boolean 'is_lib' as second argument.
6566 (Input_file_argument::is_lib): Use type_.
6567 (Input_file_argument::is_searched_file): New function.
6568 (Input_file_argument::may_need_search): Handle is_searched_file.
6569 * options.cc (General_options::parse_library): Support -l:filename.
6570 (General_options::parse_just_symbols): Update for Input_file_argument
6571 changes.
6572 (Command_line::process): Likewise.
6573 * archive.cc (Archive::get_file_and_offset): Likewise.
6574 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6575 * script.cc (read_script_file, script_add_file): Likewise.
6576 * fileread.cc (Input_file::Input_file): Likewise.
6577 (Input_file::will_search_for): Handle is_searched_file.
6578 (Input_file::open): Likewise.
6579 * readsyms.cc (Read_symbols::get_name): Likewise.
6580 * testsuite/Makefile.am (searched_file_test): New test.
6581 * testsuite/Makefile.in: Regenerate.
6582 * testsuite/searched_file_test.cc: New file.
6583 * testsuite/searched_file_test_lib.cc: New file.
6584
f3048a1d
ILT
65852009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6586 Ian Lance Taylor <iant@google.com>
6587
6588 * descriptor.cc: Include <cstdio> and "binary-io.h".
6589 (Descriptors::open): Open the files in binary mode always.
6590 * script.cc (Lex::get_token): Treat \r as whitespace.
6591
d4780e57
ILT
65922009-10-09 Ian Lance Taylor <iant@google.com>
6593
6594 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6595
d9a893b8
ILT
65962009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6597 Ian Lance Taylor <iant@google.com>
6598
6599 * configure.ac: Check for readv function also.
6600 * fileread.cc (readv): Define if not HAVE_READV.
6601 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6602 does not exist.
6603 * config.in: Regenerate.
6604 * configure: Regenerate.
6605
c0a62865
DK
66062009-10-09 Doug Kwan <dougkwan@google.com>
6607
6608 * layout.cc (Layout::make_output_section): Call target hook to make
6609 ordinary output section.
6610 (Layout::finalize): Adjust parameter list of call the
6611 Target::may_relax().
6612 * layout.h (class Layout::section_list): New method.
6613 * merge.h (Output_merge_base::entsize): Change visibility to public.
6614 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6615 New methods.
6616 (Output_merge_string::do_is_string): New method.
6617 * object.cc (Sized_relobj::do_setup): renamed from
6618 Sized_relobj::set_up.
6619 * object.h (Sized_relobj::adjust_shndx,
6620 Sized_relobj::initializ_input_to_output_maps,
6621 Sized_relobj::free_input_to_output_maps): Change visibilities to
6622 protected.
6623 (Sized_relobj::setup): Virtualize.
6624 (Sized_relobj::do_setup): New method declaration.
6625 (Sized_relobj::invalidate_section_offset,
6626 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6627 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6628 * options.cc (parse_int): New function.
6629 * options.h (parse_int): New declaration.
6630 (DEFINE_int): New macro.
6631 (stub_group_size): New option.
6632 * output.cc (Output_section::Output_section): Initialize memebers
6633 merge_section_map_, merge_section_by_properties_map_,
6634 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6635 (Output_section::add_input_section): Handled deferred code-fill
6636 generation and remove an old comment.
6637 (Output_section::add_relaxed_input_section): New method definition.
6638 (Output_section::add_merge_input_section): Use merge section by
6639 properties map to speed to search. Update merge section maps
6640 as appropriate.
6641 (Output_section::build_relaxation_map): New method definition.
6642 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6643 Same.
6644 (Output_section::relax_input_section): Renamed to
6645 Output_section::convert_input_sections_to_relaxed_sections and change
6646 interface to take a vector of pointers to relaxed sections.
6647 (Output_section::find_merge_section,
6648 Output_section::find_relaxed_input_section): New method definitions.
6649 (Output_section::is_input_address_mapped,
6650 Output_section::output_offset, Output_section::output_address):
6651 Use output section data maps to speed up searching.
6652 (Output_section::find_starting_output_address): Add comments.
6653 (Output_section::do_write,
6654 Output_section::write_to_postprocessing_buffer): Do code-fill
6655 generation as appropriate.
6656 (Output_section::get_input_sections): Invalidate relaxed input section
6657 map.
6658 (Output_section::restore_states): Adjust type of checkpoint .
6659 Invalidate relaxed input section map.
6660 * output.h (Output_merge_base): New class declaration.
6661 (Input_section_specifier): New class defintion.
6662 (class Output_relaxed_input_section) Change base class to
6663 Output_section_data_build.
6664 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6665 base class initializer.
6666 (Output_section::add_relaxed_input_section): New method declaration.
6667 (Output_section::Input_section): Change visibility to protected.
6668 (Output_section::Input_section::relobj,
6669 Output_section::Input_section::shndx): Handle relaxed input sections.
6670 Output_section::input_sections) Change visibility to protected. Also
6671 define overload to return a non-const pointer.
6672 (Output_section::Merge_section_properties): New class defintion.
6673 (Output_section::Merge_section_by_properties_map,
6674 Output_section::Output_section_data_by_input_section_map,
6675 Output_section::Relaxation_map): New types.
6676 (Output_section::relax_input_section): Rename method to
6677 Output_section::convert_input_sections_to_relaxed_sections and change
6678 interface to take a vector of relaxed section pointers.
6679 (Output_section::find_merge_section,
6680 Output_section::find_relaxed_input_section,
6681 Output_section::build_relaxation_map,
6682 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6683 New method declarations.
6684 (Output_section::merge_section_map_
6685 Output_section::merge_section_by_properties_map_,
6686 Output_section::relaxed_input_section_map_,
6687 Output_section::is_relaxed_input_section_map_valid_,
6688 Output_section::generate_code_fills_at_write_): New data members.
6689 * script-sections.cc
6690 (Output_section_element_input::set_section_addresses): Call
6691 current_data_size and addralign methods of relaxed input sections.
6692 (Orphan_output_section::set_section_addresses): Call current_data_size
6693 and addralign methods of relaxed input sections.
6694 * symtab.cc (Symbol_table::compute_final_value): Extract template
6695 from the body of Symbol_table::sized_finalize_symbol.
6696 (Symbol_table::sized_finalized_symbol): Call
6697 Symbol_table::compute_final_value.
6698 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6699 (Symbol_table::compute_final_value): New templated method declaration.
6700 * target.cc (Target::do_make_output_section): New method defintion.
6701 * target.h (Target::make_output_section): New method declaration.
6702 (Target::relax): Add more parameters for input objects, symbol table
6703 and layout. Adjust call to do_relax.
6704 (Target::do_make_output_section): New method declaration.
6705 (Target::do_relax): Add parameters for input objects, symbol table
6706 and layout.
6707
d446d6c4
ILT
67082009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6709
6710 * pread.c: Include stdio.h.
6711
bc06c745
ILT
67122009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6713
6714 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6715 defined.
6716
75aea3d0
ILT
67172009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6718
6719 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6720 Change read_shndx type to unsigned int.
6721 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6722 int.
6723 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6724 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6725 Change read_shndx type to unsigned int.
6726 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6727 int.
6728 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6729 * layout.cc (Layout::create_symtab_sections): Cast the result of
6730 local_symcount * symsize to off_t in the gold_assert.
6731
be8fcb75
ILT
67322009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6733
6734 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6735 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6736 R_ARM_BASE_ABS.
6737 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6738 (Arm_relocate_functions::thm_abs5): New function.
6739 (Arm_relocate_functions::abs12): New function.
6740 (Arm_relocate_functions::abs16): New function.
6741 (Arm_relocate_functions::base_abs): New function.
6742 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6743 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6744 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6745 R_ARM_BASE_ABS.
6746 (Scan::global): Likewise.
6747 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6748 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6749 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6750 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6751 R_ARM_BASE_ABS.
6752
c2a122b6
ILT
67532009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6754
6755 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6756 (Arm_relocate_functions::movt_prel): New function.
6757 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6758 (Arm_relocate_functions::thm_movt_prel): New function.
6759 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6760 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6761 (Scan::global, Relocate::relocate): Likewise.
6762 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6763
c4aa1e2d
ILT
67642009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6765
6766 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6767 Incremental_checker.
6768 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6769 unsigned int.
6770 (class Incremental_inputs_header): New class.
6771 (Incremental_inputs_header_writer): Edit comment.
6772 (Incremental_inputs_entry): New class.
6773 (Incremental_inputs_entry_writer): Edit comment.
6774 (Sized_incremental_binary::do_find_incremental_inputs_section):
6775 Add *strtab_shndx parameter, fill it.
6776 (Sized_incremental_binary::do_check_inputs): New method.
6777 (Incremental_checker::can_incrementally_link_output_file): Use
6778 Sized_incremental_binary::check_inputs.
6779 (Incremental_inputs::report_command_line): Save command line in
6780 command_line_.
6781 * incremental.h:
6782 (Incremental_binary::find_incremental_inputs_section): New
6783 method.
6784 (Incremental_binary::do_find_incremental_inputs_section): Add
6785 strtab_shndx parameter.
6786 (Incremental_binary::do_check_inputs): New pure virtual method.
6787 (Sized_incremental_binary::do_check_inputs): Declare.
6788 (Incremental_checker::Incremental_checker): Add incremental_inputs
6789 parameter, use it to initialize incremental_inputs_.
6790 (Incremental_checker::incremental_inputs_): New field.
6791 (Incremental_checker::command_line): New method.
6792 (Incremental_checker::inputs): New method.
6793 (Incremental_checker::command_line_): New field.
6794
c549a694
ILT
67952009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6796
6797 * incremental.cc: Include <cstdarg> and "target-select.h".
6798 (vexplain_no_incremental): New function.
6799 (explain_no_incremental): New function.
6800 (Incremental_binary::error): New method.
6801 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6802 method.
6803 (make_sized_incremental_binary): New function.
6804 (open_incremental_binary): New function.
6805 (can_incrementally_link_file): Add checks if output is ELF and has
6806 inputs section.
6807 * incremental.h: Include "elfcpp_file.h" and "output.h".
6808 (Incremental_binary): New class.
6809 (Sized_incremental_binary): New class.
6810 (open_incremental_binary): Declare.
6811 * object.cc (is_elf_object): Use
6812 elfcpp::Elf_recognizer::is_elf_file.
6813 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6814 * output.h (Output_file::filesize): New method.
6815
fd3c5f0b
ILT
68162009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6817
6818 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6819 New function.
6820 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6821 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6822 function.
6823 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6824 function.
6825 (Arm_relocate_functions::movw_abs_nc): New function.
6826 (Arm_relocate_functions::movt_abs): New function.
6827 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6828 (Arm_relocate_functions::thm_movt_abs): New function.
6829 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6830 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6831 (Scan::global): Likewise.
6832 (Relocate::relocate): Likewise.
6833 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6834
7f5309a5
ILT
68352009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6836
6837 * arm.cc (Arm_relocate_functions::got_prel) New function.
6838 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6839 (Relocate::relocate): Likewise.
6840 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6841
364c7fa5
ILT
68422009-10-06 Ian Lance Taylor <iant@google.com>
6843
6844 * options.h (class General_options): Define
6845 split_stack_adjust_size parameter.
6846 * object.h (class Object): Add uses_split_stack_ and
6847 has_no_split_stack_ fields. Add uses_split_stack and
6848 has_no_split_stack accessor functions. Declare
6849 handle_split_stack_section.
6850 (class Reloc_symbol_changes): Define.
6851 (class Sized_relobj): Define Function_offsets. Declare
6852 split_stack_adjust, split_stack_adjust_reltype, and
6853 find_functions.
6854 * object.cc (Object::handle_split_stack_section): New function.
6855 (Sized_relobj::do_layout): Call handle_split_stack_section.
6856 * dynobj.cc (Sized_dynobj::do_layout): Call
6857 handle_split_stack_section.
6858 * reloc.cc (Sized_relobj::relocate_sections): Call
6859 split_stack_adjust for executable sections in split_stack
6860 objects. Pass reloc_map to relocate_section.
6861 (Sized_relobj::split_stack_adjust): New function.
6862 (Sized_relobj::split_stack_adjust_reltype): New function.
6863 (Sized_relobj::find_functions): New function.
6864 * target-reloc.h: Include "object.h".
6865 (relocate_section): Add reloc_symbol_changes parameter. Change
6866 all callers.
6867 * target.h (class Target): Add calls_non_split method. Declare
6868 do_calls_non_split virtual method. Declare match_view and
6869 set_view_to_nop.
6870 * target.cc: Include "elfcpp.h".
6871 (Target::do_calls_non_split): New function.
6872 (Target::match_view): New function.
6873 (Target::set_view_to_nop): New function.
6874 * gold.cc (queue_middle_tasks): Give an error if mixing
6875 split-stack and non-split-stack objects with -r.
6876 * i386.cc (Target_i386::relocate_section): Add
6877 reloc_symbol_changes parameter.
6878 (Target_i386::do_calls_non_split): New function.
6879 * x86_64.cc (Target_x86_64::relocate_section): Add
6880 reloc_symbol_changes parameter.
6881 (Target_x86_64::do_calls_non_split): New function.
6882 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6883 parameter.
6884 * powerpc.cc (Target_powerpc::relocate_section): Add
6885 reloc_symbol_changes parameter.
6886 * sparc.cc (Target_sparc::relocate_section): Add
6887 reloc_symbol_changes parameter.
6888 * configure.ac: Call AM_CONDITIONAL for the default target.
6889 * configure: Rebuild.
6890 * testsuite/Makefile.am (TEST_AS): New variable.
6891 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6892 (check_DATA): Add split_i386 and split_x86_64 files.
6893 (SPLIT_DEFSYMS): Define.
6894 (split_i386_[1234n].o): New targets.
6895 (split_i386_[124]): New targets.
6896 (split_i386_[1234r].stdout): New targets.
6897 (split_x86_64_[1234n].o): New targets.
6898 (split_x86_64_[124]): New targets.
6899 (split_x86_64_[1234r].stdout): New targets.
6900 (MOSTLYCLEANFILES): Add new executables.
6901 * testsuite/split_i386.sh: New file.
6902 * testsuite/split_x86_64.sh: New file.
6903 * testsuite/split_i386_1.s: New file.
6904 * testsuite/split_i386_2.s: New file.
6905 * testsuite/split_i386_3.s: New file.
6906 * testsuite/split_i386_4.s: New file.
6907 * testsuite/split_i386_n.s: New file.
6908 * testsuite/split_x86_64_1.s: New file.
6909 * testsuite/split_x86_64_2.s: New file.
6910 * testsuite/split_x86_64_3.s: New file.
6911 * testsuite/split_x86_64_4.s: New file.
6912 * testsuite/split_x86_64_n.s: New file.
6913 * testsuite/testfile.cc (Target_test): Update relocation_section
6914 function.
6915 * testsuite/Makefile.in: Rebuild.
6916
e8a9fcda
ILT
69172009-10-06 Ian Lance Taylor <iant@google.com>
6918
6919 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6920 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6921 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6922 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6923 the address on ldo_addrs_.
6924 (Target_i386::Relocate::fix_up_ldo): New function.
6925
e99daf92
ILT
69262009-10-06 Rafael Espindola <espindola@google.com>
6927
6928 * plugin.cc (add_input_library): New.
6929 (Plugin::load): Add add_input_library to tv.
6930 (Plugin_manager::add_input_file): Add the is_lib argument.
6931 (add_input_file): Update call to Plugin_manager::add_input_file.
6932 (add_input_library): New.
6933 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6934
966d4097
DK
69352009-09-30 Doug Kwan <dougkwan@google.com>
6936
6937 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6938 symbol and call Symbol::may_need_copy_reloc to determine if
6939 a copy reloc is needed.
6940 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6941 nocopyreloc is given in command line.
6942 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6943 given in command line.
6944 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6945 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6946 of the removed Target_i386::may_need_copy_reloc.
6947 * options.h (copyreloc): New option with default value false.
6948 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6949 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6950 instead of the removed Target_powerpc::may_need_copy_reloc.
6951 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6952 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6953 instead of the removed Target_sparc::may_need_copy_reloc.
6954 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6955 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6956 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6957 instead of the removed Target_x86_64::may_need_copy_reloc.
6958
029ba973
ILT
69592009-09-30 Ian Lance Taylor <iant@google.com>
6960
6961 * object.h (class Object): Remove target_ field, and target,
6962 sized_target, and set_target methods.
6963 (Object::sized_target): Remove.
6964 (class Sized_relobj): Update declarations. Remove sized_target.
6965 * object.cc (Sized_relobj::setup): Remove target parameter.
6966 Change all callers.
6967 (Input_objects::add_object): Don't do anything with the target.
6968 (make_elf_sized_object): Add punconfigured parameter. Change all
6969 callers. Set or test parameter target.
6970 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6971 Change all callers.
6972 * parameters.cc (Parameters::set_target): Change parameter type to
6973 be non-const.
6974 (Parameters::default_target): Remove.
6975 (set_parameters_target): Change parameter type to be non-const.
6976 (parameters_force_valid_target): New function.
6977 (parameters_clear_target): New function.
6978 * parameters.h (class Parameters): Update declarations. Remove
6979 default_target method. Add sized_target and clear_target
6980 methods. Change target_ to be non-const.
6981 (set_parameters_target): Update declaration.
6982 (parameters_force_valid_target): Declare.
6983 (parameters_clear_target): Declare.
6984 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6985 as NULL if we aren't searching.
6986 (Add_symbols::run): Don't check for compatible target.
6987 * fileread.cc (Input_file::open_binary): Call
6988 parameters_force_valid_target.
6989 * gold.cc (queue_middle_tasks): Likewise.
6990 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6991 set_target on object.
6992 * dynobj.h (class Sized_dynobj): Update declarations.
6993 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6994 make_elf_object returns NULL.
6995 (Archive::include_member): Don't check whether object target is
6996 compatible.
6997 * output.cc (Output_section::add_input_section): Get target from
6998 parameters.
6999 (Output_section::relax_input_section): Likewise.
7000 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7001 parameters.
7002 (Sized_relobj::do_scan_relocs): Likewise.
7003 (Sized_relobj::relocate_sections): Likewise.
7004 * resolve.cc (Symbol_table::resolve): Likewise.
7005 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7006 parameter. Change all callers.
7007 (Symbol_table::add_from_object): Get target from parameters.
7008 (Symbol_table::add_from_relobj): Don't check object target.
7009 (Symbol_table::add_from_dynobj): Likewise.
7010 (Symbol_table::define_special_symbol): Get target from
7011 parameters.
7012 * symtab.h (class Symbol_table): Update declaration.
7013 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7014 parameter. Change all callers. Clear parameter target.
7015 (Binary_test): Test target here.
7016 * testsuite/object_unittest.cc (gold_testsuite): Remove
7017 target_test_pointer parameter. Change all callers.
7018 (Object_test): Test target here.
7019
a6a22b83
ILT
70202009-09-26 Ian Lance Taylor <iant@google.com>
7021
7022 * testsuite/initpri1.c: Don't try to use constructor priorities if
7023 compiling with gcc before 4.3.
7024
6a8f49fe
ILT
70252009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7026
7027 * testsuite/retain_symbols_file_test.sh (check_present): Change
7028 output file name to retain_symbols_file_test.stdout.
7029 (check_absent): Likewise.
7030
8c604651
CS
70312009-09-18 Craig Silverstein <csilvers@google.com>
7032
7033 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7034 * options.cc: Include <cerrno> and <fstream>.
7035 (General_options::finalize): Parse -retain-symbols-file tag.
7036 * options.h: New flag.
7037 (General_options): New method should_retain_symbol, new
7038 variable symbols_to_retain.
7039 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7040 should_retain_symbol map.
7041 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7042 * testsuite/Makefile.in: Regenerate.
7043 * testsuite/retain_symbols_file_test.sh: New file.
7044
ca58b19f
NC
70452009-09-18 Nick Clifton <nickc@redhat.com>
7046
7047 * po/es.po: Updated Spanish translation.
7048
20e6d0d6
DK
70492009-09-17 Doug Kwan <dougkwan@google.com>
7050
7051 * debug.h (DEBUG_RELAXATION): New constant.
7052 (DEBUG_ALL): Add DEBUG_RELAXATION.
7053 (debug_string_to_enum): Add relaxation debug option.
7054 * layout.cc
7055 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7056 Layout::Relaxation_debug_check::read_sections,
7057 Layout::Relaxation_debug_check::read_sections): New method definitions.
7058 (Layout::Layout): Initialize data members
7059 record_output_section_data_from_scrips_,
7060 script_output_section_data_list_ and relaxation_debug_check_.
7061 (Layout::save_segments, Layout::restore_segments,
7062 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7063 Layout::relaxation_loop_body): New method definitions.
7064 (Layout::finalize): Support relaxation. Move section layout code to
7065 Layout::relaxation_loop_body.
7066 (Layout::set_asection_address_from_script): Move code for orphan
7067 section placement out.
7068 (Layout::place_orphan_sections_in_script): New method definition.
7069 * layout.h (Output_segment_headers, Output_file_header):
7070 New forward class declarations.
7071 (Layout::~Layout): Define.
7072 (Layout::new_output_section_data_from_script): New method definition.
7073 (Layout::place_orphan_sections_in_script): New method declaration.
7074 (Layout::Segment_states): New type declaration.
7075 (Layout::save_segments, Layout::restore_segments,
7076 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7077 Layout::relaxation_loop_body): New method declarations.
7078 (Layout::Output_section_data_list): New type declaration.
7079 (Layout::Relaxation_debug_check): New class definition.
7080 (Layout::record_output_section_data_from_script_,
7081 Layout::script_output_section_data_list_, Layout::segment_states_,
7082 Layout::relaxation_debug_check_): New data members.
7083 * output.cc: (Output_section_headers::do_size): New method definition.
7084 (Output_section_headers::Output_section_headers): Move size
7085 computation to Output_section_headers::do_size.
7086 (Output_segment_headers::do_size): New method definition.
e1df38aa 7087 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
7088 Output_file_header::do_size and call it.
7089 (Output_file_header::do_size): New method definition.
7090 (Output_data_group::Output_data_group): Adjust call to
7091 Output_section_data.
7092 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7093 (Output_symtab_xindex::do_write): Add array bound check.
7094 (Output_section::Input_section::print_to_mapfile): Handle
7095 RELAXED_INPUT_SECTION_CODE.
7096 (Output_section::Output_section): Initialize data member checkpoint_.
7097 (Output_section::~Output_section): Delete checkpoint object pointed
7098 by checkpoint_.
7099 (Output_section::add_input_section): Always add an Input_section if
7100 relaxing.
7101 (Output_section::add_merge_input_section): Add assert.
7102 (Output_section::relax_input_section): New method definition.
7103 (Output_section::set_final_data_size): Set load address to zero for
7104 an unallocated section.
7105 (Output_section::do_address_and_file_offset_have_reset_values):
7106 New method definition.
7107 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7108 Handle relaxed input section.
7109 (Output_section::sort_attached_input_sections): Checkpoint input
7110 section list lazily.
7111 (Output_section::get_input_sections): Change type of input_sections to
7112 list of Simple_input_section pointers. Checkpoint input section list
7113 lazily. Also handle relaxed input sections.
7114 (Output_section::add_input_section_for_script): Take a reference to
7115 a Simple_input_section object instead of Relobj pointer and section
7116 index as parameter. Handle relaxed input sections.
7117 (Output_section::save_states, Output_section::restore_states): New
7118 method definitions.
7119 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7120 (Output_data::is_data_size_fixed): New method definition.
7121 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7122 if it is fixed.
7123 (Output_data::address_and_file_offset_have_reset_values): New method
7124 definition.
7125 (Output_data::do_address_and_file_offset_have_reset_values): New method
7126 definition.
7127 (Output_data::set_data_size): Check that data size is not fixed.
7128 (Output_data::fix_data_size): New method definition.
7129 (Output_data::is_data_size_fixed_): New data member.
7130 (Output_section_headers::set_final_data_size): New method definition.
7131 (Output_section_headers::do_size): New method declaration.
7132 (Output_segment_headers::set_final_data_size): New method definition.
7133 (Output_segment_headers::do_size): New method declaration.
7134 (Output_file_header::set_final_data_size)::New method definition.
7135 (Output_file_header::do_size)::New method declaration.
7136 (Output_section_data::Output_section_data): Add new parameter
7137 is_data_size_fixed and use it to fix data size.
7138 (Output_data_const::Output_data_const): Adjust call to base class
7139 constructor and fix data size.
7140 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7141 base class constructor and fix data size.
7142 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7143 base class constructor and fix data size.
7144 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7145 class constructor and fix data size.
7146 (Output_data_group::set_final_data_size): New method definition.
7147 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7148 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7149 class constructor and fix data size.
7150 (Output_relaxed_input_section): New class definition.
7151 (Output_section::Simple_input_section): New class definition.
7152 (Output_section::get_input_sections): Adjust parameter list.
7153 (Output_section::add_input_section_for_script): Same.
7154 (Output_section::save_states, Output_section::restore_states,
7155 Output_section::do_address_and_file_offset_have_reset_values,
7156 (Output_section::Input_section::Input_section): Handle
7157 RELAXED_INPUT_SECTION_CODE. Add new overload for
7158 Output_relaxed_input_section.
7159 (Output_section::Input_section::is_input_section,
7160 Output_section::Input_section::set_output_section): Handle relaxed
7161 input section.
7162 (Output_section::Input_section::is_relaxed_input_section,
7163 Output_section::Input_section::output_section_data,
7164 Output_section::Input_section::relaxed_input_section): New method
7165 definitions.
7166 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7167 value.
7168 (Output_section::Input_section::u1_): Update comments.
7169 (Output_section::Input_section::u2_): Add new union member poris.
7170 (Output_section::Checkpoint_output_section): New classs definition.
7171 (Output_section::relax_input_section): New method declaration.
7172 (Output_section::checkpoint_): New data member.
7173 (Output_segment): Update comments.
7174 (Output_segment::Output_segment): Un-privatize copy constructor.
7175 (Output_segment::operator=): Un-privatize.
7176 * script-sections.cc (Output_section_element::Input_section_list):
7177 Change element type to Output_section::Simple_input_section.
7178 (Output_section_element_dot_assignment::set_section_addresses):
7179 Register output section data for relaxation clean up.
7180 (Output_data_exression::Output_data_expression): Adjust call to base
7181 constructor to fix data size.
7182 (Output_section_element_data::set_section_addresses): Register
7183 Output_data_expression object for relaxation clean up.
7184 (struct Input_section_info): Replace Relobj pointer and section index
7185 pair with Output_section::Simple_input_section and Convert struct to a
7186 class.
7187 (Input_section_sorter::operator()): Adjust access to
e1df38aa 7188 Input_section_info data member to use accessors.
20e6d0d6
DK
7189 (Output_section_element_input::set_section_addresses): Use layout
7190 parameter. Adjust code to use Output_section::Simple_input_section
7191 and Input_secction_info classes. Register filler for relaxation
7192 clean up.
7193 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7194 and section index pair with Output_section::Simple_input_section
7195 class. Adjust code accordingly.
7196 (Phdrs_element::release_segment): New method definition.
7197 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7198 segment list.
7199 (Script_sections::release_segments): New method definition.
7200 * gold/script-sections.h (Script_sections::release_segments): New
7201 method declaration.
7202 * gold/target.h (Target::may_relax, Target::relax,
7203 Target::do_may_relax, Target::do_relax): New method definitions.
7204
5e445df6
ILT
72052009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7206
7207 * arm.cc (has_signed_unsigned_overflow): New function.
7208 (Arm_relocate_functions::abs8): New function.
7209 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7210 (Target_arm::Scan::global): Likewise.
7211 (Target_arm::relocate::relocate): Likewise.
7212 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7213 Likewise.
7214
8c604651 72152009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
7216
7217 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7218 * testsuite/Makefile.in: Regenerate.
7219
1e9cc1c2
NC
72202009-09-11 Nick Clifton <nickc@redhat.com>
7221
7222 * po/gold.pot: Updated by the Translation project.
7223
6a89f575
CC
72242009-09-08 Cary Coutant <ccoutant@google.com>
7225
7226 * output.cc (Output_file::open): Add execute permission to empty file.
7227 * testsuite/Makefile.am (permission_test): New test.
7228 * testsuite/Makefile.in: Regenerate.
7229
fdcac5af
ILT
72302009-09-02 Ian Lance Taylor <iant@google.com>
7231
7232 * output.cc (Output_file::resize): Call map_no_anonymous rather
7233 than map.
7234
44453f85
ILT
72352009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7236
7237 * gold.cc: Include "incremental.h".
7238 (queue_initial_tasks): Call Incremental_checker methods.
7239 * incremental.cc: Include "output.h".
7240 (Incremental_checker::can_incrementally_link_output_file): New
7241 method.
7242 * incremental.h (Incremental_checker): New class.
7243
7244 * output.cc (Output_file::open_for_modification): New method.
7245 (Output_file::map_anonymous): Changed return type to bool. Record
7246 map in base_ field.
7247 (Output_file::map_no_anonymous): New method, broken out of map.
7248 (Output_file::map): Use map_no_anonymous and map_anonymous.
7249 * output.h (class Output_file): Update declarations.
7250
293c1386
CC
72512009-08-24 Cary Coutant <ccoutant@google.com>
7252
7253 * options.h (Command_line::Pre_options): New class.
7254 (Command_line::pre_options): New member.
7255 * options.cc (gold::options::ready_to_register): New variable.
7256 (One_option::register_option): Do nothing if not registering options.
7257 Assert if same short option registered twice.
7258 (General_options::General_options): Turn off option registration when
7259 done constructing.
7260 (Command_line::Pre_options::Pre_options): New constructor.
7261
f773f3d2
CC
72622009-08-24 Cary Coutant <ccoutant@google.com>
7263
06a73cfe
CC
7264 * options.h (General_options::no_keep_memory): Remove incorrect
7265 short option.
f773f3d2 7266
a15af8e2
RW
72672009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7268
7269 * Makefile.am (am__skiplex, am__skipyacc): New.
7270 * Makefile.in: Regenerate.
7271
c462b41b
RW
72722009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7273
14ec8efd
RW
7274 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7275 (INCLUDES): ... this.
7276 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7277 (AM_CPPFLAGS): Renamed from ...
7278 (INCLUDE): ... this.
7279 * Makefile.in, testsuite/Makefile.in: Regenerate.
7280
81ecdfbb
RW
7281 * Makefile.in: Regenerate.
7282 * aclocal.m4: Likewise.
7283 * config.in: Likewise.
7284 * configure: Likewise.
7285 * testsuite/Makefile.in: Likewise.
7286
c462b41b
RW
7287 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7288 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7289 * Makefile.in: Regenerate.
7290 * testsuite/Makefile.in: Regenerate.
7291
2da73f13
CC
72922009-08-19 Cary Coutant <ccoutant@google.com>
7293
7294 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7295 symbols in shared libraries overridden by hidden or internal symbols
7296 in the main program.
7297
2db70501
CD
72982009-08-19 Chris Demetriou <cgd@google.com>
7299
7300 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7301 checking source file names in error messages.
7302
f733487b
DK
73032009-08-18 Doug Kwan <dougkwan@google.com>
7304
7305 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7306 an elcpp::Ehdr as parameter. Adjust call to set_target.
7307 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7308 an elfcpp::Ehdr as parameter.
7309 * object.cc (Object::set_target): Remove the version that looks up
7310 a target and sets it.
7311 (Sized_relobj::setup): Take a Target object instead of
7312 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7313 (make_elf_sized_object): Find target and ask target to
7314 make an ELF object.
7315 * object.h: (Object::set_target): Remove the version that looks up
7316 a target and sets it.
7317 (Sized_relobj::setup): Take a Target object instead of
7318 an elfcpp:Ehdr as parameter.
7319 * target.cc: Include dynobj.h.
7320 (Target::do_make_elf_object_implementation): New.
7321 (Target::do_make_elf_object): New.
7322 * target.h (Target::make_elf_object): New template declaration.
7323 (Target::do_make_elf_object): New method declarations.
7324 (Target::do_make_elf_object_implementation): New template declaration.
7325
cc70f101
ILT
73262009-08-14 Ian Lance Taylor <iant@google.com>
7327
7328 * gold.h (FUNCTION_NAME): Define.
7329 (gold_unreachable): Use FUNCTION_NAME.
7330
ef5e0cb1
ST
73312009-08-12 Sriraman Tallam <tmsriram@google.com>
7332
7333 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7334 symbol in the --keep-unique list is not found.
7335
48c187ce
ST
73362009-08-12 Sriraman Tallam <tmsriram@google.com>
7337
7338 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7339 been maked as --keep-unique.
7340 (Icf::unfold_section): New function.
7341 * icf.h (Icf::unfold_section): New function.
7342 * options.h (General_options::keep_unique): New option.
7343 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7344 * testsuite/Makefile.in: Regenerate.
7345 * testsuite/icf_keep_unique_test.sh: New file.
7346 * testsuite/icf_keep_unique_test.cc: New file.
7347
645afe0c
CC
73482009-08-12 Cary Coutant <ccoutant@google.com>
7349
7350 PR 10471
7351 * resolve.cc (Symbol_table::resolve): Check for references from
7352 dynamic objects to hidden and internal symbols.
7353 * testsuite/Makefile.am (hidden_test.sh): New test.
7354 * testsuite/Makefile.in: Regenerate.
7355 * testsuite/hidden_test.sh: New script.
7356 * testsuite/hidden_test_1.c: New test source.
7357 * testsuite/hidden_test_main.c: New test source.
7358
11af873f
DK
73592009-08-11 Doug Kwan <dougkwan@google.com>
7360
7361 * arm.cc: Update comments.
7362 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7363 segment to locate the .ARM.exidx section if present.
7364
b9f7d72d
DK
73652009-08-09 Doug Kwan <dougkwan@google.com>
7366
7367 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7368 patch.
7369
ddd3c53c
ST
73702009-08-07 Sriraman Tallam <tmsriram@google.com>
7371 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7372 compiler warnings.
7373
27721062
ST
73742009-08-06 Sriraman Tallam <tmsriram@google.com>
7375
7376 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7377 valid tls_segment only for non-debug-section relocations.
7378 * testsuite/Makefile.am: Add gc_tls_test.
7379 * testsuite/Makefile.in: Regenerate.
7380 * testsuite/gc_tls_test.cc: New file.
7381 * testsuite/gc_tls_test.sh: New file.
7382
ef15dade 73832009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 7384
ef15dade
ST
7385 * icf.cc: New file.
7386 * icf.h: New file.
7387 * Makefile.am (CCFILES): Add icf.cc.
7388 (HFILES): Add icf.h
7389 * Makefile.in: Regenerate.
7390 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7391 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7392 section, symbol and addend information for the relocs.
7393 * gold.cc (queue_middle_tasks): Call identical code folding.
7394 * gold.h: Add defines for multimap.
7395 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7396 to the call of finalize_local_symbols.
7397 * main.cc (main): Create object of class Icf.
7398 * object.cc (Sized_relobj::do_layout): Allow this function to be
7399 called twice during icf.
7400 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7401 to sections marked as identical by icf.
7402 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7403 when available.
7404 (Sized_relobj::do_section_entsize): New function.
7405 * object.h (Object::section_entsize): New function.
7406 (Object::do_section_entsize): New pure virtual function.
7407 (Relobj::finalize_local_symbols): Add new parameter.
7408 (Relobj::do_section_entsize): New function.
7409 * options.h (General_options::icf): New option.
7410 (General_options::icf_iterations): New option.
7411 (General_options::print_icf_sections): New option.
7412 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7413 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7414 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7415 icf.
7416 * symtab.cc (Symbol_table::is_section_folded): New function.
7417 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7418 to sections marked as identical by icf.
7419 * symtab.h (Symbol_table::set_icf): New function.
7420 (Symbol_table::icf): New function.
7421 (Symbol_table::is_section_folded): New function.
7422 (Symbol_table::icf_): New data member.
7423 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7424 * testsuite/Makefile.am: Add commands to build icf_test.
7425 * testsuite/Makefile.in: Regenerate.
7426 * testsuite/icf_test.sh: New file.
7427 * testsuite/icf_test.cc: New file.
7428
c3b65ac4
CD
74292009-07-24 Chris Demetriou <cgd@google.com>
7430
7431 * layout.cc (is_compressible_debug_section): Fix incorrect
7432 comment about compressed section names.
7433
1caf2c51
ILT
74342009-07-20 Ian Lance Taylor <ian@airs.com>
7435
7436 PR 10419
7437 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7438
1ef4d87f
ILT
74392009-07-16 Ian Lance Taylor <iant@google.com>
7440
7441 PR 10400
7442 * layout.h: #include <map>.
7443 (class Kept_section): Change from struct to class. Add accessors
7444 and setters. Add section size to Comdat_group mapping. Change
7445 Comdat_group to std::map. Add is_comdat_ field. Add
7446 linkonce_size field in union.
7447 (class Layout): Update declaration of find_or_add_kept_section.
7448 Don't declare find_kept_object.
7449 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7450 parameter. Add object, shndx, is_comdat, and is_group_name
7451 parameters. Change all callers. Adjust for new Kept_section.
7452 (Layout::find_kept_object): Remove.
7453 * object.cc (Sized_relobj::include_section_group): Update use of
7454 Kept_section. Rename secnum to shndx. Only record
7455 Kept_comdat_section if sections are the same size.
7456 (Sized_relobj::include_linkonce_section): Update use of
7457 Kept_section. Only record Kept_comdat_section if sections are the
7458 same size. Set size of linkonce section.
7459 (Sized_relobj::map_to_kept_section): Update call to
7460 get_kept_comdat_section.
7461 * object.h (class Sized_relobj): Rename fields in
7462 Kept_comdat_section to drop trailing underscores; change object
7463 field to Relobj*. Change Kept_comdat_section_table to store
7464 struct rather than pointer.
7465 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7466 Add kept_object and kept_shndx parameters. Change all callers.
7467 (Sized_relobj::get_kept_comdat_section): Change return type to
7468 bool. Add kept_object and kept_shndx parameters. Change all
7469 callers.
7470 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7471 Layout::find_or_add_kept_section.
7472
37c3b7b0
ILT
74732009-07-09 Ian Lance Taylor <iant@google.com>
7474
7475 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7476 Reserve space in the hash table.
7477
98fa85cb
ILT
74782009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7479
7480 * fileread.cc (File_read::get_mtime): New method.
7481 * fileread.h (Timespec): New structure.
7482 (File_read::get_mtime): New method.
7483 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7484 Renamed from timestamp_nsec.
7485 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7486 Elf_Xword.
e1df38aa 7487 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 7488 timestamp_nsec.
e1df38aa 7489 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
7490 (Incremental_inputs::report_obejct): Save mtime; style fix.
7491 (Incremental_inputs::report_script): Save mtime; style fix.
7492 (Incremental_inputs::finalize_inputs): Style fix.
7493 (Incremental_inputs::finalize): Style fix.
7494 (Incremental_inputs::create_input_section_data): Store inputs
7495 mtime.
7496 * incremental.h (Incremental_inputs::report_script): Add mtime
7497 argument.
7498 (Incremental_inputs::Input_info::Input_info): Intialize only one
7499 union member.
7500 (Incremental_inputs::Input_info::archive): Move to nameless
7501 union.
7502 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7503 (Incremental_inputs::Input_info::script): Move to nameless union.
7504 (Incremental_inputs::mtime): New field.
7505 * script.cc (read_input_script): Pass file mtime to
7506 Incremental_input.
7507 * script.h (Script_info::inputs): Style fix.
7508
c9d70757
ILT
75092009-07-01 Ian Lance Taylor <ian@airs.com>
7510
7511 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7512 instead of 32.
7513
9c547ec3
ILT
75142009-06-24 Ian Lance Taylor <iant@google.com>
7515
7516 PR 10156
7517 * layout.cc (Layout::choose_output_section): If we find an
7518 existing section, update the flags.
7519 (Layout::create_notes): New function, broken out of
7520 Layout::finalize.
7521 (Layout::finalize): Don't create note sections.
7522 (Layout::create_note): Don't crash if linker script discards
7523 section.
7524 (Layout::create_gold_note): Likewise.
7525 (Layout::create_build_id): Likewise. Don't set
7526 after_input_sections on the section.
7527 (Layout::create_executable_stack_info): Remove target parameter.
7528 Change caller.
7529 * layout.h (class Layout): Declare create_notes. Update
7530 declaration of create_executable_stack_info.
7531 * gold.cc (queue_middle_tasks): Call create_notes.
7532 * output.cc (Output_section::update_flags_for_input_section): Move
7533 here from output.h. If SHF_ALLOC flag is newly set, mark address
7534 invalid.
7535 * output.h (Output_data::mark_address_invalid): New function.
7536 (class Output_section): Only declare, not define,
7537 update_flags_for_input_section. Remove set_flags.
7538
55458500
ILT
75392009-06-24 Ian Lance Taylor <iant@google.com>
7540
7541 * script-sections.cc (Output_section_definition::
7542 set_section_addresses): Rename shadowing local load_address to
7543 laddr.
7544
1307d6cd
ILT
75452009-06-24 Ian Lance Taylor <iant@google.com>
7546
7547 PR 10244
7548 * reloc.cc (relocate_sections): Skip empty relocation sections.
7549
ec3f783e
ILT
75502009-06-23 Ian Lance Taylor <iant@google.com>
7551
7552 PR 10156
7553 * layout.cc (Layout::create_note): Use choose_output_section
7554 rather than make_output_section.
7555
459c9f1c
ILT
75562009-06-23 Ian Lance Taylor <iant@google.com>
7557
7558 PR 10237
7559 * options.cc (General_options::parse_V): Set printed_version_.
7560 (General_options::General_options): Initialize printed_version_.
7561 * options.h (class General_options): Add printed_version_ field.
7562 * gold.cc (queue_initial_tasks): If there are no input files,
7563 don't give a fatal error if we printed the version information.
7564 (queue_middle_tasks): If using -r with a shared object, give a
7565 fatal error rather than an ordinary error.
7566
1518dc8f
ILT
75672009-06-23 Ian Lance Taylor <iant@google.com>
7568
7569 PR 10219
7570 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7571 (Layout::make_output_section): Set have_stabstr_section_ if we see
7572 a .stab*str section.
7573 (Layout::finalize): Call link_stabs_sections.
7574 (Layout::link_stabs_sections): New file.
7575 * layout.h (class Layout): Add have_stabstr_section_ field.
7576 Declare link_stabs_sections.
7577
3d857b98
DK
75782009-06-23 Doug Kwan <dougkwan@google.com>
7579
7580 * Makefile.am (libgold_a_LIBADD): New.
7581 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7582 * Makefile.in: Regenerate.
7583 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7584 * configure: Regenerate.
7585 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7586 * fileread.cc: Include sys/state.h
7587 * gold.h: Declare memmem and strndup if found missing.
7588 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7589
0639a6f6
ILT
75902009-06-23 Ian Lance Taylor <iant@google.com>
7591
7592 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7593 * configure: Rebuild.
7594
8d63875c
ILT
75952009-06-23 Ian Lance Taylor <iant@google.com>
7596
7597 PR 10147
7598 * object.cc (Object::section_contents): Don't try to get a view if
7599 the section has length zero.
7600 (Object::handle_gnu_warning_section): If the section is empty, use
7601 the name of the section as the warning.
7602
f7c8a183
ILT
76032009-06-23 Ian Lance Taylor <iant@google.com>
7604
7605 PR 10133
7606 * stringpool.h (class Stringpool_template): Add optimize_ field.
7607 (Stringpool_template::set_optimize): New function.
7608 * stringpool.cc (Stringpool_template::Stringpool_template):
7609 Initialize optimize_ field.
7610 (Stringpool_template::set_string_offsets): Test local optimize
7611 fild rather than parameter.
7612 * layout.cc (Layout::Layout): Call set_optimize on the section
7613 name stringpool.
7614
e6a307ba
ILT
76152009-06-22 Ian Lance Taylor <iant@google.com>
7616
7617 PR 10030
7618 * yyscript.y: Parse TARGET.
7619 * script.cc (script_set_target): New function.
7620 * script-c.h (script_set_target): Declare.
7621 * options.cc (General_options::string_to_object_format): Rename
7622 from string_to_object_format in anonymous namespace. Change
7623 callers.
7624 * options.h (class General_options): Declare
7625 string_to_object_format.
7626
3ee173de
ILT
76272009-06-22 Ian Lance Taylor <iant@google.com>
7628
7629 * script-sections.cc (Script_sections::create_segments): Don't put
7630 program headers in a PT_LOAD segment if -n or -N.
7631
76322009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
7633
7634 PR 10141
7635 * options.h (class General_options): Add -z lazy and -z now. Sort
7636 -z options into alphabetical order.
7637 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7638
cd6739a1 76392009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
7640
7641 * layout.cc (Layout::make_output_section): Call
7642 Target::new_output_section.
7643 (Layout::attach_allocated_section_to_segment): Put large section
7644 sections in a separate load segment with the large segment flag
7645 set.
7646 (Layout::segment_precedes): Sort large data segments after other
7647 load segments.
7648 (align_file_offset): New static function.
7649 (Layout::set_segment_offsets): Use align_file_offset.
7650 * output.h (class Output_section): Add is_small_section_ and
7651 is_large_section_ fields.
7652 (Output_section::is_small_section): New function.
7653 (Output_section::set_is_small_section): New function.
7654 (Output_section::is_large_section): New function.
7655 (Output_section::set_is_large_section): New function.
7656 (Output_section::is_large_data_section): New function.
7657 (class Output_segment): Add is_large_data_segment_ field.
7658 (Output_segment::is_large_data_segment): New function.
7659 (Output_segment::set_is_large_data_segment): New function.
7660 * output.cc (Output_section::Output_section): Initialize new
7661 fields.
7662 (Output_segment::Output_segment): Likewise.
7663 (Output_segment::add_output_section): Add assertion that large
7664 data sections always go in large data segments. Force small data
7665 sections to the end of the list of data sections. Force small BSS
7666 sections to the start of the list of BSS sections. For large BSS
7667 sections to the end of the list of BSS sections.
7668 * symtab.h (class Symbol): Declare is_common_shndx.
7669 (Symbol::is_defined): Check Symbol::is_common_shndx.
7670 (Symbol::is_common): Likewise.
7671 (class Symbol_table): Define enum Commons_section_type. Update
7672 declarations. Add small_commons_ and large_commons_ fields.
7673 * symtab.cc (Symbol::is_common_shndx): New function.
7674 (Symbol_table::Symbol_table): Initialize new fields.
7675 (Symbol_table::add_from_object): Put small and large common
7676 symbols in the right list.
7677 (Symbol_table::sized_finalized_symbol): Check
7678 Symbol::is_common_shndx.
7679 (Symbol_table::sized_write_globals): Likewise.
7680 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7681 common symbol lists. Don't call do_allocate_commons_list if the
7682 list is empty.
7683 (Symbol_table::do_allocate_commons_list): Remove is_tls
7684 parameter. Add comons_section_type parameter. Change all
7685 callers. Handle small and large common symbols.
7686 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7687 Symbol::is_common_shndx.
7688 * resolve.cc (symbol_to_bits): Likewise.
7689 * target.h (Target::small_common_shndx): New function.
7690 (Target::small_common_section_flags): New function.
7691 (Target::large_common_shndx): New function.
7692 (Target::large_common_section_flags): New function.
7693 (Target::new_output_section): New function.
7694 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7695 small_common_section_flags, and large_common_section_flags
7696 fields.
7697 (Target::do_new_output_section): New virtual function.
7698 * arm.cc (Target_arm::arm_info): Initialize new fields.
7699 * i386.cc (Target_i386::i386_info): Likewise.
7700 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7701 Likewise.
7702 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7703 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7704 (Target_x86_64::do_new_output_section): New function.
7705 * configure.ac: Define conditional MCMODEL_MEDIUM.
7706 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7707 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7708 (large_LDFLAGS): Define.
7709 * testsuite/large.c: New file.
7710 * testsuite/testfile.cc (Target_test::test_target_info):
7711 Initialize new fields.
7712 * configure, testsuite/Makefile.in: Rebuild.
7713
bb04269c
DK
77142009-06-05 Doug Kwan <dougkwan@google.com>
7715
7716 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 7717 * Makefile.in: Regenerate.
bb04269c
DK
7718 * i386.cc (class Target_i386): Define new virtual method to
7719 override do_is_local_label_name in parent.
7720 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7721 local symbols if --discard-locals or -X is given.
7722 * options.h (class General_options): Declare new options
7723 '--discard-locals' and '-X' for discarding locals.
7724 * target.h (class Target): Define new methods is_local_label_name.
7725 Declare new virtual method do_is_local_label_name.
7726 * target.cc: New file.
7727 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7728 (check_SCRIPTS): Add discard_locals_test.sh.
7729 (check_DATA): Add discard_local_tests.syms.
7730 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7731 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7732 * testsuite/Makefile.in: Regenerate.
7733 * testsuite/discard_locals_test.c: New file.
7734 * testsuite/discard_locals_test.sh: Same.
7735
805bb01c
DK
77362009-06-05 Doug Kwan <dougkwan@google.com>
7737
7738 * object.cc (Sized_relobj::Sized_relobj): Initialize
7739 discarded_eh_frame_shndx_ to -1U.
7740 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7741 section.
7742 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7743 a discarded .eh_frame section.
7744 (Sized_relobj::do_finalize_local_symbols): Ditto.
7745 * object.h (class Sized_relobj): Declare new member
7746 discarded_eh_frame_shndx_.
7747 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7748 (local_labels_test.o, local_labels_test): New rules.
7749 * testsuite/Makefile.in: Regenerate.
7750
1dcd334d
DK
77512009-06-04 Doug Kwan <dougkwan@google.com>
7752
7753 * layout.cc (Layout::section_name_mapping): Add mapping for
7754 special ARM sections.
7755
96d49306
DK
77562009-06-03 Doug Kwan <dougkwan@google.com>
7757
7758 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7759 (utils::has_overflow): Same.
7760
dff16297
ILT
77612009-06-03 Ian Lance Taylor <iant@google.com>
7762
7763 * layout.cc (Layout::section_name_mapping): New array, replacing
7764 Layout::linkonce_mapping.
7765 (Layout::section_name_mapping_count): New variable, replacing
7766 Layout::linkonce_mapping_count.
7767 (Layout::linkonce_output_name): Remove.
7768 (Layout::output_section_name): Rewrite.
7769 * layout.h (class Layout): Rename Linkonce_mapping to
7770 Section_name_mapping, linkonce_mapping to section_name_mapping,
7771 linkonce_mapping_count to section_name_mapping_count. Don't
7772 declare linkonce_output_name.
7773
c121c671
DK
77742009-06-03 Doug Kwan <dougkwan@google.com>
7775
7776 * gold/arm.cc (namespace utils): New.
7777 (Target_arm::reloc_is_non_pic): Define new method.
7778 (class Arm_relocate_functions): New.
7779 (Target_arm::Relocate::relocate): Handle relocation types used by
7780 Android.
7781
07800fab
ILT
77822009-06-03 Ian Lance Taylor <iant@google.com>
7783
7784 * arm.cc (Target_arm::scan::global): Use || instead of |.
7785
c121c671
DK
77862009-06-02 Doug Kwan <dougkwan@google.com>
7787
7788 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7789 issued_non_pic_error_.
7790 (class Target_arm::Scan): Declare new method check_non_pic.
7791 Define new method symbol_needs_plt_entry.
7792 Declare new data member issued_non_pic_error_.
7793 (class Target_arm::Relocate): Declare new method
7794 should_apply_static_reloc.
7795 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7796 (Target_arm::Scan::check_non_pic): Define new method.
7797 (Target_arm::Scan::local): Handle a small subset of reloc types used
7798 by Android.
7799 (Target_arm::Scan::local): Same.
7800 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7801
b19b0c6d
ILT
78022009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7803
7804 * incremental.cc (Incremental_inputs::report_command_line): Filter
7805 out --incremental-* options.
7806
94cdfcff
DK
78072009-05-29 Doug Kwan <dougkwan@google.com>
7808
7809 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7810 template class.
7811 (class Target_arm): Update comment.
7812 (Target_arm::Target_arm): Initialize new data members GOT_,
7813 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7814 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7815 and Target_arm::rel_dyn_section.
7816 Declare new_enum Target_arm::Got_type.
7817 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7818 and DYNBSS_.
7819 Update commments for member do_dynsym_value.
7820 (Target_arm::got_size, Target_arm::plt_section,
7821 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7822 new methods inside class defintion.
7823 (Target_arm::got_section): Define new method.
7824 (Target_arm::rel_dyn_section): Same.
7825 (Output_data_plt_arm): New template class.
7826 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7827 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7828 (Output_data_plt_arm::add_entry): Same.
7829 (Output_data_plt_arm::first_plt_entry): Define new
7830 static data member for PLT instruction template.
7831 (Output_data_plt_arm::plt_entry): Same.
7832 (Output_data_plt_arm::do_write): Define new method.
7833 (Target_arm::make_plt_entry): Same.
7834 (Target_arm::do_finalize_sections): Same.
7835 (Target_arm::do_dynsym_value): Same.
7836
4a657b0d
DK
78372009-05-28 Doug Kwan <dougkwan@google.com>
7838
7839 * Makefile.am (TARGETSOURCES): Add arm.cc.
7840 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7841 * Makefile.in: Regenerate.
7842 * arm.cc: New file.
7843 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7844
e7ae8c36
DK
78452009-05-26 Doug Kwan <dougkwan@google.com>
7846
7847 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7848 (General_options::check_excluded_libs): Strip off directories in
7849 archive name before matching like GNU ld does.
7850 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7851 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7852 (exclude_libs_test_LDFLAGS): Add linker option
7853 -Wl,--exclude-libs,libexclude_libs_test_3
7854 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7855 an explicit archive without using -l.
7856 (alt/libexclude_libs_test_3.a): New make rule.
7857 * testsuite/Makefile.in: Regenerate.
7858 * testsuite/exclude_libs_test.c : Declare lib3_default().
7859 (main): Call it.
7860 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7861 * exclude_libs_test_3.c: New file.
7862
f12e7348
NC
78632009-05-26 Nick Clifton <nickc@redhat.com>
7864
7865 * po/id.po: New Indonesian translation.
7866 * po/gold.pot: Updated template file.
7867
4daadc0d
ST
78682009-05-22 Sriraman Tallam <tmsriram@google.com>
7869
e1df38aa 7870 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
7871 gc_comdat_test files. Add -Wl,--gc-sections to build
7872 gc_comdat_test.
7873 * testsuite/Makefile.in: Regenerate.
7874 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7875
531813ad
ST
78762009-05-21 Sriraman Tallam <tmsriram@google.com>
7877
7878 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7879 kept comdat section was garbage collected.
7880 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7881 * testsuite/Makefile.in: Regenerate.
7882 * testsuite/gc_comdat_test.sh: New file.
7883 * testsuite/gc_comdat_test_1.cc: New file.
7884 * testsuite/gc_comdat_test_2.cc: New file.
7885
65514900
CC
78862009-05-19 Doug Kwan <dougkwan@google.com>
7887
7888 * archive.cc (Archive::Archive): Move constructor from archive.h
7889 to here. Initialize no_export_.
7890 (Archive::get_elf_object_for_member): Set no_export flag of object.
7891 * archive.h (Archive::Archive): Move constructor body to
7892 archive.cc.
7893 (Archive::no_export): New method.
7894 (Archive::no_export_): New field.
7895 * object.h (Object::Object): Initialize no_export_ to false.
7896 (Object::no_export, Object::set_no_export): New methods.
7897 (Object::no_export_): New field.
7898 * options.cc (General_options::parse_exclude_libs): New method.
7899 (General_options::check_excluded_libs) Same.
7900 * options.h (exclude_libs): New option.
7901 (General_options::check_excluded_libs): New method declaration.
7902 (General_options::excluded_libs_): New field.
7903 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7904 default or protected visibility if an object has no-export flag set.
7905 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7906 (check_SCRIPTS): Add exclude_libs_test.sh.
7907 (check_DATA): Add exclude_libs_test.syms.
7908 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7909 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7910 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7911 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7912 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7913 libexclude_libs_test_2.a): New rules.
7914 * testsuite/Makefile.in: Regenerate.
7915 * testsuite/exclude_libs_test.c: New file.
7916 * testsuite/exclude_libs_test.sh: Ditto.
7917 * testsuite/exclude_libs_test_1.c: Ditto.
7918 * testsuite/exclude_libs_test_2.c: Ditto.
7919
1b77ea50
ILT
79202009-05-15 Ian Lance Taylor <iant@google.com>
7921
7922 * configure.ac: Check for declarations for cases where libiberty.h
7923 checks HAVE_DECL_xxx.
7924 * configure, config.in: Rebuild.
7925
072fe7ce
ILT
79262009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7927
7928 * gold.h (Incremental_argument_list): Remove (invalid) forward
7929 declaration.
7930 * incremental.cc (Incremental_inputs::report_achive): New method.
7931 (Incremental_inputs::report_object): New method.
7932 (Incremental_inputs::report_script): New method.
7933 (Incremental_inputs::finalize_inputs): New method.
7934 (Incremental_inputs::finalize): Call finalize_inputs().
7935 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7936 Create inputs entries.
7937 * incremental.h (Incremental_input_type): New enum.
7938 (Incremental_inputs::Incremental_input): Initialize new fields.
7939 (Incremental_inputs::report_inputs): New method.
7940 (Incremental_inputs::report_achive): New method.
7941 (Incremental_inputs::report_object): New method.
7942 (Incremental_inputs::report_script): New method.
7943 (Incremental_inputs::finalize_inputs): New method.
7944 (Incremental_inputs::Input_info): New struct.
7945 (Incremental_inputs::Input_info_map): New typedef.
7946 (Incremental_inputs::lock_): New field.
7947 (Incremental_inputs::Inputs_): New field.
7948 (Incremental_inputs::Inputs_map): New field.
7949 * main.cc (main): Call Incremental_input::report_inputs.
7950 * options.h (Input_argument_list): Typedef moved from
7951 Input_arguments.
7952 (Input_file_group::Files): Remove, use ::Input_argument_list.
7953 (Input_file_group::Input_argument_list): Remove, use
7954 ::Input_argument_list.
7955 * plugin.cc (Plugin_manager::add_input_file): Add error in
7956 incremental build.
7957 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7958 functions.
7959 * script.cc (read_input_script): Call
7960 Incremental_input::report_script.
7961 * script.h (Script_info): New class.
7962
b0481b0b
ILT
79632009-04-27 Ian Lance Taylor <iant@google.com>
7964
7965 * x86_64.cc (do_adjust_output_section): Set entsize to
7966 plt_entry_size.
7967
b22a5a41 79682009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
7969
7970 * output.cc (Output_file::close): After short writes, continue
7971 writing from the correct offset in the buffer being written.
7972
40fde488
CD
79732009-04-23 Chris Demetriou <cgd@google.com>
7974
7975 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7976 * configure: Regenerate.
7977 * config.in: Regenerate.
7978 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7979 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7980
3ce2c28e
ILT
79812009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7982
7983 * incremental.cc (Incremental_inputs_header_data): Renamed from
7984 Incremental_input_header_data.
7985 (Incremental_inputs_header_data::data_size): New field.
7986 (Incremental_inputs_header_data::put_input_file_count): Renamed
7987 from input_file_count.
7988 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7989 from command_line_offset.
7990 (Incremental_inputs_header_data::put_reserved): Renamed from
7991 put_reserved.
7992 (Incremental_inputs_entry_data): Renamed from
7993 Incremental_input_entry_data.
7994 (Incremental_inputs_entry_data::data_size): New field.
7995 (Incremental_inputs::report_command_line): New method.
7996 (Incremental_inputs::finalize): New method.
7997 (Incremental_inputs::create_incremental_inputs_data): New method.
7998 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7999 * incremental.h: New file.
8000 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8001 (Layout::finalize): Create incremental inputs section in
8002 incremental builds.
8003 (Layout::create_incremental_info_sections): New method.
8004 * layout.h (Layout::incremental_inputs): New method.
8005 (Layout::create_incremental_info_sections): New method.
8006 (Layout::incremental_inputs_): New field.
8007 * main.cc (main): Notify Incremental_input of the command line.
8008
e55bde5e
ILT
80092009-04-01 Ian Lance Taylor <iant@google.com>
8010 Mikolaj Zalewski <mikolajz@google.com>
8011
8012 * gold.h (reserve_unordered_map): Define, three versions, one for
8013 each version of Unordered_map.
8014 * layout.cc (Layout::Layout): Remove options parameter. Add
8015 number_of_input_files parameter. Don't initialize options_.
8016 Initialize number_of_input_files_ and resized_signatures_. Move
8017 sections_are_attached_.
8018 (Layout::layout_group): Reserve space for group_signatures_.
8019 (Layout::find_or_add_kept_section): Change name parameter to be a
8020 reference. Resize signatures_ map when it gets large enough.
8021 (Layout::layout_eh_frame): Use parameters->options() instead of
8022 this->options_.
8023 (Layout::make_output_section): Likewise.
8024 (Layout::attach_allocated_section_to_segment): Likewise.
8025 (Layout::finalize, Layout::create_executable_stack): Likewise.
8026 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8027 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8028 * layout.h (class Layout): Update declarations. Remove options_
8029 field. Add number_of_input_files_ and resized_signatures_
8030 fields. Move sections_are_attached_ field.
8031 * main.cc (main): Pass number of input files to Layout
8032 constructor. Don't pass options.
8033
154b857c
ILT
80342009-03-30 Ian Lance Taylor <iant@google.com>
8035
8036 * ffsll.c (ffsll): Correct implementation.
8037
2f35ab9b
ILT
80382009-03-27 Ian Lance Taylor <iant@google.com>
8039
fd03461a
ILT
8040 * ffsll.c: New file.
8041 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8042 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8043 * ftruncate.c (ftruncate): Declare before definition.
8044 * mremap.c (mremap): Likewise.
8045 * pread.c (pread): Likewise.
8046 * configure, Makefile.in, config.in: Rebuild.
8047
2f35ab9b
ILT
8048 * mremap.c: New file.
8049 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8050 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8051 (mremap): Declare if HAVE_MREMAP is not defined.
8052 * configure, Makefile.in, config.in: Rebuild.
8053
33aea2fd
CC
80542009-03-27 Cary Coutant <ccoutant@google.com>
8055
8056 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8057 position independent.
8058 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8059 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8060
6d479619
CC
80612009-03-24 Cary Coutant <ccoutant@google.com>
8062
8063 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8064 an executable.
8065 (needs_dynamic_reloc): Likewise.
8066
afc06bb8
ILT
80672009-03-24 Ian Lance Taylor <iant@google.com>
8068
8069 * yyscript.y (file_cmd): Recognize EXTERN.
8070 (extern_name_list, extern_name_list_body): New nonterminals.
8071 * script.cc (script_add_extern): Define.
8072 * script-c.h (script_add_extern): Declare.
8073
f6060a4d
ILT
80742009-03-24 Rafael Avila de Espindola <espindola@google.com>
8075
8076 * object.cc (is_elf_object): Define.
8077 * object.h (is_elf_object): Declare.
8078 * archive.cc (Archive::get_elf_object_for_member): Call
8079 is_elf_object.
33aea2fd 8080 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 8081
26736d8e
ILT
80822009-03-24 Elliott Hughes <enh@google.com>
8083
8084 * output.cc (Output_file::map_anonymous): Define.
8085 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8086 try an anonymous one. Report the size if the mmap fails.
8087 * output.h (class Output_file): Declare map_anonymous.
8088
22fd9730
ILT
80892009-03-24 Ian Lance Taylor <iant@google.com>
8090
8091 * target-select.cc (instantiate_target): Don't acquire the lock if
8092 the instantiated_target_ field has already been set.
8093
cb010894
ILT
80942009-03-23 Ian Lance Taylor <iant@google.com>
8095
7f055c20
ILT
8096 * gold-threads.h (class Initialize_lock): Define.
8097 * gold-threads.cc (class Initialize_lock_once): Define.
8098 (initialize_lock_control): New static variable.
8099 (initialize_lock_pointer): New static variable.
8100 (initialize_lock_once): New static function.
8101 (Initialize_lock::Initialize_lock): Define.
8102 (Initialize_lock::initialize): Define.
8103 * target-select.h: Include "gold-threads.h".
8104 (class Target_selector): Add lock_ and initialize_lock_ fields.
8105 Don't define instantiate_target, just declare it.
8106 * target-select.cc (Target_selector::Target_selector): Initialize
8107 new fields.
8108 (Target_selector::instantiate_target): Define.
8109 * descriptors.h: Include "gold-threads.h".
8110 (class Descriptors): Add initialize_lock_ field.
8111 * descriptors.cc (Descriptors::Descriptors): Initialize new
8112 field.
8113 (Descriptors::open): Use initialize_lock_ field
8114 * errors.h (class Errors): Add initialize_lock_ field.
8115 * errors.cc (Errors::Errors): Initialize new field.
8116 (Errors::initialize_lock): Use initialize_lock_ field.
8117 * powerpc.cc (class Target_selector_powerpc): Remove
8118 instantiated_target_ field. In do_recognize call
8119 instantiate_target rather than do_instantiate_target. In
8120 do_instantiate_target just allocate a new target.
8121 * sparc.cc (class Target_selector_sparc): Likewise.
8122
36959681
ILT
8123 * freebsd.h: New file.
8124 * i386.cc: Include "freebsd.h".
8125 (Target_i386): Derive from Target_freebsd rather than
8126 Sized_target.
8127 (Target_selector_i386): Derive from Target_selector_freebsd rather
8128 than Target_selector.
8129 * x86_64.cc: Include "freebsd.h".
8130 (Target_x86_64): Derive from Target_freebsd rather than
8131 Sized_target.
8132 (Target_selector_x86_64): Derive from Target_selector_freebsd
8133 rather than Target_selector.
8134 * target.h (class Target): Add adjust_elf_header and
8135 do_adjust_elf_header.
8136 * output.cc (Output_file_header:: do_sized_write): Call target
8137 adjust_elf_header routine.
8138 * configure.tgt: Set targ_osabi.
8139 * configure.ac: Define GOLD_DEFAULT_OSABI.
8140 * parameters.cc (Parameters::default_target): Pass
8141 GOLD_DEFAULT_OSABI to select_target.
8142 * target-select.h (class Target_selector): Make instantiate_target
8143 protected rather than private.
8144 * Makefile.am (HFILES): Add freebsd.h.
8145 * configure, Makefile.in, config.in: Rebuild.
8146
cb010894
ILT
8147 * merge.cc (do_add_input_section): Correct pend value. Change
8148 message about last entry not being null terminated from error to
8149 warning.
8150
0e879927
ILT
81512009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8152
8153 * incremental.cc: New file.
8154 * Makefile.am (CCFILES): Add incremental.cc.
8155 * Makefile.in: Rebuild.
8156
41105937
PP
81572009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8158
8159 * layout.cc (Layout::output_section_name): Preserve names
8160 of '.note.' sections.
e1df38aa 8161
60439920
ILT
81622009-03-19 Ian Lance Taylor <iant@google.com>
8163
8164 * descriptors.cc (Descriptors::open): Check that the options are
8165 valid before using them.
8166
0d371ad3
ILT
81672009-03-18 Ian Lance Taylor <iant@google.com>
8168
8169 * script-sections.h: Include <list>.
8170 (class Script_sections): Change Sections_elements from std::vector
8171 to std::list. Typedef public Elements_iterator. Add
8172 orphan_section_placement_, data_segment_align_start_, and
8173 saw_data_segment_align_ fields. Remove data_segment_align_index_
8174 field.
8175 * script-sections.cc (class Orphan_section_placement): New class.
8176 (class Sections_element): Add virtual functions is_relro and
8177 orphan_section_init. Remove virtual function place_orphan_here.
8178 (class Output_section_definition): Add is_relro and
8179 orphan_section_init. Remove place_orphan_here.
8180 (class Orphan_output_section): Likewise.
8181 (Script_sections::Script_sections): Update for field changes.
8182 (Script_sections::data_segment_align): Set saw_data_segment_align_
8183 and data_segment_align_start_, not data_segment_align_index.
8184 (Script_sections::data_segment_relro_end): Check
8185 saw_data_segment_align_. Use data_segment_align_start_ rather
8186 than data_segment_align_index_.
8187 (Script_sections::place_orphan): Rewrite to use
8188 Orphan_section_placement.
8189
9201d894
ILT
81902009-03-17 Ian Lance Taylor <iant@google.com>
8191
9c5b8369
ILT
8192 * archive.cc (Archive::add_symbols): Check for a version attached
8193 to the symbol name in the archive map.
8194 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8195 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8196 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8197 (ver_test_11.a): New target.
8198 * testsuite/Makefile.in: Rebuild.
8199
9201d894
ILT
8200 * configure.ac: Check for chsize and posix_fallocate. Replace
8201 ftruncate.
8202 * ftruncate.c: New file, from gnulib.
8203 * output.cc (posix_fallocate): Define dummy version if not
8204 HAVE_POSIX_FALLOCATE.
8205 (Output_file::map): Call posix_fallocate rather than lseek and
8206 write.
8207 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8208 * configure, Makefile.in, config.in: Rebuild.
8209
ef4ab7a8 82102009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 8211
ef4ab7a8
PP
8212 * layout.h (Layout::create_note): Add section_name parameter.
8213 * layout.cc (Layout::create_note): Likewise.
8214 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 8215
8c500701
ILT
82162009-03-17 Ian Lance Taylor <iant@google.com>
8217
e85b18e1
ILT
8218 * descriptors.cc: Include "options.h".
8219 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8220 (Descriptors::open): Always use O_CLOEXEC when opening a new
8221 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8222 then set FD_CLOEXEC.
8223
9efe6174
ILT
8224 * sparc.cc (class Target_sparc): Add has_got_section.
8225 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8226 make sure we have a GOT section.
8227
8228 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8229 (Target_sparc::Scan::local): Likewise.
8230 (Target_sparc::Scan::global): Likewise.
8231 (Target_sparc::Relocate::relocate): Likewise.
8232 (Target_sparc::Relocate::relocate_tls): Likewise.
8233
8c500701
ILT
8234 * symtab.cc (Symbol_table::define_default_version): New function,
8235 broken out of add_from_object.
8236 (Symbol_table::add_from_object): Call define_default_version.
8237 (Symbol_table::define_special_symbol): Add resolve_oldsym
8238 parameter. Change all callers. If the version for a symbol comes
8239 from a version script, resolve it with the symbol with the same
8240 name with no version. Also add the symbol without a version if
8241 appropriate.
8242 (do_define_in_output_data): If resolving with oldsym, don't delete
8243 sym.
8244 (do_define_in_output_segment): Likewise.
8245 (do_define_as_constant): Likewise.
8246 * symtab.h (class Symbol_table): Update declarations.
8247
f1ed28fb
ILT
82482009-03-13 Ian Lance Taylor <iant@google.com>
8249
15f8229b
ILT
8250 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8251 (Read_symbols::requeue): New function.
8252 (Read_symbols::do_read_symbols): If make_elf_object fails because
8253 the target type is not configured, and the file was searched for,
8254 issue a warning and retry with the next directory.
8255 (Add_symbols::run): If the file has an incompatible format, and
8256 it was searched for, requeue the Read_symbols task. On error,
8257 release the object.
8258 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8259 dirindex parameter to constructor. Change all callers. Declare
8260 incompatible_warning and requeue.
8261 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8262 input_argument_ and input_group_ fields. Add them to
8263 constructor. Change all callers.
8264 (class Read_script): Add dirindex_ field. Add it to constructor.
8265 Change all callers.
8266 * archive.cc (Archive::setup): Remove input_objects parameter.
8267 Change all callers.
8268 (Archive::get_file_and_offset): Likewise.
8269 (Archive::read_all_symbols): Likewise.
8270 (Archive::read_symbols): Likewise.
8271 (Archive::get_elf_object_for_member): Remove input_objects
8272 parameter. Add punconfigured parameter. Change all callers.
8273 (Archive::add_symbols): Change return type to bool. Check return
8274 value of include_member.
8275 (Archive::include_all_members): Likewise.
8276 (Archive::include_member): Change return type to bool. Return
8277 false if first included object has incompatible target. Set
8278 included_member_ field.
8279 (Add_archive_symbols::run): If add_symbols returns false, requeue
8280 Read_symbols task.
8281 * archive.h (class Archive): Add included_member_ field.
8282 Initialize it in constructor. Add input_file and searched_for
8283 methods. Update declarations.
8284 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8285 input_argument_ fields. Add them to constructor. Change all
8286 callers.
8287 * script.cc: Include "target-select.h".
8288 (class Parser_closure): Add skip_on_incompatible_target_ and
8289 found_incompatible_target_ fields. Add
8290 skip_on_incompatible_target parameter to constructor. Change all
8291 callers. Add methods skip_on_incompatible_target,
8292 clear_skip_on_incompatible_target, found_incompatible_target, and
8293 set_found_incompatible_target.
8294 (read_input_script): Add dirindex parameter. Change all callers.
8295 If parser finds an incompatible target, requeue Read_symbols
8296 task.
8297 (script_set_symbol): Clear skip_on_incompatible_target in
8298 closure.
8299 (script_add_assertion, script_parse_option): Likewise.
8300 (script_start_sections, script_add_phdr): Likewise.
8301 (script_check_output_format): New function.
8302 * script.h (read_input_script): Update declaration.
8303 * script-c.h (script_check_output_format): Declare.
8304 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8305 (ignore_cmd): Remove OUTPUT_FORMAT.
8306 * fileread.cc (Input_file::Input_file): Add explicit this.
8307 (Input_file::will_search_for): New function.
8308 (Input_file::open): Add pindex parameter. Change all callers.
8309 * fileread.h (class Input_file): Add input_file_argument method.
8310 Declare will_search_for. Update declarations.
8311 * object.cc (make_elf_object): Add punconfigured parameter.
8312 Change all callers.
8313 * object.h (class Object): Make input_file public. Add
8314 searched_for method.
8315 (make_elf_object): Update declaration.
8316 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8317 restart search.
8318 * dirsearch.h (class Dirsearch): Update declaration.
8319 * options.h (class General_options): Add --warn-search-mismatch.
8320 * parameters.cc (Parameters::is_compatible_target): New function.
8321 * parameters.h (class Parameters): Declare is_compatible_target.
8322 * workqueue.cc (Workqueue::add_blocker): New function.
8323 * workqueue.h (class Workqueue): Declare add_blocker.
8324
f1ed28fb
ILT
8325 * fileread.cc (Input_file::open): Remove options parameter.
8326 Change all callers.
8327 (Input_file::open_binary): Likewise.
8328 * script.cc (read_input_script): Likewise.
8329 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8330 options parameter from constructor. Change all callers.
8331 (class Read_script): Likewise.
8332 * fileread.h (class Input_file): Update declarations.
8333 * script.h (read_input_script): Update declaration.
8334
34dd024a
NC
83352009-03-10 Nick Clifton <nickc@redhat.com>
8336
8337 * po/es.po: New Spanish translation.
8338
6d71b17c
CC
83392009-03-06 Cary Coutant <ccoutant@google.com>
8340
8341 * options.cc (parse_short_option): Keep dash_z from registering itself.
8342
031cdbed
ILT
83432009-03-03 Ian Lance Taylor <iant@google.com>
8344
8345 PR 9918
8346 * target-reloc.h (relocate_section): Pass output_section to
8347 relocate.
8348 * i386.cc (Target_i386::should_apply_static_reloc): Add
8349 output_section parameter. Change all callers.
8350 (Target_i386::Relocate::relocate): Add output_section parameter.
8351 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8352 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8353 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8354 * testsuite/two_file_shared.sh: New script.
8355 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8356 (check_DATA): Add two_file_shared.dbg.
8357 (two_file_shared.dbg): New target.
8358 * testsuite/Makefile.in: Rebuild.
8359
15d5fa16
ILT
83602009-03-01 Ian Lance Taylor <iant@google.com>
8361
8362 * configure.ac: Check for byteswap.h.
8363 * configure: Rebuild.
8364 * config.in: Rebuild.
8365
8a4c0b0d
ILT
83662009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8367
8368 * layout.cc (Layout::find_or_add_kept_section): New function.
8369 (Layout::add_comdat): Removed.
8370 * layout.h (struct Kept_section): Move out of class Layout.
8371 Remove trailing underscores from field names. Add group_sections
8372 field. Rename group_ field to is_group. Change all uses.
8373 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8374 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8375 comdat_groups_ field.
8376 (Sized_relobj::include_section_group): Use
8377 find_or_add_kept_section and Kept_section::group_sections.
8378 (Sized_relobj::include_linkonce_section): Likewise.
8379 * object.cc (class Sized_relobj): Don't define Comdat_group or
8380 Comdat_group_table. Remove find_comdat_group and
8381 add_comdat_group. Remove comdat_groups_ field.
8382 * plugin.cc (include_comdat_group): Use
8383 Layout::find_or_add_kept_section.
8384
b4ecf66b
ILT
83852009-02-28 Ian Lance Taylor <iant@google.com>
8386
14359ca0
ILT
8387 * README: --gc-sections and map files are now supported. Document
8388 some build requirements.
8389
b4ecf66b
ILT
8390 PR 6992
8391 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8392 relocatable link set the value of the section symbol to zero.
8393 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8394 relocatable link don't include the section address in the local
8395 symbol value.
8396
0602e05a
ILT
83972009-02-27 Ian Lance Taylor <iant@google.com>
8398
fd9d194f
ILT
8399 PR 6811
8400 * options.h (class Search_directory): Add is_system_directory.
8401 (class General_options): Declare is_in_system_directory.
8402 * options.cc (get_relative_sysroot): Make static.
8403 (get_default_sysroot): Make static.
8404 (General_optoins::is_in_system_directory): New function.
8405 * fileread.cc (Input_file::is_in_system_directory): New function.
8406 * fileread.h (class Input_file): Declare is_in_system_directory.
8407 * object.h (class Object): Add is_in_system_directory.
8408 (class Input_objects): Remove system_library_directory_ field.
8409 * object.cc (Input_objects::add_object): Don't set
8410 system_library_directory_.
8411 (input_objects::found_in_system_library_directory): Remove.
8412 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8413 parameter. Change all callers.
8414 (Symbol_table::sized_write_globals): Likewise.
8415 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8416 Call Object::is_in_system_directory.
8417 * symtab.h (class Symbol_table): Update declarations.
8418
61edd21f
ILT
8419 PR 5990
8420 * descriptors.h (Open_descriptor): Add is_on_stack field.
8421 * descriptors.cc (Descriptors::open): If the descriptor is on the
8422 top of the stack, remove it. Initialize is_on_stack field.
8423 (Descriptors::release): Only add pod to stack if it is not on the
8424 stack already.
8425 (Descriptors::close_some_descriptor): Clear stack_next and
8426 is_on_stack fields.
8427
e29e076a
ILT
8428 PR 7091
8429 * output.cc (Output_section::find_starting_output_address): Rename
8430 from starting_output_address; add PADDR parameter; change return
8431 type.
8432 * output.h (class Output_section): Declare
8433 find_starting_output_address instead of starting_output_address.
8434 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8435 section symbol for which we can't find a merge section.
8436
0602e05a
ILT
8437 PR 9836
8438 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8439 hidden or internal, force the symbol to be local.
8440 * resolve.cc (Symbol::override_visibility): Define.
8441 (Symbol::override_base): Use override_visibility.
8442 (Symbol_table::resolve): Likewise.
8443 (Symbol::override_base_with_special): Likewise.
8444 (Symbol_table::override_with_special): If the visibility is hidden
8445 or internal, force the symbol to be local.
8446 * symtab.h (class Symbol): Add set_visibility and
8447 override_visibility.
8448 * testsuite/ver_test_1.sh: New file.
8449 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8450 (check_DATA): Add ver_test_1.syms.
8451 (ver_test_1.syms): New target.
8452 * testsuite/Makefile.in: Rebuild.
8453
401a9a73
CC
84542009-02-25 Cary Coutant <ccoutant@google.com>
8455
8456 * layout.cc (Layout::choose_output_section): Don't rename sections
8457 when using a linker script that has a SECTIONS clause.
8458 * Makefile.in: Regenerate.
8459
8460 * testsuite/Makefile.am (script_test_5.sh): New test case.
8461 * testsuite/Makefile.in: Regenerate.
8462 * testsuite/script_test_5.cc: New file.
8463 * testsuite/script_test_5.sh: New file.
8464 * testsuite/script_test_5.t: New file.
8465
f488e4b0
CC
84662009-02-13 Rafael Avila de Espindola <espindola@google.com>
8467
8468 * archive.cc (Archive::include_member): Update calls to add_symbols.
8469 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8470 the Layout argument.
8471 * dynobj.h (do_add_symbols): Add the Layout argument.
8472 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8473 Layout argument.
8474 * object.h (Object::add_symbols): Add the Layout argument.
8475 (Object::do_add_symbols): Add the Layout argument.
8476 (Sized_relobj::do_add_symbols): Add the Layout argument.
8477 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8478 Unify the two versions.
8479 (Add_plugin_symbols): Remove.
8480 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8481 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8482 (Add_plugin_symbols): Remove.
8483 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8484 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8485 (Add_symbols::run): Make it work with Pulginobj.
8486
89dd1680
ILT
84872009-02-06 Ian Lance Taylor <iant@google.com>
8488
8489 * object.cc (Sized_relobj::do_layout): Make info message start
8490 with lower case letter.
8491
266d0a74
ILT
84922009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8493
602b464e
ILT
8494 * binary.cc: Fix file comment.
8495
266d0a74
ILT
8496 * options.h (enum Incremental_disposition): Define.
8497 (class General_options): Add new options: --incremental,
8498 --incremental_changed, --incremental_unchanged,
8499 --incremental_unknown. Add incremental_disposition_ and
8500 implicit_incremental_ fields.
8501 (General_options::incremental_disposition): New function.
8502 (class Position_dependent_options): Add incremental_disposition
8503 option.
8504 (Position_dependent_options::copy_from_options): Set incremental
8505 dispositions.
8506 * options.cc (General_options::parse_incremental_changed): New
8507 function.
8508 (General_options::parse_incremental_unchanged): New function.
8509 (General_options::parse_incremental_unknown): New function.
8510 (General_options::General_options): Initialize new fields
8511 incremental_disposition_ and implicit_incremental_.
8512 (General_options::finalize): Check for uasge of --incremental-*
8513 without --incremental.
8514
f073bbf7
CD
85152009-02-06 Chris Demetriou <cgd@google.com>
8516
8517 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8518 pointer and to report location as the file name associated with
8519 the symbol.
8520 (gold_undefined_symbol_at_location): New function to replace the
8521 old gold_undefined_symbol functionality.
8522 * target-reloc.h (relocate_section): Update to use
8523 gold_undefined_symbol_at_location.
8524 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8525 Call gold_undefined_symbol function rather than gold_error.
8526 * errors.h (Errors::undefined_symbol): Take location as a
8527 string, rather than calculating it from a relocation.
8528 * errors.cc (Errors::fatal): Print "fatal error:" before the
8529 formatted message.
8530 (Errors::error, Errors::error_at_location): Print "error: "
8531 before the formatted message.
8532 (Errors::undefined_symbol): Take location as a string, rather
8533 than calculating it from a relocation.
8534 (gold_undefined_symbol_at_location): New function akin to
8535 old gold_undefined_symbol, calculates location from relocation.
8536 (gold_undefined_symbol): Change to take only a Symbol pointer
8537 and to report location as the file name associated with the symbol.
8538 * testsuite/debug_msg.sh: Update for changed error messages.
8539 * testsuite/undef_symbol.sh: Likewise.
8540
8e94a90c
ILT
85412009-02-04 Duncan Sands <baldrick@free.fr>
8542
8543 PR 9812
8544 * reduced_debug_output.h
8545 (Output_reduced_debug_abbrev_section::failed): Use format for
8546 gold_warning.
8547 (Output_reduced_debug_info_section::faild): Likewise.
8548
88a0e15b
ILT
85492009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8550
8551 * script.cc (Lazy_demangler): New class.
8552 (Version_script_info::get_symbol_version_helper): Demangle a
8553 symbol only once.
8554
5efc7cd2
CC
85552009-01-29 Cary Coutant <ccoutant@google.com>
8556
8557 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8558 to __tls_get_addr.
8559 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8560
e0ebcf42
ILT
85612009-01-28 Ian Lance Taylor <iant@google.com>
8562
5efc7cd2 8563 * version.cc (version_string): Bump to 1.9.
75fe7426 8564
e0ebcf42
ILT
8565 * gold.h: Include <cstring> and <stdint.h>.
8566 * version.cc: Include <cstdio>.
8567 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8568 warning.
8569 * reduced_debug_output.cc (insert_into_vector): Rename from
8570 Insert_into_vector; change all callers. Use Swap_unaligned to
8571 avoid aliasing issue; remove union since it is unnecessary.
8572
8e2813be 85732009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
8574
8575 * Makefile.am (CCFILES): Add gc.cc.
8576 (HFILES): Add gc.h.
8577 * Makefile.in: Regenerate.
8578 * gold.cc (Gc_runner): New class.
8579 (queue_initial_tasks): Call garbage collection related tasks
8580 when corresponding options are invoked.
8581 (queue_middle_gc_tasks): New function.
8582 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8583 processed early before laying out sections during garbage collection.
8584 * gold.h (queue_middle_gc_tasks): New function.
8585 (is_prefix_of): Move from "layout.cc".
8586 * i386.cc (Target_i386::gc_process_relocs): New function.
8587 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8588 * main.cc (main): Create object of class "Garbage_collection".
8589 * object.cc (Relobj::copy_symbols_data): New function.
8590 (Relobj::is_section_name_included): New function.
e1df38aa
NC
8591 (Sized_relobj::do_layout): Allow this function to be called twice
8592 during garbage collection and defer layout of section during the
6d03d481
ST
8593 first call.
8594 * object.h (Relobj::get_symbols_data): New function.
8595 (Relobj::is_section_name_included): New function.
8596 (Relobj::copy_symbols_data): New function.
8597 (Relobj::set_symbols_data): New function.
8598 (Relobj::get_relocs_data): New function.
8599 (Relobj::set_relocs_data): New function.
8600 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8601 (Relobj::gc_process_relocs): New function.
8602 (Relobj::do_gc_process_relocs): New pure virtual function.
8603 (Relobj::sd_): New data member.
8604 (Sized_relobj::is_output_section_offset_invalid): New function.
8605 (Sized_relobj::do_gc_process_relocs): New function.
8606 * options.h (General_options::gc_sections): Modify to not be a no-op.
8607 (General_options::print_gc_sections): New option.
8608 * plugin.cc (Plugin_finish::run): Remove function call to
8609 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8610 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8611 * reloc.cc (Read_relocs::run): Add task to process relocs and
8612 determine unreferenced sections when doing garbage collection.
8613 (Gc_process_relocs): New class.
8614 (Sized_relobj::do_gc_process_relocs): New function.
8615 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8616 sections that are garbage collected.
8617 * reloc.h (Gc_process_relocs): New class.
8618 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8619 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8620 symbols whose corresponding sections are garbage collected.
8621 (Symbol_table::Symbol_table): Add new parameter for the garbage
8622 collection object.
8623 (Symbol_table::gc_mark_undef_symbols): New function.
8624 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8625 (Symbol_table::gc_mark_dyn_syms): New function.
8626 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8627 as garbage.
8628 (Symbol_table::add_from_object): Likewise.
8629 (Symbol_table::add_from_relobj): When building shared objects, do not
8630 treat externally visible symbols as garbage.
8631 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8632 table information for static and relocatable links.
8633 * symtab.h (Symbol_table::set_gc): New function.
8634 (Symbol_table::gc): New function.
8635 (Symbol_table::gc_mark_undef_symbols): New function.
8636 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8637 (Symbol_table::gc_mark_dyn_syms): New function.
8638 (Symbol_table::gc_): New data member.
e1df38aa 8639 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
8640 function.
8641 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8642 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8643
3b293544
CF
86442009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8645
8646 * options.h (General_options::gc_sections): Define as a no-op for now.
8647 (General_options::no_keep_memory): Ditto.
8648 (General_options::Bshareable): Define.
8649 * options.cc (General_options::finalize): Honor -Bshareable.
8650
83d22aa8
AS
86512009-01-20 Andreas Schwab <schwab@suse.de>
8652
8653 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8654 read the value in the contents, since we don't use it. Use the
8655 template endianness when writing.
8656 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8657
cd536b21
AS
86582009-01-19 Andreas Schwab <schwab@suse.de>
8659
8660 * configure.tgt (powerpc64-*): Fix targ_obj.
8661
99e9a495
ILT
86622009-01-15 Ian Lance Taylor <iant@google.com>
8663
8664 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8665 local symbols when stripping all symbols.
8666
bbbfea06
CC
86672009-01-14 Cary Coutant <ccoutant@google.com>
8668
99e9a495 8669 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 8670
0f7c0701
CC
86712009-01-14 Cary Coutant <ccoutant@google.com>
8672
8673 * archive.cc (Archive::get_elf_object_for_member): Remove call
8674 to File_read::claim_for_plugin.
8675 * descriptors.cc (Descriptors::open): Remove reference to
8676 is_claimed.
8677 (Descriptors::claim_for_plugin): Remove.
8678 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8679 (Descriptors::is_claimed): Remove.
8680 (claim_descriptor_for_plugin): Remove.
8681 * fileread.cc (File_read::claim_for_plugin): Remove.
8682 * fileread.h (File_read::claim_for_plugin): Remove.
8683 (File_read::descriptor): Reopen descriptor if necessary.
8684 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8685 (Plugin_manager::all_symbols_read): Add task parameter. Change
8686 all callers.
8687 (Plugin_manager::get_input_file): New function.
8688 (Plugin_manager::release_input_file): New function.
8689 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8690 corresponding data member.
8691 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8692 and pass to base constructor. Change all callers.
8693 (get_input_file, release_input_file): New functions.
8694 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8695 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8696 (Plugin_manager::all_symbols_read): Add task parameter.
8697 (Plugin_manager::get_input_file): New function.
8698 (Plugin_manager::release_input_file): New function.
8699 (Plugin_manager::task_): New data member.
8700 (Pluginobj::Pluginobj): Add filesize parameter.
8701 (Pluginobj::filename): New function.
8702 (Pluginobj::descriptor): New function.
8703 (Pluginobj::filesize): New function.
8704 (Pluginobj::filesize_): New data member.
8705 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8706 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8707 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8708
8709 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8710 with archive libraries.
8711 * testsuite/Makefile.in: Regenerate.
8712 * testsuite/plugin_test.c (struct sym_info): New type.
8713 (get_input_file, release_input_file): New static variables.
8714 (onload): Capture new transfer vector entries.
8715 (claim_file_hook): Stop reading at end of file according to filesize.
8716 Factor out parsing of readelf output into separate function.
8717 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8718 APIs and get the source file name from the symbol table. Convert
8719 source file name to corresponding object file name. Print info
8720 message when adding new input files.
8721 (parse_readelf_line): New function.
8722 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8723 * testsuite/plugin_test_2.sh: Likewise.
8724 * testsuite/plugin_test_3.sh: Likewise.
8725 * testsuite/plugin_test_4.sh: New test case.
8726
62a6d109
ILT
87272009-01-07 Ian Lance Taylor <iant@google.com>
8728
8729 * version.cc (version_string): Bump to 1.8.
8730
483620e8
CC
87312008-12-23 Cary Coutant <ccoutant@google.com>
8732
8733 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8734 * plugin.cc (Plugin_manager::finish): Rename as
8735 layout_deferred_objects. Move cleanup to separate function.
8736 (Plugin_manager::cleanup): New function.
8737 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8738 separately.
8739 * plugin.h (Plugin_manager::finish): Rename as
8740 layout_deferred_objects.
8741 (Plugin_manager::cleanup): New function.
8742 (Plugin_manager::cleanup_done): New field.
8743
d66a9eb3
CC
87442008-12-23 Cary Coutant <ccoutant@google.com>
8745
8746 * plugin.cc (is_visible_from_outside): New function.
8747 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8748 so we don't return "IR only" status for exported symbols or -r links.
8749
8750 * testsuite/Makefile.am (plugin_test_3): New test case.
8751 * testsuite/Makefile.in: Regenerate.
8752 * testsuite/plugin_test_3.sh: New file.
8753
5995b570
CC
87542008-12-22 Cary Coutant <ccoutant@google.com>
8755
8756 * object.cc (Sized_relobj::layout_section): New function.
8757 (Sized_relobj::do_layout): Defer layout of input sections until after
8758 plugin has provided replacement files.
8759 (Sized_relobj::do_layout_deferred_sections): New function.
8760 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8761 (Relobj::layout_deferred_sections): New function.
8762 (Relobj::do_layout_deferred_sections): New function.
8763 (Sized_relobj::do_layout_deferred_sections): New function.
8764 (Sized_relobj::layout_section): New function.
8765 (Sized_relobj::Deferred_layout): New structure.
8766 (Sized_relobj::deferred_layout_): New field.
8767 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8768 Change all callers. Layout deferred sections.
8769 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8770 references.
8771 (Plugin_hook::run): Move code from do_plugin_hook inline.
8772 (Plugin_hook::do_plugin_hook): Remove.
8773 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8774 (Plugin_manager::finish): Renamed, was cleanup.
8775 (Plugin_manager::should_defer_layout): New function.
8776 (Plugin_manager::add_deferred_layout_object): New function.
8777 (Plugin_manager::Deferred_layout_list): New type.
8778 (Plugin_manager::deferred_layout_objects_): New field.
8779 (Plugin_hook::do_plugin_hook): Remove.
8780
ee769c88
ILT
87812008-12-17 Ian Lance Taylor <iant@google.com>
8782
8783 * options.h (class General_options): Add --no case for
8784 --export-dynamic.
8785
abc8dcba
CC
87862008-12-16 Cary Coutant <ccoutant@google.com>
8787
8788 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8789 vector.
8790 (Plugin_manager::claim_file): Create plugin object even if
8791 plugin did not call the add_symbols callback.
8792 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8793 asking for more symbols than were added.
8794 * testsuite/Makefile.am (plugin_test_1): Add test case with
8795 no global symbols.
8796 (empty.syms): New target.
8797 * testsuite/Makefile.in: Regenerate.
8798 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8799 message. Don't call add_symbols if no globals.
8800 (all_symbols_read_hook): Don't provide replacement for empty
8801 claimed file.
8802
b0074644
ILT
88032008-12-12 Ian Lance Taylor <iant@google.com>
8804
68943102
ILT
8805 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8806 r_type == 0 for a local symbol with r_sym == 0.
8807 (scan_relocatable_relocs): Pass r_sym to
8808 local_non_section_strategy.
8809 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8810 r_sym parameter.
8811
b0074644
ILT
8812 * configure.ac: Update test for TLS descriptors: they are
8813 supported as of glibc 2.9.
8814 * configure: Rebuild.
8815
c2508178
ILT
88162008-12-11 Ian Lance Taylor <iant@google.com>
8817
8818 PR 7091
8819 * target-reloc.h (Default_scan_relocatable_relocs): For each
8820 function, map r_type == 0 to RELOC_DISCARD.
8821
2756a258
CC
88222008-12-10 Cary Coutant <ccoutant@google.com>
8823
8824 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8825 object to override a kept COMDAT group from a plugin object.
8826
bb6f53d3
ILT
88272008-12-09 Ian Lance Taylor <iant@google.com>
8828
fbc558e1
ILT
8829 PR 7088
8830 * yyscript.y (file_cmd): Handle INPUT.
8831
bb6f53d3
ILT
8832 * testsuite/initpri1.c: Change all declarations to be full
8833 prototypes by adding void, to avoid compiler warnings.
8834
4674ecfc
CC
88352008-12-05 Rafael Avila de Espindola <espindola@google.com>
8836
8837 * options.cc (General_options::parse_plugin_opt): New.
8838 (General_options::add_plugin): The argument now is just the filename.
8839 (General_options::add_plugin_option): New.
8840 * options.h (plugin_opt): New.
8841 (add_plugin): Change argument name.
8842 (add_plugin_option): New.
8843 * plugin.cc (Plugin::load): Don't parse the plugin option.
8844 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8845 (Plugin::add_option): New.
8846 (Plugin::args_): Change type.
8847 (Plugin::filename_): New.
8848 (Plugin_manager::add_plugin_option): New.
8849 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8850 * testsuite/Makefile.in: Regenerate.
8851
fd06b4aa
CC
88522008-12-05 Cary Coutant <ccoutant@google.com>
8853
8854 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8855 Handle --strip-lto-sections option.
8856 * options.h (strip_lto_sections): New option.
8857
6c52134c
CC
88582008-12-01 Cary Coutant <ccoutant@google.com>
8859
8860 * plugin.cc (ld_plugin_message): Change format parameter to const.
8861 Fix mismatch between new[] and delete.
8862
a45248e0
CC
88632008-11-14 Cary Coutant <ccoutant@google.com>
8864
8865 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8866 instead of -1U.
8867
c82fbeee
CS
88682008-11-05 Craig Silverstein <csilvers@google.com>
8869
8870 * options.cc (General_options::parse_dynamic_list): New function.
8871 * options.h (General_options): New flags dynamic_list,
8872 dynamic_list_data, dynamic_list_cpp_new, and
8873 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8874 (General_options::in_dynamic_list): New function.
8875 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8876 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8877 (Lex::can_continue_name): Likewise.
8878 (yylex): Likewise.
8879 (read_script_file): New parameter script_options.
8880 (read_dynamic_list): New function.
8881 (Script_options::define_dynamic_list): New function.
8882 (dynamic_list_keyword_parsecodes): New variable.
8883 (dynamic_list_keywords): New variable.
8884 * script.h (Script_options::define_dynamic_list): New function
8885 prototype.
8886 (read_dynamic_list): New function prototype.
8887 * symtab.cc (strprefix): New macro.
8888 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8889 dynamic_list_data, dynamic_list_cpp_new, and
8890 dynamic_list_cpp_typeinfo.
8891 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8892 (dynamic_list_expr): New rule.
8893 (dynamic_list_nodes): Likewise.
8894 (dynamic_list_node): Likewise.
8895 * testsuite/Makefile.am (dynamic_list): New test.
8896 * testsuite/Makefile.in: Regenerated.
8897 * testsuite/dynamic_list.t: New file.
8898 * testsuite/dynamic_list.sh: New file.
8899
e0bb29a5
CS
89002008-11-05 Craig Silverstein <csilvers@google.com>
8901
8902 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8903 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8904 (t11_last): Likewise.
8905 * testsuite/ver_test_6.c (main): Likewise.
8906
4e1e25e0
CC
89072008-10-07 Cary Coutant <ccoutant@google.com>
8908
8909 * options.c (General_options::finalize): Add check for -static and
8910 -shared.
8911 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8912 is not empty.
8913
92f03fcb
CC
89142008-10-02 Cary Coutant <ccoutant@google.com>
8915
8916 * plugin.cc (make_sized_plugin_object): Fix conditional
8917 compilation to work when not all targets are enabled.
8918
fbd8a257
CC
89192008-09-29 Cary Coutant <ccoutant@google.com>
8920
8921 * archive.cc (Archive::get_file_and_offset): Use filename instead
8922 of name to get library path.
8923 (Archive::include_member): Unlock external member of a thin archive.
8924
8925 * testsuite/Makefile.am (TEST_AR): New variable.
8926 (thin_archive_test_1): New test.
8927 (thin_archive_test_2): New test.
81636b3f
CC
8928 * testsuite/Makefile.in: Regenerate.
8929 * testsuite/thin_archive_main.cc: New file.
8930 * testsuite/thin_archive_test_1.cc: New file.
8931 * testsuite/thin_archive_test_2.cc: New file.
8932 * testsuite/thin_archive_test_3.cc: New file.
8933 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 8934
eff45813
CC
89352008-09-29 Cary Coutant <ccoutant@google.com>
8936
8937 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8938 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8939 instead of -1U.
8940 (Sized_relobj::do_finalize_local_symbols): Likewise.
8941 (Sized_relobj::map_to_kept_section): Likewise.
8942 * object.h (Sized_relobj::invalid_address): New constant.
8943 (Sized_relobj::do_output_section_offset): Check for invalid_address
8944 and return -1ULL.
8945 * output.cc (Output_reloc::local_section_offset): Use constant
8946 invalid_address instead of -1U.
8947 (Output_reloc::get_address): Likewise.
8948 (Output_section::output_address): Change -1U to -1ULL.
8949 * output.h (Output_reloc::invalid_address): New constant.
8950 * reloc.cc (Sized_relobj::write_sections): Use constant
8951 invalid_address instead of -1U.
8952 (Sized_relobj::relocate_sections): Likewise.
8953 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8954 values for merge sections.
8955 * target-reloc.h (relocate_for_relocatable): Use constant
8956 invalid_address instead of -1U.
8957
89fc3421
CC
89582008-09-19 Cary Coutant <ccoutant@google.com>
8959
8960 Add plugin functionality for link-time optimization (LTO).
8961 * configure.ac (plugins): Add --enable-plugins option.
8962 * configure: Regenerate.
8963 * config.in: Regenerate.
8964 * Makefile.am (LIBDL): New variable.
8965 (CCFILES): Add plugin.cc.
8966 (HFILES): Add plugin.h.
8967 (ldadd_var): Add LIBDL.
8968 * Makefile.in: Regenerate.
8969
8970 * archive.cc: Include "plugin.h".
8971 (Archive::setup): Don't preread archive symbols when using a plugin.
8972 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8973 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8974 files.
8975 (Archive::include_member): Add symbols from plugin objects.
8976 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8977 * descriptors.cc (Descriptors::open): Check for file descriptors
8978 abandoned by plugins.
8979 (Descriptors::claim_for_plugin): New function.
8980 * descriptors.h (Descriptors::claim_for_plugin): New function.
8981 (Open_descriptor::is_claimed): New field.
8982 (claim_descriptor_for_plugin): New function.
8983 * fileread.cc (File_read::claim_for_plugin): New function.
8984 * fileread.h (File_read::claim_for_plugin): New function.
8985 (File_read::descriptor): New function.
8986 * gold.cc: Include "plugin.h".
8987 (queue_initial_tasks): Add task to call plugin hooks for generating
8988 new object files.
8989 * main.cc: Include "plugin.h".
8990 (main): Load plugin libraries.
8991 * object.h (Pluginobj): Declare.
8992 (Object::pluginobj): New function.
8993 (Object::do_pluginobj): New function.
8994 (Object::set_target): New function.
8995 * options.cc: Include "plugin.h".
8996 (General_options::parse_plugin): New function.
8997 (General_options::General_options): Initialize plugins_ field.
8998 (General_options::add_plugin): New function.
8999 * options.h (Plugin_manager): Declare.
9000 (General_options): Add --plugin option.
9001 (General_options::has_plugins): New function.
9002 (General_options::plugins): New function.
9003 (General_options::add_plugin): New function.
9004 (General_options::plugins_): New field.
9005 * plugin.cc: New file.
9006 * plugin.h: New file.
9007 * readsyms.cc: Include "plugin.h".
9008 (Read_symbols::do_read_symbols): Check for archive before checking
9009 for ELF file. Call plugin hooks to claim files.
9010 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9011 from a real object file; force override when processing replacement
9012 files.
9013 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9014 (Symbol::init_base_object): Likewise.
9015 (Symbol::init_base_output_data): Likewise.
9016 (Symbol::init_base_output_segment): Likewise.
9017 (Symbol::init_base_constant): Likewise.
9018 (Symbol::init_base_undefined): Likewise.
9019 (Symbol::output_section): Assert that object is not a plugin.
9020 (Symbol_table::add_from_pluginobj): New function.
9021 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9022 undefined.
9023 (Symbol_table::sized_write_globals): Likewise.
9024 (Symbol_table::add_from_pluginobj): Instantiate template.
9025 * symtab.h (Sized_pluginobj): Declare.
9026 (Symbol::in_real_elf): New function.
9027 (Symbol::set_in_real_elf): New function.
9028 (Symbol::in_real_elf_): New field.
9029 (Symbol_table::add_from_pluginobj): New function.
9030
9031 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9032 (LIBDL): New variable.
9033 (LDADD): Add LIBDL.
9034 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9035 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9036 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9037 (MOSTLYCLEANFILES): Likewise.
9038 * testsuite/Makefile.in: Regenerate.
9039 * testsuite/plugin_test.c: New file.
9040 * testsuite/plugin_test_1.sh: New file.
9041 * testsuite/plugin_test_2.sh: New file.
9042
de31bda5
ILT
90432008-09-16 Ian Lance Taylor <iant@google.com>
9044
9c2d0ef9
ILT
9045 * target-reloc.h (relocate_section): Check whether a symbol is
9046 defined by the ABI before reporting an undefined symbol error.
9047 * target.h (Target::is_defined_by_abi): Make parameter const.
9048 (Target::do_is_defined_by_abi): Likewise.
9049 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9050 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9051 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9052 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9053 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9054 * testsuite/Makefile.in: Rebuild.
9055
de31bda5
ILT
9056 * fileread.cc (make_view): Add casts to avoid warning.
9057
9fa33bee
AO
90582008-09-16 Alexandre Oliva <aoliva@redhat.com>
9059
9060 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9061 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9062
183fd0e3
AO
90632008-09-16 Alexandre Oliva <aoliva@redhat.com>
9064
9065 * options.h (General_options::output_is_executable): New.
9066 (General_options::output_is_pie): New.
9067 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9068 for shared libraries.
9069 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9070
7be8330a
CD
90712008-09-11 Chris Demetriou <cgd@google.com>
9072
9073 * options.h (origin): New -z option.
9074 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9075 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9076 in DT_FLAGS_1.
9077
a9caad02
CC
90782008-09-05 Cary Coutant <ccoutant@google.com>
9079
9080 * fileread.cc (File_read::make_view): Add check for attempt to map
9081 beyond end of file.
9082
ae6dce4d
CC
90832008-09-05 Cary Coutant <ccoutant@google.com>
9084
9085 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9086 explicit instantiations.
9087
d7ab2a47
KVH
90882008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9089
9090 PR gold/6858
9091 * options.cc (General_options::finalize): Allow undefined symbols
9092 in shlibs if linking -shared.
9093
9094 PR gold/6859
9095 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9096 symbols as not needing a dynsym entry.
9097
1e52a9c1
CS
90982008-08-20 Craig Silverstein <csilvers@google.com>
9099
9100 * fileread.cc (File_read::open): Do not lock the file unless it
9101 was successfully opened.
9102
d85c80a3
CC
91032008-08-14 Cary Coutant <ccoutant@google.com>
9104
9105 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9106 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9107 * testsuite/tls_test.cc (struct int128): 128-bit struct
9108 for testing TLS relocs with non-zero addend.
9109 (v12): New TLS variable.
9110 (t12): New test.
9111 (t_last): Add check for v12.
9112 * testsuite/tls_test.h (t12): New function.
9113 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9114
2d924fd9
ILT
91152008-08-13 Ian Lance Taylor <iant@google.com>
9116
9117 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9118 set tls_segment_ or relro_segment_.
9119 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9120 when appropriate.
9121 * output.h (Output_section::clear_is_relro): New function.
9122 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9123 sections specially even when output_data_ is empty.
9124 (Output_segment::maximum_alignment): When first section is relro,
9125 only force alignment for PT_LOAD segments.
9126 * script.cc (script_data_segment_align): New function.
9127 (script_data_segment_relro_end): New function.
9128 * script-c.h (script_data_segment_align): Declare.
9129 (script_data_segment_relro_end): Declare.
9130 * script-sections.h (class Script_sections): Declare
9131 data_segment_align and data_segment_relro_end. Add fields
9132 segment_align_index_ and saw_relro_end_.
9133 * script-sections.cc (class Sections_element): Add set_is_relro
9134 virtual function. Add new bool* parameter to place_orphan_here.
9135 Add get_output_section virtual function.
9136 (class Output_section_definition): Add set_is_relro. Add new
9137 bool* parameter to place_orphan_here. Add get_output_section.
9138 Add is_relro_ field.
9139 (Output_section_definition::Output_section_definition): Initialize
9140 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9141 and is_relro_ fields.
9142 (Output_section_definition::place_orphan_here): Add is_relro
9143 parameter.
9144 (Output_section_definition::set_section_addresses): Set relro for
9145 output section.
9146 (Output_section_definition::alternate_constraint): Likewise.
9147 (class Orphan_output_section): Add new bool* parameter to
9148 place_orphan_here. Add get_output_section.
9149 (Orphan_output_section::place_orphan_here): Add is_relro
9150 parameter.
9151 (Script_sections::Script_sections): Initialize
9152 data_segment_align_index_ and saw_relro_end_.
9153 (Script_sections::data_segment_align): New function.
9154 (Script_sections::data_segment_relro_end): New function.
9155 (Script_sections::place_orphan): Set or clear is_relro.
9156 (Script_sections::set_section_addresses): Force alignment of first
9157 TLS section.
9158 * yyscript.y (exp): Call script_data_segment_align and
9159 script_data_segment_relro_end.
9160 * testsuite/relro_script_test.t: New file.
9161 * testsuite/relro_test.cc (using_script): Declare.
9162 (t1, t2): Test using_script.
9163 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9164 (relro_script_test_SOURCES): Define.
9165 (relro_script_test_DEPENDENCIES): Define.
9166 (relro_script_test_LDFLAGS): Define.
9167 (relro_script_test_LDADD): Define.
9168 (relro_script_test.so): New target.
9169 * testsuite/Makefile.in: Rebuild.
9170
f827c9a9
CC
91712008-08-06 Cary Coutant <ccoutant@google.com>
9172
9173 * archive.cc (Archive::total_archives, Archive::total_members)
9174 (Archive::total_members_loaded): New variables.
9175 (Archive::setup): Add parameter. Add option to preread
9176 archive symbols.
9177 (Archive::read_armap): Add counter.
9178 (Archive::get_file_and_offset): New function.
9179 (Archive::get_elf_object_for_member): New function.
9180 (Archive::read_all_symbols): New function.
9181 (Archive::read_symbols): New function.
9182 (Archive::add_symbols): Add counters.
9183 (Archive::include_all_members): Use armap to find members if it's
9184 already built.
9185 (Archive::include_member): Skip reading symbols if already read.
9186 Factored code into Archive::get_file_and_offset and
9187 Archive::get_elf_object_for_member. Changed call to
9188 Mapfile::report_include_archive_member.
9189 (Archive::print_stats): New function.
9190 * archive.h: Declare Object and Read_symbols_data classes.
9191 (Archive::Archive): Add initializers for new members.
9192 (Archive::setup): Add parameter.
9193 (Archive::print_stats): New function.
9194 (Archive::total_archives, Archive::total_members)
9195 (Archive::total_members_loaded): New variables.
9196 (Archive::get_file_and_offset): New function.
9197 (Archive::get_elf_object_for_member): New function.
9198 (Archive::read_all_symbols): New function.
9199 (Archive::read_symbols): New function.
9200 (Archive::Archive_member): New class.
9201 (Archive::members_): New member.
9202 (Archive::num_members_): New member.
9203 * main.cc: Include archive.h.
9204 (main): Call Archive::print_stats.
9205 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9206 archive parameter; member_name is now the fully-decorated name.
9207 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9208 * options.h: (General_options): Add --preread-archive-symbols option.
9209 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9210 Archive::setup.
9211
de4c45bd
ILT
92122008-08-04 Ian Lance Taylor <iant@google.com>
9213
9214 * symtab.h (Symbol::use_plt_offset): New function.
9215 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9216 * powerpc.cc (Relocate::relocate): Likewise.
9217 * sparc.cc (Relocate::relocate): Likewise.
9218 * x86_64.cc (Relocate::relocate): Likewise.
9219 * testsuite/weak_plt.sh: New test.
9220 * testsuite/weak_plt_main.cc: New test.
9221 * testsuite/weak_plt_shared.cc: New test.
9222 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9223 (check_PROGRAMS): Add weak_plt.
9224 (check_DATA): Add weak_plt_shared.so.
9225 (weak_plt_main_pic.o, weak_plt): New targets.
9226 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9227 * testsuite/Makefile.in: Rebuild.
9228
9229 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9230 gcctestdir/ld.
9231 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9232 * testsuite/Makefile.in: Rebuild.
9233
323ee3f4
AM
92342008-08-04 Alan Modra <amodra@bigpond.net.au>
9235
9236 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9237 * Makefile.in: Regenerate.
9238 * po/POTFILES.in: Regenerate.
9239
7c07ecec
ILT
92402008-07-29 Ian Lance Taylor <iant@google.com>
9241
9242 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9243 symbols before other symbols.
9244 * testsuite/script_test_2.cc (test_addr): Declare.
9245 (test_addr_alias): Declare.
9246 (main): Check that test_addr and test_addr_alias have the right
cd536b21 9247 values.
7c07ecec
ILT
9248 * testsuite/script_test_2.t: Define test_addr_alias and
9249 test_addr.
9250
5778530e
ILT
92512008-07-24 Ian Lance Taylor <iant@google.com>
9252
2a00e4fb
ILT
9253 PR 5990
9254 * descriptors.cc: New file.
9255 * descriptors.h: New file.
9256 * gold-threads.h (class Hold_optional_lock): New class.
9257 * fileread.cc: Include "descriptors.h".
9258 (File_read::~File_read): Release descriptor rather than closing
9259 it.
9260 (File_read::open) [file]: Call open_descriptor rather than open.
9261 Set is_descriptor_opened_.
9262 (File_read::open) [memory]: Assert that descriptor is not open.
9263 (File_read::reopen_descriptor): New function.
9264 (File_read::release): Release descriptor.
9265 (File_read::do_read): Make non-const. Reopen descriptor.
9266 (File_read::read): Make non-const.
9267 (File_read::make_view): Reopen descriptor.
9268 (File_read::do_readv): Likewise.
9269 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9270 Update declarations.
9271 * layout.cc: Include "descriptors.h".
9272 (Layout::create_build_id): Use open_descriptor rather than open.
9273 * output.cc: Include "descriptors.h".
9274 (Output_file::open): Use open_descriptor rather than open.
9275 * archive.cc (Archive::const_iterator): Change Archive to be
9276 non-const.
9277 (Archive::begin, Archive::end): Make non-const.
9278 (Archive::count_members): Likewise.
9279 * archive.h (class Archive): Update declarations.
9280 * object.h (Object::read): Make non-const.
9281 * Makefile.am (CCFILES): Add descriptors.cc.
9282 (HFILES): Add descriptors.h.
9283 * Makefile.in: Rebuild.
9284
801647d1
ILT
9285 PR 6716
9286 * gold.h: Always include <clocale>. Add Solaris workarounds
9287 following code in binutils/sysdep.h.
9288
5edd166e
ILT
9289 PR 6048
9290 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9291 this->eh_frame_hdr_ is NULL before using it.
9292
c89ad728
ILT
9293 * dynobj.cc (Versions::Versions): Update comment.
9294
aa86f06b
ILT
9295 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9296 the base version name.
9297
5778530e
ILT
9298 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9299 array size plus one.
9300 (Stringpool_template::set_string_offsets): Subtract one from key
9301 before using it as an array index.
9302 (Stringpool_template::get_offset_with_length): Likewise.
9303 (Stringpool_template::write_to_buffer): Likewise.
9304 * stringpool.h (Stringpool_template::get_offset_from_key):
9305 Likewise.
9306
057ead22
ILT
93072008-07-23 Ian Lance Taylor <iant@google.com>
9308
7f649c59
ILT
9309 PR 6658
9310 * object.h (Merged_symbol_value::value): Do our best to handle a
9311 negative addend.
9312
057ead22
ILT
9313 PR 6647
9314 * script.cc (Version_script_info::get_versions): Don't add empty
9315 version tag to return value.
9316 (Version_script_info::get_symbol_version_helper): Change return
9317 type to bool. Add pversion parameter. Change all callers.
9318 (script_register_vers_node): Don't require a non-NULL tag.
9319 * script.h (class Version_script_info): Update declarations.
9320 (Version_script_info::get_symbol_version): Change return type to
9321 bool. Add version parameter. Change all callers.
9322 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9323 handling. Handle an empty version from a version script.
9324 (Symbol_table::define_special_symbol): Likewise.
9325 * testsuite/ver_test_10.script: New file.
9326 * testsuite/ver_test_10.sh: New file.
9327 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9328 (check_DATA): Add ver_test_10.syms.
9329 (ver_test_10.syms, ver_test_10.so): New target.
9330 * testsuite/Makefile.in: Rebuild.
9331
58e54ac2
CD
93322008-07-23 Simon Baldwin <simonb@google.com>
9333
9334 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9335 to zero for undefined symbols from dynamic libraries.
9336
95d14cd3
ILT
93372008-07-23 Ian Lance Taylor <iant@google.com>
9338
9339 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9340 Change all callers.
9341 * symtab.h (class Symbol_table): Update declaration.
9342 * testsuite/ver_test_9.cc: New file.
9343 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9344 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9345 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9346 (ver_test_9.so, ver_test_9.o): New targets.
9347 * testsuite/Makefile.in: Rebuild.
9348
92de84a6
ILT
93492008-07-22 Ian Lance Taylor <iant@google.com>
9350
34810851
ILT
9351 * options.h (class General_options): Define --check-sections.
9352 * layout.cc (Layout::set_segment_offsets): Handle
9353 --check-sections.
9354
af6156ef
ILT
9355 * options.h (class General_options): Define -n/--nmagic and
9356 -N/--omagic.
9357 * options.cc (General_options::finalize): For -n/--nmagic or
9358 -N/--omagic, set -static.
9359 * layout.cc (Layout::attach_allocated_section_to_segment): If
9360 -N/--omagic, don't put read-only and read-write sections in
9361 different segments.
9362 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9363 finding a read-only segment.
9364 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9365 don't set the minimum segment alignment to the common page size,
9366 and don't set the file offset to the address modulo the page size.
9367 * script-sections.cc (Script_sections::create_segments): If
9368 -n/--omagic, don't put read-only and read-write sections in
9369 different segments.
9370
92de84a6
ILT
9371 * cref.cc: New file.
9372 * cref.h: New file.
9373 * options.h (class General_options): Add --print-symbol-counts.
9374 * main.cc (main): Issue defined symbol report if requested.
9375 * archive.cc (Archive::interpret_header): Make into a const member
9376 function.
9377 (Archive::add_symbols): Call Input_objects::archive_start and
9378 archive_stop.
9379 (Archive::const_iterator): Define new class.
9380 (Archive::begin, Archive::end): New functions.
9381 (Archive::include_all_members): Rewrite to use iterator.
9382 (Archive::count_members): New function.
9383 * archive.h (class Archive): Update declarations.
9384 (Archive::filename): New function.
9385 * object.cc: Include "cref.h".
9386 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9387 (Sized_relobj::do_get_global_symbol_counts): New function.
9388 (Input_objects::add_object): Add object to cross-referencer.
9389 (Input_objects::archive_start): New function.
9390 (Input_objects::archive_stop): New function.
9391 (Input_objects::print_symbol_counts): New function.
9392 * object.h: Declare Cref and Archive.
9393 (Object::get_global_symbol_counts): New function.
9394 (Object::do_get_global_symbol_counts): New pure virtual function.
9395 (class Sized_relobj): Add defined_count_ field. Update
9396 declarations.
9397 (class Input_objects): Add cref_ field. Update constructor.
9398 Update declarations.
9399 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9400 defined_count_.
9401 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9402 symbol counts.
9403 (Sized_dynobj::do_get_global_symbol_counts): New function.
9404 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9405 defined_count_. Update declarations. Define Symbols typedef.
9406 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9407 parameter. Change all callers.
9408 (Symbol_table::add_from_dynobj): Add sympointers and defined
9409 parameters. Change all callers.
9410 * symtab.h (class Symbol_table): Update declarations.
9411 * Makefile.am (CCFILES): Add cref.cc.
9412 (HFILES): Add cref.h.
9413 * Makefile.in: Rebuild.
9414
3f7c5e1d
CD
94152008-07-22 Simon Baldwin <simonb@google.com>
9416
9417 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9418 to zero when writing undefined symbols.
9419
e0b64032
ILT
94202008-07-22 Ian Lance Taylor <iant@google.com>
9421
9422 * output.cc (Output_section::add_input_section): Don't try to
9423 merge empty merge sections.
9424
096b02cf
CS
94252008-07-21 Craig Silverstein <csilvers@google.com>
9426
9427 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9428 Include symbol version in error message.
cd536b21 9429
1d1f116d
CD
94302008-07-20 Chris Demetriou <cgd@google.com>
9431
cd536b21 9432 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
9433 (RANDOM_SEED_CFLAGS): New substituted variable.
9434 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9435 * configure: Rebuild.
9436 * Makefile.in: Likewise.
9437 * testsuite/Makefile.in: Likewise.
9438
a18f591e
ILT
94392008-07-18 Ian Lance Taylor <iant@google.com>
9440
9441 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9442 where we see NAME/NULL and NAME/VERSION as separate symbols.
9443 * testsuite/ver_test_main.cc (main): Call t4.
9444 (t4, t4_2a): Define.
9445 * testsuite/ver_test_2.cc (t4_2): Define.
9446 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9447 * testsuite/ver_test_4.cc (t4_2a): Define.
9448 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9449 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9450
c6e3f6ed
ILT
94512008-07-17 Ian Lance Taylor <iant@google.com>
9452
9453 * dynobj.cc (Versions::add_def): If we give an error about a
9454 missing version, go ahead and create the version anyhow.
9455
ef9beddf
ILT
94562008-07-10 Ian Lance Taylor <iant@google.com>
9457
9458 Handle output sections with more than 0x7fffffff bytes.
9459 * object.h (class Relobj): Change map_to_output_ to
9460 output_sections_, and just keep a section pointer. Change all
9461 uses. Move comdat group support to Sized_relobj.
9462 (Relobj::is_section_specially_mapped): Remove.
9463 (Relobj::output_section): Remove poff parameter. Change all
9464 callers.
9465 (Relobj::output_section_offset): New function.
9466 (Relobj::set_section_offset): Rewrite.
9467 (Relobj::map_to_output): Remove.
9468 (Relobj::output_sections): New function.
9469 (Relobj::do_output_section_offset): New pure virtual function.
9470 (Relobj::do_set_section_offset): Likewise.
9471 (class Sized_relobj): Add section_offsets_ field. Add comdat
9472 group support from Relobj. Update declarations.
9473 (Sized_relobj::get_output_section_offset): New function.
9474 (Sized_relobj::do_output_section_offset): New function.
9475 (Sized_relobj::do_set_section_offset): New function.
9476 * object.cc (Relobj::output_section_address): Remove.
9477 (Sized_relobj::Sized_relobj): Initialize new fields.
9478 (Sized_relobj::include_section_group): Cast find_kept_object to
9479 Sized_relobj.
9480 (Sized_relobj::include_linkonce_section): Likewise.
9481 (Sized_relobj::do_layout): Use separate arrays for output section
9482 and output offset.
9483 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9484 output_sections.
9485 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9486 output_sections and section_offsets.
9487 (Sized_relobj::write_local_symbols): Likewise.
9488 (map_to_kept_section): Compute output address directly.
9489 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9490 output_sections and section_offsets.
9491 (Sized_relobj::write_sections): Likewise.
9492 (Sized_relobj::relocate_sections): Likewise.
9493 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9494 * output.h (class Output_reloc): Update declarations. Change
9495 u2_.relobj to Sized_relobj*.
9496 (class Output_data_reloc): Change add functions to use
9497 Sized_relobj*.
9498 * output.cc (Output_reloc::Output_reloc): Change relobj to
9499 Sized_relobj*.
9500 (Output_reloc::local_section_offset): Change return type to
9501 Elf_Addr. Use get_output_section_offset.
9502 (Output_reloc::get_address): Likewise.
9503 (Output_section::is_input_address_mapped): Don't call
9504 is_section_specially_mapped.
9505 (Output_section::output_offset): Likewise.
9506 (Output_section::output_address): Likewise.
9507 (Output_section::starting_output_address): Likewise.
9508 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9509 parameter to Sized_relobj*.
9510 (Copy_relocs::need_copy_reloc): Likewise.
9511 (Copy_relocs::save): Likewise.
9512 * copy-relocs.h (class Copy_relocs): Update declarations.
9513 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9514 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9515 * target-reloc.h (relocate_for_relocatable): Change
9516 offset_in_output_section type to Elf_Addr. Change code that uses
9517 it as well.
9518 * layout.cc (Layout::layout): Always set *off.
9519 * mapfile.cc (Mapfile::print_input_section): Use
9520 output_section_offset.
9521 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9522 Sized_relobj*.
9523 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9524 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9525 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9526
5cb66f97
ILT
95272008-07-03 Ian Lance Taylor <iant@google.com>
9528
9529 * layout.cc (Layout::include_section): Do not discard unrecognized
9530 SHT_STRTAB sections.
9531
afe47622
CS
95322008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9533
9534 * script.cc (Lex::can_continue_name): Make '?' allowable in
9535 version-script names.
9536 * testsuite/version_script.map: Change glob pattern to use '?'
9537
5adf9721
ILT
95382008-06-30 Manish Singh <yosh@gimp.org>
9539
9540 PR 6585
9541 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9542 Correct typo.
9543
e6fde208
ILT
95442008-06-30 Ian Lance Taylor <iant@google.com>
9545
9546 PR 6660
9547 PR 6682
9548 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9549 versions]: Don't try to read the value in the contents, since we
9550 don't use it. Use the template endianness when writing.
9551
3f2e6a2d
CC
95522008-06-25 Cary Coutant <ccoutant@google.com>
9553
9554 * fileread.cc (File_read::make_view): Assert on zero-length view.
9555 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9556 symbol table when there are no symbols to read.
9557
c43d3a48
CS
95582008-06-23 Craig Silverstein <csilvers@google.com>
9559
9560 * version.cc (version_string): Bump to 1.7
9561
5f494ea0
CS
95622008-06-18 Craig Silverstein <csilvers@google.com>
9563
9564 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9565 constant 0xFFFF to type Valtype.
9566 (Powerpc_relocate_functions::rel16_ha): Likewise.
9567
c42e122e
ILT
95682008-06-17 Ian Lance Taylor <iant@google.com>
9569
f34787f8
ILT
9570 * output.h (Output_section::Input_section): Initialize p2align_ to
9571 zero for Output_section_data constructors.
9572 (Output_section::Input_section::addralign): If not an input
9573 section, return the alignment of the Output_section_data.
9574 * testsuite/copy_test.cc: New file.
9575 * testsuite/copy_test_1.cc: New file.
9576 * testsuite/copy_test_2.cc: New file.
9577 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9578 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9579 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9580 (copy_test_1_pic.o, copy_test_1.so): New targets.
9581 (copy_test_2_pic.o, copy_test_2.so): New targets.
9582 * testsuite/Makefile.in: Rebuild.
9583
c42e122e
ILT
9584 * script-sections.cc (Script_sections::place_orphan): Initialize
9585 local variable exact.
9586
ce3ac18a
DE
95872008-06-13 David Edelsohn <edelsohn@gnu.org>
9588
9589 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9590
42cacb20
DE
95912008-06-12 David Edelsohn <edelsohn@gnu.org>
9592 David S. Miller <davem@davemloft.net>
9593
9594 * powerpc.cc: New file.
9595 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9596 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9597 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9598 * Makefile.in: Rebuild.
9599
7b308235
ILT
96002008-06-09 Ian Lance Taylor <iant@google.com>
9601
9602 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9603 <exception>.
9604 (throwing, orig_terminate): New static variables.
9605 (terminate_handler): New static function.
9606 (t2): Set terminate handler.
9607
f0b886e3
ILT
96082008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9609
9610 PR 6584
cd536b21 9611 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
9612 alignment.
9613
3e90f135
CC
96142008-05-30 Cary Coutant <ccoutant@google.com>
9615
9616 * archive.cc (Archive::include_all_members) Correct to step
9617 over symbol table and extended name table in thin archives.
9618
e09ad04a
ILT
96192008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9620
9621 PR 6407
9622 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9623 calculation.
9624
62b01cb5
ILT
96252008-05-28 Caleb Howe <cshowe@google.com>
9626
9627 * reduced_debug_output.cc: New file.
9628 * reduced_debug_output.h: New file.
92de84a6 9629 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
9630 * options.cc (General_options::finalize): Add strip_debug_non_line
9631 to the strip heirarchy.
9632 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9633 fields.
9634 * layout.cc: Include "reduced_debug_output.h".
9635 (Layout::Layout): Initialize new fields.
9636 (line_only_debug_sections): New static array.
9637 (is_lines_only_debug_sections): New static inline function.
9638 (Layout::include_section): Handle --strip-debug-non-line.
9639 (Layout::make_output_section): If --strip-debug-non-line, build
9640 new output sections for .debug_abbrev and .debug_info.
9641 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9642 gold. Warn about possible overflow.
9643 (read_signed_LEB_128): Likewise.
9644 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9645 (read_signed_LEB_128): Declare.
9646 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9647 (HFILES): Add reduced_debug_output.h.
9648 * Makefile.in: Rebuild.
9649
7d9e3d98
ILT
96502008-05-21 Ian Lance Taylor <iant@google.com>
9651
9652 * mapfile.cc: New file.
9653 * mapfile.h: New file.
9654 * options.h (class General_options): Add -M/--print-map and -Map.
9655 * options.cc (General_options::finalize): Make -M equivalent to
9656 -Map -.
9657 * main.cc: Include <cstdio> and "mapfile.h".
9658 (main): Open mapfile if requested.
9659 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9660 constructor. Change caller.
9661 (queue_initial_tasks): Add mapfile parameter. Change caller.
9662 (queue_middle_tasks): Likewise.
9663 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9664 declarations.
9665 * archive.cc: Include "mapfile.h".
9666 (Archive::add_symbols): Add mapfile parameter. Change all
9667 callers. Pass mapfile, symbol, and reason to include_member.
9668 (Archive::include_all_members): Add mapfile parameter. Change all
9669 callers.
9670 (Archive::include_member): Add mapfile, sym, and why parameters.
9671 Change all callers. Report inclusion to map file.
9672 * archive.h: Include "fileread.h".
9673 (class Archive): Update declarations.
9674 (Archive::file): New const method.
9675 (class Add_archive_symbols): Add mapfile_ field. Update
9676 constructor. Change all callers.
9677 * readsyms.h (class Read_symbols): Likewise.
9678 (class Finish_group): Likewise.
9679 (class Read_script): Likewise.
9680 * common.cc: Include "mapfile.h".
9681 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9682 all callers.
9683 (Symbol_table::do_allocate_commons): Likewise.
9684 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9685 symbol allocation to mapfile.
9686 * common.h (class Allocate_commons_task): Add mapfile_ field.
9687 Update constructor. Change all callers.
9688 * symtab.h (class Symbol_table): Update declarations.
9689 * layout.cc: Include "mapfile.h".
9690 (Layout_task_runner::run): Print information to mapfile.
9691 (Layout::create_gold_note): Change Output_data_fixed_space to
9692 Output_data_zero_fill.
9693 (Layout::create_build_id): Likewise.
9694 (Layout::print_to_mapfile): New function.
9695 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9696 constructor. Change caller.
9697 (class Layout): Declare print_to_mapfile.
9698 * output.cc (Output_section::Input_section::print_to_mapfile): New
9699 function.
9700 (Output_section::add_input_section): If producing a map, always
9701 add to input_sections_ list.
9702 (Output_section::do_print_to_mapfile): New function.
9703 (Output_segment::print_sections_to_mapfile): New function.
9704 (Output_segment::print_section_list_to_mapfile): New function.
9705 * output.h: Include "mapfile.h".
9706 (Output_data::print_to_mapfile): New function.
9707 (Output_data::do_print_to_mapfile): New virtual function.
9708 (Output_segment_headers::do_print_to_mapfile): New function.
9709 (Output_file_header::do_print_to_mapfile): New function.
9710 (Output_data_const::do_print_to_mapfile): New function.
9711 (class Output_data_const_buffer): Add map_name_ field. Update
9712 constructor. Change all callers. Add do_print_to_mapfile
9713 function.
9714 (class Output_data_fixed_space): Likewise.
9715 (class Output_data_space): Likewise.
9716 (class Output_data_zero_fill): New class.
9717 (Output_data_strtab::do_print_to_mapfile): New function.
9718 (Output_data_reloc_base::do_print_to_mapfile): New function.
9719 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9720 (Output_data_group::do_print_to_mapfile): New function.
9721 (Output_data_got::do_print_to_mapfile): New function.
9722 (Output_data_dynamic::do_print_to_mapfile): New function.
9723 (Output_symtab_xindex::do_print_to_mapfile): New function.
9724 (class Output_section): Declare do_print_to_mapflie. Declare
9725 print_to_mapfile in Input_section.
9726 (class Output_segment): Declare new functions.
9727 * object.h (Sized_relobj::symbol_count): New function.
9728 * script-sections.cc
9729 (Output_section_element_dot_assignment::set_section_addresses):
9730 Change Output_data_fixed_space to Output_data_zero_fill.
9731 (Output_data_expression::do_print_to_mapfile): New function.
9732 * script.cc (read_input_script): Add mapfile parameter. Change
9733 all callers.
9734 * script.h (read_input_script): Update declaration.
9735 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9736 (Eh_frame::do_print_to_mapfile): New function.
9737 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9738 (Output_merge_string::do_print_to_mapfile): New function.
9739 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9740 function.
9741 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9742 function.
9743 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9744 function.
9745 * Makefile.am (CCFILES): Add mapfile.cc.
9746 (HFILES): Add mapfile.h.
9747 * Makefile.in: Rebuild.
9748
9f1d377b
ILT
97492008-05-19 Ian Lance Taylor <iant@google.com>
9750
9751 * options.h (class General_options): Add -z relro.
9752 * layout.cc (Layout::Layout): Initialize relro_segment_.
9753 (Layout::add_output_section_data): Return the output section.
9754 (Layout::make_output_section): Rcognize relro sections and mark
9755 them appropriately.
9756 (Layout::attach_allocated_section_to_segment): Put relro sections
9757 in a PT_GNU_RELRO segment.
9758 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9759 section as relro.
9760 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9761 PT_TLS segments.
9762 (Layout::linkonce_mapping): Map d.rel.ro.local to
9763 .data.rel.ro.local.
9764 (Layout::output_section_name): Us .data.rel.ro.local for any
9765 section which begins with that.
9766 * layout.h (class Layout): Update add_output_section_data
9767 declaration. Add relro_segment_ field.
9768 * output.cc (Output_section::Output_section): Initialize is_relro_
9769 and is_relro_local_ fields.
9770 (Output_segment::add_output_section): Group relro sections.
9771 (Output_segment::is_first_section_relro): New function.
9772 (Output_segment::maximum_alignment): If there is a relro section,
9773 align the segment to the common page size.
9774 (Output_segment::set_section_addresses): Track whether we are
9775 looking at relro sections. If the last section is a relro
9776 section, align to the common page size.
9777 (Output_segment::set_section_list_addresses): Add in_relro
9778 parameter. Change all callers. Align to the page size when
9779 moving from relro to non-relro section.
9780 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9781 segment.
9782 * output.h (class Output_section): Add is_relro_ and
9783 is_relro_local_ fields.
9784 (Output_section::is_relro): New function.
9785 (Output_section::set_is_relro): New function.
9786 (Output_section::is_relro_local): New function.
9787 (Output_section::set_is_relro_local): New function.
9788 (class Output_segment): Update declarations.
9789 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9790 * sparc.cc (Target_sparc::got_section): Likewise.
9791 * x86_64.cc (Target_x86_64::got_section): Likewise.
9792 * testsuite/relro_test_main.cc: New file.
9793 * testsuite/relro_test.cc: New file.
9794 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9795 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9796 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9797 (relro_test.so, relro_test_pic.o): New targets.
9798 * testsuite/Makefile.in: Rebuild.
9799
a984ee1d
ILT
98002008-05-16 Ian Lance Taylor <iant@google.com>
9801
01676dcd
ILT
9802 * output.cc (Output_segment::add_output_section): Remove front
9803 parameter.
9804 * output.h (class Output_segment): Remove
9805 add_initial_output_section and overloaded add_output_section.
9806 Update declaration of remaining add_output_section.
9807 * layout.cc (Layout::create_interp): Call add_output_section
9808 rather than add_initial_output_section.
9809 (Layout::finish_dynamic_section): Likewise.
9810
497897f9
ILT
9811 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9812 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9813 know the dynamic type.
9814 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9815 field. Initialize it in constructor.
9816 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9817 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9818 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9819 reloc.
9820
a984ee1d
ILT
9821 * output.cc (Output_reloc::get_address): Change return type to
9822 Elf_Addr.
9823 * output.h (class Output_reloc): Update get_address declaration.
9824 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9825 for section addresses.
9826
55ba0940
ILT
98272008-05-09 Ian Lance Taylor <iant@google.com>
9828
9829 PR 6493
9830 * gold.cc (gold_nomem): Use return value of write.
9831
75517b77
ILT
98322008-05-08 Ian Lance Taylor <iant@google.com>
9833
9834 * symtab.c (Symbol::init_base_output_data): Add version
9835 parameter. Change all callers.
9836 (Symbol::init_base_output_segment): Likewise.
9837 (Symbol::init_base_constant): Likewise.
9838 (Symbol::init_base_undefined): Likewise.
9839 (Sized_symbol::init_output_data): Likewise.
9840 (Sized_symbol::init_output_segment): Likewise.
9841 (Sized_symbol::init_constant): Likewise.
9842 (Sized_symbol::init_undefined): Likewise.
9843 (Symbol_table::do_define_in_output_data): If the new symbol has a
9844 version, mark it as the default.
9845 (Symbol_table::do_define_in_output_segment): Likewise.
9846 (Symbol_table::do_define_as_constant): Likewise.
9847 * symtab.h (class Symbol): Update declarations.
9848 (class Sized_symbol): Likewise.
9849 * resolve.cc (Symbol::override_version): New function.
c42e122e 9850 (Symbol::override_base): Call override_version.
75517b77
ILT
9851 (Symbol::override_base_with_special): Likewise.
9852 * testsuite/ver_script_8.script: New file.
9853 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9854 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9855 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9856 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9857
f1f70eae
ILT
98582008-05-06 Ian Lance Taylor <iant@google.com>
9859
f3e9c5c5
ILT
9860 PR 6049
9861 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9862 functions.
9863 (class General_options): Remove existing --undefined, and add
9864 --no-undefined instead. Add new --undefined as synonym for -u.
9865 * archive.cc (Archive::add_symbols): Check whether symbol was
9866 named with -u.
9867 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9868 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9869 all uses. Add IS_UNDEFINED. Update declarations to split
9870 different versions of init_base. Declare init_base_undefined.
9871 (Symbol::is_defined): Handle IS_UNDEFINED.
9872 (Symbol::is_undefined): Likewise.
9873 (Symbol::is_weak_undefined): Call is_undefined.
9874 (Symbol::is_absolute): Handle IS_CONSTANT.
9875 (class Sized_symbol): Update declarations to split different
9876 versions of init. Declare init_undefined.
9877 (class Symbol_table): Declare new functions.
9878 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9879 Change all callers.
9880 (Symbol::init_base_output_data): Likewise.
9881 (Symbol::init_base_output_segment): Likewise.
9882 (Symbol::init_base_constant): Likewise.
9883 (Symbol::init_base_undefined): New function.
9884 (Sized_symbol::init_object): Rename from init. Change all
9885 callers.
9886 (Sized_symbol::init_output_data): Likewise.
9887 (Sized_symbol::init_output_segment): Likewise.
9888 (Sized_symbol::init_constant): Likewise.
9889 (Sized_symbol::init_undefined): New function.
9890 (Symbol_table::add_undefined_symbols_from_command_line): New
9891 function.
9892 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9893 function.
9894 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9895 (Symbol::output_section): Likewise.
9896 (Symbol::set_output_section): Likewise.
9897 (Symbol_table::sized_finalize_symbol): Likewise.
9898 (Symbol_table::sized_write_globals): Likewise.
9899 * resolve.cc (Symbol_table::should_override): Likewise.
9900 (Symbol::override_base_with_special): Likewise.
9901
8bdcdf2c
ILT
9902 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9903 symbol, change it to have default visibility.
9904 * testsuite/protected_1.cc: New file.
9905 * testsuite/protected_2.cc: New file.
9906 * testsuite/protected_3.cc: New file.
9907 * testsuite/protected_main_1.cc: New file.
9908 * testsuite/protected_main_2.cc: New file.
9909 * testsuite/protected_main_3.cc: New file.
9910 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9911 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9912 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9913 (protected_1.so): New target.
9914 (protected_1_pic.o, protected_2_pic.o): New targets.
9915 (protected_3_pic.o): New target.
9916 (check_PROGRAMS): Add protected_2.
9917 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9918 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9919 * testsuite/Makefile.in: Rebuild.
9920
2b706932
ILT
9921 * options.h (DEFINE_var): Add set_user_set_##varname__.
9922 (DEFINE_bool_alias): New macro.
9923 (class General_options): Define -Bstatic using DEFINE_bool_alias
9924 rather than DEFINE_special. Add --undefined as an alias for -z
9925 defs.
9926 * options.cc (General_options::parse_Bstatic): Remove.
9927
d82a5bcc
ILT
9928 * options.h (class General_options): Add --fatal-warnings.
9929 * main.cc (main): Implement --fatal-warnings.
9930 * errors.h (Errors::warning_count): New function.
9931
f1f70eae
ILT
9932 * options.h (class General_options): Add -Bsymbolic-functions.
9933 * symtab.h (Symbol::is_preemptible): Check for
9934 -Bsymbolic-functions.
9935
8825ac63
ILT
99362008-05-05 Ian Lance Taylor <iant@google.com>
9937
d98bc257
ILT
9938 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9939 as noVARNAME rather than no-VARNAME.
9940 (class General_options): Add option -z combreloc.
9941 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9942 get_address.
9943 (Output_reloc::sort_before) [SHT_REL]: New function.
9944 (Output_reloc::sort_before) [SHT_RELA]: New function.
9945 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9946 Sort_relocs_comparison.
9947 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9948 parameter. Change all callers.
9949 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9950 sort_relocs parameter. Change all callers.
9951 * output.cc (Output_reloc::get_address): New function, broken out
9952 of write_rel.
9953 (Output_reloc::write_rel): Call it.
9954 (Output_reloc::compare): New function.
9955 (Output_data_reloc_base::do_write): Optionally sort relocs.
9956
60b2b4e7
ILT
9957 * configure.ac: If targ_extra_obj is set, link it in.
9958 * configure.tgt: Initialize all variables.
9959 (x86_64*): Set targ_extra_obj and targ_extra_size.
9960 * configure: Rebuild.
9961
8825ac63
ILT
9962 * object.cc (Sized_relobj::include_section_group): Adjust section
9963 indexes read from group data. Build vector to pass to
9964 layout_group.
9965 * layout.cc (Layout::layout_group): Add flags and shndxes
9966 parameters. Remove contents parameter. Change caller. Update
9967 explicit instantiations.
9968 * layout.h (class Layout): Update layout_group declaration.
9969 * output.cc (Output_data_group::Output_data_group): Add flags and
9970 input_shndxes parameters. Remove contents parameter. Change
9971 caller.
9972 (Output_data_group::do_write): Change input_sections_ to
9973 input_shndxes_.
9974 * output.h (class Output_data_group): Update constructor
9975 declaration. Rename input_sections_ to input_shndxes_.
9976 * testsuite/many_sections_test.cc: Add template.
9977
e94cf127
CC
99782008-04-30 Cary Coutant <ccoutant@google.com>
9979
4418b2d5
CC
9980 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9981
e94cf127
CC
9982 * layout.cc (Layout::include_section): Refactored check for debug
9983 info section.
9984 (Layout::add_comdat): Add new parameters. Change type
9985 of signature parameter. Add object and shndx to signatures table.
9986 (Layout::find_kept_object): New function.
9987 * layout.h: Include <cstring>.
9988 (Layout::is_debug_info_section): New function.
9989 (Layout::add_comdat): Add new parameters.
9990 (Layout::find_kept_object): New function.
9991 (Layout::Kept_section): New struct.
9992 (Layout::Signatures): Change type of map range.
9993 * object.cc (Relobj::output_section_address): New function.
9994 (Sized_relobj::include_section_group): Add new parameters. Change
9995 calls to Layout::add_comdat. Change to build table of kept comdat
9996 groups and table mapping discarded sections to kept sections.
9997 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9998 (Sized_relobj::do_layout): Change calls to include_section_group and
9999 include_linkonce_section.
10000 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10001 value to zero when section is discarded.
10002 (Sized_relobj::map_to_kept_section): New function.
10003 * object.h (Relobj::output_section_address): New function.
10004 (Relobj::Comdat_group): New type.
10005 (Relobj::find_comdat_group): New function.
10006 (Relobj::Comdat_group_table): New type.
10007 (Relobj::Kept_comdat_section): New type.
10008 (Relobj::Kept_comdat_section_table): New type.
10009 (Relobj::add_comdat_group): New function.
10010 (Relobj::set_kept_comdat_section): New function.
10011 (Relobj::get_kept_comdat_section): New function.
10012 (Relobj::comdat_groups_): New field.
10013 (Relobj::kept_comdat_sections_): New field.
10014 (Symbol_value::input_value): Update comment.
10015 (Sized_relobj::map_to_kept_section) New function.
10016 (Sized_relobj::include_linkonce_section): Add new parameter.
10017 * target-reloc.h (Comdat_behavior): New type.
10018 (get_comdat_behavior): New function.
10019 (relocate_section): Add code to map a discarded section to the
10020 corresponding kept section when applying a relocation.
10021
e4e5049b
CS
100222008-04-30 Craig Silverstein <csilvers@google.com>
10023
10024 * dwarf_reader.cc (next_generation_count): New static var.
10025 (Addr2line_cache_entry): New struct.
10026 (addr2line_cache): New static var.
10027 (Dwarf_line_info::one_addr2line): Added caching.
10028 (Dwarf_line_info::clear_addr2line_cache): New function.
10029 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10030 cache-size parameter.
10031 (Dwarf_line_info::one_addr2line_cache): New function.
10032 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10033 new cache-size argument to one_addr2line(), and clear cache.
10034
d09e9154
CC
100352008-04-28 Cary Coutant <ccoutant@google.com>
10036
10037 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10038 R_386_PC8 relocations.
10039
7ef73768
ILT
100402008-04-23 Ian Lance Taylor <iant@google.com>
10041
55438702
ILT
10042 * object.cc (Sized_relobj::include_section_group): Check for
10043 invalid section group.
10044
c165fb93
ILT
10045 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10046 header size.
10047
7ef73768
ILT
10048 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10049 than read for file header.
10050 * archive.cc (Archive::include_member): Likewise.
10051
6194aaab
L
100522008-04-23 Paolo Bonzini <bonzini@gnu.org>
10053
10054 * aclocal.m4: Regenerate.
10055 * configure: Regenerate.
10056
d491d34e
ILT
100572008-04-19 Ian Lance Taylor <iant@google.com>
10058
5ea2bac6
ILT
10059 * version.cc (version_string): Bump to 1.6.
10060
7bc3e21a
ILT
10061 * testsuite/Makefile.am (many_sections_r_test): New target.
10062 (many_sections_r_test_SOURCES): Remove.
10063 (many_sections_r_test_DEPENDENCIES): Remove.
10064 (many_sections_r_test_LDFLAGS): Remove.
10065 (many_sections_r_test_LDADD): Remove.
10066
7fcd3aa9
ILT
10067 * object.cc (Sized_relobj::do_add_symbols): Always pass
10068 local_symbol_count_ to add_from_relobj.
10069
4c94d6ae
ILT
10070 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10071 every thousand variables.
10072 * testsuite/Makefile.in: Rebuild.
10073
d491d34e
ILT
10074 * object.cc (Xindex::initialize_symtab_xindex): New function.
10075 (Xindex::read_symtab_xindex): New function.
10076 (Xindex::sym_xindex_to_shndx): New function.
10077 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10078 available.
10079 (Sized_relobj::do_initialize_xindex): New function.
10080 (Sized_relobj::do_read_symbols): Adjust section links.
10081 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10082 parameter. Change all callers.
10083 (Sized_relobj::include_section_group): Adjust section links and
10084 symbol section indexes.
10085 (Sized_relobj::do_layout): Adjust section links.
10086 (Sized_relobj::do_count_local_symbols): Adjust section links and
10087 symbol section indexes.
10088 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10089 ordinary and special symbols.
10090 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10091 dynsym_xindex parameters. Change all callers. Adjust section
10092 links. Use SHN_XINDEX when needed.
10093 (Sized_relobj::get_symbol_location_info): Adjust section links.
10094 Don't get fooled by special symbols.
10095 * object.h (class Xindex): Define.
10096 (class Object): Add xindex_ parameter. Declare virtual functoin
10097 do_initialize_xindex.
10098 (Object::adjust_sym_shndx): New function.
10099 (Object::set_xindex): New protected function.
10100 (class Symbol_value): Add is_ordinary_shndx_ field.
10101 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10102 (Symbol_value::value): Assert ordinary section.
10103 (Symbol_value::initialize_input_to_output_map): Likewise.
10104 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10105 Change all callers.
10106 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10107 all callers.
10108 (class Sized_relobj): Update declarations.
10109 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10110 parameter. Change all callers.
10111 (Sized_relobj::adjust_shndx): New function.
10112 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10113 field.
10114 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10115 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10116 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10117 (Sized_dynobj::read_dynsym_section): Adjust section links.
10118 (Sized_dynobj::read_dynamic): Likewise.
10119 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10120 section links.
10121 (Sized_dynobj::do_initialize_xindex): New function.
10122 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10123 do_initialize_xindex.
10124 (Sized_dynobj::adjust_shndx): New function.
10125 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10126 dynsym_xindex_ fields.
10127 (Layout::finalize): Add a call to set_section_indexes before
10128 creating the symtab sections.
10129 (Layout::set_section_indexes): Don't do anything if the section
10130 already has a section index.
10131 (Layout::create_symtab_sections): Add shnum parameter. Change
10132 caller. Create .symtab_shndx section if needed.
10133 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10134 caller.
10135 (Layout::allocated_output_section_count): New function.
10136 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10137 needed.
10138 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10139 fields. Update declarations.
10140 (Layout::symtab_xindex): New function.
10141 (Layout::dynsym_xindex): New function.
10142 (class Write_symbols_task): Add layout_ field.
10143 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10144 Change caller.
10145 * output.cc (Output_section_headers::Output_section_headers): Add
10146 shstrtab_section parameter. Change all callers.
10147 (Output_section_headers::do_sized_write): Store overflow values
10148 for section count and section string table section index in
10149 section header zero.
10150 (Output_file_header::do_sized_write): Check for overflow of
10151 section count and section string table section index.
10152 (Output_symtab_xindex::do_write): New function.
10153 (Output_symtab_xindex::endian_do_write): New function.
10154 * output.h (class Output_section_headers): Add shstrtab_section_.
10155 Update declarations.
10156 (class Output_symtab_xindex): Define.
10157 (Output_section::has_out_shndx): New function.
10158 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10159 field.
10160 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10161 Change all callers.
10162 (Sized_symbol::init): Likewise.
10163 (Symbol::output_section): Check for ordinary symbol.
10164 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10165 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10166 callers.
10167 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10168 Change all callers. Simplify handling of symbols from sections
10169 not included in the link.
10170 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10171 distinction.
10172 (Weak_alias_sorter::operator()): Assert that symbols are
10173 ordinary.
10174 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10175 distinction.
10176 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10177 parameters. Change all callers.
10178 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10179 symbol distinction. Use SHN_XINDEX when needed.
10180 (Symbol_table::write_section_symbol): Add symtab_xindex
10181 parameter. Change all callers.
10182 (Symbol_table::sized_write_section_symbol): Likewise. Use
10183 SHN_XINDEX when needed.
10184 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10185 declarations.
10186 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10187 (Symbol::is_defined): Check is_ordinary.
10188 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10189 (Symbol::is_absolute, Symbol::is_common): Likewise.
10190 (class Sized_symbol): Update declarations.
10191 (class Symbol_table): Update declarations.
10192 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10193 parameters. Change all callers.
10194 (Sized_symbol::override): Likewise.
10195 (Symbol_table::override): Likewise.
10196 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10197 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10198 is_ordinary, and orig_st_shndx parameters. Change all callers.
10199 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10200 to be in an ordinary section.
10201 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10202 object and is_ordinary parameters. Change all callers.
10203 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10204 Change all callers. Don't add undefined or non-ordinary symbols
10205 to reloc_map_.
10206 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10207 Change all callers.
10208 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10209 declarations.
10210 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10211 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10212 (Sized_relobj::relocate_sections): Likewise.
10213 * target-reloc.h (scan_relocs): Adjust section symbol index.
10214 (scan_relocatable_relocs): Likewise.
10215 * i386.cc (Scan::local): Check for ordinary symbols.
10216 * sparc.cc (Scan::local): Likewise.
10217 * x86_64.cc (Scan::local): Likewise.
10218 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10219 to symbol_section_and_value.
10220 * testsuite/many_sections_test.cc: New file.
10221 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10222 (check_PROGRAMS): Add many_sections_test.
10223 (many_sections_test_SOURCES): Define.
10224 (many_sections_test_DEPENDENCIES): Define.
10225 (many_sections_test_LDFLAGS): Define.
10226 (BUILT_SOURCES): Add many_sections_define.h.
10227 (many_sections_define.h): New target.
10228 (BUILT_SOURCES): Add many_sections_check.h.
10229 (many_sections_check.h): New target.
10230 (check_PROGRAMS): Add many_sections_r_test.
10231 (many_sections_r_test_SOURCES): Define.
10232 (many_sections_r_test_DEPENDENCIES): Define.
10233 (many_sections_r_test_LDFLAGS): Define.
10234 (many_sections_r_test_LDADD): Define.
10235 (many_sections_r_test.o): New target.
10236 * testsuite/Makefile.in: Rebuild.
10237
c5818ff1
CC
102382008-04-17 Cary Coutant <ccoutant@google.com>
10239
10240 * errors.cc (Errors::info): New function.
10241 (gold_info): New function.
10242 * errors.h (Errors::info): New function.
10243 * gold.h (gold_info): New function.
10244 * object.cc (Input_objects::add_object): Print trace output.
10245 * options.cc (options::parse_set): New function.
10246 (General_options::parse_wrap): Deleted.
10247 (General_options::General_options): Deleted initializer.
10248 * options.h (options::String_set): New typedef.
10249 (options::parse_set): New function.
10250 (DEFINE_set): New macro.
10251 (General_options::wrap): Changed to use DEFINE_set. Changed
10252 callers of any_wrap_symbols and is_wrap_symbol.
10253 (General_options::trace, General_options::trace_symbol):
10254 New options.
10255 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10256 (General_options::wrap_symbols_): Deleted.
10257 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10258
b5be4a7c
DM
102592008-04-17 David S. Miller <davem@davemloft.net>
10260
10261 * options.cc (General_options::parse_V): New function.
10262 * options.h: Add entries for -V and -Qy.
10263
155a0dd7
ILT
102642008-04-17 Ian Lance Taylor <iant@google.com>
10265
10266 * common.cc (Symbol_table::allocate_commons): Remove options
10267 parameter. Change caller.
10268 (Symbol_table::do_allocate_commons): Remove options parameter.
10269 Change caller. Just call do_allocate_commons_list twice.
10270 (Symbol_table::do_allocate_commons_list): New function, broken out
10271 of do_allocate_commons.
10272 * common.h (class Allocate_commons_task): Remove options_ field.
10273 Update constructor.
10274 * symtab.cc (Symbol_table::Symbol_table): Initialize
10275 tls_commons_.
10276 (Symbol_table::add_from_object): Put TLS common symbols on
10277 tls_commons_ list.
10278 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10279 which are IN_OUTPUT_DATA.
10280 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10281 allocate_commons and do_allocate_commons declarations. Declare
10282 do_allocate_commons_list.
10283 * gold.cc (queue_middle_tasks): Update creation of
10284 Allocate_commons_task to not pass options.
10285 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10286 (TLS_TEST_C_FLAGS): New variable.
10287 (tls_test_c_pic.o): New target.
10288 (tls_test_shared.so): Link in tls_test_c_pic.o.
10289 (tls_test_c_pic_ie.o): New target.
10290 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10291 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10292 (tls_test_c.o): New target.
10293 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10294 (tls_pic_test_LDADD): Likewise.
10295 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10296 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10297 (tls_test_c_gnu2.o): New target.
10298 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10299 tls_test_c_gnu2.o.
10300 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10301 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10302 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10303 * testsuite/tls_test.cc: Include "config.h".
10304 (t_last): Call t11_last.
10305 * testsuite/tls_test.h (t11, t11_last): Declare.
10306 * testsuite/tls_test_c.c: New file.
10307 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10308 * configure.ac: Check for OpenMP support.
10309 * configure, config.in, Makefile.in: Rebuild.
10310 * testsuite/Makefile.in: Rebuild.
10311
edfbb029
CC
103122008-04-16 Cary Coutant <ccoutant@google.com>
10313
10314 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10315 (Target_i386::tls_base_symbol_defined_): New field.
10316 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10317 (Target_i386::Scan::global): Likewise.
10318 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10319 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10320 (Target_x86_64::tls_base_symbol_defined_): New field.
10321 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10322 (Target_x86_64::Scan::global): Likewise.
10323
f3c69fca
CC
103242008-04-16 Cary Coutant <ccoutant@google.com>
10325
10326 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10327 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10328 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10329 building shared libraries.
10330 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10331 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10332 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10333 * testsuite/Makefile.in: Rebuild.
10334 * testsuite/weak_undef.h: New file.
10335 * testsuite/weak_undef_file1.cc: Add extra test cases.
10336 * testsuite/weak_undef_file2.cc: Likewise.
10337 * testsuite/weak_undef_test.cc: Likewise.
10338
7c414435
DM
103392008-04-16 David S. Miller <davem@davemloft.net>
10340
32b769e1
DM
10341 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10342 Add issued_non_pic_error_ field. Declare check_non_pic.
10343 (Target_sparc::Scan::check_non_pic): New function.
10344 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10345 (Target_sparc::Scan::global): Likewise.
10346
11936fb1
DM
10347 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10348 * configure: Rebuild.
10349
7c414435
DM
10350 * options.h (DEFINE_enable): New macro.
10351 (new_dtags): New enable option.
10352 (initfirst, interpose, loadfltr, nodefaultlib,
10353 nodelete, nodlopen, nodump): New -z options.
10354 * layout.cc (Layout:finish_dynamic_section): If new
10355 dtags enabled, emit DT_RUNPATH. Also, emit a
10356 DT_FLAGS_1 containing any specified -z flags.
10357
85c7bf8b
ILT
103582008-04-16 Ian Lance Taylor <iant@google.com>
10359
12c0daef
ILT
10360 * copy-relocs.cc: New file.
10361 * copy-relocs.h: New file.
10362 * reloc.cc: Remove Copy_relocs code.
10363 * reloc.h: Likewise.
10364 * reloc-types.h (struct Reloc_types) [both versions]: Add
10365 get_reloc_addend_noerror.
10366 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10367 variants of add_global which take an addend which must be zero.
10368 * i386.cc: Include "copy-relocs.h".
10369 (class Target_i386): Change type of copy_relocs_ to variable,
10370 update initializer.
10371 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10372 Change all callers.
10373 (Target_i386::do_finalize_sections): Change handling of
10374 copy_relocs_.
10375 * sparc.cc: Include "copy-relocs.h".
10376 (class Target_sparc): Change type of copy_relocs_ to variable,
10377 update initializer.
10378 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10379 Change all callers.
10380 (Target_sparc::do_finalize_sections): Change handling of
10381 copy_relocs_.
10382 * x86_64.cc: Include "copy-relocs.h".
10383 (class Target_x86_64): Change type of copy_relocs_ to variable,
10384 update initializer.
10385 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10386 class. Change all callers.
10387 (Target_x86_64::do_finalize_sections): Change handling of
10388 copy_relocs_.
10389 * Makefile.am (CCFILES): Add copy-relocs.cc.
10390 (HFILES): Add copy-relocs.h.
10391
4f4995b6
ILT
10392 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10393
85c7bf8b
ILT
10394 * testsuite/script_test_4.sh: Permit leading zeroes.
10395
4f2a9edd
ILT
103962008-04-15 Ian Lance Taylor <iant@google.com>
10397
e6188289
ILT
10398 * script-sections.cc (Script_sections::create_segments): Use
10399 header_size_adjustment even when there is enough room for the
10400 headers.
10401 * testsuite/script_test_4.sh: New file.
10402 * testsuite/script_test_4.t: New file.
10403 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10404 (check_DATA): Add script_test_4.stdout.
10405 (MOSTLYCLEANFILES): Likewise.
10406 (script_test_4): New target.
10407 (script_test_4.stdout): New target.
10408 * testsuite/Makefile.in: Rebuild.
10409
4f2a9edd
ILT
10410 * sparc.cc: Add definitions for Output_data_plt_sparc class
10411 constants.
10412
f5314dd5
DM
104132008-04-14 David S. Miller <davem@davemloft.net>
10414
10415 * sparc.cc: New file.
10416 * Makefile.am (TARGETSOURCES): Add sparc.cc
10417 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10418 * configure.tgt: Document targ_extra_size and
10419 targ_extra_big_endian. Add entries for sparc-* and
10420 sparc64-*.
10421 * configure.ac: Handle targ_extra_size and
10422 targ_extra_big_endian.
10423 * Makefile.in: Rebuild.
10424 * configure: Likewise.
10425 * po/POTFILES.in: Likewise.
10426 * po/gold.pot: Likewise.
10427
154e0e9a
ILT
104282008-04-14 Ian Lance Taylor <iant@google.com>
10429
10430 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10431 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10432 in the name/type/flags to section mapping. Don't call
10433 allocate_output_section.
10434 (Layout::choose_output_section): Change parameter from adjust_name
10435 to is_input_section. Don't permit input sections after sections
10436 are attached to segments. Don't call allocate_output_section.
10437 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10438 not write_enable_output_section.
10439 (Layout::make_output_section): Don't push to
10440 unattached_section_list_ nor call attach_to_segment. Call
10441 attach_section_to_segment if sections are attached.
10442 (Layout::attach_sections_to_segments): New function.
10443 (Layout::attach_section_to_segment): New function.
10444 (Layout::attach_allocated_section_to_segment): Rename from
10445 attach_to_segment. Remove flags parameter.
10446 (Layout::allocate_output_section): Remove function.
10447 (Layout::write_enable_output_section): Remove function.
10448 * layout.h (class Layout): Update for above changes. Add new
10449 field sections_are_attached_.
10450 * output.h (Output_section::update_flags_for_input_section): New
10451 function.
10452 * output.cc (Output_section::add_input_section): Call
10453 update_flags_for_input_section.
10454 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10455
009a67a2
CC
104562008-04-11 Cary Coutant <ccoutant@google.com>
10457
10458 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10459 thought unnecessary.
10460 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10461
759b1a24
ILT
104622008-04-11 Ian Lance Taylor <iant@google.com>
10463
10464 * output.h (class Output_section_data): Remove inline definition
10465 of set_addralign.
10466 * output.cc (Output_section_data::set_addralign): New function.
10467
c2b45e22
CC
104682008-04-11 Cary Coutant <ccoutant@google.com>
10469
10470 Add support for TLS descriptors for i386 and x86_64.
10471 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10472 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10473 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10474 GOT_TYPE_TLS_DESC.
10475 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10476 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10477 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10478 relocations.
10479 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10480 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10481 Fix problem with initial-exec relocations.
10482 (Target_i386::Relocate::relocate_tls): Likewise.
10483 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10484 relaxation.
10485 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10486 support for section-plus-offset dynamic table entries.
10487 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10488 (Output_data_dynamic::Dynamic_entry): Add support for
10489 section-plus-offset dynamic table entries.
10490 (Output_data_dynamic::Classification): Likewise.
10491 (Output_data_dynamic::classification_): Renamed offset_.
10492 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10493 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10494 (Target_x86_64::make_plt_section): New function.
10495 (Target_x86_64::reserve_tlsdesc_entries): New function.
10496 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10497 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10498 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10499 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10500 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10501 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10502 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10503 add extra PLT entry for TLS descriptors.
10504 (Output_data_plt_x86_64::got_): New field.
10505 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10506 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10507 fields.
10508 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10509 descriptors.
10510 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10511 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10512 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10513 R_386_TLS_DESC_CALL relocations.
10514 (Target_x86_64::Scan::global): Likewise.
10515 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10516 for TLS descriptors.
10517 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10518 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10519 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10520 GD-to-IE relaxation.
10521 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10522 and TLS_DESCRIPTORS.
10523 * Makefile.in: Rebuild.
10524 * configure: Rebuild.
10525 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10526 (tls_test_shared2.so): New target.
10527 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10528 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10529 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10530 (tls_shared_gd_to_ie_test_LDADD): New variable.
10531 (tls_shared_gnu2_gd_to_ie_test): New target.
10532 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10533 New targets.
10534 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10535 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10536 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10537 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10538 (tls_shared_gnu2_test): New target.
10539 (tls_test_gnu2_shared.so): New target.
10540 (tls_shared_gnu2_test_SOURCES): New variable.
10541 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10542 (tls_shared_gnu2_test_LDFLAGS): New variable.
10543 (tls_shared_gnu2_test_LDADD): New variable.
10544 * testsuite/Makefile.in: Rebuild.
10545 * testsuite/Makefile.
10546
83bfb6b7
ILT
105472008-04-11 Ian Lance Taylor <iant@google.com>
10548
10549 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10550 justsyms.t.
10551 * testsuite/Makefile.in: Rebuild.
10552
10553 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10554 long.
10555 * testsuite/script_test_2.cc (main): Adjust test.
10556
706e1f5e
ILT
105572008-04-11 David S. Miller <davem@davemloft.net>
10558 Ian Lance Taylor <iant@google.com>
10559
10560 * options.h (General_options): Add entries for '-Y' and
10561 '-relax'.
10562 * options.cc (General_options:finalize): If -Y was used, add those
10563 entries to the library path instead of the default "/lib" and
10564 "/usr/lib".
10565
7c98e6bb
DM
105662008-04-11 David S. Miller <davem@davemloft.net>
10567
10568 * testsuite/justsyms.t: Start at 0x100.
10569 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
10570 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10571 long.
10572 * testsuite/script_test_2.cc: Adjust string and section length
10573 checks.
7c98e6bb 10574
99a37bfd
ILT
105752008-04-09 Ian Lance Taylor <iant@google.com>
10576
2cefc357
ILT
10577 PR gold/5996
10578 * script-sections.cc (Sections_element::allocate_to_segment): Add
10579 orphan parameter.
10580 (Output_section_definition::allocate_to_segment): Likewise.
10581 (Orphan_output_section::allocate_to_segment): Likewise.
10582 (Script_sections::attach_sections_using_phdrs_clause): Don't
10583 propagate non-PT_LOAD segments to orphan sections.
10584 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10585 readelf rather than objdump.
10586 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10587 .interp section and PT_INTERP segment are the same size.
10588 * testsuite/Makefile.in: Rebuild.
10589
99a37bfd
ILT
10590 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10591 aliases for symbols defined in the same object.
10592 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10593 (weak_alias_test_SOURCES): New variable.
10594 (weak_alias_test_DEPENDENCIES): New variable.
10595 (weak_alias_test_LDFLAGS): New variable.
10596 (weak_alias_test_LDADD): New variable.
10597 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10598 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10599 (weak_alias_test_3.o): New target.
10600 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10601 * testsuite/weak_alias_test_main.cc: New file.
10602 * testsuite/weak_alias_test_1.cc: New file.
10603 * testsuite/weak_alias_test_2.cc: New file.
10604 * testsuite/weak_alias_test_3.cc: New file.
10605
780e49c5
ILT
106062008-04-08 Ian Lance Taylor <iant@google.com>
10607
cdb0b8f5
ILT
10608 * options.h (class General_options): Add --noinhibit-exec option.
10609 * main.cc (main): Check --noinhibit-exec.
10610
0864d551
ILT
10611 * options.h (class General_options): Define --wrap as a special
10612 option. Add wrap_symbols_ field.
10613 (General_options::any_wrap_symbols): New function.
10614 (General_options::is_wrap_symbol): New function.
10615 * options.cc (General_options::parse_wrap): New function.
10616 (General_options::General_options): Initialize wrap_symbols_.
10617 * symtab.cc (Symbol_table::wrap_symbol): New function.
10618 (Symbol_table::add_from_object): Handle --wrap.
10619 * symtab.h (class Symbol_table): Declare wrap_symbol.
10620 * target.h (Target::wrap_char): New function.
10621 (Target::Target_info): Add wrap_char field.
10622 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10623 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10624 * testsuite/testfile.cc (Target_test::test_target_info):
10625 Likewise.
10626
789aa6de
ILT
10627 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10628 there is one.
10629
2c38906f
ILT
10630 * layout.h (class Layout): Add added_eh_frame_data_ field.
10631 * layout.cc (Layout::Layout): Initialize new field.
10632 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10633 output section until we find a section we merged successfully.
10634 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10635 that the size be non-zero.
10636
780e49c5
ILT
10637 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10638 qualifier.
10639
7fcd0256
ILT
106402008-04-08 Craig Silverstein <csilvers@google.com>
10641
10642 * configure.ac: Export new conditional variable HAVE_ZLIB.
10643 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10644 on HAVE_ZLIB.
10645 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10646 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10647
6835af53
ILT
106482008-04-07 Ian Lance Taylor <iant@google.com>
10649
e24f324c
ILT
10650 * version.cc (version_string): Set to "1.5".
10651
a036edd8
ILT
10652 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10653 Add issued_non_pic_error_ field. Declare check_non_pic.
10654 (Target_x86_64::Scan::check_non_pic): New function.
10655 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10656 (Target_x86_64::Scan::global): Likewise.
10657
624f8810
ILT
10658 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10659 addend parameter. Change caller. Handle merge sections.
10660 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10661 Address to Addend. Don't add in the result of
10662 local_section_offset, pass down the addend and use the returned
10663 value.
10664 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10665 Update declarations of local_section_offset and symbol_value.
10666 * testsuite/two_file_test_1.cc (t18): New function.
10667 * testsuite/two_file_test_2.cc (f18): New function.
10668 * testsuite/two_file_test_main.cc (main): Call t18.
10669 * testsuite/two_file_test.h (t18, f18): Declare.
10670
6835af53
ILT
10671 * configure.ac: Don't test for objdump, c++filt, or readelf.
10672 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10673 conditionals.
10674 (TEST_READELF): New variable.
10675 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10676 (check_PROGRAMS): Add two_file_strip_test.
10677 (two_file_strip_test): New target.
10678 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10679 (two_file_same_shared_strip_test_SOURCES): New variable.
10680 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10681 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10682 (two_file_same_shared_strip_test_LDADD): New variable.
10683 (two_file_shared_strip.so): New target.
10684 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10685 (ver_test_5.syms, ver_test_7.syms): Likewise.
10686 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10687 (strip_test_3.stdout): Use TEST_OBJDUMP.
10688 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10689
86925eef
CC
106902008-04-04 Cary Coutant <ccoutant@google.com>
10691
10692 * symtab.h (Symbol::is_weak_undefined): New function.
10693 (Symbol::is_strong_undefined): New function.
10694 (Symbol::is_absolute): New function.
10695 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10696 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10697 absolute symbols.
10698 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10699 (weak_undef_test): New target.
10700 * testsuite/Makefile.in: Rebuild.
10701 * testsuite/weak_undef_file1.cc: New file.
10702 * testsuite/weak_undef_file2.cc: New file.
10703 * testsuite/weak_undef_test.cc: New file.
10704
126f3ece
ILT
107052008-04-03 Craig Silverstein <csilvers@google.com>
10706
10707 * compressed_output.h (class Output_compressed_section): Use
10708 unsigned buffer.
10709 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10710 add zlib header.
10711 (zlib_compressed_suffix): Removed.
10712 (Output_compressed_section::set_final_data_size): Use unsigned
10713 buffers.
10714 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10715 Fix linker invocation.
10716 (flagstest_o_specialfile_and_compress_debug_sections):
10717 Likewise.
10718 * testsuite/Makefile.in: Regenerated.
10719
deae2a14
DM
107202008-04-02 David S. Miller <davem@davemloft.net>
10721
10722 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10723 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10724
70752818
ILT
107252008-04-02 Craig Silverstein <csilvers@google.com>
10726
10727 * TODO: New file.
10728
39d0cb0e
ILT
107292008-04-02 Ian Lance Taylor <iant@google.com>
10730
10731 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10732 parameters. Update for new key type to views_. Change all
10733 callers.
10734 (File_read::read): Adjust for byteshift in returned view.
10735 (File_read::add_view): New function, broken out of
10736 find_and_make_view.
10737 (File_read::make_view): New function, broken out of
10738 find_and_make_view.
10739 (File_read::find_or_make_view): Add offset and aligned
10740 parameters. Rewrite accordingly. Change all callers.
10741 (File_read::get_view): Add offset and aligned parameters. Adjust
10742 for byteshift in return value.
10743 (File_read::get_lasting_view): Likewise.
10744 * fileread.h (class File_read): Update declarations.
10745 (class File_read::View): Add byteshift_ field. Add byteshift to
10746 constructor. Add byteshift method.
10747 * archive.h (Archive::clear_uncached_views): New function.
10748 (Archive::get_view): Add aligned parameter. Change all callers.
10749 * object.h (Object::get_view): Add aligned parameter. Change all
10750 callers.
10751 (Object::get_lasting_view): Likewise.
10752
10753 * fileread.cc (File_read::release): Don't call clear_views if
10754 there are multiple objects.
10755 * fileread.h (File_read::clear_uncached_views): New function.
10756 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10757 on the archive.
10758
a1207466
CC
107592008-03-31 Cary Coutant <ccoutant@google.com>
10760
10761 Add thin archive support.
10762 * archive.cc (Archive::armagt): New const.
10763 (Archive::setup): Remove task parameter and calls to unlock.
10764 (Archive::unlock_nested_archives): New function.
10765 (Archive::read_header): Add nested_off parameter. Change
10766 all callers.
10767 (Archive::interpret_header): Likewise.
10768 (Archive::include_all_members): Change to handle thin
10769 archives.
10770 (Archive::include_member): Likewise.
10771 * archive.h (Archive::Archive): Add new parameters and
10772 initializers.
10773 (Archive::armagt): New const.
10774 (Archive::setup): Remove task parameter.
10775 (Archive::unlock_nested_archives): New function.
10776 (Archive::read_header): Add nested_off parameter.
10777 (Archive::interpret_header): Likewise.
10778 (Archive::Nested_archive_table): New typedef.
10779 (Archive::is_thin_archive_): New field.
10780 (Archive::nested_archives_): New field.
10781 (Archive::options_): New field.
10782 (Archive::dirpath_): New field.
10783 (Archive::task_): New field.
10784 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10785 for thin archives. Pass additional parameters to
10786 Archive::Archive. Unlock the archive file after calling
10787 Archive::setup.
cd536b21 10788
479f6503
ILT
107892008-03-29 Ian Lance Taylor <iant@google.com>
10790
686c8caf
ILT
10791 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10792 version symbol to be local.
10793 * testsuite/ver_test_4.sh: New file.
10794 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10795 (check_DATA): Add ver_test_4.syms.
10796 (ver_test_4.syms): New target.
10797 * testsuite/Makefile.in: Rebuild.
10798
ab794b6b
ILT
10799 * output.cc
10800 (Output_section::Input_section_sort_entry::has_priority): New
10801 function.
10802 (Output_section::Input_section_sort_entry::match_file_name): New
10803 function.
10804 (Output_section::Input_section_sort_entry::match_section_name):
10805 Remove.
10806 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10807 Remove.
10808 (Output_section::Input_section_sort_entry::match_section_file):
10809 Remove.
10810 (Output_section::Input_section_sort_compare::operator()): Rewrite
10811 using new Input_section_sort_entry functions. Sort crtbegin and
10812 crtend first. Sort sections with no priority before sections with
10813 a priority.
10814 * testsuite/initpri1.c (d3): Check j != 4.
10815 (cd5): New constructor/destructor function.
10816 (main): Check j != 2.
10817
479f6503
ILT
10818 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10819 new symbol when resolving, don't call set_is_default.
10820 * testsuite/ver_test_7.cc: New file.
10821 * testsuite/ver_test_7.sh: New file.
10822 * testsuite/Makefile.am (ver_test_7.so): New target.
10823 (ver_test_7.o): New target.
10824 (check_SCRIPTS): Add ver_test_7.sh.
10825 (check_DATA): Add ver_test_7.syms.
10826 (ver_test_7.syms): New target.
10827
2fd32231
ILT
108282008-03-28 Ian Lance Taylor <iant@google.com>
10829
10830 * layout.cc (Layout::layout): If we see an input section with a
10831 name that needs sorting, set the must_sort flag for the output
10832 section.
10833 (Layout::make_output_section): If the name of the output section
10834 indicates that it might require sorting, set the may_sort flag.
10835 * output.h (Output_section::may_sort_attached_input_sections): New
10836 function.
10837 (Output_section::set_may_sort_attached_input_sections): New
10838 function.
10839 (Output_section::must_sort_attached_input_sections): New
10840 function.
10841 (Output_section::set_must_sort_attached_input_sections): New
10842 function.
10843 (class Output_section): Declare Input_section_sort_entry. Define
10844 Input_section_sort_compare. Declare
10845 sort_attached_input_sections. Add new fields:
10846 may_sort_attached_input_sections_,
10847 must_sort_attached_input_sections_,
10848 attached_input_sections_are_sorted_.
10849 * output.cc (Output_section::Output_section): Initialize new
10850 fields.
10851 (Output_section::add_input_section): Add an entry to
10852 input_sections_ if may_sort or must_sort are true.
10853 (Output_section::set_final_data_size): Call
10854 sort_attached_input_sections if necessary.
10855 (Output_section::Input_section_sort_entry): Define new class.
10856 (Output_section::Input_section_sort_compare::operator()): New
10857 function.
10858 (Output_section::sort_attached_input_sections): New function.
10859 * configure.ac: Check whether the compiler supports constructor
10860 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10861 * testsuite/initpri1.c: New file.
10862 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10863 CONSTRUCTOR_PRIORITY.
10864 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10865 (initpri1_LDFLAGS): New variable.
10866 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10867
18e6b24e
ILT
108682008-03-27 Ian Lance Taylor <iant@google.com>
10869
49bdd526
ILT
10870 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10871 * testsuite/common_test_1.c: New file.
10872 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10873 (common_test_1_SOURCES): New variable.
10874 (common_test_1_DEPENDENCIES): New variable.
10875 (common_test_1_LDFLAGS): New variable.
10876
18e6b24e
ILT
10877 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10878 and commons_ correctly when NAME/VERSION does not override
10879 NAME/NULL.
10880 * testsuite/ver_test_6.c: New file.
10881 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10882 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10883 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10884
04bf7072
ILT
108852008-03-26 Ian Lance Taylor <iant@google.com>
10886
5871526f
ILT
10887 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10888 of an undefined symbol from a version script.
10889 * testsuite/Makefile.am (ver_test_5.so): New target.
10890 (ver_test_5.o): New target.
10891 (check_SCRIPTS): Add ver_test_5.sh.
10892 (check_DATA): Add ver_test_5.syms.
10893 (ver_test_5.syms): New target.
10894 * testsuite/ver_test_5.cc: New file.
10895 * testsuite/ver_test_5.script: New file.
10896 * testsuite/ver_test_5.sh: New file.
10897 * Makefile.in, testsuite/Makefile.in: Rebuild.
10898
04bf7072
ILT
10899 PR gold/5986
10900 Fix problems building gold with gcc 4.3.0.
10901 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10902 (gold_error_at_location, gold_warning_at_location): Use it.
10903 * configure.ac: Check whether we can compile and use a template
10904 function with a printf attribute.
10905 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10906 when jumping over bytes.
10907 * object.cc: Instantiate Object::read_section_data.
10908 * debug.h: Include <cstring>
10909 * dwarf_reader.cc: Include <algorithm>
10910 * main.cc: Include <cstring>.
10911 * options.cc: Include <cstring>.
10912 * output.cc: Include <cstring>.
10913 * script.cc: Include <cstring>.
10914 * script.h: Include <string>.
10915 * symtab.cc: Include <cstring> and <algorithm>.
10916 * target-select.cc: Include <cstring>.
10917 * version.cc: Include <string>.
10918 * testsuite/testmain.cc: Include <cstdlib>.
10919 * configure, config.in: Rebuild.
10920
874c5b28
ILT
109212008-03-25 Ian Lance Taylor <iant@google.com>
10922
819d6c3a
ILT
10923 * options.cc: Include "../bfd/bfdver.h".
10924 (options::help): Print bug reporting address.
10925
f4b2c6f5
ILT
10926 * version.cc (print_version): Adjust output for current value of
10927 BFD_VERSION_STRING.
10928
10929 * NEWS: New file.
10930
e96caa79
ILT
10931 * options.cc (options::help): Print list of supported targets.
10932 * target-select.h: Include <vector>.
10933 (class Target_selector): Make machine_, size_, and is_big_endian_
10934 fields const. Add bfd_name_ and instantiated_target_ fields.
10935 (Target_selector::Target_selector): Add bfd_name parameter.
10936 (Target_selector::recognize): Make non-virtual, call
10937 do_recognize.
10938 (Target_selector::recognize_by_name): Make non-virtual, call
10939 do_recognize_by_name.
10940 (Target_selector::supported_names): New function.
10941 (Target_selector::bfd_name): New function.
10942 (Target_selector::do_instantiate_target): New pure virtual
10943 function.
10944 (Target_selector::do_recognize): New virtual function.
10945 (Target_selector::do_recognize_by_name): New virtual function.
10946 (Target_selector::instantiate_target): New private function.
10947 (supported_target_names): Declare.
10948 * target-select.cc (Target_selector::Target_selector): Update for
10949 new parameter and fields.
10950 (select_target_by_name): Check that the name matches before
10951 calling recognize_by_name.
10952 (supported_target_names): New function.
10953 * i386.cc (class Target_selector_i386): Update Target_selector
10954 constructor call. Remove recognize and recognize_by_name. Add
10955 do_instantiate_target.
10956 * x86_64.cc (class Target_selector_x86_64): Likewise.
10957 * testsuite/testfile.cc (class Target_selector_test): Update for
10958 changes to Target_selector.
10959
874c5b28
ILT
10960 * README: Rewrite, with some notes on unsupported features.
10961
0a65a3a7
CC
109622008-03-24 Cary Coutant <ccoutant@google.com>
10963
10964 * i386.cc (Target_i386::Got_type): New enum declaration.
10965 (Target_i386::Scan::local): Updated callers of Output_data_got
10966 member functions.
10967 (Target_i386::Scan::global): Likewise.
10968 (Target_i386::Relocate::relocate): Likewise.
10969 (Target_i386::Relocate::relocate_tls): Likewise.
10970 * object.h (Got_offset_list): New class.
10971 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10972 (Sized_relobj::local_got_offset): Likewise.
10973 (Sized_relobj::set_local_got_offset): Likewise.
10974 (Sized_relobj::local_has_tls_got_offset): Removed.
10975 (Sized_relobj::local_tls_got_offset): Removed.
10976 (Sized_relobj::set_local_tls_got_offset): Removed.
10977 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10978 * output.cc (Output_data_got::add_global): Added got_type parameter.
10979 (Output_data_got::add_global_with_rel): Likewise.
10980 (Output_data_got::add_global_with_rela): Likewise.
10981 (Output_data_got::add_global_pair_with_rel): New function.
10982 (Output_data_got::add_global_pair_with_rela): New function.
10983 (Output_data_got::add_local): Added got_type parameter.
10984 (Output_data_got::add_local_with_rel): Likewise.
10985 (Output_data_got::add_local_with_rela): Likewise.
10986 (Output_data_got::add_local_pair_with_rel): New function.
10987 (Output_data_got::add_local_pair_with_rela): New function.
10988 (Output_data_got::add_global_tls): Removed.
10989 (Output_data_got::add_global_tls_with_rel): Removed.
10990 (Output_data_got::add_global_tls_with_rela): Removed.
10991 (Output_data_got::add_local_tls): Removed.
10992 (Output_data_got::add_local_tls_with_rel): Removed.
10993 (Output_data_got::add_local_tls_with_rela): Removed.
10994 * output.h (Output_data_got::add_global): Added got_type parameter.
10995 (Output_data_got::add_global_with_rel): Likewise.
10996 (Output_data_got::add_global_with_rela): Likewise.
10997 (Output_data_got::add_global_pair_with_rel): New function.
10998 (Output_data_got::add_global_pair_with_rela): New function.
10999 (Output_data_got::add_local): Added got_type parameter.
11000 (Output_data_got::add_local_with_rel): Likewise.
11001 (Output_data_got::add_local_with_rela): Likewise.
11002 (Output_data_got::add_local_pair_with_rel): New function.
11003 (Output_data_got::add_local_pair_with_rela): New function.
11004 (Output_data_got::add_global_tls): Removed.
11005 (Output_data_got::add_global_tls_with_rel): Removed.
11006 (Output_data_got::add_global_tls_with_rela): Removed.
11007 (Output_data_got::add_local_tls): Removed.
11008 (Output_data_got::add_local_tls_with_rel): Removed.
11009 (Output_data_got::add_local_tls_with_rela): Removed.
11010 * resolve.cc (Symbol::override_base_with_special): Removed
11011 reference to has_got_offset_ field.
11012 * symtab.cc (Symbol::init_fields): Replaced initialization
11013 of got_offset_ with got_offsets_. Removed initialization
11014 of has_got_offset_
53fcba31 11015 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
11016 (Symbol::got_offset): Likewise.
11017 (Symbol::set_got_offset): Likewise.
11018 (Symbol::has_tls_got_offset): Removed.
11019 (Symbol::tls_got_offset): Removed.
11020 (Symbol::set_tls_got_offset): Removed.
11021 (Symbol::got_offset_): Removed.
11022 (Symbol::tls_mod_got_offset_): Removed.
11023 (Symbol::tls_pair_got_offset_): Removed.
11024 (Symbol::got_offsets_): New field.
11025 (Symbol::has_got_offset): Removed.
11026 (Symbol::has_tls_mod_got_offset): Removed.
11027 (Symbol::has_tls_pair_got_offset): Removed.
11028 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11029 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11030 member functions.
11031 (Target_x86_64::Scan::global): Likewise.
11032 (Target_x86_64::Relocate::relocate): Likewise.
11033 (Target_x86_64::Relocate::relocate_tls): Likewise.
11034
bd52eafb
BE
110352008-03-25 Ben Elliston <bje@au.ibm.com>
11036
11037 * yyscript.y: Fix spelling error in comment.
11038
8b105e34
ILT
110392008-03-24 Ian Lance Taylor <iant@google.com>
11040
8ed814a9
ILT
11041 * options.h (class General_options): Define build_id option.
11042 * layout.h (class Layout): Declare write_build_id, create_note,
11043 create_build_id. Add build_id_note_ member.
11044 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11045 "libiberty.h", "md5.h", "sha1.h".
11046 (Layout::Layout): Initialize eh_frame_data_,
11047 eh_frame_hdr_section_, and build_id_note_.
11048 (Layout::finalize): Call create_build_id.
11049 (Layout::create_note): New function, broken out of
11050 Layout::create_gold_note.
11051 (Layout::create_gold_note): Call create_note.
11052 (Layout::create_build_id): New function.
11053 (Layout::write_build_id): New function.
11054 (Close_task_runner::run): Call write_build_id.
11055
8b105e34
ILT
11056 * x86_64.cc: Correct license to GPLv3.
11057
086a1841
ILT
110582008-03-23 Ian Lance Taylor <iant@google.com>
11059
11060 * options.cc: Include "demangle.h".
11061 (parse_optional_string): New function.
11062 (parse_long_option): Handle takes_optional_argument.
11063 (parse_short_option): Update dash_z initializer. Handle
11064 takes_optional_argument.
11065 (General_options::General_options): Initialize do_demangle_.
11066 (General_options::finalize): Set do_demangle_. Handle demangling
11067 style.
11068 * options.h (parse_optional_string): Declare.
11069 (struct One_option): Add optional_arg field. Update constructor.
11070 Update call constructor calls. Add takes_optional_argument
11071 function.
11072 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11073 (DEFINE_optional_string): Define.
11074 (General_options::demangle): Change from DEFINE_bool to
11075 DEFINE_optional_string.
11076 (General_options::no_demangle): New function.
11077 (General_options::do_demangle): New function.
11078 (General_options::set_do_demangle): New function.
11079 (General_options::execstack_status_): Move definition to end of
11080 class definition.
11081 (General_options::static_): Likewise.
11082 (General_options::do_demangle_): New field.
11083 * object.cc (big_endian>::get_symbol_location_info): Call
11084 Options::do_demangle, not Options::demangle.
11085 * symtab.cc (demangle): Likewise.
11086
cbb93e63
ILT
110872008-03-22 Ian Lance Taylor <iant@google.com>
11088
11089 * gold.h: Include <cstddef> and <sys/types.h>
11090 * options.h: Include <cstring>.
11091
ec531623
ILT
110922008-03-21 Ian Lance Taylor <iant@google.com>
11093
11094 * Added source code to GNU binutils.
This page took 0.750256 seconds and 4 git commands to generate.