Support x32 core dump.
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
85b0f90c
AM
12011-06-14 Alan Modra <amodra@gmail.com>
2
3 * po/POTFILES.in: Regenerate.
4
a94907d9
ILT
52011-06-09 Ian Lance Taylor <iant@google.com>
6
7 * script-sections.cc
8 (Orphan_output_section::set_section_addresses): For a relocatable
9 link set address to 0.
10
4fb3a1c3
CC
112011-06-09 Cary Coutant <ccoutant@google.com>
12
13 PR gold/12804
14 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
15 used with --compress-debug-sections.
16 * gold/object.cc (Sized_relobj_file::do_layout): Report
17 uncompressed size of compressed input sections.
18
61220854
CC
192011-06-08 Cary Coutant <ccoutant@google.com>
20
21 PR gold/12804
22 * testsuite/two_file_test_2_v1.cc: Change initialization of
23 v2 to keep it in .data.
24
e6455dfb
CC
252011-06-07 Cary Coutant <ccoutant@google.com>
26
27 * common.cc (Symbol_table::do_allocate_commons_list): Call
28 gold_fallback.
29 * errors.cc (Errors::fatal): Adjust call to gold_exit.
30 (Errors::fallback): New function.
31 (gold_fallback): New function.
32 * errors.h (Errors::fallback): New function.
33 * gold.cc (gold_exit): Change status parameter to enum; adjust
34 all callers.
35 (queue_initial_tasks): Call gold_fallback.
36 * gold.h: Include cstdlib.
37 (Exit_status): New enum type.
38 (gold_exit): Change status parameter to enum.
39 (gold_fallback): New function.
40 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
41 (Layout::create_symtab_sections): Likewise.
42 (Layout::create_shdrs): Likewise.
43 * main.cc (main): Adjust call to gold_exit.
44 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
45 (Output_data_got::add_got_entry_pair): Likewise.
46 (Output_section::add_input_section): Likewise.
47 (Output_section::add_output_section_data): Likewise.
48 (Output_segment::set_section_list_addresses): Likewise.
49 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
50
fb0e076f
CC
512011-06-07 Cary Coutant <ccoutant@google.com>
52
53 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
54 for incremental links.
55 * output.cc (Output_segment::set_section_list_addresses): Remove
56 FIXME and test for TLS or BSS.
57
a5ee4d5d
CC
582011-06-07 Cary Coutant <ccoutant@google.com>
59
60 * testsuite/Makefile.am: Add incremental_copy_test,
61 incremental_common_test_1.
62 * testsuite/Makefile.in: Regenerate.
63 * testsuite/common_test_1_v1.c: New source file.
64 * testsuite/common_test_1_v2.c: New source file.
65 * testsuite/copy_test_v1.cc: New source file.
66
5146f448
CC
672011-06-07 Cary Coutant <ccoutant@google.com>
68
69 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
70 update, allocate common from bss section's free list.
71 * incremental-dump.cc (dump_incremental_inputs): Print flag for
72 linker-defined symbols.
73 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
74 Skip GOT and PLT entries that are no longer referenced.
75 (Output_section_incremental_inputs::write_info_blocks): Mark
76 linker-defined symbols.
77 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
78 * output.cc (Output_section::allocate): New function.
79 * output.h (Output_section::allocate): New function.
80 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
81 linker-defined symbols.
82 (Symbol::override_base_with_special): Copy is_predefined_ flag.
83 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
84 (Symbol::init_base_output_data): Likewise.
85 (Symbol::init_base_output_segment): Likewise.
86 (Symbol::init_base_constant): Likewise.
87 (Sized_symbol::init_output_data): Likewise.
88 (Sized_symbol::init_output_segment): Likewise.
89 (Sized_symbol::init_constant): Likewise.
90 (Symbol_table::do_define_in_output_data): Likewise.
91 (Symbol_table::do_define_in_output_segment): Likewise.
92 (Symbol_table::do_define_as_constant): Likewise.
93 * symtab.h (Symbol::is_predefined): New function.
94 (Symbol::init_base_output_data): Add is_predefined parameter.
95 (Symbol::init_base_output_segment): Likewise.
96 (Symbol::init_base_constant): Likewise.
97 (Symbol::is_predefined_): New data member.
98 (Sized_symbol::init_output_data): Add is_predefined parameter.
99 (Sized_symbol::init_output_segment): Likewise.
100 (Sized_symbol::init_constant): Likewise.
101 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
102
26d3c67d
CC
1032011-06-07 Cary Coutant <ccoutant@google.com>
104
105 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
106 instead of emit_copy_reloc.
107 (Copy_relocs::emit_copy_reloc): Refactor.
108 (Copy_relocs::make_copy_reloc): New function.
109 (Copy_relocs::add_copy_reloc): Remove.
110 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
111 section.
112 (Copy_relocs::make_copy_reloc): New function.
113 (Copy_relocs::add_copy_reloc): Remove.
114 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
115 unchanged input files.
116 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
117 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
118 Reserve BSS space for COPY relocations.
119 (Sized_incremental_binary::do_emit_copy_relocs): New function.
120 (Output_section_incremental_inputs::write_info_blocks): Record
121 whether a symbol is copied from a shared object.
122 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
123 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
124 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
125 (Incremental_input_entry_reader::get_output_symbol_index): Add
126 is_copy parameter.
127 (Incremental_binary::emit_copy_relocs): New function.
128 (Incremental_binary::do_emit_copy_relocs): New function.
129 (Sized_incremental_binary::Sized_incremental_binary): Initialize
130 new data member.
131 (Sized_incremental_binary::add_copy_reloc): New function.
132 (Sized_incremental_binary::do_emit_copy_relocs): New function.
133 (Sized_incremental_binary::Copy_reloc): New struct.
134 (Sized_incremental_binary::Copy_relocs): New typedef.
135 (Sized_incremental_binary::copy_relocs_): New data member.
136 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
137 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
138 * target.h (Sized_target::emit_copy_reloc): New function.
139 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
140
7cdb37d9
CC
1412011-06-02 Cary Coutant <ccoutant@google.com>
142
143 PR gold/12163
144 * gold/archive.cc (Archive::Archive): Initialize new data member.
145 (Archive::include_all_members): Return if archive has already been
146 included.
147 * gold/archive.h (Archive::include_all_members_): New data member.
148
cc643b88
NC
1492011-06-02 Nick Clifton <nickc@redhat.com>
150
151 * dynobj.h: Fix spelling mistake in comment.
152 * output.cc: Likewise.
153
f62a3ca7
DK
1542011-05-31 Doug Kwan <dougkwan@google.com>
155 Asier Llano
156
157 PR gold/12826
cc643b88 158 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
159 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
160 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
161 redundant arm_exidx_test.so.
162 * testsuite/Makefile.in: Regenerate.
163 (check_SCRIPTS): Add pr12826.sh
164 (check_DATA): Add pr12826.stdout
165 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
166 * testsuite/pr12826.sh: New file.
167 * testsuite/pr12826_1.s: Ditto.
168 * testsuite/pr12826_1.s: Ditto.
169
8dbe1edc
ILT
1702011-05-30 Ian Lance Taylor <iant@google.com>
171
172 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
173 sections.
174
c49875be
ILT
1752011-05-29 Ian Lance Taylor <iant@google.com>
176
177 PR gold/12804
178 * testsuite/Makefile.am: Use different file name for two_file_test
179 temporary file for each incremental test.
180 * testsuite/Makefile.in: Rebuild.
181
69d53f7a
ILT
1822011-05-29 Ian Lance Taylor <iant@google.com>
183
184 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
185 binary input file is empty.
186
41d0ab5f
ILT
1872011-05-27 Ian Lance Taylor <iant@google.com>
188
189 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
190 (ver_test_9.so): Likewise.
191 * testsuite/Makefile.in: Rebuild.
192
89d8a36b
CC
1932011-05-26 Cary Coutant <ccoutant@google.com>
194
195 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
196 * incremental.cc (Incremental_inputs::report_input_section): Fix
197 comment, indentation.
198 (Incremental_inputs::report_comdat_group): New function.
199 (Output_section_incremental_inputs::set_final_data_size): Adjust size
200 of data for incremental input file entry.
201 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
202 group count, COMDAT group signatures.
203 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
204 an unchanged input file.
205 * incremental.h (Incremental_object_entry::Incremental_object_entry):
206 Initialize new data member.
207 (Incremental_object_entry::add_comdat_group): New function.
208 (Incremental_object_entry::get_comdat_group_count): New function.
209 (Incremental_object_entry::get_comdat_signature_key): New function.
210 (Incremental_object_entry::groups_): New data member.
211 (Incremental_inputs::report_comdat_group): New function.
212 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
213 data for incremental input file entry.
214 (Incremental_input_entry_reader::get_comdat_group_count): New function.
215 (Incremental_input_entry_reader::get_input_section): Adjust size of
216 data for incremental input file entry.
217 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
218 (Incremental_input_entry_reader::get_comdat_group_signature): New
219 function.
220 * object.cc (Sized_relobj::include_section_group): Report kept
221 COMDAT groups for incremental links.
222
1706a06f
ILT
2232011-05-24 David Meyer <pdox@google.com>
224
225 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
226 with name parameter. Add found_name parameter.
227 * fileread.cc (Input_file::find_file): Adjust code accordingly.
228 * dirsearch.h (class Dirsearch): Update declaration.
229
a10ae760
ILT
2302011-05-24 Ian Lance Taylor <iant@google.com>
231
232 * archive.cc (Library_base::should_include_member): Pull in object
233 from archive if it defines the entry symbol.
234 * parameters.cc (Parameters::entry): New function.
235 * parameters.h (class Parameters): Declare entry.
236 * output.h (class Output_file_header): Remove entry_ field.
237 * output.cc (Output_file_header::Output_file_header): Remove entry
238 parameter. Change all callers.
239 (Output_file_header::entry): Use parameters->entry.
240 * gold.cc (queue_middle_tasks): Likewise.
241 * plugin.cc (Plugin_hook::run): Likewise.
242
aa92d6ed
CC
2432011-05-24 Cary Coutant <ccoutant@google.com>
244
245 * gold.cc (queue_initial_tasks): Pass incremental base filename
246 to Output_file::open_base_file; don't print error message.
247 * incremental-dump.cc (main): Adjust call to
248 Output_file::open_for_modification.
249 * incremental-dump.cc (main): Likewise.
250 * incremental.cc (Incremental_inputs::report_command_line):
251 Ignore --incremental-base option when comparing command lines.
252 Ignore parameter when given as separate argument.
253 * options.h (class General_options): Add --incremental-base.
254 * output.cc (Output_file::Output_file):
255 (Output_file::open_base_file): Add base_name and writable parameters;
256 read base file into new file; print error message here.
257 (Output_file::map_no_anonymous): Add writable parameter; adjust all
258 callers.
259 * output.h (Output_file::open_for_modification): Rename to...
260 (Output_file::open_base_file): ...this; add base_name and
261 writable parameters; adjust all callers.
262 (Output_file::map_no_anonymous): Add writable parameter; adjust all
263 callers.
264 * testsuite/Makefile.am (incremental_test_4): Test
265 --incremental-base.
266 * testsuite/Makefile.in: Regenerate.
267
2eedd706
CC
2682011-05-24 Cary Coutant <ccoutant@google.com>
269
270 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
271 incremental_test_4.
272 * testsuite/Makefile.in: Regenerate.
273 * testsuite/two_file_test_1_v1.cc: New test source file.
274 * testsuite/two_file_test_1b_v1.cc: New test source file.
275 * testsuite/two_file_test_2_v1.cc: New test source file.
276
0f1c85a6
CC
2772011-05-24 Cary Coutant <ccoutant@google.com>
278
279 * dynobj.h (Dynobj::do_dynobj): New function.
280 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
281 flag and soname for shared objects.
282 * incremental.cc (Incremental_inputs::report_object): Make
283 either Incremental_object_entry or Incremental_dynobj_entry; add
284 soname to string table.
285 (Incremental_inputs::report_input_section): Add assertion.
286 (Output_section_incremental_inputs::set_final_data_size): Adjust
287 type of input file entry for shared libraries; adjust size of
288 shared library info entry.
289 (Output_section_incremental_inputs::write_input_files): Write
290 as_needed flag for shared libraries.
291 (Output_section_incremental_inputs::write_info_blocks): Adjust type
292 of input file entry for shared libraries; write soname.
293 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
294 soname from incremental info.
295 * incremental.h (enum Incremental_input_flags): Add
296 INCREMENTAL_INPUT_AS_NEEDED.
297 (Incremental_input_entry::Incremental_input_entry): Initialize new
298 data member.
299 (Incremental_input_entry::set_as_needed): New function.
300 (Incremental_input_entry::as_needed): New function.
301 (Incremental_input_entry::do_dynobj_entry): New function.
302 (Incremental_input_entry::as_needed_): New data member.
303 (Incremental_object_entry::Incremental_object_entry): Don't check
304 for shared library.
305 (Incremental_object_entry::do_type): Likewise.
306 (class Incremental_dynobj_entry): New class.
307 (Incremental_input_entry_reader::as_needed): New function.
308 (Incremental_input_entry_reader::get_soname): New function.
309 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
310 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
311 size of shared library info entry.
312 * layout.cc (Layout::finish_dynamic_section): Don't test for
313 incremental link when adding DT_NEEDED entries.
314 * object.h (Object::Object): Initialize new data member.
315 (Object::dynobj): New function.
316 (Object::set_as_needed): New function.
317 (Object::as_needed): New function.
318 (Object::do_dynobj): New function.
319 (Object::as_needed_): New data member.
320
6fa2a40b
CC
3212011-05-24 Cary Coutant <ccoutant@google.com>
322
323 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
324 info; adjust display of GOT entries.
325 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
326 vector of input objects; remove file_status_.
327 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
328 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
329 got_plt reader; call target hooks to reserve GOT entries.
330 (Output_section_incremental_inputs::set_final_data_size): Adjust size
331 of input file info header and GOT info entry.
332 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
333 relocation info.
334 (Got_plt_view_info::got_descriptor): Remove.
335 (Got_plt_view_info::sym_index): New data member.
336 (Got_plt_view_info::input_index): New data member.
337 (Local_got_offset_visitor::visit): Write input file index.
338 (Global_got_offset_visitor::visit): Write 0 for input file index.
339 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
340 with sym_index and input_index.
341 (Output_section_incremental_inputs::write_got_plt): Adjust size of
342 incremental info GOT entry; replace got_descriptor with input_index.
343 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
344 map from input file index to object.
345 (Sized_relobj_incr::do_layout): Replace direct data member reference
346 with accessor function.
347 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
348 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
349 Adjust size of input file info header.
350 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
351 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
352 (Incremental_input_entry_reader::get_input_section): Adjust size of
353 input file info header.
354 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
355 of incremental info GOT entry.
356 (Incremental_got_plt_reader::get_got_desc): Remove.
357 (Incremental_got_plt_reader::get_got_symndx): New function.
358 (Incremental_got_plt_reader::get_got_input_index): New function.
359 (Sized_incremental_binary::Sized_incremental_binary): Remove
360 file_status_; add input_objects_.
361 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
362 (Sized_incremental_binary::set_file_is_unchanged): Remove.
363 (Sized_incremental_binary::file_is_unchanged): Remove.
364 (Sized_incremental_binary::set_input_object): New function.
365 (Sized_incremental_binary::input_object): New function.
366 (Sized_incremental_binary::file_status_): Remove.
367 (Sized_incremental_binary::input_objects_): New data member.
368 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
369 references.
370 (Sized_relobj_incr::invalid_address): Move to base class.
371 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
372 class.
373 (Sized_relobj_incr::do_output_section_offset): Likewise.
374 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
375 (Sized_relobj_incr::section_offsets_): Likewise.
376 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
377 function.
378 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
379 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
380 with accessor function.
381 (Sized_relobj_file::do_layout): Likewise.
382 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
383 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
384 (Sized_relobj_file::compute_final_local_value): Replace refs to
385 section_offsets_ with accessor function.
386 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
387 * object.h (Relobj::Relobj): Initialize new data members.
388 (Relobj::add_dyn_reloc): New function.
389 (Relobj::first_dyn_reloc): New function.
390 (Relobj::dyn_reloc_count): New function.
391 (Relobj::first_dyn_reloc_): New data member.
392 (Relobj::dyn_reloc_count_): New data member.
393 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
394 references.
395 (Sized_relobj::Address): New typedef.
396 (Sized_relobj::invalid_address): Move here from child class.
397 (Sized_relobj::Sized_relobj): Initialize new data members.
398 (Sized_relobj::sized_relobj): New function.
399 (Sized_relobj::is_output_section_offset_invalid): Move here from
400 child class.
401 (Sized_relobj::get_output_section_offset): Likewise.
402 (Sized_relobj::local_has_got_offset): Likewise.
403 (Sized_relobj::local_got_offset): Likewise.
404 (Sized_relobj::set_local_got_offset): Likewise.
405 (Sized_relobj::do_for_all_local_got_entries): Likewise.
406 (Sized_relobj::clear_got_offsets): New function.
407 (Sized_relobj::section_offsets): Move here from child class.
408 (Sized_relobj::do_output_section_offset): Likewise.
409 (Sized_relobj::do_set_section_offset): Likewise.
410 (Sized_relobj::Local_got_offsets): Likewise.
411 (Sized_relobj::local_got_offsets_): Likewise.
412 (Sized_relobj::section_offsets_): Likewise.
413 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
414 references.
415 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
416 class.
417 (Sized_relobj_file::sized_relobj): New function
418 (Sized_relobj_file::local_has_got_offset): Move to base class.
419 (Sized_relobj_file::local_got_offset): Likewise.
420 (Sized_relobj_file::set_local_got_offset): Likewise.
421 (Sized_relobj_file::get_output_section_offset): Likewise.
422 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
423 (Sized_relobj_file::do_output_section_offset): Likewise.
424 (Sized_relobj_file::do_set_section_offset): Likewise.
425 (Sized_relobj_file::Local_got_offsets): Likewise.
426 (Sized_relobj_file::local_got_offsets_): Likewise.
427 (Sized_relobj_file::section_offsets_): Likewise.
428 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
429 (all constructors).
430 (set_needs_dynsym_index): Convert relobj to derived class pointer.
431 (Output_reloc::get_symbol_index): Likewise.
432 (Output_reloc::local_section_offset): Likewise.
433 (Output_reloc::get_address): Likewise.
434 (Output_reloc::symbol_value): Likewise.
435 (Output_data_got::reserve_slot): Move to class definition.
436 (Output_data_got::reserve_local): New function.
437 (Output_data_got::reserve_slot_for_global): Remove.
438 (Output_data_got::reserve_global): New function.
439 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
440 (all constructors, two instantiations).
441 (Output_reloc::get_relobj): New function (two instantiations).
442 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
443 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
444 (Output_data_reloc::add_global): Adjust type of relobj.
445 (Output_data_reloc::add_global_relative): Likewise.
446 (Output_data_reloc::add_symbolless_global_addend): Likewise.
447 (Output_data_reloc::add_local): Likewise.
448 (Output_data_reloc::add_local_relative): Likewise.
449 (Output_data_reloc::add_symbolless_local_addend): Likewise.
450 (Output_data_reloc::add_local_section): Likewise.
451 (Output_data_reloc::add_output_section): Likewise.
452 (Output_data_reloc::add_absolute): Likewise.
453 (Output_data_reloc::add_target_specific): Likewise.
454 (Output_data_got::reserve_slot): Move definition here.
455 (Output_data_got::reserve_local): New function.
456 (Output_data_got::reserve_global): New function.
457 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
458 section_offsets_ with accessor function.
459 (Sized_relobj_file::write_sections): Likewise.
460 (Sized_relobj_file::do_relocate_sections): Likewise.
461 * target.h (Sized_target::reserve_local_got_entry): New function.
462 (Sized_target::reserve_global_got_entry): New function.
463 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
464 (Target_x86_64::reserve_global_got_entry): New function.
465 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
466
4829d394
CC
4672011-05-23 Cary Coutant <ccoutant@google.com>
468
469 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
470 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
471 bit when checking got_type.
472 * incremental.cc (Sized_incremental_binary::setup_readers):
473 Store symbol table and string table locations; initialize bit vector
474 of file status flags.
475 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
476 unchanged files.
477 (Sized_incremental_binary::do_process_got_plt): New function.
478 (Sized_incremental_binary::get_symtab_view): Use stored locations.
479 (Output_section_incremental_inputs::set_final_data_size): Record
480 file index for each input file.
481 (Output_section_incremental_inputs::write_got_plt): Store file index
482 instead of input entry offset for each GOT entry.
483 * incremental.h
484 (Incremental_input_entry::Incremental_input_entry): Initialize new
485 data member.
486 (Incremental_input_entry::set_offset): Store file index.
487 (Incremental_input_entry::get_file_index): New function.
488 (Incremental_input_entry::file_index_): New data member.
489 (Incremental_binary::process_got_plt): New function.
490 (Incremental_binary::do_process_got_plt): New function.
491 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
492 data members.
493 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
494 (Sized_incremental_binary::set_file_is_unchanged): New function.
495 (Sized_incremental_binary::file_is_unchanged): New function.
496 (Sized_incremental_binary::do_process_got_plt): New function.
497 (Sized_incremental_binary::file_status_): New data member.
498 (Sized_incremental_binary::main_symtab_loc_): New data member.
499 (Sized_incremental_binary::main_strtab_loc_): New data member.
500 * output.cc (Output_data_got::Got_entry::write): Add case
501 RESERVED_CODE.
502 (Output_data_got::add_global): Call add_got_entry.
503 (Output_data_got::add_global_plt): Likewise.
504 (Output_data_got::add_global_with_rel): Likewise.
505 (Output_data_got::add_global_with_rela): Likewise.
506 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
507 (Output_data_got::add_global_pair_with_rela): Likewise.
508 (Output_data_got::add_local): Call add_got_entry.
509 (Output_data_got::add_local_plt): Likewise.
510 (Output_data_got::add_local_with_rel): Likewise.
511 (Output_data_got::add_local_with_rela): Likewise.
512 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
513 (Output_data_got::add_local_pair_with_rela): Likewise.
514 (Output_data_got::reserve_slot): New function.
515 (Output_data_got::reserve_slot_for_global): New function.
516 (Output_data_got::add_got_entry): New function.
517 (Output_data_got::add_got_entry_pair): New function.
518 (Output_section::add_output_section_data): Edit FIXME.
519 * output.h
520 (Output_section_data_build::Output_section_data_build): New
521 constructor with size parameter.
522 (Output_data_space::Output_data_space): Likewise.
523 (Output_data_got::Output_data_got): Initialize new data member; new
524 constructor with size parameter.
525 (Output_data_got::add_constant): Call add_got_entry.
526 (Output_data_got::reserve_slot): New function.
527 (Output_data_got::reserve_slot_for_global): New function.
528 (class Output_data_got::Got_entry): Add RESERVED_CODE.
529 (Output_data_got::add_got_entry): New function.
530 (Output_data_got::add_got_entry_pair): New function.
531 (Output_data_got::free_list_): New data member.
532 * target.h (Sized_target::init_got_plt_for_update): New function.
533 (Sized_target::register_global_plt_entry): New function.
534 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
535 Initialize new data member; call init; add constructor with PLT count.
536 (Output_data_plt_x86_64::init): New function.
537 (Output_data_plt_x86_64::add_relocation): New function.
538 (Output_data_plt_x86_64::reserve_slot): New function.
539 (Output_data_plt_x86_64::free_list_): New data member.
540 (Target_x86_64::init_got_plt_for_update): New function.
541 (Target_x86_64::register_global_plt_entry): New function.
542 (Output_data_plt_x86_64::add_entry): Allocate from free list for
543 incremental updates.
544 (Output_data_plt_x86_64::add_relocation): New function.
545 * testsuite/object_unittest.cc (Object_test): Set default options.
546
ec69d6da
ILT
5472011-05-16 Ian Lance Taylor <iant@google.com>
548
549 * options.h (class General_options): Make -i a synonym for -r.
550
732e31de
ILT
5512011-05-16 Ian Lance Taylor <iant@google.com>
552
553 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
554
403676b5
CC
5552011-05-10 Cary Coutant <ccoutant@google.com>
556
557 * object.cc (Sized_relobj::do_count_local_symbols): Check for
558 strip_all (-s).
559
5b7b7d6e
ILT
5602011-05-06 Ian Lance Taylor <iant@google.com>
561
562 * layout.cc (Layout::layout): If the output section flags change,
563 update the ordering.
564
f0f9babf
CC
5652011-04-25 Cary Coutant <ccoutant@google.com>
566
567 * incremental-dump.cc (dump_incremental_inputs): Print local
568 symbol info for each input file.
569 * incremental.cc
570 (Output_section_incremental_inputs::set_final_data_size): Add local
571 symbol info to input file entries in incremental info.
572 (Output_section_incremental_inputs::write_info_blocks): Likewise.
573 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
574 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
575 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
576 implementation.
577 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
578 (Sized_incr_relobj::do_relocate): Write the local symbols.
579 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
580 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
581 Adjust size of input file header.
582 (Incremental_inputs_reader::get_local_symbol_offset): New function.
583 (Incremental_inputs_reader::get_local_symbol_count): New function.
584 (Incremental_inputs_reader::get_input_section): Adjust size of input
585 file header.
586 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
587 (Sized_incr_relobj::This): New typedef.
588 (Sized_incr_relobj::sym_size): New const data member.
589 (Sized_incr_relobj::Local_symbol): New struct.
590 (Sized_incr_relobj::do_output_local_symbol_count): New function.
591 (Sized_incr_relobj::do_local_symbol_offset): New function.
592 (Sized_incr_relobj::local_symbol_count_): New data member.
593 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
594 (Sized_incr_relobj::local_symbol_index_): New data member.
595 (Sized_incr_relobj::local_symbol_offset_): New data member.
596 (Sized_incr_relobj::local_dynsym_offset_): New data member.
597 (Sized_incr_relobj::local_symbols_): New data member.
598 * object.h (Relobj::output_local_symbol_count): New function.
599 (Relobj::local_symbol_offset): New function.
600 (Relobj::do_output_local_symbol_count): New function.
601 (Relobj::do_local_symbol_offset): New function.
602 (Sized_relobj::do_output_local_symbol_count): New function.
603 (Sized_relobj::do_local_symbol_offset): New function.
604
d0a9ace3
ILT
6052011-04-22 Vladimir Simonov <sv@sw.ru>
606
607 * descriptors.cc (set_close_on_exec): New function.
608 (Descriptors::open): Use set_close_on_exec.
609 * output.cc (S_ISLNK): Define if not defined.
610
94a3fc8b
CC
6112011-04-22 Cary Coutant <ccoutant@google.com>
612
613 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
614 global symbol map.
615 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
616 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
617 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
618 relocations.
619 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
620 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
621 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
622 * incremental.h
623 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
624 function.
625 (Incremental_binary::apply_incremental_relocs): New function.
626 (Incremental_binary::do_apply_incremental_relocs): New function.
627 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
628 data member.
629 (Sized_incremental_binary::add_global_symbol): New function.
630 (Sized_incremental_binary::global_symbol): New function.
631 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
632 (Sized_incremental_binary::symbol_map_): New data member.
633 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
634 * target.h (Sized_target::apply_relocation): New function.
635 * target-reloc.h (apply_relocation): New function.
636 * x86_64.cc (Target_x86_64::apply_relocation): New function.
637
c87e4302
DK
6382011-04-22 Doug Kwan <dougkwan@google.com>
639
640 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
641 flag of a SHT_ARM_EXIDX section.
642 * testsuite/Makefile.am (arm_exidx_test): New test rules.
643 * testsuite/Makefile.in: Regenerate.
644 * testsuite/arm_exidx_test.s: New file.
645 * testsuite/arm_exidx_test.sh: Same.
646
e7782cf6
CC
6472011-04-20 Cary Coutant <ccoutant@google.com>
648
649 PR gold/12689
650 * archive.h (Incremental_archive_entry::Archive_member):
651 Initialize arg_serial_ (second constructor).
652
308ecdc7
ILT
6532011-04-17 Ian Lance Taylor <iant@google.com>
654
655 * object.cc (Relocate_info::location): Simplify location string.
656 * errors.cc (Errors::error_at_location): Don't print program
657 name.
658 (Errors::warning_at_location): Likewise.
659 (Errors::undefined_symbol): Likewise.
660 * testsuite/debug_msg.sh: Update accordingly.
661
bec5b579
CC
6622011-04-14 Cary Coutant <ccoutant@google.com>
663
664 * gold/layout.cc (Layout::symtab_section_offset): New function.
665 * gold/layout.h (Layout::symtab_section_offset): New function.
666 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
667
88597d34
ILT
6682011-04-12 Ian Lance Taylor <iant@google.com>
669
670 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
671 with MREMAP_MAYMOVE.
672 * output.h (class Output_file): Add map_is_allocated_ field.
673 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
674 not available, provide stubs. If mremap is not available, #define
675 it to gold_mremap.
676 (MREMAP_MAYMOVE): Define if not defined.
677 (Output_file::Output_file): Initialize map_is_allocated_.
678 (Output_file::resize): Check map_is_allocated_.
679 (Output_file::map_anonymous): If mmap fails, use malloc.
680 (Output_file::unmap): Don't do anything for an anonymous map.
681 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
682 is not available, provide stubs.
683 (File_read::View::~View): Use free rather than delete[].
684 (File_read::make_view): Use malloc rather than new[]. If mmap
685 fails, use malloc.
686 (File_read::find_or_make_view): Use malloc rather than new[].
687 * gold.h: Remove HAVE_REMAP code.
688 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
689 exists. Rename mremap to gold_mremap. If mmap is not available
690 don't do anything.
691 * configure, config.in: Rebuild.
692
11e361bc
ILT
6932011-04-11 Ian Lance Taylor <iant@google.com>
694
695 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
696 initialize local variable v.
697
cdc29364
CC
6982011-04-11 Cary Coutant <ccoutant@google.com>
699
700 * archive.cc (Archive::include_member): Adjust call to
701 report_object.
702 (Add_archive_symbols::run): Track argument serial numbers.
703 (Lib_group::include_member): Likewise.
704 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
705 * archive.h (Incremental_archive_entry::Archive_member):
706 Initialize arg_serial_.
707 (Archive_member::arg_serial_): New data member.
708 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
709 (Sized_dynobj::do_add_symbols): Track symbols when doing an
710 incremental link.
711 (Sized_dynobj::do_for_all_local_got_entries): New function.
712 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
713 function.
714 * fileread.cc (get_mtime): New function.
715 * fileread.h (get_mtime): New function.
716 * gold.cc (queue_initial_tasks): Check for incremental update.
717 (process_incremental_input): New function.
718 (queue_middle_tasks): Don't force valid target for incremental
719 update.
720 * incremental-dump.cc (find_input_containing_global): Adjust
721 size of symbol info entry.
722 (dump_incremental_inputs): Dump argument serial number and
723 in_system_directory flag; bias shndx by 1; print symbol names
724 when dumping per-file symbol lists; use new symbol info readers.
725 * incremental.cc
726 (Output_section_incremental_inputs:update_data_size): New function.
727 (Sized_incremental_binary::setup_readers): Setup input readers
728 for each input file; build maps for files added from libraries
729 and scripts.
730 (Sized_incremental_binary::check_input_args): New function.
731 (Sized_incremental_binary::do_check_inputs): Build map of argument
732 serial numbers to input arguments.
733 (Sized_incremental_binary::do_file_has_changed): Rename
734 do_file_is_unchanged to this; compare file modification times.
735 (Sized_incremental_binary::do_init_layout): New function.
736 (Sized_incremental_binary::do_reserve_layout): New function.
737 (Sized_incremental_binary::do_get_input_reader): Remove.
738 (Sized_incremental_binary::get_symtab_view): New function.
739 (Incremental_checker::can_incrementally_link_output_file): Remove.
740 (Incremental_inputs::report_command_line): Exclude --debug options.
741 (Incremental_inputs::report_archive_begin): Add parameter; track
742 argument serial numbers; don't put input file entry for archive
743 before archive members.
744 (Incremental_inputs::report_archive_end): Put input file entry
745 for archive after archive members.
746 (Incremental_inputs::report_object): Add parameter; track argument
747 serial numbers and in_system_directory flag.
748 (Incremental_inputs::report_script): Add parameter; track argument
749 serial numbers.
750 (Output_section_incremental_inputs::set_final_data_size): Adjust
751 size of symbol info entry; check for forwarding symbols.
752 (Output_section_incremental_inputs::write_input_files): Write
753 in_system_directory flag and argument serial number.
754 (Output_section_incremental_inputs::write_info_blocks): Map section
755 indices between incremental info and original input file; store
756 input section index for each symbol.
757 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
758 change operator() to visit().
759 (class Global_got_offset_visitor): Likewise.
760 (class Global_symbol_visitor_got_plt):
761 (Output_section_incremental_inputs::write_got_plt): Use new visitor
762 classes.
763 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
764 (Sized_incr_relobj::do_read_symbols): New function.
765 (Sized_incr_relobj::do_layout): New function.
766 (Sized_incr_relobj::do_layout_deferred_sections): New function.
767 (Sized_incr_relobj::do_add_symbols): New function.
768 (Sized_incr_relobj::do_should_include_member): New function.
769 (Sized_incr_relobj::do_for_all_global_symbols): New function.
770 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
771 (Sized_incr_relobj::do_section_size): New function.
772 (Sized_incr_relobj::do_section_name): New function.
773 (Sized_incr_relobj::do_section_contents): New function.
774 (Sized_incr_relobj::do_section_flags): New function.
775 (Sized_incr_relobj::do_section_entsize): New function.
776 (Sized_incr_relobj::do_section_address): New function.
777 (Sized_incr_relobj::do_section_type): New function.
778 (Sized_incr_relobj::do_section_link): New function.
779 (Sized_incr_relobj::do_section_info): New function.
780 (Sized_incr_relobj::do_section_addralign): New function.
781 (Sized_incr_relobj::do_initialize_xindex): New function.
782 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
783 (Sized_incr_relobj::do_read_relocs): New function.
784 (Sized_incr_relobj::do_gc_process_relocs): New function.
785 (Sized_incr_relobj::do_scan_relocs): New function.
786 (Sized_incr_relobj::do_count_local_symbols): New function.
787 (Sized_incr_relobj::do_finalize_local_symbols): New function.
788 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
789 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
790 (Sized_incr_relobj::do_relocate): New function.
791 (Sized_incr_relobj::do_set_section_offset): New function.
792 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
793 (Sized_incr_dynobj::do_read_symbols): New function.
794 (Sized_incr_dynobj::do_layout): New function.
795 (Sized_incr_dynobj::do_add_symbols): New function.
796 (Sized_incr_dynobj::do_should_include_member): New function.
797 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
798 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
799 (Sized_incr_dynobj::do_section_size): New function.
800 (Sized_incr_dynobj::do_section_name): New function.
801 (Sized_incr_dynobj::do_section_contents): New function.
802 (Sized_incr_dynobj::do_section_flags): New function.
803 (Sized_incr_dynobj::do_section_entsize): New function.
804 (Sized_incr_dynobj::do_section_address): New function.
805 (Sized_incr_dynobj::do_section_type): New function.
806 (Sized_incr_dynobj::do_section_link): New function.
807 (Sized_incr_dynobj::do_section_info): New function.
808 (Sized_incr_dynobj::do_section_addralign): New function.
809 (Sized_incr_dynobj::do_initialize_xindex): New function.
810 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
811 (make_sized_incremental_object): New function.
812 (Incremental_library::copy_unused_symbols): New function.
813 (Incremental_library::do_for_all_unused_symbols): New function.
814 * incremental.h (enum Incremental_input_flags): New type.
815 (class Incremental_checker): Remove.
816 (Incremental_input_entry::Incremental_input_entry): Add argument
817 serial number.
818 (Incremental_input_entry::arg_serial): New function.
819 (Incremental_input_entry::set_is_in_system_directory): New function.
820 (Incremental_input_entry::is_in_system_directory): New function.
821 (Incremental_input_entry::arg_serial_): New data member.
822 (Incremental_input_entry::is_in_system_directory_): New data member.
823 (class Script_info): Move here from script.h.
824 (Script_info::Script_info): Add filename parameter.
825 (Script_info::filename): New function.
826 (Script_info::filename_): New data member.
827 (Incremental_script_entry::Incremental_script_entry): Add argument
828 serial number.
829 (Incremental_object_entry::Incremental_object_entry): Likewise.
830 (Incremental_object_entry::add_input_section): Build list of input
831 sections with map to original shndx.
832 (Incremental_object_entry::get_input_section_index): New function.
833 (Incremental_object_entry::shndx_): New data member.
834 (Incremental_object_entry::name_key_): Rename; adjust all refs.
835 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
836 (Incremental_archive_entry::Incremental_archive_entry): Add argument
837 serial number.
838 (Incremental_inputs::report_archive_begin): Likewise.
839 (Incremental_inputs::report_object): Likewise.
840 (Incremental_inputs::report_script): Likewise.
841 (class Incremental_global_symbol_reader): New class.
842 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
843 and store flags and input file type.
844 (Incremental_input_entry_reader::arg_serial): New function.
845 (Incremental_input_entry_reader::type): Extract type from flags.
846 (Incremental_input_entry_reader::is_in_system_directory): New function.
847 (Incremental_input_entry_reader::get_input_section_count): Call
848 accessor function for type.
849 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
850 function for type; adjust size of global symbol entry.
851 (Incremental_input_entry_reader::get_global_symbol_count): Call
852 accessor function for type.
853 (Incremental_input_entry_reader::get_object_count): Likewise.
854 (Incremental_input_entry_reader::get_object_offset): Likewise.
855 (Incremental_input_entry_reader::get_member_count): Likewise.
856 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
857 (Incremental_input_entry_reader::get_member_offset): Likewise.
858 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
859 (Incremental_input_entry_reader::Global_symbol_info): Remove.
860 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
861 (Incremental_input_entry_reader::get_global_symbol_reader): New
862 function.
863 (Incremental_input_entry_reader::get_output_symbol_index): New
864 function.
865 (Incremental_input_entry_reader::type_): Remove.
866 (Incremental_input_entry_reader::flags_): New data member.
867 (Incremental_inputs_reader::input_file_offset): New function.
868 (Incremental_inputs_reader::input_file_index): New function.
869 (Incremental_inputs_reader::input_file): Call input_file_offset.
870 (Incremental_inputs_reader::input_file_at_offset): New function.
871 (Incremental_relocs_reader::get_r_type): Reformat.
872 (Incremental_relocs_reader::get_r_shndx): Reformat.
873 (Incremental_relocs_reader::get_r_offset): Reformat.
874 (Incremental_relocs_reader::data): New function.
875 (Incremental_binary::Incremental_binary): Initialize new data members.
876 (Incremental_binary::check_inputs): Add cmdline parameter.
877 (Incremental_binary::file_is_unchanged): Remove.
878 (Input_reader::arg_serial): New function.
879 (Input_reader::get_unused_symbol_count): New function.
880 (Input_reader::get_unused_symbol): New function.
881 (Input_reader::do_arg_serial): New function.
882 (Input_reader::do_get_unused_symbol_count): New function.
883 (Input_reader::do_get_unused_symbol): New function.
884 (Incremental_binary::input_file_count): New function.
885 (Incremental_binary::get_input_reader): Change signature to use
886 index instead of filename.
887 (Incremental_binary::file_has_changed): New function.
888 (Incremental_binary::get_input_argument): New function.
889 (Incremental_binary::get_library): New function.
890 (Incremental_binary::get_script_info): New function.
891 (Incremental_binary::init_layout): New function.
892 (Incremental_binary::reserve_layout): New function.
893 (Incremental_binary::output_file): New function.
894 (Incremental_binary::do_check_inputs): New function.
895 (Incremental_binary::do_file_is_unchanged): Remove.
896 (Incremental_binary::do_file_has_changed): New function.
897 (Incremental_binary::do_init_layout): New function.
898 (Incremental_binary::do_reserve_layout): New function.
899 (Incremental_binary::do_input_file_count): New function.
900 (Incremental_binary::do_get_input_reader): Change signature.
901 (Incremental_binary::input_args_map_): New data member.
902 (Incremental_binary::library_map_): New data member.
903 (Incremental_binary::script_map_): New data member.
904 (Sized_incremental_binary::Sized_incremental_binary): Initialize
905 new data members.
906 (Sized_incremental_binary::output_section): New function.
907 (Sized_incremental_binary::inputs_reader): Add const.
908 (Sized_incremental_binary::symtab_reader): Add const.
909 (Sized_incremental_binary::relocs_reader): Add const.
910 (Sized_incremental_binary::got_plt_reader): Add const.
911 (Sized_incremental_binary::get_symtab_view): New function.
912 (Sized_incremental_binary::Inputs_reader): New typedef.
913 (Sized_incremental_binary::Input_entry_reader): New typedef.
914 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
915 (Sized_incremental_binary::do_file_is_unchanged): Remove.
916 (Sized_incremental_binary::do_file_has_changed): New function.
917 (Sized_incremental_binary::do_init_layout): New function.
918 (Sized_incremental_binary::do_reserve_layout): New function.
919 (Sized_input_reader::Inputs_reader): Remove.
920 (Sized_input_reader::Input_entry_reader): Remove.
921 (Sized_input_reader::do_arg_serial): New function.
922 (Sized_input_reader::do_get_unused_symbol_count): New function.
923 (Sized_input_reader::do_get_unused_symbol): New function.
924 (Sized_incremental_binary::do_input_file_count): New function.
925 (Sized_incremental_binary::do_get_input_reader): Change signature;
926 use index instead of filename.
927 (Sized_incremental_binary::section_map_): New data member.
928 (Sized_incremental_binary::input_entry_readers_): New data member.
929 (class Sized_incr_relobj): New class.
930 (class Sized_incr_dynobj): New class.
931 (make_sized_incremental_object): New function.
932 (class Incremental_library): New class.
933 * layout.cc (Free_list::num_lists): New static data member.
934 (Free_list::num_nodes): New static data member.
935 (Free_list::num_removes): New static data member.
936 (Free_list::num_remove_visits): New static data member.
937 (Free_list::num_allocates): New static data member.
938 (Free_list::num_allocate_visits): New static data member.
939 (Free_list::init): New function.
940 (Free_list::remove): New function.
941 (Free_list::allocate): New function.
942 (Free_list::dump): New function.
943 (Free_list::print_stats): New function.
944 (Layout_task_runner::run): Resize output file for incremental updates.
945 (Layout::Layout): Initialize new data members.
946 (Layout::set_incremental_base): New function.
947 (Layout::init_fixed_output_section): New function.
948 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
949 incremental updates.
950 (Layout::create_gold_note): Do not create gold note section for
951 incremental updates.
952 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
953 for incremental updates.
954 (Layout::set_section_offsets): For incremental updates, allocate space
955 from free list.
956 (Layout::create_symtab_sections): Layout with offsets relative to
957 start of section; for incremental updates, allocate space from free
958 list.
959 (Layout::create_shdrs): For incremental updates, allocate space from
960 free list.
961 (Layout::finish_dynamic_section): For incremental updates, do not
962 check --as-needed (fixed in subsequent patch).
963 * layout.h (class Free_list): New class.
964 (Layout::set_incremental_base): New function.
965 (Layout::incremental_base): New function.
966 (Layout::init_fixed_output_section): New function.
967 (Layout::allocate): New function.
968 (Layout::incremental_base_): New data member.
969 (Layout::free_list_): New data member.
970 * main.cc (main): Print Free_list statistics.
971 * object.cc (Relobj::finalize_incremental_relocs): Add
972 clear_counts parameter; clear counts only when clear_counts is set.
973 (Sized_relobj::Sized_relobj): Initialize new base class.
974 (Sized_relobj::do_layout): Don't report special sections.
975 (Sized_relobj::do_for_all_local_got_entries): New function.
976 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
977 symtab_off to all symbol table offsets.
978 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
979 * object.h (class Got_offset_list): Move to top of file.
980 (Object::Object): Allow case where input_file == NULL.
981 (Object::~Object): Likewise.
982 (Object::input_file): Assert that input_file != NULL.
983 (Object::lock): Allow case where input_file == NULL.
984 (Object::unlock): Likewise.
985 (Object::is_locked): Likewise.
986 (Object::token): Likewise.
987 (Object::release): Likewise.
988 (Object::is_incremental): New function.
989 (Object::get_mtime): New function.
990 (Object::for_all_local_got_entries): New function.
991 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
992 (Object::set_is_in_system_directory): New function.
993 (Object::is_in_system_directory): New function.
994 (Object::do_is_incremental): New function.
995 (Object::do_get_mtime): New function.
996 (Object::do_for_all_local_got_entries): New function.
997 (Object::is_in_system_directory_): New data member.
998 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
999 (class Sized_relobj_base): New class.
1000 (class Sized_relobj): Derive from Sized_relobj_base.
1001 (class Sized_relobj::Symbols): Redeclare from base class.
1002 (class Sized_relobj::local_got_offset_list): Remove.
1003 (class Sized_relobj::Output_sections): Redeclare from base class.
1004 (class Sized_relobj::do_for_all_local_got_entries): New function.
1005 (class Sized_relobj::write_local_symbols): Add offset parameter.
1006 (class Sized_relobj::local_symbol_offset_): Update comment.
1007 (class Sized_relobj::local_dynsym_offset_): Update comment.
1008 * options.cc (Input_arguments::add_file): Remove const.
1009 * options.h (Input_file_argument::Input_file_argument):
1010 Initialize arg_serial_ (all constructors).
1011 (Input_file_argument::set_arg_serial): New function.
1012 (Input_file_argument::arg_serial): New function.
1013 (Input_file_argument::arg_serial_): New data member.
1014 (Input_arguments::Input_arguments): Initialize file_count_.
1015 (Input_arguments::add_file): Remove const.
1016 (Input_arguments::number_of_input_files): New function.
1017 (Input_arguments::file_count_): New data member.
1018 (Command_line::number_of_input_files): Call
1019 Input_arguments::number_of_input_files.
1020 * output.cc (Output_segment_headers::Output_segment_headers):
1021 Set current size.
1022 (Output_section::Input_section::current_data_size): New function.
1023 (Output_section::Output_section): Initialize new data members.
1024 (Output_section::add_input_section): Don't do merge sections for
1025 an incremental link; allocate space from free list for an
1026 incremental update.
1027 (Output_section::add_output_section_data): Allocate space from
1028 free list for an incremental update.
1029 (Output_section::update_data_size): New function.
1030 (Output_section::set_fixed_layout): New function.
1031 (Output_section::reserve): New function.
1032 (Output_segment::set_section_addresses): Remove const.
1033 (Output_segment::set_section_list_addresses): Remove const; allocate
1034 space from free list for an incremental update.
1035 (Output_segment::set_offset): Adjust size of RELRO segment for an
1036 incremental update.
1037 * output.h (Output_data::current_data_size): Move here from
1038 child classes.
1039 (Output_data::pre_finalize_data_size): New function.
1040 (Output_data::update_data_size): New function.
1041 (Output_section_headers::update_data_size): new function.
1042 (Output_section_data_build::current_data_size): Move to Output_data.
1043 (Output_data_strtab::update_data_size): New function.
1044 (Output_section::current_data_size): Move to Output_data.
1045 (Output_section::set_fixed_layout): New function.
1046 (Output_section::has_fixed_layout): New function.
1047 (Output_section::reserve): New function.
1048 (Output_section::update_data_size): New function.
1049 (Output_section::has_fixed_layout_): New data member.
1050 (Output_section::free_list_): New data member.
1051 (Output_segment::set_section_addresses): Remove const.
1052 (Output_segment::set_section_list_addresses): Remove const.
1053 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1054 New function.
1055 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1056 New function.
1057 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1058 parameter when calling Add_symbols constructor; store argument
1059 serial number for members of a lib group.
1060 (Add_symbols::locks): Allow case where token == NULL.
1061 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1062 (Read_member::~Read_member): New function.
1063 (Read_member::is_runnable): New function.
1064 (Read_member::locks): New function.
1065 (Read_member::run): New function.
1066 (Check_script::~Check_script): New function.
1067 (Check_script::is_runnable): New function.
1068 (Check_script::locks): New function.
1069 (Check_script::run): New function.
1070 (Check_library::~Check_library): New function.
1071 (Check_library::is_runnable): New function.
1072 (Check_library::locks): New function.
1073 (Check_library::run): New function.
1074 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1075 (Add_symbols::library_): New data member.
1076 (class Read_member): New class.
1077 (class Check_script): New class.
1078 (class Check_library): New class.
1079 * reloc.cc (Read_relocs::is_runnable): Allow case where
1080 token == NULL.
1081 (Read_relocs::locks): Likewise.
1082 (Scan_relocs::locks): Likewise.
1083 (Relocate_task::locks): Likewise.
1084 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1085 to clear counters.
1086 (Sized_relobj::incremental_relocs_scan): Fix comment.
1087 (Sized_relobj::do_relocate): Pass output file offset to
1088 write_local_symbols.
1089 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1090 from class declaration.
1091 * script.cc (read_input_script): Allocate Script_info; pass
1092 argument serial number to report_script.
1093 * script.h (class Script_info): Move to incremental.h.
1094 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1095 * symtab.h (Symbol_table::add_from_incrobj): New function.
1096 (Symbol_table::set_file_offset): New function.
1097
b961d0d7
CC
10982011-04-05 Cary Coutant <ccoutant@google.com>
1099
1100 * incremental-dump.cc (dump_incremental_inputs): Change signature
1101 to take a Sized_incremental_binary; change caller. Use readers
1102 in Sized_incremental_binary.
1103 * incremental.cc
1104 (Sized_incremental_binary::find_incremental_inputs_sections):
1105 Rename do_find_incremental_inputs_sections to this.
1106 (Sized_incremental_binary::setup_readers): New function.
1107 (Sized_incremental_binary::do_check_inputs): Check
1108 has_incremental_info_ flag; move setup code to setup_readers;
1109 use input readers.
1110 (Sized_incremental_binary::do_file_is_unchanged): New function.
1111 (Sized_incremental_binary::do_get_input_reader): New function.
1112 * incremental.h (class Incremental_binary): Move to end of file.
1113 (Incremental_binary::file_is_unchanged): New function.
1114 (Incremental_binary::do_file_is_unchanged): New function.
1115 (Incremental_binary::Input_reader): New class.
1116 (Incremental_binary::get_input_reader): New function.
1117 (class Sized_incremental_binary): Move to end of file.
1118 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1119 input section reader classes.
1120 (Sized_incremental_binary::has_incremental_info): New function.
1121 (Sized_incremental_binary::inputs_reader): New function.
1122 (Sized_incremental_binary::symtab_reader): New function.
1123 (Sized_incremental_binary::relocs_reader): New function.
1124 (Sized_incremental_binary::got_plt_reader): New function.
1125 (Sized_incremental_binary::do_file_is_unchanged): New function.
1126 (Sized_incremental_binary::Sized_input_reader): New class.
1127 (Sized_incremental_binary::get_input_reader): New function.
1128 (Sized_incremental_binary::find_incremental_inputs_sections):
1129 Rename do_find_incremental_inputs_sections to this.
1130 (Sized_incremental_binary::setup_readers): New function.
1131 (Sized_incremental_binary::has_incremental_info_): New data member.
1132 (Sized_incremental_binary::inputs_reader_): New data member.
1133 (Sized_incremental_binary::symtab_reader_): New data member.
1134 (Sized_incremental_binary::relocs_reader_): New data member.
1135 (Sized_incremental_binary::got_plt_reader_): New data member.
1136 (Sized_incremental_binary::current_input_file_): New data member.
1137
a869183f
PP
11382011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1139
1140 PR gold/12640
1141 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1142 violation.
1143
11442011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
1145
1146 * archive.cc (Archive::include_member): Adjust call to report_object.
1147 (Add_archive_symbols::run): Add script_info to call to
1148 report_archive_begin.
1149 (Lib_group::include_member): Adjust call to report_object.
1150 (Add_lib_group_symbols::run): Adjust call to report_object.
1151 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1152 blocks. Add object count for script input files.
1153 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1154 script_info parameter; change all callers.
1155 (Incremental_inputs::report_object): Add script_info parameter;
1156 change all callers.
1157 (Incremental_inputs::report_script): Store backpointer to
1158 incremental info entry.
1159 (Output_section_incremental_inputs::set_final_data_size): Record
1160 additional information for scripts.
1161 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1162 * incremental.h (Incremental_script_entry::add_object): New function.
1163 (Incremental_script_entry::get_object_count): New function.
1164 (Incremental_script_entry::get_object): New function.
1165 (Incremental_script_entry::objects_): New data member; adjust
1166 constructor.
1167 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1168 (Incremental_inputs::report_object): Add script_info parameter.
1169 (Incremental_inputs_reader::get_object_count): New function.
1170 (Incremental_inputs_reader::get_object_offset): New function.
1171 * options.cc (Input_arguments::add_file): Return reference to
1172 new input argument.
1173 * options.h (Input_argument::set_script_info): New function.
1174 (Input_argument::script_info): New function.
1175 (Input_argument::script_info_): New data member; adjust all
1176 constructors.
1177 (Input_file_group::add_file): Return reference to new input argument.
1178 (Input_file_lib::add_file): Likewise.
1179 (Input_arguments::add_file): Likewise.
1180 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1181 * script.cc (Parser_closure::Parser_closure): Add script_info
1182 parameter; adjust all callers.
1183 (Parser_closure::script_info): New function.
1184 (Parser_closure::script_info_): New data member.
1185 (read_input_script): Report scripts earlier to incremental info.
1186 (script_add_file): Set script_info in Input_argument.
1187 (script_add_library): Likewise.
1188 * script.h (Script_options::Script_info): Rewrite class.
1189
a869183f 11902011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
1191
1192 * archive.cc (Library_base::should_include_member): Move
1193 method here from class Archive.
1194 (Archive::Archive): Initialize base class.
1195 (Archive::should_include_member): Move to base class.
1196 (Archive::do_for_all_unused_symbols): New function.
1197 (Add_archive_symbols::run): Remove redundant access to
1198 incremental_inputs.
1199 (Lib_group::Lib_group): Initialize base class.
1200 (Lib_group::do_filename): New function.
1201 (Lib_group::include_member): Pass pointer to Lib_group to
1202 report_object.
1203 (Lib_group::do_for_all_unused_symbols): New function.
1204 (Add_lib_group_symbols::run): Report archive information for
1205 incremental links.
1206 * archive.h (class Library_base): New base class.
1207 (class Archive): Derive from Library_base.
1208 (Archive::filename): Move to base class.
1209 (Archive::set_incremental_info): Likewise.
1210 (Archive::incremental_info): Likewise.
1211 (Archive::Should_include): Likewise.
1212 (Archive::should_include_member): Likewise.
1213 (Archive::Armap_entry): Remove.
1214 (Archive::Unused_symbol_iterator): Remove.
1215 (Archive::unused_symbols_begin): Remove.
1216 (Archive::unused_symbols_end): Remove.
1217 (Archive::do_filename): New function.
1218 (Archive::do_get_mtime): New function.
1219 (Archive::do_for_all_unused_symbols): New function.
1220 (Archive::task_): Move to base class.
1221 (Archive::incremental_info_): Likewise.
1222 (class Lib_group): Derive from Library_base.
1223 (Lib_group::do_filename): New function.
1224 (Lib_group::do_get_mtime): New function.
1225 (Lib_group::do_for_all_unused_symbols): New function.
1226 (Lib_group::task_): Move to base class.
1227 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1228 function.
1229 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1230 function.
1231 * incremental.cc (Incremental_inputs::report_archive_begin):
1232 Use Library_base; call library's get_mtime; add incremental inputs
1233 entry before members.
1234 (class Unused_symbol_visitor): New class.
1235 (Incremental_inputs::report_archive_end): Use Library_base; use
1236 visitor class to record unused symbols; don't add incremental inputs
1237 entry after members.
1238 (Incremental_inputs::report_object): Use Library_base.
1239 * incremental.h
1240 (Incremental_archive_entry::Incremental_archive_entry): Remove
1241 unused Archive parameter.
1242 (Incremental_inputs::report_archive_begin): Use Library_base.
1243 (Incremental_inputs::report_archive_end): Likewise.
1244 (Incremental_inputs::report_object): Likewise.
1245 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1246 function.
1247 * object.h (Object::for_all_global_symbols): New function.
1248 (Object::do_for_all_global_symbols): New function.
1249 (Sized_relobj::do_for_all_global_symbols): New function.
1250 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1251 function.
1252 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1253 function.
1254
61ab3e40
ILT
12552011-03-27 Ian Lance Taylor <iant@google.com>
1256
1257 * archive.cc (Archive::interpret_header): Return -1 if something
1258 goes wrong. Change callers accordingly.
1259
30e1f9e6
CC
12602011-03-25 Cary Coutant <ccoutant@google.com>
1261
1262 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1263 * testsuite/Makefile.in: Regenerate.
1264
9c793f14
RÁE
12652010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1266
1267 * plugin.cc (get_view): New.
1268 (Plugin::load): Pass get_view to the plugin.
1269 (Plugin_manager::get_view): New.
1270
9312bb0a
ILT
12712011-03-21 Ian Lance Taylor <iant@google.com>
1272
1273 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 1274 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 1275
7e12ba9e
ST
12762011-03-21 Sriraman Tallam <tmsriram@google.com>
1277
1278 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1279 Change == to -eq.
1280 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1281 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1282 Change == to -eq.
1283 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1284 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1285
fd7a005d
ILT
12862011-03-14 Ian Lance Taylor <iant@google.com>
1287
1288 * script-sections.cc (Sort_output_sections::script_compare):
1289 Rename from is_before, change return type.
1290 (Sort_output_sections::operator()): Adjust accordingly.
1291
ed16fd1b
ILT
12922011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1293
1294 PR gold/12572
1295 * testsuite/odr_violation2.cc: Add comment to make all error line
1296 numbers double digits.
1297 * testsuite/debug_msg.sh: Adjust expected errors.
1298
71ff8986
ILT
12992011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1300
1301 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1302 but mark earlier ones as non-canonical
1303 (offset_to_iterator): Update search target and example
1304 (do_addr2line): Return extra lines in a vector*
1305 (format_file_lineno): Extract from do_addr2line
1306 (one_addr2line): Add vector* out-param
1307 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1308 when a lineno entry appeared last for its instruction
1309 (Dwarf_line_info): Add vector* out-param
1310 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1311 * symtab.cc (Odr_violation_compare): Include the lineno in the
1312 comparison again.
1313 (linenos_from_loc): New. Combine the canonical line for an
1314 address with its other lines.
1315 (True_if_intersect): New. Helper functor to make
1316 std::set_intersection a query.
1317 (detect_odr_violations): Compare sets of lines instead of just
1318 one line for each function. This became less deterministic, but
1319 has fewer false positives.
1320 * symtab.h: Declarations.
1321 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1322 mix an optimized and non-optimized object in the same binary
1323 (odr_violation2.so): Same.
1324 * testsuite/Makefile.in: Regenerate from Makefile.am.
1325 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1326 * testsuite/debug_msg.sh: Update line numbers and add
1327 assertions.
1328 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1329 non-optimized context.
1330 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1331 isn't inlined, and use OdrDerived in an optimized context.
1332 * testsuite/odr_header1.h: Defines OdrDerived, where
1333 optimization will change the
1334 first-instruction-in-the-destructor's file and line number.
1335 * testsuite/odr_header2.h: Defines OdrBase.
1336
a19fefdc
ILT
13372011-03-09 Ian Lance Taylor <iant@google.com>
1338
1339 * fileread.cc (File_read::clear_views): Don't delete the whole
1340 file view.
1341
ecb351e9
ILT
13422011-03-08 Ian Lance Taylor <iant@google.com>
1343
1344 PR gold/12525
1345 * fileread.cc: #include <climits>.
1346 (GOLD_IOV_MAX): Define.
1347 (File_read::read_multiple): Limit number of entries by iov_max.
1348 * fileread.h (class File_read): Always set max_readv_entries to
1349 128.
1350
b821d13c
ILT
13512011-03-07 Ian Lance Taylor <iant@google.com>
1352
1353 PR gold/12525
1354 * options.h (class General_options): Add -dy and -dn.
1355
89243142
CC
13562011-03-02 Cary Coutant <ccoutant@google.com>
1357
1358 * testsuite/script_test_9.t: Add TLS segment.
1359
d0773f31
ILT
13602011-03-02 Simon Baldwin <simonb@google.com>
1361
1362 * configure.ac: Add check for gnu_indirect_function support in
1363 the toolchain building binutils.
1364 * configure: Rebuild.
1365
badc8139
RÁE
13662010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1367
1368 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1369 plugin only symbols.
1370 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1371 in plugin files as not needed in the symbol table.
1372
4cf7a849
ST
13732011-02-11 Sriraman Tallam <tmsriram@google.com>
1374
1375 * output.cc (Output_section::add_input_section): Delay fill
1376 generation for section ordering.
1377
b578bd7d
ILT
13782011-02-09 Ian Lance Taylor <iant@google.com>
1379
1380 PR gold/12316
1381 * object.h (class Sized_relobj): Remove clear_local_symbols.
1382 * reloc.cc (Sized_relobj::do_relocate): Don't call
1383 clear_local_symbols.
1384
84ced98a
RÁE
13852010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1386
1387 * plugin.cc (is_visible_from_outside): Return true for symbols
1388 in the -u option.
1389
55382fb7
ILT
13902011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1391
1392 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1393 filename.
1394
4e271fff
ST
13952011-02-02 Sriraman Tallam <tmsriram@google.com>
1396
1397 * icf.h (is_section_foldable_candidate): Change type of parameter
1398 to std::string.
1399 * icf.cc (Icf::find_identical_sections): Change type of local variable
1400 section_name to be std::string.
1401 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1402
d433c3ac
ILT
14032011-01-25 Ian Lance Taylor <iant@google.com>
1404
1405 * script.cc (script_add_extern): Rewrite to use
1406 add_symbol_reference.
1407
880473a6
DK
14082011-01-25 Doug Kwan <dougkwan@google.com>
1409
d433c3ac 1410 * icf.cc (get_section_contents): Always lock section's object.
880473a6 1411
f30f86fa
ILT
14122011-01-24 Ian Lance Taylor <iant@google.com>
1413
1414 * options.h (class General_options): Accept
1415 --no-detect-odr-violations.
1416
8e51a0b9
ILT
14172011-01-24 Ian Lance Taylor <iant@google.com>
1418
1419 * version.cc (version_string): Bump to 1.11.
1420
0f3b89d8
ILT
14212011-01-24 Ian Lance Taylor <iant@google.com>
1422
1423 * plugin.cc (class Plugin_rescan): Define new class.
1424 (Plugin_manager::claim_file): Set any_claimed_.
1425 (Plugin_manager::save_archive): New function.
1426 (Plugin_manager::save_input_group): New function.
1427 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1428 necessary.
1429 (Plugin_manager::new_undefined_symbol): New function.
1430 (Plugin_manager::rescan): New function.
1431 (Plugin_manager::rescannable_defines): New function.
1432 (Plugin_manager::add_input_file): Set any_added_.
1433 * plugin.h (class Plugin_manager): define new fields rescannable_,
1434 undefined_symbols_, any_claimed_, and any_added_. Declare
1435 Plugin_rescan as friend. Declare new functions.
1436 (Plugin_manager::Rescannable): Define type.
1437 (Plugin_manager::Rescannable_list): Define type.
1438 (Plugin_manager::Undefined_symbol_list): Define type.
1439 (Plugin_manager::Plugin_manager): Initialize new fields.
1440 * archive.cc (Archive::defines_symbol): New function.
1441 (Add_archive_symbols::run): Pass archive to plugins if any.
1442 * archive.h (class Archive): Declare defines_symbol.
1443 * readsyms.cc (Input_group::~Input_group): New function.
1444 (Finish_group::run): Pass input_group to plugins if any.
1445 * readsyms.h (class Input_group): Declare destructor.
1446 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1447 any.
1448
3bb951e5
ILT
14492011-01-10 Ian Lance Taylor <iant@google.com>
1450
1451 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1452 section as relro.
1453 (Layout::set_segment_offsets): Reset increase_relro before calling
1454 set_section_addresses a second time.
1455
0aa45fac
CC
14562011-01-04 Cary Coutant <ccoutant@google.com>
1457
1458 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1459 sections before NOBITS sections.
1460
0db46eb4
L
14612011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1462
1463 * version.cc (print_version): Update copyright to 2011.
1464
829c9745
CC
14652010-12-23 Cary Coutant <ccoutant@google.com>
1466
1467 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1468 of OS to this->add. Add OD parameter to second form of the function.
1469
7500420b
ILT
14702010-12-20 Ian Lance Taylor <iant@google.com>
1471
1472 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1473 second of two consecutive entries with same offset.
1474
f8e9a930
RW
14752010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1476
1477 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1478 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1479 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1480 to avoid unneeded links against $(LDADD).
1481 * testsuite/Makefile.in: Regenerate.
1482
2fbb4320
ILT
14832010-12-15 Ian Lance Taylor <iant@google.com>
1484
1485 PR gold/12324
1486 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1487 for R_X86_64_32 and R_X86_64_PC32.
1488 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1489 ver_matching_def_pic.o.
1490 (ver_matching_def_pic.o): New target.
1491
fedb228d
RW
14922010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1493
1494 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1495 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1496 Move definition before File_read::View member definitions.
1497 (File_read::View::~View): Initialize and hold lock before
1498 updating current_mapped_bytes.
1499
9b547ce6
RW
15002010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1501
1502 * dwarf_reader.cc: Remove outdated comment.
1503 * gold-threads.cc: Fix typo in error message.
1504 * archive.cc: Fix typos in comments.
1505 * archive.h: Likewise.
1506 * arm-reloc-property.cc: Likewise.
1507 * arm-reloc-property.h: Likewise.
1508 * arm-reloc.def: Likewise.
1509 * arm.cc: Likewise.
1510 * attributes.h: Likewise.
1511 * cref.cc: Likewise.
1512 * ehframe.cc: Likewise.
1513 * fileread.h: Likewise.
1514 * gold.h: Likewise.
1515 * i386.cc: Likewise.
1516 * icf.cc: Likewise.
1517 * incremental.h: Likewise.
1518 * int_encoding.cc: Likewise.
1519 * layout.h: Likewise.
1520 * main.cc: Likewise.
1521 * merge.h: Likewise.
1522 * object.cc: Likewise.
1523 * object.h: Likewise.
1524 * options.cc: Likewise.
1525 * readsyms.cc: Likewise.
1526 * reduced_debug_output.cc: Likewise.
1527 * reloc.cc: Likewise.
1528 * script-sections.cc: Likewise.
1529 * sparc.cc: Likewise.
1530 * symtab.h: Likewise.
1531 * target-reloc.h: Likewise.
1532 * target.cc: Likewise.
1533 * target.h: Likewise.
1534 * timer.cc: Likewise.
1535 * timer.h: Likewise.
1536 * x86_64.cc: Likewise.
1537
83e17bd5
CC
15382010-12-09 Cary Coutant <ccoutant@google.com>
1539
1540 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1541 stack.
1542 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1543 parameter; change all callers.
1544 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1545 * options.h (warn_execstack): New option.
1546
017257f8
DK
15472010-12-07 Doug Kwan <dougkwan@google.com>
1548
1549 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1550 like function call relocations.
1551
c20cbc06
ILT
15522010-12-07 Ian Lance Taylor <iant@google.com>
1553
1554 * archive.cc (Archive::get_elf_object_for_member): Permit
1555 punconfigured to be NULL.
1556 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1557 (Archive::include_member): Pass NULL to get_elf_object_for_member
1558 if we searched for the archive and this is the first included
1559 object.
1560
4dbfafcc
ILT
15612010-12-01 Ian Lance Taylor <iant@google.com>
1562
1563 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1564 track_relocs_type_ field.
1565 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1566 Set track_relocs_type_.
1567 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1568 contents when using RELA relocs.
1569 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1570 reloc_map_.
1571 * reloc.cc (Track_relocs::next_addend): New function.
1572 * reloc.h (class Track_relocs): Declare next_addend.
1573
e5e19edd
ILT
15742010-12-01 Ian Lance Taylor <iant@google.com>
1575
1576 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1577 virtual destructor.
1578
9a5ce24c
ILT
15792010-12-01 Ian Lance Taylor <iant@google.com>
1580
1581 * README: Update compilers known to work and fail.
1582
c7791212
NC
15832010-11-23 Matthias Klose <doko@ubuntu.com>
1584
1585 * configure.in: For --enable-gold, handle value `default' instead of
1586 `both*'. Always install ld as ld.bfd, install as ld if gold is
1587 not the default.
1588 * configure: Regenerate.
1589
0ad220c9
DK
15902010-11-18 Doug Kwan <dougkwan@google.com>
1591
1592 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1593 and right_alignment to be zero. Store result alignment only if it is
1594 greater than existing alignment.
1595
ab8056e0
CC
15962010-11-16 Cary Coutant <ccoutant@google.com>
1597
1598 PR gold/12220
1599 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1600 Check for ".zdebug_line".
1601
fd064a5b
CC
16022010-11-16 Doug Kwan <dougkwan@google.com>
1603 Cary Coutant <ccoutant@google.com>
1604
1605 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1606 by reference; adjust all callers.
1607 * output.cc (Output_segment::set_section_addresses): Adjust references
1608 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1609 list is empty.
1610 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1611 end at page boundary.
1612
6fc6ea19
CC
16132010-11-16 Cary Coutant <ccoutant@google.com>
1614
1615 PR gold/12220
1616 * layout.cc (Layout::choose_output_section): Transform names of
1617 compressed sections even when using a script with a SECTIONS clause.
1618 (Layout::output_section_name): Remove code to transform
1619 compressed debug section names.
1620 * output.cc (Output_section::add_input_section): Use uncompressed
1621 section size when tracking input sections.
1622
95a2c8d6
RS
16232010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1624
1625 * symtab.h (Symbol::NON_PIC_REF): Remove.
1626 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1627 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1628 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1629 (Symbol::use_plt_offset): Take a flags argument and pass it
1630 directly to needs_dynamic_reloc. Restrict check for undefined
1631 weak symbols to function calls.
1632 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1633 (Target_arm::Scan::global): Use it.
1634 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1635 (Target_arm::Relocate::relocate): Likewise.
1636 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1637 parameter with an r_type parameter. Use get_reference_flags
1638 to get the flags.
1639 (Target_arm::Relocate::relocate): Update accordingly.
1640 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1641 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1642 (Target_i386::Scan::global): Likewise.
1643 (Target_i386::Relocate::relocate): Likewise.
1644 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1645 parameter with an r_type parameter. Use get_reference_flags
1646 to get the flags.
1647 (Target_i386::Relocate::relocate): Update accordingly.
1648 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1649 (Target_powerpc::Scan::global): Use it.
1650 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1651 (Target_powerpc::Relocate::relocate): Likewise.
1652 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1653 (Target_sparc::Scan::global): Use it.
1654 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1655 (Target_sparc::Relocate::relocate): Likewise.
1656 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1657 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1658 (Target_x86_64::Scan::global): Likewise.
1659 (Target_x86_64::Relocate::relocate): Likewise.
1660
f625ae50
DK
16612010-11-08 Doug Kwan <dougkwan@google.com>
1662 Cary Coutant <ccoutant@google.com>
1663
1664 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1665 (Arm_exidx_merge_section::section_contents_): New data member.
1666 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1667 (Arm_input_section::~Arm_input_section): De-allocate memory.
1668 (Arm_input_section::original_contents_): New data member.
1669 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1670 in parameters instead of calling Object::section_contents without
1671 locking.
1672 (Arm_output_section::group_section): New parameter TASK. Pass it
1673 to callees that need locking objects.
1674 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1675 to lock EXIDX input sections. Fix a formatting issue. Call
1676 Arm_exidx_merged_section::build_contents to create merged section
1677 contents.
1678 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1679 to lock object of stub table owner.
1680 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1681 TEXT_SIZE to initialize data member TEXT_SIZE_.
1682 (Arm_exidx_input_section::addralign): Fix typo in comment.
1683 (Arm_exidx_input_section::text_size): New method.
1684 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1685 that require locking objects. Lock objects before scanning for stubs
1686 and updating local symbols.
1687 (Arm_input_section<big_endian>::init): Copy contents of original
1688 input section.
1689 (Arm_input_section<big_endian>::do_write): Use saved contents of
1690 original input section instead of calling Object::section_contents
1691 without locking.
1692 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1693 size without calling Object::section_size().
1694 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1695 for size. Allocate a buffer for merged EXIDX entries.
1696 (Arm_exidx_merged_section::build_contents): New method.
1697 (Arm_exidx_merged_section::do_write): Move merge section contents
1698 building code to Arm_exidx_merged_section::build_contetns. Write
1699 out contetns in buffer instead of building it on the fly.
1700 (Arm_relobj::make_exidx_input_section): Also pass text section size
1701 to Arm_exidx_input_section constructor.
1702 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1703 (Arm_dynobj::do_read_symbols): Fix memory leak.
1704 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1705 * target.h: (class Task): Add forward declaration.
1706 (Target::relax): Add new parameter TASK and pass it to
1707 Target::do_relax().
1708 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1709
5f9bcf58
CC
17102010-11-05 Cary Coutant <ccoutant@google.com>
1711
1712 PR gold/10708
1713 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1714 object when reading from the file.
1715 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1716 second layout pass.
1717 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1718 when reading section contents.
1719 (get_section_contents): Likewise.
1720 (icf::find_identical_sections): Likewise.
1721 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1722 object when reading from the file.
1723 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1724 the object when doing deferred section layout.
1725
e597fa08
NC
17262010-11-03 Nick Clifton <nickc@redhat.com>
1727
1728 PR gold/12001
1729 * script.h (class Symbol_assignment: name): New member. Returns
1730 the name of the symbol.
1731 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1732 Returns true if the given symbol name is on the list of
1733 assignments wating to be processed.
1734 * archive.cc (should_incldue_member): If the symbol is undefined,
1735 check to see if it is on the list of symbols pending assignment.
1736
3f9a3278
ILT
17372010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1738
1739 * script-sections.cc (Script_sections::find_memory_region): Check
1740 for a NULL output section pointer.
1741
d06fb4d1
DK
17422010-10-29 Doug Kwan <dougkwan@google.com>
1743
1744 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1745 Output_section::add_relaxed_input_section.
1746 * output.cc (Output_section::add_relaxed_input_section): Add new
1747 arguments LAYOUT and NAME. Set section order index.
1748 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1749 Copy section order index.
1750 * output.h (Output_section::add_relaxed_input_section): Add new
1751 arguments LAYOUT and NAME.
1752
90e24de5
ILT
17532010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1754
1755 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1756 NATIVE_OR_CROSS_LINKER.
1757 * testsuite/Makefile.in: Regenerate.
1758
c9484ea5
DK
17592010-10-20 Doug Kwan <dougkwan@google.com>
1760
1761 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1762 without SHF_LINK_ORDER flags.
1763 * layout.cc (Layout::choose_output_section): Do not filter
1764 SHF_LINK_ORDER flag in a relocatable link.
1765
5bc2f5be
CC
17662010-10-17 Cary Coutant <ccoutant@google.com>
1767
1768 * output.h (Output_segment::set_section_addresses): Change function
1769 signature. Update all callers.
1770 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1771 sections.
1772 (Output_segment::set_section_addresses): Align after last TLS
1773 section. Add padding before last relro section instead of after.
1774
0c91cf04
DK
17752010-10-17 Doug Kwan <dougkwan@google.com>
1776
1777 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1778 GOT output section to be writable.
1779
8c21d9d3
CC
17802010-10-14 Cary Coutant <ccoutant@google.com>
1781
1782 * debug.h (DEBUG_INCREMENTAL): New flag.
1783 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1784 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1785 mode.
1786 * incremental.cc (report_command_line): Ignore all forms of
1787 --incremental.
1788 * layout.cc (Layout::Layout): Check parameters for incremental link
1789 mode.
1790 * options.cc (General_options::parse_incremental): New function.
1791 (General_options::parse_no_incremental): New function.
1792 (General_options::parse_incremental_full): New function.
1793 (General_options::parse_incremental_update): New function.
1794 (General_options::incremental_mode_): New data member.
1795 (General_options::finalize): Check incremental_mode_.
1796 * options.h (General_options): Update help text for --incremental.
1797 Add --no-incremental, --incremental-full, --incremental-update.
1798 (General_options::Incremental_mode): New enum type.
1799 (General_options::incremental_mode): New function.
1800 (General_options::incremental_mode_): New data member.
1801 * parameters.cc (Parameters::incremental_mode_): New data member.
1802 (Parameters::set_options): Set incremental_mode_.
1803 (Parameters::set_incremental_full): New function.
1804 (Parameters::incremental): New function.
1805 (Parameters::incremental_update): New function.
1806 (set_parameters_incremental_full): New function.
1807 * parameters.h (Parameters::set_incremental_full): New function.
1808 (Parameters::incremental): New function.
1809 (Parameters::incremental_update): New function.
1810 (Parameters::incremental_mode_): New data member.
1811 (set_parameters_incremental_full): New function.
1812 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1813 incremental link mode.
1814 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1815 (Sized_relobj::do_relocate_sections): Likewise.
1816 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1817 option.
1818 * testsuite/Makefile.in: Regenerate.
1819 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1820
bb32aa18 18212010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
1822
1823 * script-sections.h (class Script_sections): Make
1824 Sections_elements typedef public.
1825 * script-sections.cc (class Sort_output_sections): Add elements_
1826 field. Add constructor which sets it; change all callers.
1827 (Sort_output_sections::is_before): New function.
1828 (Sort_output_sections::operator()): Call is_before.
1829 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1830 conditional.
1831 * testsuite/script_test_10.sh: New test. Test script section
1832 order.
1833 * testsuite/script_test_10.t: Likewise.
1834 * testsuite/script_test_10.s: Likewise.
1835 * testsuite/Makefile.am: Wrap the cross linker tests and the
1836 common tests into NATIVE_OR_CROSS_LINKER.
1837 (check_SCRIPTS): Add script_test_10.sh.
1838 (check_DATA): Add script_test_10.stdout.
1839 (script_test_10.o, script_test_10): New targets.
1840 (script_test_10.stdout): New target.
1841 * configure, testsuite/Makefile.in: Regenerate.
1842
3cef7179
ILT
18432010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1844
1845 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1846 error for the deprecated relocations.
1847 (Target_arm::Scan::global): Likewise.
1848 (Target_arm::Relocate::relocate): Likewise.
1849
7411e9a8
RS
18502010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1851
1852 * fileread.cc (Input_file::find_file): Initialize *found_name
1853 and *namep when using the fallback search for case 4.
1854
6a9da32a
CC
18552010-10-11 Cary Coutant <ccoutant@google.com>
1856
1857 * options.h (class General_options): Redefine -z lazy as an alias for
1858 the negation of -z now.
1859
ac897c20
ILT
18602010-10-11 Ian Lance Taylor <iant@google.com>
1861
1862 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1863 binding.
1864
ea5cae92
NC
18652010-10-06 Nick Clifton <nickc@redhat.com>
1866
1867 * script-sections.cc(class Memory_region): Remove
1868 current_lma_offset_ field. Rename current_vma_offset_ to
1869 current_offset_. Add last_section_ field.
1870 (Memory_region::get_current_vma_address): Rename to
1871 get_current_address.
1872 (Memory_region::get_current_lma_address): Delete.
1873 (Memory_region::increment_vma_offset): Rename to
1874 increment_offset.
1875 (Memory_region::increment_lma_offset): Delete.
1876 (Memory_region::attributes_compatible): New method. Returns
1877 true if the provided section is compatible with the region.
1878 (Memory_region::get_last_section): New method. Returns the last
1879 section to use the region.
1880 (Memory_region::set_last_section): New method. Stores the last
1881 section to use the region.
1882 (Script_sections::block_in_region): New method. Returns true if
1883 a block of memory is contained within a region.
1884 (Script_sections::find_memory_region): New method. Locates a
1885 memory region to be used to set a VMA or LMA address.
1886 (Output_section_definition::set_section_addresses): Add code to
1887 check for addresses set by memory regions.
1888 (Output_segment::set_section_addresses): Remove memory region
1889 walking code.
1890 (Script_sections::create_segment): Add a warning if a header
1891 segment is created outside of any region.
1892 * script-sections.h (class Script_sections): Add prototypes for
1893 find_memory_region and block_in_region methods.
1894 * testsuite/memory_test.s: Use .long instead of .word.
1895 * testsuite/memory_test.t: Add some more output sections.
1896 * testsuite/memory_test.sh: Update expected output.
1897
a9bfd952
DK
18982010-10-02 Doug Kwan <dougkwan@google.com>
1899
1900 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1901 defintion to symtab.h
1902 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1903 declaration to defintion.
1904
bacff3ab
NC
19052010-10-01 Nick Clifton <nickc@redhat.com>
1906
1907 * expression.cc (eval): Replace dummy argument with NULL.
1908 (eval_maybe_dot): Check for a NULL result section pointer.
1909 (Symbol_expression::value): Likewise.
1910 (Dot_expression::value): Likewise.
1911 (BINARY_EXPRESSION): Likewise.
1912 (Max_expression::value): Likewise.
1913 (Min_expression::value): Likewise.
1914 (Absolute_expression::value): Likewise.
1915 (Addr_expression::value_from_output_section): Likewise.
1916 (Loaddddr_expression::value_from_output_section): Likewise.
1917 (Segment_start_expression::value): Likewise.
1918 * script-sections.cc
1919 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1920 argument with NULL.
1921 (Sections_elememt_dot_assignment::set_section_addresses):
1922 Likewise.
1923 (Output_data_expression::do_write_to_buffer): Likewise.
1924 (Output_section_definition::finalize_symbols): Likewise.
1925 (Output_section_definition::set_section_addresses): Likewise.
1926
f81bc8b5
DK
19272010-09-30 Doug Kwan <dougkwan@google.com>
1928
1929 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1930
c95e9f27
ST
19312010-09-28 Sriraman Tallam <tmsriram@google.com>
1932
1933 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 1934 function.
c95e9f27
ST
1935 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1936 virtual function.
1937 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1938 virtual function.
1939 * icf.cc (get_section_contents): Inline merge sections only when
1940 target allows it.
1941
3cac54d2
RW
19422010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1943
1944 * configure: Regenerate.
1945
2904037a
ILT
19462010-09-17 Ian Lance Taylor <iant@google.com>
1947
1948 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
1949 * testsuite/Makefile.am (memory_test.o): New target.
1950 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1951 memory_test.t.
1952 * testsuite/Makefile.in: Rebuild.
2904037a 1953
bca7fb63
DK
19542010-09-17 Doug Kwan <dougkwan@google.com>
1955
1956 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1957 defintion if relocation uses GOT entries of the symbol.
1958 * testsuite/icf_safe_test.sh: Fix test.
1959 * testsuite/icf_safe_so_test.sh: Fix test.
1960
4ef28648
CC
19612010-09-16 Cary Coutant <ccoutant@google.com>
1962
1963 * script_sections.cc (class Memory_region): Remove "NULL" from
1964 vector initializations.
1965
793990de
CC
19662010-09-15 Cary Coutant <ccoutant@google.com>
1967
1968 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1969 Resolve forwarding symbols.
1970
81e015e2
DK
19712010-09-15 Doug Kwan <dougkwan@google.com>
1972
1973 * gold/testsuite/script_test_3.t: Add ARM special sections.
1974 * gold/testsuite/script_test_4.t: Same.
1975 * gold/testsuite/script_test_5.t: Same.
1976 * gold/testsuite/script_test_6.t: Same.
1977 * gold/testsuite/script_test_7.t: Same.
1978 * gold/testsuite/script_test_7.t: Same.
1979 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1980
36171d64
CC
19812010-09-14 Cary Coutant <ccoutant@google.com>
1982
1983 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1984 (Target_x86_64::Relocate::relocate_tls): Replace check for
1985 saw_tls_block_reloc_ with test for executable section.
1986
d89051bd
CC
19872010-09-12 Cary Coutant <ccoutant@google.com>
1988
1989 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1990 position-independent executables to shared libraries need dynamic
1991 relocations.
1992 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1993 position-independent executables.
1994 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1995 * testsuite/Makefile.in: Regenerate.
1996
fca41f0f
NC
19972010-09-10 Nick Clifton <nickc@redhat.com>
1998
1999 PR gold/11997
2000 * testsuite/memory_test.t: Discard any sections that are not
2001 needed.
2002
6695e4b3
L
20032010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2004
2005 PR gold/11996
2006 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2007 "This::" to work around a bug in gcc 4.2.
2008
2009 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2010
0f72bf6f
RÁE
20112010-09-09 Rafael Espindola <espindola@google.com>
2012
2013 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2014 sections with different PF_X flags in the same segment.
2015 (Layout::find_first_load_seg): Search all segments to find the first
2016 one.
2017 * options.h (rosegment): New.
2018
20192010-09-08 Rafael Espindola <espindola@google.com>
a6577478 2020
05a79166 2021 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 2022
aa98ff75
DK
20232010-09-08 Doug Kwan <dougkwan@google.com>
2024
2025 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2026 (Arm_relobj::do_relocate_sections): Add new parameter for output
2027 file to match the parent.
2028 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2029 of local symbols instead of input values. Update code to track
2030 changes in gold::relocate_section.
2031 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2032 (Sized_relobj::compute_final_local_value_internal): New methods.
2033 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2034 body into private version of Sized_relobj::compute_final_local_value.
2035 Call the inline method.
2036 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2037 merged symbol value if there is one.
2038 (Symbol_value::has_output_value): New method defintiion.
2039 (Sized_relobj::Compute_final_local_value_status): New enum type.
2040 (Sized_relobj::compute_final_local_value): New methods.
2041 (Sized_relobj::compute_final_local_value_internal): New methods.
2042 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2043 and arm_cortex_a8.sh.
2044 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2045 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2046 New tests.
2047 * Makefile.in: Regenerate.
2048 * testsuite/arm_bl_out_of_range.s: Update test.
2049 * testsuite/thumb_bl_out_of_range.s: Ditto.
2050 * testsuite/thumb_blx_out_of_range.s: Ditto.
2051 * testsuite/arm_branch_out_of_range.sh: New file.
2052 * testsuite/arm_cortex_a8.sh: Ditto.
2053 * testsuite/arm_cortex_a8_b.s: Ditto.
2054 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2055 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2056 * testsuite/arm_cortex_a8_bl.s: Ditto.
2057 * testsuite/arm_cortex_a8_blx.s: Ditto.
2058 * testsuite/arm_cortex_a8_local.s: Ditto.
2059 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2060 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2061
05a79166
L
20622010-09-08 Rafael Espindola <espindola@google.com>
2063
2064 * Makefile.am (memory_test.stdout): Run readelf with -W.
2065 * Makefile.in: Regenerate.
2066 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2067 64 bit output.
2068
33dbc701
RÁE
20692010-09-08 Rafael Espindola <espindola@google.com>
2070
2071 * script-sections.cc (Script_sections::add_memory_region): Convert
2072 field precision to int.
2073 * script.cc (script_set_section_region, script_set_section_region):
2074 Convert field precision to int.
2075
731ca54a
RÁE
20762010-09-08 Rafael Espindola <espindola@google.com>
2077
2078 * arm.cc (do_finalize_sections): Create the __exidx_start and
2079 __exdix_end symbols even when the section is missing.
2080
7f8cd844
NC
20812010-09-08 Nick Clifton <nickc@redhat.com>
2082
2083 * README: Remove claim that MEMORY is not supported.
2084 * expression.cc (script_exp_function_origin)
2085 (script_exp_function_length): Move from here to ...
2086 * script.cc: ... here.
2087 (script_set_section_region, script_add_memory)
2088 (script_parse_memory_attr, script_include_directive): New
2089 functions.
2090 * script-sections.cc
2091 (class Memory_region): New class.
2092 (class Output_section_definition): Add set_memory_region,
2093 set_section_vma, set_section_lma and get_section_name methods.
2094 (class Script_Sections): Add add_memory_region,
2095 find_memory_region, find_memory_region_origin,
2096 find_memory_region_length and set_memory_region methods.
2097 Have set_section_addresses method walk the list of set memory
2098 regions.
2099 Extend the print methos to display memory regions.
2100 * script-sections.h: Add prototypes for new methods.
2101 Add enum for MEMORY region attributes.
2102 * yyscript.y: Add support for parsing MEMORY regions.
2103 * script-c.h: Add prototypes for new functions.
2104 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2105 * testsuite/Makefile.in: Regenerate.
2106 * testsuite/memory_test.sh: New script.
2107 * testsuite/memory_test.s: New assembler source file.
2108 * testsuite/memory_test.t: New linker script.
2109
a4649286
DK
21102010-08-27 Doug Kwan <dougkwan@google.com>
2111
2112 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2113 reference override an existing dynamic weak reference.
2114 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2115 * testsuite/Makefile.in: Regenerate.
2116 * testsuite/dyn_weak_ref.sh: New file.
2117 * testsuite/dyn_weak_ref_1.c: Ditto.
2118 * testsuite/dyn_weak_ref_2.c: Ditto.
2119
b56648ad
ILT
21202010-08-27 Ian Lance Taylor <iant@google.com>
2121
2122 * incremental.h (class Incremental_input_entry): Add virtual
2123 destructor.
2124
809313cb
ILT
21252010-08-27 Ian Lance Taylor <iant@google.com>
2126
2127 * testsuite/start_lib_test_3.c: Mark t3 as used.
2128
11e32464
NC
21292010-08-27 Nick Clifton <nickc@redhat.com>
2130
2131 * options.cc (version_script): Fix small typo in previous
2132 whitespace tidyup.
2133
ca09d69a
NC
21342010-08-25 Nick Clifton <nickc@redhat.com>
2135
2136 * archive.cc: Formatting fixes: Remove whitespace between
2137 typename and following asterisk. Remove whitespace between
2138 function name and opening parenthesis.
2139 * archive.h: Likewise.
2140 * arm.cc: Likewise.
2141 * attributes.cc: Likewise.
2142 * attributes.h: Likewise.
2143 * common.cc: Likewise.
2144 * copy-relocs.cc: Likewise.
2145 * dirsearch.h: Likewise.
2146 * dynobj.cc: Likewise.
2147 * ehframe.cc: Likewise.
2148 * ehframe.h: Likewise.
2149 * expression.cc: Likewise.
2150 * fileread.cc: Likewise.
2151 * fileread.h: Likewise.
2152 * gc.h: Likewise.
2153 * gold-threads.cc: Likewise.
2154 * gold.cc: Likewise.
2155 * i386.cc: Likewise.
2156 * icf.h: Likewise.
2157 * incremental-dump.cc: Likewise.
2158 * incremental.cc: Likewise.
2159 * layout.cc: Likewise.
2160 * layout.h: Likewise.
2161 * main.cc: Likewise.
2162 * merge.cc: Likewise.
2163 * merge.h: Likewise.
2164 * object.cc: Likewise.
2165 * object.h: Likewise.
2166 * options.cc: Likewise.
2167 * options.h: Likewise.
2168 * output.cc: Likewise.
2169 * output.h: Likewise.
2170 * plugin.cc: Likewise.
2171 * plugin.h: Likewise.
2172 * powerpc.cc: Likewise.
2173 * reloc.cc: Likewise.
2174 * script-c.h: Likewise.
2175 * script-sections.cc: Likewise.
2176 * script.cc: Likewise.
2177 * stringpool.cc: Likewise.
2178 * symtab.cc: Likewise.
2179 * symtab.h: Likewise.
2180 * target.cc: Likewise.
2181 * timer.cc: Likewise.
2182 * timer.h: Likewise.
2183 * version.cc: Likewise.
2184 * x86_64.cc: Likewise.
2185
b8fa8750
NC
21862010-08-24 Nick Clifton <nickc@redhat.com>
2187
2188 PR 11899
2189 * layout.cc (segment_precedes): Sort segments by their physical
2190 addresses, if they have been set.
2191
9919d93b
CC
21922010-08-23 Cary Coutant <ccoutant@google.com>
2193
2194 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2195 symbols data.
2196 (Lib_group::include_member): Unlock object after deleting its
2197 symbols data.
2198 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2199 the bug fixed here.
2200
97b4be1c
CC
22012010-08-19 Neil Vachharajani <nvachhar@google.com>
2202 Cary Coutant <ccoutant@google.com>
2203
2204 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2205 constructor, and set_blocker.
2206 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2207 readsyms_blocker_.
2208 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2209 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2210 * testsuite/Makefile.am (start_lib_test): New test case.
2211 * testsuite/Makefile.in: Regenerate.
2212 * testsuite/start_lib_test_main.c: New file.
2213 * testsuite/start_lib_test_1.c: New file.
2214 * testsuite/start_lib_test_2.c: New file.
2215 * testsuite/start_lib_test_3.c: New file.
2216
dd0b1884
ILT
22172010-08-19 Ian Lance Taylor <iant@google.com>
2218
2219 * Makefile.in: Rebuild with automake 1.11.1.
2220 * aclocal.m4: Likewise.
2221 * testsuite/Makefile.in: Likewise.
2222
7223e9ca
ILT
22232010-08-19 Ian Lance Taylor <iant@google.com>
2224
2225 PR 10893
2226 * i386.cc (class Output_data_plt_i386): Update declarations.
2227 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2228 local_ifuncs_ fields.
2229 (Target_i386::do_plt_section_for_global): New function.
2230 (Target_i386::do_plt_section_for_local): New function.
2231 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2232 parameter; change all callers. Initialize global_ifuncs_ and
2233 local_ifuncs_. If doing a static link define __rel_iplt_start and
2234 __rel_iplt_end.
2235 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2236 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2237 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2238 symbols.
2239 (Target_i386::make_plt_section): New function, broken out of
2240 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2241 (Target_i386::make_plt_entry): Call make_plt_section.
2242 (Target_i386::make_local_ifunc_plt_entry): New function.
2243 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2244 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2245 R_386_IRELATIVE to switch.
2246 (Target_i386::Scan::global): Likewise.
2247 (Target_i386::Relocate::relocate): Likewise.
2248 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2249 switch.
2250 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2251 (Target_x86_64::do_plt_section_for_global): New function.
2252 (Target_x86_64::do_plt_section_for_local): New function.
2253 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2254 parameter; change all callers. If doing a static link define
2255 __rela_iplt_start and __rela_iplt_end.
2256 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2257 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2258 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2259 to point to .plt.
2260 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2261 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2262 switch.
2263 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2264 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2265 R_X86_64_IRELATIVE to switch.
2266 (Target_x86_64::Scan::global): Likewise.
2267 (Target_x86_64::Relocate::relocate): Likewise.
2268 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2269 switch.
2270 * target.h (class Target): Add plt_section_for_global and
2271 plt_section_for_local functions. Add do_plt_section_for_global
2272 and do_plt_section_for_local virtual functions.
2273 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2274 clarifying comments.
2275 (Symbol::use_plt_offset): Handle IFUNC symbol.
2276 * object.cc (Sized_relobj::Sized_relobj): Initialize
2277 local_plt_offsets_.
2278 (Sized_relobj::local_has_plt_offset): New function.
2279 (Sized_relobj::local_plt_offset): New function.
2280 (Sized_relobj::set_local_plt_offset): New function.
2281 (Sized_relobj::do_count): Handle IFUNC symbol.
2282 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2283 a bit away from input_shndx_ field. Add set_is_func_symbol and
2284 is_ifunc_symbol functions.
2285 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2286 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2287 local_plt_offsets_ field.
2288 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2289 * output.h (class Output_section_data): Add non-const
2290 output_section function.
2291 (class Output_data_got): Update declarations.
2292 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2293 Add use_plt_offset parameter to global and local constructors.
2294 Change all callers. Change local_sym_index_ field to 31 bits.
2295 Change GSYM_CODE and CONSTANT_CODE accordingly.
2296 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2297 doing a static link don't set sh_link field.
2298 (Output_data_got::Got_entry::write): Use PLT offset if
2299 appropriate.
2300 (Output_data_got::add_global_plt): New function.
2301 (Output_data_got::add_local_plt): New function.
2302 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2303 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2304 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2305 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2306 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2307 IFUNC conditional.
2308 * testsuite/ifunc-sel.h: New file.
2309 * testsuite/ifuncmain1.c: New file.
2310 * testsuite/ifuncmain1vis.c: New file.
2311 * testsuite/ifuncmod1.c: New file.
2312 * testsuite/ifuncdep2.c: New file.
2313 * testsuite/ifuncmain2.c: New file.
2314 * testsuite/ifuncmain3.c: New file.
2315 * testsuite/ifuncmod3.c: New file.
2316 * testsuite/ifuncmain4.c: New file.
2317 * testsuite/ifuncmain5.c: New file.
2318 * testsuite/ifuncmod5.c: New file.
2319 * testsuite/ifuncmain6pie.c: New file.
2320 * testsuite/ifuncmod6.c: New file.
2321 * testsuite/ifuncmain7.c: New file.
2322 * configure, testsuite/Makefile.in: Rebuild.
2323
56f75c03
ILT
23242010-08-18 Ian Lance Taylor <iant@google.com>
2325
2326 * incremental.cc
2327 (Output_section_incremental_inputs::write_input_files): Add cast
2328 to avoid signed/unsigned comparison warning.
2329 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2330
55455f89
CC
23312010-08-12 Cary Coutant <ccoutant@google.com>
2332
2333 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2334
e2054bcb
ILT
23352010-08-13 Ian Lance Taylor <iant@google.com>
2336
2337 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2338
74f67560
DK
23392010-08-12 Cary Coutant <ccoutant@google.com>
2340 Doug Kwan <dougkwan@google.com>
2341
2342 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2343 defintion overrides non-weak undef, remember that the original undef
2344 is not weak.
2345 * symtab.cc (Symbol_table::sized_write_global): For undef without
2346 an original weak binding, set binding to global in output.
2347 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2348 * testsuite/Makefile.in: Regenerate.
2349 * testsuite/strong_ref_weak_def.sh: New file.
2350 * testsuite/strong_ref_weak_def_1.c: Ditto.
2351 * testsuite/strong_ref_weak_def_2.c: Ditto.
2352
d1238d12
CC
23532010-08-12 Cary Coutant <ccoutant@google.com>
2354
2355 * testsuite/incremental_test.sh: Rewrite.
2356 * testsuite/incremental_test_1.c: Rewrite.
2357 * testsuite/incremental_test_2.c: Rewrite.
2358
0e70b911
CC
23592010-08-12 Cary Coutant <ccoutant@google.com>
2360
2361 * arm.cc (Target_arm::got_size): Add const.
2362 (Target_arm::got_entry_count): New function.
2363 (Target_arm::plt_entry_count): New function.
2364 (Target_arm::first_plt_entry_offset): New function.
2365 (Target_arm::plt_entry_size): New function.
2366 (Output_data_plt_arm::entry_count): New function.
2367 (Output_data_plt_arm::first_plt_entry_offset): New function.
2368 (Output_data_plt_arm::get_plt_entry_size): New function.
2369 * i386.cc (Target_i386::got_size): Add const.
2370 (Target_i386::got_entry_count): New function.
2371 (Target_i386::plt_entry_count): New function.
2372 (Target_i386::first_plt_entry_offset): New function.
2373 (Target_i386::plt_entry_size): New function.
2374 (Output_data_plt_i386::entry_count): New function.
2375 (Output_data_plt_i386::first_plt_entry_offset): New function.
2376 (Output_data_plt_i386::get_plt_entry_size): New function.
2377 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2378 find_incremental_inputs_sections. Dump incremental_got_plt section.
2379 * incremental.cc: Include target.h.
2380 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2381 parameter. Adjust all callers. Find incremental_got_plt section.
2382 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2383 section.
2384 (Output_section_incremental_inputs::set_final_data_size): Calculate
2385 size of incremental_got_plt section.
2386 (Output_section_incremental_inputs::do_write): Write the
2387 incremental_got_plt section.
2388 (Got_plt_view_info): New struct.
2389 (Local_got_offset_visitor): New class.
2390 (Global_got_offset_visitor): New class.
2391 (Global_symbol_visitor_got_plt): New class.
2392 (Output_section_incremental_inputs::write_got_plt): New function.
2393 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2394 Add parameter. Adjust all callers.
2395 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2396 (Incremental_inputs::got_plt_section): New function.
2397 (Incremental_inputs::got_plt_section_): New data member.
2398 (Incremental_got_plt_reader): New class.
2399 * layout.cc (Layout::create_incremental_info_sections): Add the
2400 incremental_got_plt section.
2401 * object.h (Got_offset_list::get_list): New function.
2402 (Got offset_list::for_all_got_offsets): New function.
2403 (Sized_relobj::local_got_offset_list): New function.
2404 * powerpc.cc (Target_powerpc::got_size): Add const.
2405 (Target_powerpc::got_entry_count): New function.
2406 (Target_powerpc::plt_entry_count): New function.
2407 (Target_powerpc::first_plt_entry_offset): New function.
2408 (Target_powerpc::plt_entry_size): New function.
2409 (Output_data_plt_powerpc::entry_count): New function.
2410 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2411 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2412 * sparc.cc (Target_sparc::got_size): Add const.
2413 (Target_sparc::got_entry_count): New function.
2414 (Target_sparc::plt_entry_count): New function.
2415 (Target_sparc::first_plt_entry_offset): New function.
2416 (Target_sparc::plt_entry_size): New function.
2417 (Output_data_plt_sparc::entry_count): New function.
2418 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2419 (Output_data_plt_sparc::get_plt_entry_size): New function.
2420 * symtab.h (Symbol::got_offset_list): New function.
2421 (Symbol_table::for_all_symbols): New function.
2422 * target.h (Sized_target::got_entry_count): New function.
2423 (Sized_target::plt_entry_count): New function.
2424 (Sized_target::plt_entry_size): New function.
2425 * x86_64.cc (Target_x86_64::got_size): Add const.
2426 (Target_x86_64::got_entry_count): New function.
2427 (Target_x86_64::plt_entry_count): New function.
2428 (Target_x86_64::first_plt_entry_offset): New function.
2429 (Target_x86_64::plt_entry_size): New function.
2430 (Output_data_plt_x86_64::entry_count): New function.
2431 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2432 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2433
09ec0418
CC
24342010-08-12 Cary Coutant <ccoutant@google.com>
2435
2436 * archive.cc: Include incremental.h.
2437 (Archive::Archive): Initialize incremental_info_.
2438 (Archive::include_member): Record archive members in incremental info.
2439 (Add_archive_symbols::run): Record begin and end of an archive in
2440 incremental info.
2441 (Lib_group::include_member): Record objects in incremental info.
2442 * archive.h (Incremental_archive_entry): Forward declaration.
2443 (Archive::set_incremental_info): New member function.
2444 (Archive::incremental_info): New member function.
2445 (Archive::Unused_symbol_iterator): New class.
2446 (Archive::unused_symbols_begin): New member function.
2447 (Archive::unused_symbols_end): New member function.
2448 (Archive::incremental_info_): New data member.
2449 * incremental-dump.cc (find_input_containing_global): New function.
2450 (dump_incremental_inputs): Dump new incremental info sections.
2451 * incremental.cc: Include symtab.h.
2452 (Output_section_incremental_inputs): New class.
2453 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2454 new incremental info sections.
2455 (Sized_incremental_binary::do_check_inputs): Likewise.
2456 (Incremental_inputs::report_archive): Remove.
2457 (Incremental_inputs::report_archive_begin): New function.
2458 (Incremental_inputs::report_archive_end): New function.
2459 (Incremental_inputs::report_object): New function.
2460 (Incremental_inputs::finalize_inputs): Remove.
2461 (Incremental_inputs::report_input_section): New function.
2462 (Incremental_inputs::report_script): Rewrite.
2463 (Incremental_inputs::finalize): Do nothing but finalize string table.
2464 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2465 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2466 (Incremental_inputs::create_data_sections): New function.
2467 (Incremental_inputs::relocs_entsize): New function.
2468 (Output_section_incremental_inputs::set_final_data_size): New function.
2469 (Output_section_incremental_inputs::do_write): New function.
2470 (Output_section_incremental_inputs::write_header): New function.
2471 (Output_section_incremental_inputs::write_input_files): New function.
2472 (Output_section_incremental_inputs::write_info_blocks): New function.
2473 (Output_section_incremental_inputs::write_symtab): New function.
2474 * incremental.h (Incremental_script_entry): Forward declaration.
2475 (Incremental_object_entry): Forward declaration.
2476 (Incremental_archive_entry): Forward declaration.
2477 (Incremental_inputs): Forward declaration.
2478 (Incremental_inputs_header_data): Remove.
2479 (Incremental_inputs_header): Remove.
2480 (Incremental_inputs_header_write): Remove.
2481 (Incremental_inputs_entry_data): Remove.
2482 (Incremental_inputs_entry): Remove.
2483 (Incremental_inputs_entry_write): Remove.
2484 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2485 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2486 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2487 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2488 Likewise.
2489 (Incremental_input_entry): New class.
2490 (Incremental_script_entry): New class.
2491 (Incremental_object_entry): New class.
2492 (Incremental_archive_entry): New class.
2493 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2494 (Incremental_inputs::report_inputs): Remove.
2495 (Incremental_inputs::report_archive): Remove.
2496 (Incremental_inputs::report_archive_begin): New function.
2497 (Incremental_inputs::report_archive_end): New function.
2498 (Incremental_inputs::report_object): Change prototype.
2499 (Incremental_inputs::report_input_section): New function.
2500 (Incremental_inputs::report_script): Change prototype.
2501 (Incremental_inputs::get_reloc_count): New function.
2502 (Incremental_inputs::set_reloc_count): New function.
2503 (Incremental_inputs::create_data_sections): New function.
2504 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2505 (Incremental_inputs::inputs_section): New function.
2506 (Incremental_inputs::symtab_section): New function.
2507 (Incremental_inputs::relocs_section): New function.
2508 (Incremental_inputs::get_stringpool): Add const.
2509 (Incremental_inputs::command_line): Add const.
2510 (Incremental_inputs::inputs): Remove.
2511 (Incremental_inputs::command_line_key): New function.
2512 (Incremental_inputs::input_file_count): New function.
2513 (Incremental_inputs::input_files): New function.
2514 (Incremental_inputs::relocs_entsize): New function.
2515 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2516 (Incremental_inputs::finalize_inputs): Remove.
2517 (Incremental_inputs::Input_info): Remove.
2518 (Incremental_inputs::lock_): Remove.
2519 (Incremental_inputs::inputs_): Change type.
2520 (Incremental_inputs::inputs_map_): Remove.
2521 (Incremental_inputs::current_object_entry_): New data member.
2522 (Incremental_inputs::inputs_section_): New data member.
2523 (Incremental_inputs::symtab_section_): New data member.
2524 (Incremental_inputs::relocs_section_): New data member.
2525 (Incremental_inputs::reloc_count_): New data member.
2526 (Incremental_inputs_reader): New class.
2527 (Incremental_symtab_reader): New class.
2528 (Incremental_relocs_reader): New class.
2529 * layout.cc (Layout::finalize): Move finalization of incremental info
2530 and creation of incremental info sections to follow finalization of
2531 symbol table. Set offsets for postprocessing sections.
2532 (Layout::create_incremental_info_sections): Call
2533 Incremental_inputs::create_data_sections. Add incremental symtab
2534 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2535 sections to layout after input sections.
2536 * layout.h (struct Timespec): Forward declaration.
2537 (Layout::incremental_inputs): Add const.
2538 (Layout::create_incremental_info_sections): Add parameter.
2539 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2540 * object.cc: Include incremental.h.
2541 (Relobj::finalize_incremental_relocs): New function.
2542 (Sized_relobj::do_layout): Record input sections in incremental info.
2543 * object.h (Object::output_section): New function.
2544 (Object::output_section_offset): Moved from Relobj.
2545 (Object::get_incremental_reloc_base): New function.
2546 (Object::get_incremental_reloc_count): New function.
2547 (Object::do_output_section): New function.
2548 (Object::do_output_section_offset): Moved from Relobj.
2549 (Object::do_get_incremental_reloc_base): New function.
2550 (Object::do_get_incremental_reloc_count): New function.
2551 (Object::Object): Initialize new data members.
2552 (Relobj::output_section): Renamed do_output_section and moved to
2553 protected.
2554 (Relobj::output_section_offset): Moved to Object.
2555 (Relobj::do_get_incremental_reloc_base): New function.
2556 (Relobj::do_get_incremental_reloc_count): New function.
2557 (Relobj::allocate_incremental_reloc_counts): New function.
2558 (Relobj::count_incremental_reloc): New function.
2559 (Relobj::finalize_incremental_relocs): New function.
2560 (Relobj::next_incremental_reloc_index): New function.
2561 (Relobj::reloc_counts_): New data member.
2562 (Relobj::reloc_bases_): New data member.
2563 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2564 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2565 (Sized_relobj::incremental_relocs_scan): New function.
2566 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2567 (Sized_relobj::incremental_relocs_write): New function.
2568 (Sized_relobj::incremental_relocs_write_reltype): New function.
2569 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2570 incremental link.
2571 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2572 archives and object files elsewhere.
2573 (Add_symbols::run): Report object files here.
2574 (Finish_group::run): Report end of archive at end of group.
2575 * reloc.cc: Include layout.h, incremental.h.
2576 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2577 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2578 (Sized_relobj::incremental_relocs_scan): New function.
2579 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2580 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2581 (Sized_relobj::incremental_relocs_write): New function.
2582 (Sized_relobj::incremental_relocs_write_reltype): New function.
2583 * script.cc (read_input_script): Rewrite test for incremental link.
2584 Change call to Incremental_inputs::report_script.
2585 * symtab.h (Symbol_table::first_global_index): New function.
2586 (Symbol_table::output_count): New function.
2587
ce0d1972
DK
25882010-08-12 Doug Kwan <dougkwan@google.com>
2589
2590 * arm.cc (Target_arm::merge_object_attributes): Check command line
2591 options --no-wchar-size-warning and --no-enum-size-warning.
2592 * options.h (General_options): Add ld-compatible options
2593 --no-enum-size-warning and --no-wchar-size-warning.
2594
6e5710ce
ILT
25952010-08-04 Ian Lance Taylor <iant@google.com>
2596
2597 * x86_64.cc (Target_x86_64::Scan::local): Use
2598 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2599 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2600 (Target_x86_64::Scan::global): Likewise.
2601 (Target_x86_64::Relocate::relocate): Likewise.
2602 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2603 Likewise.
2604
fef830db
CC
26052010-08-03 Cary Coutant <ccoutant@google.com>
2606
2607 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2608 to reserve space in merged_strings vector. Keep total input size
2609 for stats.
2610 (Output_merge_string::do_print_merge_stats): Print total input size.
2611 * merge.h (Output_merge_string): Add input_size_ field.
2612 * stringpool.cc (Stringpool_template::string_length): Move
2613 implementations out of Stringpool_template class and place in
2614 stringpool.h.
2615 * stringpool.h (string_length): Move out of Stringpool_template.
2616
1e3811b0
ILT
26172010-08-03 Ian Lance Taylor <iant@google.com>
2618
2619 PR 11712
2620 * layout.cc (relaxation_loop_body): If address of load segment is
2621 set, adjust address to include headers if possible.
2622
7af0c620
ILT
26232010-08-03 Ian Lance Taylor <iant@google.com>
2624
2625 * version.cc (version_string): Bump to 1.10.
2626
22f0da72
ILT
26272010-08-03 Ian Lance Taylor <iant@google.com>
2628
2629 PR 11805
2630 * layout.h (enum Output_section_order): Define.
2631 (class Layout): Update declarations.
2632 * layout.cc (Layout::get_output_section): Add order parameter.
2633 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2634 is_first_non_relro parameters. Change all callers.
2635 (Layout::choose_output_section): Likewise.
2636 (Layout::add_output_section_data): Likewise.
2637 (Layout::make_output_section): Likewise. Set order.
2638 (Layout::default_section_order): New function.
2639 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2640 * output.cc (Output_section::Output_section): Initialize order_.
2641 Don't initialize deleted fields.
2642 (Output_segment::Output_segment): Don't initialize deleted
2643 fields.
2644 (Output_segment::add_output_section_to_load): New function
2645 replacing add_output_section. Change all callers to call this or
2646 add_output_section_to_nonload.
2647 (Output_segment::add_output_section_to_nonload): New function.
2648 (Output_segment::remove_output_section): Rewrite.
2649 (Output_segment::add_initial_output_data): Likewise.
2650 (Output_segment::has_any_data_sections): Likewise.
2651 (Output_segment::is_first_section_relro): Likewise.
2652 (Output_segment::maximum_alignment): Likewise.
2653 (Output_segment::has_dynamic_reloc): New function replacing
2654 dynamic_reloc_count. Change all callers.
2655 (Output_segment::has_dynamic_reloc_list): New function replacing
2656 dynamic_reloc_count_list. Change all callers.
2657 (Output_segment::set_section_addresses): Rewrite.
2658 (Output_segment::set_offset): Rewrite.
2659 (Output_segment::find_first_and_last_list): Remove.
2660 (Output_segment::set_tls_offsets): Rewrite.
2661 (Output_segment::first_section_load_address): Likewise.
2662 (Output_segment::output_section_count): Likewise.
2663 (Output_segment::section_with_lowest_load_address): Likewise.
2664 (Output_segment::write_section_headers): Likewise.
2665 (Output_segment::print_sections_to_map): Likewise.
2666 * output.h (class Output_data): Remove dynamic_reloc_count_
2667 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2668 (Output_data::add_dynamic_reloc): Rewrite.
2669 (Output_data::has_dynamic_reloc): New function.
2670 (Output_data::dynamic_reloc_count): Remove.
2671 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2672 is_last_relro_, is_first_non_relro_, is_interp_,
2673 is_dynamic_linker_section_ fields. Add order and set_order
2674 functions. Remove is_relro_local, set_is_relro_local,
2675 is_last_relro, set_is_last_relro, is_first_non_relro,
2676 set_is_first_non_relro functions, is_interp, set_is_interp,
2677 is_dynamic_linker_section, and set_is_dynamic_linker_section
2678 functions.
2679 (class Output_segment): Change Output_data_list from std::list to
2680 std:;vector. Add output_lists_ field. Remove output_data_ and
2681 output_bss_ fields. Update declarations.
2682
3ff2ccb0
ILT
26832010-08-02 Ian Lance Taylor <iant@google.com>
2684
2685 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2686 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2687 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2688
88a4108b
ILT
26892010-08-02 Ian Lance Taylor <iant@google.com>
2690
2691 PR 11855
2692 * script.cc (Script_options::Script_options): Initialize
2693 symbol_definitions_ and symbol_references_.
2694 (Script_options::add_symbol_assignment): Update
2695 symbol_definitions_ and symbol_references_.
2696 (Script_options::add_symbol_reference): New function.
2697 (script_symbol): New function.
2698 * script.h (class Script_options): Add symbol_definitions_ and
2699 symbol_references_ fields.
2700 (Script_options::referenced_const_iterator): New type.
2701 (Script_options::referenced_begin): New function.
2702 (Script_options::referenced_end): New function.
2703 (Script_options::is_referenced): New function.
2704 (Script_options::any_unreferenced): New function.
2705 * script-c.h (script_symbol): Declare.
2706 * yyscript.y (exp): Call script_symbol.
2707 * symtab.cc: Include "script.h".
2708 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2709 Change all callers. Check symbols referenced by scripts.
2710 (Symbol_table::add_undefined_symbols_from_command_line): Add
2711 layout parameter. Change all callers.
2712 (Symbol_table::do_add_undefined_symbols_from_command_line):
2713 Likewise. Break out loop body. Check symbols referenced by
2714 scripts.
2715 (Symbol_table::add_undefined_symbol_from_command_line): New
2716 function broken out of
2717 do_add_undefined_symbols_from_command_line.
2718 * symtab.h (class Symbol_table): Update declarations.
2719 * archive.cc: Include "layout.h".
2720 (Archive::should_include_member): Add layout parameter. Change
2721 all callers. Check for symbol mentioned in expression.
2722 * archive.h (class Archive): Update declaration.
2723 * object.cc (Sized_relobj::do_should_include_member): Add layout
2724 parameter.
2725 * object.h (Object::should_include_member): Add layout parameter.
2726 Change all callers.
2727 (Object::do_should_include_member): Add layout parameter.
2728 (class Sized_relobj): Update declaration.
2729 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2730 parameter.
2731 * dynobj.h (class Sized_dynobj): Update declaration.
2732 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2733 layout parameter.
2734 * plugin.h (class Sized_pluginobj): Update declaration.
2735
5f1ab67a
ILT
27362010-08-02 Ian Lance Taylor <iant@google.com>
2737
2738 PR 11866
2739 * output.cc (Output_segment::set_offset): Search for the first and
2740 last sections rather than assuming that the list is in order.
2741 (Output_segment::find_first_and_last_list): New function.
2742 * output.h (class Output_segment): Update declarations.
2743 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2744 (relro_strip_test_SOURCES): New variable.
2745 (relro_strip_test_DEPENDENCIES): New variable.
2746 (relro_strip_test_LDFLAGS): New variable.
2747 (relro_strip_test_LDADD): New variable.
2748 (relro_strip_test.so): New target.
2749
a8df5856
ILT
27502010-08-02 Ian Lance Taylor <iant@google.com>
2751
2752 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2753 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2754 (Target_i386::got_tlsdesc_section): New function.
2755 (Target_i386::got_section): Create space for GOT entries for
2756 TLSDESC relocations.
2757 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2758 R_386_TLS_GOTDESC.
2759 (Target_i386::Scan::global): Likewise.
2760 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2761 using TLSDESC GOT.
2762 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2763 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2764 (Target_x86_64::got_tlsdesc_section): New function.
2765 (Target_x86_64::got_section): Create space for GOT entries for
2766 TLSDESC relocations.
2767 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2768 R_386_TLS_GOTDESC.
2769 (Target_x86_64::Scan::global): Likewise.
2770 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2771 using TLSDESC GOT.
2772
0c10a0a6
ILT
27732010-08-02 Ian Lance Taylor <iant@google.com>
2774
2775 * testsuite/final_layout.sh: Use dc to convert from hex to
2776 decimal.
2777
41cbeecc
ST
27782010-07-29 Sriraman Tallam <tmsriram@google.com>
2779
2780 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2781 paramter to the call to gold::gc_process_relocs.
2782 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2783 paramter to the call to gold::gc_process_relocs.
2784 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2785 parameter to the call to gold::gc_process_relocs.
2786 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2787 template parameter to the call to gold::gc_process_relocs.
2788 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2789 paramter to the call to gold::gc_process_relocs.
2790 * gc.h (get_embedded_addend_size): New function.
2791 (gc_process_relocs): Save the size of the reloc for use by ICF.
2792 * icf.cc (get_section_contents): Get the addend from the text section
2793 for SHT_REL relocation sections.
2794 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2795 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2796 * int_encoding.h (read_from_pointer): New overloaded function.
2797 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2798 * testsuite/icf_sht_rel_addend_test.sh: New file.
2799 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2800 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2801
6ea55b82
RW
28022010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2803
2804 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2805 * Makefile.in: Regenerate.
2806 * testsuite/Makefile.in: Regenerate.
2807
9691462b
ILT
28082010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2809
2810 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2811 * gold/testsuite/debug_msg.cc: Likewise.
2812 * gold/testsuite/odr_violation1.cc
2813 * gold/testsuite/odr_violation2.cc
2814
76897331
CC
28152010-07-21 Cary Coutant <ccoutant@google.com>
2816
2817 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2818 string, and length fields.
2819 (Output_merge_string::Merged_strings_list): New type.
2820 (Output_merge_string::Merged_strings_lists): New typedef.
2821 (Output_merge_string): Replace merged_strings_ with
2822 merged_strings_lists_.
2823 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2824 Merged_strings_list per input object and section. Don't store pointer
2825 to the string. Don't store length with each merged string entry.
2826 (Output_merge_string::finalize_merged_data): Loop over list of merged
2827 strings lists. Recompute length of each merged string.
2828
78384e8f
CC
28292010-07-15 Cary Coutant <ccoutant@google.com>
2830
2831 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2832 here.
2833
783659f9
ILT
28342010-07-14 Ian Lance Taylor <iant@google.com>
2835
2836 * descriptors.cc (Descriptors::open): Report correct name in error
2837 message.
2838
131687b4
DK
28392010-07-13 Doug Kwan <dougkwan@google.com>
2840
2841 * arm.cc (Arm_input_section::Arm_input_section): For a
2842 SHT_ARM_EXIDX section, always keeps the input sections.
2843 (Arm_input_section::set_exidx_section_link): New method.
2844 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2845 has_errors_ to false.
2846 (Arm_exidx_input_section::has_errors,
2847 Arm_exidx_input_section::set_has_errors): New methods.
2848 (Arm_exidx_input_section::has_errors_): New data member.
2849 (Arm_relobj::get_exidx_shndx_list): New method.
2850 (Arm_output_section::append_text_sections_to_list): Do not skip
2851 section without SHF_EXECINSTR.
2852 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2853 errors.
2854 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2855 section header. Make error messages more verbose. Check for
2856 a non-executable section linked to an EXIDX section.
2857 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2858 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2859 check that there is no deferred EXIDX section if we exit early.
2860 Instead of not making an EXIDX section in case of an error, make one
2861 and set the has_errors flag of it.
2862 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2863 in a relocatable link.
2864 (Target_arm::do_relax): Look for the EXIDX output section instead of
2865 assuming that it is called .ARM.exidx.
2866 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2867 section list. Do not check for SHF_EXECINSTR section flags but
2868 skip any input section with errors.
2869 * output.cc (Output_section::Output_section): Initialize
2870 always_keeps_input_sections_ to false.
2871 (Output_section::add_input_section): Check for
2872 always_keeps_input_sections_.
2873 * output.h (Output_section::always_keeps_input_sections,
2874 Output_section::set_always_keeps_input_sections): New methods.
2875 (Output_section::always_keeps_input_sections): New data member.
2876
69517287
RÁE
28772010-07-13 Rafael Espindola <espindola@google.com>
2878
2879 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2880 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2881
82742395
ILT
28822010-07-13 Philip Herron <herron.philip@googlemail.com>
2883 Ian Lance Taylor <iant@google.com>
2884
2885 * output.h (Output_section_lookup_maps::add_merge_section):
2886 Correct check of whether value was inserted.
2887 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2888 (Output_section_lookup_maps::add_relaxed_input_section):
2889 Likewise.
2890 * arm.cc (Target_arm::got_section): Remove used local os.
2891 * i386.cc (Target_i386::got_section): Likewise.
2892 * x86_64.cc (Target_x86_64::got_section): Likewise.
2893 * sparc.cc (Target_sparc::got_section): Likewise.
2894 (Target_sparc::relocate): Remove unused local have_got_offset.
2895 * powerpc.cc (Target_powerpc::relocate): Likewise.
2896
f2d707b5
ILT
28972010-07-13 Ian Lance Taylor <iant@google.com>
2898
241531d6
ILT
2899 * compressed_output.cc (zlib_decompress): Fix signature in
2900 !HAVE_ZLIB_H case.
2901
f2d707b5
ILT
2902 * archive.cc (Archive::include_member): Unlock an external member
2903 of a thin archive. Don't bother to delete an object we know is
2904 NULL.
2905
a2e47362
CC
29062010-07-12 Cary Coutant <ccoutant@google.com>
2907
2908 * compressed_output.cc (zlib_decompress): New function.
2909 (get_uncompressed_size): New function.
2910 (decompress_input_section): New function.
2911 * compressed_output.h (get_uncompressed_size): New function.
2912 (decompress_input_section): New function.
2913 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2914 Handle compressed debug sections.
2915 * layout.cc (is_compressed_debug_section): New function.
2916 (Layout::output_section_name): Map compressed section names to
2917 canonical names.
2918 * layout.h (is_compressed_debug_section): New function.
2919 (is_debug_info_section): Recognize compressed debug sections.
2920 * merge.cc: Include compressed_output.h.
2921 (Output_merge_data::do_add_input_section): Handle compressed
2922 debug sections.
2923 (Output_merge_string::do_add_input_section): Handle compressed
2924 debug sections.
2925 * object.cc: Include compressed_output.h.
2926 (Sized_relobj::Sized_relobj): Initialize new data members.
2927 (build_compressed_section_map): New function.
2928 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2929 * object.h (Object::section_is_compressed): New method.
2930 (Object::do_section_is_compressed): New method.
2931 (Sized_relobj::Compressed_section_map): New type.
2932 (Sized_relobj::do_section_is_compressed): New method.
2933 (Sized_relobj::compressed_sections_): New data member.
2934 * output.cc (Output_section::add_input_section): Handle compressed
2935 debug sections.
2936 * reloc.cc: Include compressed_output.h.
2937 (Sized_relobj::write_sections): Handle compressed debug sections.
2938
ce279a62
CC
29392010-07-08 Cary Coutant <ccoutant@google.com>
2940
2941 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2942 weak when resolving to a dynamic def.
2943 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2944 for weak undef/dynamic def cases. Adjust callers.
2945 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2946 undef_binding_weak_.
2947 (Symbol_table::sized_write_globals): Adjust symbol binding.
2948 (Symbol_table::sized_write_symbol): Add binding parameter.
2949 * symtab.h (Symbol::set_undef_binding): New method.
2950 (Symbol::is_undef_binding_weak): New method.
2951 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2952 (Symbol_table::should_override): Add new parameter.
2953 (Symbol_table::sized_write_symbol): Add new parameter.
2954
2955 * testsuite/weak_undef_file1.cc: Add new test case.
2956 * testsuite/weak_undef_file2.cc: Fix header comment.
2957 * testsuite/weak_undef_test.cc: Add new test case.
2958
b2286c10
DK
29592010-06-29 Doug Kwan <dougkwan@google.com>
2960
2961 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2962 Initialize USE_SYMBOL_.
2963 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2964 definition.
2965 (Arm_reloc_property::uses_symbol_): New data member declaration.
2966 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2967 uses symbol value and symbol is undefined but not weakly undefined.
2968
4802450a
RÁE
29692010-06-28 Rafael Espindola <espindola@google.com>
2970
2971 * plugin.cc (Plugin::load): Use dlerror.
2972
e5ca47ba
ILT
29732010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2974
2975 * symtab.cc (detect_odr_violations): When reporting an ODR
2976 violation, report an object where the symbol is defined.
2977
8a75a161
DK
29782010-06-25 Doug Kwan <dougkwan@google.com>
2979
2980 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2981 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2982 definition.
2983 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2984 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2985 target hook to detect function points.
2986 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2987 * icf.h (Icf::check_section_for_function_pointers): Change type of
2988 parameter SECTION_NAME to const reference to std::string. Use
2989 target hook to determine if section may have unsafe pointers.
2990 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2991 method definition.
2992
42218b9f
RÁE
29932010-06-21 Rafael Espindola <espindola@google.com>
2994
2995 * fileread.cc (Input_file::find_fie): New
2996 (Input_file::open): Use Input_file::find_fie.
2997 * fileread.h (Input_file::find_fie): New
2998 * plugin.cc (set_extra_library_path): New.
2999 (Plugin::load): Add set_extra_library_path to the transfer vector.
3000 (Plugin_manager::set_extra_library_path): New.
3001 (Plugin_manager::add_input_file): Use the extra search path if set.
3002 (set_extra_library_path(): New.
3003 * plugin.h (Plugin_manager): Add set_extra_library_path and
3004 extra_search_path_.
3005
a0506cca
CC
30062010-06-19 Cary Coutant <ccoutant@google.com>
3007
3008 * layout.cc (gdb_sections): Add .debug_types.
3009 (lines_only_debug_sections): Likewise.
3010
6508b958
RÁE
30112010-06-18 Rafael Espindola <espindola@google.com>
3012
3013 * plugin.cc (add_input_file,add_input_library)
3014 (Plugin_manager::add_input_file): Make filename arguments const.
3015 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3016 const.
3017
3e235302
DK
30182010-06-16 Doug Kwan <dougkwan@google.com>
3019
3020 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3021 .ARM.attributes section if we have not merged any input
3022 attributes sections.
3023
106e8a6c
DK
30242010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3025
3026 * arm.cc: Allow combining objects with no EABI version
3027 information.
3028
91ff43fe
RÁE
30292010-06-15 Rafael Espindola <espindola@google.com>
3030
3031 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3032
68ed838c
ILT
30332010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3034
3035 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3036 (struct iovec): Correct !HAVE_READV definition.
3037
f3a2388f
CC
30382010-06-10 Cary Coutant <ccoutant@google.com>
3039
3040 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3041 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3042 reloc sections.
3043 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3044
3045 PR 11683
3046 * symtab.h (Symbol::is_placeholder): New member function.
3047 * target-reloc.h (relocate_section): Check for placeholder symbols.
3048
3049 * testsuite/Makefile.am (plugin_test_8): New test.
3050 (plugin_test_9): New test.
3051 * testsuite/Makefile.in: Regenerate.
3052
e1df38aa
NC
30532010-06-09 Nick Clifton <nickc@redhat.com>
3054
3055 * yyscript.y (input_list_element): Allow strings prefixed with
3056 the '-' character. Treat these as libraries.
3057 * script.cc (script_add_library): New function. Adds a library
3058 specified by "-l<name>" found in an input script.
3059 * script-c.h: Add prototype for script_add_library.
3060
25bbe950
DK
30612010-06-07 Doug Kwan <dougkwan@google.com>
3062
3063 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3064 Restrict stub-group size to be within long conditional branch
3065 range when working around cortex-A8 erratum.
3066
0f32ea4c
ILT
30672010-06-07 Damien Diederen <dd@crosstwine.com>
3068
3069 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3070 #ifdef typo.
3071
8fe2a369
ST
30722010-06-03 Sriraman Tallam <tmsriram@google.com>
3073
3074 PR gold/11658
3075 * output.cc
3076 (Output_section::Input_section_sort_entry::compare_section_ordering):
3077 Change to return non-zero correctly.
3078 (Output_section::Input_section_sort_section_order_index_compare
3079 ::operator()): Change to fix ambiguity in comparisons.
3080
6e9ba2ca
ST
30812010-06-01 Sriraman Tallam <tmsriram@google.com>
3082
3083 * gold.h (is_wildcard_string): New function.
3084 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3085 (Layout::layout_eh_frame): Ditto.
3086 (Layout::find_section_order_index): New method.
3087 (Layout::read_layout_from_file): New method.
3088 * layout.h (Layout::find_section_order_index): New method.
3089 (Layout::read_layout_from_file): New method.
3090 (Layout::input_section_position_): New private member.
3091 (Layout::input_section_glob_): New private member.
3092 * main.cc (main): Call read_layout_from_file here.
3093 * options.h (--section-ordering-file): New option.
3094 * output.cc (Output_section::input_section_order_specified_): New
3095 member.
3096 (Output_section::Output_section): Initialize new member.
3097 (Output_section::add_input_section): Add new parameter.
3098 Keep input sections when --section-ordering-file is used.
3099 (Output_section::set_final_data_size): Sort input sections when
3100 section ordering file is specified.
3101 (Output_section::Input_section_sort_entry): Add new parameter.
3102 Check sorting type.
3103 (Output_section::Input_section_sort_entry::compare_section_ordering):
3104 New method.
3105 (Output_section::Input_section_sort_compare::operator()): Change to
3106 consider section_order_index.
3107 (Output_section::Input_section_sort_init_fini_compare::operator()):
3108 Change to consider section_order_index.
3109 (Output_section::Input_section_sort_section_order_index_compare
3110 ::operator()): New method.
3111 (Output_section::sort_attached_input_sections): Change to sort
3112 according to section order when specified.
e1df38aa
NC
3113 (Output_section::add_input_section<32, true>): Add new parameter.
3114 (Output_section::add_input_section<64, true>): Add new parameter.
3115 (Output_section::add_input_section<32, false>): Add new parameter.
3116 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
3117 * output.h (Output_section::add_input_section): Add new parameter.
3118 (Output_section::input_section_order_specified): New
3119 method.
3120 (Output_section::set_input_section_order_specified): New method.
3121 (Input_section::Input_section): Initialize section_order_index_.
3122 (Input_section::section_order_index): New method.
3123 (Input_section::set_section_order_index): New method.
3124 (Input_section::section_order_index_): New member.
3125 (Input_section::Input_section_sort_section_order_index_compare): New
3126 struct.
3127 (Output_section::input_section_order_specified_): New member.
3128 * script-sections.cc (is_wildcard_string): Delete and move modified
3129 method to gold.h.
3130 (Output_section_element_input::Output_section_element_input): Modify
3131 call to is_wildcard_string.
3132 (Output_section_element_input::Input_section_pattern
3133 ::Input_section_pattern): Ditto.
3134 (Output_section_element_input::Output_section_element_input): Ditto.
3135 * testsuite/Makefile.am (final_layout): New test case.
3136 * testsuite/Makefile.in: Regenerate.
3137 * testsuite/final_layout.cc: New file.
3138 * testsuite/final_layout.sh: New file.
3139
3537c84b
RÁE
31402010-06-01 Rafael Espindola <espindola@google.com>
3141
3142 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3143
105b6afd
RÁE
31442010-06-01 Rafael Espindola <espindola@google.com>
3145
3146 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3147 visibility of symbols.
3148
29e11421
DK
31492010-05-27 Doug Kwan <dougkwan@google.com>
3150
3151 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3152 from start of output section instead of address for a local symbol
3153 in a merged or relaxed section when doing a relocatable link.
3154
5e0f337e
RÁE
31552010-05-26 Rafael Espindola <espindola@google.com>
3156
3157 PR 11604
3158 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3159 adding sections the garbage collector removed.
3160 * gold/testsuite/Makefile.am: Add test.
3161 * gold/testsuite/Makefile.in: Regenerate.
3162 * gold/testsuite/plugin_test_7.sh: New.
3163 * gold/testsuite/plugin_test_7_1.c: New.
3164 * gold/testsuite/plugin_test_7_2.c: New.
3165
f4187277
RÁE
31662010-05-26 Rafael Espindola <espindola@google.com>
3167
3168 * script-sections.cc (Output_section_definition::set_section_addresses):
3169 Check for --section-start.
3170
5c388529
DK
31712010-05-26 Doug Kwan <dougkwan@google.com>
3172
3173 * arm.cc (Arm_scan_relocatable_relocs): New class.
3174 (Target_arm::relocate_special_relocatable): New method.
3175 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3176 (Arm_relocate_functions::thumb_branch_common): Same.
3177 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3178 instead of Default_scan_relocatable_relocs.
3179 * target-reloc.h (relocate_for_relocatable): Let target handle
3180 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3181 * target.h (Sized_target::relocate_special_relocatable): New method.
3182
bca1c3ae
ILT
31832010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3184
3185 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3186
0439c796
DK
31872010-05-23 Doug Kwan <dougkwan@google.com>
3188
3189 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3190 instead of a cast.
3191 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3192 with a direct branch, not a conditional branch, to a stub.
3193 * merge.cc (Output_merge_base::record_input_section): New method
3194 defintion.
3195 (Output_merge_data::do_add_input_section): Record input section if
3196 keeps-input-sections flag is set.
3197 (Output_merge_string::do_add_input_section): Ditto.
3198 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3199 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3200 INPUT_SECTIONS_.
3201 (Output_merge_base::keeps_input_sections,
3202 Output_merge_base::set_keeps_input_sections,
3203 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3204 method definitions.
3205 (Output_merge_base::Input_sections): New type declaration.
3206 (Output_merge_base::input_sections_begin,
3207 Output_merge_base::input_sections_end,
3208 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3209 (Output_merge_base::bool keeps_input_sections_,
3210 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3211 Output_merge_base::input_sections_): New data members.
3212 (Output_merge_data::do_set_keeps_input_sections): New method
3213 defintion.
3214 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3215 * output.cc (Output_section::Input_section::relobj): Move method
3216 defintion from class declaration to here and handle merge sections.
3217 (Output_section::Input_section::shndx): Ditto.
3218 (Output_section::Output_section): Remove initializations of removed
3219 data members and initialize new data member LOOKUP_MAPS_.
3220 (Output_section::add_input_section): Set keeps-input-sections flag
3221 for a newly created merge output section as appropriate. Adjust code
3222 to use Output_section_lookup_maps class.
3223 (Output_section::add_relaxed_input_section): Adjst code for lookup
3224 maps code refactoring.
3225 (Output_section::add_merge_input_section): Add a new parameter
3226 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3227 class. If adding input section to a newly created merge output
3228 section fails, remove the new merge section.
3229 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 3230 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
3231 (Output_section::find_merge_section): Ditto.
3232 (Output_section::build_lookup_maps): New method defintion.
3233 (Output_section::find_relaxed_input_section): Adjust code to use
3234 Output_section_lookup_maps class.
3235 (Output_section::get_input_sections): Export merge sections. Adjust
3236 code to use Output_section_lookup_maps class.
3237 (Output_section:::add_script_input_section): Adjust code to use
3238 Output_section_lookup_maps class. Update lookup maps for merge
3239 sections also.
3240 (Output_section::discard_states): Use Output_section_lookup_maps.
3241 (Output_section::restore_states): Same.
3242 * output.h (Merge_section_properties): Move class defintion out of
3243 Output_section.
3244 (Output_section_lookup_maps): New class.
3245 (Output_section::Input_section::is_merge_section): New method
3246 defintion.
3247 (Output_section::Input_section::relobj): Move defintion out of class
3248 defintion. Declare method only.
3249 (Output_section::Input_section::shndx): Ditto.
3250 (Output_section::Input_section::output_merge_base): New method defintion.
3251 (Output_section::Input_section::u2_.pomb): New union field.
3252 (Output_section::Merge_section_by_properties_map,
3253 Output_section::Output_section_data_by_input_section_map,
3254 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3255 Remove types.
3256 (Output_section::add_merge_input_section): Add new parameter
3257 KEEPS_INPUT_SECTIONS.
3258 (Output_section::build_lookup_maps): New method declaration.
3259 (Output_section::merge_section_map_,
3260 Output_section::merge_section_by_properties_map_,
3261 Output_section::relaxed_input_section_map_,
3262 Output_section::is_relaxed_input_section_map_valid_): Remove data
3263 members.
3264 (Output_section::lookup_maps_): New data member.
3265
76295588
L
32662010-05-21 Doug Kwan <dougkwan@google.com>
3267
3268 PR gold/11619
3269 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3270 avoid a compilation error.
3271
d103a984
RÁE
32722010-05-19 Rafael Espindola <espindola@google.com>
3273
3274 * script-sections.cc (Output_section_definition::allocate_to_segment):
3275 Update the phdrs_list even when the output section is NULL.
3276 * testsuite/Makefile.am: Add test.
3277 * testsuite/Makefile.in: Regenerate.
3278 * testsuite/script_test_9.cc: New.
3279 * testsuite/script_test_9.sh: New.
3280 * testsuite/script_test_9.t: New.
3281
6625d24e
DK
32822010-05-19 Doug Kwan <dougkwan@google.com>
3283
3284 * arm.cc (Arm_input_section::original_size): New method.
3285 (Arm_input_section::do_addralign): Add a cast.
3286 (Arm_input_section::do_output_offset): Remove static cast.
3287 (Arm_input_section::original_addralign,
3288 Arm_input_section::original_size_): Change type to uint32_t.
3289 (Arm_input_section::init): Add safe casts for section alignment
3290 and size.
3291 (Arm_input_section::set_final_data_size): Do not set address and
3292 offset of stub table.
3293 (Arm_output_section::fix_exidx_coverage): Change use of of
3294 Output_section::Simple_input_section to that of
3295 Output_section::Input_section.
3296 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3297 except for the first pass.
3298 * output.cc (Output_section::get_input_sections): Change type of
3299 input_sections to std::list<Input_section>.
3300 (Output_section::add_script_input_section): Rename from
3301 Output_section::add_simple_input_section. Change type of SIS
3302 parameter from Simple_input_section to Input_section.
3303 * output.h (Output_section::Simple_input_section): Remove class.
3304 (Output_section::Input_section): Change class visibility to public.
3305 (Output_section::Input_section::addralign): Use stored alignments
3306 for special input sections if set.
3307 (Output_section::Input_section::set_addralign): New method.
3308 (Output_section::get_input_sections): Change parameter type from
3309 list of Simple_input_section to list of Input_section.
3310 (Output_section::add_script_input_section): Rename from
3311 Output_section::add_simple_input_section. Change first parameter's
3312 type from Simple_input_section to Input_section and remove the
3313 second and third parameters.
3314 * script-sections.cc (Input_section::Input_section_list): Change
3315 type to list of Output_section::Input_section/
3316 (Input_section_info::Input_section_info): Change parameter type of
3317 INPUT_SECTION to Output_section::Input_section.
3318 (Input_section_info::input_section): Change return type.
3319 (Input_section_info::input_section_): Change type to
3320 Output_section::Input_section.
3321 (Output_section_element_input::set_section_addresses): Adjust code
3322 to use Output_section::Input_section instead of
3323 Output_section::Simple_input_section. Adjust code for renaming
3324 of Output_section::add_simple_input_section.
3325 (Orphan_output_section::set_section_addresses): Ditto.
3326
e1e82ea4
RW
33272010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3328
3329 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3330 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3331
91e75c8a
RÁE
33322010-05-18 Rafael Espindola <espindola@google.com>
3333
3334 * options.cc (General_options::finalize): Handle -nostdlib.
3335 * options.h (nostdlib): New option.
3336 * script.cc (script_add_search_dir): Handle -nostdlib.
3337
da59ad79
DK
33382010-05-12 Doug Kwan <dougkwan@google.com>
3339
3340 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3341 attributes section only if there no attributes section after merging.
3342 (Target_arm::merge_object_attributes): Move value of
e1df38aa 3343 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
3344 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3345 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3346 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3347 and arm_attr_merge_7.stdout.
3348 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3349 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3350 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3351 arm_attr_merge_7b.o): New rules.
3352 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3353 arm_attr_merge_7
3354 * testsuite/Makefile.in: Regenerate.
3355 * testsuite/arm_attr_merge.sh: New file.
3356 * testsuite/arm_attr_merge_[67][ab].s: Same.
3357
3e01a7fd
NC
33582010-05-05 Nick Clifton <nickc@redhat.com>
3359
3360 * po/es.po: Updated Spanish translation.
3361
7ad2014a
L
33622010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3363
3364 * Makefile.am (install-exec-local): Properly install gold as
3365 default cross linker.
3366 * Makefile.in: Regenerated.
3367
4fda8867
NC
33682010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3369 Nick Clifton <nickc@redhat.com>
3370
3371 * configure.ac (install_as_default): Define and set to false
3372 unless --enable-gold or --enable-gold=both/gold has been
3373 specified.
3374 * configure: Regenerate.
3375
3376 * Makefile.am (install-exec-local): Install the executable as
3377 'ld.gold'. If install_as_default is true then also install it as
3378 'ld'.
3379 * Makefile.in: Regenerated.
3380
bd288ea2
ILT
33812010-04-24 Ian Lance Taylor <iant@google.com>
3382
3383 * layout.cc (Layout::layout_reloc): In relocatable link don't
3384 combine reloc sections for grouped sections.
3385
ef38fd8a
ST
33862010-04-23 Sriraman Tallam <tmsriram@google.com>
3387
3388 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3389 sections that are not ordinary to icf.
3390 * icf.cc (get_section_contents): Handle relocation pointing to section
3391 with no object or shndx information.
3392 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3393 * testsuite/Makefile.in: Regenerate.
3394 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3395 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3396
f6973bdc
ILT
33972010-04-22 Ian Lance Taylor <iant@google.com>
3398
3399 * expression.cc (Expression::Expression_eval_info): Add
3400 result_alignment_pointer field.
3401 (Expression::eval_with_dot): Add result_alignment_pointer
3402 parameter. Change all callers.
3403 (Expression::eval_maybe_dot): Likewise.
3404 (class Binary_expression): Add alignment_pointer parameter to
3405 left_value and right_value. Change all callers.
3406 (BINARY_EXPRESSION): Set result alignment.
3407 (class Trinary_expression): Add alignment_pointer parameter to
3408 arg2_value and arg3_value. Change all callers.
3409 (Trinary_cond::value): Set result alignment.
3410 (Max_expression::value, Min_expression::value): Likewise.
3411 (Align_expression::value): Likewise.
3412 * script-sections.cc (class Sections_element): Add dot_alignment
3413 parameter to set_section_addresses virtual function. Update
3414 instantiations.
3415 (class Output_section_element): Likewise.
3416 (Script_sections::create_segments): Add dot_alignment parameter.
3417 Change all callers.
3418 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3419 (Script_sections::set_phdrs_clause_addresses): Likewise.
3420 * script-sections.h: Update declarations.
3421 * script.h: Update declarations.
3422 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3423 min_p_align.
3424 * testsuite/script_test_3.t: Set large alignment.
3425 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3426 segment has expected alignment.
3427
9c9c98a5
NC
34282010-04-22 Nick Clifton <nickc@redhat.com>
3429
3430 * po/gold.pot: Updated by the Translation project.
3431 * po/vi.po: Updated Vietnamese translation.
3432
2253bfba
L
34332010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3434
3435 * testsuite/Makefile.am (check_PROGRAMS): Add
3436 icf_virtual_function_folding_test.
3437 * testsuite/Makefile.in: Regenerated.
3438
85fdf906
AH
34392010-04-15 Andrew Haley <aph@redhat.com>
3440
3441 * options.h (merge_exidx_entries): New option.
3442 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3443 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3444 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3445 (Target_arm::merge_exidx_entries): New function.
3446 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3447 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3448 to Arm_exidx_fixup constructor.
3449 Add new arg, merge_exidx_entries.
3450 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3451 Arm_output_section::fix_exidx_coverage.
3452
ce97fa81
ST
34532010-04-18 Sriraman Tallam <tmsriram@google.com>
3454
3455 * icf.cc (get_section_contents): Check for preemptible functions.
3456 Ignore addend when appropriate.
3457 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3458 section folded.
3459 (add_from_relobj): Check for section folded.
3460 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3461 * symtab.h (should_add_dynsym_entry): Add new parameter.
3462 * target-reloc.h (scan_relocs): Check for section folded.
3463 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3464 Check reloc types for function pointers in shared objects.
3465 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3466 case.
3467 (icf_preemptible_functions_test): New test case.
3468 (icf_string_merge_test): New test case.
3469 * testsuite.Makefile.in: Regenerate.
3470 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3471 bar_glob. Refactor code.
3472 * testsuite/icf_preemptible_functions_test.cc: New file.
3473 * testsuite/icf_preemptible_functions_test.sh: New file.
3474 * testsuite/icf_string_merge_test.cc: New file.
3475 * testsuite/icf_string_merge_test.sh: New file.
3476 * testsuite/icf_virtual_function_folding_test.cc: New file.
3477 * testsuite/icf_virtual_function_folding_test.sh: New file.
3478
04ceb17c
DK
34792010-04-14 Doug Kwan <dougkwan@google.com>
3480
3481 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3482 for local symbol recounting if we remove a section due to ICF.
3483 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3484 there are no regular objects in input.
3485
153e7da4
DK
34862010-04-13 Doug Kwan <dougkwan@google.com>
3487
3488 * arm.cc (Arm_input_section::set_final_data_size): Compute
3489 accurate final data size instead of using current data size.
3490
4dbd9faf
DK
34912010-04-09 Doug Kwan <dougkwan@google.com>
3492
3493 * layout.cc (Layout::choose_output_section): Handle script section
3494 types.
3495 (Layout::make_output_section_for_script): Add section type parameter.
3496 Handle script section types.
3497 * layout.h (Layout::make_output_section_for_script): Add section
3498 type parameter.
3499 * output.cc (Output_section::Output_section): Initialize data member
3500 is_noload_.
3501 (Output_section::do_reset_address_and_file_offset): Do not set address
3502 to 0 if section is a NOLOAD section.
3503 * output.h (Output_section::is_noload): New method.
3504 (Output_section::set_is_noload): Ditto.
3505 (Output_section::is_noload_): New data member.
3506 * script-c.h (Script_section_type): New enum type.
3507 (struct Parser_output_section_header): Add new file section_type.
3508 * script-sections.cc (Sections_element::output_section_name): Add
3509 parameter for returning script section type.
3510 (Output_section_definition::output_section_name): Ditto.
3511 (Output_section_definition::section_type)P; New method.
3512 (Output_section_definiton::script_section_type_name): Ditto.
3513 (Output_section_definition::script_section_type_): New data member.
3514 (Output_section_definition::Output_section_definition): Initialize
3515 data member Output_section_definition::script_section_type_.
3516 (Output_section_definition::create_sections): Pass script section type
3517 to Layout::make_output_section_for_script.
3518 (Output_section_definition::output_section_name): Return script
3519 section type to caller.
3520 (Output_section_definition::set_section_address): Do not advance
3521 dot value and load address if section type is NOLOAD. Set address
3522 of NOLOAD sections regardless of section flags.
3523 (Output_section_definition::print): Print section type if it is
3524 not SCRIPT_SECTION_TYPE_NONE.
3525 (Output_section_definition::section_type): New method.
3526 (Output_section_definition::script_section_type_name): Ditto.
3527 (Script_sections::output_section_name): Add new parameter
3528 PSECTION_TYPE for returning script section type. Pass it to
3529 section elements. Handle discard sections.
3530 (Sort_output_sections::operator()): Handle NOLOAD sections.
3531 * script-sections.h (Script_sections::Section_type): New enum type.
3532 (Script_sections::output_section_name): Add a new parameter for
3533 returning script section type.
3534 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3535 INFO and NOLOAD.
3536 * yyscript.y (union): Add new field SECTION_TYPE.
3537 (COPY, DSECT, INFO, NOLOAD): New tokens.
3538 (opt_address_and_section_type): Change type to output_section_header.
3539 (section_type): New non-terminal
3540 (section_header): Handle section type.
2253bfba 3541 (opt_address_and_section_type): Return section type value.
4dbd9faf 3542
721ea635
L
35432010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3544
3545 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3546 * testsuite/plugin_common_test_2.c (foo): Likewise.
3547
6bf924b0
DK
35482010-04-08 Doug Kwan <dougkwan@google.com>
3549
3550 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3551 Output_merge_data.
3552 * output.cc (Output_section::add_merge_input_section): Simplify
3553 code and return status of Output_merge_base::add_input_section.
e1df38aa 3554 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
3555 returns true.
3556
24af6f92
DK
35572010-04-07 Doug Kwan <dougkwan@google.com>
3558
3559 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3560 if section is marked as containing instructions but has no mapping
3561 symbols.
3562 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3563 correct section index.
3564 (Arm_relobj::find_linked_text_section): Ditto.
3565
00698fc5
CC
35662010-04-07 Cary Coutant <ccoutant@google.com>
3567
3568 * archive.cc (include_member): Destroy Read_symbols_data object before
3569 releasing file.
3570 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3571 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3572 (Read_symbols_data::~Read_symbols_data) New destructor.
3573 (Section_relocs::Section_relocs) New constructor.
3574 (Section_relocs::~Section_relocs) New destructor.
3575 (Read_relocs_data::Read_relocs_data) New constructor.
3576 (Read_relocs_data::~Read_relocs_data) New destructor.
3577 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3578 pointers to NULL after deleting.
3579
7296d933
DK
35802010-04-07 Doug Kwan <dougkwan@google.com>
3581
3582 * arm.cc: Replace "endianity" with "endianness" in comments.
3583 (Arm_exidx_cantunwind): Ditto.
3584 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3585 (Arm_relobj::merge_flags_and_attributes): New method.
3586 (Arm_relobj::merge_flags_and_attributes_): New data member.
3587 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3588 (Arm_relobj::scan_sections_for_stubs): Ditto.
3589 (Arm_relobj::do_read_symbols): Check to see if we really want to
3590 merge processor-specific flags and attributes. Exit early if
3591 an object is empty except for section names and the undefined symbol.
3592 (Target_arm::do_finalize_sections): Move check for ELF format to
3593 Arm_relobj::do_read_symbols. Merge processor specific flags and
3594 attributes from a regular object only when we have determined that
3595 it is aapropriate. Do not create an .ARM.attributes section in
3596 output if there is no regular input object.
3597 (Target_arm::merge_processor_specific_flags): Check
3598 --warn-mismatch before printing any error.
3599 (Target_arm::merge_object_attributes): Ditto.
3600 * gold.cc (queue_middle_tasks): Handle the case in which there is
3601 no regular object in input.
3602 * options.cc (General_options::parse_EB): New method.
3603 (General_options::parse_EL): Same.
3604 (General_options::General_options): Initialize endianness_.
3605 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3606 New options.
3607 (General_options::Endianness): New enum.
3608 (General_options::endianness): New method.
3609 (General_options::endianness_): New data member.
3610 * parameters.cc (Parameters::set_options): Check target endianness.
3611 (Parameters::set_target_once): Ditto.
3612 (Parameters::check_target_endianness): New method.
3613 (parameters_force_valid_target): If either -EL or -EB is specified,
3614 use it to define endianness of default target.
3615 * parameters.h (Parameters::check_target_endianness): New method
3616 declaration.
3617 * target.h (class Target): Change "endianity" to "endianness"
3618 in comments.
3619
efc8d4f2
RW
36202010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3621
3622 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3623 * configure: Regenerate.
3624 * Makefile.in: Regenerate.
3625 * testsuite/Makefile.in: Regenerate.
3626
be234d88
CC
36272010-04-06 Cary Coutant <ccoutant@google.com>
3628
3629 gcc PR lto/42757
3630 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3631 prevailing definitions of common symbols.
3632 * testsuite/plugin_test_6.sh: New test case.
3633 * testsuite/plugin_common_test_1.c: New test case.
3634 * testsuite/plugin_common_test_2.c: New test case.
3635 * testsuite/Makefile.am (plugin_test_6): New test case.
3636 * testsuite/Makefile.in: Regenerate.
3637
bd32c6bd
NC
36382010-04-06 Nick Clifton <nickc@redhat.com>
3639
3640 * po/vi.po: New Vietnamese translation.
3641
323c532f
DK
36422010-03-30 Doug Kwan <dougkwan@google.com>
3643
3644 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3645
4fcd97eb
DK
36462010-03-25 Doug Kwan <dougkwan@google.com>
3647
3648 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3649 to avoid a conversion warning on a 32-bit host.
3650
4ebf39db
ILT
36512010-03-24 Ian Lance Taylor <iant@google.com>
3652
3653 * testsuite/script_test_3.t: Add a TLS segment.
3654 * testsuite/Makefile.am (check_PROGRAMS): Add
3655 tls_phdrs_script_test.
3656 (tls_phdrs_script_test_SOURCES): Define.
3657 (tls_phdrs_script_test_DEPENDENCIES): Define.
3658 (tls_phdrs_script_test_LDFLAGS): Define.
3659 (tls_phdrs_script_test_LDADD): Define.
3660 * testsuite/Makefile.in: Rebuild.
3661
4a599bdd
CC
36622010-03-23 Cary Coutant <ccoutant@google.com>
3663
3664 * fileread.cc (find_or_make_view): Fix comment.
3665
6c93b22c
ILT
36662010-03-23 Ian Lance Taylor <iant@google.com>
3667
3668 * script-sections.cc (class Orphan_section_placement): Define
3669 PLACE_TLS and PLACE_TLS_BSS.
3670 (Orphan_section_placement::Orphan_section_placement): Initialize
3671 new places.
3672 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3673 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3674 (tls_script_test_SOURCES): Define.
3675 (tls_script_test_DEPENDENCIES): Define.
3676 (tls_script_test_LDFLAGS): Define.
3677 (tls_script_test_LDADD): Define.
3678 * testsuite/Makefile.in: Rebuild.
3679
a2c7281b
DK
36802010-03-22 Doug Kwan <dougkwan@google.com>
3681
3682 * arm.cc (Arm_relocate_functions::abs8,
3683 Arm_relocate_functions::abs16): Use correct check for overflow
3684 specified in the ARM ELF specs.
3685 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3686 target of a BLX instruction specially.
3687 (Reloc_stub::stub_type_for_reloc): Ditto.
3688 (Relocate::relocate): Use symbolic names instead of numeric relocation
3689 codes to report error.
3690 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3691 workaround.
3692 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3693 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3694 thumb2_blx_out_of_range.stdout
3695 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3696 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3697 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3698 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3699 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3700 thumb2_blx_in_range, thumb2_blx_in_range.o,
3701 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3702 thumb2_blx_out_of_range.o): New rules.
3703 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3704 thumb2_blx_in_range and thumb2_blx_out_of_range.
3705 * testsuite/Makefile.in: Regenerate.
3706 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3707 * testsuite/thumb_blx_in_range.s: New file.
3708 * testsuite/thumb_blx_out_of_range.s: New file.
3709
b0193076
RÁE
37102010-03-22 Rafael Espindola <espindola@google.com>
3711
3712 * archive.cc (Should_include): Move to archive.h.
3713 (should_include_member): Make it a member of Archive.
3714 (Lib_group): New.
3715 (Add_lib_group_symbols): New.
3716 * archive.h: Include options.h.
3717 (Archive_member): Moved from Archive.
3718 (Should_include): Moved from archive.cc.
3719 (Lib_group): New.
3720 (Add_lib_group_symbols): New.
3721 * dynobj.cc (do_should_include_member): New.
3722 * dynobj.h (do_should_include_member): New.
3723 * gold.cc (queue_initial_tasks): Update call to queue.
3724 * main.cc (main): Print lib group stats.
3725 * object.cc (do_should_include_member): New.
3726 * object.h: Include archive.h.
3727 (Object::should_include_member): New.
3728 (Object::do_should_include_member): New.
3729 (Sized_relobj::do_should_include_member): New.
3730 * options.cc (General_options::parse_start_lib): New.
3731 (General_options::parse_end_lib): New.
3732 (Input_arguments::add_file): Handle lib groups.
3733 (Input_arguments::start_group): Check we are not in a lib.
3734 (Input_arguments::start_lib): New.
3735 (Input_arguments::end_lib): New.
3736 * options.h (General_options): Add start_lib and end_lib.
3737 (Input_argument::lib_): New.
3738 (Input_argument::lib): New.
3739 (Input_argument::is_lib): New.
3740 (Input_file_lib): New.
3741 (Input_arguments::in_lib_): New.
3742 (Input_arguments::in_lib): New.
3743 (Input_arguments::start_lib): New.
3744 (Input_arguments::end_lib_): New.
3745 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3746 in unused members as preempted.
3747 (Sized_pluginobj::do_should_include_member): New.
3748 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3749 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3750 return the blocker.
3751 (Read_symbols::do_whole_lib_group): New.
3752 (Read_symbols::do_lib_group): New.
3753 (Read_symbols::do_read_symbols): Handle lib groups.
3754 (Read_symbols::get_name): Handle lib groups.
3755 * readsyms.h (Read_symbols): Add an archive member pointer.
3756 (Read_symbols::do_whole_lib_group): New.
3757 (Read_symbols::do_lib_group): New.
3758 (Read_symbols::member_): New.
3759 * script.cc (read_input_script): Update call to queue_soon.
3760
d099120c
DK
37612010-03-19 Doug Kwan <dougkwan@google.com>
3762
3763 * arm.cc (Stub_table::Stub_table): Initialize new data members
3764 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3765 (Stub_table::add_reloc_stub): Assign stub offset and update
3766 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3767 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3768 New data members.
3769 (Stub_table::update_data_size_and_addralign): Use
3770 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3771 instead of going over all reloc stubs.
3772 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3773 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3774 Stringpool_template::offset_ to size of Stringpool_char.
3775 (Stringpool_template::new_key_offset): Remove code to initialize
3776 Stringpool_template::offset_.
3777 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3778 Stringpool_template::offset_ to zero.
3779
1aa37384
DK
37802010-03-15 Doug Kwan <dougkwan@google.com>
3781
3782 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3783 offset_.
3784 (Stringpool_template::new_key_offset): New method.
3785 (Stringpool_template::add_string): Assign offsets when adding new
3786 strings.
3787 (Stringpool_template::set_string_offsets): Do not set string offsets
3788 when not optimizing.
3789 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3790 member size_.
3791 (Chunked_vector::clear): Clear size_.
3792 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3793 (Chunked_vector::size): Return size_.
3794 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 3795 (Chunked_vector::size_): New data member.
1aa37384
DK
3796 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3797 (Stringpool_template::new_key_offset): New method declaration.
3798 (Stringpool_template::offset_): New data member.
3799
b672b057
RÁE
38002010-03-15 Rafael Espindola <espindola@google.com>
3801
3802 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3803 Add_symbols' constructor.
3804 * readsyms.h (Add_symbols): Remove the input_group member.
3805
b6848d3c
ILT
38062010-03-10 Ian Lance Taylor <iant@google.com>
3807
3808 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3809 target to ask whether a reference to a symbol requires a stack
3810 split.
3811 * target.h (Target::is_call_to_non_split): New function.
3812 (Target::do_is_call_to_non_split): Declare virtual function.
3813 * target.cc: Include "symtab.h".
3814 (Target::do_is_call_to_non_split): New function.
3815 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3816
a2a5469e
CC
38172010-03-10 Cary Coutant <ccoutant@google.com>
3818
3819 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3820 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3821 (File_read::open[2]): Add whole_file_view_ to list of views.
3822 (File_read::make_view): Remove test of whole_file_view_.
3823 (File_read::find_or_make_view): Create whole_file_view_ if
3824 necessary.
3825 (File_read::clear_views): Replace bool parameter with enum;
3826 adjust all callers. Don't delete views with permanent data;
3827 do delete cached views and views from archives if
3828 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3829 if clearing the corresponding view.
3830 * fileread.h (File_read::Clear_views_mode): New enum.
3831 (File_read::View::is_permanent_view): New method.
3832 (File_read::clear_views): Replace bool parameter
3833 with enum; adjust all callers.
3834 * options.h (General_options): Change keep_files_mapped option;
3835 add map_whole_files.
3836 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3837 releasing the file.
3838 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3839 the file.
3840
8861f32b
DM
38412010-03-10 David S. Miller <davem@davemloft.net>
3842
3843 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3844
d62d0f5f
ST
38452010-03-09 Sriraman Tallam <tmsriram@google.com>
3846
3847 * icf.cc (get_section_contents): Add '@' marker after processing the
3848 merge reloc.
3849
9177756d
DK
38502010-03-08 Doug Kwan <dougkwan@google.com>
3851
3852 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3853 due to a conversion warning.
3854 (Arm_relobj::update_output_local_symbol_count): Check for local
3855 symbol with unset output index.
3856
9e9e071b
ILT
38572010-03-05 Ian Lance Taylor <iant@google.com>
3858
3859 * options.h (class General_options): Add --spare-dynamic-tags.
3860 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3861 --spare-dynamic-tags.
3862
a81ee015
ILT
38632010-03-05 Ian Lance Taylor <iant@google.com>
3864
3865 * incremental.cc: Include "libiberty.h".
3866
44ec90b9
RO
38672010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3868
3869 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3870 function, is_info_ member.
3871 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3872 (Versions::Versions): Update caller.
3873 (Versions::define_base_version): Likewise.
3874 (Versions::add_def): Likewise.
3875
0897ed3b
ST
38762010-03-03 Sriraman Tallam <tmsriram@google.com>
3877
3878 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3879 (Scan::possible_function_pointer_reloc): New function.
3880 (Scan::local_reloc_may_be_function_pointer): Change to call
3881 possible_function_pointer_reloc.
3882 (Scan::global_reloc_may_be_function_pointer): Ditto.
3883 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3884 relocations in ".data.rel.ro._ZTV" section.
3885 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3886 * testsuite/icf_safe_so_test.cc: Ditto.
3887 * testsuite/icf_safe_test.cc: Ditto.
3888 * testsuite/icf_safe_test.sh: Ditto.
3889
d3bbad62
ILT
38902010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3891 Ian Lance Taylor <iant@google.com>
3892
3893 * target-reloc.h (relocate_section): Check the symbol table index
3894 for -1U before setting the local symbol index.
3895 (scan_relocatable_relocs): If copying the relocation, record that
3896 the local symbol is required.
3897 * object.h (Symbol_value::is_output_symtab_index_set): New
3898 function.
3899 (Symbol_value::may_be_discarded_from_output_symtab): New
3900 function.
3901 (Symbol_value::has_output_symtab_entry): New function.
3902 (Symbol_value::needs_output_symtab_entry): Remove.
3903 (Symbol_value::output_symtab_index): Make sure the symbol index is
3904 set.
3905 (Symbol_value::set_output_symtab_index): Make sure the symbol
3906 index is not set. Make sure the new index is valid.
3907 (Symbol_value::set_must_have_output_symtab_entry): New function.
3908 (Symbol_value::has_output_dynsym_entry): New function.
3909 (Symbol_value::set_output_dynsym_index): Make sure the new index
3910 is valid.
3911 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3912 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3913 local symbol if permitted.
3914 (Sized_relobj::do_finalize_local_symbols): Call
3915 is_output_symtab_index_set rather than needs_output_symtab_entry.
3916 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3917 rather than needs_output_symtab_entry. Call
3918 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3919 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3920 is_output_symtab_index_set rather than needs_output_symtab_entry.
3921 * testsuite/discard_locals_relocatable_test.c: New file.
3922 * testsuite/discard_locals_test.sh: Test -r.
3923 * testsuite/Makefile.am (check_DATA): Add
3924 discard_locals_relocatable_test1.syms,
3925 discard_local_relocatable_test2.syms.
3926 (MOSTLYCLEANFILES): Likewise. Also add
3927 discard_locals_relocatable_test1.lout and
3928 discard_locals_relocatable_test2.out.
3929 (discard_locals_relocatable_test1.syms): New target.
3930 (discard_locals_relocatable_test.o): New target.
3931 (discard_locals_relocatable_test1.out): New target.
3932 (discard_locals_relocatable_test2.syms): New target.
3933 (discard_locals_relocatable_test2.out): New target.
3934 (various): Add missing ../ld-new dependencies.
3935 * testsuite/Makefile.in: Rebuild.
3936
7e8ccf26
NC
39372010-03-03 Nick Clifton <nickc@redhat.com>
3938
3939 * po/fi.po: New Finnish translation.
3940
2a0ff005
DK
39412010-03-01 Doug Kwan <dougkwan@google.com>
3942
3943 * layout.cc (Layout::Layout): Force section types of .init_array*,
3944 .preinit_array* and .fini_array* sections.
3945 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3946 Fix check of return value of std::string::find.().
3947 (Output_section::Input_section_sort_compare::operator()): Remove
3948 comment about .init_array.
3949 (Output_section::Input_section_sort_init_fini_compare::operator()):
3950 New method.
3951 (Output_section::sort_attached_input_sections): Handle .init_array
3952 and .fini_array specially.
3953 * output.h (Output_section::Inut_section_sort_compare): Update
3954 comment.
3955 (Output_section::Input_section_sort_init_fini_compare): New struct.
3956
c3e4ae29
DK
39572010-02-26 Doug Kwan <dougkwan@google.com>
3958
3959 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3960 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3961 * testsuite/debug_msg.sh: Avoid matching source line number for
3962 use of global variable undef_int.
3963
2fd9ae7a
DK
39642010-02-26 Doug Kwan <dougkwan@google.com>
3965
3966 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3967 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3968 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3969 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3970 * options.cc (General_options::General_options): Initialize member
3971 fix_v4bx_.
3972 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3973 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3974 and rm_no_fix_v4bx.stdout
3975 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3976 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3977 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3978 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3979 and arm_no_fix_v4bx.
3980 * Makefile.in: Regenerate.
3981 * testsuite/arm_fix_v4bx.s: New file.
3982 * testsuite/arm_fix_v4bx.sh: Ditto.
3983
67ec7d0b
DK
39842010-02-24 Doug Kwan <dougkwan@google.com>
3985
3986 * arm.cc (Target_arm::got_section): Make the .got section the first
3987 non RELRO section in the data segment.
3988 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3989 suffixes of section names.
3990
10165461
DK
39912010-02-24 Doug Kwan <dougkwan@google.com>
3992
3993 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3994 flags and attributes merging if an input file is a binary file.
3995 * fileread.cc (Input_file::open): Record format of original file.
3996 * fileread.h (Input_file::Format): New enum type.
3997 (Input_file::Input_file): Initialize data member format_.
3998 (Input_file::format): New method definition.
3999 (Input_file::format_):: New data member.
4000
4a54abbb
DK
40012010-02-24 Doug Kwan <dougkwan@google.com>
4002
4003 * arm.cc (Arm_output_data_got): New class.
4004 (ARM_TCB_SIZE): New constant
4005 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4006 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4007 If user uses a script with a SECTIONS clause, issue only a warning
4008 for a misplaced EXIDX input section. Otherwise, issue an error.
4009 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4010 garbage collection.
4011 (Target_arm::got_mode_index_entry): Handle static linking.
4012 (Target_arm::Scan::local): Ditto.
4013 (Target_arm::Scan::global): Ditto.
4014 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4015 all incorrectly implemented relocations.
e1df38aa 4016 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
4017 Arm_output_section::fix_exidx_coverage.
4018 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4019 from ".ARM.exidx." and ".ARM.extab.".
4020
ca419a6f
ILT
40212010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4022
4023 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4024 section if it does not already exist.
4025 * attributes.cc (Attributes_section_data::Attributes_section_data):
4026 Don't crash if size is zero.
4027
135b9c78
ILT
40282010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4029 Ian Lance Taylor <iant@google.com>
4030
4031 * gold.cc (queue_middle_tasks): If no input files were opened,
4032 exit.
4033 * workqueue.h (Task_function::Task_function): Assert that there is
4034 a blocker.
4035
bb0bfe4f
DK
40362010-02-22 Doug Kwan <dougkwan@google.com>
4037
4038 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4039 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4040 types to avoid warnings due to different uint64_t implementations
4041 on different hosts.
4042
2a2b6d42
DK
40432010-02-21 Doug Kwan <dougkwan@google.com>
4044
4045 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4046 handling of the maximum backward branch offset.
4047 (Arm_relocate_functions::thumb_branch_common): Ditto.
4048 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4049 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 4050 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
4051 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4052 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4053 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4054 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4055 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4056 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4057 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4058 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4059 thumb2_bl_out_of_range.o): New rules.
4060 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4061 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4062 thumb2_bl_out_of_range
4063 * testsuite/Makefile.in: Regenerate.
4064 * testsuite/arm_bl_in_range.s: New file.
4065 * testsuite/arm_bl_out_of_range.s: Ditto.
4066 * testsuite/arm_branch_in_range.sh: Ditto.
4067 * testsuite/arm_branch_range.t: Ditto.
4068 * testsuite/thumb2_branch_range.t: Ditto.
4069 * testsuite/thumb_bl_in_range.s: Ditto.
4070 * testsuite/thumb_bl_out_of_range.s: Ditto.
4071 * testsuite/thumb_branch_range.t: Ditto.
4072
b487ad64
ST
40732010-02-20 Sriraman Tallam <tmsriram@google.com>
4074
4075 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4076 Add reloc offset information.
4077 * icf.cc (get_section_contents): Change iterators to point to the new
4078 vectors. Add reloc offset information to the contents.
4079 * icf.h (Icf::Sections_reachable_info): New typedef.
4080 (Icf::Sections_reachable_list): New typedef.
4081 (Icf::Offset_info): New typedef.
4082 (Icf::Reloc_info): New struct typedef.
4083 (Icf::Reloc_info_list): New typedef.
4084 (Icf::symbol_reloc_list): Delete method.
4085 (Icf::addend_reloc_list): Delete method.
4086 (Icf::section_reloc_list): Delete method.
4087 (Icf::reloc_info_list): New method.
4088 (Icf::reloc_info_list_): New member.
4089
f96accdf
DK
40902010-02-19 Doug Kwan <dougkwan@google.com>
4091
4092 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4093 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4094 * arm.cc (Arm_relocation_functions): New forward declaration.
4095 (Target_arm::Target_arm): Initialize new data members
4096 got_mod_index_offset_ and tls_base_symbol_defined_.
4097 (Target_arm::Relocate::relocate_tls): New method.
4098 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4099 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4100 New methods.
4101 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4102 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4103 (Target_arm::got_mod_index_offset_,
4104 Target_arm::tls_base_symbol_defined_): New data members.
4105 (Target_arm::Scan::local, Target::Scan::global,
4106 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4107 relocations.
4108
c8761b9a
DK
41092010-02-18 Doug Kwan <dougkwan@google.com>
4110
4111 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4112 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4113 text section as a parameter becuase some broken tools may not set
4114 the link in section header.
4115 (Target_arm::has_got_section): New method.
4116 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4117 without any mapping symbol as data only. Remove warning.
4118 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4119 link in its section header, try to discover the link by inspecting the
4120 REL31 relocation at the beginning of the section.
4121 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4122 in error message.
4123 (Target_arm::Scan::global): Treat any reference to the symbol
4124 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4125
21bb3914
ST
41262010-02-12 Sriraman Tallam <tmsriram@google.com>
4127
4128 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4129 (Scan::global_reloc_may_be_function_pointer): New function.
4130 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4131 (Scan::global_reloc_may_be_function_pointer): New function.
4132 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4133 (Scan::global_reloc_may_be_function_pointer): New function.
4134 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4135 (Scan::global_reloc_may_be_function_pointer): New function.
4136 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4137 (Scan::global_reloc_may_be_function_pointer): New function.
4138 (Scan::possible_function_pointer_reloc): New function.
4139 (Target_x86_64::can_check_for_function_pointers): New function.
4140 * gc.h (gc_process_relocs): Scan relocation types to determine if
4141 function pointers were taken for targets that support it.
4142 * icf.cc (Icf::find_identical_sections): Include functions for
4143 folding in safe ICF whose pointer is not taken.
4144 * icf.h (Secn_fptr_taken_set): New typedef.
4145 (fptr_section_id_): New member.
4146 (section_has_function_pointers): New function.
4147 (set_section_has_function_pointers): New function.
4148 (check_section_for_function_pointers): New function.
4149 * options.h: Fix comment for safe ICF option.
4150 * target.h (can_check_for_function_pointers): New function.
4151 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4152 Modify icf_safe_test for X86-64.
4153 * testsuite/Makefile.in: Regenerate.
4154 * testsuite/icf_safe_so_test.cc: New file.
4155 * testsuite/icf_safe_so_test.sh: New file.
4156 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4157 (main): Change to take pointer to function kept_func_3.
4158 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4159 folding is done correctly for X86-64.
4160
0da6fa6c
DM
41612010-02-12 David S. Miller <davem@davemloft.net>
4162
4163 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4164 is_symbolless parameter.
4165 (Output_reloc<SHT_REL>::is_symbolless): New.
4166 (Output_reloc<SHT_REL>::is_symbolless_): New.
4167 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4168 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4169 (Output_reloc<SHT_RELA>::is_symbolless): New.
4170 (Output_data_reloc::add_global): Handle is_symbolless.
4171 (Output_data_reloc::add_global_relative): Likewise.
4172 (Output_data_reloc::add_local): Likewise.
4173 (Output_data_reloc::add_local_relative): Likewise.
4174 (Output_data_reloc::add_symbolless_global_addend): New.
4175 (Output_data_reloc::add_symbolless_local_addend): New.
4176 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4177 is_symbolless.
4178 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4179 instead of ->is_relative_
4180 (Output_reloc::write): Likewise.
4181 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4182 (Output_reloc::write_rel): Simplify.
4183
4184 * sparc.cc (Target_sparc::Scan::local): Use
4185 ->add_symbolless_local_addend as needed.
4186 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4187 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4188 based upon relocation offset.
4189
e4782e83
DK
41902010-02-11 Doug Kwan <dougkwan@google.com>
4191
4192 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4193 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4194 beginning of function.
4195 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4196 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4197 parameter is_32bit in calls to should_apply_static_reloc.
4198 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4199 (check_DATA): Add arm_abs_global.stdout.
4200 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4201 arm_abs_global.stdout): New rules.
4202 (MOSTLLYCLEANFILES): Add arm_abs_global
4203 * Makefile.in: Regenerate.
4204 * testsuite/arm_abs_global.s: New file.
4205 * testsuite/arm_abs_global.sh: Ditto.
4206 * testsuite/arm_abs_lib.s: Ditto.
4207
93ceb764
ILT
42082010-02-11 Ian Lance Taylor <iant@google.com>
4209
4210 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4211 Read_relocs task.
4212 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4213 Allocate_commons_task first.
4214 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4215 task, rather than symtab_lock_.
4216 (Gc_process_relocs::~Gc_process_relocs): New function.
4217 (Gc_process_relocs::is_runnable): Check this_blocker_.
4218 (Gc_process_relocs::locks): Use next_blocker_ rather than
4219 blocker_.
4220 (Scan_relocs::~Scan_relocs): New function.
4221 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4222 symtab_lock_.
4223 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4224 next_blocker_.
4225 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4226 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4227 constructor accordingly.
4228 (class Gc_process_relocs): Likewise.
4229 (class Scan_relocs): Likewise.
4230 * common.h (class Allocate_commons_task): Remove symtab_lock_
4231 field, and corresponding constructor parameter.
4232 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4233 symtab_lock_.
4234 (Allocate_commons_task::locks): Likewise.
4235
114dfbe1
ILT
42362010-02-11 Ian Lance Taylor <iant@google.com>
4237
4238 * gold-threads.h (class Once): Define.
4239 (class Initialize_lock): Rewrite as child of Once.
4240 * gold-threads.cc (class Once_initialize): Define.
4241 (once_pointer_control): New static variable.
4242 (once_pointer, once_arg): New static variables.
4243 (c_run_once): New static function.
4244 (Once::Once, Once::run_once, Once::internal_run): New functions.
4245 (class Initialize_lock_once): Remove.
4246 (initialize_lock_control): Remove.
4247 (initialize_lock_pointer): Remove.
4248 (initialize_lock_once): Remove.
4249 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4250 (Initialize_lock::initialize): Rewrite.
4251 (Initialize_lock::do_run_once): New function.
4252 * archive.cc (Archive::interpret_header): Only clear name if it is
4253 not already empty.
4254 * fileread.cc: Include "gold-threads.h"
4255 (file_counts_lock): New static variable.
4256 (file_counts_initialize_lock): Likewise.
4257 (File_read::release): Only increment counts when using --stats.
4258 Use a lock around the increment.
4259 * parameters.cc (class Set_parameters_target_once): Define.
4260 (set_parameters_target_once): New static variable.
4261 (Parameters::Parameters): Move here from parameters.h.
4262 (Parameters::set_target): Rewrite.
4263 (Parameters::set_target_once): New function.
4264 (Parameters::clear_target): Move here and rewrite.
4265 * parameters.h (class Parameters): Update declarations. Add
4266 set_parameters_target_once_ field.
4267 (Parameters::Parameters): Move to parameters.cc.
4268 (Parameters::clear_target): Likewise.
4269 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4270 task.
4271 (Start_group::~Start_group): New function.
4272 (Start_group::is_runnable): New function.
4273 (Start_group::locks, Start_group::run): New functions.
4274 (Finish_group::run): Change saw_undefined to size_t.
4275 * readsyms.h (class Start_group): Define.
4276 (class Finish_group): Change saw_undefined_ field to size_t.
4277 (Finish_group::Finish_group): Remove saw_undefined and
4278 this_blocker parameters. Change all callers.
4279 (Finish_group::set_saw_undefined): New function.
4280 (Finish_group::set_blocker): New function.
4281 * symtab.h (class Symbol_table): Change saw_undefined to return
4282 size_t. Change saw_undefined_ field to size_t.
4283 * target-select.cc (Set_target_once::do_run_once): New function.
4284 (Target_selector::Target_selector): Initialize set_target_once_
4285 field. Don't initialize lock_ and initialize_lock_ fields.
4286 (Target_selector::instantiate_target): Rewrite.
4287 (Target_selector::set_target): New function.
4288 * target-select.h (class Set_target_once): Define.
4289 (class Target_selector): Update declarations. Make
4290 Set_target_once a friend. Remove lock_ and initialize_lock_
4291 fields. Add set_target_once_ field.
4292
fa17a3f4
ILT
42932010-02-10 Ian Lance Taylor <iant@google.com>
4294
4295 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4296 queueing any tasks.
4297 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4298 (queue_middle_tasks): Add all blockers before queueing any tasks.
4299 (queue_final_tasks): Likewise.
4300 * token.h (Task_token::add_blockers): New function.
4301 * object.h (Input_objects::number_of_relobjs): New function.
4302
c7177d31
ILT
43032010-02-10 Ian Lance Taylor <iant@google.com>
4304
5de0e392
ILT
4305 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4306 shared, not if not position independent.
4307 * x86_64.cc (Relocate::relocate_tls): Likewise.
4308 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4309 (tls_pie_pic_test): New target.
4310 * testsuite/Makefile.in: Rebuild.
4311
c7177d31
ILT
4312 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4313 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4314 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4315 * testsuite/Makefile.in: Rebuild.
4316
684b268a
DM
43172010-02-09 David S. Miller <davem@davemloft.net>
4318
4319 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4320 R_SPARC_RELATIVE using ->add_local_relative().
4321 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4322
612a8d3d
DM
4323 * output.h (Output_data_dynamic::add_section_size): New method
4324 that takes two Output_data objects.
4325 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4326 entry param. Handle it in initializers.
4327 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4328 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4329 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4330 arg.
4331 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4332 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4333 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4334 for dynrel_includes_plt.
4335 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4336 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4337 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4338 before .rela.plt
4339 (Target_sparc::do_finalize_sections): Update to pass true for
4340 dynrel_includes_plt.
4341 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4342 output before .rela.plt
4343 (Target_powerpc::do_finalize_sections): Update to pass true for
4344 dynrel_includes_plt when 32-bit.
4345
cb1be87e
DK
43462010-02-08 Doug Kwan <dougkwan@google.com>
4347
4348 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4349 method.
4350 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4351 Arm_relobj::scan_section_for_cortex_a8_stubs,
4352 Arm_relobj::do_relocation_section): Instead of calling
4353 Output_section::output_address, use faster
4354 Arm_relobj::simple_input_section_output_address.
4355
705b5121
DM
43562010-02-08 David S. Miller <davem@davemloft.net>
4357
4358 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4359 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4360 relocation helper function.
4361
024c4466
DM
4362 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4363 just like R_SPARC_GOT{10,13,22}.
4364 (Target_sparc::Scan::local): Likewise.
4365 (Target_sparc::Relocate:relocate): Likewise.
4366
9109c078
ILT
43672010-02-06 Ian Lance Taylor <iant@google.com>
4368
4369 * configure.ac: Rewrite targetobjs duplicate removal code to use
4370 only shell constructs.
4371 * configure: Rebuild.
4372
cf846138
DK
43732010-02-05 Doug Kwan <dougkwan@google.com>
4374
4375 PR 11247
4376 * arm.cc (Arm_relobj::section_is_scannable): New method.
4377 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4378 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4379
6cfaf60b
DK
43802010-02-04 Doug Kwan <dougkwan@google.com>
4381
4382 PR 11247
4383 * arm-reloc-property.cc (cstdio): Include.
4384 * configure.ac (targetobjs): Remove duplicates.
4385 * configure: Regenerate.
4386 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4387 big and little endian version for a given address size.
4388
5c57f1be
DK
43892010-02-03 Doug Kwan <dougkwan@google.com>
4390
4391 * arm-reloc-property.cc
4392 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4393 definition.
4394 * arm-reloc-property.h
4395 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4396 New method definition.
4397 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4398 declaration.
4399 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4400 overflow to N.
4401 (GOT_PREL): Change implemented to Y.
4402 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4403 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4404 (Arm_relocate_functions::movw_abs_nc): Remove method.
4405 (Arm_relocate_functions::movt_abs): Ditto.
4406 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4407 (Arm_relocate_functions::thm_movt_abs): Ditto.
4408 (Arm_relocate_functions::movw_rel_nc): Ditto.
4409 (Arm_relocate_functions::movw_rel): Ditto.
4410 (Arm_relocate_functions::movt_rel): Ditto.
4411 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4412 (Arm_relocate_functions:thm_movw_rel): Ditto.
4413 (Arm_relocate_functions:thm_movt_rel): Ditto.
4414 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4415 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4416 New method definitions.
4417 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4418 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4419 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4420 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4421 (Target_arm::Relocate::relocate): Check for non-static or
4422 unimplemented relocation code and exit early. Change calls to
4423 Target_arm::reloc_uses_thumb_bit and
4424 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4425 instead. Refactor code to handle similar relocations to increase
4426 code sharing. Remove check for unsupported relocation code in switch
4427 statement.
4428 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4429 relocation property table to find out size. Change error message to
4430 print out the name of a relocation code instead of the numeric value.
4431 (Target_arm::scan_reloc_for_stub): Use relocation property table
4432 instead of calling Target_arm::reloc_uses_thumb_bit().
4433
218c5831
DK
44342010-02-02 Doug Kwan <dougkwan@google.com>
4435
4436 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4437 types of relaxed input section.
4438
0d31c79d
DK
44392010-02-02 Doug Kwan <dougkwan@google.com>
4440
4441 * Makefile.am (HFILES): Add arm-reloc-property.h.
4442 (DEFFILES): New.
4443 (TARGETSOURCES): Add arm-reloc-property.cc
4444 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4445 (libgold_a_SOURCES): $(DEFFILES)
4446 * Makefile.in: Regenerate.
4447 * arm-reloc-property.cc: New file.
4448 * arm-reloc-property.h: New file.
4449 * arm-reloc.def: New file.
4450 * arm.cc: Update comments.
4451 (arm-reloc-property.h): New included header.
4452 (arm_reloc_property_table): New global variable.
4453 (Target_arm::do_select_as_default_target): New method definition.
4454 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4455 arm-reloc-property to targ_extra_obj.
4456 * parameters.cc (set_parameters_target): Call
4457 Target::select_as_default_target().
4458 * target.h (Target::select_as_default_target): New method definition.
4459 (Target::do_select_as_default_target): Same.
4460
546c7457
DK
44612010-02-01 Doug Kwan <dougkwan@google.com>
4462
4463 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4464 first_output_text_section_.
4465 (Arm_exidx_fixup::first_output_text_section): New method definition.
4466 (Arm_exidx_fixup::first_output_text_section_): New data member.
4467 (Arm_exidx_fixup::process_exidx_section): Record the first text
4468 output section seen.
4469 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4470 and entsize in output section header.
4471
11b861d5
DK
44722010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4473
4474 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4475 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4476 (Arm_relocate_functions::thm_alu11): New Method.
4477 (Arm_relocate_functions::thm_pc8): New Method.
4478 (Arm_relocate_functions::thm_pc12): New Method.
4479 (Target_arm::Scan::local): Handle the relocations.
4480 (Target_arm::Scan::global): Likewise.
4481 (Target_arm::Relocate::relocate): Likewise.
4482 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4483
c9a2c125
DK
44842010-01-29 Doug Kwan <dougkwan@google.com>
4485
4486 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4487 of relocation types as ld.
4488
1521477a
DK
44892010-01-29 Doug Kwan <dougkwan@google.com>
4490
4491 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4492 to public.
4493 (Arm_relocate_functions::thumb_branch_common): Ditto.
4494 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4495 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4496 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4497 Arm_relocate_functions::jump24): Remove.
4498 (Target_arm::Relocate::relocate): Adjust code to call
4499 Arm_relocation_functions::arm_branch_common and
4500 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 4501 wrappers. Merge switch-cases together to reduce source code size.
1521477a 4502
e7eca48c
DK
45032010-01-29 Doug Kwan <dougkwan@google.com>
4504
4505 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4506 output_local_symbol_count_needs_update_.
4507 (Arm_relobj::output_local_symbol_count_needs_update,
4508 Arm_relobj::set_output_local_symbol_count_needs_update,
4509 Arm_relobj::update_output_local_symbol_count): New methods.
4510 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4511 member.
4512 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4513 of pointed function as in a R_ARM_PREL31 relocation.
4514 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4515 for output local symbol count updating.
4516 (Target_arm::do_relax): Update output local symbol counts in objects
4517 if necessary.
4518 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4519
02961d7e
ILT
45202010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4521
4522 * arm.cc: Added support for the ARM relocations:
4523 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4524 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4525 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4526 movw_prel_nc).
4527 (Arm_relocate_functions::movw_rel): New method.
4528 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4529 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4530 thm_movw_prel_nc).
4531 (Arm_relocate_functions::thm_movw_rel): New method.
4532 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4533 thm_movt_prel).
4534 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4535 relocations.
4536 (Target_arm::Scan::global): Likewise.
4537 (Target_arm::Relocate::relocate): Likewise.
4538 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4539 Likewise.
4540
b10d2873
ILT
45412010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4542
4543 * arm.cc: Added support for ARM group relocations.
4544 (Target_arm::reloc_needs_sym_origin): New method.
4545 (Arm_relocate_functions::calc_grp_kn): New method.
4546 (Arm_relocate_functions::calc_grp_residual): New method.
4547 (Arm_relocate_functions::calc_grp_gn): New method.
4548 (Arm_relocate_functions::arm_grp_alu): New Method.
4549 (Arm_relocate_functions::arm_grp_ldr): New Method.
4550 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4551 (Arm_relocate_functions::arm_grp_ldc): New Method.
4552 (Target_arm::Scan::local): Handle the ARM group relocations.
4553 (Target_arm::Scan::global): Likewise.
4554 (Target_arm::Relocate::relocate): Likewise.
4555 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4556 Likewise.
4557
2b328d4e
DK
45582010-01-26 Doug Kwan <dougkwan@google.com>
4559
4560 * arm.cc (set): Include.
4561 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4562 pointer type.
4563 (Arm_output_section::Text_section_list): New type.
4564 (Arm_output_section::append_text_sections_to_list): New method.
4565 (Arm_output_section::fix_exidx_coverage): Ditto.
4566 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4567 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4568 Relobj::set_section_offset() instead of
4569 Sized_relobj::invalidate_section_offset().
4570 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4571 parameter for section headers. Ignore relocation sections for
4572 unallocated sections and EXIDX sections.
4573 (Target_arm::fix_exidx_coverage): New method.
4574 (Target_arm::output_section_address_less_than): New type.
4575 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4576 linked text section instead of the EXIDX section.
4577 (Arm_output_section::create_stub_group): Add an assertion to check
4578 that this is not an EXIDX output section.
4579 (Arm_output_section::append_text_sections_to_list): New method.
4580 (Arm_output_section::fix_exidx_coverage): Ditto.
4581 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4582 Arm_relobj::section_needs_reloc_stub_scanning.
4583 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4584 first pass.
4585 (Target_arm::fix_exidx_coverage): New method.
4586 * object.h (Relobj::set_output_section): New method.
4587 (Sized_relobj::invalidate_section_offset): Remove method.
4588 (Sized_relobj::do_invalidate_section_offset): Remove method.
4589 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4590
c7f3c371
DK
45912010-01-25 Doug Kwan <dougkwan@google.com>
4592
4593 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4594 Fix warning due to signed and unsigned comparison on a 32-bit host.
4595
8923b24c
DK
45962010-01-22 Doug Kwan <dougkwan@google.com>
4597
4598 * arm.cc (Target_arm::do_relax): Record an output section for section
4599 offset adjustment it contains any stub table that has changed.
4600 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4601 offsets in an output section if necessary.
4602 * output.cc (Output_section::Output_section): Initialize
4603 section_offsets_need_adjustments_.
4604 (Output_section::add_input_section_for_script): Renamed to
4605 Output_section::add_simple_input_section.
4606 (Output_section::save_states): Add a comment.
4607 (Output_section::discard_states): New method defintion.
4608 (Output_section::adjust_section_offsets): Same.
4609 * output.h (Output_section::add_input_section_for_script): Renamed to
4610 Output_section::add_simple_input_section.
4611 (Output_section::discard_states): New method declaration.
4612 (Output_section::adjust_section_offsets): Same.
4613 (Output_section::section_offsets_need_adjustment,
4614 Output_section::set_section_offsets_need_adjustment): New method
4615 definitions.
4616 (Output_section::section_offsets_need_adjustment_): New data member.
4617 * script-sections.cc
4618 (Output_section_element_input::set_section_address): Adjust code for
4619 renaming of Output_section::add_input_section_for_script.
4620 (Orphan_output_section::set_section_address): Same.
4621
9b2fd367
DK
46222010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4623
4624 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4625 Fix_v4bx enum values .
4626 * gold/options.h (General_options): New option definitions.
4627 (General_options::fix_v4bx): New method.
4628 (General_options::Fix_v4bx): New enum.
4629 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4630 (General_options::parse_fix_v4bx_interworking): New method.
4631
80d0d023
DK
46322010-01-22 Doug Kwan <dougkwan@google.com>
4633
4634 * arm.cc (Arm_exidx_fixup): New class.
4635
af2cdeae
DK
46362010-01-21 Doug Kwan <dougkwan@google.com>
4637
4638 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4639 classes.
4640 (Arm_exidx_section_offset_map): New type.
4641
993d07c1
DK
46422010-01-21 Doug Kwan <dougkwan@google.com>
4643
4644 * arm.cc (Arm_exidx_input_section): New class.
4645 (Arm_relobj::exidx_input_section_by_link,
4646 Arm_relobj::exidx_input_section_by_shndx,
4647 Arm_relobj::make_exidx_input_section): New methods.
4648 (read_arm_attributes_section): Remove.
4649 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4650 information about them.
4651 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4652 to here.
4653
5ac169d4
DK
46542010-01-20 Doug Kwan <dougkwan@google.com>
4655
4656 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4657 Input_section_specifier to Section_id.
4658 (Target_arm::new_arm_input_section: Adjust code for change of key
4659 type.
4660 (Target_arm::find_arm_input_section): Ditto.
4661 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4662 (Section_id): Remove.
4663 (Garbage_collection::Section_id_hash): Remove.
4664 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4665 (Section_id): Remove.
4666 (Icf::Section_id_hash): Remove.
4667 * object.h (Section_id, Const_section_id, Section_id_hash,
4668 Const_section_id_hash): New type definitions.
4669 * output.cc (Output_section::add_relaxed_input_section): Change to
4670 use Const_section_id instead of Input_section_specifier as key type.
4671 (Output_section::add_merge_input_section): Ditto.
4672 (Output_section::build_relaxation_map): Change to use Section_id
4673 instead of Input_section_specifier as key type.
4674 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4675 Ditto.
4676 (Output_section::convert_input_sections_to_relaxed_sections): Change
4677 to use Const_section_id instead of Input_section_specifier as key type.
4678 (Output_section::find_merge_section): Ditto.
4679 (Output_section::find_relaxed_input_section): Ditto.
4680 * output.h (Input_section_specifier): Remove class.
4681 (Output_section::Output_section_data_by_input_section_map): Change
4682 key type to Const_section_id.
4683 (Output_section::Output_relaxed_input_section_by_input_section_map):
4684 Ditto.
4685 (Output_section::Relaxation_map): Change key type to Section_id.
4686
a2162063
ILT
46872010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4688
4689 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4690 (class Arm_v4bx_stub): New class.
4691 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4692 (Stub_factory::make_arm_v4bx_stub): New method.
4693 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4694 (Stub_table::empty): Handle v4bx stubs.
4695 (Stub_table::add_arm_v4bx_stub): New method.
4696 (Stub_table::find_arm_v4bx_stub): New method.
4697 (Arm_relocate_functions::v4bx): New method.
4698 (Target_arm::fix_v4bx): New method.
4699 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4700 (Stub_table::relocate_stubs): Likewise.
4701 (Stub_table::do_write): Likewise.
4702 (Stub_table::update_data_size_and_addralign): Likewise.
4703 (Stub_table::finalize_stubs): Likewise.
4704 (Target_arm::Scan::local): Likewise.
4705 (Target_arm::Scan::global): Likewise.
4706 (Target_arm::do_finalize_sections): Likewise.
4707 (Target_arm::Relocate::relocate): Likewise.
4708 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4709 Likewise.
4710 (Target_arm::scan_reloc_for_stub): Likewise.
4711 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4712
5696ab0b
ILT
47132010-01-19 Ian Lance Taylor <iant@google.com>
4714
4715 * output.cc (Output_section_headers::do_sized_write): Write large
4716 segment count to sh_info field.
4717 (Output_file_header::do_sized_write): For large segment count,
4718 write PN_XNUM to e_phnum field.
4719
800d0f56
ILT
47202010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4721
4722 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4723 (Arm_relocate_functions::thm_jump8): New function.
4724 (Arm_relocate_functions::thm_jump11): New function.
4725 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4726 R_ARM_THM_JUMP11.
4727 (Target_arm::Scan::global): Likewise.
4728 (Target_arm::Relocate::relocate): Likewise.
4729 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4730 Likewise.
4731
41263c05
DK
47322010-01-14 Doug Kwan <dougkwan@google.com>
4733
4734 * arm.cc (map, utility): Include headers.
4735 (Target_arm::apply_cortex_a8_workaround): New method.
4736 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4737 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4738 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4739 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4740 the --[no-]fix-cortex-a8 command line options.
4741 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4742 (Target_arm::relocate_stub): Use addend in instruction template.
4743 * options.h (DEFINE_bool): Set the user-set flag.
4744 (General_options): Add --[no-]-fix-cortex options.
4745 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 4746 : Update fast look-up map after conversion.
41263c05 4747
459e9b03
ST
47482010-01-14 Sriraman Tallam <tmsriram@google.com>
4749
4750 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4751 in the first pass of do_layout.
4752
b521dfe4
DK
47532010-01-13 Doug Kwan <dougkwan@google.com>
4754
4755 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4756 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4757 apparent compiler problem of not folding static constant integral
4758 data members of elfcpp::Elf_sizes<32>.
4759
44272192
DK
47602010-01-13 Doug Kwan <dougkwan@google.com>
4761
4762 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4763 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4764 Arm_relobj::scan_section_for_cortex_a8_erratum,
4765 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4766 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4767 sections to scan for relocation stubs into a new method
4768 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4769 relocation and Cortex-A8 stub scanning.
4770 (Target_arm::do_relax): Force stubs to be after stubbed sections
4771 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 4772 the beginning of a new relaxation pass. Update a comment.
44272192
DK
4773 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4774
44b71ece
ILT
47752010-01-12 Ian Lance Taylor <iant@google.com>
4776
4777 * target-reloc.h (visibility_error): New inline function.
4778 (relocate_section): Call visibility_error.
4779 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4780 (MOSTLYCLEANFILES): Likewise.
4781 (protected_4_pic.o, protected_3.err): New targets.
4782 * testsuite/protected_4.cc: New file.
4783
a120bc7f
DK
47842010-01-12 Doug Kwan <dougkwan@google.com>
4785
4786 * arm.cc (Cortex_a8_reloc): New class.
4787 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4788 and cortex_a8_relocs_info_.
4789 (Target_arm::fix_cortex_a8): New method definition.
4790 (Target_arm::Cortex_a8_relocs_info): New type.
4791 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4792 New data member declarations.
4793 (Target_arm::scan_reloc_for_stub): Record information about
4794 relocations for THUMB branches that might be exempted from the
4795 Cortex-A8 workaround.
4796 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4797 at the beginning of a relaxation pass.
4798
20138696
DK
47992010-01-12 Doug Kwan <dougkwan@google.com>
4800
4801 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4802 (Arm_relobj::Mapping_symbol_position,
4803 Arm_reloj::Mapping_symbol_position_less,
4804 Arm_relobj::Mapping_symbols_info): New types.
4805 (Target_arm::is_mapping_symbol_name): New method definition.
4806 (Arm_relobj::do_count_local_symbols): Save information about mapping
4807 symbols.
4808
089d69dc
DK
48092010-01-11 Doug Kwan <dougkwan@google.com>
4810
4811 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4812 Arm_relocate_functions::thumb32_branch_upper,
4813 Arm_relocate_functions::thumb32_branch_lower,
4814 Arm_relocate_functions::thumb32_cond_branch_offset,
4815 Arm_relocate_functions::thumb32_cond_branch_upper,
4816 Arm_relocate_functions::thumb32_cond_branch_lower,
4817 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4818 branch offset encoding.
4819 (Arm_relocate_functions::thumb_branch_common): Use new branch
4820 offset encoding methods to avoid code duplication.
4821 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4822 (Stub_addend_reader::operator()): Use new branch encoding method
4823 to avoid code duplication.
4824
99e5bff2
DK
48252010-01-11 Doug Kwan <dougkwan@google.com>
4826
4827 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4828 (Target_arm::do_finalize_sections): Define special EXIDX section
4829 symbols only if referenced.
4830 * gc.h (Garbage_collection::add_reference): New method.
4831 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4832 code duplication.
4833
98e090bd
ILT
48342010-01-11 Ian Lance Taylor <iant@google.com>
4835
d0a91bd8
ILT
4836 * script.cc (Version_script_info::build_expression_list_lookup):
4837 Change complaing about duplicate wildcard match from error to
4838 warning.
4839
98e090bd
ILT
4840 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4841 of 2009-12-30.
4842 (Version_script_info::Version_script_info): Initialize globs_,
4843 default_version_, default_is_global_, and exact_. Don't
4844 initialize globals_ or locals_.
4845 (Version_script_info::build_lookup_tables): Build local symbols
4846 first.
4847 (Version_script_info::unquote): New function.
4848 (Version_script_info::add_exact_match): New function.
4849 (Version_script_info::build_expression_list_lookup): Remove lookup
4850 parameter. Add is_global parameter. Change all callers. Handle
4851 wildcard pattern specially. Unquote pattern. Call
4852 add_exact_match.
4853 (Version_script_info::get_name_to_match): New function.
4854 (Version_script_info::get_symbol_version): New function.
4855 (Version_script_info::get_symbol_version_helper): Remove.
4856 (Version_script_info::check_unmatched_names): Call unquote.
4857 * script.h (class Version_script_info): Change get_symbol_version
4858 to be non-inline and add is_global parameter; change all callers.
4859 Rewrite symbol_is_local. Update declarations. Define struct
4860 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4861 Remove globals_ and locals_ members. Add exact_, globs_,
4862 default_version_, is_global_.
4863 (Version_script_info::Glob): Remove pattern, add expression and
4864 is_global. Update constructor. Change all callers.
4865 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4866 default version.
4867 (Versions::symbol_section_contents): If a symbol is undefined, or
4868 defined in a dynamic object, set the version index to
4869 VER_NDX_LOCAL.
4870 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4871 symbol_is_local.
4872 (Symbol_table::add_from_pluginobj): Likewise.
4873 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4874
d56962d3
DK
48752010-01-11 Doug Kwan <dougkwan@google.com>
4876
4877 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4878 (incremental_dump_LDADD): Add linking option for libintl.
4879 * Makefile.in: Regenerate.
4880
94e6ee91
L
48812010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4882
4883 PR gold/11144
4884 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4885 instead of -Ds.
4886 * testsuite/Makefile.in: Regenerated.
4887
e96c574b
DK
48882010-01-10 Doug Kwan <dougkwan@google.com>
4889
4890 * options.h (DEFINE_var): Use parentheses around argument varname__
4891 in macro body to avoid any unintended subsequent substitutions.
4892
7198066b
ILT
48932010-01-10 Ian Lance Taylor <iant@google.com>
4894
ba4d53bf
ILT
4895 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4896 candidates before doing symbol resolution.
4897
7198066b
ILT
4898 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4899 ODR candidates if only one is weak.
4900
a2beed37
ILT
49012010-01-08 Ian Lance Taylor <iant@google.com>
4902
4903 * script.cc (Version_script_info::build_expression_list_lookup):
4904 Don't warn about ambiguous version, just record the ambiguity.
4905 (Version_script_info::get_symbol_version_helper): Give error if
4906 version is ambiguous.
4907
2fb7225c
DK
49082010-01-08 Doug Kwan <dougkwan@google.com>
4909
4910 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4911 prev_data_size_ and prev_addralign_. Remove initializer for
4912 deleted data member has_been_changed_.
4913 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4914 to determine if the table is empty.
4915 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4916 Remove.
4917 (Stub_table::add_reloc_stub): Define method in class definition
4918 instead of just declaring it there.
4919 (Stub_table::add_cortex_a8_stub): New method definition.
4920 (Stub_table::update_data_size_and_addralign): Ditto.
4921 (Stub_table::finalize_stubs): Ditto.
4922 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4923 (Stub_table::do_addralign_): Return address alignment in the
4924 (Stub_table::do_reset_address_and_file_offset): Define method in
4925 class definition instead of declaring it there. Set current data
4926 size to be the data size of the previous pass.
4927 (Stub_table::set_final_data_size): Use current data size as the
4928 final data size.
4929 (Stub_table::relocate_stub): Change parameter type of stub from
4930 Reloc_stub pointer to Stub pointer.
4931 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4932 (Stub_table::Cortex_a8_stub_list): New typedef.
4933 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4934 Stub_table::prev_addralign_): New data member.
4935 (Arm_relobj::Arm_relobj): Initialize data member
4936 section_has_cortex_a8_workaround_.
4937 (Arm_relobj::section_has_cortex_a8_workaround,
4938 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4939 definitions.
4940 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4941 declarations.
4942 (Target_arm::relocate_stub): Change parameter type of stub from
4943 Reloc_stub pointer to Stub pointer.
4944 (Insn_template::size, Insn_template::alignment): Handle
4945 THUMB16_SPECIAL_TYPE.
4946 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4947 Stub_table::update_data_size_and_addralign,
4948 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4949 definitions.
4950 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4951 (Stub_table::do_write): Ditto.
4952 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4953
880cd20d
ILT
49542010-01-08 Ian Lance Taylor <iant@google.com>
4955
4956 PR 11108
4957 * symtab.h (class Symbol): Remove fields is_target_special_ and
4958 has_plt_offset_. Add field is_defined_in_discarded_section_.
4959 (Symbol::is_defined_in_discarded_section): New function.
4960 (Symbol::set_is_defined_in_discarded_section): New function.
4961 (Symbol::has_plt_offset): Rewrite.
4962 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4963 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4964 Don't initialize is_target_special_ or has_plt_offset_.
4965 Initialize is_defined_in_discarded_section_.
4966 (Symbol_table::add_from_relobj): If appropriate, set
4967 is_defined_in_discarded_section.
4968 * resolve.cc (Symbol::override_base_with_special): Don't test
4969 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4970 * target-reloc.h (relocate_section): Do special handling for
4971 symbols defined in discarded sections for global symbols as well
4972 as local symbols.
4973
2703e3eb
ILT
49742010-01-08 Ian Lance Taylor <iant@google.com>
4975
4976 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4977 the SHT_SYMTAB case.
4978
339d40a3
ILT
49792010-01-08 Ian Lance Taylor <iant@google.com>
4980
4981 * object.cc (Sized_relobj::do_layout): Don't get confused if
4982 layout_eh_frame returns NULL.
4983
abecea76
ILT
49842010-01-08 Ian Lance Taylor <iant@google.com>
4985
4986 PR 11084
4987 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4988 dynamic symbol table, use the normal symbol table.
4989 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4990 symbol table.
4991
6b7dd3f3
ILT
49922010-01-08 Ian Lance Taylor <iant@google.com>
4993
4994 PR 11072
4995 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4996 sections.
4997
36c50e63
L
49982010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4999
5000 * version.cc (print_version): Change to "Copyright 2010".
5001
e291e7b9
ILT
50022010-01-08 Ian Lance Taylor <iant@google.com>
5003
5004 PR 10287
5005 PR 11063
5006 * i386.cc (class Target_i386): Change return type of plt_section
5007 to be non-const.
5008 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5009 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5010 tls_desc_rel_ field.
5011 (Output_data_plt_i386::rel_tls_desc): New function.
5012 (Target_i386::rel_tls_desc_section): New function.
5013 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5014 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5015 R_386_TLS_DESC reloc in rel_tls_desc_section.
5016 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5017 Define struct Tlsdesc_info.
5018 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5019 (Target_x86_64::do_reloc_symbol_index): New function.
5020 (Target_x86_64::add_tlsdesc_info): New function.
5021 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5022 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5023 tlsdesc_rel_ field.
5024 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5025 all callers.
5026 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5027 (Target_x86_64::rela_tlsdesc_section): New function.
5028 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5029 handling.
5030 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5031 (Target_x86_64::do_reloc_addend): New function.
5032 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5033 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5034 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5035 (Output_reloc::type): New function.
5036 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5037 (Output_reloc::is_target_specific): New function.
5038 (Output_reloc::target_arg): New function.
5039 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5040 absolute relocs and target specific relocs.
5041 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5042 add_target_specific.
5043 (class Output_data_reloc) [SHT_RELA]: Likewise.
5044 * output.cc (Output_reloc::Output_reloc): Add four new versions
5045 for absolute relocs and target specific relocs.
5046 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5047 (Output_reloc::get_symbol_index): Likewise.
5048 (Output_reloc::local_section_offset): Check that local_sym_index_
5049 is not TARGET_CODE or 0.
5050 (Output_reloc::symbol_value): Likewise.
5051 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5052 reloc.
5053 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5054 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5055 functions.
5056 * layout.cc (add_target_dynamic_tags): Use output section for
5057 DT_PLTRELSZ and DT_JMPREL.
5058
3a44184e
ILT
50592010-01-07 Ian Lance Taylor <iant@google.com>
5060
5061 PR 11061
5062 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5063 function.
5064 (class Output_data_reloc_generic): Define.
5065 (class Output_data_reloc_base): Change base class to
5066 Output_data_reloc_generic. Change add() method to call
5067 bump_relative_reloc_count for a relative reloc. Remove
5068 sort_relocs_ field.
5069 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5070 to sort_relocs().
5071 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5072 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5073 appropriate.
5074 * layout.h (class Layout): Update declaration.
5075
ea715a34
ILT
50762010-01-07 Ian Lance Taylor <iant@google.com>
5077
5078 * output.h (class Output_data): Add const version of
5079 output_section and do_output_section.
5080 (class Output_section_data): Add const version of
5081 do_output_section.
5082 (class Output_section): Likewise.
5083 * layout.cc (Layout::add_target_dynamic_tags): New function.
5084 * layout.h (class Layout): Update declarations.
5085 * arm.cc (Target_arm::do_finalize_sections): Use
5086 add_target_dynamic_tags.
5087 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5088 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5089 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5090 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5091
659948a4
ILT
50922010-01-07 Ian Lance Taylor <iant@google.com>
5093
5094 PR 11042
5095 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5096 object as needed.
5097
9d3b86f6
ILT
50982010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5099 Ian Lance Taylor <iant@google.com>
5100
5101 PR 11019
5102 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5103 Xindex::read_symtab_xindex.
5104
bb0d3eb0
DK
51052010-01-07 Doug Kwan <dougkwan@google.com>
5106
5107 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5108 (Insn_template::thumb16_bcond_insn): New method declaration.
5109 (Insn_template): Fix spelling.
5110 (Stub::thumb16_special): New method declaration.
5111 (Stub::do_write): Define virtual method which was previously pure
5112 virtual.
5113 (Stub::do_thumb16_special): New method declaration.
5114 (Stub::do_fixed_endian_write): New template member.
5115 (Reloc_stub::do_write): Remove.
5116 (Reloc_stub::do_fixed_endian_write): Remove.
5117 (Cortex_a8_stub): New class definition.
5118 (Stub_factory::make_cortex_a8_stub): New method definition.
5119 (Stub_factory::Stub_factory): Add missing static storage class
5120 qualifier for elf32_arm_stub_a8_veneer_blx.
5121
ffeef7df
ILT
51222010-01-07 Ian Lance Taylor <iant@google.com>
5123
dc3f80fe
ILT
5124 PR 10980
5125 * options.h (class General_options): Add --warn-unresolved-symbols
5126 and --error-unresolved-symbols.
5127 * errors.cc (Errors::undefined_symbol): Implement
5128 --warn-unresolved-symbols.
5129
ffeef7df
ILT
5130 * options.h (class General_options): Add -z text and -z textoff.
5131 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5132
f1ec9ded
ST
51332010-01-06 Sriraman Tallam <tmsriram@google.com>
5134
5135 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5136 (Garbage_collection::cident_sections): New function.
5137 (Garbage_collection::add_cident_section): New function.
5138 (Garbage_collection::cident_sections_): New member.
5139 (gc_process_relocs): Add references to sections whose names are C
5140 identifiers.
5141 * gold.h (cident_section_start_prefix): New constant.
5142 (cident_section_stop_prefix): New constant.
5143 (is_cident): New function.
5144 * layout.cc (Layout::define_section_symbols): Replace string constants
5145 with the newly defined constants.
5146 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5147 C identifiers.
5148 * testsuite/Makefile.am: Add gc_orphan_section_test.
5149 * testsuite/Makefile.in: Regenerate.
5150 * testsuite/gc_orphan_section_test.cc: New file.
5151 * testsuite/gc_orphan_section_test.sh: New file.
5152
6eda8c29
ILT
51532010-01-06 Ian Lance Taylor <iant@google.com>
5154
b9674e17
ILT
5155 PR 10980
5156 * options.h (class General_options): Add --warn-shared-textrel.
5157 * layout.cc (Layout::finish_dynamic_section): Implement
5158 --warn-shared-textrel.
5159
6eda8c29
ILT
5160 PR 10980
5161 * options.h (class General_options): Add --warn-multiple-gp.
5162
32dcd44e
ILT
51632010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5164
5165 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5166 $(THREADSLIB) and $(LIBDL).
5167 * Makefile.in: Rebuild.
5168
a192ba05
ILT
51692010-01-06 Ian Lance Taylor <iant@google.com>
5170
5171 PR 10980
5172 * options.cc (General_options::parse_section_start): New function.
5173 (General_options::section_start): New function.
5174 (General_options::General_options): Initialize all members.
5175 * options.h: Include <map>
5176 (class General_options): Add --section-start. Add section_starts_
5177 member.
5178 * layout.cc (Layout::attach_allocated_section_to_segment): If
5179 --section-start was used, set the address of the segment. Remove
5180 local sort_sections.
5181 (Layout::relaxation_loop_body): If the address of the load segment
5182 has been set by --section-start, don't use it.
5183 * output.h (Output_segment::update_flags_for_output_section): New
5184 function.
5185 * output.cc (Output_segment::add_output_section): Call
5186 update_flags_for_output_section.
5187
dde3f402
ILT
51882010-01-05 Ian Lance Taylor <iant@google.com>
5189
62dfdd4d
ILT
5190 PR 10980
5191 * options.h (class General_options): Add --undefined-version.
5192 * script.cc (struct Version_expression): Add was_matched_by_symbol
5193 field.
5194 (Version_script_info::matched_symbol): New function.
5195 (Version_script_info::get_symbol_version_helper): Call
5196 matched_symbol.
5197 (Version_script_info::check_unmatched_names): New function.
5198 * script.h (class Version_script_info): Update declarations.
5199 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5200
9c4ae156
ILT
5201 * options.h (class General_options): Use DEFINE_bool_alias for
5202 allow_multiple_definition.
5203 * resolve.cc (Symbol_table::should_override): Don't test
5204 allow_multiple_definition.
5205
dde3f402
ILT
5206 PR 10980
5207 * options.h (class General_options): Add --cref.
5208 * main.cc (main): Print cref table if --cref. Don't close mapfile
5209 until after printing cref table.
5210 * cref.cc: Include "symtab.h".
5211 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5212 (Cref_table_compare::operator()): New function.
5213 (Cref_inputs::gather_cref): New function.
5214 (filecol): New static const.
5215 (Cref_inputs::print_cref): New function.
5216 (Cref::print_cref): New function.
5217 * cref.h: Include <cstdio>.
5218 (class Cref): Update declarations.
5219 * mapfile.h (Mapfile::file): New function.
5220 * object.h (class Object): Define Symbols. Declare virtual
5221 do_get_global_symbols.
5222 (Object::get_global_symbols): New function.
5223 * object.cc (Input_objects::add_object): Pass object to cref_ if
5224 --cref.
5225 (Input_objects::archive_start): Likewise.
5226 (Input_objects::archive_stop): Likewise.
5227 (Input_objects::print_cref): New function.
5228 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5229 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5230 --cref.
5231 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5232 function.
5233 * plugin.h (class Sized_pluginobj): Update declarations.
5234
8781f709
ILT
52352010-01-05 Ian Lance Taylor <iant@google.com>
5236
5237 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5238 to is_default_version. Rename insdef to insdefault.
5239 (Symbol_table::add_from_relobj): Rename def to is_default_version
5240 and local to is_forced_local.
5241 (Symbol_table::add_from_pluginobj): Likewise.
5242 (Symbol_table::add_from_dynobj): Likewise.
5243 (Symbol_table::define_special_symbol): Rename insdef to
5244 insdefault.
5245
fe35d28d
ILT
52462010-01-04 Ian Lance Taylor <iant@google.com>
5247
30bc8c46
ILT
5248 PR 10980
5249 * options.h (class General_options): Add
5250 --allow-multiple-definition and -z muldefs.
5251 * resolve.cc (Symbol_table::should_override): Don't warn about a
5252 multiple symbol definition if --allow-multiple-definition or -z
5253 muldefs.
5254
7eaea549
ILT
5255 PR 10980
5256 * options.h (class General_options): Add --add-needed and
5257 --copy-dt-needed-entries. Tweak --as-needed help entry.
5258 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5259 error if --copy-dt-needed-entries aka --add-needed is used and
5260 would cause a change in behaviour.
5261
fe35d28d
ILT
5262 PR 10980
5263 * options.h (class General_options): Add -G as a short version of
5264 --shared. Add no-op options -assert, -g, and -i.
5265
55a2bb35
ST
52662010-01-04 Sriraman Tallam <tmsriram@google.com>
5267
5268 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5269 check for .text or .gnu.linkonce.t sections.
5270 * icf.cc (Icf::find_identical_sections): Ditto.
5271 Change the detection for mangled function name within the section
5272 name.
5273 * icf.h (is_section_foldable_candidate): New function.
5274
719328e1
ILT
52752009-12-30 Ian Lance Taylor <iant@google.com>
5276
5277 PR 10980
5278 * options.h (class General_options): Permit two dashes with
5279 --retain-symbols-file.
5280
d7bb5745
ILT
52812009-12-30 Ian Lance Taylor <iant@google.com>
5282
403a15dd
ILT
5283 PR 10979
5284 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5285 don't put the file header and segment headers in the text
5286 segment.
5287
eda294df
ILT
5288 PR 10979
5289 * common.cc (Sort_commons::operator()): Stabilize sort when both
5290 entries are NULL.
5291 (Symbol_table::do_allocate_commons_list): When allocating common
5292 symbols, skip a symbol which is no longer common.
5293 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5294 an object before checking its type.
5295 * testsuite/common_test_2.c: New file.
5296 * testsuite/common_test_3.c: New file.
5297 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5298 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5299 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5300 (common_test_2_pic.o, common_test_2.so): New targets.
5301 (common_test_3_pic.o, common_test_3.so): New targets.
5302 * testsuite/Makefile.in: Rebuild.
5303
d7bb5745
ILT
5304 PR 10979
5305 * script.cc (read_input_script): If we see a new SECTIONS clause,
5306 and we have added an input section, give an error.
5307 * layout.h (class Layout): Add have_added_input_section function.
5308 Add have_added_input_section_ field.
5309 * layout.cc (Layout::Layout): Initialize
5310 have_added_input_section_.
5311 (Layout::layout): Set have_added_input_section_.
5312 (Layout::layout_eh_frame): Likewise.
5313
fc59c572
ILT
53142009-12-30 Ian Lance Taylor <iant@google.com>
5315
5316 PR 10931
5317 * options.h (class General_options): Add --sort-common option.
5318 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5319 * common.cc (Sort_common): Add sort_order parameter to
5320 constructor. Add sort_order_ field.
5321 (Sort_commons::operator): Check sort_order_.
5322 (Symbol_table::allocate_commons): Determine the sort order.
5323 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5324 Change all callers.
5325 (Symbol_table::do_allocate_commons_list): Likewise.
5326
1c74fab0
ILT
53272009-12-30 Ian Lance Taylor <iant@google.com>
5328
5329 PR 10916
5330 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5331 symbols from this object, don't change the visibility of an
5332 undefined symbol.
5333 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5334
6affe781
ILT
53352009-12-30 Ian Lance Taylor <iant@google.com>
5336
5337 PR 10861
5338 * script.h (class Version_script_info): Define Language enum.
5339 Update declarations. Define Glob, Exact, and Lookup types. Add
5340 new fields globals_, locals_, and is_finalized_.
5341 * script.cc: Various formatting fixes.
5342 (class Parser_closure): Change language_stack_ from a vector of
5343 std::string to one of Version_script_info::Language. Adjust all
5344 uses accordingly.
5345 (class Lazy_demangler): Remove.
5346 (struct Version_expression): Change language from std::string to
5347 Version_script_info::Language.
5348 (Version_script_info::Version_script_info): New function.
5349 (Version_script_info::~Version_script_info): Don't call clear.
5350 (Version_script_info::finalize): New function.
5351 (Version_script_info::build_lookup_tables): New function.
5352 (Version_script_info::build_expression_list_lookup): New
5353 function.
5354 (Version_script_info::get_symbol_version_helper): Rewrite to use
5355 lookup tables.
5356 (Version_script_info::print_expression_list): Adjust to use
5357 Version_script_info::Language.
5358 (script_push_lex_into_version_mode): Check that the version script
5359 has not been finalized.
5360 (version_script_push_lang): Change language string to
5361 Version_script_info::Language.
5362 * options.cc (Command_line::version_script): New function.
5363 * options.h (class General_options): Add finalize_dynamic_list
5364 function. Change version_script from declaration to definition.
5365 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5366 * testsuite/version_script.map: Remove duplicate def of foo.
5367 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5368 version_script.map.
5369 * testsuite/Makefile.in: Rebuild.
5370
818bf354
ILT
53712009-12-30 Ian Lance Taylor <iant@google.com>
5372
5373 PR 10843
5374 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5375 if the input symbol index is 0, make the output symbol index 0.
5376
ebcc8304
ILT
53772009-12-30 Ian Lance Taylor <iant@google.com>
5378
5379 PR 10670
5380 * options.h (class General_options): Add -x/--discard-all.
5381 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5382 --discard-all. If the local symbol needs a dynamic entry, check
5383 that before handling --discard-locals.
5384
176fe33f
ILT
53852009-12-30 Ian Lance Taylor <iant@google.com>
5386
bb321bb1
ILT
5387 PR 10450
5388 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5389 flags to PF_R.
5390 (Output_segment::add_output_section): Don't change the flags if
5391 the type is PT_TLS.
5392
176fe33f
ILT
5393 PR 10450
5394 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5395 GNU hash table if they need a dynamic value. Otherwise, don't add
5396 them if they are defined in a dynamic object or are forced local.
5397
e8cd95c7
ILT
53982009-12-29 Ian Lance Taylor <iant@google.com>
5399
1b81fb71
ILT
5400 PR 10450
5401 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5402 .gnu.hash table for a 32-bit target.
5403
8d6d383d
ILT
5404 PR 10450
5405 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5406 regular and a dynamic object only needs a dynamic symbol table
5407 entry if it is externally visible.
5408
e785ec03
ILT
5409 PR 10450
5410 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5411 constructor. Add global_offset_table_ field.
5412 (Target_i386::got_section): Set global_offset_table_.
5413 (Target_i386::do_finalize_sections): Set global_offset_table_
5414 size.
5415 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5416 in constructor. Add global_offset_table_ field.
5417 (Target_x86_64::got_section): Set global_offset_table_.
5418 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5419 size.
5420
1a2dff53
ILT
5421 * layout.cc (Layout::Layout): Initialize increase_relro_.
5422 (Layout::get_output_section): Add is_relro, is_last_relro, and
5423 is_first_non_relro parameters. Change all callers.
5424 (Layout::choose_output_section): Likewise.
5425 (Layout::add_output_section_data): Likewise.
5426 (Layout::make_output_section): Likewise.
5427 (Layout::set_segment_offsets): Clear increase_relro when using a
5428 linker script.
5429 * layout.h (class Layout): Add increase_relro method. Add
5430 increase_relro_ field. Update declarations.
5431 * output.cc (Output_section::Output_section): Initialize
5432 is_last_relro_ and is_first_non_relro_.
5433 (Output_segment::add_output_section): Group relro sections is
5434 do_sort is true. Handle is_last_relro and is_first_non_relro.
5435 (Output_segment::maximum_alignment): Remove relro handling.
5436 (Output_segment::set_section_addresses): Add increase_relro
5437 parameter. Change all callers. Add initial alignment to align
5438 relro sections on separate page. Remove old relro handling.
5439 (Output_segment::set_section_list_addresses): Remove in_relro
5440 parameter. Change all callers.
5441 (Output_segment::set_offset): Add increase parameter. Change all
5442 callers. Remove old relro handling.
5443 * output.h (class Output_section): Add new methods: is_last_relro,
5444 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5445 Add is_last_relro_ and is_first_non_relro_ fields.
5446 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5447 Create separate .got.plt section. Call increase_relro.
5448 * x86_64.cc (Target_x86_64::got_section): Likewise.
5449 * testsuite/relro_script_test.t: Add .got.plt.
5450
f0ba79e2
ILT
5451 PR 10450
5452 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5453 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5454 (Layout::finalize): Call set_dynamic_symbol_size.
5455 (Layout::set_dynamic_symbol_size): New function.
5456 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5457 set_dynamic_symbol_size.
5458
e8cd95c7
ILT
5459 PR 10450
5460 * output.h (class Output_section): Add is_entsize_zero_ field.
5461 * output.cc (Output_section::Output_section): Initialize
5462 is_entsize_zero_.
5463 (Output_section::set_entsize): If two different entsizes are
5464 requested, force it to zero.
5465 (Output_section::add_input_section): Set flags for .debug_str
5466 before updating section flags. Set entsize.
5467 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5468 and SHF_STRING if all input sections have those flags.
5469
3e1b9a8a
RÁE
54702009-12-29 Rafael Espindola <espindola@google.com>
5471
5472 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
5473 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5474 reporting.
3e1b9a8a 5475
3dcad376
ST
54762009-12-29 Sriraman Tallam <tmsriram@google.com>
5477
5478 * options.cc (General_options::parse_version): Allow -v to exit
5479 without an error if there is nothing to link.
5480
084e2665
ILT
54812009-12-29 Ian Lance Taylor <iant@google.com>
5482
5483 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5484 using a version of gcc before 4.1.
5485 * configure: Rebuild.
5486
250acde3
CD
54872009-12-28 Chris Demetriou <cgd@google.com>
5488
5489 * attributes.cc (Output_attributes_section_data::do_write): Use
5490 std::vector::front rather than std::vector::data.
5491
99fff23b
ILT
54922009-12-28 Ian Lance Taylor <iant@google.com>
5493
5494 * symtab.h (class Symbol_table): Add enum Defined.
5495 * resolve.cc (Symbol_table::should_override): Add defined
5496 parameter. Change all callers. Test whether object is NULL
5497 before calling a method on it.
5498 (Symbol_table::report_resolve_problem): Add defined parameter.
5499 Change all callers.
5500 (Symbol_table::should_override_with_special): Likewise.
5501 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5502 parameter. Change all callers.
5503 (Symbol_table::do_define_in_output_data): Likewise.
5504 (Symbol_table::define_in_output_segment): Likewise.
5505 (Symbol_table::do_define_in_output_segment): Likewise.
5506 (Symbol_table::define_as_constant): Likewise.
5507 (Symbol_table::do_define_as_constant): Likewise.
5508 * script.h (class Symbol_assignment): Add is_defsym parameter to
5509 constructor; change all callers.
5510 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5511 parameter. Change all callers. Add is_defsym_ field.
5512 (class Parser_closure): Add parsing_defsym parameter to
5513 constructor; change all callers. Add parsing_defsym accessor
5514 function. Add parsing_defsym_ field.
5515
556bd683
ILT
55162009-12-28 Ian Lance Taylor <iant@google.com>
5517
5518 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 5519 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 5520
1782c879
ILT
55212009-12-23 Ian Lance Taylor <iant@google.com>
5522
5523 * i386.cc (Target_i386::do_calls_non_split): Recognize
5524 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
5525 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5526 -fsplit-stack prologue when using %r11.
1782c879 5527
329ca2b1
ST
55282009-12-21 Sriraman Tallam <tmsriram@google.com>
5529
5530 * options.cc (General_options::parse_version): Make -v continue and do
5531 the link like GNU ld does.
5532
d675ff46
RÁE
55332009-12-17 Rafael Avila de Espindola <espindola@google.com>
5534
5535 * Makefile.am (CCFILES): Add timer.cc.
5536 (HFILES): Add timer.h.
5537 * configure.ac: Check for sysconf and times.
5538 * main.cc: include timer.h.
5539 (main): Use Timer instead of get_run_time.
5540 * timer.cc: New.
5541 * timer.h: New.
5542 * workqueue.cc: include timer.h.
5543 (Workqueue::find_and_run_task):
5544 Report user, sys and wall time.
5545 * Makefile.in: Regenerate.
5546 * config.in: Regenerate.
5547 * configure: Regenerate.
5548
d6344fb5
DK
55492009-12-16 Doug Kwan <dougkwan@google.com>
5550
5551 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5552 sections.
5553 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5554 relaxed input sections.
5555 * output.cc (Output_section::find_relaxed_input_section): Change
5556 return type to Output_relaxed_input_section pointer. Adjust code
5557 for new type of relaxed_input_section_map_.
5558 * output.h (Output_section::find_relaxed_input_section): Change
5559 return type to Output_relaxed_input_section pointer.
5560 (Output_section::Output_relaxed_input_section_by_input_section_map):
5561 New type.
5562 (Output_section::relaxed_input_section_map_): Change type to
5563 Output_section::Output_relaxed_input_section_by_input_section_map.
5564 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5565 input section.
5566
0e0d5469
ILT
55672009-12-15 Ian Lance Taylor <iant@google.com>
5568
5569 * layout.cc (Layout::create_shstrtab): Only write out after input
5570 sections if we are compressing debug sections.
5571
0649a889
ILT
55722009-12-15 Ian Lance Taylor <iant@google.com>
5573
5574 * archive.cc (Archive::add_symbols): Only look up a symbol without
5575 a version if there is, in fact, a version.
5576
2ea97941
ILT
55772009-12-14 Ian Lance Taylor <iant@google.com>
5578
5579 Revert -Wshadow changes, all changes from:
5580 2009-12-11 Doug Kwan <dougkwan@google.com>
5581 2009-12-11 Nick Clifton <nickc@redhat.com>
5582 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5583
b0eec2cc
DK
55842009-12-11 Doug Kwan <dougkwan@google.com>
5585
5586 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5587 due to -Wshadow.
5588 * attributes.cc (Object_attribute::size): Ditto.
5589 (Attributes_section_data::size): Ditto.
5590 (Attributes_section_data::Attributes_section_data): Ditto.
5591 (Output_attributes_section_data::do_write): Ditto.
5592 * attributes.h (Object_attribute::set_type): Ditto.
5593 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5594
91d6fa6a
NC
55952009-12-11 Nick Clifton <nickc@redhat.com>
5596
5597 * archive.cc: Fix shadowed variable warnings.
5598 * arm.cc: Likewise.
5599 * compressed_output.cc: Likewise.
5600 * compressed_output.h: Likewise.
5601 * configure: Likewise.
5602 * dwarf_reader.cc: Likewise.
5603 * dynobj.cc: Likewise.
5604 * dynobj.h: Likewise.
5605 * ehframe.cc: Likewise.
5606 * ehframe.h: Likewise.
5607 * errors.cc: Likewise.
5608 * expression.cc: Likewise.
5609 * fileread.cc: Likewise.
5610 * fileread.h: Likewise.
5611 * freebsd.h: Likewise.
5612 * i386.cc: Likewise.
5613 * icf.cc: Likewise.
5614 * incremental.h: Likewise.
5615 * layout.cc: Likewise.
5616 * layout.h: Likewise.
5617 * mapfile.cc: Likewise.
5618 * merge.cc: Likewise.
5619 * merge.h: Likewise.
5620 * object.cc: Likewise.
5621 * object.h: Likewise.
5622 * options.h: Likewise.
5623 * output.cc: Likewise.
5624 * output.h: Likewise.
5625 * parameters.cc: Likewise.
5626 * plugin.cc: Likewise.
5627 * powerpc.cc: Likewise.
5628 * reduced_debug_output.cc: Likewise.
5629 * reduced_debug_output.h: Likewise.
5630 * reloc.cc: Likewise.
5631 * reloc.h: Likewise.
5632 * resolve.cc: Likewise.
5633 * script-sections.cc: Likewise.
5634 * script.cc: Likewise.
5635 * script.h: Likewise.
5636 * sparc.cc: Likewise.
5637 * symtab.cc: Likewise.
5638 * symtab.h: Likewise.
5639 * target-select.cc: Likewise.
5640 * target-select.h: Likewise.
5641 * token.h: Likewise.
5642 * workqueue.cc: Likewise.
5643 * workqueue.h: Likewise.
5644 * x86_64.cc: Likewise.
5645
a0351a69
DK
56462009-12-10 Doug Kwan <dougkwan@google.com>
5647
5648 * arm.cc (attributes.h): New include.
5649 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5650 (Arm_relobj::~Arm_relobj): Delete object pointed by
5651 attributes_section_data_.
5652 (Arm_relobj::attributes_section_data): New method definition.
5653 (Arm_relobj::attributes_section_data_): New data member declaration.
5654 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5655 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5656 attributes_section_data_.
5657 (Arm_dynobj::attributes_section_data): New method definition.
5658 (Arm_dynobj::attributes_section_data_): New data member declaration.
5659 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5660 initialization value of may_use_blx_ to false.
5661 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5662 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5663 object attributes to compute results instead of hard-coding.
5664 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5665 Target_arm::get_secondary_compatible_arch,
5666 Target_arm::set_secondary_compatible_arch
5667 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5668 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5669 New method declarations.
5670 (Target_arm::get_aeabi_object_attribute): New method definition.
5671 (Target_arm::attributes_section_data_): New data member declaration.
5672 (read_arm_attributes_section): New template definition.
5673 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5674 (Arm_dynobj::do_read_symbols): Ditto.
5675 (Target_arm::do_finalize_sections): Merge attributes sections from
5676 input. Check for BLX use after attributes section merging.
5677 Fix __exidx_start and __exidx_end visibility. Create an
5678 .ARM.attributes section if necessary.
5679 (Target_arm::get_secondary_compatible_arch,
5680 Target_arm::set_secondary_compatible_arch,
5681 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5682 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 5683 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
5684 New method definitions.
5685
b59befec
ILT
56862009-12-09 Ian Lance Taylor <iant@google.com>
5687
5688 * plugin.cc (Plugin::load): Don't cast from void* to a function
5689 pointer.
5690
1276bc89
ILT
56912009-12-09 Ian Lance Taylor <iant@google.com>
5692
5693 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5694 information fields.
5695
2f2de248
L
56962009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5697
5698 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5699 Replace two_file_shared_1.so with two_file_shared_2.so.
5700 * testsuite/Makefile.in: Regenerated.
5701
4f787271
DK
57022009-12-08 Doug Kwan <dougkwan@google.com>
5703
5704 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5705 (HFILES): Add attributes.h and int_encoding.h.
5706 * Makefile.in: Regenerate.
5707 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5708 function definitions to int_encoding.cc
5709 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5710 prototypes to int_encoding.h
5711 * reduced_debug_output.cc (int_encoding.h): New include.
5712 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5713 function definitions to int_encoding.cc
5714 (insert_into_vector, read_from_pointer): Move template definitions to
5715 int_encoding.h
5716 * attributes.cc: New file.
5717 * attributes.h: New file.
5718 * int_encoding.cc: New file.
5719 * int_encoding.h: New file.
5720
20b52f1a
RÁE
57212009-12-07 Rafael Avila de Espindola <espindola@google.com>
5722
5723 PR gold/11055
5724 * incremental-dump.cc (dump_incremental_inputs): New.
5725 (main): Use dump_incremental_inputs.
5726
53d7974c
L
57272009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5728
5729 PR gold/10893
5730 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5731 checking elfcpp::STT_FUNC.
5732 (Target_i386::Relocate::relocate): Likewise.
5733 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5734
5735 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5736 symbols from shared libraries into normal FUNC symbols.
5737
5738 * symtab.h (Symbol): Add is_func and use it.
5739
05a352e6
DK
57402009-12-05 Doug Kwan <dougkwan@google.com>
5741
5742 * arm.cc (Target_arm::arm_info): Initialize new fields
5743 attributes_section and attributes_vendor.
5744 * i386.cc (Target_i386::i386_info): Same.
5745 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5746 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5747 fields attributes_section and attributes_vendor.
53d7974c 5748 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
5749 * target.h (Target::attributes_section, Target::attributes_vendor,
5750 Target::is_attributes_section, Target::attribute_arg_type,
5751 Target::attributes_order): New method definitions.
5752 (Target::Target_info::attributes_section,
5753 Target::Target_info::attributes_vendor): New fields.
5754 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5755 virtual method definitions.
5756 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5757 attributes_section and attributes_vendor.
5758 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5759
f4e5969c
DK
57602009-12-05 Doug Kwan <dougkwan@google.com>
5761
5762 * arm.cc: Update comments about interworking and stub generation.
5763 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5764 considered as non-PIC.
5765 (Arm_relocate_functions::base_abs): Fix formatting.
5766 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5767 of function to use GOT entry address instead of offset.
5768 (Target_arm::Scan::global): Issue an error if a symbol would need a
5769 PLT does not get one because it is untyped. Remove code to create
5770 dynamic symbols for relative branches.
5771 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5772 takes unsigned integer instead of boolean.
5773
1abce4a6
L
57742009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5775
5776 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5777 (two_file_test_LDADD): Likewise.
5778 (common_test_1_LDADD): Likewise.
5779 (exception_test_LDADD) Likewise.
5780 (weak_test_LDADD): Likewise.
5781 (many_sections_test_LDADD): Likewise.
5782 (initpri1_LDADD): Likewise.
5783 (script_test_1_LDADD): Likewise.
5784 (script_test_2_LDADD): Likewise.
5785 (justsyms_LDADD): Likewise.
5786 (binary_test_LDADD): Likewise.
5787 (large_LDADD): Likewise.
5788 * testsuite/Makefile.in: Regenerated.
5789
adcf2816 57902009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 5791
adcf2816
L
5792 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5793 (Symbol_table::override_with_special): Likewise.
5794 (Symbol_table::add_from_object): Likewise.
5795
28e67f5d
RÁE
57962009-12-04 Rafael Avila de Espindola <espindola@google.com>
5797
5798 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5799 Don't set the data_offset twice.
5800
ae10a101
RÁE
58012009-12-04 Rafael Avila de Espindola <espindola@google.com>
5802
5803 * testsuite/Makefile.in: Regenerate.
5804
f59f41f3
DK
58052009-12-03 Doug Kwan <dougkwan@google.com>
5806
5807 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5808 (Target_arm::do_finalize_sections): Add parameter for symbol table
5809 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5810 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5811 parameter for symbol table pointer.
5812 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5813 an additional parameter for a pointer to symbol table.
5814 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5815 parameter for a symbol table pointer.
5816 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5817 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5818 Ditto.
5819 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5820 parameter for a symbol table pointer.
5821
ca55d848
RÁE
58222009-12-03 Rafael Avila de Espindola <espindola@google.com>
5823
5824 * incremental.cc (Incremental_inputs_header)
5825 (Incremental_inputs_header_write, Incremental_inputs_entry)
5826 (Incremental_inputs_entry_write): Move ...
5827 * incremental.h (Incremental_inputs_header)
5828 (Incremental_inputs_header_write, Incremental_inputs_entry)
5829 (Incremental_inputs_entry_write): here.
5830
3aec4f9c
RÁE
58312009-12-02 Rafael Avila de Espindola <espindola@google.com>
5832
5833 * incremental.cc (make_sized_incremental_binary): Set the target.
5834 Error if it is incompatible.
5835 * output.h (Output_file): Add filename method.
5836
9c0ae74d
RÁE
58372009-12-02 Rafael Avila de Espindola <espindola@google.com>
5838
5839 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5840 from the get_* methods.
5841
a45500ae
RÁE
58422009-12-02 Rafael Avila de Espindola <espindola@google.com>
5843
5844 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5845 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5846 Write 0 for the data_offset of scripts.
5847
325e6408
RÁE
58482009-12-02 Rafael Avila de Espindola <espindola@google.com>
5849
5850 * testsuite/Makefile.am: Add the incremental_test.sh test.
5851 * testsuite/incremental_test.sh: New.
5852 * testsuite/incremental_test_1.c: New.
5853 * testsuite/incremental_test_2.c: New.
5854
954c3e2e
RÁE
58552009-12-01 Rafael Avila de Espindola <espindola@google.com>
5856
5857 * incremental-dump.cc (main): Fix typos.
5858
f8086623
RÁE
58592009-11-27 Rafael Avila de Espindola <espindola@google.com>
5860
5861 PR gold/11025
5862 * incremental-dump.cc (main): Use llu to print 64 bit values.
5863
3b0dd6ac
L
58642009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5865 H.J. Lu <hongjiu.lu@intel.com>
5866
5867 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5868 $(LIBDL).
5869 (incremental_dump_LDADD): Likewise.
5870 * Makefile.in: Regenerated.
5871
a6d1ef57 58722009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 5873
a6d1ef57
DK
5874 Revert:
5875
5876 2009-11-25 Doug Kwan <dougkwan@google.com>
5877
5878 * arm.cc (Target_arm::Target_arm): Move method definition
5879 outside of class definition. Add code to handle
5880 --target1-rel, --target1-abs and --target2= options.
5881 (Target_arm::get_reloc_reloc_type): Change method to be
5882 non-static and const.
5883 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5884 New data member declaration.
5885 (Target_arm::Scan::local, Target_arm::Scan::global,
5886 Target_arm::Relocate::relocate,
5887 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5888 Adjust call to Target_arm::get_real_reloc_type.
5889 (Target_arm::get_real_reloc_type): Use command line options
5890 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5891 * options.h (--target1-rel, --target1-abs, --target2): New
5892 ARM-only options.
5893
50aeb7d4
DK
58942009-11-25 Doug Kwan <dougkwan@google.com>
5895
5896 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5897 class definition. Add code to handle --target1-rel, --target1-abs
5898 and --target2= options.
5899 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5900 and const.
5901 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5902 member declaration.
5903 (Target_arm::Scan::local, Target_arm::Scan::global,
5904 Target_arm::Relocate::relocate,
5905 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5906 call to Target_arm::get_real_reloc_type.
5907 (Target_arm::get_real_reloc_type): Use command line options to
5908 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5909 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5910 options.
5911
51938283
DK
59122009-11-25 Doug Kwan <dougkwan@google.com>
5913
5914 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5915 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5916 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5917 formatting.
5918 (Arm_relocate_functions::thm_call): Replace body with a call to
5919 Arm_relocate_functions::thumb_branch_common.
5920 (Arm_relocate_functions::thm_jump24,
5921 Arm_relocate_functions::thm_xpc22): New method definitions.
5922 (Arm_relocate_functions::thumb_branch_common): New method definition.
5923 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5924 operator.
5925 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5926 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5927
e2b8f3c4
RÁE
59282009-11-24 Rafael Avila de Espindola <espindola@google.com>
5929
5930 * Makefile.am: Build incremental-dump
5931 * Makefile.in: Regenerate.
5932 * incremental-dump.cc: New.
5933 * incremental.cc (Incremental_inputs_header_data,
5934 Incremental_inputs_entry_data): Move to incremental.h
5935 * incremental.h: (Incremental_inputs_header_data,
5936 Incremental_inputs_entry_data): Move from incremental.cc
5937
bcba9aec
RÁE
59382009-11-24 Rafael Avila de Espindola <espindola@google.com>
5939
5940 * incremental.cc (Incremental_inputs_header,
5941 Incremental_inputs_header_write, Incremental_inputs_entry,
5942 Incremental_inputs_entry_write): Add a typedef with the data type.
5943
7c3afe08
RÁE
59442009-11-24 Rafael Avila de Espindola <espindola@google.com>
5945
5946 * incremental.cc (Incremental_inputs_header,
5947 Incremental_inputs_header_write, Incremental_inputs_entry,
5948 Incremental_inputs_entry_write): Update comment about which
5949 type has the filed descriptions.
5950
d204b6e9
DK
59512009-11-15 Doug Kwan <dougkwan@google.com>
5952
5953 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5954 (Arm_relocate_functions::arm_branch_common): Change method defintion
5955 in class definition to a method declaration and update list of formal
5956 parameters.
5957 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5958 Arm_relocation_functions::jump24): Adjust call to
5959 Arm_relocate_functions::arm_branch_common. Update list of formal
5960 parameters.
5961 (Arm_relocate_functions::xpc25): New method definition.
5962 (Arm_relocate_functions::arm_branch_common): Move method defintion
5963 out from class definition. Use stubs for mode-switching and extending
5964 branch ranges.
5965 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5966 specially. Change code to enable use of stubs in ARM branches.
5967
43d12afe
DK
59682009-11-10 Doug Kwan <dougkwan@google.com>
5969
5970 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5971 in method declaration.
5972 (Target_arm::relocate_stub): New method declaration.
5973 (Target_arm::default_target): Change to return a pointer instead of
5974 a const reference.
5975 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5976 Target_arm::default_target.
5977 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5978 method definition.
5979 (Target_arm::relocate_section): Adjust view.
5980 (Target_arm::relocate_stub): New method definition.
5981
ac33a407
DK
59822009-11-10 Doug Kwan <dougkwan@google.com>
5983
5984 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5985 a format warning.
5986 * incremental.cc (open_incremental_binary): Initialized local
5987 variables to avoid warnings.
5988 * object.cc (make_elf_object): Ditto.
5989 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5990 a format warning.
e1df38aa 5991
88ee28e9
L
5992009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5993
5994 PR gold/10930
5995 * testsuite/plugin_test.c: Include "config.h".
5996
2daedcd6
DK
59972009-11-09 Doug Kwan <dougkwan@google.com>
5998
5999 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6000 (arm_symbol_value): Remove.
6001 (Arm_relocate_functions::arm_branch_common,
6002 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6003 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6004 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6005 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6006 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6007 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6008 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6009 Arm_relocate_functions::thm_mobw_abs_nc,
6010 Arm_relocate_functions::thm_mov_abs,
6011 Arm_relocate_functions::movw_prel_nc,
6012 Arm_relocate_functions::thm_movt_abs,
6013 Arm_relocate_functions::movt_prel,
6014 Arm_relocate_functions::thm_movw_prel_nc,
6015 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6016 (Target_arm::Relocate::relocate): Only decompose address into two
6017 parts if relocation type uses the thumb-bit and pass the actual
6018 bit instead of a flag indicating that the thumb-bit is used. Adjust
6019 calls to methods in Arm_relocate_functions for this change.
6020
1276bc89 60212009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
6022
6023 PR 10925
6024 * reloc.cc: Instantiate
6025 Sized_relobj::initialize_input_to_output_maps and
6026 Sized_relobj:free_input_to_output_maps.
6027
e53ad1b5
ILT
60282009-11-06 Ian Lance Taylor <iant@google.com>
6029
6030 PR 10876
6031 * defstd.cc (in_segment): Set only_if_ref true for "end".
6032
eb44217c
DK
60332009-11-06 Doug Kwan <dougkwan@google.com>
6034
6035 * arm.cc (class Reloc_stub): Correct a comment.
6036 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6037 (Target_arm::scan_section_for_stubs): New method declaration.
6038 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6039 Change methods from private to protected.
6040 (Target_arm::do_may_relax): New method definition.
6041 (Target_arm::do_relax, Target_arm::group_sections,
6042 Target_arm::scan_reloc_for_stub,
6043 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6044 (Target_arm::arm_input_section_map_): New data member declaration.
6045 (Target_arm::scan_reloc_for_stub,
6046 Target_arm::scan_reloc_section_for_stubs,
6047 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6048 Target_arm::do_relax): New method definitions.
6049
5d329b7d
ILT
60502009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6051
6052 * configure.ac: Check for (struct stat)::st_mtim
6053 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6054 * config.in: Regenerate.
6055 * configure: Regenerate.
6056
96a0d71b
ILT
60572009-11-05 Ian Lance Taylor <iant@google.com>
6058
6059 PR 10910
6060 * output.cc (Output_segment::add_output_section): Add missing
6061 return statement.
6062
594c8e5e
ILT
60632009-11-04 Ian Lance Taylor <iant@google.com>
6064
6065 PR 10880
6066 * object.h (class Object): Add is_needed and set_is_needed
6067 methods. Add is_needed_ field. Make bool fields into bitfields.
6068 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6069 defined in a dynamic object and referenced by a regular object,
6070 set is_needed for the dynamic object.
6071 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6072 if the file is marked with as_needed and it is not needed.
6073
22b127cc
ILT
60742009-11-04 Ian Lance Taylor <iant@google.com>
6075
6076 PR 10887
6077 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6078 tags if data is discarded by linker script.
6079 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6080 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6081 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6082 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6083
f5c870d2
ILT
60842009-11-04 Ian Lance Taylor <iant@google.com>
6085
6086 * layout.cc (Layout::get_output_section): Add is_interp and
6087 is_dynamic_linker_section parameters. Change all callers.
6088 (Layout::choose_output_section): Likewise.
6089 (Layout::make_output_section): Likewise.
6090 (Layout::add_output_section_data): Add is_dynamic_linker_section
6091 parameter. Change all callers.
6092 * layout.h (class Layout): Update declarations.
6093 * output.h (class Output_section): Add is_interp, set_is_interp,
6094 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6095 Add is_interp_, is_dynamic_linker_section_ fields. Change
6096 generate_code_fills_at_write_ to a bitfield.
6097 * output.cc (Output_section::Output_sections): Initialize new
6098 fields.
6099 (Output_segment::add_output_section): Add do_sort parameter.
6100 Change all callers.
6101
1ae4d23b
ILT
61022009-11-03 Ian Lance Taylor <iant@google.com>
6103
6104 PR 10860
6105 * options.h (class General_options): Add --warn-common.
6106 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6107 merging two common symbols.
6108 (Symbol_table::should_override): Handle --warn-common when merging
6109 a common symbol with a defined symbol. Use report_resolve_problem
6110 for multiple definitions.
6111 (Symbol_table::report_resolve_problem): New function.
6112 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6113
55da9579
DK
61142009-11-03 Doug Kwan <dougkwan@google.com>
6115
6116 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6117 stub_factory_.
6118 (Target_arm::stub_factory): New method definition.
6119 (Target_arm::new_arm_input_section,
6120 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6121 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 6122 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
6123 New type definitions.
6124 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6125 member declarations.
6126 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6127 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6128 New method definitions.
6129
37a9ac43
ILT
61302009-11-03 Ian Lance Taylor <iant@google.com>
6131
6132 * options.h (class General_options): Add --warn_constructors.
6133
b3d6a3d4
ILT
61342009-11-03 Ian Lance Taylor <iant@google.com>
6135
6136 PR 10893
6137 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6138 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6139
934b01dd
ILT
61402009-11-03 Ian Lance Taylor <iant@google.com>
6141
6142 PR 10895
6143 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6144 --msgid-bugs-address.
6145 (install-pdf): New target.
6146 (install-data_yes): Look up one directory to find mkinstalldirs.
6147
03c1939b
L
61482009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6149
6150 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6151 tree.
6152
ebd95253
DK
61532009-10-30 Doug Kwan <dougkwan@google.com>
6154
6155 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6156
e9bbb538
DK
61572009-10-30 Doug Kwan <dougkwan@google.com>
6158
6159 * arm.cc (Stub_addend_reader): New struct template definition
6160 and partial specializations.
6161 (Stub_addend_reader::operator()): New method definition for a
6162 partially specialized template.
6163
d5b40221
DK
61642009-10-30 Doug Kwan <dougkwan@google.com>
6165
6166 * arm.cc (Arm_relobj::processor_specific_flags): New method
6167 definition.
6168 (Arm_relobj::do_read_symbols): New method declaration.
6169 (Arm_relobj::processor_specific_flags_): New data member declaration.
6170 (Arm_dynobj): New class definition.
6171 (Target_arm::do_finalize_sections): Add input_objects parameter.
6172 (Target_arm::do_adjust_elf_header): New method declaration.
6173 (Target_arm::are_eabi_versions_compatible,
6174 (Target_arm::merge_processor_specific_flags): New method declaration.
6175 (Target_arm::do_make_elf_object): New overloaded method definitions
6176 and declaration.
6177 (Arm_relobj::do_read_symbols): New method definition.
6178 (Arm_dynobj::do_read_symbols): Ditto.
6179 (Target_arm::do_finalize_sections): Add input_objects parameters.
6180 Merge processor-specific flags from all input objects.
6181 (Target_arm::are_eabi_versions_compatible,
6182 Target_arm::merge_processor_specific_flags,
6183 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6184 New method definitions.
6185 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6186 Input_objects pointer type parameter.
6187 * layout.cc (Layout::finalize): Pass input objects to target's.
6188 finalize_sections function.
6189 * output.cc (Output_file_header::do_sized_write): Set ELF file
6190 header's processor-specific flags.
6191 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6192 Input_objects pointer type parameter.
6193 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6194 * target.h (Input_objects): New forward class declaration.
6195 (Target::processor_specific_flags,
6196 Target::are_processor_specific_flags_sect): New method definitions.
6197 (Target::finalize_sections): Add input_objects parameter.
6198 (Target::Target): Initialize processor_specific_flags_ and
6199 are_processor_specific_flags_set_.
6200 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6201 parameter.
6202 (Target::set_processor_specific_flags): New method definition.
6203 (Target::processor_specific_flags_,
6204 Target::are_processor_specific_flags_set_): New data member
6205 declarations.
6206 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6207 Input_objects pointer type parameter.
6208
ebabffbd
DK
62092009-10-30 Doug Kwan <dougkwan@google.com>
6210
6211 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6212
ad0f2072
ILT
62132009-10-28 Ian Lance Taylor <iant@google.com>
6214
6215 * object.h (class Relobj): Drop options parameter from
6216 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6217 do_scan_relocs, do_relocate. Change all callers.
6218 (class Sized_relobj): Drop options parameters from
6219 do_gc_process_relocs, do_scan_relocs, do_relocate,
6220 do_relocate_sections, relocate_sections, emit_relocs_scan,
6221 emit_relocs_scan_reltype. Change all callers.
6222 (struct Relocate_info): Remove options field and all references to
6223 it.
6224 * reloc.h (class Read_relocs): Remove options constructor
6225 parameter and options_ field. Change all callers.
6226 (class Gc_process_relocs, class Scan_relocs): Likewise.
6227 (class Relocate_task): Likewise.
6228 * target-reloc.h (scan_relocs): Remove options parameter. Change
6229 all callers.
6230 (scan_relocatable_relocs): Likewise.
6231 * target.h (class Sized_target): Remove options parameter from
6232 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6233 all callers.
6234 * gc.h (gc_process_relocs): Remove options parameter. Change all
6235 callers.
6236 * arm.cc: Update functions to remove options parameters.
6237 * i386.cc: Likewise.
6238 * powerpc.cc: Likewise.
6239 * sparc.cc: Likewise.
6240 * x86_64.cc: Likewise.
6241 * testsuite/testfile.cc: Likewise.
6242
8ffa3667
DK
62432009-10-28 Doug Kwan <dougkwan@google.com>
6244
6245 * arm.cc (Arm_relobj): New class definition.
e1df38aa 6246 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
6247 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6248 New method definitions.
6249
40f36857
CC
62502009-10-28 Cary Coutant <ccoutant@google.com>
6251
6252 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6253 (Plugin::cleanup_done_): New member.
6254 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6255 (Plugin_manager::cleanup_done_): Remove.
6256 (Plugin_manager::add_input_file): Edit error message.
6257 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6258 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6259
2c849493
ILT
62602009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6261
6262 * fileread.cc: (File_read::View::~View): Use the new
6263 data_ownership_ filed.
6264 (File_read::~File_read): Dispose the new whole_file_view_.
6265 (File_read::open): Mmap the whole file if needed.
6266 (File_read::open): Use whole_file_view_ instead of contents_.
6267 (File_read::find_view): Use whole_file_view_ if applicable.
6268 (File_read::do_read): Use whole_file_view_ instead of contents_.
6269 (File_read::make_view): Use whole_file_view_ instead of contents_,
6270 update File_read::View::View call.
6271 (File_read::find_or_make_view): Update File_read::View::View
6272 call.
6273 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6274 remove contents_
6275 (File_read::View::Data_ownership): New enum.
6276 (File_read::View::View): Replace bool mapped_ with Data_ownership
6277 argument.
6278 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6279 (File_read::View::data_ownership_): New field.
6280 (File_read::contents_): Remove (replaced by whole_file_view_).
6281 (File_read::whole_file_view_): New field.
6282 * options.h (class General_options): Add --keep-files-mapped.
6283
24998053
CC
62842009-10-27 Cary Coutant <ccoutant@google.com>
6285
6286 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6287 * testsuite/Makefile.am (plugin_test_5): New test case.
6288 * testsuite/Makefile.in: Regenerate.
6289
72adc4fa
DK
62902009-10-25 Doug Kwan <dougkwan@google.com>
6291
6292 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6293 from private to protected to allow access by child class.
6294 (Sized_relobj::do_relocate_sections): New method declaration.
6295 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 6296 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
6297 Sized_relobj::relocate_sections. Instantiate template explicitly
6298 for different target sizes and endianity.
6299
07f508a2
DK
63002009-10-24 Doug Kwan <dougkwan@google.com>
6301
6302 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6303 (Arm_input_section::as_arm_input_section): New method.
6304 (Arm_output_section): New class definition.
6305 (Arm_output_section::create_stub_group,
6306 Arm_output_section::group_sections): New method definitions.
6307
10ad9fe5
DK
63082009-10-22 Doug Kwan <dougkwan@google.com>
6309
6310 * arm.cc (Arm_input_section): New class definition.
6311 (Arm_input_section::init, Arm_input_section:do_write,
6312 Arm_input_section::set_final_data_size,
6313 Arm_input_section::do_reset_address_and_file_offset): New method
6314 definitions.
6315
56ee5e00
DK
63162009-10-21 Doug Kwan <dougkwan@google.com>
6317
6318 * arm.cc (Stub_table, Arm_input_section): New forward class
6319 declarations.
6320 (Stub_table): New class defintion.
6321 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6322 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6323 New method definition.
6324
b569affa
DK
63252009-10-21 Doug Kwan <dougkwan@google.com>
6326
6327 * arm.cc: Update copyright comments.
6328 (Target_arm): New forward class template declaration.
6329 (Arm_address): New type.
6330 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6331 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6332 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6333 constants.
6334 (Insn_template): Same.
6335 (DEF_STUBS): New macro.
6336 (Stub_type): New enum type.
6337 (Stub_template): New class definition.
6338 (Stub): Same.
6339 (Reloc_stub): Same.
6340 (Stub_factory): Same.
6341 (Target_arm::Target_arm): Initialize may_use_blx_ and
6342 should_force_pic_veneer_.
6343 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6344 Target_arm::should_force_pic_veneer,
6345 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6346 Target_arm::using_thumb_only, Target_arm:;default_target): New
6347 method defintions.
6348 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6349 New data member declarations.
6350 (Insn_template::size, Insn_template::alignment): New method defintions.
6351 (Stub_template::Stub_template): New method definition.
6352 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6353 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6354 (Stub_factory::Stub_factory): New method definition.
6355 * gold.h (string_hash): New template.
6356 * output.h (Input_section_specifier::hash_value): Use
6357 gold::string_hash.
6358 (Input_section_specifier::string_hash): Remove.
6359 * stringpool.cc (Stringpool_template::string_hash): Use
6360 gold::string_hash.
6361
6c172549
DK
63622009-10-20 Doug Kwan <dougkwan@google.com>
6363
6364 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6365 symbols of relaxed input sections.
6366 * output.h (Output_section::find_relaxed_input_section): Make
6367 method public.
6368
c5617f2f
DK
63692009-10-16 Doug Kwan <dougkwan@google.com>
6370
6371 * dynobj.cc (Versions::Versions): Initialize version_script_.
6372 Only insert base version symbol definition for a shared object
6373 if version script defines any version versions.
6374 (Versions::define_base_version): New method definition.
6375 (Versions::add_def): Check that base version is not needed.
6376 (Versions::add_need): Define base version lazily.
6377 * dynobj.h (Versions::define_base_version): New method declaration.
6378 (Versions::needs_base_version_): New data member declaration.
6379 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6380 (check_DATA): Add no_version_test.stdout.
6381 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6382 New make rules.
6383 * testsuite/Makefile.in: Regenerate.
6384 * testsuite/no_version_test.c: New file.
6385 * testsuite/no_version_test.sh: Ditto.
6386
3c12dcdb
DK
63872009-10-16 Doug Kwan <dougkwan@google.com>
6388
6389 * expression.cc (class Segment_start_expression): New class definition.
6390 (Segment_start_expression::value): New method definition.
6391 (script_exp_function_segment_start): Return a new
6392 Segment_start_expression.
6393 * gold/script-c.h (script_saw_segment_start_expression): New function
6394 prototype.
6395 * script-sections.cc (Script_sections::Script_sections): Initialize
6396 SAW_SEGMENT_START_EXPRESSION_ to false.
6397 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6398 and -Tbbs options to specify section addresses if given in
6399 command line and no SEGMENT_START expression is seen in a script.
6400 * script-sections.h (Script_sections::saw_segment_start_expression,
6401 Script_sections::set_saw_segment_start_expression): New method
6402 definition.
6403 (Script_sections::saw_segment_start_expression_): New data member
6404 declaration.
6405 * script.cc (script_saw_segment_start_expression): New function.
6406 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6407 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6408 script_test_7.sh and script_test_8.sh.
6409 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6410 script_test_8.stdout.
6411 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6412 (script_test_6, script_test_6.stdout, script_test_7,
6413 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6414 * Makefile.in: Regenerate.
6415 * testsuite/script_test_6.sh: New file.
6416 * testsuite/script_test_6.t: Same.
6417 * testsuite/script_test_7.sh: Same.
6418 * testsuite/script_test_7.t: Same.
6419 * testsuite/script_test_8.sh: Same.
6420
64b1ae37
DK
64212009-10-16 Doug Kwan <dougkwan@google.com>
6422
6423 * output.cc (Output_segment::set_section_list_address): Cast
6424 expressions to unsigned long long type to avoid format warnings.
6425
661be1e2
ILT
64262009-10-15 Ian Lance Taylor <iant@google.com>
6427
12edd763 6428 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 6429 dot assignment to script_sections_.
12edd763
ILT
6430 * script-sections.cc (Script_sections::add_dot_assignment):
6431 Initialize if necessary.
6432
68b6574b
ILT
6433 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6434 program headers with no load segment if there is a linker script.
6435
661be1e2
ILT
6436 * layout.cc (Layout::set_segment_offsets): Align the file offset
6437 to the segment aligment for -N or -n with no load segment.
6438 * output.cc (Output_segment::add_output_section): Don't crash if
6439 the first section is a TLS section.
6440 (Output_segment::set_section_list_addresses): Print an error
6441 message if the address moves backward in a linker script.
6442 * script-sections.cc
6443 (Output_section_element_input::set_section_addresses): Don't
6444 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6445 (Orphan_output_section::set_section_addresses): Likewise.
6446
f15f61a7
DK
64472009-10-15 Doug Kwan <dougkwan@google.com>
6448
6449 * layout.cc (Layout::finish_dynamic_section): Generate tags
6450 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6451 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6452 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6453
82bb573a
ILT
64542009-10-14 Ian Lance Taylor <iant@google.com>
6455
6456 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6457 fields.
6458 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6459 data_shdr fields of relinfo.
6460 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6461 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6462 R_386_TLS_LDO_32, adjust based on section flags.
6463 (Target_i386::Relocate::fix_up_ldo): Remove.
6464
374ad285
ILT
64652009-10-13 Ian Lance Taylor <iant@google.com>
6466
6467 Add support for -pie.
6468 * options.h (class General_options): Add -pie and
6469 --pic-executable.
6470 (General_options::output_is_position_independent): Test -pie.
6471 (General_options::output_is_executable): Return true if not shared
6472 and not relocatable.
6473 (General_options::output_is_pie): Remove.
6474 * options.cc (General_options::finalize): Reject incompatible uses
6475 of -pie.
6476 * gold.cc (queue_middle_tasks): A -pie link is not static.
6477 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6478 * symtab.cc (Symbol::final_value_is_known): Return false if
6479 output_is_position_independent.
6480 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6481 output_is_position_independent.
6482 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6483 output_is_position_independent.
6484 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6485 output_is_position_independent.
6486 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6487 two_file_pie_test.
6488 (basic_pie_test.o, basic_pie_test): New targets.
6489 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6490 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6491 (two_file_pie_test): New target.
6492 * testsuite/Makefile.in: Rebuild.
6493 * README: Remove note saying that -pie is not supported.
6494
c6585162
ILT
64952009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6496
6497 * options.h (class General_options): Add -init and -fini.
6498 * layout.cc (Layout::finish_dynamic_section): Emit
6499 given init and fini functions.
6500
032ce4e9
ST
65012009-10-13 Sriraman Tallam <tmsriram@google.com>
6502
6503 * gc.h (gc_process_relocs): Check if icf is enabled using new
6504 function.
6505 * gold.cc (queue_initial_tasks): Likewise.
6506 (queue_middle_tasks): Likewise.
6507 * object.cc (do_layout): Likewise.
6508 * symtab.cc (is_section_folded): Likewise.
6509 * main.cc (main): Likewise.
6510 * reloc.cc (Read_relocs::run): Likewise.
6511 (Sized_relobj::do_scan_relocs): Likewise.
6512 * icf.cc (is_function_ctor_or_dtor): New function.
6513 (Icf::find_identical_sections): Check if function is ctor or dtor when
6514 safe icf is chosen.
6515 * options.h (General_options::icf): Change option to be an enum.
6516 (Icf_status): New enum.
6517 (icf_enabled): New method.
6518 (icf_safe_folding): New method.
6519 (set_icf_status): New method.
6520 (icf_status_): New variable.
6521 * (options.cc) (General_options::finalize): Set icf_status_.
6522 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6523 icf_test and icf_keep_unique_test to use the --icf enum flag.
6524 * testsuite/icf_safe_test.sh: New file.
e1df38aa 6525 * testsuite/icf_safe_test.cc: New file.
032ce4e9 6526
f345227a
ST
65272009-10-12 Sriraman Tallam <tmsriram@google.com>
6528
6529 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6530 includes to gc.h and icf.h.
6531 * arm.cc: Include gc.h.
6532 * gold.cc: Likewise.
6533 * i386.cc: Likewise.
6534 * powerpc.cc: Likewise.
6535 * sparc.cc: Likewise.
6536 * x86_64.cc: Likewise.
6537 * gc.h: Include icf.h.
6538
1c7814ed
ILT
65392009-10-11 Ian Lance Taylor <iant@google.com>
6540
6541 * plugin.cc: Include "gold.h" before other header files.
6542
ae3b5189
CD
65432009-10-10 Chris Demetriou <cgd@google.com>
6544
6545 * options.h (Input_file_argument::Input_file_type): New enum.
6546 (Input_file_argument::is_lib_): Replace with...
6547 (Input_file_argument::type_): New member.
6548 (Input_file_argument::Input_file_argument): Take Input_file_type
6549 'type' rather than boolean 'is_lib' as second argument.
6550 (Input_file_argument::is_lib): Use type_.
6551 (Input_file_argument::is_searched_file): New function.
6552 (Input_file_argument::may_need_search): Handle is_searched_file.
6553 * options.cc (General_options::parse_library): Support -l:filename.
6554 (General_options::parse_just_symbols): Update for Input_file_argument
6555 changes.
6556 (Command_line::process): Likewise.
6557 * archive.cc (Archive::get_file_and_offset): Likewise.
6558 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6559 * script.cc (read_script_file, script_add_file): Likewise.
6560 * fileread.cc (Input_file::Input_file): Likewise.
6561 (Input_file::will_search_for): Handle is_searched_file.
6562 (Input_file::open): Likewise.
6563 * readsyms.cc (Read_symbols::get_name): Likewise.
6564 * testsuite/Makefile.am (searched_file_test): New test.
6565 * testsuite/Makefile.in: Regenerate.
6566 * testsuite/searched_file_test.cc: New file.
6567 * testsuite/searched_file_test_lib.cc: New file.
6568
f3048a1d
ILT
65692009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6570 Ian Lance Taylor <iant@google.com>
6571
6572 * descriptor.cc: Include <cstdio> and "binary-io.h".
6573 (Descriptors::open): Open the files in binary mode always.
6574 * script.cc (Lex::get_token): Treat \r as whitespace.
6575
d4780e57
ILT
65762009-10-09 Ian Lance Taylor <iant@google.com>
6577
6578 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6579
d9a893b8
ILT
65802009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6581 Ian Lance Taylor <iant@google.com>
6582
6583 * configure.ac: Check for readv function also.
6584 * fileread.cc (readv): Define if not HAVE_READV.
6585 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6586 does not exist.
6587 * config.in: Regenerate.
6588 * configure: Regenerate.
6589
c0a62865
DK
65902009-10-09 Doug Kwan <dougkwan@google.com>
6591
6592 * layout.cc (Layout::make_output_section): Call target hook to make
6593 ordinary output section.
6594 (Layout::finalize): Adjust parameter list of call the
6595 Target::may_relax().
6596 * layout.h (class Layout::section_list): New method.
6597 * merge.h (Output_merge_base::entsize): Change visibility to public.
6598 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6599 New methods.
6600 (Output_merge_string::do_is_string): New method.
6601 * object.cc (Sized_relobj::do_setup): renamed from
6602 Sized_relobj::set_up.
6603 * object.h (Sized_relobj::adjust_shndx,
6604 Sized_relobj::initializ_input_to_output_maps,
6605 Sized_relobj::free_input_to_output_maps): Change visibilities to
6606 protected.
6607 (Sized_relobj::setup): Virtualize.
6608 (Sized_relobj::do_setup): New method declaration.
6609 (Sized_relobj::invalidate_section_offset,
6610 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6611 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6612 * options.cc (parse_int): New function.
6613 * options.h (parse_int): New declaration.
6614 (DEFINE_int): New macro.
6615 (stub_group_size): New option.
6616 * output.cc (Output_section::Output_section): Initialize memebers
6617 merge_section_map_, merge_section_by_properties_map_,
6618 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6619 (Output_section::add_input_section): Handled deferred code-fill
6620 generation and remove an old comment.
6621 (Output_section::add_relaxed_input_section): New method definition.
6622 (Output_section::add_merge_input_section): Use merge section by
6623 properties map to speed to search. Update merge section maps
6624 as appropriate.
6625 (Output_section::build_relaxation_map): New method definition.
6626 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6627 Same.
6628 (Output_section::relax_input_section): Renamed to
6629 Output_section::convert_input_sections_to_relaxed_sections and change
6630 interface to take a vector of pointers to relaxed sections.
6631 (Output_section::find_merge_section,
6632 Output_section::find_relaxed_input_section): New method definitions.
6633 (Output_section::is_input_address_mapped,
6634 Output_section::output_offset, Output_section::output_address):
6635 Use output section data maps to speed up searching.
6636 (Output_section::find_starting_output_address): Add comments.
6637 (Output_section::do_write,
6638 Output_section::write_to_postprocessing_buffer): Do code-fill
6639 generation as appropriate.
6640 (Output_section::get_input_sections): Invalidate relaxed input section
6641 map.
6642 (Output_section::restore_states): Adjust type of checkpoint .
6643 Invalidate relaxed input section map.
6644 * output.h (Output_merge_base): New class declaration.
6645 (Input_section_specifier): New class defintion.
6646 (class Output_relaxed_input_section) Change base class to
6647 Output_section_data_build.
6648 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6649 base class initializer.
6650 (Output_section::add_relaxed_input_section): New method declaration.
6651 (Output_section::Input_section): Change visibility to protected.
6652 (Output_section::Input_section::relobj,
6653 Output_section::Input_section::shndx): Handle relaxed input sections.
6654 Output_section::input_sections) Change visibility to protected. Also
6655 define overload to return a non-const pointer.
6656 (Output_section::Merge_section_properties): New class defintion.
6657 (Output_section::Merge_section_by_properties_map,
6658 Output_section::Output_section_data_by_input_section_map,
6659 Output_section::Relaxation_map): New types.
6660 (Output_section::relax_input_section): Rename method to
6661 Output_section::convert_input_sections_to_relaxed_sections and change
6662 interface to take a vector of relaxed section pointers.
6663 (Output_section::find_merge_section,
6664 Output_section::find_relaxed_input_section,
6665 Output_section::build_relaxation_map,
6666 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6667 New method declarations.
6668 (Output_section::merge_section_map_
6669 Output_section::merge_section_by_properties_map_,
6670 Output_section::relaxed_input_section_map_,
6671 Output_section::is_relaxed_input_section_map_valid_,
6672 Output_section::generate_code_fills_at_write_): New data members.
6673 * script-sections.cc
6674 (Output_section_element_input::set_section_addresses): Call
6675 current_data_size and addralign methods of relaxed input sections.
6676 (Orphan_output_section::set_section_addresses): Call current_data_size
6677 and addralign methods of relaxed input sections.
6678 * symtab.cc (Symbol_table::compute_final_value): Extract template
6679 from the body of Symbol_table::sized_finalize_symbol.
6680 (Symbol_table::sized_finalized_symbol): Call
6681 Symbol_table::compute_final_value.
6682 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6683 (Symbol_table::compute_final_value): New templated method declaration.
6684 * target.cc (Target::do_make_output_section): New method defintion.
6685 * target.h (Target::make_output_section): New method declaration.
6686 (Target::relax): Add more parameters for input objects, symbol table
6687 and layout. Adjust call to do_relax.
6688 (Target::do_make_output_section): New method declaration.
6689 (Target::do_relax): Add parameters for input objects, symbol table
6690 and layout.
6691
d446d6c4
ILT
66922009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6693
6694 * pread.c: Include stdio.h.
6695
bc06c745
ILT
66962009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6697
6698 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6699 defined.
6700
75aea3d0
ILT
67012009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6702
6703 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6704 Change read_shndx type to unsigned int.
6705 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6706 int.
6707 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6708 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6709 Change read_shndx type to unsigned int.
6710 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6711 int.
6712 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6713 * layout.cc (Layout::create_symtab_sections): Cast the result of
6714 local_symcount * symsize to off_t in the gold_assert.
6715
be8fcb75
ILT
67162009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6717
6718 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6719 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6720 R_ARM_BASE_ABS.
6721 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6722 (Arm_relocate_functions::thm_abs5): New function.
6723 (Arm_relocate_functions::abs12): New function.
6724 (Arm_relocate_functions::abs16): New function.
6725 (Arm_relocate_functions::base_abs): New function.
6726 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6727 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6728 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6729 R_ARM_BASE_ABS.
6730 (Scan::global): Likewise.
6731 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6732 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6733 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6734 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6735 R_ARM_BASE_ABS.
6736
c2a122b6
ILT
67372009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6738
6739 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6740 (Arm_relocate_functions::movt_prel): New function.
6741 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6742 (Arm_relocate_functions::thm_movt_prel): New function.
6743 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6744 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6745 (Scan::global, Relocate::relocate): Likewise.
6746 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6747
c4aa1e2d
ILT
67482009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6749
6750 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6751 Incremental_checker.
6752 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6753 unsigned int.
6754 (class Incremental_inputs_header): New class.
6755 (Incremental_inputs_header_writer): Edit comment.
6756 (Incremental_inputs_entry): New class.
6757 (Incremental_inputs_entry_writer): Edit comment.
6758 (Sized_incremental_binary::do_find_incremental_inputs_section):
6759 Add *strtab_shndx parameter, fill it.
6760 (Sized_incremental_binary::do_check_inputs): New method.
6761 (Incremental_checker::can_incrementally_link_output_file): Use
6762 Sized_incremental_binary::check_inputs.
6763 (Incremental_inputs::report_command_line): Save command line in
6764 command_line_.
6765 * incremental.h:
6766 (Incremental_binary::find_incremental_inputs_section): New
6767 method.
6768 (Incremental_binary::do_find_incremental_inputs_section): Add
6769 strtab_shndx parameter.
6770 (Incremental_binary::do_check_inputs): New pure virtual method.
6771 (Sized_incremental_binary::do_check_inputs): Declare.
6772 (Incremental_checker::Incremental_checker): Add incremental_inputs
6773 parameter, use it to initialize incremental_inputs_.
6774 (Incremental_checker::incremental_inputs_): New field.
6775 (Incremental_checker::command_line): New method.
6776 (Incremental_checker::inputs): New method.
6777 (Incremental_checker::command_line_): New field.
6778
c549a694
ILT
67792009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6780
6781 * incremental.cc: Include <cstdarg> and "target-select.h".
6782 (vexplain_no_incremental): New function.
6783 (explain_no_incremental): New function.
6784 (Incremental_binary::error): New method.
6785 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6786 method.
6787 (make_sized_incremental_binary): New function.
6788 (open_incremental_binary): New function.
6789 (can_incrementally_link_file): Add checks if output is ELF and has
6790 inputs section.
6791 * incremental.h: Include "elfcpp_file.h" and "output.h".
6792 (Incremental_binary): New class.
6793 (Sized_incremental_binary): New class.
6794 (open_incremental_binary): Declare.
6795 * object.cc (is_elf_object): Use
6796 elfcpp::Elf_recognizer::is_elf_file.
6797 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6798 * output.h (Output_file::filesize): New method.
6799
fd3c5f0b
ILT
68002009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6801
6802 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6803 New function.
6804 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6805 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6806 function.
6807 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6808 function.
6809 (Arm_relocate_functions::movw_abs_nc): New function.
6810 (Arm_relocate_functions::movt_abs): New function.
6811 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6812 (Arm_relocate_functions::thm_movt_abs): New function.
6813 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6814 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6815 (Scan::global): Likewise.
6816 (Relocate::relocate): Likewise.
6817 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6818
7f5309a5
ILT
68192009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6820
6821 * arm.cc (Arm_relocate_functions::got_prel) New function.
6822 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6823 (Relocate::relocate): Likewise.
6824 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6825
364c7fa5
ILT
68262009-10-06 Ian Lance Taylor <iant@google.com>
6827
6828 * options.h (class General_options): Define
6829 split_stack_adjust_size parameter.
6830 * object.h (class Object): Add uses_split_stack_ and
6831 has_no_split_stack_ fields. Add uses_split_stack and
6832 has_no_split_stack accessor functions. Declare
6833 handle_split_stack_section.
6834 (class Reloc_symbol_changes): Define.
6835 (class Sized_relobj): Define Function_offsets. Declare
6836 split_stack_adjust, split_stack_adjust_reltype, and
6837 find_functions.
6838 * object.cc (Object::handle_split_stack_section): New function.
6839 (Sized_relobj::do_layout): Call handle_split_stack_section.
6840 * dynobj.cc (Sized_dynobj::do_layout): Call
6841 handle_split_stack_section.
6842 * reloc.cc (Sized_relobj::relocate_sections): Call
6843 split_stack_adjust for executable sections in split_stack
6844 objects. Pass reloc_map to relocate_section.
6845 (Sized_relobj::split_stack_adjust): New function.
6846 (Sized_relobj::split_stack_adjust_reltype): New function.
6847 (Sized_relobj::find_functions): New function.
6848 * target-reloc.h: Include "object.h".
6849 (relocate_section): Add reloc_symbol_changes parameter. Change
6850 all callers.
6851 * target.h (class Target): Add calls_non_split method. Declare
6852 do_calls_non_split virtual method. Declare match_view and
6853 set_view_to_nop.
6854 * target.cc: Include "elfcpp.h".
6855 (Target::do_calls_non_split): New function.
6856 (Target::match_view): New function.
6857 (Target::set_view_to_nop): New function.
6858 * gold.cc (queue_middle_tasks): Give an error if mixing
6859 split-stack and non-split-stack objects with -r.
6860 * i386.cc (Target_i386::relocate_section): Add
6861 reloc_symbol_changes parameter.
6862 (Target_i386::do_calls_non_split): New function.
6863 * x86_64.cc (Target_x86_64::relocate_section): Add
6864 reloc_symbol_changes parameter.
6865 (Target_x86_64::do_calls_non_split): New function.
6866 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6867 parameter.
6868 * powerpc.cc (Target_powerpc::relocate_section): Add
6869 reloc_symbol_changes parameter.
6870 * sparc.cc (Target_sparc::relocate_section): Add
6871 reloc_symbol_changes parameter.
6872 * configure.ac: Call AM_CONDITIONAL for the default target.
6873 * configure: Rebuild.
6874 * testsuite/Makefile.am (TEST_AS): New variable.
6875 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6876 (check_DATA): Add split_i386 and split_x86_64 files.
6877 (SPLIT_DEFSYMS): Define.
6878 (split_i386_[1234n].o): New targets.
6879 (split_i386_[124]): New targets.
6880 (split_i386_[1234r].stdout): New targets.
6881 (split_x86_64_[1234n].o): New targets.
6882 (split_x86_64_[124]): New targets.
6883 (split_x86_64_[1234r].stdout): New targets.
6884 (MOSTLYCLEANFILES): Add new executables.
6885 * testsuite/split_i386.sh: New file.
6886 * testsuite/split_x86_64.sh: New file.
6887 * testsuite/split_i386_1.s: New file.
6888 * testsuite/split_i386_2.s: New file.
6889 * testsuite/split_i386_3.s: New file.
6890 * testsuite/split_i386_4.s: New file.
6891 * testsuite/split_i386_n.s: New file.
6892 * testsuite/split_x86_64_1.s: New file.
6893 * testsuite/split_x86_64_2.s: New file.
6894 * testsuite/split_x86_64_3.s: New file.
6895 * testsuite/split_x86_64_4.s: New file.
6896 * testsuite/split_x86_64_n.s: New file.
6897 * testsuite/testfile.cc (Target_test): Update relocation_section
6898 function.
6899 * testsuite/Makefile.in: Rebuild.
6900
e8a9fcda
ILT
69012009-10-06 Ian Lance Taylor <iant@google.com>
6902
6903 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6904 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6905 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6906 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6907 the address on ldo_addrs_.
6908 (Target_i386::Relocate::fix_up_ldo): New function.
6909
e99daf92
ILT
69102009-10-06 Rafael Espindola <espindola@google.com>
6911
6912 * plugin.cc (add_input_library): New.
6913 (Plugin::load): Add add_input_library to tv.
6914 (Plugin_manager::add_input_file): Add the is_lib argument.
6915 (add_input_file): Update call to Plugin_manager::add_input_file.
6916 (add_input_library): New.
6917 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6918
966d4097
DK
69192009-09-30 Doug Kwan <dougkwan@google.com>
6920
6921 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6922 symbol and call Symbol::may_need_copy_reloc to determine if
6923 a copy reloc is needed.
6924 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6925 nocopyreloc is given in command line.
6926 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6927 given in command line.
6928 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6929 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6930 of the removed Target_i386::may_need_copy_reloc.
6931 * options.h (copyreloc): New option with default value false.
6932 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6933 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6934 instead of the removed Target_powerpc::may_need_copy_reloc.
6935 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6936 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6937 instead of the removed Target_sparc::may_need_copy_reloc.
6938 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6939 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6940 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6941 instead of the removed Target_x86_64::may_need_copy_reloc.
6942
029ba973
ILT
69432009-09-30 Ian Lance Taylor <iant@google.com>
6944
6945 * object.h (class Object): Remove target_ field, and target,
6946 sized_target, and set_target methods.
6947 (Object::sized_target): Remove.
6948 (class Sized_relobj): Update declarations. Remove sized_target.
6949 * object.cc (Sized_relobj::setup): Remove target parameter.
6950 Change all callers.
6951 (Input_objects::add_object): Don't do anything with the target.
6952 (make_elf_sized_object): Add punconfigured parameter. Change all
6953 callers. Set or test parameter target.
6954 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6955 Change all callers.
6956 * parameters.cc (Parameters::set_target): Change parameter type to
6957 be non-const.
6958 (Parameters::default_target): Remove.
6959 (set_parameters_target): Change parameter type to be non-const.
6960 (parameters_force_valid_target): New function.
6961 (parameters_clear_target): New function.
6962 * parameters.h (class Parameters): Update declarations. Remove
6963 default_target method. Add sized_target and clear_target
6964 methods. Change target_ to be non-const.
6965 (set_parameters_target): Update declaration.
6966 (parameters_force_valid_target): Declare.
6967 (parameters_clear_target): Declare.
6968 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6969 as NULL if we aren't searching.
6970 (Add_symbols::run): Don't check for compatible target.
6971 * fileread.cc (Input_file::open_binary): Call
6972 parameters_force_valid_target.
6973 * gold.cc (queue_middle_tasks): Likewise.
6974 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6975 set_target on object.
6976 * dynobj.h (class Sized_dynobj): Update declarations.
6977 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6978 make_elf_object returns NULL.
6979 (Archive::include_member): Don't check whether object target is
6980 compatible.
6981 * output.cc (Output_section::add_input_section): Get target from
6982 parameters.
6983 (Output_section::relax_input_section): Likewise.
6984 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6985 parameters.
6986 (Sized_relobj::do_scan_relocs): Likewise.
6987 (Sized_relobj::relocate_sections): Likewise.
6988 * resolve.cc (Symbol_table::resolve): Likewise.
6989 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6990 parameter. Change all callers.
6991 (Symbol_table::add_from_object): Get target from parameters.
6992 (Symbol_table::add_from_relobj): Don't check object target.
6993 (Symbol_table::add_from_dynobj): Likewise.
6994 (Symbol_table::define_special_symbol): Get target from
6995 parameters.
6996 * symtab.h (class Symbol_table): Update declaration.
6997 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6998 parameter. Change all callers. Clear parameter target.
6999 (Binary_test): Test target here.
7000 * testsuite/object_unittest.cc (gold_testsuite): Remove
7001 target_test_pointer parameter. Change all callers.
7002 (Object_test): Test target here.
7003
a6a22b83
ILT
70042009-09-26 Ian Lance Taylor <iant@google.com>
7005
7006 * testsuite/initpri1.c: Don't try to use constructor priorities if
7007 compiling with gcc before 4.3.
7008
6a8f49fe
ILT
70092009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7010
7011 * testsuite/retain_symbols_file_test.sh (check_present): Change
7012 output file name to retain_symbols_file_test.stdout.
7013 (check_absent): Likewise.
7014
8c604651
CS
70152009-09-18 Craig Silverstein <csilvers@google.com>
7016
7017 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7018 * options.cc: Include <cerrno> and <fstream>.
7019 (General_options::finalize): Parse -retain-symbols-file tag.
7020 * options.h: New flag.
7021 (General_options): New method should_retain_symbol, new
7022 variable symbols_to_retain.
7023 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7024 should_retain_symbol map.
7025 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7026 * testsuite/Makefile.in: Regenerate.
7027 * testsuite/retain_symbols_file_test.sh: New file.
7028
ca58b19f
NC
70292009-09-18 Nick Clifton <nickc@redhat.com>
7030
7031 * po/es.po: Updated Spanish translation.
7032
20e6d0d6
DK
70332009-09-17 Doug Kwan <dougkwan@google.com>
7034
7035 * debug.h (DEBUG_RELAXATION): New constant.
7036 (DEBUG_ALL): Add DEBUG_RELAXATION.
7037 (debug_string_to_enum): Add relaxation debug option.
7038 * layout.cc
7039 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7040 Layout::Relaxation_debug_check::read_sections,
7041 Layout::Relaxation_debug_check::read_sections): New method definitions.
7042 (Layout::Layout): Initialize data members
7043 record_output_section_data_from_scrips_,
7044 script_output_section_data_list_ and relaxation_debug_check_.
7045 (Layout::save_segments, Layout::restore_segments,
7046 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7047 Layout::relaxation_loop_body): New method definitions.
7048 (Layout::finalize): Support relaxation. Move section layout code to
7049 Layout::relaxation_loop_body.
7050 (Layout::set_asection_address_from_script): Move code for orphan
7051 section placement out.
7052 (Layout::place_orphan_sections_in_script): New method definition.
7053 * layout.h (Output_segment_headers, Output_file_header):
7054 New forward class declarations.
7055 (Layout::~Layout): Define.
7056 (Layout::new_output_section_data_from_script): New method definition.
7057 (Layout::place_orphan_sections_in_script): New method declaration.
7058 (Layout::Segment_states): New type declaration.
7059 (Layout::save_segments, Layout::restore_segments,
7060 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7061 Layout::relaxation_loop_body): New method declarations.
7062 (Layout::Output_section_data_list): New type declaration.
7063 (Layout::Relaxation_debug_check): New class definition.
7064 (Layout::record_output_section_data_from_script_,
7065 Layout::script_output_section_data_list_, Layout::segment_states_,
7066 Layout::relaxation_debug_check_): New data members.
7067 * output.cc: (Output_section_headers::do_size): New method definition.
7068 (Output_section_headers::Output_section_headers): Move size
7069 computation to Output_section_headers::do_size.
7070 (Output_segment_headers::do_size): New method definition.
e1df38aa 7071 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
7072 Output_file_header::do_size and call it.
7073 (Output_file_header::do_size): New method definition.
7074 (Output_data_group::Output_data_group): Adjust call to
7075 Output_section_data.
7076 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7077 (Output_symtab_xindex::do_write): Add array bound check.
7078 (Output_section::Input_section::print_to_mapfile): Handle
7079 RELAXED_INPUT_SECTION_CODE.
7080 (Output_section::Output_section): Initialize data member checkpoint_.
7081 (Output_section::~Output_section): Delete checkpoint object pointed
7082 by checkpoint_.
7083 (Output_section::add_input_section): Always add an Input_section if
7084 relaxing.
7085 (Output_section::add_merge_input_section): Add assert.
7086 (Output_section::relax_input_section): New method definition.
7087 (Output_section::set_final_data_size): Set load address to zero for
7088 an unallocated section.
7089 (Output_section::do_address_and_file_offset_have_reset_values):
7090 New method definition.
7091 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7092 Handle relaxed input section.
7093 (Output_section::sort_attached_input_sections): Checkpoint input
7094 section list lazily.
7095 (Output_section::get_input_sections): Change type of input_sections to
7096 list of Simple_input_section pointers. Checkpoint input section list
7097 lazily. Also handle relaxed input sections.
7098 (Output_section::add_input_section_for_script): Take a reference to
7099 a Simple_input_section object instead of Relobj pointer and section
7100 index as parameter. Handle relaxed input sections.
7101 (Output_section::save_states, Output_section::restore_states): New
7102 method definitions.
7103 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7104 (Output_data::is_data_size_fixed): New method definition.
7105 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7106 if it is fixed.
7107 (Output_data::address_and_file_offset_have_reset_values): New method
7108 definition.
7109 (Output_data::do_address_and_file_offset_have_reset_values): New method
7110 definition.
7111 (Output_data::set_data_size): Check that data size is not fixed.
7112 (Output_data::fix_data_size): New method definition.
7113 (Output_data::is_data_size_fixed_): New data member.
7114 (Output_section_headers::set_final_data_size): New method definition.
7115 (Output_section_headers::do_size): New method declaration.
7116 (Output_segment_headers::set_final_data_size): New method definition.
7117 (Output_segment_headers::do_size): New method declaration.
7118 (Output_file_header::set_final_data_size)::New method definition.
7119 (Output_file_header::do_size)::New method declaration.
7120 (Output_section_data::Output_section_data): Add new parameter
7121 is_data_size_fixed and use it to fix data size.
7122 (Output_data_const::Output_data_const): Adjust call to base class
7123 constructor and fix data size.
7124 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7125 base class constructor and fix data size.
7126 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7127 base class constructor and fix data size.
7128 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7129 class constructor and fix data size.
7130 (Output_data_group::set_final_data_size): New method definition.
7131 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7132 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7133 class constructor and fix data size.
7134 (Output_relaxed_input_section): New class definition.
7135 (Output_section::Simple_input_section): New class definition.
7136 (Output_section::get_input_sections): Adjust parameter list.
7137 (Output_section::add_input_section_for_script): Same.
7138 (Output_section::save_states, Output_section::restore_states,
7139 Output_section::do_address_and_file_offset_have_reset_values,
7140 (Output_section::Input_section::Input_section): Handle
7141 RELAXED_INPUT_SECTION_CODE. Add new overload for
7142 Output_relaxed_input_section.
7143 (Output_section::Input_section::is_input_section,
7144 Output_section::Input_section::set_output_section): Handle relaxed
7145 input section.
7146 (Output_section::Input_section::is_relaxed_input_section,
7147 Output_section::Input_section::output_section_data,
7148 Output_section::Input_section::relaxed_input_section): New method
7149 definitions.
7150 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7151 value.
7152 (Output_section::Input_section::u1_): Update comments.
7153 (Output_section::Input_section::u2_): Add new union member poris.
7154 (Output_section::Checkpoint_output_section): New classs definition.
7155 (Output_section::relax_input_section): New method declaration.
7156 (Output_section::checkpoint_): New data member.
7157 (Output_segment): Update comments.
7158 (Output_segment::Output_segment): Un-privatize copy constructor.
7159 (Output_segment::operator=): Un-privatize.
7160 * script-sections.cc (Output_section_element::Input_section_list):
7161 Change element type to Output_section::Simple_input_section.
7162 (Output_section_element_dot_assignment::set_section_addresses):
7163 Register output section data for relaxation clean up.
7164 (Output_data_exression::Output_data_expression): Adjust call to base
7165 constructor to fix data size.
7166 (Output_section_element_data::set_section_addresses): Register
7167 Output_data_expression object for relaxation clean up.
7168 (struct Input_section_info): Replace Relobj pointer and section index
7169 pair with Output_section::Simple_input_section and Convert struct to a
7170 class.
7171 (Input_section_sorter::operator()): Adjust access to
e1df38aa 7172 Input_section_info data member to use accessors.
20e6d0d6
DK
7173 (Output_section_element_input::set_section_addresses): Use layout
7174 parameter. Adjust code to use Output_section::Simple_input_section
7175 and Input_secction_info classes. Register filler for relaxation
7176 clean up.
7177 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7178 and section index pair with Output_section::Simple_input_section
7179 class. Adjust code accordingly.
7180 (Phdrs_element::release_segment): New method definition.
7181 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7182 segment list.
7183 (Script_sections::release_segments): New method definition.
7184 * gold/script-sections.h (Script_sections::release_segments): New
7185 method declaration.
7186 * gold/target.h (Target::may_relax, Target::relax,
7187 Target::do_may_relax, Target::do_relax): New method definitions.
7188
5e445df6
ILT
71892009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7190
7191 * arm.cc (has_signed_unsigned_overflow): New function.
7192 (Arm_relocate_functions::abs8): New function.
7193 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7194 (Target_arm::Scan::global): Likewise.
7195 (Target_arm::relocate::relocate): Likewise.
7196 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7197 Likewise.
7198
8c604651 71992009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
7200
7201 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7202 * testsuite/Makefile.in: Regenerate.
7203
1e9cc1c2
NC
72042009-09-11 Nick Clifton <nickc@redhat.com>
7205
7206 * po/gold.pot: Updated by the Translation project.
7207
6a89f575
CC
72082009-09-08 Cary Coutant <ccoutant@google.com>
7209
7210 * output.cc (Output_file::open): Add execute permission to empty file.
7211 * testsuite/Makefile.am (permission_test): New test.
7212 * testsuite/Makefile.in: Regenerate.
7213
fdcac5af
ILT
72142009-09-02 Ian Lance Taylor <iant@google.com>
7215
7216 * output.cc (Output_file::resize): Call map_no_anonymous rather
7217 than map.
7218
44453f85
ILT
72192009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7220
7221 * gold.cc: Include "incremental.h".
7222 (queue_initial_tasks): Call Incremental_checker methods.
7223 * incremental.cc: Include "output.h".
7224 (Incremental_checker::can_incrementally_link_output_file): New
7225 method.
7226 * incremental.h (Incremental_checker): New class.
7227
7228 * output.cc (Output_file::open_for_modification): New method.
7229 (Output_file::map_anonymous): Changed return type to bool. Record
7230 map in base_ field.
7231 (Output_file::map_no_anonymous): New method, broken out of map.
7232 (Output_file::map): Use map_no_anonymous and map_anonymous.
7233 * output.h (class Output_file): Update declarations.
7234
293c1386
CC
72352009-08-24 Cary Coutant <ccoutant@google.com>
7236
7237 * options.h (Command_line::Pre_options): New class.
7238 (Command_line::pre_options): New member.
7239 * options.cc (gold::options::ready_to_register): New variable.
7240 (One_option::register_option): Do nothing if not registering options.
7241 Assert if same short option registered twice.
7242 (General_options::General_options): Turn off option registration when
7243 done constructing.
7244 (Command_line::Pre_options::Pre_options): New constructor.
7245
f773f3d2
CC
72462009-08-24 Cary Coutant <ccoutant@google.com>
7247
06a73cfe
CC
7248 * options.h (General_options::no_keep_memory): Remove incorrect
7249 short option.
f773f3d2 7250
a15af8e2
RW
72512009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7252
7253 * Makefile.am (am__skiplex, am__skipyacc): New.
7254 * Makefile.in: Regenerate.
7255
c462b41b
RW
72562009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7257
14ec8efd
RW
7258 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7259 (INCLUDES): ... this.
7260 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7261 (AM_CPPFLAGS): Renamed from ...
7262 (INCLUDE): ... this.
7263 * Makefile.in, testsuite/Makefile.in: Regenerate.
7264
81ecdfbb
RW
7265 * Makefile.in: Regenerate.
7266 * aclocal.m4: Likewise.
7267 * config.in: Likewise.
7268 * configure: Likewise.
7269 * testsuite/Makefile.in: Likewise.
7270
c462b41b
RW
7271 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7272 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7273 * Makefile.in: Regenerate.
7274 * testsuite/Makefile.in: Regenerate.
7275
2da73f13
CC
72762009-08-19 Cary Coutant <ccoutant@google.com>
7277
7278 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7279 symbols in shared libraries overridden by hidden or internal symbols
7280 in the main program.
7281
2db70501
CD
72822009-08-19 Chris Demetriou <cgd@google.com>
7283
7284 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7285 checking source file names in error messages.
7286
f733487b
DK
72872009-08-18 Doug Kwan <dougkwan@google.com>
7288
7289 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7290 an elcpp::Ehdr as parameter. Adjust call to set_target.
7291 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7292 an elfcpp::Ehdr as parameter.
7293 * object.cc (Object::set_target): Remove the version that looks up
7294 a target and sets it.
7295 (Sized_relobj::setup): Take a Target object instead of
7296 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7297 (make_elf_sized_object): Find target and ask target to
7298 make an ELF object.
7299 * object.h: (Object::set_target): Remove the version that looks up
7300 a target and sets it.
7301 (Sized_relobj::setup): Take a Target object instead of
7302 an elfcpp:Ehdr as parameter.
7303 * target.cc: Include dynobj.h.
7304 (Target::do_make_elf_object_implementation): New.
7305 (Target::do_make_elf_object): New.
7306 * target.h (Target::make_elf_object): New template declaration.
7307 (Target::do_make_elf_object): New method declarations.
7308 (Target::do_make_elf_object_implementation): New template declaration.
7309
cc70f101
ILT
73102009-08-14 Ian Lance Taylor <iant@google.com>
7311
7312 * gold.h (FUNCTION_NAME): Define.
7313 (gold_unreachable): Use FUNCTION_NAME.
7314
ef5e0cb1
ST
73152009-08-12 Sriraman Tallam <tmsriram@google.com>
7316
7317 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7318 symbol in the --keep-unique list is not found.
7319
48c187ce
ST
73202009-08-12 Sriraman Tallam <tmsriram@google.com>
7321
7322 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7323 been maked as --keep-unique.
7324 (Icf::unfold_section): New function.
7325 * icf.h (Icf::unfold_section): New function.
7326 * options.h (General_options::keep_unique): New option.
7327 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7328 * testsuite/Makefile.in: Regenerate.
7329 * testsuite/icf_keep_unique_test.sh: New file.
7330 * testsuite/icf_keep_unique_test.cc: New file.
7331
645afe0c
CC
73322009-08-12 Cary Coutant <ccoutant@google.com>
7333
7334 PR 10471
7335 * resolve.cc (Symbol_table::resolve): Check for references from
7336 dynamic objects to hidden and internal symbols.
7337 * testsuite/Makefile.am (hidden_test.sh): New test.
7338 * testsuite/Makefile.in: Regenerate.
7339 * testsuite/hidden_test.sh: New script.
7340 * testsuite/hidden_test_1.c: New test source.
7341 * testsuite/hidden_test_main.c: New test source.
7342
11af873f
DK
73432009-08-11 Doug Kwan <dougkwan@google.com>
7344
7345 * arm.cc: Update comments.
7346 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7347 segment to locate the .ARM.exidx section if present.
7348
b9f7d72d
DK
73492009-08-09 Doug Kwan <dougkwan@google.com>
7350
7351 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7352 patch.
7353
ddd3c53c
ST
73542009-08-07 Sriraman Tallam <tmsriram@google.com>
7355 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7356 compiler warnings.
7357
27721062
ST
73582009-08-06 Sriraman Tallam <tmsriram@google.com>
7359
7360 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7361 valid tls_segment only for non-debug-section relocations.
7362 * testsuite/Makefile.am: Add gc_tls_test.
7363 * testsuite/Makefile.in: Regenerate.
7364 * testsuite/gc_tls_test.cc: New file.
7365 * testsuite/gc_tls_test.sh: New file.
7366
ef15dade 73672009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 7368
ef15dade
ST
7369 * icf.cc: New file.
7370 * icf.h: New file.
7371 * Makefile.am (CCFILES): Add icf.cc.
7372 (HFILES): Add icf.h
7373 * Makefile.in: Regenerate.
7374 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7375 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7376 section, symbol and addend information for the relocs.
7377 * gold.cc (queue_middle_tasks): Call identical code folding.
7378 * gold.h: Add defines for multimap.
7379 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7380 to the call of finalize_local_symbols.
7381 * main.cc (main): Create object of class Icf.
7382 * object.cc (Sized_relobj::do_layout): Allow this function to be
7383 called twice during icf.
7384 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7385 to sections marked as identical by icf.
7386 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7387 when available.
7388 (Sized_relobj::do_section_entsize): New function.
7389 * object.h (Object::section_entsize): New function.
7390 (Object::do_section_entsize): New pure virtual function.
7391 (Relobj::finalize_local_symbols): Add new parameter.
7392 (Relobj::do_section_entsize): New function.
7393 * options.h (General_options::icf): New option.
7394 (General_options::icf_iterations): New option.
7395 (General_options::print_icf_sections): New option.
7396 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7397 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7398 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7399 icf.
7400 * symtab.cc (Symbol_table::is_section_folded): New function.
7401 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7402 to sections marked as identical by icf.
7403 * symtab.h (Symbol_table::set_icf): New function.
7404 (Symbol_table::icf): New function.
7405 (Symbol_table::is_section_folded): New function.
7406 (Symbol_table::icf_): New data member.
7407 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7408 * testsuite/Makefile.am: Add commands to build icf_test.
7409 * testsuite/Makefile.in: Regenerate.
7410 * testsuite/icf_test.sh: New file.
7411 * testsuite/icf_test.cc: New file.
7412
c3b65ac4
CD
74132009-07-24 Chris Demetriou <cgd@google.com>
7414
7415 * layout.cc (is_compressible_debug_section): Fix incorrect
7416 comment about compressed section names.
7417
1caf2c51
ILT
74182009-07-20 Ian Lance Taylor <ian@airs.com>
7419
7420 PR 10419
7421 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7422
1ef4d87f
ILT
74232009-07-16 Ian Lance Taylor <iant@google.com>
7424
7425 PR 10400
7426 * layout.h: #include <map>.
7427 (class Kept_section): Change from struct to class. Add accessors
7428 and setters. Add section size to Comdat_group mapping. Change
7429 Comdat_group to std::map. Add is_comdat_ field. Add
7430 linkonce_size field in union.
7431 (class Layout): Update declaration of find_or_add_kept_section.
7432 Don't declare find_kept_object.
7433 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7434 parameter. Add object, shndx, is_comdat, and is_group_name
7435 parameters. Change all callers. Adjust for new Kept_section.
7436 (Layout::find_kept_object): Remove.
7437 * object.cc (Sized_relobj::include_section_group): Update use of
7438 Kept_section. Rename secnum to shndx. Only record
7439 Kept_comdat_section if sections are the same size.
7440 (Sized_relobj::include_linkonce_section): Update use of
7441 Kept_section. Only record Kept_comdat_section if sections are the
7442 same size. Set size of linkonce section.
7443 (Sized_relobj::map_to_kept_section): Update call to
7444 get_kept_comdat_section.
7445 * object.h (class Sized_relobj): Rename fields in
7446 Kept_comdat_section to drop trailing underscores; change object
7447 field to Relobj*. Change Kept_comdat_section_table to store
7448 struct rather than pointer.
7449 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7450 Add kept_object and kept_shndx parameters. Change all callers.
7451 (Sized_relobj::get_kept_comdat_section): Change return type to
7452 bool. Add kept_object and kept_shndx parameters. Change all
7453 callers.
7454 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7455 Layout::find_or_add_kept_section.
7456
37c3b7b0
ILT
74572009-07-09 Ian Lance Taylor <iant@google.com>
7458
7459 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7460 Reserve space in the hash table.
7461
98fa85cb
ILT
74622009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7463
7464 * fileread.cc (File_read::get_mtime): New method.
7465 * fileread.h (Timespec): New structure.
7466 (File_read::get_mtime): New method.
7467 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7468 Renamed from timestamp_nsec.
7469 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7470 Elf_Xword.
e1df38aa 7471 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 7472 timestamp_nsec.
e1df38aa 7473 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
7474 (Incremental_inputs::report_obejct): Save mtime; style fix.
7475 (Incremental_inputs::report_script): Save mtime; style fix.
7476 (Incremental_inputs::finalize_inputs): Style fix.
7477 (Incremental_inputs::finalize): Style fix.
7478 (Incremental_inputs::create_input_section_data): Store inputs
7479 mtime.
7480 * incremental.h (Incremental_inputs::report_script): Add mtime
7481 argument.
7482 (Incremental_inputs::Input_info::Input_info): Intialize only one
7483 union member.
7484 (Incremental_inputs::Input_info::archive): Move to nameless
7485 union.
7486 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7487 (Incremental_inputs::Input_info::script): Move to nameless union.
7488 (Incremental_inputs::mtime): New field.
7489 * script.cc (read_input_script): Pass file mtime to
7490 Incremental_input.
7491 * script.h (Script_info::inputs): Style fix.
7492
c9d70757
ILT
74932009-07-01 Ian Lance Taylor <ian@airs.com>
7494
7495 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7496 instead of 32.
7497
9c547ec3
ILT
74982009-06-24 Ian Lance Taylor <iant@google.com>
7499
7500 PR 10156
7501 * layout.cc (Layout::choose_output_section): If we find an
7502 existing section, update the flags.
7503 (Layout::create_notes): New function, broken out of
7504 Layout::finalize.
7505 (Layout::finalize): Don't create note sections.
7506 (Layout::create_note): Don't crash if linker script discards
7507 section.
7508 (Layout::create_gold_note): Likewise.
7509 (Layout::create_build_id): Likewise. Don't set
7510 after_input_sections on the section.
7511 (Layout::create_executable_stack_info): Remove target parameter.
7512 Change caller.
7513 * layout.h (class Layout): Declare create_notes. Update
7514 declaration of create_executable_stack_info.
7515 * gold.cc (queue_middle_tasks): Call create_notes.
7516 * output.cc (Output_section::update_flags_for_input_section): Move
7517 here from output.h. If SHF_ALLOC flag is newly set, mark address
7518 invalid.
7519 * output.h (Output_data::mark_address_invalid): New function.
7520 (class Output_section): Only declare, not define,
7521 update_flags_for_input_section. Remove set_flags.
7522
55458500
ILT
75232009-06-24 Ian Lance Taylor <iant@google.com>
7524
7525 * script-sections.cc (Output_section_definition::
7526 set_section_addresses): Rename shadowing local load_address to
7527 laddr.
7528
1307d6cd
ILT
75292009-06-24 Ian Lance Taylor <iant@google.com>
7530
7531 PR 10244
7532 * reloc.cc (relocate_sections): Skip empty relocation sections.
7533
ec3f783e
ILT
75342009-06-23 Ian Lance Taylor <iant@google.com>
7535
7536 PR 10156
7537 * layout.cc (Layout::create_note): Use choose_output_section
7538 rather than make_output_section.
7539
459c9f1c
ILT
75402009-06-23 Ian Lance Taylor <iant@google.com>
7541
7542 PR 10237
7543 * options.cc (General_options::parse_V): Set printed_version_.
7544 (General_options::General_options): Initialize printed_version_.
7545 * options.h (class General_options): Add printed_version_ field.
7546 * gold.cc (queue_initial_tasks): If there are no input files,
7547 don't give a fatal error if we printed the version information.
7548 (queue_middle_tasks): If using -r with a shared object, give a
7549 fatal error rather than an ordinary error.
7550
1518dc8f
ILT
75512009-06-23 Ian Lance Taylor <iant@google.com>
7552
7553 PR 10219
7554 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7555 (Layout::make_output_section): Set have_stabstr_section_ if we see
7556 a .stab*str section.
7557 (Layout::finalize): Call link_stabs_sections.
7558 (Layout::link_stabs_sections): New file.
7559 * layout.h (class Layout): Add have_stabstr_section_ field.
7560 Declare link_stabs_sections.
7561
3d857b98
DK
75622009-06-23 Doug Kwan <dougkwan@google.com>
7563
7564 * Makefile.am (libgold_a_LIBADD): New.
7565 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7566 * Makefile.in: Regenerate.
7567 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7568 * configure: Regenerate.
7569 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7570 * fileread.cc: Include sys/state.h
7571 * gold.h: Declare memmem and strndup if found missing.
7572 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7573
0639a6f6
ILT
75742009-06-23 Ian Lance Taylor <iant@google.com>
7575
7576 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7577 * configure: Rebuild.
7578
8d63875c
ILT
75792009-06-23 Ian Lance Taylor <iant@google.com>
7580
7581 PR 10147
7582 * object.cc (Object::section_contents): Don't try to get a view if
7583 the section has length zero.
7584 (Object::handle_gnu_warning_section): If the section is empty, use
7585 the name of the section as the warning.
7586
f7c8a183
ILT
75872009-06-23 Ian Lance Taylor <iant@google.com>
7588
7589 PR 10133
7590 * stringpool.h (class Stringpool_template): Add optimize_ field.
7591 (Stringpool_template::set_optimize): New function.
7592 * stringpool.cc (Stringpool_template::Stringpool_template):
7593 Initialize optimize_ field.
7594 (Stringpool_template::set_string_offsets): Test local optimize
7595 fild rather than parameter.
7596 * layout.cc (Layout::Layout): Call set_optimize on the section
7597 name stringpool.
7598
e6a307ba
ILT
75992009-06-22 Ian Lance Taylor <iant@google.com>
7600
7601 PR 10030
7602 * yyscript.y: Parse TARGET.
7603 * script.cc (script_set_target): New function.
7604 * script-c.h (script_set_target): Declare.
7605 * options.cc (General_options::string_to_object_format): Rename
7606 from string_to_object_format in anonymous namespace. Change
7607 callers.
7608 * options.h (class General_options): Declare
7609 string_to_object_format.
7610
3ee173de
ILT
76112009-06-22 Ian Lance Taylor <iant@google.com>
7612
7613 * script-sections.cc (Script_sections::create_segments): Don't put
7614 program headers in a PT_LOAD segment if -n or -N.
7615
76162009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
7617
7618 PR 10141
7619 * options.h (class General_options): Add -z lazy and -z now. Sort
7620 -z options into alphabetical order.
7621 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7622
cd6739a1 76232009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
7624
7625 * layout.cc (Layout::make_output_section): Call
7626 Target::new_output_section.
7627 (Layout::attach_allocated_section_to_segment): Put large section
7628 sections in a separate load segment with the large segment flag
7629 set.
7630 (Layout::segment_precedes): Sort large data segments after other
7631 load segments.
7632 (align_file_offset): New static function.
7633 (Layout::set_segment_offsets): Use align_file_offset.
7634 * output.h (class Output_section): Add is_small_section_ and
7635 is_large_section_ fields.
7636 (Output_section::is_small_section): New function.
7637 (Output_section::set_is_small_section): New function.
7638 (Output_section::is_large_section): New function.
7639 (Output_section::set_is_large_section): New function.
7640 (Output_section::is_large_data_section): New function.
7641 (class Output_segment): Add is_large_data_segment_ field.
7642 (Output_segment::is_large_data_segment): New function.
7643 (Output_segment::set_is_large_data_segment): New function.
7644 * output.cc (Output_section::Output_section): Initialize new
7645 fields.
7646 (Output_segment::Output_segment): Likewise.
7647 (Output_segment::add_output_section): Add assertion that large
7648 data sections always go in large data segments. Force small data
7649 sections to the end of the list of data sections. Force small BSS
7650 sections to the start of the list of BSS sections. For large BSS
7651 sections to the end of the list of BSS sections.
7652 * symtab.h (class Symbol): Declare is_common_shndx.
7653 (Symbol::is_defined): Check Symbol::is_common_shndx.
7654 (Symbol::is_common): Likewise.
7655 (class Symbol_table): Define enum Commons_section_type. Update
7656 declarations. Add small_commons_ and large_commons_ fields.
7657 * symtab.cc (Symbol::is_common_shndx): New function.
7658 (Symbol_table::Symbol_table): Initialize new fields.
7659 (Symbol_table::add_from_object): Put small and large common
7660 symbols in the right list.
7661 (Symbol_table::sized_finalized_symbol): Check
7662 Symbol::is_common_shndx.
7663 (Symbol_table::sized_write_globals): Likewise.
7664 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7665 common symbol lists. Don't call do_allocate_commons_list if the
7666 list is empty.
7667 (Symbol_table::do_allocate_commons_list): Remove is_tls
7668 parameter. Add comons_section_type parameter. Change all
7669 callers. Handle small and large common symbols.
7670 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7671 Symbol::is_common_shndx.
7672 * resolve.cc (symbol_to_bits): Likewise.
7673 * target.h (Target::small_common_shndx): New function.
7674 (Target::small_common_section_flags): New function.
7675 (Target::large_common_shndx): New function.
7676 (Target::large_common_section_flags): New function.
7677 (Target::new_output_section): New function.
7678 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7679 small_common_section_flags, and large_common_section_flags
7680 fields.
7681 (Target::do_new_output_section): New virtual function.
7682 * arm.cc (Target_arm::arm_info): Initialize new fields.
7683 * i386.cc (Target_i386::i386_info): Likewise.
7684 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7685 Likewise.
7686 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7687 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7688 (Target_x86_64::do_new_output_section): New function.
7689 * configure.ac: Define conditional MCMODEL_MEDIUM.
7690 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7691 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7692 (large_LDFLAGS): Define.
7693 * testsuite/large.c: New file.
7694 * testsuite/testfile.cc (Target_test::test_target_info):
7695 Initialize new fields.
7696 * configure, testsuite/Makefile.in: Rebuild.
7697
bb04269c
DK
76982009-06-05 Doug Kwan <dougkwan@google.com>
7699
7700 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 7701 * Makefile.in: Regenerate.
bb04269c
DK
7702 * i386.cc (class Target_i386): Define new virtual method to
7703 override do_is_local_label_name in parent.
7704 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7705 local symbols if --discard-locals or -X is given.
7706 * options.h (class General_options): Declare new options
7707 '--discard-locals' and '-X' for discarding locals.
7708 * target.h (class Target): Define new methods is_local_label_name.
7709 Declare new virtual method do_is_local_label_name.
7710 * target.cc: New file.
7711 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7712 (check_SCRIPTS): Add discard_locals_test.sh.
7713 (check_DATA): Add discard_local_tests.syms.
7714 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7715 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7716 * testsuite/Makefile.in: Regenerate.
7717 * testsuite/discard_locals_test.c: New file.
7718 * testsuite/discard_locals_test.sh: Same.
7719
805bb01c
DK
77202009-06-05 Doug Kwan <dougkwan@google.com>
7721
7722 * object.cc (Sized_relobj::Sized_relobj): Initialize
7723 discarded_eh_frame_shndx_ to -1U.
7724 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7725 section.
7726 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7727 a discarded .eh_frame section.
7728 (Sized_relobj::do_finalize_local_symbols): Ditto.
7729 * object.h (class Sized_relobj): Declare new member
7730 discarded_eh_frame_shndx_.
7731 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7732 (local_labels_test.o, local_labels_test): New rules.
7733 * testsuite/Makefile.in: Regenerate.
7734
1dcd334d
DK
77352009-06-04 Doug Kwan <dougkwan@google.com>
7736
7737 * layout.cc (Layout::section_name_mapping): Add mapping for
7738 special ARM sections.
7739
96d49306
DK
77402009-06-03 Doug Kwan <dougkwan@google.com>
7741
7742 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7743 (utils::has_overflow): Same.
7744
dff16297
ILT
77452009-06-03 Ian Lance Taylor <iant@google.com>
7746
7747 * layout.cc (Layout::section_name_mapping): New array, replacing
7748 Layout::linkonce_mapping.
7749 (Layout::section_name_mapping_count): New variable, replacing
7750 Layout::linkonce_mapping_count.
7751 (Layout::linkonce_output_name): Remove.
7752 (Layout::output_section_name): Rewrite.
7753 * layout.h (class Layout): Rename Linkonce_mapping to
7754 Section_name_mapping, linkonce_mapping to section_name_mapping,
7755 linkonce_mapping_count to section_name_mapping_count. Don't
7756 declare linkonce_output_name.
7757
c121c671
DK
77582009-06-03 Doug Kwan <dougkwan@google.com>
7759
7760 * gold/arm.cc (namespace utils): New.
7761 (Target_arm::reloc_is_non_pic): Define new method.
7762 (class Arm_relocate_functions): New.
7763 (Target_arm::Relocate::relocate): Handle relocation types used by
7764 Android.
7765
07800fab
ILT
77662009-06-03 Ian Lance Taylor <iant@google.com>
7767
7768 * arm.cc (Target_arm::scan::global): Use || instead of |.
7769
c121c671
DK
77702009-06-02 Doug Kwan <dougkwan@google.com>
7771
7772 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7773 issued_non_pic_error_.
7774 (class Target_arm::Scan): Declare new method check_non_pic.
7775 Define new method symbol_needs_plt_entry.
7776 Declare new data member issued_non_pic_error_.
7777 (class Target_arm::Relocate): Declare new method
7778 should_apply_static_reloc.
7779 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7780 (Target_arm::Scan::check_non_pic): Define new method.
7781 (Target_arm::Scan::local): Handle a small subset of reloc types used
7782 by Android.
7783 (Target_arm::Scan::local): Same.
7784 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7785
b19b0c6d
ILT
77862009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7787
7788 * incremental.cc (Incremental_inputs::report_command_line): Filter
7789 out --incremental-* options.
7790
94cdfcff
DK
77912009-05-29 Doug Kwan <dougkwan@google.com>
7792
7793 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7794 template class.
7795 (class Target_arm): Update comment.
7796 (Target_arm::Target_arm): Initialize new data members GOT_,
7797 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7798 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7799 and Target_arm::rel_dyn_section.
7800 Declare new_enum Target_arm::Got_type.
7801 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7802 and DYNBSS_.
7803 Update commments for member do_dynsym_value.
7804 (Target_arm::got_size, Target_arm::plt_section,
7805 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7806 new methods inside class defintion.
7807 (Target_arm::got_section): Define new method.
7808 (Target_arm::rel_dyn_section): Same.
7809 (Output_data_plt_arm): New template class.
7810 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7811 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7812 (Output_data_plt_arm::add_entry): Same.
7813 (Output_data_plt_arm::first_plt_entry): Define new
7814 static data member for PLT instruction template.
7815 (Output_data_plt_arm::plt_entry): Same.
7816 (Output_data_plt_arm::do_write): Define new method.
7817 (Target_arm::make_plt_entry): Same.
7818 (Target_arm::do_finalize_sections): Same.
7819 (Target_arm::do_dynsym_value): Same.
7820
4a657b0d
DK
78212009-05-28 Doug Kwan <dougkwan@google.com>
7822
7823 * Makefile.am (TARGETSOURCES): Add arm.cc.
7824 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7825 * Makefile.in: Regenerate.
7826 * arm.cc: New file.
7827 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7828
e7ae8c36
DK
78292009-05-26 Doug Kwan <dougkwan@google.com>
7830
7831 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7832 (General_options::check_excluded_libs): Strip off directories in
7833 archive name before matching like GNU ld does.
7834 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7835 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7836 (exclude_libs_test_LDFLAGS): Add linker option
7837 -Wl,--exclude-libs,libexclude_libs_test_3
7838 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7839 an explicit archive without using -l.
7840 (alt/libexclude_libs_test_3.a): New make rule.
7841 * testsuite/Makefile.in: Regenerate.
7842 * testsuite/exclude_libs_test.c : Declare lib3_default().
7843 (main): Call it.
7844 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7845 * exclude_libs_test_3.c: New file.
7846
f12e7348
NC
78472009-05-26 Nick Clifton <nickc@redhat.com>
7848
7849 * po/id.po: New Indonesian translation.
7850 * po/gold.pot: Updated template file.
7851
4daadc0d
ST
78522009-05-22 Sriraman Tallam <tmsriram@google.com>
7853
e1df38aa 7854 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
7855 gc_comdat_test files. Add -Wl,--gc-sections to build
7856 gc_comdat_test.
7857 * testsuite/Makefile.in: Regenerate.
7858 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7859
531813ad
ST
78602009-05-21 Sriraman Tallam <tmsriram@google.com>
7861
7862 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7863 kept comdat section was garbage collected.
7864 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7865 * testsuite/Makefile.in: Regenerate.
7866 * testsuite/gc_comdat_test.sh: New file.
7867 * testsuite/gc_comdat_test_1.cc: New file.
7868 * testsuite/gc_comdat_test_2.cc: New file.
7869
65514900
CC
78702009-05-19 Doug Kwan <dougkwan@google.com>
7871
7872 * archive.cc (Archive::Archive): Move constructor from archive.h
7873 to here. Initialize no_export_.
7874 (Archive::get_elf_object_for_member): Set no_export flag of object.
7875 * archive.h (Archive::Archive): Move constructor body to
7876 archive.cc.
7877 (Archive::no_export): New method.
7878 (Archive::no_export_): New field.
7879 * object.h (Object::Object): Initialize no_export_ to false.
7880 (Object::no_export, Object::set_no_export): New methods.
7881 (Object::no_export_): New field.
7882 * options.cc (General_options::parse_exclude_libs): New method.
7883 (General_options::check_excluded_libs) Same.
7884 * options.h (exclude_libs): New option.
7885 (General_options::check_excluded_libs): New method declaration.
7886 (General_options::excluded_libs_): New field.
7887 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7888 default or protected visibility if an object has no-export flag set.
7889 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7890 (check_SCRIPTS): Add exclude_libs_test.sh.
7891 (check_DATA): Add exclude_libs_test.syms.
7892 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7893 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7894 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7895 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7896 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7897 libexclude_libs_test_2.a): New rules.
7898 * testsuite/Makefile.in: Regenerate.
7899 * testsuite/exclude_libs_test.c: New file.
7900 * testsuite/exclude_libs_test.sh: Ditto.
7901 * testsuite/exclude_libs_test_1.c: Ditto.
7902 * testsuite/exclude_libs_test_2.c: Ditto.
7903
1b77ea50
ILT
79042009-05-15 Ian Lance Taylor <iant@google.com>
7905
7906 * configure.ac: Check for declarations for cases where libiberty.h
7907 checks HAVE_DECL_xxx.
7908 * configure, config.in: Rebuild.
7909
072fe7ce
ILT
79102009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7911
7912 * gold.h (Incremental_argument_list): Remove (invalid) forward
7913 declaration.
7914 * incremental.cc (Incremental_inputs::report_achive): New method.
7915 (Incremental_inputs::report_object): New method.
7916 (Incremental_inputs::report_script): New method.
7917 (Incremental_inputs::finalize_inputs): New method.
7918 (Incremental_inputs::finalize): Call finalize_inputs().
7919 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7920 Create inputs entries.
7921 * incremental.h (Incremental_input_type): New enum.
7922 (Incremental_inputs::Incremental_input): Initialize new fields.
7923 (Incremental_inputs::report_inputs): New method.
7924 (Incremental_inputs::report_achive): New method.
7925 (Incremental_inputs::report_object): New method.
7926 (Incremental_inputs::report_script): New method.
7927 (Incremental_inputs::finalize_inputs): New method.
7928 (Incremental_inputs::Input_info): New struct.
7929 (Incremental_inputs::Input_info_map): New typedef.
7930 (Incremental_inputs::lock_): New field.
7931 (Incremental_inputs::Inputs_): New field.
7932 (Incremental_inputs::Inputs_map): New field.
7933 * main.cc (main): Call Incremental_input::report_inputs.
7934 * options.h (Input_argument_list): Typedef moved from
7935 Input_arguments.
7936 (Input_file_group::Files): Remove, use ::Input_argument_list.
7937 (Input_file_group::Input_argument_list): Remove, use
7938 ::Input_argument_list.
7939 * plugin.cc (Plugin_manager::add_input_file): Add error in
7940 incremental build.
7941 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7942 functions.
7943 * script.cc (read_input_script): Call
7944 Incremental_input::report_script.
7945 * script.h (Script_info): New class.
7946
b0481b0b
ILT
79472009-04-27 Ian Lance Taylor <iant@google.com>
7948
7949 * x86_64.cc (do_adjust_output_section): Set entsize to
7950 plt_entry_size.
7951
b22a5a41 79522009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
7953
7954 * output.cc (Output_file::close): After short writes, continue
7955 writing from the correct offset in the buffer being written.
7956
40fde488
CD
79572009-04-23 Chris Demetriou <cgd@google.com>
7958
7959 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7960 * configure: Regenerate.
7961 * config.in: Regenerate.
7962 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7963 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7964
3ce2c28e
ILT
79652009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7966
7967 * incremental.cc (Incremental_inputs_header_data): Renamed from
7968 Incremental_input_header_data.
7969 (Incremental_inputs_header_data::data_size): New field.
7970 (Incremental_inputs_header_data::put_input_file_count): Renamed
7971 from input_file_count.
7972 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7973 from command_line_offset.
7974 (Incremental_inputs_header_data::put_reserved): Renamed from
7975 put_reserved.
7976 (Incremental_inputs_entry_data): Renamed from
7977 Incremental_input_entry_data.
7978 (Incremental_inputs_entry_data::data_size): New field.
7979 (Incremental_inputs::report_command_line): New method.
7980 (Incremental_inputs::finalize): New method.
7981 (Incremental_inputs::create_incremental_inputs_data): New method.
7982 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7983 * incremental.h: New file.
7984 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7985 (Layout::finalize): Create incremental inputs section in
7986 incremental builds.
7987 (Layout::create_incremental_info_sections): New method.
7988 * layout.h (Layout::incremental_inputs): New method.
7989 (Layout::create_incremental_info_sections): New method.
7990 (Layout::incremental_inputs_): New field.
7991 * main.cc (main): Notify Incremental_input of the command line.
7992
e55bde5e
ILT
79932009-04-01 Ian Lance Taylor <iant@google.com>
7994 Mikolaj Zalewski <mikolajz@google.com>
7995
7996 * gold.h (reserve_unordered_map): Define, three versions, one for
7997 each version of Unordered_map.
7998 * layout.cc (Layout::Layout): Remove options parameter. Add
7999 number_of_input_files parameter. Don't initialize options_.
8000 Initialize number_of_input_files_ and resized_signatures_. Move
8001 sections_are_attached_.
8002 (Layout::layout_group): Reserve space for group_signatures_.
8003 (Layout::find_or_add_kept_section): Change name parameter to be a
8004 reference. Resize signatures_ map when it gets large enough.
8005 (Layout::layout_eh_frame): Use parameters->options() instead of
8006 this->options_.
8007 (Layout::make_output_section): Likewise.
8008 (Layout::attach_allocated_section_to_segment): Likewise.
8009 (Layout::finalize, Layout::create_executable_stack): Likewise.
8010 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8011 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8012 * layout.h (class Layout): Update declarations. Remove options_
8013 field. Add number_of_input_files_ and resized_signatures_
8014 fields. Move sections_are_attached_ field.
8015 * main.cc (main): Pass number of input files to Layout
8016 constructor. Don't pass options.
8017
154b857c
ILT
80182009-03-30 Ian Lance Taylor <iant@google.com>
8019
8020 * ffsll.c (ffsll): Correct implementation.
8021
2f35ab9b
ILT
80222009-03-27 Ian Lance Taylor <iant@google.com>
8023
fd03461a
ILT
8024 * ffsll.c: New file.
8025 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8026 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8027 * ftruncate.c (ftruncate): Declare before definition.
8028 * mremap.c (mremap): Likewise.
8029 * pread.c (pread): Likewise.
8030 * configure, Makefile.in, config.in: Rebuild.
8031
2f35ab9b
ILT
8032 * mremap.c: New file.
8033 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8034 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8035 (mremap): Declare if HAVE_MREMAP is not defined.
8036 * configure, Makefile.in, config.in: Rebuild.
8037
33aea2fd
CC
80382009-03-27 Cary Coutant <ccoutant@google.com>
8039
8040 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8041 position independent.
8042 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8043 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8044
6d479619
CC
80452009-03-24 Cary Coutant <ccoutant@google.com>
8046
8047 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8048 an executable.
8049 (needs_dynamic_reloc): Likewise.
8050
afc06bb8
ILT
80512009-03-24 Ian Lance Taylor <iant@google.com>
8052
8053 * yyscript.y (file_cmd): Recognize EXTERN.
8054 (extern_name_list, extern_name_list_body): New nonterminals.
8055 * script.cc (script_add_extern): Define.
8056 * script-c.h (script_add_extern): Declare.
8057
f6060a4d
ILT
80582009-03-24 Rafael Avila de Espindola <espindola@google.com>
8059
8060 * object.cc (is_elf_object): Define.
8061 * object.h (is_elf_object): Declare.
8062 * archive.cc (Archive::get_elf_object_for_member): Call
8063 is_elf_object.
33aea2fd 8064 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 8065
26736d8e
ILT
80662009-03-24 Elliott Hughes <enh@google.com>
8067
8068 * output.cc (Output_file::map_anonymous): Define.
8069 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8070 try an anonymous one. Report the size if the mmap fails.
8071 * output.h (class Output_file): Declare map_anonymous.
8072
22fd9730
ILT
80732009-03-24 Ian Lance Taylor <iant@google.com>
8074
8075 * target-select.cc (instantiate_target): Don't acquire the lock if
8076 the instantiated_target_ field has already been set.
8077
cb010894
ILT
80782009-03-23 Ian Lance Taylor <iant@google.com>
8079
7f055c20
ILT
8080 * gold-threads.h (class Initialize_lock): Define.
8081 * gold-threads.cc (class Initialize_lock_once): Define.
8082 (initialize_lock_control): New static variable.
8083 (initialize_lock_pointer): New static variable.
8084 (initialize_lock_once): New static function.
8085 (Initialize_lock::Initialize_lock): Define.
8086 (Initialize_lock::initialize): Define.
8087 * target-select.h: Include "gold-threads.h".
8088 (class Target_selector): Add lock_ and initialize_lock_ fields.
8089 Don't define instantiate_target, just declare it.
8090 * target-select.cc (Target_selector::Target_selector): Initialize
8091 new fields.
8092 (Target_selector::instantiate_target): Define.
8093 * descriptors.h: Include "gold-threads.h".
8094 (class Descriptors): Add initialize_lock_ field.
8095 * descriptors.cc (Descriptors::Descriptors): Initialize new
8096 field.
8097 (Descriptors::open): Use initialize_lock_ field
8098 * errors.h (class Errors): Add initialize_lock_ field.
8099 * errors.cc (Errors::Errors): Initialize new field.
8100 (Errors::initialize_lock): Use initialize_lock_ field.
8101 * powerpc.cc (class Target_selector_powerpc): Remove
8102 instantiated_target_ field. In do_recognize call
8103 instantiate_target rather than do_instantiate_target. In
8104 do_instantiate_target just allocate a new target.
8105 * sparc.cc (class Target_selector_sparc): Likewise.
8106
36959681
ILT
8107 * freebsd.h: New file.
8108 * i386.cc: Include "freebsd.h".
8109 (Target_i386): Derive from Target_freebsd rather than
8110 Sized_target.
8111 (Target_selector_i386): Derive from Target_selector_freebsd rather
8112 than Target_selector.
8113 * x86_64.cc: Include "freebsd.h".
8114 (Target_x86_64): Derive from Target_freebsd rather than
8115 Sized_target.
8116 (Target_selector_x86_64): Derive from Target_selector_freebsd
8117 rather than Target_selector.
8118 * target.h (class Target): Add adjust_elf_header and
8119 do_adjust_elf_header.
8120 * output.cc (Output_file_header:: do_sized_write): Call target
8121 adjust_elf_header routine.
8122 * configure.tgt: Set targ_osabi.
8123 * configure.ac: Define GOLD_DEFAULT_OSABI.
8124 * parameters.cc (Parameters::default_target): Pass
8125 GOLD_DEFAULT_OSABI to select_target.
8126 * target-select.h (class Target_selector): Make instantiate_target
8127 protected rather than private.
8128 * Makefile.am (HFILES): Add freebsd.h.
8129 * configure, Makefile.in, config.in: Rebuild.
8130
cb010894
ILT
8131 * merge.cc (do_add_input_section): Correct pend value. Change
8132 message about last entry not being null terminated from error to
8133 warning.
8134
0e879927
ILT
81352009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8136
8137 * incremental.cc: New file.
8138 * Makefile.am (CCFILES): Add incremental.cc.
8139 * Makefile.in: Rebuild.
8140
41105937
PP
81412009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8142
8143 * layout.cc (Layout::output_section_name): Preserve names
8144 of '.note.' sections.
e1df38aa 8145
60439920
ILT
81462009-03-19 Ian Lance Taylor <iant@google.com>
8147
8148 * descriptors.cc (Descriptors::open): Check that the options are
8149 valid before using them.
8150
0d371ad3
ILT
81512009-03-18 Ian Lance Taylor <iant@google.com>
8152
8153 * script-sections.h: Include <list>.
8154 (class Script_sections): Change Sections_elements from std::vector
8155 to std::list. Typedef public Elements_iterator. Add
8156 orphan_section_placement_, data_segment_align_start_, and
8157 saw_data_segment_align_ fields. Remove data_segment_align_index_
8158 field.
8159 * script-sections.cc (class Orphan_section_placement): New class.
8160 (class Sections_element): Add virtual functions is_relro and
8161 orphan_section_init. Remove virtual function place_orphan_here.
8162 (class Output_section_definition): Add is_relro and
8163 orphan_section_init. Remove place_orphan_here.
8164 (class Orphan_output_section): Likewise.
8165 (Script_sections::Script_sections): Update for field changes.
8166 (Script_sections::data_segment_align): Set saw_data_segment_align_
8167 and data_segment_align_start_, not data_segment_align_index.
8168 (Script_sections::data_segment_relro_end): Check
8169 saw_data_segment_align_. Use data_segment_align_start_ rather
8170 than data_segment_align_index_.
8171 (Script_sections::place_orphan): Rewrite to use
8172 Orphan_section_placement.
8173
9201d894
ILT
81742009-03-17 Ian Lance Taylor <iant@google.com>
8175
9c5b8369
ILT
8176 * archive.cc (Archive::add_symbols): Check for a version attached
8177 to the symbol name in the archive map.
8178 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8179 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8180 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8181 (ver_test_11.a): New target.
8182 * testsuite/Makefile.in: Rebuild.
8183
9201d894
ILT
8184 * configure.ac: Check for chsize and posix_fallocate. Replace
8185 ftruncate.
8186 * ftruncate.c: New file, from gnulib.
8187 * output.cc (posix_fallocate): Define dummy version if not
8188 HAVE_POSIX_FALLOCATE.
8189 (Output_file::map): Call posix_fallocate rather than lseek and
8190 write.
8191 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8192 * configure, Makefile.in, config.in: Rebuild.
8193
ef4ab7a8 81942009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 8195
ef4ab7a8
PP
8196 * layout.h (Layout::create_note): Add section_name parameter.
8197 * layout.cc (Layout::create_note): Likewise.
8198 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 8199
8c500701
ILT
82002009-03-17 Ian Lance Taylor <iant@google.com>
8201
e85b18e1
ILT
8202 * descriptors.cc: Include "options.h".
8203 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8204 (Descriptors::open): Always use O_CLOEXEC when opening a new
8205 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8206 then set FD_CLOEXEC.
8207
9efe6174
ILT
8208 * sparc.cc (class Target_sparc): Add has_got_section.
8209 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8210 make sure we have a GOT section.
8211
8212 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8213 (Target_sparc::Scan::local): Likewise.
8214 (Target_sparc::Scan::global): Likewise.
8215 (Target_sparc::Relocate::relocate): Likewise.
8216 (Target_sparc::Relocate::relocate_tls): Likewise.
8217
8c500701
ILT
8218 * symtab.cc (Symbol_table::define_default_version): New function,
8219 broken out of add_from_object.
8220 (Symbol_table::add_from_object): Call define_default_version.
8221 (Symbol_table::define_special_symbol): Add resolve_oldsym
8222 parameter. Change all callers. If the version for a symbol comes
8223 from a version script, resolve it with the symbol with the same
8224 name with no version. Also add the symbol without a version if
8225 appropriate.
8226 (do_define_in_output_data): If resolving with oldsym, don't delete
8227 sym.
8228 (do_define_in_output_segment): Likewise.
8229 (do_define_as_constant): Likewise.
8230 * symtab.h (class Symbol_table): Update declarations.
8231
f1ed28fb
ILT
82322009-03-13 Ian Lance Taylor <iant@google.com>
8233
15f8229b
ILT
8234 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8235 (Read_symbols::requeue): New function.
8236 (Read_symbols::do_read_symbols): If make_elf_object fails because
8237 the target type is not configured, and the file was searched for,
8238 issue a warning and retry with the next directory.
8239 (Add_symbols::run): If the file has an incompatible format, and
8240 it was searched for, requeue the Read_symbols task. On error,
8241 release the object.
8242 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8243 dirindex parameter to constructor. Change all callers. Declare
8244 incompatible_warning and requeue.
8245 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8246 input_argument_ and input_group_ fields. Add them to
8247 constructor. Change all callers.
8248 (class Read_script): Add dirindex_ field. Add it to constructor.
8249 Change all callers.
8250 * archive.cc (Archive::setup): Remove input_objects parameter.
8251 Change all callers.
8252 (Archive::get_file_and_offset): Likewise.
8253 (Archive::read_all_symbols): Likewise.
8254 (Archive::read_symbols): Likewise.
8255 (Archive::get_elf_object_for_member): Remove input_objects
8256 parameter. Add punconfigured parameter. Change all callers.
8257 (Archive::add_symbols): Change return type to bool. Check return
8258 value of include_member.
8259 (Archive::include_all_members): Likewise.
8260 (Archive::include_member): Change return type to bool. Return
8261 false if first included object has incompatible target. Set
8262 included_member_ field.
8263 (Add_archive_symbols::run): If add_symbols returns false, requeue
8264 Read_symbols task.
8265 * archive.h (class Archive): Add included_member_ field.
8266 Initialize it in constructor. Add input_file and searched_for
8267 methods. Update declarations.
8268 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8269 input_argument_ fields. Add them to constructor. Change all
8270 callers.
8271 * script.cc: Include "target-select.h".
8272 (class Parser_closure): Add skip_on_incompatible_target_ and
8273 found_incompatible_target_ fields. Add
8274 skip_on_incompatible_target parameter to constructor. Change all
8275 callers. Add methods skip_on_incompatible_target,
8276 clear_skip_on_incompatible_target, found_incompatible_target, and
8277 set_found_incompatible_target.
8278 (read_input_script): Add dirindex parameter. Change all callers.
8279 If parser finds an incompatible target, requeue Read_symbols
8280 task.
8281 (script_set_symbol): Clear skip_on_incompatible_target in
8282 closure.
8283 (script_add_assertion, script_parse_option): Likewise.
8284 (script_start_sections, script_add_phdr): Likewise.
8285 (script_check_output_format): New function.
8286 * script.h (read_input_script): Update declaration.
8287 * script-c.h (script_check_output_format): Declare.
8288 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8289 (ignore_cmd): Remove OUTPUT_FORMAT.
8290 * fileread.cc (Input_file::Input_file): Add explicit this.
8291 (Input_file::will_search_for): New function.
8292 (Input_file::open): Add pindex parameter. Change all callers.
8293 * fileread.h (class Input_file): Add input_file_argument method.
8294 Declare will_search_for. Update declarations.
8295 * object.cc (make_elf_object): Add punconfigured parameter.
8296 Change all callers.
8297 * object.h (class Object): Make input_file public. Add
8298 searched_for method.
8299 (make_elf_object): Update declaration.
8300 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8301 restart search.
8302 * dirsearch.h (class Dirsearch): Update declaration.
8303 * options.h (class General_options): Add --warn-search-mismatch.
8304 * parameters.cc (Parameters::is_compatible_target): New function.
8305 * parameters.h (class Parameters): Declare is_compatible_target.
8306 * workqueue.cc (Workqueue::add_blocker): New function.
8307 * workqueue.h (class Workqueue): Declare add_blocker.
8308
f1ed28fb
ILT
8309 * fileread.cc (Input_file::open): Remove options parameter.
8310 Change all callers.
8311 (Input_file::open_binary): Likewise.
8312 * script.cc (read_input_script): Likewise.
8313 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8314 options parameter from constructor. Change all callers.
8315 (class Read_script): Likewise.
8316 * fileread.h (class Input_file): Update declarations.
8317 * script.h (read_input_script): Update declaration.
8318
34dd024a
NC
83192009-03-10 Nick Clifton <nickc@redhat.com>
8320
8321 * po/es.po: New Spanish translation.
8322
6d71b17c
CC
83232009-03-06 Cary Coutant <ccoutant@google.com>
8324
8325 * options.cc (parse_short_option): Keep dash_z from registering itself.
8326
031cdbed
ILT
83272009-03-03 Ian Lance Taylor <iant@google.com>
8328
8329 PR 9918
8330 * target-reloc.h (relocate_section): Pass output_section to
8331 relocate.
8332 * i386.cc (Target_i386::should_apply_static_reloc): Add
8333 output_section parameter. Change all callers.
8334 (Target_i386::Relocate::relocate): Add output_section parameter.
8335 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8336 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8337 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8338 * testsuite/two_file_shared.sh: New script.
8339 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8340 (check_DATA): Add two_file_shared.dbg.
8341 (two_file_shared.dbg): New target.
8342 * testsuite/Makefile.in: Rebuild.
8343
15d5fa16
ILT
83442009-03-01 Ian Lance Taylor <iant@google.com>
8345
8346 * configure.ac: Check for byteswap.h.
8347 * configure: Rebuild.
8348 * config.in: Rebuild.
8349
8a4c0b0d
ILT
83502009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8351
8352 * layout.cc (Layout::find_or_add_kept_section): New function.
8353 (Layout::add_comdat): Removed.
8354 * layout.h (struct Kept_section): Move out of class Layout.
8355 Remove trailing underscores from field names. Add group_sections
8356 field. Rename group_ field to is_group. Change all uses.
8357 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8358 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8359 comdat_groups_ field.
8360 (Sized_relobj::include_section_group): Use
8361 find_or_add_kept_section and Kept_section::group_sections.
8362 (Sized_relobj::include_linkonce_section): Likewise.
8363 * object.cc (class Sized_relobj): Don't define Comdat_group or
8364 Comdat_group_table. Remove find_comdat_group and
8365 add_comdat_group. Remove comdat_groups_ field.
8366 * plugin.cc (include_comdat_group): Use
8367 Layout::find_or_add_kept_section.
8368
b4ecf66b
ILT
83692009-02-28 Ian Lance Taylor <iant@google.com>
8370
14359ca0
ILT
8371 * README: --gc-sections and map files are now supported. Document
8372 some build requirements.
8373
b4ecf66b
ILT
8374 PR 6992
8375 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8376 relocatable link set the value of the section symbol to zero.
8377 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8378 relocatable link don't include the section address in the local
8379 symbol value.
8380
0602e05a
ILT
83812009-02-27 Ian Lance Taylor <iant@google.com>
8382
fd9d194f
ILT
8383 PR 6811
8384 * options.h (class Search_directory): Add is_system_directory.
8385 (class General_options): Declare is_in_system_directory.
8386 * options.cc (get_relative_sysroot): Make static.
8387 (get_default_sysroot): Make static.
8388 (General_optoins::is_in_system_directory): New function.
8389 * fileread.cc (Input_file::is_in_system_directory): New function.
8390 * fileread.h (class Input_file): Declare is_in_system_directory.
8391 * object.h (class Object): Add is_in_system_directory.
8392 (class Input_objects): Remove system_library_directory_ field.
8393 * object.cc (Input_objects::add_object): Don't set
8394 system_library_directory_.
8395 (input_objects::found_in_system_library_directory): Remove.
8396 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8397 parameter. Change all callers.
8398 (Symbol_table::sized_write_globals): Likewise.
8399 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8400 Call Object::is_in_system_directory.
8401 * symtab.h (class Symbol_table): Update declarations.
8402
61edd21f
ILT
8403 PR 5990
8404 * descriptors.h (Open_descriptor): Add is_on_stack field.
8405 * descriptors.cc (Descriptors::open): If the descriptor is on the
8406 top of the stack, remove it. Initialize is_on_stack field.
8407 (Descriptors::release): Only add pod to stack if it is not on the
8408 stack already.
8409 (Descriptors::close_some_descriptor): Clear stack_next and
8410 is_on_stack fields.
8411
e29e076a
ILT
8412 PR 7091
8413 * output.cc (Output_section::find_starting_output_address): Rename
8414 from starting_output_address; add PADDR parameter; change return
8415 type.
8416 * output.h (class Output_section): Declare
8417 find_starting_output_address instead of starting_output_address.
8418 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8419 section symbol for which we can't find a merge section.
8420
0602e05a
ILT
8421 PR 9836
8422 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8423 hidden or internal, force the symbol to be local.
8424 * resolve.cc (Symbol::override_visibility): Define.
8425 (Symbol::override_base): Use override_visibility.
8426 (Symbol_table::resolve): Likewise.
8427 (Symbol::override_base_with_special): Likewise.
8428 (Symbol_table::override_with_special): If the visibility is hidden
8429 or internal, force the symbol to be local.
8430 * symtab.h (class Symbol): Add set_visibility and
8431 override_visibility.
8432 * testsuite/ver_test_1.sh: New file.
8433 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8434 (check_DATA): Add ver_test_1.syms.
8435 (ver_test_1.syms): New target.
8436 * testsuite/Makefile.in: Rebuild.
8437
401a9a73
CC
84382009-02-25 Cary Coutant <ccoutant@google.com>
8439
8440 * layout.cc (Layout::choose_output_section): Don't rename sections
8441 when using a linker script that has a SECTIONS clause.
8442 * Makefile.in: Regenerate.
8443
8444 * testsuite/Makefile.am (script_test_5.sh): New test case.
8445 * testsuite/Makefile.in: Regenerate.
8446 * testsuite/script_test_5.cc: New file.
8447 * testsuite/script_test_5.sh: New file.
8448 * testsuite/script_test_5.t: New file.
8449
f488e4b0
CC
84502009-02-13 Rafael Avila de Espindola <espindola@google.com>
8451
8452 * archive.cc (Archive::include_member): Update calls to add_symbols.
8453 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8454 the Layout argument.
8455 * dynobj.h (do_add_symbols): Add the Layout argument.
8456 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8457 Layout argument.
8458 * object.h (Object::add_symbols): Add the Layout argument.
8459 (Object::do_add_symbols): Add the Layout argument.
8460 (Sized_relobj::do_add_symbols): Add the Layout argument.
8461 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8462 Unify the two versions.
8463 (Add_plugin_symbols): Remove.
8464 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8465 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8466 (Add_plugin_symbols): Remove.
8467 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8468 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8469 (Add_symbols::run): Make it work with Pulginobj.
8470
89dd1680
ILT
84712009-02-06 Ian Lance Taylor <iant@google.com>
8472
8473 * object.cc (Sized_relobj::do_layout): Make info message start
8474 with lower case letter.
8475
266d0a74
ILT
84762009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8477
602b464e
ILT
8478 * binary.cc: Fix file comment.
8479
266d0a74
ILT
8480 * options.h (enum Incremental_disposition): Define.
8481 (class General_options): Add new options: --incremental,
8482 --incremental_changed, --incremental_unchanged,
8483 --incremental_unknown. Add incremental_disposition_ and
8484 implicit_incremental_ fields.
8485 (General_options::incremental_disposition): New function.
8486 (class Position_dependent_options): Add incremental_disposition
8487 option.
8488 (Position_dependent_options::copy_from_options): Set incremental
8489 dispositions.
8490 * options.cc (General_options::parse_incremental_changed): New
8491 function.
8492 (General_options::parse_incremental_unchanged): New function.
8493 (General_options::parse_incremental_unknown): New function.
8494 (General_options::General_options): Initialize new fields
8495 incremental_disposition_ and implicit_incremental_.
8496 (General_options::finalize): Check for uasge of --incremental-*
8497 without --incremental.
8498
f073bbf7
CD
84992009-02-06 Chris Demetriou <cgd@google.com>
8500
8501 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8502 pointer and to report location as the file name associated with
8503 the symbol.
8504 (gold_undefined_symbol_at_location): New function to replace the
8505 old gold_undefined_symbol functionality.
8506 * target-reloc.h (relocate_section): Update to use
8507 gold_undefined_symbol_at_location.
8508 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8509 Call gold_undefined_symbol function rather than gold_error.
8510 * errors.h (Errors::undefined_symbol): Take location as a
8511 string, rather than calculating it from a relocation.
8512 * errors.cc (Errors::fatal): Print "fatal error:" before the
8513 formatted message.
8514 (Errors::error, Errors::error_at_location): Print "error: "
8515 before the formatted message.
8516 (Errors::undefined_symbol): Take location as a string, rather
8517 than calculating it from a relocation.
8518 (gold_undefined_symbol_at_location): New function akin to
8519 old gold_undefined_symbol, calculates location from relocation.
8520 (gold_undefined_symbol): Change to take only a Symbol pointer
8521 and to report location as the file name associated with the symbol.
8522 * testsuite/debug_msg.sh: Update for changed error messages.
8523 * testsuite/undef_symbol.sh: Likewise.
8524
8e94a90c
ILT
85252009-02-04 Duncan Sands <baldrick@free.fr>
8526
8527 PR 9812
8528 * reduced_debug_output.h
8529 (Output_reduced_debug_abbrev_section::failed): Use format for
8530 gold_warning.
8531 (Output_reduced_debug_info_section::faild): Likewise.
8532
88a0e15b
ILT
85332009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8534
8535 * script.cc (Lazy_demangler): New class.
8536 (Version_script_info::get_symbol_version_helper): Demangle a
8537 symbol only once.
8538
5efc7cd2
CC
85392009-01-29 Cary Coutant <ccoutant@google.com>
8540
8541 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8542 to __tls_get_addr.
8543 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8544
e0ebcf42
ILT
85452009-01-28 Ian Lance Taylor <iant@google.com>
8546
5efc7cd2 8547 * version.cc (version_string): Bump to 1.9.
75fe7426 8548
e0ebcf42
ILT
8549 * gold.h: Include <cstring> and <stdint.h>.
8550 * version.cc: Include <cstdio>.
8551 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8552 warning.
8553 * reduced_debug_output.cc (insert_into_vector): Rename from
8554 Insert_into_vector; change all callers. Use Swap_unaligned to
8555 avoid aliasing issue; remove union since it is unnecessary.
8556
8e2813be 85572009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
8558
8559 * Makefile.am (CCFILES): Add gc.cc.
8560 (HFILES): Add gc.h.
8561 * Makefile.in: Regenerate.
8562 * gold.cc (Gc_runner): New class.
8563 (queue_initial_tasks): Call garbage collection related tasks
8564 when corresponding options are invoked.
8565 (queue_middle_gc_tasks): New function.
8566 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8567 processed early before laying out sections during garbage collection.
8568 * gold.h (queue_middle_gc_tasks): New function.
8569 (is_prefix_of): Move from "layout.cc".
8570 * i386.cc (Target_i386::gc_process_relocs): New function.
8571 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8572 * main.cc (main): Create object of class "Garbage_collection".
8573 * object.cc (Relobj::copy_symbols_data): New function.
8574 (Relobj::is_section_name_included): New function.
e1df38aa
NC
8575 (Sized_relobj::do_layout): Allow this function to be called twice
8576 during garbage collection and defer layout of section during the
6d03d481
ST
8577 first call.
8578 * object.h (Relobj::get_symbols_data): New function.
8579 (Relobj::is_section_name_included): New function.
8580 (Relobj::copy_symbols_data): New function.
8581 (Relobj::set_symbols_data): New function.
8582 (Relobj::get_relocs_data): New function.
8583 (Relobj::set_relocs_data): New function.
8584 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8585 (Relobj::gc_process_relocs): New function.
8586 (Relobj::do_gc_process_relocs): New pure virtual function.
8587 (Relobj::sd_): New data member.
8588 (Sized_relobj::is_output_section_offset_invalid): New function.
8589 (Sized_relobj::do_gc_process_relocs): New function.
8590 * options.h (General_options::gc_sections): Modify to not be a no-op.
8591 (General_options::print_gc_sections): New option.
8592 * plugin.cc (Plugin_finish::run): Remove function call to
8593 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8594 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8595 * reloc.cc (Read_relocs::run): Add task to process relocs and
8596 determine unreferenced sections when doing garbage collection.
8597 (Gc_process_relocs): New class.
8598 (Sized_relobj::do_gc_process_relocs): New function.
8599 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8600 sections that are garbage collected.
8601 * reloc.h (Gc_process_relocs): New class.
8602 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8603 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8604 symbols whose corresponding sections are garbage collected.
8605 (Symbol_table::Symbol_table): Add new parameter for the garbage
8606 collection object.
8607 (Symbol_table::gc_mark_undef_symbols): New function.
8608 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8609 (Symbol_table::gc_mark_dyn_syms): New function.
8610 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8611 as garbage.
8612 (Symbol_table::add_from_object): Likewise.
8613 (Symbol_table::add_from_relobj): When building shared objects, do not
8614 treat externally visible symbols as garbage.
8615 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8616 table information for static and relocatable links.
8617 * symtab.h (Symbol_table::set_gc): New function.
8618 (Symbol_table::gc): New function.
8619 (Symbol_table::gc_mark_undef_symbols): New function.
8620 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8621 (Symbol_table::gc_mark_dyn_syms): New function.
8622 (Symbol_table::gc_): New data member.
e1df38aa 8623 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
8624 function.
8625 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8626 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8627
3b293544
CF
86282009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8629
8630 * options.h (General_options::gc_sections): Define as a no-op for now.
8631 (General_options::no_keep_memory): Ditto.
8632 (General_options::Bshareable): Define.
8633 * options.cc (General_options::finalize): Honor -Bshareable.
8634
83d22aa8
AS
86352009-01-20 Andreas Schwab <schwab@suse.de>
8636
8637 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8638 read the value in the contents, since we don't use it. Use the
8639 template endianness when writing.
8640 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8641
cd536b21
AS
86422009-01-19 Andreas Schwab <schwab@suse.de>
8643
8644 * configure.tgt (powerpc64-*): Fix targ_obj.
8645
99e9a495
ILT
86462009-01-15 Ian Lance Taylor <iant@google.com>
8647
8648 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8649 local symbols when stripping all symbols.
8650
bbbfea06
CC
86512009-01-14 Cary Coutant <ccoutant@google.com>
8652
99e9a495 8653 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 8654
0f7c0701
CC
86552009-01-14 Cary Coutant <ccoutant@google.com>
8656
8657 * archive.cc (Archive::get_elf_object_for_member): Remove call
8658 to File_read::claim_for_plugin.
8659 * descriptors.cc (Descriptors::open): Remove reference to
8660 is_claimed.
8661 (Descriptors::claim_for_plugin): Remove.
8662 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8663 (Descriptors::is_claimed): Remove.
8664 (claim_descriptor_for_plugin): Remove.
8665 * fileread.cc (File_read::claim_for_plugin): Remove.
8666 * fileread.h (File_read::claim_for_plugin): Remove.
8667 (File_read::descriptor): Reopen descriptor if necessary.
8668 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8669 (Plugin_manager::all_symbols_read): Add task parameter. Change
8670 all callers.
8671 (Plugin_manager::get_input_file): New function.
8672 (Plugin_manager::release_input_file): New function.
8673 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8674 corresponding data member.
8675 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8676 and pass to base constructor. Change all callers.
8677 (get_input_file, release_input_file): New functions.
8678 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8679 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8680 (Plugin_manager::all_symbols_read): Add task parameter.
8681 (Plugin_manager::get_input_file): New function.
8682 (Plugin_manager::release_input_file): New function.
8683 (Plugin_manager::task_): New data member.
8684 (Pluginobj::Pluginobj): Add filesize parameter.
8685 (Pluginobj::filename): New function.
8686 (Pluginobj::descriptor): New function.
8687 (Pluginobj::filesize): New function.
8688 (Pluginobj::filesize_): New data member.
8689 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8690 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8691 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8692
8693 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8694 with archive libraries.
8695 * testsuite/Makefile.in: Regenerate.
8696 * testsuite/plugin_test.c (struct sym_info): New type.
8697 (get_input_file, release_input_file): New static variables.
8698 (onload): Capture new transfer vector entries.
8699 (claim_file_hook): Stop reading at end of file according to filesize.
8700 Factor out parsing of readelf output into separate function.
8701 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8702 APIs and get the source file name from the symbol table. Convert
8703 source file name to corresponding object file name. Print info
8704 message when adding new input files.
8705 (parse_readelf_line): New function.
8706 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8707 * testsuite/plugin_test_2.sh: Likewise.
8708 * testsuite/plugin_test_3.sh: Likewise.
8709 * testsuite/plugin_test_4.sh: New test case.
8710
62a6d109
ILT
87112009-01-07 Ian Lance Taylor <iant@google.com>
8712
8713 * version.cc (version_string): Bump to 1.8.
8714
483620e8
CC
87152008-12-23 Cary Coutant <ccoutant@google.com>
8716
8717 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8718 * plugin.cc (Plugin_manager::finish): Rename as
8719 layout_deferred_objects. Move cleanup to separate function.
8720 (Plugin_manager::cleanup): New function.
8721 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8722 separately.
8723 * plugin.h (Plugin_manager::finish): Rename as
8724 layout_deferred_objects.
8725 (Plugin_manager::cleanup): New function.
8726 (Plugin_manager::cleanup_done): New field.
8727
d66a9eb3
CC
87282008-12-23 Cary Coutant <ccoutant@google.com>
8729
8730 * plugin.cc (is_visible_from_outside): New function.
8731 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8732 so we don't return "IR only" status for exported symbols or -r links.
8733
8734 * testsuite/Makefile.am (plugin_test_3): New test case.
8735 * testsuite/Makefile.in: Regenerate.
8736 * testsuite/plugin_test_3.sh: New file.
8737
5995b570
CC
87382008-12-22 Cary Coutant <ccoutant@google.com>
8739
8740 * object.cc (Sized_relobj::layout_section): New function.
8741 (Sized_relobj::do_layout): Defer layout of input sections until after
8742 plugin has provided replacement files.
8743 (Sized_relobj::do_layout_deferred_sections): New function.
8744 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8745 (Relobj::layout_deferred_sections): New function.
8746 (Relobj::do_layout_deferred_sections): New function.
8747 (Sized_relobj::do_layout_deferred_sections): New function.
8748 (Sized_relobj::layout_section): New function.
8749 (Sized_relobj::Deferred_layout): New structure.
8750 (Sized_relobj::deferred_layout_): New field.
8751 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8752 Change all callers. Layout deferred sections.
8753 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8754 references.
8755 (Plugin_hook::run): Move code from do_plugin_hook inline.
8756 (Plugin_hook::do_plugin_hook): Remove.
8757 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8758 (Plugin_manager::finish): Renamed, was cleanup.
8759 (Plugin_manager::should_defer_layout): New function.
8760 (Plugin_manager::add_deferred_layout_object): New function.
8761 (Plugin_manager::Deferred_layout_list): New type.
8762 (Plugin_manager::deferred_layout_objects_): New field.
8763 (Plugin_hook::do_plugin_hook): Remove.
8764
ee769c88
ILT
87652008-12-17 Ian Lance Taylor <iant@google.com>
8766
8767 * options.h (class General_options): Add --no case for
8768 --export-dynamic.
8769
abc8dcba
CC
87702008-12-16 Cary Coutant <ccoutant@google.com>
8771
8772 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8773 vector.
8774 (Plugin_manager::claim_file): Create plugin object even if
8775 plugin did not call the add_symbols callback.
8776 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8777 asking for more symbols than were added.
8778 * testsuite/Makefile.am (plugin_test_1): Add test case with
8779 no global symbols.
8780 (empty.syms): New target.
8781 * testsuite/Makefile.in: Regenerate.
8782 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8783 message. Don't call add_symbols if no globals.
8784 (all_symbols_read_hook): Don't provide replacement for empty
8785 claimed file.
8786
b0074644
ILT
87872008-12-12 Ian Lance Taylor <iant@google.com>
8788
68943102
ILT
8789 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8790 r_type == 0 for a local symbol with r_sym == 0.
8791 (scan_relocatable_relocs): Pass r_sym to
8792 local_non_section_strategy.
8793 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8794 r_sym parameter.
8795
b0074644
ILT
8796 * configure.ac: Update test for TLS descriptors: they are
8797 supported as of glibc 2.9.
8798 * configure: Rebuild.
8799
c2508178
ILT
88002008-12-11 Ian Lance Taylor <iant@google.com>
8801
8802 PR 7091
8803 * target-reloc.h (Default_scan_relocatable_relocs): For each
8804 function, map r_type == 0 to RELOC_DISCARD.
8805
2756a258
CC
88062008-12-10 Cary Coutant <ccoutant@google.com>
8807
8808 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8809 object to override a kept COMDAT group from a plugin object.
8810
bb6f53d3
ILT
88112008-12-09 Ian Lance Taylor <iant@google.com>
8812
fbc558e1
ILT
8813 PR 7088
8814 * yyscript.y (file_cmd): Handle INPUT.
8815
bb6f53d3
ILT
8816 * testsuite/initpri1.c: Change all declarations to be full
8817 prototypes by adding void, to avoid compiler warnings.
8818
4674ecfc
CC
88192008-12-05 Rafael Avila de Espindola <espindola@google.com>
8820
8821 * options.cc (General_options::parse_plugin_opt): New.
8822 (General_options::add_plugin): The argument now is just the filename.
8823 (General_options::add_plugin_option): New.
8824 * options.h (plugin_opt): New.
8825 (add_plugin): Change argument name.
8826 (add_plugin_option): New.
8827 * plugin.cc (Plugin::load): Don't parse the plugin option.
8828 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8829 (Plugin::add_option): New.
8830 (Plugin::args_): Change type.
8831 (Plugin::filename_): New.
8832 (Plugin_manager::add_plugin_option): New.
8833 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8834 * testsuite/Makefile.in: Regenerate.
8835
fd06b4aa
CC
88362008-12-05 Cary Coutant <ccoutant@google.com>
8837
8838 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8839 Handle --strip-lto-sections option.
8840 * options.h (strip_lto_sections): New option.
8841
6c52134c
CC
88422008-12-01 Cary Coutant <ccoutant@google.com>
8843
8844 * plugin.cc (ld_plugin_message): Change format parameter to const.
8845 Fix mismatch between new[] and delete.
8846
a45248e0
CC
88472008-11-14 Cary Coutant <ccoutant@google.com>
8848
8849 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8850 instead of -1U.
8851
c82fbeee
CS
88522008-11-05 Craig Silverstein <csilvers@google.com>
8853
8854 * options.cc (General_options::parse_dynamic_list): New function.
8855 * options.h (General_options): New flags dynamic_list,
8856 dynamic_list_data, dynamic_list_cpp_new, and
8857 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8858 (General_options::in_dynamic_list): New function.
8859 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8860 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8861 (Lex::can_continue_name): Likewise.
8862 (yylex): Likewise.
8863 (read_script_file): New parameter script_options.
8864 (read_dynamic_list): New function.
8865 (Script_options::define_dynamic_list): New function.
8866 (dynamic_list_keyword_parsecodes): New variable.
8867 (dynamic_list_keywords): New variable.
8868 * script.h (Script_options::define_dynamic_list): New function
8869 prototype.
8870 (read_dynamic_list): New function prototype.
8871 * symtab.cc (strprefix): New macro.
8872 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8873 dynamic_list_data, dynamic_list_cpp_new, and
8874 dynamic_list_cpp_typeinfo.
8875 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8876 (dynamic_list_expr): New rule.
8877 (dynamic_list_nodes): Likewise.
8878 (dynamic_list_node): Likewise.
8879 * testsuite/Makefile.am (dynamic_list): New test.
8880 * testsuite/Makefile.in: Regenerated.
8881 * testsuite/dynamic_list.t: New file.
8882 * testsuite/dynamic_list.sh: New file.
8883
e0bb29a5
CS
88842008-11-05 Craig Silverstein <csilvers@google.com>
8885
8886 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8887 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8888 (t11_last): Likewise.
8889 * testsuite/ver_test_6.c (main): Likewise.
8890
4e1e25e0
CC
88912008-10-07 Cary Coutant <ccoutant@google.com>
8892
8893 * options.c (General_options::finalize): Add check for -static and
8894 -shared.
8895 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8896 is not empty.
8897
92f03fcb
CC
88982008-10-02 Cary Coutant <ccoutant@google.com>
8899
8900 * plugin.cc (make_sized_plugin_object): Fix conditional
8901 compilation to work when not all targets are enabled.
8902
fbd8a257
CC
89032008-09-29 Cary Coutant <ccoutant@google.com>
8904
8905 * archive.cc (Archive::get_file_and_offset): Use filename instead
8906 of name to get library path.
8907 (Archive::include_member): Unlock external member of a thin archive.
8908
8909 * testsuite/Makefile.am (TEST_AR): New variable.
8910 (thin_archive_test_1): New test.
8911 (thin_archive_test_2): New test.
81636b3f
CC
8912 * testsuite/Makefile.in: Regenerate.
8913 * testsuite/thin_archive_main.cc: New file.
8914 * testsuite/thin_archive_test_1.cc: New file.
8915 * testsuite/thin_archive_test_2.cc: New file.
8916 * testsuite/thin_archive_test_3.cc: New file.
8917 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 8918
eff45813
CC
89192008-09-29 Cary Coutant <ccoutant@google.com>
8920
8921 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8922 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8923 instead of -1U.
8924 (Sized_relobj::do_finalize_local_symbols): Likewise.
8925 (Sized_relobj::map_to_kept_section): Likewise.
8926 * object.h (Sized_relobj::invalid_address): New constant.
8927 (Sized_relobj::do_output_section_offset): Check for invalid_address
8928 and return -1ULL.
8929 * output.cc (Output_reloc::local_section_offset): Use constant
8930 invalid_address instead of -1U.
8931 (Output_reloc::get_address): Likewise.
8932 (Output_section::output_address): Change -1U to -1ULL.
8933 * output.h (Output_reloc::invalid_address): New constant.
8934 * reloc.cc (Sized_relobj::write_sections): Use constant
8935 invalid_address instead of -1U.
8936 (Sized_relobj::relocate_sections): Likewise.
8937 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8938 values for merge sections.
8939 * target-reloc.h (relocate_for_relocatable): Use constant
8940 invalid_address instead of -1U.
8941
89fc3421
CC
89422008-09-19 Cary Coutant <ccoutant@google.com>
8943
8944 Add plugin functionality for link-time optimization (LTO).
8945 * configure.ac (plugins): Add --enable-plugins option.
8946 * configure: Regenerate.
8947 * config.in: Regenerate.
8948 * Makefile.am (LIBDL): New variable.
8949 (CCFILES): Add plugin.cc.
8950 (HFILES): Add plugin.h.
8951 (ldadd_var): Add LIBDL.
8952 * Makefile.in: Regenerate.
8953
8954 * archive.cc: Include "plugin.h".
8955 (Archive::setup): Don't preread archive symbols when using a plugin.
8956 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8957 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8958 files.
8959 (Archive::include_member): Add symbols from plugin objects.
8960 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8961 * descriptors.cc (Descriptors::open): Check for file descriptors
8962 abandoned by plugins.
8963 (Descriptors::claim_for_plugin): New function.
8964 * descriptors.h (Descriptors::claim_for_plugin): New function.
8965 (Open_descriptor::is_claimed): New field.
8966 (claim_descriptor_for_plugin): New function.
8967 * fileread.cc (File_read::claim_for_plugin): New function.
8968 * fileread.h (File_read::claim_for_plugin): New function.
8969 (File_read::descriptor): New function.
8970 * gold.cc: Include "plugin.h".
8971 (queue_initial_tasks): Add task to call plugin hooks for generating
8972 new object files.
8973 * main.cc: Include "plugin.h".
8974 (main): Load plugin libraries.
8975 * object.h (Pluginobj): Declare.
8976 (Object::pluginobj): New function.
8977 (Object::do_pluginobj): New function.
8978 (Object::set_target): New function.
8979 * options.cc: Include "plugin.h".
8980 (General_options::parse_plugin): New function.
8981 (General_options::General_options): Initialize plugins_ field.
8982 (General_options::add_plugin): New function.
8983 * options.h (Plugin_manager): Declare.
8984 (General_options): Add --plugin option.
8985 (General_options::has_plugins): New function.
8986 (General_options::plugins): New function.
8987 (General_options::add_plugin): New function.
8988 (General_options::plugins_): New field.
8989 * plugin.cc: New file.
8990 * plugin.h: New file.
8991 * readsyms.cc: Include "plugin.h".
8992 (Read_symbols::do_read_symbols): Check for archive before checking
8993 for ELF file. Call plugin hooks to claim files.
8994 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8995 from a real object file; force override when processing replacement
8996 files.
8997 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8998 (Symbol::init_base_object): Likewise.
8999 (Symbol::init_base_output_data): Likewise.
9000 (Symbol::init_base_output_segment): Likewise.
9001 (Symbol::init_base_constant): Likewise.
9002 (Symbol::init_base_undefined): Likewise.
9003 (Symbol::output_section): Assert that object is not a plugin.
9004 (Symbol_table::add_from_pluginobj): New function.
9005 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9006 undefined.
9007 (Symbol_table::sized_write_globals): Likewise.
9008 (Symbol_table::add_from_pluginobj): Instantiate template.
9009 * symtab.h (Sized_pluginobj): Declare.
9010 (Symbol::in_real_elf): New function.
9011 (Symbol::set_in_real_elf): New function.
9012 (Symbol::in_real_elf_): New field.
9013 (Symbol_table::add_from_pluginobj): New function.
9014
9015 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9016 (LIBDL): New variable.
9017 (LDADD): Add LIBDL.
9018 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9019 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9020 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9021 (MOSTLYCLEANFILES): Likewise.
9022 * testsuite/Makefile.in: Regenerate.
9023 * testsuite/plugin_test.c: New file.
9024 * testsuite/plugin_test_1.sh: New file.
9025 * testsuite/plugin_test_2.sh: New file.
9026
de31bda5
ILT
90272008-09-16 Ian Lance Taylor <iant@google.com>
9028
9c2d0ef9
ILT
9029 * target-reloc.h (relocate_section): Check whether a symbol is
9030 defined by the ABI before reporting an undefined symbol error.
9031 * target.h (Target::is_defined_by_abi): Make parameter const.
9032 (Target::do_is_defined_by_abi): Likewise.
9033 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9034 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9035 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9036 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9037 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9038 * testsuite/Makefile.in: Rebuild.
9039
de31bda5
ILT
9040 * fileread.cc (make_view): Add casts to avoid warning.
9041
9fa33bee
AO
90422008-09-16 Alexandre Oliva <aoliva@redhat.com>
9043
9044 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9045 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9046
183fd0e3
AO
90472008-09-16 Alexandre Oliva <aoliva@redhat.com>
9048
9049 * options.h (General_options::output_is_executable): New.
9050 (General_options::output_is_pie): New.
9051 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9052 for shared libraries.
9053 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9054
7be8330a
CD
90552008-09-11 Chris Demetriou <cgd@google.com>
9056
9057 * options.h (origin): New -z option.
9058 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9059 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9060 in DT_FLAGS_1.
9061
a9caad02
CC
90622008-09-05 Cary Coutant <ccoutant@google.com>
9063
9064 * fileread.cc (File_read::make_view): Add check for attempt to map
9065 beyond end of file.
9066
ae6dce4d
CC
90672008-09-05 Cary Coutant <ccoutant@google.com>
9068
9069 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9070 explicit instantiations.
9071
d7ab2a47
KVH
90722008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9073
9074 PR gold/6858
9075 * options.cc (General_options::finalize): Allow undefined symbols
9076 in shlibs if linking -shared.
9077
9078 PR gold/6859
9079 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9080 symbols as not needing a dynsym entry.
9081
1e52a9c1
CS
90822008-08-20 Craig Silverstein <csilvers@google.com>
9083
9084 * fileread.cc (File_read::open): Do not lock the file unless it
9085 was successfully opened.
9086
d85c80a3
CC
90872008-08-14 Cary Coutant <ccoutant@google.com>
9088
9089 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9090 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9091 * testsuite/tls_test.cc (struct int128): 128-bit struct
9092 for testing TLS relocs with non-zero addend.
9093 (v12): New TLS variable.
9094 (t12): New test.
9095 (t_last): Add check for v12.
9096 * testsuite/tls_test.h (t12): New function.
9097 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9098
2d924fd9
ILT
90992008-08-13 Ian Lance Taylor <iant@google.com>
9100
9101 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9102 set tls_segment_ or relro_segment_.
9103 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9104 when appropriate.
9105 * output.h (Output_section::clear_is_relro): New function.
9106 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9107 sections specially even when output_data_ is empty.
9108 (Output_segment::maximum_alignment): When first section is relro,
9109 only force alignment for PT_LOAD segments.
9110 * script.cc (script_data_segment_align): New function.
9111 (script_data_segment_relro_end): New function.
9112 * script-c.h (script_data_segment_align): Declare.
9113 (script_data_segment_relro_end): Declare.
9114 * script-sections.h (class Script_sections): Declare
9115 data_segment_align and data_segment_relro_end. Add fields
9116 segment_align_index_ and saw_relro_end_.
9117 * script-sections.cc (class Sections_element): Add set_is_relro
9118 virtual function. Add new bool* parameter to place_orphan_here.
9119 Add get_output_section virtual function.
9120 (class Output_section_definition): Add set_is_relro. Add new
9121 bool* parameter to place_orphan_here. Add get_output_section.
9122 Add is_relro_ field.
9123 (Output_section_definition::Output_section_definition): Initialize
9124 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9125 and is_relro_ fields.
9126 (Output_section_definition::place_orphan_here): Add is_relro
9127 parameter.
9128 (Output_section_definition::set_section_addresses): Set relro for
9129 output section.
9130 (Output_section_definition::alternate_constraint): Likewise.
9131 (class Orphan_output_section): Add new bool* parameter to
9132 place_orphan_here. Add get_output_section.
9133 (Orphan_output_section::place_orphan_here): Add is_relro
9134 parameter.
9135 (Script_sections::Script_sections): Initialize
9136 data_segment_align_index_ and saw_relro_end_.
9137 (Script_sections::data_segment_align): New function.
9138 (Script_sections::data_segment_relro_end): New function.
9139 (Script_sections::place_orphan): Set or clear is_relro.
9140 (Script_sections::set_section_addresses): Force alignment of first
9141 TLS section.
9142 * yyscript.y (exp): Call script_data_segment_align and
9143 script_data_segment_relro_end.
9144 * testsuite/relro_script_test.t: New file.
9145 * testsuite/relro_test.cc (using_script): Declare.
9146 (t1, t2): Test using_script.
9147 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9148 (relro_script_test_SOURCES): Define.
9149 (relro_script_test_DEPENDENCIES): Define.
9150 (relro_script_test_LDFLAGS): Define.
9151 (relro_script_test_LDADD): Define.
9152 (relro_script_test.so): New target.
9153 * testsuite/Makefile.in: Rebuild.
9154
f827c9a9
CC
91552008-08-06 Cary Coutant <ccoutant@google.com>
9156
9157 * archive.cc (Archive::total_archives, Archive::total_members)
9158 (Archive::total_members_loaded): New variables.
9159 (Archive::setup): Add parameter. Add option to preread
9160 archive symbols.
9161 (Archive::read_armap): Add counter.
9162 (Archive::get_file_and_offset): New function.
9163 (Archive::get_elf_object_for_member): New function.
9164 (Archive::read_all_symbols): New function.
9165 (Archive::read_symbols): New function.
9166 (Archive::add_symbols): Add counters.
9167 (Archive::include_all_members): Use armap to find members if it's
9168 already built.
9169 (Archive::include_member): Skip reading symbols if already read.
9170 Factored code into Archive::get_file_and_offset and
9171 Archive::get_elf_object_for_member. Changed call to
9172 Mapfile::report_include_archive_member.
9173 (Archive::print_stats): New function.
9174 * archive.h: Declare Object and Read_symbols_data classes.
9175 (Archive::Archive): Add initializers for new members.
9176 (Archive::setup): Add parameter.
9177 (Archive::print_stats): New function.
9178 (Archive::total_archives, Archive::total_members)
9179 (Archive::total_members_loaded): New variables.
9180 (Archive::get_file_and_offset): New function.
9181 (Archive::get_elf_object_for_member): New function.
9182 (Archive::read_all_symbols): New function.
9183 (Archive::read_symbols): New function.
9184 (Archive::Archive_member): New class.
9185 (Archive::members_): New member.
9186 (Archive::num_members_): New member.
9187 * main.cc: Include archive.h.
9188 (main): Call Archive::print_stats.
9189 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9190 archive parameter; member_name is now the fully-decorated name.
9191 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9192 * options.h: (General_options): Add --preread-archive-symbols option.
9193 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9194 Archive::setup.
9195
de4c45bd
ILT
91962008-08-04 Ian Lance Taylor <iant@google.com>
9197
9198 * symtab.h (Symbol::use_plt_offset): New function.
9199 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9200 * powerpc.cc (Relocate::relocate): Likewise.
9201 * sparc.cc (Relocate::relocate): Likewise.
9202 * x86_64.cc (Relocate::relocate): Likewise.
9203 * testsuite/weak_plt.sh: New test.
9204 * testsuite/weak_plt_main.cc: New test.
9205 * testsuite/weak_plt_shared.cc: New test.
9206 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9207 (check_PROGRAMS): Add weak_plt.
9208 (check_DATA): Add weak_plt_shared.so.
9209 (weak_plt_main_pic.o, weak_plt): New targets.
9210 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9211 * testsuite/Makefile.in: Rebuild.
9212
9213 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9214 gcctestdir/ld.
9215 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9216 * testsuite/Makefile.in: Rebuild.
9217
323ee3f4
AM
92182008-08-04 Alan Modra <amodra@bigpond.net.au>
9219
9220 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9221 * Makefile.in: Regenerate.
9222 * po/POTFILES.in: Regenerate.
9223
7c07ecec
ILT
92242008-07-29 Ian Lance Taylor <iant@google.com>
9225
9226 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9227 symbols before other symbols.
9228 * testsuite/script_test_2.cc (test_addr): Declare.
9229 (test_addr_alias): Declare.
9230 (main): Check that test_addr and test_addr_alias have the right
cd536b21 9231 values.
7c07ecec
ILT
9232 * testsuite/script_test_2.t: Define test_addr_alias and
9233 test_addr.
9234
5778530e
ILT
92352008-07-24 Ian Lance Taylor <iant@google.com>
9236
2a00e4fb
ILT
9237 PR 5990
9238 * descriptors.cc: New file.
9239 * descriptors.h: New file.
9240 * gold-threads.h (class Hold_optional_lock): New class.
9241 * fileread.cc: Include "descriptors.h".
9242 (File_read::~File_read): Release descriptor rather than closing
9243 it.
9244 (File_read::open) [file]: Call open_descriptor rather than open.
9245 Set is_descriptor_opened_.
9246 (File_read::open) [memory]: Assert that descriptor is not open.
9247 (File_read::reopen_descriptor): New function.
9248 (File_read::release): Release descriptor.
9249 (File_read::do_read): Make non-const. Reopen descriptor.
9250 (File_read::read): Make non-const.
9251 (File_read::make_view): Reopen descriptor.
9252 (File_read::do_readv): Likewise.
9253 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9254 Update declarations.
9255 * layout.cc: Include "descriptors.h".
9256 (Layout::create_build_id): Use open_descriptor rather than open.
9257 * output.cc: Include "descriptors.h".
9258 (Output_file::open): Use open_descriptor rather than open.
9259 * archive.cc (Archive::const_iterator): Change Archive to be
9260 non-const.
9261 (Archive::begin, Archive::end): Make non-const.
9262 (Archive::count_members): Likewise.
9263 * archive.h (class Archive): Update declarations.
9264 * object.h (Object::read): Make non-const.
9265 * Makefile.am (CCFILES): Add descriptors.cc.
9266 (HFILES): Add descriptors.h.
9267 * Makefile.in: Rebuild.
9268
801647d1
ILT
9269 PR 6716
9270 * gold.h: Always include <clocale>. Add Solaris workarounds
9271 following code in binutils/sysdep.h.
9272
5edd166e
ILT
9273 PR 6048
9274 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9275 this->eh_frame_hdr_ is NULL before using it.
9276
c89ad728
ILT
9277 * dynobj.cc (Versions::Versions): Update comment.
9278
aa86f06b
ILT
9279 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9280 the base version name.
9281
5778530e
ILT
9282 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9283 array size plus one.
9284 (Stringpool_template::set_string_offsets): Subtract one from key
9285 before using it as an array index.
9286 (Stringpool_template::get_offset_with_length): Likewise.
9287 (Stringpool_template::write_to_buffer): Likewise.
9288 * stringpool.h (Stringpool_template::get_offset_from_key):
9289 Likewise.
9290
057ead22
ILT
92912008-07-23 Ian Lance Taylor <iant@google.com>
9292
7f649c59
ILT
9293 PR 6658
9294 * object.h (Merged_symbol_value::value): Do our best to handle a
9295 negative addend.
9296
057ead22
ILT
9297 PR 6647
9298 * script.cc (Version_script_info::get_versions): Don't add empty
9299 version tag to return value.
9300 (Version_script_info::get_symbol_version_helper): Change return
9301 type to bool. Add pversion parameter. Change all callers.
9302 (script_register_vers_node): Don't require a non-NULL tag.
9303 * script.h (class Version_script_info): Update declarations.
9304 (Version_script_info::get_symbol_version): Change return type to
9305 bool. Add version parameter. Change all callers.
9306 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9307 handling. Handle an empty version from a version script.
9308 (Symbol_table::define_special_symbol): Likewise.
9309 * testsuite/ver_test_10.script: New file.
9310 * testsuite/ver_test_10.sh: New file.
9311 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9312 (check_DATA): Add ver_test_10.syms.
9313 (ver_test_10.syms, ver_test_10.so): New target.
9314 * testsuite/Makefile.in: Rebuild.
9315
58e54ac2
CD
93162008-07-23 Simon Baldwin <simonb@google.com>
9317
9318 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9319 to zero for undefined symbols from dynamic libraries.
9320
95d14cd3
ILT
93212008-07-23 Ian Lance Taylor <iant@google.com>
9322
9323 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9324 Change all callers.
9325 * symtab.h (class Symbol_table): Update declaration.
9326 * testsuite/ver_test_9.cc: New file.
9327 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9328 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9329 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9330 (ver_test_9.so, ver_test_9.o): New targets.
9331 * testsuite/Makefile.in: Rebuild.
9332
92de84a6
ILT
93332008-07-22 Ian Lance Taylor <iant@google.com>
9334
34810851
ILT
9335 * options.h (class General_options): Define --check-sections.
9336 * layout.cc (Layout::set_segment_offsets): Handle
9337 --check-sections.
9338
af6156ef
ILT
9339 * options.h (class General_options): Define -n/--nmagic and
9340 -N/--omagic.
9341 * options.cc (General_options::finalize): For -n/--nmagic or
9342 -N/--omagic, set -static.
9343 * layout.cc (Layout::attach_allocated_section_to_segment): If
9344 -N/--omagic, don't put read-only and read-write sections in
9345 different segments.
9346 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9347 finding a read-only segment.
9348 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9349 don't set the minimum segment alignment to the common page size,
9350 and don't set the file offset to the address modulo the page size.
9351 * script-sections.cc (Script_sections::create_segments): If
9352 -n/--omagic, don't put read-only and read-write sections in
9353 different segments.
9354
92de84a6
ILT
9355 * cref.cc: New file.
9356 * cref.h: New file.
9357 * options.h (class General_options): Add --print-symbol-counts.
9358 * main.cc (main): Issue defined symbol report if requested.
9359 * archive.cc (Archive::interpret_header): Make into a const member
9360 function.
9361 (Archive::add_symbols): Call Input_objects::archive_start and
9362 archive_stop.
9363 (Archive::const_iterator): Define new class.
9364 (Archive::begin, Archive::end): New functions.
9365 (Archive::include_all_members): Rewrite to use iterator.
9366 (Archive::count_members): New function.
9367 * archive.h (class Archive): Update declarations.
9368 (Archive::filename): New function.
9369 * object.cc: Include "cref.h".
9370 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9371 (Sized_relobj::do_get_global_symbol_counts): New function.
9372 (Input_objects::add_object): Add object to cross-referencer.
9373 (Input_objects::archive_start): New function.
9374 (Input_objects::archive_stop): New function.
9375 (Input_objects::print_symbol_counts): New function.
9376 * object.h: Declare Cref and Archive.
9377 (Object::get_global_symbol_counts): New function.
9378 (Object::do_get_global_symbol_counts): New pure virtual function.
9379 (class Sized_relobj): Add defined_count_ field. Update
9380 declarations.
9381 (class Input_objects): Add cref_ field. Update constructor.
9382 Update declarations.
9383 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9384 defined_count_.
9385 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9386 symbol counts.
9387 (Sized_dynobj::do_get_global_symbol_counts): New function.
9388 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9389 defined_count_. Update declarations. Define Symbols typedef.
9390 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9391 parameter. Change all callers.
9392 (Symbol_table::add_from_dynobj): Add sympointers and defined
9393 parameters. Change all callers.
9394 * symtab.h (class Symbol_table): Update declarations.
9395 * Makefile.am (CCFILES): Add cref.cc.
9396 (HFILES): Add cref.h.
9397 * Makefile.in: Rebuild.
9398
3f7c5e1d
CD
93992008-07-22 Simon Baldwin <simonb@google.com>
9400
9401 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9402 to zero when writing undefined symbols.
9403
e0b64032
ILT
94042008-07-22 Ian Lance Taylor <iant@google.com>
9405
9406 * output.cc (Output_section::add_input_section): Don't try to
9407 merge empty merge sections.
9408
096b02cf
CS
94092008-07-21 Craig Silverstein <csilvers@google.com>
9410
9411 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9412 Include symbol version in error message.
cd536b21 9413
1d1f116d
CD
94142008-07-20 Chris Demetriou <cgd@google.com>
9415
cd536b21 9416 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
9417 (RANDOM_SEED_CFLAGS): New substituted variable.
9418 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9419 * configure: Rebuild.
9420 * Makefile.in: Likewise.
9421 * testsuite/Makefile.in: Likewise.
9422
a18f591e
ILT
94232008-07-18 Ian Lance Taylor <iant@google.com>
9424
9425 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9426 where we see NAME/NULL and NAME/VERSION as separate symbols.
9427 * testsuite/ver_test_main.cc (main): Call t4.
9428 (t4, t4_2a): Define.
9429 * testsuite/ver_test_2.cc (t4_2): Define.
9430 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9431 * testsuite/ver_test_4.cc (t4_2a): Define.
9432 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9433 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9434
c6e3f6ed
ILT
94352008-07-17 Ian Lance Taylor <iant@google.com>
9436
9437 * dynobj.cc (Versions::add_def): If we give an error about a
9438 missing version, go ahead and create the version anyhow.
9439
ef9beddf
ILT
94402008-07-10 Ian Lance Taylor <iant@google.com>
9441
9442 Handle output sections with more than 0x7fffffff bytes.
9443 * object.h (class Relobj): Change map_to_output_ to
9444 output_sections_, and just keep a section pointer. Change all
9445 uses. Move comdat group support to Sized_relobj.
9446 (Relobj::is_section_specially_mapped): Remove.
9447 (Relobj::output_section): Remove poff parameter. Change all
9448 callers.
9449 (Relobj::output_section_offset): New function.
9450 (Relobj::set_section_offset): Rewrite.
9451 (Relobj::map_to_output): Remove.
9452 (Relobj::output_sections): New function.
9453 (Relobj::do_output_section_offset): New pure virtual function.
9454 (Relobj::do_set_section_offset): Likewise.
9455 (class Sized_relobj): Add section_offsets_ field. Add comdat
9456 group support from Relobj. Update declarations.
9457 (Sized_relobj::get_output_section_offset): New function.
9458 (Sized_relobj::do_output_section_offset): New function.
9459 (Sized_relobj::do_set_section_offset): New function.
9460 * object.cc (Relobj::output_section_address): Remove.
9461 (Sized_relobj::Sized_relobj): Initialize new fields.
9462 (Sized_relobj::include_section_group): Cast find_kept_object to
9463 Sized_relobj.
9464 (Sized_relobj::include_linkonce_section): Likewise.
9465 (Sized_relobj::do_layout): Use separate arrays for output section
9466 and output offset.
9467 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9468 output_sections.
9469 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9470 output_sections and section_offsets.
9471 (Sized_relobj::write_local_symbols): Likewise.
9472 (map_to_kept_section): Compute output address directly.
9473 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9474 output_sections and section_offsets.
9475 (Sized_relobj::write_sections): Likewise.
9476 (Sized_relobj::relocate_sections): Likewise.
9477 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9478 * output.h (class Output_reloc): Update declarations. Change
9479 u2_.relobj to Sized_relobj*.
9480 (class Output_data_reloc): Change add functions to use
9481 Sized_relobj*.
9482 * output.cc (Output_reloc::Output_reloc): Change relobj to
9483 Sized_relobj*.
9484 (Output_reloc::local_section_offset): Change return type to
9485 Elf_Addr. Use get_output_section_offset.
9486 (Output_reloc::get_address): Likewise.
9487 (Output_section::is_input_address_mapped): Don't call
9488 is_section_specially_mapped.
9489 (Output_section::output_offset): Likewise.
9490 (Output_section::output_address): Likewise.
9491 (Output_section::starting_output_address): Likewise.
9492 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9493 parameter to Sized_relobj*.
9494 (Copy_relocs::need_copy_reloc): Likewise.
9495 (Copy_relocs::save): Likewise.
9496 * copy-relocs.h (class Copy_relocs): Update declarations.
9497 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9498 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9499 * target-reloc.h (relocate_for_relocatable): Change
9500 offset_in_output_section type to Elf_Addr. Change code that uses
9501 it as well.
9502 * layout.cc (Layout::layout): Always set *off.
9503 * mapfile.cc (Mapfile::print_input_section): Use
9504 output_section_offset.
9505 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9506 Sized_relobj*.
9507 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9508 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9509 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9510
5cb66f97
ILT
95112008-07-03 Ian Lance Taylor <iant@google.com>
9512
9513 * layout.cc (Layout::include_section): Do not discard unrecognized
9514 SHT_STRTAB sections.
9515
afe47622
CS
95162008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9517
9518 * script.cc (Lex::can_continue_name): Make '?' allowable in
9519 version-script names.
9520 * testsuite/version_script.map: Change glob pattern to use '?'
9521
5adf9721
ILT
95222008-06-30 Manish Singh <yosh@gimp.org>
9523
9524 PR 6585
9525 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9526 Correct typo.
9527
e6fde208
ILT
95282008-06-30 Ian Lance Taylor <iant@google.com>
9529
9530 PR 6660
9531 PR 6682
9532 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9533 versions]: Don't try to read the value in the contents, since we
9534 don't use it. Use the template endianness when writing.
9535
3f2e6a2d
CC
95362008-06-25 Cary Coutant <ccoutant@google.com>
9537
9538 * fileread.cc (File_read::make_view): Assert on zero-length view.
9539 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9540 symbol table when there are no symbols to read.
9541
c43d3a48
CS
95422008-06-23 Craig Silverstein <csilvers@google.com>
9543
9544 * version.cc (version_string): Bump to 1.7
9545
5f494ea0
CS
95462008-06-18 Craig Silverstein <csilvers@google.com>
9547
9548 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9549 constant 0xFFFF to type Valtype.
9550 (Powerpc_relocate_functions::rel16_ha): Likewise.
9551
c42e122e
ILT
95522008-06-17 Ian Lance Taylor <iant@google.com>
9553
f34787f8
ILT
9554 * output.h (Output_section::Input_section): Initialize p2align_ to
9555 zero for Output_section_data constructors.
9556 (Output_section::Input_section::addralign): If not an input
9557 section, return the alignment of the Output_section_data.
9558 * testsuite/copy_test.cc: New file.
9559 * testsuite/copy_test_1.cc: New file.
9560 * testsuite/copy_test_2.cc: New file.
9561 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9562 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9563 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9564 (copy_test_1_pic.o, copy_test_1.so): New targets.
9565 (copy_test_2_pic.o, copy_test_2.so): New targets.
9566 * testsuite/Makefile.in: Rebuild.
9567
c42e122e
ILT
9568 * script-sections.cc (Script_sections::place_orphan): Initialize
9569 local variable exact.
9570
ce3ac18a
DE
95712008-06-13 David Edelsohn <edelsohn@gnu.org>
9572
9573 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9574
42cacb20
DE
95752008-06-12 David Edelsohn <edelsohn@gnu.org>
9576 David S. Miller <davem@davemloft.net>
9577
9578 * powerpc.cc: New file.
9579 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9580 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9581 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9582 * Makefile.in: Rebuild.
9583
7b308235
ILT
95842008-06-09 Ian Lance Taylor <iant@google.com>
9585
9586 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9587 <exception>.
9588 (throwing, orig_terminate): New static variables.
9589 (terminate_handler): New static function.
9590 (t2): Set terminate handler.
9591
f0b886e3
ILT
95922008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9593
9594 PR 6584
cd536b21 9595 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
9596 alignment.
9597
3e90f135
CC
95982008-05-30 Cary Coutant <ccoutant@google.com>
9599
9600 * archive.cc (Archive::include_all_members) Correct to step
9601 over symbol table and extended name table in thin archives.
9602
e09ad04a
ILT
96032008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9604
9605 PR 6407
9606 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9607 calculation.
9608
62b01cb5
ILT
96092008-05-28 Caleb Howe <cshowe@google.com>
9610
9611 * reduced_debug_output.cc: New file.
9612 * reduced_debug_output.h: New file.
92de84a6 9613 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
9614 * options.cc (General_options::finalize): Add strip_debug_non_line
9615 to the strip heirarchy.
9616 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9617 fields.
9618 * layout.cc: Include "reduced_debug_output.h".
9619 (Layout::Layout): Initialize new fields.
9620 (line_only_debug_sections): New static array.
9621 (is_lines_only_debug_sections): New static inline function.
9622 (Layout::include_section): Handle --strip-debug-non-line.
9623 (Layout::make_output_section): If --strip-debug-non-line, build
9624 new output sections for .debug_abbrev and .debug_info.
9625 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9626 gold. Warn about possible overflow.
9627 (read_signed_LEB_128): Likewise.
9628 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9629 (read_signed_LEB_128): Declare.
9630 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9631 (HFILES): Add reduced_debug_output.h.
9632 * Makefile.in: Rebuild.
9633
7d9e3d98
ILT
96342008-05-21 Ian Lance Taylor <iant@google.com>
9635
9636 * mapfile.cc: New file.
9637 * mapfile.h: New file.
9638 * options.h (class General_options): Add -M/--print-map and -Map.
9639 * options.cc (General_options::finalize): Make -M equivalent to
9640 -Map -.
9641 * main.cc: Include <cstdio> and "mapfile.h".
9642 (main): Open mapfile if requested.
9643 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9644 constructor. Change caller.
9645 (queue_initial_tasks): Add mapfile parameter. Change caller.
9646 (queue_middle_tasks): Likewise.
9647 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9648 declarations.
9649 * archive.cc: Include "mapfile.h".
9650 (Archive::add_symbols): Add mapfile parameter. Change all
9651 callers. Pass mapfile, symbol, and reason to include_member.
9652 (Archive::include_all_members): Add mapfile parameter. Change all
9653 callers.
9654 (Archive::include_member): Add mapfile, sym, and why parameters.
9655 Change all callers. Report inclusion to map file.
9656 * archive.h: Include "fileread.h".
9657 (class Archive): Update declarations.
9658 (Archive::file): New const method.
9659 (class Add_archive_symbols): Add mapfile_ field. Update
9660 constructor. Change all callers.
9661 * readsyms.h (class Read_symbols): Likewise.
9662 (class Finish_group): Likewise.
9663 (class Read_script): Likewise.
9664 * common.cc: Include "mapfile.h".
9665 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9666 all callers.
9667 (Symbol_table::do_allocate_commons): Likewise.
9668 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9669 symbol allocation to mapfile.
9670 * common.h (class Allocate_commons_task): Add mapfile_ field.
9671 Update constructor. Change all callers.
9672 * symtab.h (class Symbol_table): Update declarations.
9673 * layout.cc: Include "mapfile.h".
9674 (Layout_task_runner::run): Print information to mapfile.
9675 (Layout::create_gold_note): Change Output_data_fixed_space to
9676 Output_data_zero_fill.
9677 (Layout::create_build_id): Likewise.
9678 (Layout::print_to_mapfile): New function.
9679 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9680 constructor. Change caller.
9681 (class Layout): Declare print_to_mapfile.
9682 * output.cc (Output_section::Input_section::print_to_mapfile): New
9683 function.
9684 (Output_section::add_input_section): If producing a map, always
9685 add to input_sections_ list.
9686 (Output_section::do_print_to_mapfile): New function.
9687 (Output_segment::print_sections_to_mapfile): New function.
9688 (Output_segment::print_section_list_to_mapfile): New function.
9689 * output.h: Include "mapfile.h".
9690 (Output_data::print_to_mapfile): New function.
9691 (Output_data::do_print_to_mapfile): New virtual function.
9692 (Output_segment_headers::do_print_to_mapfile): New function.
9693 (Output_file_header::do_print_to_mapfile): New function.
9694 (Output_data_const::do_print_to_mapfile): New function.
9695 (class Output_data_const_buffer): Add map_name_ field. Update
9696 constructor. Change all callers. Add do_print_to_mapfile
9697 function.
9698 (class Output_data_fixed_space): Likewise.
9699 (class Output_data_space): Likewise.
9700 (class Output_data_zero_fill): New class.
9701 (Output_data_strtab::do_print_to_mapfile): New function.
9702 (Output_data_reloc_base::do_print_to_mapfile): New function.
9703 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9704 (Output_data_group::do_print_to_mapfile): New function.
9705 (Output_data_got::do_print_to_mapfile): New function.
9706 (Output_data_dynamic::do_print_to_mapfile): New function.
9707 (Output_symtab_xindex::do_print_to_mapfile): New function.
9708 (class Output_section): Declare do_print_to_mapflie. Declare
9709 print_to_mapfile in Input_section.
9710 (class Output_segment): Declare new functions.
9711 * object.h (Sized_relobj::symbol_count): New function.
9712 * script-sections.cc
9713 (Output_section_element_dot_assignment::set_section_addresses):
9714 Change Output_data_fixed_space to Output_data_zero_fill.
9715 (Output_data_expression::do_print_to_mapfile): New function.
9716 * script.cc (read_input_script): Add mapfile parameter. Change
9717 all callers.
9718 * script.h (read_input_script): Update declaration.
9719 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9720 (Eh_frame::do_print_to_mapfile): New function.
9721 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9722 (Output_merge_string::do_print_to_mapfile): New function.
9723 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9724 function.
9725 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9726 function.
9727 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9728 function.
9729 * Makefile.am (CCFILES): Add mapfile.cc.
9730 (HFILES): Add mapfile.h.
9731 * Makefile.in: Rebuild.
9732
9f1d377b
ILT
97332008-05-19 Ian Lance Taylor <iant@google.com>
9734
9735 * options.h (class General_options): Add -z relro.
9736 * layout.cc (Layout::Layout): Initialize relro_segment_.
9737 (Layout::add_output_section_data): Return the output section.
9738 (Layout::make_output_section): Rcognize relro sections and mark
9739 them appropriately.
9740 (Layout::attach_allocated_section_to_segment): Put relro sections
9741 in a PT_GNU_RELRO segment.
9742 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9743 section as relro.
9744 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9745 PT_TLS segments.
9746 (Layout::linkonce_mapping): Map d.rel.ro.local to
9747 .data.rel.ro.local.
9748 (Layout::output_section_name): Us .data.rel.ro.local for any
9749 section which begins with that.
9750 * layout.h (class Layout): Update add_output_section_data
9751 declaration. Add relro_segment_ field.
9752 * output.cc (Output_section::Output_section): Initialize is_relro_
9753 and is_relro_local_ fields.
9754 (Output_segment::add_output_section): Group relro sections.
9755 (Output_segment::is_first_section_relro): New function.
9756 (Output_segment::maximum_alignment): If there is a relro section,
9757 align the segment to the common page size.
9758 (Output_segment::set_section_addresses): Track whether we are
9759 looking at relro sections. If the last section is a relro
9760 section, align to the common page size.
9761 (Output_segment::set_section_list_addresses): Add in_relro
9762 parameter. Change all callers. Align to the page size when
9763 moving from relro to non-relro section.
9764 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9765 segment.
9766 * output.h (class Output_section): Add is_relro_ and
9767 is_relro_local_ fields.
9768 (Output_section::is_relro): New function.
9769 (Output_section::set_is_relro): New function.
9770 (Output_section::is_relro_local): New function.
9771 (Output_section::set_is_relro_local): New function.
9772 (class Output_segment): Update declarations.
9773 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9774 * sparc.cc (Target_sparc::got_section): Likewise.
9775 * x86_64.cc (Target_x86_64::got_section): Likewise.
9776 * testsuite/relro_test_main.cc: New file.
9777 * testsuite/relro_test.cc: New file.
9778 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9779 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9780 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9781 (relro_test.so, relro_test_pic.o): New targets.
9782 * testsuite/Makefile.in: Rebuild.
9783
a984ee1d
ILT
97842008-05-16 Ian Lance Taylor <iant@google.com>
9785
01676dcd
ILT
9786 * output.cc (Output_segment::add_output_section): Remove front
9787 parameter.
9788 * output.h (class Output_segment): Remove
9789 add_initial_output_section and overloaded add_output_section.
9790 Update declaration of remaining add_output_section.
9791 * layout.cc (Layout::create_interp): Call add_output_section
9792 rather than add_initial_output_section.
9793 (Layout::finish_dynamic_section): Likewise.
9794
497897f9
ILT
9795 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9796 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9797 know the dynamic type.
9798 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9799 field. Initialize it in constructor.
9800 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9801 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9802 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9803 reloc.
9804
a984ee1d
ILT
9805 * output.cc (Output_reloc::get_address): Change return type to
9806 Elf_Addr.
9807 * output.h (class Output_reloc): Update get_address declaration.
9808 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9809 for section addresses.
9810
55ba0940
ILT
98112008-05-09 Ian Lance Taylor <iant@google.com>
9812
9813 PR 6493
9814 * gold.cc (gold_nomem): Use return value of write.
9815
75517b77
ILT
98162008-05-08 Ian Lance Taylor <iant@google.com>
9817
9818 * symtab.c (Symbol::init_base_output_data): Add version
9819 parameter. Change all callers.
9820 (Symbol::init_base_output_segment): Likewise.
9821 (Symbol::init_base_constant): Likewise.
9822 (Symbol::init_base_undefined): Likewise.
9823 (Sized_symbol::init_output_data): Likewise.
9824 (Sized_symbol::init_output_segment): Likewise.
9825 (Sized_symbol::init_constant): Likewise.
9826 (Sized_symbol::init_undefined): Likewise.
9827 (Symbol_table::do_define_in_output_data): If the new symbol has a
9828 version, mark it as the default.
9829 (Symbol_table::do_define_in_output_segment): Likewise.
9830 (Symbol_table::do_define_as_constant): Likewise.
9831 * symtab.h (class Symbol): Update declarations.
9832 (class Sized_symbol): Likewise.
9833 * resolve.cc (Symbol::override_version): New function.
c42e122e 9834 (Symbol::override_base): Call override_version.
75517b77
ILT
9835 (Symbol::override_base_with_special): Likewise.
9836 * testsuite/ver_script_8.script: New file.
9837 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9838 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9839 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9840 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9841
f1f70eae
ILT
98422008-05-06 Ian Lance Taylor <iant@google.com>
9843
f3e9c5c5
ILT
9844 PR 6049
9845 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9846 functions.
9847 (class General_options): Remove existing --undefined, and add
9848 --no-undefined instead. Add new --undefined as synonym for -u.
9849 * archive.cc (Archive::add_symbols): Check whether symbol was
9850 named with -u.
9851 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9852 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9853 all uses. Add IS_UNDEFINED. Update declarations to split
9854 different versions of init_base. Declare init_base_undefined.
9855 (Symbol::is_defined): Handle IS_UNDEFINED.
9856 (Symbol::is_undefined): Likewise.
9857 (Symbol::is_weak_undefined): Call is_undefined.
9858 (Symbol::is_absolute): Handle IS_CONSTANT.
9859 (class Sized_symbol): Update declarations to split different
9860 versions of init. Declare init_undefined.
9861 (class Symbol_table): Declare new functions.
9862 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9863 Change all callers.
9864 (Symbol::init_base_output_data): Likewise.
9865 (Symbol::init_base_output_segment): Likewise.
9866 (Symbol::init_base_constant): Likewise.
9867 (Symbol::init_base_undefined): New function.
9868 (Sized_symbol::init_object): Rename from init. Change all
9869 callers.
9870 (Sized_symbol::init_output_data): Likewise.
9871 (Sized_symbol::init_output_segment): Likewise.
9872 (Sized_symbol::init_constant): Likewise.
9873 (Sized_symbol::init_undefined): New function.
9874 (Symbol_table::add_undefined_symbols_from_command_line): New
9875 function.
9876 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9877 function.
9878 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9879 (Symbol::output_section): Likewise.
9880 (Symbol::set_output_section): Likewise.
9881 (Symbol_table::sized_finalize_symbol): Likewise.
9882 (Symbol_table::sized_write_globals): Likewise.
9883 * resolve.cc (Symbol_table::should_override): Likewise.
9884 (Symbol::override_base_with_special): Likewise.
9885
8bdcdf2c
ILT
9886 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9887 symbol, change it to have default visibility.
9888 * testsuite/protected_1.cc: New file.
9889 * testsuite/protected_2.cc: New file.
9890 * testsuite/protected_3.cc: New file.
9891 * testsuite/protected_main_1.cc: New file.
9892 * testsuite/protected_main_2.cc: New file.
9893 * testsuite/protected_main_3.cc: New file.
9894 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9895 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9896 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9897 (protected_1.so): New target.
9898 (protected_1_pic.o, protected_2_pic.o): New targets.
9899 (protected_3_pic.o): New target.
9900 (check_PROGRAMS): Add protected_2.
9901 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9902 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9903 * testsuite/Makefile.in: Rebuild.
9904
2b706932
ILT
9905 * options.h (DEFINE_var): Add set_user_set_##varname__.
9906 (DEFINE_bool_alias): New macro.
9907 (class General_options): Define -Bstatic using DEFINE_bool_alias
9908 rather than DEFINE_special. Add --undefined as an alias for -z
9909 defs.
9910 * options.cc (General_options::parse_Bstatic): Remove.
9911
d82a5bcc
ILT
9912 * options.h (class General_options): Add --fatal-warnings.
9913 * main.cc (main): Implement --fatal-warnings.
9914 * errors.h (Errors::warning_count): New function.
9915
f1f70eae
ILT
9916 * options.h (class General_options): Add -Bsymbolic-functions.
9917 * symtab.h (Symbol::is_preemptible): Check for
9918 -Bsymbolic-functions.
9919
8825ac63
ILT
99202008-05-05 Ian Lance Taylor <iant@google.com>
9921
d98bc257
ILT
9922 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9923 as noVARNAME rather than no-VARNAME.
9924 (class General_options): Add option -z combreloc.
9925 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9926 get_address.
9927 (Output_reloc::sort_before) [SHT_REL]: New function.
9928 (Output_reloc::sort_before) [SHT_RELA]: New function.
9929 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9930 Sort_relocs_comparison.
9931 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9932 parameter. Change all callers.
9933 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9934 sort_relocs parameter. Change all callers.
9935 * output.cc (Output_reloc::get_address): New function, broken out
9936 of write_rel.
9937 (Output_reloc::write_rel): Call it.
9938 (Output_reloc::compare): New function.
9939 (Output_data_reloc_base::do_write): Optionally sort relocs.
9940
60b2b4e7
ILT
9941 * configure.ac: If targ_extra_obj is set, link it in.
9942 * configure.tgt: Initialize all variables.
9943 (x86_64*): Set targ_extra_obj and targ_extra_size.
9944 * configure: Rebuild.
9945
8825ac63
ILT
9946 * object.cc (Sized_relobj::include_section_group): Adjust section
9947 indexes read from group data. Build vector to pass to
9948 layout_group.
9949 * layout.cc (Layout::layout_group): Add flags and shndxes
9950 parameters. Remove contents parameter. Change caller. Update
9951 explicit instantiations.
9952 * layout.h (class Layout): Update layout_group declaration.
9953 * output.cc (Output_data_group::Output_data_group): Add flags and
9954 input_shndxes parameters. Remove contents parameter. Change
9955 caller.
9956 (Output_data_group::do_write): Change input_sections_ to
9957 input_shndxes_.
9958 * output.h (class Output_data_group): Update constructor
9959 declaration. Rename input_sections_ to input_shndxes_.
9960 * testsuite/many_sections_test.cc: Add template.
9961
e94cf127
CC
99622008-04-30 Cary Coutant <ccoutant@google.com>
9963
4418b2d5
CC
9964 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9965
e94cf127
CC
9966 * layout.cc (Layout::include_section): Refactored check for debug
9967 info section.
9968 (Layout::add_comdat): Add new parameters. Change type
9969 of signature parameter. Add object and shndx to signatures table.
9970 (Layout::find_kept_object): New function.
9971 * layout.h: Include <cstring>.
9972 (Layout::is_debug_info_section): New function.
9973 (Layout::add_comdat): Add new parameters.
9974 (Layout::find_kept_object): New function.
9975 (Layout::Kept_section): New struct.
9976 (Layout::Signatures): Change type of map range.
9977 * object.cc (Relobj::output_section_address): New function.
9978 (Sized_relobj::include_section_group): Add new parameters. Change
9979 calls to Layout::add_comdat. Change to build table of kept comdat
9980 groups and table mapping discarded sections to kept sections.
9981 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9982 (Sized_relobj::do_layout): Change calls to include_section_group and
9983 include_linkonce_section.
9984 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9985 value to zero when section is discarded.
9986 (Sized_relobj::map_to_kept_section): New function.
9987 * object.h (Relobj::output_section_address): New function.
9988 (Relobj::Comdat_group): New type.
9989 (Relobj::find_comdat_group): New function.
9990 (Relobj::Comdat_group_table): New type.
9991 (Relobj::Kept_comdat_section): New type.
9992 (Relobj::Kept_comdat_section_table): New type.
9993 (Relobj::add_comdat_group): New function.
9994 (Relobj::set_kept_comdat_section): New function.
9995 (Relobj::get_kept_comdat_section): New function.
9996 (Relobj::comdat_groups_): New field.
9997 (Relobj::kept_comdat_sections_): New field.
9998 (Symbol_value::input_value): Update comment.
9999 (Sized_relobj::map_to_kept_section) New function.
10000 (Sized_relobj::include_linkonce_section): Add new parameter.
10001 * target-reloc.h (Comdat_behavior): New type.
10002 (get_comdat_behavior): New function.
10003 (relocate_section): Add code to map a discarded section to the
10004 corresponding kept section when applying a relocation.
10005
e4e5049b
CS
100062008-04-30 Craig Silverstein <csilvers@google.com>
10007
10008 * dwarf_reader.cc (next_generation_count): New static var.
10009 (Addr2line_cache_entry): New struct.
10010 (addr2line_cache): New static var.
10011 (Dwarf_line_info::one_addr2line): Added caching.
10012 (Dwarf_line_info::clear_addr2line_cache): New function.
10013 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10014 cache-size parameter.
10015 (Dwarf_line_info::one_addr2line_cache): New function.
10016 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10017 new cache-size argument to one_addr2line(), and clear cache.
10018
d09e9154
CC
100192008-04-28 Cary Coutant <ccoutant@google.com>
10020
10021 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10022 R_386_PC8 relocations.
10023
7ef73768
ILT
100242008-04-23 Ian Lance Taylor <iant@google.com>
10025
55438702
ILT
10026 * object.cc (Sized_relobj::include_section_group): Check for
10027 invalid section group.
10028
c165fb93
ILT
10029 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10030 header size.
10031
7ef73768
ILT
10032 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10033 than read for file header.
10034 * archive.cc (Archive::include_member): Likewise.
10035
6194aaab
L
100362008-04-23 Paolo Bonzini <bonzini@gnu.org>
10037
10038 * aclocal.m4: Regenerate.
10039 * configure: Regenerate.
10040
d491d34e
ILT
100412008-04-19 Ian Lance Taylor <iant@google.com>
10042
5ea2bac6
ILT
10043 * version.cc (version_string): Bump to 1.6.
10044
7bc3e21a
ILT
10045 * testsuite/Makefile.am (many_sections_r_test): New target.
10046 (many_sections_r_test_SOURCES): Remove.
10047 (many_sections_r_test_DEPENDENCIES): Remove.
10048 (many_sections_r_test_LDFLAGS): Remove.
10049 (many_sections_r_test_LDADD): Remove.
10050
7fcd3aa9
ILT
10051 * object.cc (Sized_relobj::do_add_symbols): Always pass
10052 local_symbol_count_ to add_from_relobj.
10053
4c94d6ae
ILT
10054 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10055 every thousand variables.
10056 * testsuite/Makefile.in: Rebuild.
10057
d491d34e
ILT
10058 * object.cc (Xindex::initialize_symtab_xindex): New function.
10059 (Xindex::read_symtab_xindex): New function.
10060 (Xindex::sym_xindex_to_shndx): New function.
10061 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10062 available.
10063 (Sized_relobj::do_initialize_xindex): New function.
10064 (Sized_relobj::do_read_symbols): Adjust section links.
10065 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10066 parameter. Change all callers.
10067 (Sized_relobj::include_section_group): Adjust section links and
10068 symbol section indexes.
10069 (Sized_relobj::do_layout): Adjust section links.
10070 (Sized_relobj::do_count_local_symbols): Adjust section links and
10071 symbol section indexes.
10072 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10073 ordinary and special symbols.
10074 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10075 dynsym_xindex parameters. Change all callers. Adjust section
10076 links. Use SHN_XINDEX when needed.
10077 (Sized_relobj::get_symbol_location_info): Adjust section links.
10078 Don't get fooled by special symbols.
10079 * object.h (class Xindex): Define.
10080 (class Object): Add xindex_ parameter. Declare virtual functoin
10081 do_initialize_xindex.
10082 (Object::adjust_sym_shndx): New function.
10083 (Object::set_xindex): New protected function.
10084 (class Symbol_value): Add is_ordinary_shndx_ field.
10085 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10086 (Symbol_value::value): Assert ordinary section.
10087 (Symbol_value::initialize_input_to_output_map): Likewise.
10088 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10089 Change all callers.
10090 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10091 all callers.
10092 (class Sized_relobj): Update declarations.
10093 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10094 parameter. Change all callers.
10095 (Sized_relobj::adjust_shndx): New function.
10096 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10097 field.
10098 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10099 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10100 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10101 (Sized_dynobj::read_dynsym_section): Adjust section links.
10102 (Sized_dynobj::read_dynamic): Likewise.
10103 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10104 section links.
10105 (Sized_dynobj::do_initialize_xindex): New function.
10106 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10107 do_initialize_xindex.
10108 (Sized_dynobj::adjust_shndx): New function.
10109 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10110 dynsym_xindex_ fields.
10111 (Layout::finalize): Add a call to set_section_indexes before
10112 creating the symtab sections.
10113 (Layout::set_section_indexes): Don't do anything if the section
10114 already has a section index.
10115 (Layout::create_symtab_sections): Add shnum parameter. Change
10116 caller. Create .symtab_shndx section if needed.
10117 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10118 caller.
10119 (Layout::allocated_output_section_count): New function.
10120 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10121 needed.
10122 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10123 fields. Update declarations.
10124 (Layout::symtab_xindex): New function.
10125 (Layout::dynsym_xindex): New function.
10126 (class Write_symbols_task): Add layout_ field.
10127 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10128 Change caller.
10129 * output.cc (Output_section_headers::Output_section_headers): Add
10130 shstrtab_section parameter. Change all callers.
10131 (Output_section_headers::do_sized_write): Store overflow values
10132 for section count and section string table section index in
10133 section header zero.
10134 (Output_file_header::do_sized_write): Check for overflow of
10135 section count and section string table section index.
10136 (Output_symtab_xindex::do_write): New function.
10137 (Output_symtab_xindex::endian_do_write): New function.
10138 * output.h (class Output_section_headers): Add shstrtab_section_.
10139 Update declarations.
10140 (class Output_symtab_xindex): Define.
10141 (Output_section::has_out_shndx): New function.
10142 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10143 field.
10144 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10145 Change all callers.
10146 (Sized_symbol::init): Likewise.
10147 (Symbol::output_section): Check for ordinary symbol.
10148 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10149 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10150 callers.
10151 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10152 Change all callers. Simplify handling of symbols from sections
10153 not included in the link.
10154 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10155 distinction.
10156 (Weak_alias_sorter::operator()): Assert that symbols are
10157 ordinary.
10158 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10159 distinction.
10160 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10161 parameters. Change all callers.
10162 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10163 symbol distinction. Use SHN_XINDEX when needed.
10164 (Symbol_table::write_section_symbol): Add symtab_xindex
10165 parameter. Change all callers.
10166 (Symbol_table::sized_write_section_symbol): Likewise. Use
10167 SHN_XINDEX when needed.
10168 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10169 declarations.
10170 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10171 (Symbol::is_defined): Check is_ordinary.
10172 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10173 (Symbol::is_absolute, Symbol::is_common): Likewise.
10174 (class Sized_symbol): Update declarations.
10175 (class Symbol_table): Update declarations.
10176 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10177 parameters. Change all callers.
10178 (Sized_symbol::override): Likewise.
10179 (Symbol_table::override): Likewise.
10180 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10181 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10182 is_ordinary, and orig_st_shndx parameters. Change all callers.
10183 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10184 to be in an ordinary section.
10185 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10186 object and is_ordinary parameters. Change all callers.
10187 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10188 Change all callers. Don't add undefined or non-ordinary symbols
10189 to reloc_map_.
10190 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10191 Change all callers.
10192 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10193 declarations.
10194 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10195 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10196 (Sized_relobj::relocate_sections): Likewise.
10197 * target-reloc.h (scan_relocs): Adjust section symbol index.
10198 (scan_relocatable_relocs): Likewise.
10199 * i386.cc (Scan::local): Check for ordinary symbols.
10200 * sparc.cc (Scan::local): Likewise.
10201 * x86_64.cc (Scan::local): Likewise.
10202 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10203 to symbol_section_and_value.
10204 * testsuite/many_sections_test.cc: New file.
10205 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10206 (check_PROGRAMS): Add many_sections_test.
10207 (many_sections_test_SOURCES): Define.
10208 (many_sections_test_DEPENDENCIES): Define.
10209 (many_sections_test_LDFLAGS): Define.
10210 (BUILT_SOURCES): Add many_sections_define.h.
10211 (many_sections_define.h): New target.
10212 (BUILT_SOURCES): Add many_sections_check.h.
10213 (many_sections_check.h): New target.
10214 (check_PROGRAMS): Add many_sections_r_test.
10215 (many_sections_r_test_SOURCES): Define.
10216 (many_sections_r_test_DEPENDENCIES): Define.
10217 (many_sections_r_test_LDFLAGS): Define.
10218 (many_sections_r_test_LDADD): Define.
10219 (many_sections_r_test.o): New target.
10220 * testsuite/Makefile.in: Rebuild.
10221
c5818ff1
CC
102222008-04-17 Cary Coutant <ccoutant@google.com>
10223
10224 * errors.cc (Errors::info): New function.
10225 (gold_info): New function.
10226 * errors.h (Errors::info): New function.
10227 * gold.h (gold_info): New function.
10228 * object.cc (Input_objects::add_object): Print trace output.
10229 * options.cc (options::parse_set): New function.
10230 (General_options::parse_wrap): Deleted.
10231 (General_options::General_options): Deleted initializer.
10232 * options.h (options::String_set): New typedef.
10233 (options::parse_set): New function.
10234 (DEFINE_set): New macro.
10235 (General_options::wrap): Changed to use DEFINE_set. Changed
10236 callers of any_wrap_symbols and is_wrap_symbol.
10237 (General_options::trace, General_options::trace_symbol):
10238 New options.
10239 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10240 (General_options::wrap_symbols_): Deleted.
10241 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10242
b5be4a7c
DM
102432008-04-17 David S. Miller <davem@davemloft.net>
10244
10245 * options.cc (General_options::parse_V): New function.
10246 * options.h: Add entries for -V and -Qy.
10247
155a0dd7
ILT
102482008-04-17 Ian Lance Taylor <iant@google.com>
10249
10250 * common.cc (Symbol_table::allocate_commons): Remove options
10251 parameter. Change caller.
10252 (Symbol_table::do_allocate_commons): Remove options parameter.
10253 Change caller. Just call do_allocate_commons_list twice.
10254 (Symbol_table::do_allocate_commons_list): New function, broken out
10255 of do_allocate_commons.
10256 * common.h (class Allocate_commons_task): Remove options_ field.
10257 Update constructor.
10258 * symtab.cc (Symbol_table::Symbol_table): Initialize
10259 tls_commons_.
10260 (Symbol_table::add_from_object): Put TLS common symbols on
10261 tls_commons_ list.
10262 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10263 which are IN_OUTPUT_DATA.
10264 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10265 allocate_commons and do_allocate_commons declarations. Declare
10266 do_allocate_commons_list.
10267 * gold.cc (queue_middle_tasks): Update creation of
10268 Allocate_commons_task to not pass options.
10269 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10270 (TLS_TEST_C_FLAGS): New variable.
10271 (tls_test_c_pic.o): New target.
10272 (tls_test_shared.so): Link in tls_test_c_pic.o.
10273 (tls_test_c_pic_ie.o): New target.
10274 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10275 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10276 (tls_test_c.o): New target.
10277 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10278 (tls_pic_test_LDADD): Likewise.
10279 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10280 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10281 (tls_test_c_gnu2.o): New target.
10282 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10283 tls_test_c_gnu2.o.
10284 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10285 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10286 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10287 * testsuite/tls_test.cc: Include "config.h".
10288 (t_last): Call t11_last.
10289 * testsuite/tls_test.h (t11, t11_last): Declare.
10290 * testsuite/tls_test_c.c: New file.
10291 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10292 * configure.ac: Check for OpenMP support.
10293 * configure, config.in, Makefile.in: Rebuild.
10294 * testsuite/Makefile.in: Rebuild.
10295
edfbb029
CC
102962008-04-16 Cary Coutant <ccoutant@google.com>
10297
10298 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10299 (Target_i386::tls_base_symbol_defined_): New field.
10300 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10301 (Target_i386::Scan::global): Likewise.
10302 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10303 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10304 (Target_x86_64::tls_base_symbol_defined_): New field.
10305 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10306 (Target_x86_64::Scan::global): Likewise.
10307
f3c69fca
CC
103082008-04-16 Cary Coutant <ccoutant@google.com>
10309
10310 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10311 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10312 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10313 building shared libraries.
10314 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10315 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10316 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10317 * testsuite/Makefile.in: Rebuild.
10318 * testsuite/weak_undef.h: New file.
10319 * testsuite/weak_undef_file1.cc: Add extra test cases.
10320 * testsuite/weak_undef_file2.cc: Likewise.
10321 * testsuite/weak_undef_test.cc: Likewise.
10322
7c414435
DM
103232008-04-16 David S. Miller <davem@davemloft.net>
10324
32b769e1
DM
10325 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10326 Add issued_non_pic_error_ field. Declare check_non_pic.
10327 (Target_sparc::Scan::check_non_pic): New function.
10328 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10329 (Target_sparc::Scan::global): Likewise.
10330
11936fb1
DM
10331 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10332 * configure: Rebuild.
10333
7c414435
DM
10334 * options.h (DEFINE_enable): New macro.
10335 (new_dtags): New enable option.
10336 (initfirst, interpose, loadfltr, nodefaultlib,
10337 nodelete, nodlopen, nodump): New -z options.
10338 * layout.cc (Layout:finish_dynamic_section): If new
10339 dtags enabled, emit DT_RUNPATH. Also, emit a
10340 DT_FLAGS_1 containing any specified -z flags.
10341
85c7bf8b
ILT
103422008-04-16 Ian Lance Taylor <iant@google.com>
10343
12c0daef
ILT
10344 * copy-relocs.cc: New file.
10345 * copy-relocs.h: New file.
10346 * reloc.cc: Remove Copy_relocs code.
10347 * reloc.h: Likewise.
10348 * reloc-types.h (struct Reloc_types) [both versions]: Add
10349 get_reloc_addend_noerror.
10350 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10351 variants of add_global which take an addend which must be zero.
10352 * i386.cc: Include "copy-relocs.h".
10353 (class Target_i386): Change type of copy_relocs_ to variable,
10354 update initializer.
10355 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10356 Change all callers.
10357 (Target_i386::do_finalize_sections): Change handling of
10358 copy_relocs_.
10359 * sparc.cc: Include "copy-relocs.h".
10360 (class Target_sparc): Change type of copy_relocs_ to variable,
10361 update initializer.
10362 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10363 Change all callers.
10364 (Target_sparc::do_finalize_sections): Change handling of
10365 copy_relocs_.
10366 * x86_64.cc: Include "copy-relocs.h".
10367 (class Target_x86_64): Change type of copy_relocs_ to variable,
10368 update initializer.
10369 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10370 class. Change all callers.
10371 (Target_x86_64::do_finalize_sections): Change handling of
10372 copy_relocs_.
10373 * Makefile.am (CCFILES): Add copy-relocs.cc.
10374 (HFILES): Add copy-relocs.h.
10375
4f4995b6
ILT
10376 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10377
85c7bf8b
ILT
10378 * testsuite/script_test_4.sh: Permit leading zeroes.
10379
4f2a9edd
ILT
103802008-04-15 Ian Lance Taylor <iant@google.com>
10381
e6188289
ILT
10382 * script-sections.cc (Script_sections::create_segments): Use
10383 header_size_adjustment even when there is enough room for the
10384 headers.
10385 * testsuite/script_test_4.sh: New file.
10386 * testsuite/script_test_4.t: New file.
10387 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10388 (check_DATA): Add script_test_4.stdout.
10389 (MOSTLYCLEANFILES): Likewise.
10390 (script_test_4): New target.
10391 (script_test_4.stdout): New target.
10392 * testsuite/Makefile.in: Rebuild.
10393
4f2a9edd
ILT
10394 * sparc.cc: Add definitions for Output_data_plt_sparc class
10395 constants.
10396
f5314dd5
DM
103972008-04-14 David S. Miller <davem@davemloft.net>
10398
10399 * sparc.cc: New file.
10400 * Makefile.am (TARGETSOURCES): Add sparc.cc
10401 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10402 * configure.tgt: Document targ_extra_size and
10403 targ_extra_big_endian. Add entries for sparc-* and
10404 sparc64-*.
10405 * configure.ac: Handle targ_extra_size and
10406 targ_extra_big_endian.
10407 * Makefile.in: Rebuild.
10408 * configure: Likewise.
10409 * po/POTFILES.in: Likewise.
10410 * po/gold.pot: Likewise.
10411
154e0e9a
ILT
104122008-04-14 Ian Lance Taylor <iant@google.com>
10413
10414 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10415 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10416 in the name/type/flags to section mapping. Don't call
10417 allocate_output_section.
10418 (Layout::choose_output_section): Change parameter from adjust_name
10419 to is_input_section. Don't permit input sections after sections
10420 are attached to segments. Don't call allocate_output_section.
10421 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10422 not write_enable_output_section.
10423 (Layout::make_output_section): Don't push to
10424 unattached_section_list_ nor call attach_to_segment. Call
10425 attach_section_to_segment if sections are attached.
10426 (Layout::attach_sections_to_segments): New function.
10427 (Layout::attach_section_to_segment): New function.
10428 (Layout::attach_allocated_section_to_segment): Rename from
10429 attach_to_segment. Remove flags parameter.
10430 (Layout::allocate_output_section): Remove function.
10431 (Layout::write_enable_output_section): Remove function.
10432 * layout.h (class Layout): Update for above changes. Add new
10433 field sections_are_attached_.
10434 * output.h (Output_section::update_flags_for_input_section): New
10435 function.
10436 * output.cc (Output_section::add_input_section): Call
10437 update_flags_for_input_section.
10438 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10439
009a67a2
CC
104402008-04-11 Cary Coutant <ccoutant@google.com>
10441
10442 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10443 thought unnecessary.
10444 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10445
759b1a24
ILT
104462008-04-11 Ian Lance Taylor <iant@google.com>
10447
10448 * output.h (class Output_section_data): Remove inline definition
10449 of set_addralign.
10450 * output.cc (Output_section_data::set_addralign): New function.
10451
c2b45e22
CC
104522008-04-11 Cary Coutant <ccoutant@google.com>
10453
10454 Add support for TLS descriptors for i386 and x86_64.
10455 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10456 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10457 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10458 GOT_TYPE_TLS_DESC.
10459 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10460 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10461 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10462 relocations.
10463 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10464 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10465 Fix problem with initial-exec relocations.
10466 (Target_i386::Relocate::relocate_tls): Likewise.
10467 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10468 relaxation.
10469 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10470 support for section-plus-offset dynamic table entries.
10471 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10472 (Output_data_dynamic::Dynamic_entry): Add support for
10473 section-plus-offset dynamic table entries.
10474 (Output_data_dynamic::Classification): Likewise.
10475 (Output_data_dynamic::classification_): Renamed offset_.
10476 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10477 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10478 (Target_x86_64::make_plt_section): New function.
10479 (Target_x86_64::reserve_tlsdesc_entries): New function.
10480 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10481 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10482 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10483 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10484 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10485 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10486 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10487 add extra PLT entry for TLS descriptors.
10488 (Output_data_plt_x86_64::got_): New field.
10489 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10490 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10491 fields.
10492 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10493 descriptors.
10494 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10495 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10496 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10497 R_386_TLS_DESC_CALL relocations.
10498 (Target_x86_64::Scan::global): Likewise.
10499 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10500 for TLS descriptors.
10501 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10502 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10503 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10504 GD-to-IE relaxation.
10505 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10506 and TLS_DESCRIPTORS.
10507 * Makefile.in: Rebuild.
10508 * configure: Rebuild.
10509 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10510 (tls_test_shared2.so): New target.
10511 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10512 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10513 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10514 (tls_shared_gd_to_ie_test_LDADD): New variable.
10515 (tls_shared_gnu2_gd_to_ie_test): New target.
10516 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10517 New targets.
10518 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10519 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10520 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10521 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10522 (tls_shared_gnu2_test): New target.
10523 (tls_test_gnu2_shared.so): New target.
10524 (tls_shared_gnu2_test_SOURCES): New variable.
10525 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10526 (tls_shared_gnu2_test_LDFLAGS): New variable.
10527 (tls_shared_gnu2_test_LDADD): New variable.
10528 * testsuite/Makefile.in: Rebuild.
10529 * testsuite/Makefile.
10530
83bfb6b7
ILT
105312008-04-11 Ian Lance Taylor <iant@google.com>
10532
10533 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10534 justsyms.t.
10535 * testsuite/Makefile.in: Rebuild.
10536
10537 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10538 long.
10539 * testsuite/script_test_2.cc (main): Adjust test.
10540
706e1f5e
ILT
105412008-04-11 David S. Miller <davem@davemloft.net>
10542 Ian Lance Taylor <iant@google.com>
10543
10544 * options.h (General_options): Add entries for '-Y' and
10545 '-relax'.
10546 * options.cc (General_options:finalize): If -Y was used, add those
10547 entries to the library path instead of the default "/lib" and
10548 "/usr/lib".
10549
7c98e6bb
DM
105502008-04-11 David S. Miller <davem@davemloft.net>
10551
10552 * testsuite/justsyms.t: Start at 0x100.
10553 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
10554 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10555 long.
10556 * testsuite/script_test_2.cc: Adjust string and section length
10557 checks.
7c98e6bb 10558
99a37bfd
ILT
105592008-04-09 Ian Lance Taylor <iant@google.com>
10560
2cefc357
ILT
10561 PR gold/5996
10562 * script-sections.cc (Sections_element::allocate_to_segment): Add
10563 orphan parameter.
10564 (Output_section_definition::allocate_to_segment): Likewise.
10565 (Orphan_output_section::allocate_to_segment): Likewise.
10566 (Script_sections::attach_sections_using_phdrs_clause): Don't
10567 propagate non-PT_LOAD segments to orphan sections.
10568 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10569 readelf rather than objdump.
10570 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10571 .interp section and PT_INTERP segment are the same size.
10572 * testsuite/Makefile.in: Rebuild.
10573
99a37bfd
ILT
10574 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10575 aliases for symbols defined in the same object.
10576 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10577 (weak_alias_test_SOURCES): New variable.
10578 (weak_alias_test_DEPENDENCIES): New variable.
10579 (weak_alias_test_LDFLAGS): New variable.
10580 (weak_alias_test_LDADD): New variable.
10581 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10582 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10583 (weak_alias_test_3.o): New target.
10584 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10585 * testsuite/weak_alias_test_main.cc: New file.
10586 * testsuite/weak_alias_test_1.cc: New file.
10587 * testsuite/weak_alias_test_2.cc: New file.
10588 * testsuite/weak_alias_test_3.cc: New file.
10589
780e49c5
ILT
105902008-04-08 Ian Lance Taylor <iant@google.com>
10591
cdb0b8f5
ILT
10592 * options.h (class General_options): Add --noinhibit-exec option.
10593 * main.cc (main): Check --noinhibit-exec.
10594
0864d551
ILT
10595 * options.h (class General_options): Define --wrap as a special
10596 option. Add wrap_symbols_ field.
10597 (General_options::any_wrap_symbols): New function.
10598 (General_options::is_wrap_symbol): New function.
10599 * options.cc (General_options::parse_wrap): New function.
10600 (General_options::General_options): Initialize wrap_symbols_.
10601 * symtab.cc (Symbol_table::wrap_symbol): New function.
10602 (Symbol_table::add_from_object): Handle --wrap.
10603 * symtab.h (class Symbol_table): Declare wrap_symbol.
10604 * target.h (Target::wrap_char): New function.
10605 (Target::Target_info): Add wrap_char field.
10606 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10607 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10608 * testsuite/testfile.cc (Target_test::test_target_info):
10609 Likewise.
10610
789aa6de
ILT
10611 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10612 there is one.
10613
2c38906f
ILT
10614 * layout.h (class Layout): Add added_eh_frame_data_ field.
10615 * layout.cc (Layout::Layout): Initialize new field.
10616 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10617 output section until we find a section we merged successfully.
10618 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10619 that the size be non-zero.
10620
780e49c5
ILT
10621 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10622 qualifier.
10623
7fcd0256
ILT
106242008-04-08 Craig Silverstein <csilvers@google.com>
10625
10626 * configure.ac: Export new conditional variable HAVE_ZLIB.
10627 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10628 on HAVE_ZLIB.
10629 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10630 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10631
6835af53
ILT
106322008-04-07 Ian Lance Taylor <iant@google.com>
10633
e24f324c
ILT
10634 * version.cc (version_string): Set to "1.5".
10635
a036edd8
ILT
10636 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10637 Add issued_non_pic_error_ field. Declare check_non_pic.
10638 (Target_x86_64::Scan::check_non_pic): New function.
10639 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10640 (Target_x86_64::Scan::global): Likewise.
10641
624f8810
ILT
10642 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10643 addend parameter. Change caller. Handle merge sections.
10644 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10645 Address to Addend. Don't add in the result of
10646 local_section_offset, pass down the addend and use the returned
10647 value.
10648 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10649 Update declarations of local_section_offset and symbol_value.
10650 * testsuite/two_file_test_1.cc (t18): New function.
10651 * testsuite/two_file_test_2.cc (f18): New function.
10652 * testsuite/two_file_test_main.cc (main): Call t18.
10653 * testsuite/two_file_test.h (t18, f18): Declare.
10654
6835af53
ILT
10655 * configure.ac: Don't test for objdump, c++filt, or readelf.
10656 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10657 conditionals.
10658 (TEST_READELF): New variable.
10659 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10660 (check_PROGRAMS): Add two_file_strip_test.
10661 (two_file_strip_test): New target.
10662 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10663 (two_file_same_shared_strip_test_SOURCES): New variable.
10664 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10665 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10666 (two_file_same_shared_strip_test_LDADD): New variable.
10667 (two_file_shared_strip.so): New target.
10668 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10669 (ver_test_5.syms, ver_test_7.syms): Likewise.
10670 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10671 (strip_test_3.stdout): Use TEST_OBJDUMP.
10672 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10673
86925eef
CC
106742008-04-04 Cary Coutant <ccoutant@google.com>
10675
10676 * symtab.h (Symbol::is_weak_undefined): New function.
10677 (Symbol::is_strong_undefined): New function.
10678 (Symbol::is_absolute): New function.
10679 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10680 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10681 absolute symbols.
10682 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10683 (weak_undef_test): New target.
10684 * testsuite/Makefile.in: Rebuild.
10685 * testsuite/weak_undef_file1.cc: New file.
10686 * testsuite/weak_undef_file2.cc: New file.
10687 * testsuite/weak_undef_test.cc: New file.
10688
126f3ece
ILT
106892008-04-03 Craig Silverstein <csilvers@google.com>
10690
10691 * compressed_output.h (class Output_compressed_section): Use
10692 unsigned buffer.
10693 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10694 add zlib header.
10695 (zlib_compressed_suffix): Removed.
10696 (Output_compressed_section::set_final_data_size): Use unsigned
10697 buffers.
10698 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10699 Fix linker invocation.
10700 (flagstest_o_specialfile_and_compress_debug_sections):
10701 Likewise.
10702 * testsuite/Makefile.in: Regenerated.
10703
deae2a14
DM
107042008-04-02 David S. Miller <davem@davemloft.net>
10705
10706 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10707 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10708
70752818
ILT
107092008-04-02 Craig Silverstein <csilvers@google.com>
10710
10711 * TODO: New file.
10712
39d0cb0e
ILT
107132008-04-02 Ian Lance Taylor <iant@google.com>
10714
10715 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10716 parameters. Update for new key type to views_. Change all
10717 callers.
10718 (File_read::read): Adjust for byteshift in returned view.
10719 (File_read::add_view): New function, broken out of
10720 find_and_make_view.
10721 (File_read::make_view): New function, broken out of
10722 find_and_make_view.
10723 (File_read::find_or_make_view): Add offset and aligned
10724 parameters. Rewrite accordingly. Change all callers.
10725 (File_read::get_view): Add offset and aligned parameters. Adjust
10726 for byteshift in return value.
10727 (File_read::get_lasting_view): Likewise.
10728 * fileread.h (class File_read): Update declarations.
10729 (class File_read::View): Add byteshift_ field. Add byteshift to
10730 constructor. Add byteshift method.
10731 * archive.h (Archive::clear_uncached_views): New function.
10732 (Archive::get_view): Add aligned parameter. Change all callers.
10733 * object.h (Object::get_view): Add aligned parameter. Change all
10734 callers.
10735 (Object::get_lasting_view): Likewise.
10736
10737 * fileread.cc (File_read::release): Don't call clear_views if
10738 there are multiple objects.
10739 * fileread.h (File_read::clear_uncached_views): New function.
10740 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10741 on the archive.
10742
a1207466
CC
107432008-03-31 Cary Coutant <ccoutant@google.com>
10744
10745 Add thin archive support.
10746 * archive.cc (Archive::armagt): New const.
10747 (Archive::setup): Remove task parameter and calls to unlock.
10748 (Archive::unlock_nested_archives): New function.
10749 (Archive::read_header): Add nested_off parameter. Change
10750 all callers.
10751 (Archive::interpret_header): Likewise.
10752 (Archive::include_all_members): Change to handle thin
10753 archives.
10754 (Archive::include_member): Likewise.
10755 * archive.h (Archive::Archive): Add new parameters and
10756 initializers.
10757 (Archive::armagt): New const.
10758 (Archive::setup): Remove task parameter.
10759 (Archive::unlock_nested_archives): New function.
10760 (Archive::read_header): Add nested_off parameter.
10761 (Archive::interpret_header): Likewise.
10762 (Archive::Nested_archive_table): New typedef.
10763 (Archive::is_thin_archive_): New field.
10764 (Archive::nested_archives_): New field.
10765 (Archive::options_): New field.
10766 (Archive::dirpath_): New field.
10767 (Archive::task_): New field.
10768 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10769 for thin archives. Pass additional parameters to
10770 Archive::Archive. Unlock the archive file after calling
10771 Archive::setup.
cd536b21 10772
479f6503
ILT
107732008-03-29 Ian Lance Taylor <iant@google.com>
10774
686c8caf
ILT
10775 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10776 version symbol to be local.
10777 * testsuite/ver_test_4.sh: New file.
10778 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10779 (check_DATA): Add ver_test_4.syms.
10780 (ver_test_4.syms): New target.
10781 * testsuite/Makefile.in: Rebuild.
10782
ab794b6b
ILT
10783 * output.cc
10784 (Output_section::Input_section_sort_entry::has_priority): New
10785 function.
10786 (Output_section::Input_section_sort_entry::match_file_name): New
10787 function.
10788 (Output_section::Input_section_sort_entry::match_section_name):
10789 Remove.
10790 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10791 Remove.
10792 (Output_section::Input_section_sort_entry::match_section_file):
10793 Remove.
10794 (Output_section::Input_section_sort_compare::operator()): Rewrite
10795 using new Input_section_sort_entry functions. Sort crtbegin and
10796 crtend first. Sort sections with no priority before sections with
10797 a priority.
10798 * testsuite/initpri1.c (d3): Check j != 4.
10799 (cd5): New constructor/destructor function.
10800 (main): Check j != 2.
10801
479f6503
ILT
10802 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10803 new symbol when resolving, don't call set_is_default.
10804 * testsuite/ver_test_7.cc: New file.
10805 * testsuite/ver_test_7.sh: New file.
10806 * testsuite/Makefile.am (ver_test_7.so): New target.
10807 (ver_test_7.o): New target.
10808 (check_SCRIPTS): Add ver_test_7.sh.
10809 (check_DATA): Add ver_test_7.syms.
10810 (ver_test_7.syms): New target.
10811
2fd32231
ILT
108122008-03-28 Ian Lance Taylor <iant@google.com>
10813
10814 * layout.cc (Layout::layout): If we see an input section with a
10815 name that needs sorting, set the must_sort flag for the output
10816 section.
10817 (Layout::make_output_section): If the name of the output section
10818 indicates that it might require sorting, set the may_sort flag.
10819 * output.h (Output_section::may_sort_attached_input_sections): New
10820 function.
10821 (Output_section::set_may_sort_attached_input_sections): New
10822 function.
10823 (Output_section::must_sort_attached_input_sections): New
10824 function.
10825 (Output_section::set_must_sort_attached_input_sections): New
10826 function.
10827 (class Output_section): Declare Input_section_sort_entry. Define
10828 Input_section_sort_compare. Declare
10829 sort_attached_input_sections. Add new fields:
10830 may_sort_attached_input_sections_,
10831 must_sort_attached_input_sections_,
10832 attached_input_sections_are_sorted_.
10833 * output.cc (Output_section::Output_section): Initialize new
10834 fields.
10835 (Output_section::add_input_section): Add an entry to
10836 input_sections_ if may_sort or must_sort are true.
10837 (Output_section::set_final_data_size): Call
10838 sort_attached_input_sections if necessary.
10839 (Output_section::Input_section_sort_entry): Define new class.
10840 (Output_section::Input_section_sort_compare::operator()): New
10841 function.
10842 (Output_section::sort_attached_input_sections): New function.
10843 * configure.ac: Check whether the compiler supports constructor
10844 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10845 * testsuite/initpri1.c: New file.
10846 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10847 CONSTRUCTOR_PRIORITY.
10848 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10849 (initpri1_LDFLAGS): New variable.
10850 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10851
18e6b24e
ILT
108522008-03-27 Ian Lance Taylor <iant@google.com>
10853
49bdd526
ILT
10854 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10855 * testsuite/common_test_1.c: New file.
10856 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10857 (common_test_1_SOURCES): New variable.
10858 (common_test_1_DEPENDENCIES): New variable.
10859 (common_test_1_LDFLAGS): New variable.
10860
18e6b24e
ILT
10861 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10862 and commons_ correctly when NAME/VERSION does not override
10863 NAME/NULL.
10864 * testsuite/ver_test_6.c: New file.
10865 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10866 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10867 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10868
04bf7072
ILT
108692008-03-26 Ian Lance Taylor <iant@google.com>
10870
5871526f
ILT
10871 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10872 of an undefined symbol from a version script.
10873 * testsuite/Makefile.am (ver_test_5.so): New target.
10874 (ver_test_5.o): New target.
10875 (check_SCRIPTS): Add ver_test_5.sh.
10876 (check_DATA): Add ver_test_5.syms.
10877 (ver_test_5.syms): New target.
10878 * testsuite/ver_test_5.cc: New file.
10879 * testsuite/ver_test_5.script: New file.
10880 * testsuite/ver_test_5.sh: New file.
10881 * Makefile.in, testsuite/Makefile.in: Rebuild.
10882
04bf7072
ILT
10883 PR gold/5986
10884 Fix problems building gold with gcc 4.3.0.
10885 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10886 (gold_error_at_location, gold_warning_at_location): Use it.
10887 * configure.ac: Check whether we can compile and use a template
10888 function with a printf attribute.
10889 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10890 when jumping over bytes.
10891 * object.cc: Instantiate Object::read_section_data.
10892 * debug.h: Include <cstring>
10893 * dwarf_reader.cc: Include <algorithm>
10894 * main.cc: Include <cstring>.
10895 * options.cc: Include <cstring>.
10896 * output.cc: Include <cstring>.
10897 * script.cc: Include <cstring>.
10898 * script.h: Include <string>.
10899 * symtab.cc: Include <cstring> and <algorithm>.
10900 * target-select.cc: Include <cstring>.
10901 * version.cc: Include <string>.
10902 * testsuite/testmain.cc: Include <cstdlib>.
10903 * configure, config.in: Rebuild.
10904
874c5b28
ILT
109052008-03-25 Ian Lance Taylor <iant@google.com>
10906
819d6c3a
ILT
10907 * options.cc: Include "../bfd/bfdver.h".
10908 (options::help): Print bug reporting address.
10909
f4b2c6f5
ILT
10910 * version.cc (print_version): Adjust output for current value of
10911 BFD_VERSION_STRING.
10912
10913 * NEWS: New file.
10914
e96caa79
ILT
10915 * options.cc (options::help): Print list of supported targets.
10916 * target-select.h: Include <vector>.
10917 (class Target_selector): Make machine_, size_, and is_big_endian_
10918 fields const. Add bfd_name_ and instantiated_target_ fields.
10919 (Target_selector::Target_selector): Add bfd_name parameter.
10920 (Target_selector::recognize): Make non-virtual, call
10921 do_recognize.
10922 (Target_selector::recognize_by_name): Make non-virtual, call
10923 do_recognize_by_name.
10924 (Target_selector::supported_names): New function.
10925 (Target_selector::bfd_name): New function.
10926 (Target_selector::do_instantiate_target): New pure virtual
10927 function.
10928 (Target_selector::do_recognize): New virtual function.
10929 (Target_selector::do_recognize_by_name): New virtual function.
10930 (Target_selector::instantiate_target): New private function.
10931 (supported_target_names): Declare.
10932 * target-select.cc (Target_selector::Target_selector): Update for
10933 new parameter and fields.
10934 (select_target_by_name): Check that the name matches before
10935 calling recognize_by_name.
10936 (supported_target_names): New function.
10937 * i386.cc (class Target_selector_i386): Update Target_selector
10938 constructor call. Remove recognize and recognize_by_name. Add
10939 do_instantiate_target.
10940 * x86_64.cc (class Target_selector_x86_64): Likewise.
10941 * testsuite/testfile.cc (class Target_selector_test): Update for
10942 changes to Target_selector.
10943
874c5b28
ILT
10944 * README: Rewrite, with some notes on unsupported features.
10945
0a65a3a7
CC
109462008-03-24 Cary Coutant <ccoutant@google.com>
10947
10948 * i386.cc (Target_i386::Got_type): New enum declaration.
10949 (Target_i386::Scan::local): Updated callers of Output_data_got
10950 member functions.
10951 (Target_i386::Scan::global): Likewise.
10952 (Target_i386::Relocate::relocate): Likewise.
10953 (Target_i386::Relocate::relocate_tls): Likewise.
10954 * object.h (Got_offset_list): New class.
10955 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10956 (Sized_relobj::local_got_offset): Likewise.
10957 (Sized_relobj::set_local_got_offset): Likewise.
10958 (Sized_relobj::local_has_tls_got_offset): Removed.
10959 (Sized_relobj::local_tls_got_offset): Removed.
10960 (Sized_relobj::set_local_tls_got_offset): Removed.
10961 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10962 * output.cc (Output_data_got::add_global): Added got_type parameter.
10963 (Output_data_got::add_global_with_rel): Likewise.
10964 (Output_data_got::add_global_with_rela): Likewise.
10965 (Output_data_got::add_global_pair_with_rel): New function.
10966 (Output_data_got::add_global_pair_with_rela): New function.
10967 (Output_data_got::add_local): Added got_type parameter.
10968 (Output_data_got::add_local_with_rel): Likewise.
10969 (Output_data_got::add_local_with_rela): Likewise.
10970 (Output_data_got::add_local_pair_with_rel): New function.
10971 (Output_data_got::add_local_pair_with_rela): New function.
10972 (Output_data_got::add_global_tls): Removed.
10973 (Output_data_got::add_global_tls_with_rel): Removed.
10974 (Output_data_got::add_global_tls_with_rela): Removed.
10975 (Output_data_got::add_local_tls): Removed.
10976 (Output_data_got::add_local_tls_with_rel): Removed.
10977 (Output_data_got::add_local_tls_with_rela): Removed.
10978 * output.h (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 * resolve.cc (Symbol::override_base_with_special): Removed
10995 reference to has_got_offset_ field.
10996 * symtab.cc (Symbol::init_fields): Replaced initialization
10997 of got_offset_ with got_offsets_. Removed initialization
10998 of has_got_offset_
53fcba31 10999 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
11000 (Symbol::got_offset): Likewise.
11001 (Symbol::set_got_offset): Likewise.
11002 (Symbol::has_tls_got_offset): Removed.
11003 (Symbol::tls_got_offset): Removed.
11004 (Symbol::set_tls_got_offset): Removed.
11005 (Symbol::got_offset_): Removed.
11006 (Symbol::tls_mod_got_offset_): Removed.
11007 (Symbol::tls_pair_got_offset_): Removed.
11008 (Symbol::got_offsets_): New field.
11009 (Symbol::has_got_offset): Removed.
11010 (Symbol::has_tls_mod_got_offset): Removed.
11011 (Symbol::has_tls_pair_got_offset): Removed.
11012 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11013 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11014 member functions.
11015 (Target_x86_64::Scan::global): Likewise.
11016 (Target_x86_64::Relocate::relocate): Likewise.
11017 (Target_x86_64::Relocate::relocate_tls): Likewise.
11018
bd52eafb
BE
110192008-03-25 Ben Elliston <bje@au.ibm.com>
11020
11021 * yyscript.y: Fix spelling error in comment.
11022
8b105e34
ILT
110232008-03-24 Ian Lance Taylor <iant@google.com>
11024
8ed814a9
ILT
11025 * options.h (class General_options): Define build_id option.
11026 * layout.h (class Layout): Declare write_build_id, create_note,
11027 create_build_id. Add build_id_note_ member.
11028 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11029 "libiberty.h", "md5.h", "sha1.h".
11030 (Layout::Layout): Initialize eh_frame_data_,
11031 eh_frame_hdr_section_, and build_id_note_.
11032 (Layout::finalize): Call create_build_id.
11033 (Layout::create_note): New function, broken out of
11034 Layout::create_gold_note.
11035 (Layout::create_gold_note): Call create_note.
11036 (Layout::create_build_id): New function.
11037 (Layout::write_build_id): New function.
11038 (Close_task_runner::run): Call write_build_id.
11039
8b105e34
ILT
11040 * x86_64.cc: Correct license to GPLv3.
11041
086a1841
ILT
110422008-03-23 Ian Lance Taylor <iant@google.com>
11043
11044 * options.cc: Include "demangle.h".
11045 (parse_optional_string): New function.
11046 (parse_long_option): Handle takes_optional_argument.
11047 (parse_short_option): Update dash_z initializer. Handle
11048 takes_optional_argument.
11049 (General_options::General_options): Initialize do_demangle_.
11050 (General_options::finalize): Set do_demangle_. Handle demangling
11051 style.
11052 * options.h (parse_optional_string): Declare.
11053 (struct One_option): Add optional_arg field. Update constructor.
11054 Update call constructor calls. Add takes_optional_argument
11055 function.
11056 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11057 (DEFINE_optional_string): Define.
11058 (General_options::demangle): Change from DEFINE_bool to
11059 DEFINE_optional_string.
11060 (General_options::no_demangle): New function.
11061 (General_options::do_demangle): New function.
11062 (General_options::set_do_demangle): New function.
11063 (General_options::execstack_status_): Move definition to end of
11064 class definition.
11065 (General_options::static_): Likewise.
11066 (General_options::do_demangle_): New field.
11067 * object.cc (big_endian>::get_symbol_location_info): Call
11068 Options::do_demangle, not Options::demangle.
11069 * symtab.cc (demangle): Likewise.
11070
cbb93e63
ILT
110712008-03-22 Ian Lance Taylor <iant@google.com>
11072
11073 * gold.h: Include <cstddef> and <sys/types.h>
11074 * options.h: Include <cstring>.
11075
ec531623
ILT
110762008-03-21 Ian Lance Taylor <iant@google.com>
11077
11078 * Added source code to GNU binutils.
This page took 0.647051 seconds and 4 git commands to generate.