PR gold/12804
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
4fb3a1c3
CC
12011-06-09 Cary Coutant <ccoutant@google.com>
2
3 PR gold/12804
4 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5 used with --compress-debug-sections.
6 * gold/object.cc (Sized_relobj_file::do_layout): Report
7 uncompressed size of compressed input sections.
8
61220854
CC
92011-06-08 Cary Coutant <ccoutant@google.com>
10
11 PR gold/12804
12 * testsuite/two_file_test_2_v1.cc: Change initialization of
13 v2 to keep it in .data.
14
e6455dfb
CC
152011-06-07 Cary Coutant <ccoutant@google.com>
16
17 * common.cc (Symbol_table::do_allocate_commons_list): Call
18 gold_fallback.
19 * errors.cc (Errors::fatal): Adjust call to gold_exit.
20 (Errors::fallback): New function.
21 (gold_fallback): New function.
22 * errors.h (Errors::fallback): New function.
23 * gold.cc (gold_exit): Change status parameter to enum; adjust
24 all callers.
25 (queue_initial_tasks): Call gold_fallback.
26 * gold.h: Include cstdlib.
27 (Exit_status): New enum type.
28 (gold_exit): Change status parameter to enum.
29 (gold_fallback): New function.
30 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
31 (Layout::create_symtab_sections): Likewise.
32 (Layout::create_shdrs): Likewise.
33 * main.cc (main): Adjust call to gold_exit.
34 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
35 (Output_data_got::add_got_entry_pair): Likewise.
36 (Output_section::add_input_section): Likewise.
37 (Output_section::add_output_section_data): Likewise.
38 (Output_segment::set_section_list_addresses): Likewise.
39 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
40
fb0e076f
CC
412011-06-07 Cary Coutant <ccoutant@google.com>
42
43 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
44 for incremental links.
45 * output.cc (Output_segment::set_section_list_addresses): Remove
46 FIXME and test for TLS or BSS.
47
a5ee4d5d
CC
482011-06-07 Cary Coutant <ccoutant@google.com>
49
50 * testsuite/Makefile.am: Add incremental_copy_test,
51 incremental_common_test_1.
52 * testsuite/Makefile.in: Regenerate.
53 * testsuite/common_test_1_v1.c: New source file.
54 * testsuite/common_test_1_v2.c: New source file.
55 * testsuite/copy_test_v1.cc: New source file.
56
5146f448
CC
572011-06-07 Cary Coutant <ccoutant@google.com>
58
59 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
60 update, allocate common from bss section's free list.
61 * incremental-dump.cc (dump_incremental_inputs): Print flag for
62 linker-defined symbols.
63 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
64 Skip GOT and PLT entries that are no longer referenced.
65 (Output_section_incremental_inputs::write_info_blocks): Mark
66 linker-defined symbols.
67 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
68 * output.cc (Output_section::allocate): New function.
69 * output.h (Output_section::allocate): New function.
70 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
71 linker-defined symbols.
72 (Symbol::override_base_with_special): Copy is_predefined_ flag.
73 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
74 (Symbol::init_base_output_data): Likewise.
75 (Symbol::init_base_output_segment): Likewise.
76 (Symbol::init_base_constant): Likewise.
77 (Sized_symbol::init_output_data): Likewise.
78 (Sized_symbol::init_output_segment): Likewise.
79 (Sized_symbol::init_constant): Likewise.
80 (Symbol_table::do_define_in_output_data): Likewise.
81 (Symbol_table::do_define_in_output_segment): Likewise.
82 (Symbol_table::do_define_as_constant): Likewise.
83 * symtab.h (Symbol::is_predefined): New function.
84 (Symbol::init_base_output_data): Add is_predefined parameter.
85 (Symbol::init_base_output_segment): Likewise.
86 (Symbol::init_base_constant): Likewise.
87 (Symbol::is_predefined_): New data member.
88 (Sized_symbol::init_output_data): Add is_predefined parameter.
89 (Sized_symbol::init_output_segment): Likewise.
90 (Sized_symbol::init_constant): Likewise.
91 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
92
26d3c67d
CC
932011-06-07 Cary Coutant <ccoutant@google.com>
94
95 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
96 instead of emit_copy_reloc.
97 (Copy_relocs::emit_copy_reloc): Refactor.
98 (Copy_relocs::make_copy_reloc): New function.
99 (Copy_relocs::add_copy_reloc): Remove.
100 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
101 section.
102 (Copy_relocs::make_copy_reloc): New function.
103 (Copy_relocs::add_copy_reloc): Remove.
104 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
105 unchanged input files.
106 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
107 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
108 Reserve BSS space for COPY relocations.
109 (Sized_incremental_binary::do_emit_copy_relocs): New function.
110 (Output_section_incremental_inputs::write_info_blocks): Record
111 whether a symbol is copied from a shared object.
112 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
113 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
114 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
115 (Incremental_input_entry_reader::get_output_symbol_index): Add
116 is_copy parameter.
117 (Incremental_binary::emit_copy_relocs): New function.
118 (Incremental_binary::do_emit_copy_relocs): New function.
119 (Sized_incremental_binary::Sized_incremental_binary): Initialize
120 new data member.
121 (Sized_incremental_binary::add_copy_reloc): New function.
122 (Sized_incremental_binary::do_emit_copy_relocs): New function.
123 (Sized_incremental_binary::Copy_reloc): New struct.
124 (Sized_incremental_binary::Copy_relocs): New typedef.
125 (Sized_incremental_binary::copy_relocs_): New data member.
126 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
127 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
128 * target.h (Sized_target::emit_copy_reloc): New function.
129 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
130
7cdb37d9
CC
1312011-06-02 Cary Coutant <ccoutant@google.com>
132
133 PR gold/12163
134 * gold/archive.cc (Archive::Archive): Initialize new data member.
135 (Archive::include_all_members): Return if archive has already been
136 included.
137 * gold/archive.h (Archive::include_all_members_): New data member.
138
cc643b88
NC
1392011-06-02 Nick Clifton <nickc@redhat.com>
140
141 * dynobj.h: Fix spelling mistake in comment.
142 * output.cc: Likewise.
143
f62a3ca7
DK
1442011-05-31 Doug Kwan <dougkwan@google.com>
145 Asier Llano
146
147 PR gold/12826
cc643b88 148 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
149 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
150 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
151 redundant arm_exidx_test.so.
152 * testsuite/Makefile.in: Regenerate.
153 (check_SCRIPTS): Add pr12826.sh
154 (check_DATA): Add pr12826.stdout
155 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
156 * testsuite/pr12826.sh: New file.
157 * testsuite/pr12826_1.s: Ditto.
158 * testsuite/pr12826_1.s: Ditto.
159
8dbe1edc
ILT
1602011-05-30 Ian Lance Taylor <iant@google.com>
161
162 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
163 sections.
164
c49875be
ILT
1652011-05-29 Ian Lance Taylor <iant@google.com>
166
167 PR gold/12804
168 * testsuite/Makefile.am: Use different file name for two_file_test
169 temporary file for each incremental test.
170 * testsuite/Makefile.in: Rebuild.
171
69d53f7a
ILT
1722011-05-29 Ian Lance Taylor <iant@google.com>
173
174 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
175 binary input file is empty.
176
41d0ab5f
ILT
1772011-05-27 Ian Lance Taylor <iant@google.com>
178
179 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
180 (ver_test_9.so): Likewise.
181 * testsuite/Makefile.in: Rebuild.
182
89d8a36b
CC
1832011-05-26 Cary Coutant <ccoutant@google.com>
184
185 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
186 * incremental.cc (Incremental_inputs::report_input_section): Fix
187 comment, indentation.
188 (Incremental_inputs::report_comdat_group): New function.
189 (Output_section_incremental_inputs::set_final_data_size): Adjust size
190 of data for incremental input file entry.
191 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
192 group count, COMDAT group signatures.
193 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
194 an unchanged input file.
195 * incremental.h (Incremental_object_entry::Incremental_object_entry):
196 Initialize new data member.
197 (Incremental_object_entry::add_comdat_group): New function.
198 (Incremental_object_entry::get_comdat_group_count): New function.
199 (Incremental_object_entry::get_comdat_signature_key): New function.
200 (Incremental_object_entry::groups_): New data member.
201 (Incremental_inputs::report_comdat_group): New function.
202 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
203 data for incremental input file entry.
204 (Incremental_input_entry_reader::get_comdat_group_count): New function.
205 (Incremental_input_entry_reader::get_input_section): Adjust size of
206 data for incremental input file entry.
207 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
208 (Incremental_input_entry_reader::get_comdat_group_signature): New
209 function.
210 * object.cc (Sized_relobj::include_section_group): Report kept
211 COMDAT groups for incremental links.
212
1706a06f
ILT
2132011-05-24 David Meyer <pdox@google.com>
214
215 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
216 with name parameter. Add found_name parameter.
217 * fileread.cc (Input_file::find_file): Adjust code accordingly.
218 * dirsearch.h (class Dirsearch): Update declaration.
219
a10ae760
ILT
2202011-05-24 Ian Lance Taylor <iant@google.com>
221
222 * archive.cc (Library_base::should_include_member): Pull in object
223 from archive if it defines the entry symbol.
224 * parameters.cc (Parameters::entry): New function.
225 * parameters.h (class Parameters): Declare entry.
226 * output.h (class Output_file_header): Remove entry_ field.
227 * output.cc (Output_file_header::Output_file_header): Remove entry
228 parameter. Change all callers.
229 (Output_file_header::entry): Use parameters->entry.
230 * gold.cc (queue_middle_tasks): Likewise.
231 * plugin.cc (Plugin_hook::run): Likewise.
232
aa92d6ed
CC
2332011-05-24 Cary Coutant <ccoutant@google.com>
234
235 * gold.cc (queue_initial_tasks): Pass incremental base filename
236 to Output_file::open_base_file; don't print error message.
237 * incremental-dump.cc (main): Adjust call to
238 Output_file::open_for_modification.
239 * incremental-dump.cc (main): Likewise.
240 * incremental.cc (Incremental_inputs::report_command_line):
241 Ignore --incremental-base option when comparing command lines.
242 Ignore parameter when given as separate argument.
243 * options.h (class General_options): Add --incremental-base.
244 * output.cc (Output_file::Output_file):
245 (Output_file::open_base_file): Add base_name and writable parameters;
246 read base file into new file; print error message here.
247 (Output_file::map_no_anonymous): Add writable parameter; adjust all
248 callers.
249 * output.h (Output_file::open_for_modification): Rename to...
250 (Output_file::open_base_file): ...this; add base_name and
251 writable parameters; adjust all callers.
252 (Output_file::map_no_anonymous): Add writable parameter; adjust all
253 callers.
254 * testsuite/Makefile.am (incremental_test_4): Test
255 --incremental-base.
256 * testsuite/Makefile.in: Regenerate.
257
2eedd706
CC
2582011-05-24 Cary Coutant <ccoutant@google.com>
259
260 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
261 incremental_test_4.
262 * testsuite/Makefile.in: Regenerate.
263 * testsuite/two_file_test_1_v1.cc: New test source file.
264 * testsuite/two_file_test_1b_v1.cc: New test source file.
265 * testsuite/two_file_test_2_v1.cc: New test source file.
266
0f1c85a6
CC
2672011-05-24 Cary Coutant <ccoutant@google.com>
268
269 * dynobj.h (Dynobj::do_dynobj): New function.
270 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
271 flag and soname for shared objects.
272 * incremental.cc (Incremental_inputs::report_object): Make
273 either Incremental_object_entry or Incremental_dynobj_entry; add
274 soname to string table.
275 (Incremental_inputs::report_input_section): Add assertion.
276 (Output_section_incremental_inputs::set_final_data_size): Adjust
277 type of input file entry for shared libraries; adjust size of
278 shared library info entry.
279 (Output_section_incremental_inputs::write_input_files): Write
280 as_needed flag for shared libraries.
281 (Output_section_incremental_inputs::write_info_blocks): Adjust type
282 of input file entry for shared libraries; write soname.
283 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
284 soname from incremental info.
285 * incremental.h (enum Incremental_input_flags): Add
286 INCREMENTAL_INPUT_AS_NEEDED.
287 (Incremental_input_entry::Incremental_input_entry): Initialize new
288 data member.
289 (Incremental_input_entry::set_as_needed): New function.
290 (Incremental_input_entry::as_needed): New function.
291 (Incremental_input_entry::do_dynobj_entry): New function.
292 (Incremental_input_entry::as_needed_): New data member.
293 (Incremental_object_entry::Incremental_object_entry): Don't check
294 for shared library.
295 (Incremental_object_entry::do_type): Likewise.
296 (class Incremental_dynobj_entry): New class.
297 (Incremental_input_entry_reader::as_needed): New function.
298 (Incremental_input_entry_reader::get_soname): New function.
299 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
300 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
301 size of shared library info entry.
302 * layout.cc (Layout::finish_dynamic_section): Don't test for
303 incremental link when adding DT_NEEDED entries.
304 * object.h (Object::Object): Initialize new data member.
305 (Object::dynobj): New function.
306 (Object::set_as_needed): New function.
307 (Object::as_needed): New function.
308 (Object::do_dynobj): New function.
309 (Object::as_needed_): New data member.
310
6fa2a40b
CC
3112011-05-24 Cary Coutant <ccoutant@google.com>
312
313 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
314 info; adjust display of GOT entries.
315 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
316 vector of input objects; remove file_status_.
317 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
318 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
319 got_plt reader; call target hooks to reserve GOT entries.
320 (Output_section_incremental_inputs::set_final_data_size): Adjust size
321 of input file info header and GOT info entry.
322 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
323 relocation info.
324 (Got_plt_view_info::got_descriptor): Remove.
325 (Got_plt_view_info::sym_index): New data member.
326 (Got_plt_view_info::input_index): New data member.
327 (Local_got_offset_visitor::visit): Write input file index.
328 (Global_got_offset_visitor::visit): Write 0 for input file index.
329 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
330 with sym_index and input_index.
331 (Output_section_incremental_inputs::write_got_plt): Adjust size of
332 incremental info GOT entry; replace got_descriptor with input_index.
333 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
334 map from input file index to object.
335 (Sized_relobj_incr::do_layout): Replace direct data member reference
336 with accessor function.
337 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
338 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
339 Adjust size of input file info header.
340 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
341 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
342 (Incremental_input_entry_reader::get_input_section): Adjust size of
343 input file info header.
344 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
345 of incremental info GOT entry.
346 (Incremental_got_plt_reader::get_got_desc): Remove.
347 (Incremental_got_plt_reader::get_got_symndx): New function.
348 (Incremental_got_plt_reader::get_got_input_index): New function.
349 (Sized_incremental_binary::Sized_incremental_binary): Remove
350 file_status_; add input_objects_.
351 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
352 (Sized_incremental_binary::set_file_is_unchanged): Remove.
353 (Sized_incremental_binary::file_is_unchanged): Remove.
354 (Sized_incremental_binary::set_input_object): New function.
355 (Sized_incremental_binary::input_object): New function.
356 (Sized_incremental_binary::file_status_): Remove.
357 (Sized_incremental_binary::input_objects_): New data member.
358 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
359 references.
360 (Sized_relobj_incr::invalid_address): Move to base class.
361 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
362 class.
363 (Sized_relobj_incr::do_output_section_offset): Likewise.
364 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
365 (Sized_relobj_incr::section_offsets_): Likewise.
366 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
367 function.
368 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
369 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
370 with accessor function.
371 (Sized_relobj_file::do_layout): Likewise.
372 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
373 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
374 (Sized_relobj_file::compute_final_local_value): Replace refs to
375 section_offsets_ with accessor function.
376 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
377 * object.h (Relobj::Relobj): Initialize new data members.
378 (Relobj::add_dyn_reloc): New function.
379 (Relobj::first_dyn_reloc): New function.
380 (Relobj::dyn_reloc_count): New function.
381 (Relobj::first_dyn_reloc_): New data member.
382 (Relobj::dyn_reloc_count_): New data member.
383 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
384 references.
385 (Sized_relobj::Address): New typedef.
386 (Sized_relobj::invalid_address): Move here from child class.
387 (Sized_relobj::Sized_relobj): Initialize new data members.
388 (Sized_relobj::sized_relobj): New function.
389 (Sized_relobj::is_output_section_offset_invalid): Move here from
390 child class.
391 (Sized_relobj::get_output_section_offset): Likewise.
392 (Sized_relobj::local_has_got_offset): Likewise.
393 (Sized_relobj::local_got_offset): Likewise.
394 (Sized_relobj::set_local_got_offset): Likewise.
395 (Sized_relobj::do_for_all_local_got_entries): Likewise.
396 (Sized_relobj::clear_got_offsets): New function.
397 (Sized_relobj::section_offsets): Move here from child class.
398 (Sized_relobj::do_output_section_offset): Likewise.
399 (Sized_relobj::do_set_section_offset): Likewise.
400 (Sized_relobj::Local_got_offsets): Likewise.
401 (Sized_relobj::local_got_offsets_): Likewise.
402 (Sized_relobj::section_offsets_): Likewise.
403 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
404 references.
405 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
406 class.
407 (Sized_relobj_file::sized_relobj): New function
408 (Sized_relobj_file::local_has_got_offset): Move to base class.
409 (Sized_relobj_file::local_got_offset): Likewise.
410 (Sized_relobj_file::set_local_got_offset): Likewise.
411 (Sized_relobj_file::get_output_section_offset): Likewise.
412 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
413 (Sized_relobj_file::do_output_section_offset): Likewise.
414 (Sized_relobj_file::do_set_section_offset): Likewise.
415 (Sized_relobj_file::Local_got_offsets): Likewise.
416 (Sized_relobj_file::local_got_offsets_): Likewise.
417 (Sized_relobj_file::section_offsets_): Likewise.
418 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
419 (all constructors).
420 (set_needs_dynsym_index): Convert relobj to derived class pointer.
421 (Output_reloc::get_symbol_index): Likewise.
422 (Output_reloc::local_section_offset): Likewise.
423 (Output_reloc::get_address): Likewise.
424 (Output_reloc::symbol_value): Likewise.
425 (Output_data_got::reserve_slot): Move to class definition.
426 (Output_data_got::reserve_local): New function.
427 (Output_data_got::reserve_slot_for_global): Remove.
428 (Output_data_got::reserve_global): New function.
429 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
430 (all constructors, two instantiations).
431 (Output_reloc::get_relobj): New function (two instantiations).
432 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
433 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
434 (Output_data_reloc::add_global): Adjust type of relobj.
435 (Output_data_reloc::add_global_relative): Likewise.
436 (Output_data_reloc::add_symbolless_global_addend): Likewise.
437 (Output_data_reloc::add_local): Likewise.
438 (Output_data_reloc::add_local_relative): Likewise.
439 (Output_data_reloc::add_symbolless_local_addend): Likewise.
440 (Output_data_reloc::add_local_section): Likewise.
441 (Output_data_reloc::add_output_section): Likewise.
442 (Output_data_reloc::add_absolute): Likewise.
443 (Output_data_reloc::add_target_specific): Likewise.
444 (Output_data_got::reserve_slot): Move definition here.
445 (Output_data_got::reserve_local): New function.
446 (Output_data_got::reserve_global): New function.
447 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
448 section_offsets_ with accessor function.
449 (Sized_relobj_file::write_sections): Likewise.
450 (Sized_relobj_file::do_relocate_sections): Likewise.
451 * target.h (Sized_target::reserve_local_got_entry): New function.
452 (Sized_target::reserve_global_got_entry): New function.
453 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
454 (Target_x86_64::reserve_global_got_entry): New function.
455 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
456
4829d394
CC
4572011-05-23 Cary Coutant <ccoutant@google.com>
458
459 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
460 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
461 bit when checking got_type.
462 * incremental.cc (Sized_incremental_binary::setup_readers):
463 Store symbol table and string table locations; initialize bit vector
464 of file status flags.
465 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
466 unchanged files.
467 (Sized_incremental_binary::do_process_got_plt): New function.
468 (Sized_incremental_binary::get_symtab_view): Use stored locations.
469 (Output_section_incremental_inputs::set_final_data_size): Record
470 file index for each input file.
471 (Output_section_incremental_inputs::write_got_plt): Store file index
472 instead of input entry offset for each GOT entry.
473 * incremental.h
474 (Incremental_input_entry::Incremental_input_entry): Initialize new
475 data member.
476 (Incremental_input_entry::set_offset): Store file index.
477 (Incremental_input_entry::get_file_index): New function.
478 (Incremental_input_entry::file_index_): New data member.
479 (Incremental_binary::process_got_plt): New function.
480 (Incremental_binary::do_process_got_plt): New function.
481 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
482 data members.
483 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
484 (Sized_incremental_binary::set_file_is_unchanged): New function.
485 (Sized_incremental_binary::file_is_unchanged): New function.
486 (Sized_incremental_binary::do_process_got_plt): New function.
487 (Sized_incremental_binary::file_status_): New data member.
488 (Sized_incremental_binary::main_symtab_loc_): New data member.
489 (Sized_incremental_binary::main_strtab_loc_): New data member.
490 * output.cc (Output_data_got::Got_entry::write): Add case
491 RESERVED_CODE.
492 (Output_data_got::add_global): Call add_got_entry.
493 (Output_data_got::add_global_plt): Likewise.
494 (Output_data_got::add_global_with_rel): Likewise.
495 (Output_data_got::add_global_with_rela): Likewise.
496 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
497 (Output_data_got::add_global_pair_with_rela): Likewise.
498 (Output_data_got::add_local): Call add_got_entry.
499 (Output_data_got::add_local_plt): Likewise.
500 (Output_data_got::add_local_with_rel): Likewise.
501 (Output_data_got::add_local_with_rela): Likewise.
502 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
503 (Output_data_got::add_local_pair_with_rela): Likewise.
504 (Output_data_got::reserve_slot): New function.
505 (Output_data_got::reserve_slot_for_global): New function.
506 (Output_data_got::add_got_entry): New function.
507 (Output_data_got::add_got_entry_pair): New function.
508 (Output_section::add_output_section_data): Edit FIXME.
509 * output.h
510 (Output_section_data_build::Output_section_data_build): New
511 constructor with size parameter.
512 (Output_data_space::Output_data_space): Likewise.
513 (Output_data_got::Output_data_got): Initialize new data member; new
514 constructor with size parameter.
515 (Output_data_got::add_constant): Call add_got_entry.
516 (Output_data_got::reserve_slot): New function.
517 (Output_data_got::reserve_slot_for_global): New function.
518 (class Output_data_got::Got_entry): Add RESERVED_CODE.
519 (Output_data_got::add_got_entry): New function.
520 (Output_data_got::add_got_entry_pair): New function.
521 (Output_data_got::free_list_): New data member.
522 * target.h (Sized_target::init_got_plt_for_update): New function.
523 (Sized_target::register_global_plt_entry): New function.
524 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
525 Initialize new data member; call init; add constructor with PLT count.
526 (Output_data_plt_x86_64::init): New function.
527 (Output_data_plt_x86_64::add_relocation): New function.
528 (Output_data_plt_x86_64::reserve_slot): New function.
529 (Output_data_plt_x86_64::free_list_): New data member.
530 (Target_x86_64::init_got_plt_for_update): New function.
531 (Target_x86_64::register_global_plt_entry): New function.
532 (Output_data_plt_x86_64::add_entry): Allocate from free list for
533 incremental updates.
534 (Output_data_plt_x86_64::add_relocation): New function.
535 * testsuite/object_unittest.cc (Object_test): Set default options.
536
ec69d6da
ILT
5372011-05-16 Ian Lance Taylor <iant@google.com>
538
539 * options.h (class General_options): Make -i a synonym for -r.
540
732e31de
ILT
5412011-05-16 Ian Lance Taylor <iant@google.com>
542
543 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
544
403676b5
CC
5452011-05-10 Cary Coutant <ccoutant@google.com>
546
547 * object.cc (Sized_relobj::do_count_local_symbols): Check for
548 strip_all (-s).
549
5b7b7d6e
ILT
5502011-05-06 Ian Lance Taylor <iant@google.com>
551
552 * layout.cc (Layout::layout): If the output section flags change,
553 update the ordering.
554
f0f9babf
CC
5552011-04-25 Cary Coutant <ccoutant@google.com>
556
557 * incremental-dump.cc (dump_incremental_inputs): Print local
558 symbol info for each input file.
559 * incremental.cc
560 (Output_section_incremental_inputs::set_final_data_size): Add local
561 symbol info to input file entries in incremental info.
562 (Output_section_incremental_inputs::write_info_blocks): Likewise.
563 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
564 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
565 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
566 implementation.
567 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
568 (Sized_incr_relobj::do_relocate): Write the local symbols.
569 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
570 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
571 Adjust size of input file header.
572 (Incremental_inputs_reader::get_local_symbol_offset): New function.
573 (Incremental_inputs_reader::get_local_symbol_count): New function.
574 (Incremental_inputs_reader::get_input_section): Adjust size of input
575 file header.
576 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
577 (Sized_incr_relobj::This): New typedef.
578 (Sized_incr_relobj::sym_size): New const data member.
579 (Sized_incr_relobj::Local_symbol): New struct.
580 (Sized_incr_relobj::do_output_local_symbol_count): New function.
581 (Sized_incr_relobj::do_local_symbol_offset): New function.
582 (Sized_incr_relobj::local_symbol_count_): New data member.
583 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
584 (Sized_incr_relobj::local_symbol_index_): New data member.
585 (Sized_incr_relobj::local_symbol_offset_): New data member.
586 (Sized_incr_relobj::local_dynsym_offset_): New data member.
587 (Sized_incr_relobj::local_symbols_): New data member.
588 * object.h (Relobj::output_local_symbol_count): New function.
589 (Relobj::local_symbol_offset): New function.
590 (Relobj::do_output_local_symbol_count): New function.
591 (Relobj::do_local_symbol_offset): New function.
592 (Sized_relobj::do_output_local_symbol_count): New function.
593 (Sized_relobj::do_local_symbol_offset): New function.
594
d0a9ace3
ILT
5952011-04-22 Vladimir Simonov <sv@sw.ru>
596
597 * descriptors.cc (set_close_on_exec): New function.
598 (Descriptors::open): Use set_close_on_exec.
599 * output.cc (S_ISLNK): Define if not defined.
600
94a3fc8b
CC
6012011-04-22 Cary Coutant <ccoutant@google.com>
602
603 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
604 global symbol map.
605 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
606 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
607 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
608 relocations.
609 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
610 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
611 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
612 * incremental.h
613 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
614 function.
615 (Incremental_binary::apply_incremental_relocs): New function.
616 (Incremental_binary::do_apply_incremental_relocs): New function.
617 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
618 data member.
619 (Sized_incremental_binary::add_global_symbol): New function.
620 (Sized_incremental_binary::global_symbol): New function.
621 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
622 (Sized_incremental_binary::symbol_map_): New data member.
623 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
624 * target.h (Sized_target::apply_relocation): New function.
625 * target-reloc.h (apply_relocation): New function.
626 * x86_64.cc (Target_x86_64::apply_relocation): New function.
627
c87e4302
DK
6282011-04-22 Doug Kwan <dougkwan@google.com>
629
630 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
631 flag of a SHT_ARM_EXIDX section.
632 * testsuite/Makefile.am (arm_exidx_test): New test rules.
633 * testsuite/Makefile.in: Regenerate.
634 * testsuite/arm_exidx_test.s: New file.
635 * testsuite/arm_exidx_test.sh: Same.
636
e7782cf6
CC
6372011-04-20 Cary Coutant <ccoutant@google.com>
638
639 PR gold/12689
640 * archive.h (Incremental_archive_entry::Archive_member):
641 Initialize arg_serial_ (second constructor).
642
308ecdc7
ILT
6432011-04-17 Ian Lance Taylor <iant@google.com>
644
645 * object.cc (Relocate_info::location): Simplify location string.
646 * errors.cc (Errors::error_at_location): Don't print program
647 name.
648 (Errors::warning_at_location): Likewise.
649 (Errors::undefined_symbol): Likewise.
650 * testsuite/debug_msg.sh: Update accordingly.
651
bec5b579
CC
6522011-04-14 Cary Coutant <ccoutant@google.com>
653
654 * gold/layout.cc (Layout::symtab_section_offset): New function.
655 * gold/layout.h (Layout::symtab_section_offset): New function.
656 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
657
88597d34
ILT
6582011-04-12 Ian Lance Taylor <iant@google.com>
659
660 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
661 with MREMAP_MAYMOVE.
662 * output.h (class Output_file): Add map_is_allocated_ field.
663 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
664 not available, provide stubs. If mremap is not available, #define
665 it to gold_mremap.
666 (MREMAP_MAYMOVE): Define if not defined.
667 (Output_file::Output_file): Initialize map_is_allocated_.
668 (Output_file::resize): Check map_is_allocated_.
669 (Output_file::map_anonymous): If mmap fails, use malloc.
670 (Output_file::unmap): Don't do anything for an anonymous map.
671 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
672 is not available, provide stubs.
673 (File_read::View::~View): Use free rather than delete[].
674 (File_read::make_view): Use malloc rather than new[]. If mmap
675 fails, use malloc.
676 (File_read::find_or_make_view): Use malloc rather than new[].
677 * gold.h: Remove HAVE_REMAP code.
678 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
679 exists. Rename mremap to gold_mremap. If mmap is not available
680 don't do anything.
681 * configure, config.in: Rebuild.
682
11e361bc
ILT
6832011-04-11 Ian Lance Taylor <iant@google.com>
684
685 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
686 initialize local variable v.
687
cdc29364
CC
6882011-04-11 Cary Coutant <ccoutant@google.com>
689
690 * archive.cc (Archive::include_member): Adjust call to
691 report_object.
692 (Add_archive_symbols::run): Track argument serial numbers.
693 (Lib_group::include_member): Likewise.
694 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
695 * archive.h (Incremental_archive_entry::Archive_member):
696 Initialize arg_serial_.
697 (Archive_member::arg_serial_): New data member.
698 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
699 (Sized_dynobj::do_add_symbols): Track symbols when doing an
700 incremental link.
701 (Sized_dynobj::do_for_all_local_got_entries): New function.
702 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
703 function.
704 * fileread.cc (get_mtime): New function.
705 * fileread.h (get_mtime): New function.
706 * gold.cc (queue_initial_tasks): Check for incremental update.
707 (process_incremental_input): New function.
708 (queue_middle_tasks): Don't force valid target for incremental
709 update.
710 * incremental-dump.cc (find_input_containing_global): Adjust
711 size of symbol info entry.
712 (dump_incremental_inputs): Dump argument serial number and
713 in_system_directory flag; bias shndx by 1; print symbol names
714 when dumping per-file symbol lists; use new symbol info readers.
715 * incremental.cc
716 (Output_section_incremental_inputs:update_data_size): New function.
717 (Sized_incremental_binary::setup_readers): Setup input readers
718 for each input file; build maps for files added from libraries
719 and scripts.
720 (Sized_incremental_binary::check_input_args): New function.
721 (Sized_incremental_binary::do_check_inputs): Build map of argument
722 serial numbers to input arguments.
723 (Sized_incremental_binary::do_file_has_changed): Rename
724 do_file_is_unchanged to this; compare file modification times.
725 (Sized_incremental_binary::do_init_layout): New function.
726 (Sized_incremental_binary::do_reserve_layout): New function.
727 (Sized_incremental_binary::do_get_input_reader): Remove.
728 (Sized_incremental_binary::get_symtab_view): New function.
729 (Incremental_checker::can_incrementally_link_output_file): Remove.
730 (Incremental_inputs::report_command_line): Exclude --debug options.
731 (Incremental_inputs::report_archive_begin): Add parameter; track
732 argument serial numbers; don't put input file entry for archive
733 before archive members.
734 (Incremental_inputs::report_archive_end): Put input file entry
735 for archive after archive members.
736 (Incremental_inputs::report_object): Add parameter; track argument
737 serial numbers and in_system_directory flag.
738 (Incremental_inputs::report_script): Add parameter; track argument
739 serial numbers.
740 (Output_section_incremental_inputs::set_final_data_size): Adjust
741 size of symbol info entry; check for forwarding symbols.
742 (Output_section_incremental_inputs::write_input_files): Write
743 in_system_directory flag and argument serial number.
744 (Output_section_incremental_inputs::write_info_blocks): Map section
745 indices between incremental info and original input file; store
746 input section index for each symbol.
747 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
748 change operator() to visit().
749 (class Global_got_offset_visitor): Likewise.
750 (class Global_symbol_visitor_got_plt):
751 (Output_section_incremental_inputs::write_got_plt): Use new visitor
752 classes.
753 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
754 (Sized_incr_relobj::do_read_symbols): New function.
755 (Sized_incr_relobj::do_layout): New function.
756 (Sized_incr_relobj::do_layout_deferred_sections): New function.
757 (Sized_incr_relobj::do_add_symbols): New function.
758 (Sized_incr_relobj::do_should_include_member): New function.
759 (Sized_incr_relobj::do_for_all_global_symbols): New function.
760 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
761 (Sized_incr_relobj::do_section_size): New function.
762 (Sized_incr_relobj::do_section_name): New function.
763 (Sized_incr_relobj::do_section_contents): New function.
764 (Sized_incr_relobj::do_section_flags): New function.
765 (Sized_incr_relobj::do_section_entsize): New function.
766 (Sized_incr_relobj::do_section_address): New function.
767 (Sized_incr_relobj::do_section_type): New function.
768 (Sized_incr_relobj::do_section_link): New function.
769 (Sized_incr_relobj::do_section_info): New function.
770 (Sized_incr_relobj::do_section_addralign): New function.
771 (Sized_incr_relobj::do_initialize_xindex): New function.
772 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
773 (Sized_incr_relobj::do_read_relocs): New function.
774 (Sized_incr_relobj::do_gc_process_relocs): New function.
775 (Sized_incr_relobj::do_scan_relocs): New function.
776 (Sized_incr_relobj::do_count_local_symbols): New function.
777 (Sized_incr_relobj::do_finalize_local_symbols): New function.
778 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
779 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
780 (Sized_incr_relobj::do_relocate): New function.
781 (Sized_incr_relobj::do_set_section_offset): New function.
782 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
783 (Sized_incr_dynobj::do_read_symbols): New function.
784 (Sized_incr_dynobj::do_layout): New function.
785 (Sized_incr_dynobj::do_add_symbols): New function.
786 (Sized_incr_dynobj::do_should_include_member): New function.
787 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
788 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
789 (Sized_incr_dynobj::do_section_size): New function.
790 (Sized_incr_dynobj::do_section_name): New function.
791 (Sized_incr_dynobj::do_section_contents): New function.
792 (Sized_incr_dynobj::do_section_flags): New function.
793 (Sized_incr_dynobj::do_section_entsize): New function.
794 (Sized_incr_dynobj::do_section_address): New function.
795 (Sized_incr_dynobj::do_section_type): New function.
796 (Sized_incr_dynobj::do_section_link): New function.
797 (Sized_incr_dynobj::do_section_info): New function.
798 (Sized_incr_dynobj::do_section_addralign): New function.
799 (Sized_incr_dynobj::do_initialize_xindex): New function.
800 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
801 (make_sized_incremental_object): New function.
802 (Incremental_library::copy_unused_symbols): New function.
803 (Incremental_library::do_for_all_unused_symbols): New function.
804 * incremental.h (enum Incremental_input_flags): New type.
805 (class Incremental_checker): Remove.
806 (Incremental_input_entry::Incremental_input_entry): Add argument
807 serial number.
808 (Incremental_input_entry::arg_serial): New function.
809 (Incremental_input_entry::set_is_in_system_directory): New function.
810 (Incremental_input_entry::is_in_system_directory): New function.
811 (Incremental_input_entry::arg_serial_): New data member.
812 (Incremental_input_entry::is_in_system_directory_): New data member.
813 (class Script_info): Move here from script.h.
814 (Script_info::Script_info): Add filename parameter.
815 (Script_info::filename): New function.
816 (Script_info::filename_): New data member.
817 (Incremental_script_entry::Incremental_script_entry): Add argument
818 serial number.
819 (Incremental_object_entry::Incremental_object_entry): Likewise.
820 (Incremental_object_entry::add_input_section): Build list of input
821 sections with map to original shndx.
822 (Incremental_object_entry::get_input_section_index): New function.
823 (Incremental_object_entry::shndx_): New data member.
824 (Incremental_object_entry::name_key_): Rename; adjust all refs.
825 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
826 (Incremental_archive_entry::Incremental_archive_entry): Add argument
827 serial number.
828 (Incremental_inputs::report_archive_begin): Likewise.
829 (Incremental_inputs::report_object): Likewise.
830 (Incremental_inputs::report_script): Likewise.
831 (class Incremental_global_symbol_reader): New class.
832 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
833 and store flags and input file type.
834 (Incremental_input_entry_reader::arg_serial): New function.
835 (Incremental_input_entry_reader::type): Extract type from flags.
836 (Incremental_input_entry_reader::is_in_system_directory): New function.
837 (Incremental_input_entry_reader::get_input_section_count): Call
838 accessor function for type.
839 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
840 function for type; adjust size of global symbol entry.
841 (Incremental_input_entry_reader::get_global_symbol_count): Call
842 accessor function for type.
843 (Incremental_input_entry_reader::get_object_count): Likewise.
844 (Incremental_input_entry_reader::get_object_offset): Likewise.
845 (Incremental_input_entry_reader::get_member_count): Likewise.
846 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
847 (Incremental_input_entry_reader::get_member_offset): Likewise.
848 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
849 (Incremental_input_entry_reader::Global_symbol_info): Remove.
850 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
851 (Incremental_input_entry_reader::get_global_symbol_reader): New
852 function.
853 (Incremental_input_entry_reader::get_output_symbol_index): New
854 function.
855 (Incremental_input_entry_reader::type_): Remove.
856 (Incremental_input_entry_reader::flags_): New data member.
857 (Incremental_inputs_reader::input_file_offset): New function.
858 (Incremental_inputs_reader::input_file_index): New function.
859 (Incremental_inputs_reader::input_file): Call input_file_offset.
860 (Incremental_inputs_reader::input_file_at_offset): New function.
861 (Incremental_relocs_reader::get_r_type): Reformat.
862 (Incremental_relocs_reader::get_r_shndx): Reformat.
863 (Incremental_relocs_reader::get_r_offset): Reformat.
864 (Incremental_relocs_reader::data): New function.
865 (Incremental_binary::Incremental_binary): Initialize new data members.
866 (Incremental_binary::check_inputs): Add cmdline parameter.
867 (Incremental_binary::file_is_unchanged): Remove.
868 (Input_reader::arg_serial): New function.
869 (Input_reader::get_unused_symbol_count): New function.
870 (Input_reader::get_unused_symbol): New function.
871 (Input_reader::do_arg_serial): New function.
872 (Input_reader::do_get_unused_symbol_count): New function.
873 (Input_reader::do_get_unused_symbol): New function.
874 (Incremental_binary::input_file_count): New function.
875 (Incremental_binary::get_input_reader): Change signature to use
876 index instead of filename.
877 (Incremental_binary::file_has_changed): New function.
878 (Incremental_binary::get_input_argument): New function.
879 (Incremental_binary::get_library): New function.
880 (Incremental_binary::get_script_info): New function.
881 (Incremental_binary::init_layout): New function.
882 (Incremental_binary::reserve_layout): New function.
883 (Incremental_binary::output_file): New function.
884 (Incremental_binary::do_check_inputs): New function.
885 (Incremental_binary::do_file_is_unchanged): Remove.
886 (Incremental_binary::do_file_has_changed): New function.
887 (Incremental_binary::do_init_layout): New function.
888 (Incremental_binary::do_reserve_layout): New function.
889 (Incremental_binary::do_input_file_count): New function.
890 (Incremental_binary::do_get_input_reader): Change signature.
891 (Incremental_binary::input_args_map_): New data member.
892 (Incremental_binary::library_map_): New data member.
893 (Incremental_binary::script_map_): New data member.
894 (Sized_incremental_binary::Sized_incremental_binary): Initialize
895 new data members.
896 (Sized_incremental_binary::output_section): New function.
897 (Sized_incremental_binary::inputs_reader): Add const.
898 (Sized_incremental_binary::symtab_reader): Add const.
899 (Sized_incremental_binary::relocs_reader): Add const.
900 (Sized_incremental_binary::got_plt_reader): Add const.
901 (Sized_incremental_binary::get_symtab_view): New function.
902 (Sized_incremental_binary::Inputs_reader): New typedef.
903 (Sized_incremental_binary::Input_entry_reader): New typedef.
904 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
905 (Sized_incremental_binary::do_file_is_unchanged): Remove.
906 (Sized_incremental_binary::do_file_has_changed): New function.
907 (Sized_incremental_binary::do_init_layout): New function.
908 (Sized_incremental_binary::do_reserve_layout): New function.
909 (Sized_input_reader::Inputs_reader): Remove.
910 (Sized_input_reader::Input_entry_reader): Remove.
911 (Sized_input_reader::do_arg_serial): New function.
912 (Sized_input_reader::do_get_unused_symbol_count): New function.
913 (Sized_input_reader::do_get_unused_symbol): New function.
914 (Sized_incremental_binary::do_input_file_count): New function.
915 (Sized_incremental_binary::do_get_input_reader): Change signature;
916 use index instead of filename.
917 (Sized_incremental_binary::section_map_): New data member.
918 (Sized_incremental_binary::input_entry_readers_): New data member.
919 (class Sized_incr_relobj): New class.
920 (class Sized_incr_dynobj): New class.
921 (make_sized_incremental_object): New function.
922 (class Incremental_library): New class.
923 * layout.cc (Free_list::num_lists): New static data member.
924 (Free_list::num_nodes): New static data member.
925 (Free_list::num_removes): New static data member.
926 (Free_list::num_remove_visits): New static data member.
927 (Free_list::num_allocates): New static data member.
928 (Free_list::num_allocate_visits): New static data member.
929 (Free_list::init): New function.
930 (Free_list::remove): New function.
931 (Free_list::allocate): New function.
932 (Free_list::dump): New function.
933 (Free_list::print_stats): New function.
934 (Layout_task_runner::run): Resize output file for incremental updates.
935 (Layout::Layout): Initialize new data members.
936 (Layout::set_incremental_base): New function.
937 (Layout::init_fixed_output_section): New function.
938 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
939 incremental updates.
940 (Layout::create_gold_note): Do not create gold note section for
941 incremental updates.
942 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
943 for incremental updates.
944 (Layout::set_section_offsets): For incremental updates, allocate space
945 from free list.
946 (Layout::create_symtab_sections): Layout with offsets relative to
947 start of section; for incremental updates, allocate space from free
948 list.
949 (Layout::create_shdrs): For incremental updates, allocate space from
950 free list.
951 (Layout::finish_dynamic_section): For incremental updates, do not
952 check --as-needed (fixed in subsequent patch).
953 * layout.h (class Free_list): New class.
954 (Layout::set_incremental_base): New function.
955 (Layout::incremental_base): New function.
956 (Layout::init_fixed_output_section): New function.
957 (Layout::allocate): New function.
958 (Layout::incremental_base_): New data member.
959 (Layout::free_list_): New data member.
960 * main.cc (main): Print Free_list statistics.
961 * object.cc (Relobj::finalize_incremental_relocs): Add
962 clear_counts parameter; clear counts only when clear_counts is set.
963 (Sized_relobj::Sized_relobj): Initialize new base class.
964 (Sized_relobj::do_layout): Don't report special sections.
965 (Sized_relobj::do_for_all_local_got_entries): New function.
966 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
967 symtab_off to all symbol table offsets.
968 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
969 * object.h (class Got_offset_list): Move to top of file.
970 (Object::Object): Allow case where input_file == NULL.
971 (Object::~Object): Likewise.
972 (Object::input_file): Assert that input_file != NULL.
973 (Object::lock): Allow case where input_file == NULL.
974 (Object::unlock): Likewise.
975 (Object::is_locked): Likewise.
976 (Object::token): Likewise.
977 (Object::release): Likewise.
978 (Object::is_incremental): New function.
979 (Object::get_mtime): New function.
980 (Object::for_all_local_got_entries): New function.
981 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
982 (Object::set_is_in_system_directory): New function.
983 (Object::is_in_system_directory): New function.
984 (Object::do_is_incremental): New function.
985 (Object::do_get_mtime): New function.
986 (Object::do_for_all_local_got_entries): New function.
987 (Object::is_in_system_directory_): New data member.
988 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
989 (class Sized_relobj_base): New class.
990 (class Sized_relobj): Derive from Sized_relobj_base.
991 (class Sized_relobj::Symbols): Redeclare from base class.
992 (class Sized_relobj::local_got_offset_list): Remove.
993 (class Sized_relobj::Output_sections): Redeclare from base class.
994 (class Sized_relobj::do_for_all_local_got_entries): New function.
995 (class Sized_relobj::write_local_symbols): Add offset parameter.
996 (class Sized_relobj::local_symbol_offset_): Update comment.
997 (class Sized_relobj::local_dynsym_offset_): Update comment.
998 * options.cc (Input_arguments::add_file): Remove const.
999 * options.h (Input_file_argument::Input_file_argument):
1000 Initialize arg_serial_ (all constructors).
1001 (Input_file_argument::set_arg_serial): New function.
1002 (Input_file_argument::arg_serial): New function.
1003 (Input_file_argument::arg_serial_): New data member.
1004 (Input_arguments::Input_arguments): Initialize file_count_.
1005 (Input_arguments::add_file): Remove const.
1006 (Input_arguments::number_of_input_files): New function.
1007 (Input_arguments::file_count_): New data member.
1008 (Command_line::number_of_input_files): Call
1009 Input_arguments::number_of_input_files.
1010 * output.cc (Output_segment_headers::Output_segment_headers):
1011 Set current size.
1012 (Output_section::Input_section::current_data_size): New function.
1013 (Output_section::Output_section): Initialize new data members.
1014 (Output_section::add_input_section): Don't do merge sections for
1015 an incremental link; allocate space from free list for an
1016 incremental update.
1017 (Output_section::add_output_section_data): Allocate space from
1018 free list for an incremental update.
1019 (Output_section::update_data_size): New function.
1020 (Output_section::set_fixed_layout): New function.
1021 (Output_section::reserve): New function.
1022 (Output_segment::set_section_addresses): Remove const.
1023 (Output_segment::set_section_list_addresses): Remove const; allocate
1024 space from free list for an incremental update.
1025 (Output_segment::set_offset): Adjust size of RELRO segment for an
1026 incremental update.
1027 * output.h (Output_data::current_data_size): Move here from
1028 child classes.
1029 (Output_data::pre_finalize_data_size): New function.
1030 (Output_data::update_data_size): New function.
1031 (Output_section_headers::update_data_size): new function.
1032 (Output_section_data_build::current_data_size): Move to Output_data.
1033 (Output_data_strtab::update_data_size): New function.
1034 (Output_section::current_data_size): Move to Output_data.
1035 (Output_section::set_fixed_layout): New function.
1036 (Output_section::has_fixed_layout): New function.
1037 (Output_section::reserve): New function.
1038 (Output_section::update_data_size): New function.
1039 (Output_section::has_fixed_layout_): New data member.
1040 (Output_section::free_list_): New data member.
1041 (Output_segment::set_section_addresses): Remove const.
1042 (Output_segment::set_section_list_addresses): Remove const.
1043 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1044 New function.
1045 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1046 New function.
1047 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1048 parameter when calling Add_symbols constructor; store argument
1049 serial number for members of a lib group.
1050 (Add_symbols::locks): Allow case where token == NULL.
1051 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1052 (Read_member::~Read_member): New function.
1053 (Read_member::is_runnable): New function.
1054 (Read_member::locks): New function.
1055 (Read_member::run): New function.
1056 (Check_script::~Check_script): New function.
1057 (Check_script::is_runnable): New function.
1058 (Check_script::locks): New function.
1059 (Check_script::run): New function.
1060 (Check_library::~Check_library): New function.
1061 (Check_library::is_runnable): New function.
1062 (Check_library::locks): New function.
1063 (Check_library::run): New function.
1064 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1065 (Add_symbols::library_): New data member.
1066 (class Read_member): New class.
1067 (class Check_script): New class.
1068 (class Check_library): New class.
1069 * reloc.cc (Read_relocs::is_runnable): Allow case where
1070 token == NULL.
1071 (Read_relocs::locks): Likewise.
1072 (Scan_relocs::locks): Likewise.
1073 (Relocate_task::locks): Likewise.
1074 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1075 to clear counters.
1076 (Sized_relobj::incremental_relocs_scan): Fix comment.
1077 (Sized_relobj::do_relocate): Pass output file offset to
1078 write_local_symbols.
1079 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1080 from class declaration.
1081 * script.cc (read_input_script): Allocate Script_info; pass
1082 argument serial number to report_script.
1083 * script.h (class Script_info): Move to incremental.h.
1084 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1085 * symtab.h (Symbol_table::add_from_incrobj): New function.
1086 (Symbol_table::set_file_offset): New function.
1087
b961d0d7
CC
10882011-04-05 Cary Coutant <ccoutant@google.com>
1089
1090 * incremental-dump.cc (dump_incremental_inputs): Change signature
1091 to take a Sized_incremental_binary; change caller. Use readers
1092 in Sized_incremental_binary.
1093 * incremental.cc
1094 (Sized_incremental_binary::find_incremental_inputs_sections):
1095 Rename do_find_incremental_inputs_sections to this.
1096 (Sized_incremental_binary::setup_readers): New function.
1097 (Sized_incremental_binary::do_check_inputs): Check
1098 has_incremental_info_ flag; move setup code to setup_readers;
1099 use input readers.
1100 (Sized_incremental_binary::do_file_is_unchanged): New function.
1101 (Sized_incremental_binary::do_get_input_reader): New function.
1102 * incremental.h (class Incremental_binary): Move to end of file.
1103 (Incremental_binary::file_is_unchanged): New function.
1104 (Incremental_binary::do_file_is_unchanged): New function.
1105 (Incremental_binary::Input_reader): New class.
1106 (Incremental_binary::get_input_reader): New function.
1107 (class Sized_incremental_binary): Move to end of file.
1108 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1109 input section reader classes.
1110 (Sized_incremental_binary::has_incremental_info): New function.
1111 (Sized_incremental_binary::inputs_reader): New function.
1112 (Sized_incremental_binary::symtab_reader): New function.
1113 (Sized_incremental_binary::relocs_reader): New function.
1114 (Sized_incremental_binary::got_plt_reader): New function.
1115 (Sized_incremental_binary::do_file_is_unchanged): New function.
1116 (Sized_incremental_binary::Sized_input_reader): New class.
1117 (Sized_incremental_binary::get_input_reader): New function.
1118 (Sized_incremental_binary::find_incremental_inputs_sections):
1119 Rename do_find_incremental_inputs_sections to this.
1120 (Sized_incremental_binary::setup_readers): New function.
1121 (Sized_incremental_binary::has_incremental_info_): New data member.
1122 (Sized_incremental_binary::inputs_reader_): New data member.
1123 (Sized_incremental_binary::symtab_reader_): New data member.
1124 (Sized_incremental_binary::relocs_reader_): New data member.
1125 (Sized_incremental_binary::got_plt_reader_): New data member.
1126 (Sized_incremental_binary::current_input_file_): New data member.
1127
a869183f
PP
11282011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1129
1130 PR gold/12640
1131 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1132 violation.
1133
11342011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
1135
1136 * archive.cc (Archive::include_member): Adjust call to report_object.
1137 (Add_archive_symbols::run): Add script_info to call to
1138 report_archive_begin.
1139 (Lib_group::include_member): Adjust call to report_object.
1140 (Add_lib_group_symbols::run): Adjust call to report_object.
1141 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1142 blocks. Add object count for script input files.
1143 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1144 script_info parameter; change all callers.
1145 (Incremental_inputs::report_object): Add script_info parameter;
1146 change all callers.
1147 (Incremental_inputs::report_script): Store backpointer to
1148 incremental info entry.
1149 (Output_section_incremental_inputs::set_final_data_size): Record
1150 additional information for scripts.
1151 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1152 * incremental.h (Incremental_script_entry::add_object): New function.
1153 (Incremental_script_entry::get_object_count): New function.
1154 (Incremental_script_entry::get_object): New function.
1155 (Incremental_script_entry::objects_): New data member; adjust
1156 constructor.
1157 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1158 (Incremental_inputs::report_object): Add script_info parameter.
1159 (Incremental_inputs_reader::get_object_count): New function.
1160 (Incremental_inputs_reader::get_object_offset): New function.
1161 * options.cc (Input_arguments::add_file): Return reference to
1162 new input argument.
1163 * options.h (Input_argument::set_script_info): New function.
1164 (Input_argument::script_info): New function.
1165 (Input_argument::script_info_): New data member; adjust all
1166 constructors.
1167 (Input_file_group::add_file): Return reference to new input argument.
1168 (Input_file_lib::add_file): Likewise.
1169 (Input_arguments::add_file): Likewise.
1170 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1171 * script.cc (Parser_closure::Parser_closure): Add script_info
1172 parameter; adjust all callers.
1173 (Parser_closure::script_info): New function.
1174 (Parser_closure::script_info_): New data member.
1175 (read_input_script): Report scripts earlier to incremental info.
1176 (script_add_file): Set script_info in Input_argument.
1177 (script_add_library): Likewise.
1178 * script.h (Script_options::Script_info): Rewrite class.
1179
a869183f 11802011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
1181
1182 * archive.cc (Library_base::should_include_member): Move
1183 method here from class Archive.
1184 (Archive::Archive): Initialize base class.
1185 (Archive::should_include_member): Move to base class.
1186 (Archive::do_for_all_unused_symbols): New function.
1187 (Add_archive_symbols::run): Remove redundant access to
1188 incremental_inputs.
1189 (Lib_group::Lib_group): Initialize base class.
1190 (Lib_group::do_filename): New function.
1191 (Lib_group::include_member): Pass pointer to Lib_group to
1192 report_object.
1193 (Lib_group::do_for_all_unused_symbols): New function.
1194 (Add_lib_group_symbols::run): Report archive information for
1195 incremental links.
1196 * archive.h (class Library_base): New base class.
1197 (class Archive): Derive from Library_base.
1198 (Archive::filename): Move to base class.
1199 (Archive::set_incremental_info): Likewise.
1200 (Archive::incremental_info): Likewise.
1201 (Archive::Should_include): Likewise.
1202 (Archive::should_include_member): Likewise.
1203 (Archive::Armap_entry): Remove.
1204 (Archive::Unused_symbol_iterator): Remove.
1205 (Archive::unused_symbols_begin): Remove.
1206 (Archive::unused_symbols_end): Remove.
1207 (Archive::do_filename): New function.
1208 (Archive::do_get_mtime): New function.
1209 (Archive::do_for_all_unused_symbols): New function.
1210 (Archive::task_): Move to base class.
1211 (Archive::incremental_info_): Likewise.
1212 (class Lib_group): Derive from Library_base.
1213 (Lib_group::do_filename): New function.
1214 (Lib_group::do_get_mtime): New function.
1215 (Lib_group::do_for_all_unused_symbols): New function.
1216 (Lib_group::task_): Move to base class.
1217 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1218 function.
1219 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1220 function.
1221 * incremental.cc (Incremental_inputs::report_archive_begin):
1222 Use Library_base; call library's get_mtime; add incremental inputs
1223 entry before members.
1224 (class Unused_symbol_visitor): New class.
1225 (Incremental_inputs::report_archive_end): Use Library_base; use
1226 visitor class to record unused symbols; don't add incremental inputs
1227 entry after members.
1228 (Incremental_inputs::report_object): Use Library_base.
1229 * incremental.h
1230 (Incremental_archive_entry::Incremental_archive_entry): Remove
1231 unused Archive parameter.
1232 (Incremental_inputs::report_archive_begin): Use Library_base.
1233 (Incremental_inputs::report_archive_end): Likewise.
1234 (Incremental_inputs::report_object): Likewise.
1235 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1236 function.
1237 * object.h (Object::for_all_global_symbols): New function.
1238 (Object::do_for_all_global_symbols): New function.
1239 (Sized_relobj::do_for_all_global_symbols): New function.
1240 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1241 function.
1242 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1243 function.
1244
61ab3e40
ILT
12452011-03-27 Ian Lance Taylor <iant@google.com>
1246
1247 * archive.cc (Archive::interpret_header): Return -1 if something
1248 goes wrong. Change callers accordingly.
1249
30e1f9e6
CC
12502011-03-25 Cary Coutant <ccoutant@google.com>
1251
1252 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1253 * testsuite/Makefile.in: Regenerate.
1254
9c793f14
RÁE
12552010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1256
1257 * plugin.cc (get_view): New.
1258 (Plugin::load): Pass get_view to the plugin.
1259 (Plugin_manager::get_view): New.
1260
9312bb0a
ILT
12612011-03-21 Ian Lance Taylor <iant@google.com>
1262
1263 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 1264 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 1265
7e12ba9e
ST
12662011-03-21 Sriraman Tallam <tmsriram@google.com>
1267
1268 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1269 Change == to -eq.
1270 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1271 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1272 Change == to -eq.
1273 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1274 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1275
fd7a005d
ILT
12762011-03-14 Ian Lance Taylor <iant@google.com>
1277
1278 * script-sections.cc (Sort_output_sections::script_compare):
1279 Rename from is_before, change return type.
1280 (Sort_output_sections::operator()): Adjust accordingly.
1281
ed16fd1b
ILT
12822011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1283
1284 PR gold/12572
1285 * testsuite/odr_violation2.cc: Add comment to make all error line
1286 numbers double digits.
1287 * testsuite/debug_msg.sh: Adjust expected errors.
1288
71ff8986
ILT
12892011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1290
1291 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1292 but mark earlier ones as non-canonical
1293 (offset_to_iterator): Update search target and example
1294 (do_addr2line): Return extra lines in a vector*
1295 (format_file_lineno): Extract from do_addr2line
1296 (one_addr2line): Add vector* out-param
1297 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1298 when a lineno entry appeared last for its instruction
1299 (Dwarf_line_info): Add vector* out-param
1300 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1301 * symtab.cc (Odr_violation_compare): Include the lineno in the
1302 comparison again.
1303 (linenos_from_loc): New. Combine the canonical line for an
1304 address with its other lines.
1305 (True_if_intersect): New. Helper functor to make
1306 std::set_intersection a query.
1307 (detect_odr_violations): Compare sets of lines instead of just
1308 one line for each function. This became less deterministic, but
1309 has fewer false positives.
1310 * symtab.h: Declarations.
1311 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1312 mix an optimized and non-optimized object in the same binary
1313 (odr_violation2.so): Same.
1314 * testsuite/Makefile.in: Regenerate from Makefile.am.
1315 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1316 * testsuite/debug_msg.sh: Update line numbers and add
1317 assertions.
1318 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1319 non-optimized context.
1320 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1321 isn't inlined, and use OdrDerived in an optimized context.
1322 * testsuite/odr_header1.h: Defines OdrDerived, where
1323 optimization will change the
1324 first-instruction-in-the-destructor's file and line number.
1325 * testsuite/odr_header2.h: Defines OdrBase.
1326
a19fefdc
ILT
13272011-03-09 Ian Lance Taylor <iant@google.com>
1328
1329 * fileread.cc (File_read::clear_views): Don't delete the whole
1330 file view.
1331
ecb351e9
ILT
13322011-03-08 Ian Lance Taylor <iant@google.com>
1333
1334 PR gold/12525
1335 * fileread.cc: #include <climits>.
1336 (GOLD_IOV_MAX): Define.
1337 (File_read::read_multiple): Limit number of entries by iov_max.
1338 * fileread.h (class File_read): Always set max_readv_entries to
1339 128.
1340
b821d13c
ILT
13412011-03-07 Ian Lance Taylor <iant@google.com>
1342
1343 PR gold/12525
1344 * options.h (class General_options): Add -dy and -dn.
1345
89243142
CC
13462011-03-02 Cary Coutant <ccoutant@google.com>
1347
1348 * testsuite/script_test_9.t: Add TLS segment.
1349
d0773f31
ILT
13502011-03-02 Simon Baldwin <simonb@google.com>
1351
1352 * configure.ac: Add check for gnu_indirect_function support in
1353 the toolchain building binutils.
1354 * configure: Rebuild.
1355
badc8139
RÁE
13562010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1357
1358 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1359 plugin only symbols.
1360 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1361 in plugin files as not needed in the symbol table.
1362
4cf7a849
ST
13632011-02-11 Sriraman Tallam <tmsriram@google.com>
1364
1365 * output.cc (Output_section::add_input_section): Delay fill
1366 generation for section ordering.
1367
b578bd7d
ILT
13682011-02-09 Ian Lance Taylor <iant@google.com>
1369
1370 PR gold/12316
1371 * object.h (class Sized_relobj): Remove clear_local_symbols.
1372 * reloc.cc (Sized_relobj::do_relocate): Don't call
1373 clear_local_symbols.
1374
84ced98a
RÁE
13752010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1376
1377 * plugin.cc (is_visible_from_outside): Return true for symbols
1378 in the -u option.
1379
55382fb7
ILT
13802011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1381
1382 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1383 filename.
1384
4e271fff
ST
13852011-02-02 Sriraman Tallam <tmsriram@google.com>
1386
1387 * icf.h (is_section_foldable_candidate): Change type of parameter
1388 to std::string.
1389 * icf.cc (Icf::find_identical_sections): Change type of local variable
1390 section_name to be std::string.
1391 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1392
d433c3ac
ILT
13932011-01-25 Ian Lance Taylor <iant@google.com>
1394
1395 * script.cc (script_add_extern): Rewrite to use
1396 add_symbol_reference.
1397
880473a6
DK
13982011-01-25 Doug Kwan <dougkwan@google.com>
1399
d433c3ac 1400 * icf.cc (get_section_contents): Always lock section's object.
880473a6 1401
f30f86fa
ILT
14022011-01-24 Ian Lance Taylor <iant@google.com>
1403
1404 * options.h (class General_options): Accept
1405 --no-detect-odr-violations.
1406
8e51a0b9
ILT
14072011-01-24 Ian Lance Taylor <iant@google.com>
1408
1409 * version.cc (version_string): Bump to 1.11.
1410
0f3b89d8
ILT
14112011-01-24 Ian Lance Taylor <iant@google.com>
1412
1413 * plugin.cc (class Plugin_rescan): Define new class.
1414 (Plugin_manager::claim_file): Set any_claimed_.
1415 (Plugin_manager::save_archive): New function.
1416 (Plugin_manager::save_input_group): New function.
1417 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1418 necessary.
1419 (Plugin_manager::new_undefined_symbol): New function.
1420 (Plugin_manager::rescan): New function.
1421 (Plugin_manager::rescannable_defines): New function.
1422 (Plugin_manager::add_input_file): Set any_added_.
1423 * plugin.h (class Plugin_manager): define new fields rescannable_,
1424 undefined_symbols_, any_claimed_, and any_added_. Declare
1425 Plugin_rescan as friend. Declare new functions.
1426 (Plugin_manager::Rescannable): Define type.
1427 (Plugin_manager::Rescannable_list): Define type.
1428 (Plugin_manager::Undefined_symbol_list): Define type.
1429 (Plugin_manager::Plugin_manager): Initialize new fields.
1430 * archive.cc (Archive::defines_symbol): New function.
1431 (Add_archive_symbols::run): Pass archive to plugins if any.
1432 * archive.h (class Archive): Declare defines_symbol.
1433 * readsyms.cc (Input_group::~Input_group): New function.
1434 (Finish_group::run): Pass input_group to plugins if any.
1435 * readsyms.h (class Input_group): Declare destructor.
1436 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1437 any.
1438
3bb951e5
ILT
14392011-01-10 Ian Lance Taylor <iant@google.com>
1440
1441 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1442 section as relro.
1443 (Layout::set_segment_offsets): Reset increase_relro before calling
1444 set_section_addresses a second time.
1445
0aa45fac
CC
14462011-01-04 Cary Coutant <ccoutant@google.com>
1447
1448 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1449 sections before NOBITS sections.
1450
0db46eb4
L
14512011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1452
1453 * version.cc (print_version): Update copyright to 2011.
1454
829c9745
CC
14552010-12-23 Cary Coutant <ccoutant@google.com>
1456
1457 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1458 of OS to this->add. Add OD parameter to second form of the function.
1459
7500420b
ILT
14602010-12-20 Ian Lance Taylor <iant@google.com>
1461
1462 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1463 second of two consecutive entries with same offset.
1464
f8e9a930
RW
14652010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1466
1467 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1468 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1469 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1470 to avoid unneeded links against $(LDADD).
1471 * testsuite/Makefile.in: Regenerate.
1472
2fbb4320
ILT
14732010-12-15 Ian Lance Taylor <iant@google.com>
1474
1475 PR gold/12324
1476 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1477 for R_X86_64_32 and R_X86_64_PC32.
1478 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1479 ver_matching_def_pic.o.
1480 (ver_matching_def_pic.o): New target.
1481
fedb228d
RW
14822010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1483
1484 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1485 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1486 Move definition before File_read::View member definitions.
1487 (File_read::View::~View): Initialize and hold lock before
1488 updating current_mapped_bytes.
1489
9b547ce6
RW
14902010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1491
1492 * dwarf_reader.cc: Remove outdated comment.
1493 * gold-threads.cc: Fix typo in error message.
1494 * archive.cc: Fix typos in comments.
1495 * archive.h: Likewise.
1496 * arm-reloc-property.cc: Likewise.
1497 * arm-reloc-property.h: Likewise.
1498 * arm-reloc.def: Likewise.
1499 * arm.cc: Likewise.
1500 * attributes.h: Likewise.
1501 * cref.cc: Likewise.
1502 * ehframe.cc: Likewise.
1503 * fileread.h: Likewise.
1504 * gold.h: Likewise.
1505 * i386.cc: Likewise.
1506 * icf.cc: Likewise.
1507 * incremental.h: Likewise.
1508 * int_encoding.cc: Likewise.
1509 * layout.h: Likewise.
1510 * main.cc: Likewise.
1511 * merge.h: Likewise.
1512 * object.cc: Likewise.
1513 * object.h: Likewise.
1514 * options.cc: Likewise.
1515 * readsyms.cc: Likewise.
1516 * reduced_debug_output.cc: Likewise.
1517 * reloc.cc: Likewise.
1518 * script-sections.cc: Likewise.
1519 * sparc.cc: Likewise.
1520 * symtab.h: Likewise.
1521 * target-reloc.h: Likewise.
1522 * target.cc: Likewise.
1523 * target.h: Likewise.
1524 * timer.cc: Likewise.
1525 * timer.h: Likewise.
1526 * x86_64.cc: Likewise.
1527
83e17bd5
CC
15282010-12-09 Cary Coutant <ccoutant@google.com>
1529
1530 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1531 stack.
1532 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1533 parameter; change all callers.
1534 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1535 * options.h (warn_execstack): New option.
1536
017257f8
DK
15372010-12-07 Doug Kwan <dougkwan@google.com>
1538
1539 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1540 like function call relocations.
1541
c20cbc06
ILT
15422010-12-07 Ian Lance Taylor <iant@google.com>
1543
1544 * archive.cc (Archive::get_elf_object_for_member): Permit
1545 punconfigured to be NULL.
1546 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1547 (Archive::include_member): Pass NULL to get_elf_object_for_member
1548 if we searched for the archive and this is the first included
1549 object.
1550
4dbfafcc
ILT
15512010-12-01 Ian Lance Taylor <iant@google.com>
1552
1553 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1554 track_relocs_type_ field.
1555 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1556 Set track_relocs_type_.
1557 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1558 contents when using RELA relocs.
1559 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1560 reloc_map_.
1561 * reloc.cc (Track_relocs::next_addend): New function.
1562 * reloc.h (class Track_relocs): Declare next_addend.
1563
e5e19edd
ILT
15642010-12-01 Ian Lance Taylor <iant@google.com>
1565
1566 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1567 virtual destructor.
1568
9a5ce24c
ILT
15692010-12-01 Ian Lance Taylor <iant@google.com>
1570
1571 * README: Update compilers known to work and fail.
1572
c7791212
NC
15732010-11-23 Matthias Klose <doko@ubuntu.com>
1574
1575 * configure.in: For --enable-gold, handle value `default' instead of
1576 `both*'. Always install ld as ld.bfd, install as ld if gold is
1577 not the default.
1578 * configure: Regenerate.
1579
0ad220c9
DK
15802010-11-18 Doug Kwan <dougkwan@google.com>
1581
1582 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1583 and right_alignment to be zero. Store result alignment only if it is
1584 greater than existing alignment.
1585
ab8056e0
CC
15862010-11-16 Cary Coutant <ccoutant@google.com>
1587
1588 PR gold/12220
1589 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1590 Check for ".zdebug_line".
1591
fd064a5b
CC
15922010-11-16 Doug Kwan <dougkwan@google.com>
1593 Cary Coutant <ccoutant@google.com>
1594
1595 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1596 by reference; adjust all callers.
1597 * output.cc (Output_segment::set_section_addresses): Adjust references
1598 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1599 list is empty.
1600 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1601 end at page boundary.
1602
6fc6ea19
CC
16032010-11-16 Cary Coutant <ccoutant@google.com>
1604
1605 PR gold/12220
1606 * layout.cc (Layout::choose_output_section): Transform names of
1607 compressed sections even when using a script with a SECTIONS clause.
1608 (Layout::output_section_name): Remove code to transform
1609 compressed debug section names.
1610 * output.cc (Output_section::add_input_section): Use uncompressed
1611 section size when tracking input sections.
1612
95a2c8d6
RS
16132010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1614
1615 * symtab.h (Symbol::NON_PIC_REF): Remove.
1616 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1617 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1618 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1619 (Symbol::use_plt_offset): Take a flags argument and pass it
1620 directly to needs_dynamic_reloc. Restrict check for undefined
1621 weak symbols to function calls.
1622 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1623 (Target_arm::Scan::global): Use it.
1624 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1625 (Target_arm::Relocate::relocate): Likewise.
1626 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1627 parameter with an r_type parameter. Use get_reference_flags
1628 to get the flags.
1629 (Target_arm::Relocate::relocate): Update accordingly.
1630 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1631 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1632 (Target_i386::Scan::global): Likewise.
1633 (Target_i386::Relocate::relocate): Likewise.
1634 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1635 parameter with an r_type parameter. Use get_reference_flags
1636 to get the flags.
1637 (Target_i386::Relocate::relocate): Update accordingly.
1638 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1639 (Target_powerpc::Scan::global): Use it.
1640 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1641 (Target_powerpc::Relocate::relocate): Likewise.
1642 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1643 (Target_sparc::Scan::global): Use it.
1644 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1645 (Target_sparc::Relocate::relocate): Likewise.
1646 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1647 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1648 (Target_x86_64::Scan::global): Likewise.
1649 (Target_x86_64::Relocate::relocate): Likewise.
1650
f625ae50
DK
16512010-11-08 Doug Kwan <dougkwan@google.com>
1652 Cary Coutant <ccoutant@google.com>
1653
1654 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1655 (Arm_exidx_merge_section::section_contents_): New data member.
1656 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1657 (Arm_input_section::~Arm_input_section): De-allocate memory.
1658 (Arm_input_section::original_contents_): New data member.
1659 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1660 in parameters instead of calling Object::section_contents without
1661 locking.
1662 (Arm_output_section::group_section): New parameter TASK. Pass it
1663 to callees that need locking objects.
1664 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1665 to lock EXIDX input sections. Fix a formatting issue. Call
1666 Arm_exidx_merged_section::build_contents to create merged section
1667 contents.
1668 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1669 to lock object of stub table owner.
1670 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1671 TEXT_SIZE to initialize data member TEXT_SIZE_.
1672 (Arm_exidx_input_section::addralign): Fix typo in comment.
1673 (Arm_exidx_input_section::text_size): New method.
1674 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1675 that require locking objects. Lock objects before scanning for stubs
1676 and updating local symbols.
1677 (Arm_input_section<big_endian>::init): Copy contents of original
1678 input section.
1679 (Arm_input_section<big_endian>::do_write): Use saved contents of
1680 original input section instead of calling Object::section_contents
1681 without locking.
1682 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1683 size without calling Object::section_size().
1684 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1685 for size. Allocate a buffer for merged EXIDX entries.
1686 (Arm_exidx_merged_section::build_contents): New method.
1687 (Arm_exidx_merged_section::do_write): Move merge section contents
1688 building code to Arm_exidx_merged_section::build_contetns. Write
1689 out contetns in buffer instead of building it on the fly.
1690 (Arm_relobj::make_exidx_input_section): Also pass text section size
1691 to Arm_exidx_input_section constructor.
1692 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1693 (Arm_dynobj::do_read_symbols): Fix memory leak.
1694 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1695 * target.h: (class Task): Add forward declaration.
1696 (Target::relax): Add new parameter TASK and pass it to
1697 Target::do_relax().
1698 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1699
5f9bcf58
CC
17002010-11-05 Cary Coutant <ccoutant@google.com>
1701
1702 PR gold/10708
1703 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1704 object when reading from the file.
1705 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1706 second layout pass.
1707 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1708 when reading section contents.
1709 (get_section_contents): Likewise.
1710 (icf::find_identical_sections): Likewise.
1711 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1712 object when reading from the file.
1713 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1714 the object when doing deferred section layout.
1715
e597fa08
NC
17162010-11-03 Nick Clifton <nickc@redhat.com>
1717
1718 PR gold/12001
1719 * script.h (class Symbol_assignment: name): New member. Returns
1720 the name of the symbol.
1721 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1722 Returns true if the given symbol name is on the list of
1723 assignments wating to be processed.
1724 * archive.cc (should_incldue_member): If the symbol is undefined,
1725 check to see if it is on the list of symbols pending assignment.
1726
3f9a3278
ILT
17272010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1728
1729 * script-sections.cc (Script_sections::find_memory_region): Check
1730 for a NULL output section pointer.
1731
d06fb4d1
DK
17322010-10-29 Doug Kwan <dougkwan@google.com>
1733
1734 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1735 Output_section::add_relaxed_input_section.
1736 * output.cc (Output_section::add_relaxed_input_section): Add new
1737 arguments LAYOUT and NAME. Set section order index.
1738 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1739 Copy section order index.
1740 * output.h (Output_section::add_relaxed_input_section): Add new
1741 arguments LAYOUT and NAME.
1742
90e24de5
ILT
17432010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1744
1745 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1746 NATIVE_OR_CROSS_LINKER.
1747 * testsuite/Makefile.in: Regenerate.
1748
c9484ea5
DK
17492010-10-20 Doug Kwan <dougkwan@google.com>
1750
1751 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1752 without SHF_LINK_ORDER flags.
1753 * layout.cc (Layout::choose_output_section): Do not filter
1754 SHF_LINK_ORDER flag in a relocatable link.
1755
5bc2f5be
CC
17562010-10-17 Cary Coutant <ccoutant@google.com>
1757
1758 * output.h (Output_segment::set_section_addresses): Change function
1759 signature. Update all callers.
1760 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1761 sections.
1762 (Output_segment::set_section_addresses): Align after last TLS
1763 section. Add padding before last relro section instead of after.
1764
0c91cf04
DK
17652010-10-17 Doug Kwan <dougkwan@google.com>
1766
1767 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1768 GOT output section to be writable.
1769
8c21d9d3
CC
17702010-10-14 Cary Coutant <ccoutant@google.com>
1771
1772 * debug.h (DEBUG_INCREMENTAL): New flag.
1773 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1774 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1775 mode.
1776 * incremental.cc (report_command_line): Ignore all forms of
1777 --incremental.
1778 * layout.cc (Layout::Layout): Check parameters for incremental link
1779 mode.
1780 * options.cc (General_options::parse_incremental): New function.
1781 (General_options::parse_no_incremental): New function.
1782 (General_options::parse_incremental_full): New function.
1783 (General_options::parse_incremental_update): New function.
1784 (General_options::incremental_mode_): New data member.
1785 (General_options::finalize): Check incremental_mode_.
1786 * options.h (General_options): Update help text for --incremental.
1787 Add --no-incremental, --incremental-full, --incremental-update.
1788 (General_options::Incremental_mode): New enum type.
1789 (General_options::incremental_mode): New function.
1790 (General_options::incremental_mode_): New data member.
1791 * parameters.cc (Parameters::incremental_mode_): New data member.
1792 (Parameters::set_options): Set incremental_mode_.
1793 (Parameters::set_incremental_full): New function.
1794 (Parameters::incremental): New function.
1795 (Parameters::incremental_update): New function.
1796 (set_parameters_incremental_full): New function.
1797 * parameters.h (Parameters::set_incremental_full): New function.
1798 (Parameters::incremental): New function.
1799 (Parameters::incremental_update): New function.
1800 (Parameters::incremental_mode_): New data member.
1801 (set_parameters_incremental_full): New function.
1802 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1803 incremental link mode.
1804 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1805 (Sized_relobj::do_relocate_sections): Likewise.
1806 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1807 option.
1808 * testsuite/Makefile.in: Regenerate.
1809 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1810
bb32aa18 18112010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
1812
1813 * script-sections.h (class Script_sections): Make
1814 Sections_elements typedef public.
1815 * script-sections.cc (class Sort_output_sections): Add elements_
1816 field. Add constructor which sets it; change all callers.
1817 (Sort_output_sections::is_before): New function.
1818 (Sort_output_sections::operator()): Call is_before.
1819 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1820 conditional.
1821 * testsuite/script_test_10.sh: New test. Test script section
1822 order.
1823 * testsuite/script_test_10.t: Likewise.
1824 * testsuite/script_test_10.s: Likewise.
1825 * testsuite/Makefile.am: Wrap the cross linker tests and the
1826 common tests into NATIVE_OR_CROSS_LINKER.
1827 (check_SCRIPTS): Add script_test_10.sh.
1828 (check_DATA): Add script_test_10.stdout.
1829 (script_test_10.o, script_test_10): New targets.
1830 (script_test_10.stdout): New target.
1831 * configure, testsuite/Makefile.in: Regenerate.
1832
3cef7179
ILT
18332010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1834
1835 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1836 error for the deprecated relocations.
1837 (Target_arm::Scan::global): Likewise.
1838 (Target_arm::Relocate::relocate): Likewise.
1839
7411e9a8
RS
18402010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1841
1842 * fileread.cc (Input_file::find_file): Initialize *found_name
1843 and *namep when using the fallback search for case 4.
1844
6a9da32a
CC
18452010-10-11 Cary Coutant <ccoutant@google.com>
1846
1847 * options.h (class General_options): Redefine -z lazy as an alias for
1848 the negation of -z now.
1849
ac897c20
ILT
18502010-10-11 Ian Lance Taylor <iant@google.com>
1851
1852 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1853 binding.
1854
ea5cae92
NC
18552010-10-06 Nick Clifton <nickc@redhat.com>
1856
1857 * script-sections.cc(class Memory_region): Remove
1858 current_lma_offset_ field. Rename current_vma_offset_ to
1859 current_offset_. Add last_section_ field.
1860 (Memory_region::get_current_vma_address): Rename to
1861 get_current_address.
1862 (Memory_region::get_current_lma_address): Delete.
1863 (Memory_region::increment_vma_offset): Rename to
1864 increment_offset.
1865 (Memory_region::increment_lma_offset): Delete.
1866 (Memory_region::attributes_compatible): New method. Returns
1867 true if the provided section is compatible with the region.
1868 (Memory_region::get_last_section): New method. Returns the last
1869 section to use the region.
1870 (Memory_region::set_last_section): New method. Stores the last
1871 section to use the region.
1872 (Script_sections::block_in_region): New method. Returns true if
1873 a block of memory is contained within a region.
1874 (Script_sections::find_memory_region): New method. Locates a
1875 memory region to be used to set a VMA or LMA address.
1876 (Output_section_definition::set_section_addresses): Add code to
1877 check for addresses set by memory regions.
1878 (Output_segment::set_section_addresses): Remove memory region
1879 walking code.
1880 (Script_sections::create_segment): Add a warning if a header
1881 segment is created outside of any region.
1882 * script-sections.h (class Script_sections): Add prototypes for
1883 find_memory_region and block_in_region methods.
1884 * testsuite/memory_test.s: Use .long instead of .word.
1885 * testsuite/memory_test.t: Add some more output sections.
1886 * testsuite/memory_test.sh: Update expected output.
1887
a9bfd952
DK
18882010-10-02 Doug Kwan <dougkwan@google.com>
1889
1890 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1891 defintion to symtab.h
1892 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1893 declaration to defintion.
1894
bacff3ab
NC
18952010-10-01 Nick Clifton <nickc@redhat.com>
1896
1897 * expression.cc (eval): Replace dummy argument with NULL.
1898 (eval_maybe_dot): Check for a NULL result section pointer.
1899 (Symbol_expression::value): Likewise.
1900 (Dot_expression::value): Likewise.
1901 (BINARY_EXPRESSION): Likewise.
1902 (Max_expression::value): Likewise.
1903 (Min_expression::value): Likewise.
1904 (Absolute_expression::value): Likewise.
1905 (Addr_expression::value_from_output_section): Likewise.
1906 (Loaddddr_expression::value_from_output_section): Likewise.
1907 (Segment_start_expression::value): Likewise.
1908 * script-sections.cc
1909 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1910 argument with NULL.
1911 (Sections_elememt_dot_assignment::set_section_addresses):
1912 Likewise.
1913 (Output_data_expression::do_write_to_buffer): Likewise.
1914 (Output_section_definition::finalize_symbols): Likewise.
1915 (Output_section_definition::set_section_addresses): Likewise.
1916
f81bc8b5
DK
19172010-09-30 Doug Kwan <dougkwan@google.com>
1918
1919 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1920
c95e9f27
ST
19212010-09-28 Sriraman Tallam <tmsriram@google.com>
1922
1923 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 1924 function.
c95e9f27
ST
1925 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1926 virtual function.
1927 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1928 virtual function.
1929 * icf.cc (get_section_contents): Inline merge sections only when
1930 target allows it.
1931
3cac54d2
RW
19322010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1933
1934 * configure: Regenerate.
1935
2904037a
ILT
19362010-09-17 Ian Lance Taylor <iant@google.com>
1937
1938 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
1939 * testsuite/Makefile.am (memory_test.o): New target.
1940 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1941 memory_test.t.
1942 * testsuite/Makefile.in: Rebuild.
2904037a 1943
bca7fb63
DK
19442010-09-17 Doug Kwan <dougkwan@google.com>
1945
1946 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1947 defintion if relocation uses GOT entries of the symbol.
1948 * testsuite/icf_safe_test.sh: Fix test.
1949 * testsuite/icf_safe_so_test.sh: Fix test.
1950
4ef28648
CC
19512010-09-16 Cary Coutant <ccoutant@google.com>
1952
1953 * script_sections.cc (class Memory_region): Remove "NULL" from
1954 vector initializations.
1955
793990de
CC
19562010-09-15 Cary Coutant <ccoutant@google.com>
1957
1958 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1959 Resolve forwarding symbols.
1960
81e015e2
DK
19612010-09-15 Doug Kwan <dougkwan@google.com>
1962
1963 * gold/testsuite/script_test_3.t: Add ARM special sections.
1964 * gold/testsuite/script_test_4.t: Same.
1965 * gold/testsuite/script_test_5.t: Same.
1966 * gold/testsuite/script_test_6.t: Same.
1967 * gold/testsuite/script_test_7.t: Same.
1968 * gold/testsuite/script_test_7.t: Same.
1969 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1970
36171d64
CC
19712010-09-14 Cary Coutant <ccoutant@google.com>
1972
1973 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1974 (Target_x86_64::Relocate::relocate_tls): Replace check for
1975 saw_tls_block_reloc_ with test for executable section.
1976
d89051bd
CC
19772010-09-12 Cary Coutant <ccoutant@google.com>
1978
1979 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1980 position-independent executables to shared libraries need dynamic
1981 relocations.
1982 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1983 position-independent executables.
1984 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1985 * testsuite/Makefile.in: Regenerate.
1986
fca41f0f
NC
19872010-09-10 Nick Clifton <nickc@redhat.com>
1988
1989 PR gold/11997
1990 * testsuite/memory_test.t: Discard any sections that are not
1991 needed.
1992
6695e4b3
L
19932010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1994
1995 PR gold/11996
1996 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1997 "This::" to work around a bug in gcc 4.2.
1998
1999 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2000
0f72bf6f
RÁE
20012010-09-09 Rafael Espindola <espindola@google.com>
2002
2003 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2004 sections with different PF_X flags in the same segment.
2005 (Layout::find_first_load_seg): Search all segments to find the first
2006 one.
2007 * options.h (rosegment): New.
2008
20092010-09-08 Rafael Espindola <espindola@google.com>
a6577478 2010
05a79166 2011 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 2012
aa98ff75
DK
20132010-09-08 Doug Kwan <dougkwan@google.com>
2014
2015 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2016 (Arm_relobj::do_relocate_sections): Add new parameter for output
2017 file to match the parent.
2018 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2019 of local symbols instead of input values. Update code to track
2020 changes in gold::relocate_section.
2021 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2022 (Sized_relobj::compute_final_local_value_internal): New methods.
2023 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2024 body into private version of Sized_relobj::compute_final_local_value.
2025 Call the inline method.
2026 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2027 merged symbol value if there is one.
2028 (Symbol_value::has_output_value): New method defintiion.
2029 (Sized_relobj::Compute_final_local_value_status): New enum type.
2030 (Sized_relobj::compute_final_local_value): New methods.
2031 (Sized_relobj::compute_final_local_value_internal): New methods.
2032 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2033 and arm_cortex_a8.sh.
2034 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2035 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2036 New tests.
2037 * Makefile.in: Regenerate.
2038 * testsuite/arm_bl_out_of_range.s: Update test.
2039 * testsuite/thumb_bl_out_of_range.s: Ditto.
2040 * testsuite/thumb_blx_out_of_range.s: Ditto.
2041 * testsuite/arm_branch_out_of_range.sh: New file.
2042 * testsuite/arm_cortex_a8.sh: Ditto.
2043 * testsuite/arm_cortex_a8_b.s: Ditto.
2044 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2045 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2046 * testsuite/arm_cortex_a8_bl.s: Ditto.
2047 * testsuite/arm_cortex_a8_blx.s: Ditto.
2048 * testsuite/arm_cortex_a8_local.s: Ditto.
2049 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2050 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2051
05a79166
L
20522010-09-08 Rafael Espindola <espindola@google.com>
2053
2054 * Makefile.am (memory_test.stdout): Run readelf with -W.
2055 * Makefile.in: Regenerate.
2056 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2057 64 bit output.
2058
33dbc701
RÁE
20592010-09-08 Rafael Espindola <espindola@google.com>
2060
2061 * script-sections.cc (Script_sections::add_memory_region): Convert
2062 field precision to int.
2063 * script.cc (script_set_section_region, script_set_section_region):
2064 Convert field precision to int.
2065
731ca54a
RÁE
20662010-09-08 Rafael Espindola <espindola@google.com>
2067
2068 * arm.cc (do_finalize_sections): Create the __exidx_start and
2069 __exdix_end symbols even when the section is missing.
2070
7f8cd844
NC
20712010-09-08 Nick Clifton <nickc@redhat.com>
2072
2073 * README: Remove claim that MEMORY is not supported.
2074 * expression.cc (script_exp_function_origin)
2075 (script_exp_function_length): Move from here to ...
2076 * script.cc: ... here.
2077 (script_set_section_region, script_add_memory)
2078 (script_parse_memory_attr, script_include_directive): New
2079 functions.
2080 * script-sections.cc
2081 (class Memory_region): New class.
2082 (class Output_section_definition): Add set_memory_region,
2083 set_section_vma, set_section_lma and get_section_name methods.
2084 (class Script_Sections): Add add_memory_region,
2085 find_memory_region, find_memory_region_origin,
2086 find_memory_region_length and set_memory_region methods.
2087 Have set_section_addresses method walk the list of set memory
2088 regions.
2089 Extend the print methos to display memory regions.
2090 * script-sections.h: Add prototypes for new methods.
2091 Add enum for MEMORY region attributes.
2092 * yyscript.y: Add support for parsing MEMORY regions.
2093 * script-c.h: Add prototypes for new functions.
2094 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2095 * testsuite/Makefile.in: Regenerate.
2096 * testsuite/memory_test.sh: New script.
2097 * testsuite/memory_test.s: New assembler source file.
2098 * testsuite/memory_test.t: New linker script.
2099
a4649286
DK
21002010-08-27 Doug Kwan <dougkwan@google.com>
2101
2102 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2103 reference override an existing dynamic weak reference.
2104 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2105 * testsuite/Makefile.in: Regenerate.
2106 * testsuite/dyn_weak_ref.sh: New file.
2107 * testsuite/dyn_weak_ref_1.c: Ditto.
2108 * testsuite/dyn_weak_ref_2.c: Ditto.
2109
b56648ad
ILT
21102010-08-27 Ian Lance Taylor <iant@google.com>
2111
2112 * incremental.h (class Incremental_input_entry): Add virtual
2113 destructor.
2114
809313cb
ILT
21152010-08-27 Ian Lance Taylor <iant@google.com>
2116
2117 * testsuite/start_lib_test_3.c: Mark t3 as used.
2118
11e32464
NC
21192010-08-27 Nick Clifton <nickc@redhat.com>
2120
2121 * options.cc (version_script): Fix small typo in previous
2122 whitespace tidyup.
2123
ca09d69a
NC
21242010-08-25 Nick Clifton <nickc@redhat.com>
2125
2126 * archive.cc: Formatting fixes: Remove whitespace between
2127 typename and following asterisk. Remove whitespace between
2128 function name and opening parenthesis.
2129 * archive.h: Likewise.
2130 * arm.cc: Likewise.
2131 * attributes.cc: Likewise.
2132 * attributes.h: Likewise.
2133 * common.cc: Likewise.
2134 * copy-relocs.cc: Likewise.
2135 * dirsearch.h: Likewise.
2136 * dynobj.cc: Likewise.
2137 * ehframe.cc: Likewise.
2138 * ehframe.h: Likewise.
2139 * expression.cc: Likewise.
2140 * fileread.cc: Likewise.
2141 * fileread.h: Likewise.
2142 * gc.h: Likewise.
2143 * gold-threads.cc: Likewise.
2144 * gold.cc: Likewise.
2145 * i386.cc: Likewise.
2146 * icf.h: Likewise.
2147 * incremental-dump.cc: Likewise.
2148 * incremental.cc: Likewise.
2149 * layout.cc: Likewise.
2150 * layout.h: Likewise.
2151 * main.cc: Likewise.
2152 * merge.cc: Likewise.
2153 * merge.h: Likewise.
2154 * object.cc: Likewise.
2155 * object.h: Likewise.
2156 * options.cc: Likewise.
2157 * options.h: Likewise.
2158 * output.cc: Likewise.
2159 * output.h: Likewise.
2160 * plugin.cc: Likewise.
2161 * plugin.h: Likewise.
2162 * powerpc.cc: Likewise.
2163 * reloc.cc: Likewise.
2164 * script-c.h: Likewise.
2165 * script-sections.cc: Likewise.
2166 * script.cc: Likewise.
2167 * stringpool.cc: Likewise.
2168 * symtab.cc: Likewise.
2169 * symtab.h: Likewise.
2170 * target.cc: Likewise.
2171 * timer.cc: Likewise.
2172 * timer.h: Likewise.
2173 * version.cc: Likewise.
2174 * x86_64.cc: Likewise.
2175
b8fa8750
NC
21762010-08-24 Nick Clifton <nickc@redhat.com>
2177
2178 PR 11899
2179 * layout.cc (segment_precedes): Sort segments by their physical
2180 addresses, if they have been set.
2181
9919d93b
CC
21822010-08-23 Cary Coutant <ccoutant@google.com>
2183
2184 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2185 symbols data.
2186 (Lib_group::include_member): Unlock object after deleting its
2187 symbols data.
2188 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2189 the bug fixed here.
2190
97b4be1c
CC
21912010-08-19 Neil Vachharajani <nvachhar@google.com>
2192 Cary Coutant <ccoutant@google.com>
2193
2194 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2195 constructor, and set_blocker.
2196 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2197 readsyms_blocker_.
2198 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2199 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2200 * testsuite/Makefile.am (start_lib_test): New test case.
2201 * testsuite/Makefile.in: Regenerate.
2202 * testsuite/start_lib_test_main.c: New file.
2203 * testsuite/start_lib_test_1.c: New file.
2204 * testsuite/start_lib_test_2.c: New file.
2205 * testsuite/start_lib_test_3.c: New file.
2206
dd0b1884
ILT
22072010-08-19 Ian Lance Taylor <iant@google.com>
2208
2209 * Makefile.in: Rebuild with automake 1.11.1.
2210 * aclocal.m4: Likewise.
2211 * testsuite/Makefile.in: Likewise.
2212
7223e9ca
ILT
22132010-08-19 Ian Lance Taylor <iant@google.com>
2214
2215 PR 10893
2216 * i386.cc (class Output_data_plt_i386): Update declarations.
2217 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2218 local_ifuncs_ fields.
2219 (Target_i386::do_plt_section_for_global): New function.
2220 (Target_i386::do_plt_section_for_local): New function.
2221 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2222 parameter; change all callers. Initialize global_ifuncs_ and
2223 local_ifuncs_. If doing a static link define __rel_iplt_start and
2224 __rel_iplt_end.
2225 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2226 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2227 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2228 symbols.
2229 (Target_i386::make_plt_section): New function, broken out of
2230 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2231 (Target_i386::make_plt_entry): Call make_plt_section.
2232 (Target_i386::make_local_ifunc_plt_entry): New function.
2233 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2234 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2235 R_386_IRELATIVE to switch.
2236 (Target_i386::Scan::global): Likewise.
2237 (Target_i386::Relocate::relocate): Likewise.
2238 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2239 switch.
2240 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2241 (Target_x86_64::do_plt_section_for_global): New function.
2242 (Target_x86_64::do_plt_section_for_local): New function.
2243 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2244 parameter; change all callers. If doing a static link define
2245 __rela_iplt_start and __rela_iplt_end.
2246 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2247 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2248 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2249 to point to .plt.
2250 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2251 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2252 switch.
2253 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2254 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2255 R_X86_64_IRELATIVE to switch.
2256 (Target_x86_64::Scan::global): Likewise.
2257 (Target_x86_64::Relocate::relocate): Likewise.
2258 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2259 switch.
2260 * target.h (class Target): Add plt_section_for_global and
2261 plt_section_for_local functions. Add do_plt_section_for_global
2262 and do_plt_section_for_local virtual functions.
2263 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2264 clarifying comments.
2265 (Symbol::use_plt_offset): Handle IFUNC symbol.
2266 * object.cc (Sized_relobj::Sized_relobj): Initialize
2267 local_plt_offsets_.
2268 (Sized_relobj::local_has_plt_offset): New function.
2269 (Sized_relobj::local_plt_offset): New function.
2270 (Sized_relobj::set_local_plt_offset): New function.
2271 (Sized_relobj::do_count): Handle IFUNC symbol.
2272 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2273 a bit away from input_shndx_ field. Add set_is_func_symbol and
2274 is_ifunc_symbol functions.
2275 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2276 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2277 local_plt_offsets_ field.
2278 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2279 * output.h (class Output_section_data): Add non-const
2280 output_section function.
2281 (class Output_data_got): Update declarations.
2282 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2283 Add use_plt_offset parameter to global and local constructors.
2284 Change all callers. Change local_sym_index_ field to 31 bits.
2285 Change GSYM_CODE and CONSTANT_CODE accordingly.
2286 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2287 doing a static link don't set sh_link field.
2288 (Output_data_got::Got_entry::write): Use PLT offset if
2289 appropriate.
2290 (Output_data_got::add_global_plt): New function.
2291 (Output_data_got::add_local_plt): New function.
2292 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2293 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2294 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2295 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2296 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2297 IFUNC conditional.
2298 * testsuite/ifunc-sel.h: New file.
2299 * testsuite/ifuncmain1.c: New file.
2300 * testsuite/ifuncmain1vis.c: New file.
2301 * testsuite/ifuncmod1.c: New file.
2302 * testsuite/ifuncdep2.c: New file.
2303 * testsuite/ifuncmain2.c: New file.
2304 * testsuite/ifuncmain3.c: New file.
2305 * testsuite/ifuncmod3.c: New file.
2306 * testsuite/ifuncmain4.c: New file.
2307 * testsuite/ifuncmain5.c: New file.
2308 * testsuite/ifuncmod5.c: New file.
2309 * testsuite/ifuncmain6pie.c: New file.
2310 * testsuite/ifuncmod6.c: New file.
2311 * testsuite/ifuncmain7.c: New file.
2312 * configure, testsuite/Makefile.in: Rebuild.
2313
56f75c03
ILT
23142010-08-18 Ian Lance Taylor <iant@google.com>
2315
2316 * incremental.cc
2317 (Output_section_incremental_inputs::write_input_files): Add cast
2318 to avoid signed/unsigned comparison warning.
2319 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2320
55455f89
CC
23212010-08-12 Cary Coutant <ccoutant@google.com>
2322
2323 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2324
e2054bcb
ILT
23252010-08-13 Ian Lance Taylor <iant@google.com>
2326
2327 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2328
74f67560
DK
23292010-08-12 Cary Coutant <ccoutant@google.com>
2330 Doug Kwan <dougkwan@google.com>
2331
2332 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2333 defintion overrides non-weak undef, remember that the original undef
2334 is not weak.
2335 * symtab.cc (Symbol_table::sized_write_global): For undef without
2336 an original weak binding, set binding to global in output.
2337 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2338 * testsuite/Makefile.in: Regenerate.
2339 * testsuite/strong_ref_weak_def.sh: New file.
2340 * testsuite/strong_ref_weak_def_1.c: Ditto.
2341 * testsuite/strong_ref_weak_def_2.c: Ditto.
2342
d1238d12
CC
23432010-08-12 Cary Coutant <ccoutant@google.com>
2344
2345 * testsuite/incremental_test.sh: Rewrite.
2346 * testsuite/incremental_test_1.c: Rewrite.
2347 * testsuite/incremental_test_2.c: Rewrite.
2348
0e70b911
CC
23492010-08-12 Cary Coutant <ccoutant@google.com>
2350
2351 * arm.cc (Target_arm::got_size): Add const.
2352 (Target_arm::got_entry_count): New function.
2353 (Target_arm::plt_entry_count): New function.
2354 (Target_arm::first_plt_entry_offset): New function.
2355 (Target_arm::plt_entry_size): New function.
2356 (Output_data_plt_arm::entry_count): New function.
2357 (Output_data_plt_arm::first_plt_entry_offset): New function.
2358 (Output_data_plt_arm::get_plt_entry_size): New function.
2359 * i386.cc (Target_i386::got_size): Add const.
2360 (Target_i386::got_entry_count): New function.
2361 (Target_i386::plt_entry_count): New function.
2362 (Target_i386::first_plt_entry_offset): New function.
2363 (Target_i386::plt_entry_size): New function.
2364 (Output_data_plt_i386::entry_count): New function.
2365 (Output_data_plt_i386::first_plt_entry_offset): New function.
2366 (Output_data_plt_i386::get_plt_entry_size): New function.
2367 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2368 find_incremental_inputs_sections. Dump incremental_got_plt section.
2369 * incremental.cc: Include target.h.
2370 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2371 parameter. Adjust all callers. Find incremental_got_plt section.
2372 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2373 section.
2374 (Output_section_incremental_inputs::set_final_data_size): Calculate
2375 size of incremental_got_plt section.
2376 (Output_section_incremental_inputs::do_write): Write the
2377 incremental_got_plt section.
2378 (Got_plt_view_info): New struct.
2379 (Local_got_offset_visitor): New class.
2380 (Global_got_offset_visitor): New class.
2381 (Global_symbol_visitor_got_plt): New class.
2382 (Output_section_incremental_inputs::write_got_plt): New function.
2383 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2384 Add parameter. Adjust all callers.
2385 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2386 (Incremental_inputs::got_plt_section): New function.
2387 (Incremental_inputs::got_plt_section_): New data member.
2388 (Incremental_got_plt_reader): New class.
2389 * layout.cc (Layout::create_incremental_info_sections): Add the
2390 incremental_got_plt section.
2391 * object.h (Got_offset_list::get_list): New function.
2392 (Got offset_list::for_all_got_offsets): New function.
2393 (Sized_relobj::local_got_offset_list): New function.
2394 * powerpc.cc (Target_powerpc::got_size): Add const.
2395 (Target_powerpc::got_entry_count): New function.
2396 (Target_powerpc::plt_entry_count): New function.
2397 (Target_powerpc::first_plt_entry_offset): New function.
2398 (Target_powerpc::plt_entry_size): New function.
2399 (Output_data_plt_powerpc::entry_count): New function.
2400 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2401 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2402 * sparc.cc (Target_sparc::got_size): Add const.
2403 (Target_sparc::got_entry_count): New function.
2404 (Target_sparc::plt_entry_count): New function.
2405 (Target_sparc::first_plt_entry_offset): New function.
2406 (Target_sparc::plt_entry_size): New function.
2407 (Output_data_plt_sparc::entry_count): New function.
2408 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2409 (Output_data_plt_sparc::get_plt_entry_size): New function.
2410 * symtab.h (Symbol::got_offset_list): New function.
2411 (Symbol_table::for_all_symbols): New function.
2412 * target.h (Sized_target::got_entry_count): New function.
2413 (Sized_target::plt_entry_count): New function.
2414 (Sized_target::plt_entry_size): New function.
2415 * x86_64.cc (Target_x86_64::got_size): Add const.
2416 (Target_x86_64::got_entry_count): New function.
2417 (Target_x86_64::plt_entry_count): New function.
2418 (Target_x86_64::first_plt_entry_offset): New function.
2419 (Target_x86_64::plt_entry_size): New function.
2420 (Output_data_plt_x86_64::entry_count): New function.
2421 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2422 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2423
09ec0418
CC
24242010-08-12 Cary Coutant <ccoutant@google.com>
2425
2426 * archive.cc: Include incremental.h.
2427 (Archive::Archive): Initialize incremental_info_.
2428 (Archive::include_member): Record archive members in incremental info.
2429 (Add_archive_symbols::run): Record begin and end of an archive in
2430 incremental info.
2431 (Lib_group::include_member): Record objects in incremental info.
2432 * archive.h (Incremental_archive_entry): Forward declaration.
2433 (Archive::set_incremental_info): New member function.
2434 (Archive::incremental_info): New member function.
2435 (Archive::Unused_symbol_iterator): New class.
2436 (Archive::unused_symbols_begin): New member function.
2437 (Archive::unused_symbols_end): New member function.
2438 (Archive::incremental_info_): New data member.
2439 * incremental-dump.cc (find_input_containing_global): New function.
2440 (dump_incremental_inputs): Dump new incremental info sections.
2441 * incremental.cc: Include symtab.h.
2442 (Output_section_incremental_inputs): New class.
2443 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2444 new incremental info sections.
2445 (Sized_incremental_binary::do_check_inputs): Likewise.
2446 (Incremental_inputs::report_archive): Remove.
2447 (Incremental_inputs::report_archive_begin): New function.
2448 (Incremental_inputs::report_archive_end): New function.
2449 (Incremental_inputs::report_object): New function.
2450 (Incremental_inputs::finalize_inputs): Remove.
2451 (Incremental_inputs::report_input_section): New function.
2452 (Incremental_inputs::report_script): Rewrite.
2453 (Incremental_inputs::finalize): Do nothing but finalize string table.
2454 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2455 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2456 (Incremental_inputs::create_data_sections): New function.
2457 (Incremental_inputs::relocs_entsize): New function.
2458 (Output_section_incremental_inputs::set_final_data_size): New function.
2459 (Output_section_incremental_inputs::do_write): New function.
2460 (Output_section_incremental_inputs::write_header): New function.
2461 (Output_section_incremental_inputs::write_input_files): New function.
2462 (Output_section_incremental_inputs::write_info_blocks): New function.
2463 (Output_section_incremental_inputs::write_symtab): New function.
2464 * incremental.h (Incremental_script_entry): Forward declaration.
2465 (Incremental_object_entry): Forward declaration.
2466 (Incremental_archive_entry): Forward declaration.
2467 (Incremental_inputs): Forward declaration.
2468 (Incremental_inputs_header_data): Remove.
2469 (Incremental_inputs_header): Remove.
2470 (Incremental_inputs_header_write): Remove.
2471 (Incremental_inputs_entry_data): Remove.
2472 (Incremental_inputs_entry): Remove.
2473 (Incremental_inputs_entry_write): Remove.
2474 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2475 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2476 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2477 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2478 Likewise.
2479 (Incremental_input_entry): New class.
2480 (Incremental_script_entry): New class.
2481 (Incremental_object_entry): New class.
2482 (Incremental_archive_entry): New class.
2483 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2484 (Incremental_inputs::report_inputs): Remove.
2485 (Incremental_inputs::report_archive): Remove.
2486 (Incremental_inputs::report_archive_begin): New function.
2487 (Incremental_inputs::report_archive_end): New function.
2488 (Incremental_inputs::report_object): Change prototype.
2489 (Incremental_inputs::report_input_section): New function.
2490 (Incremental_inputs::report_script): Change prototype.
2491 (Incremental_inputs::get_reloc_count): New function.
2492 (Incremental_inputs::set_reloc_count): New function.
2493 (Incremental_inputs::create_data_sections): New function.
2494 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2495 (Incremental_inputs::inputs_section): New function.
2496 (Incremental_inputs::symtab_section): New function.
2497 (Incremental_inputs::relocs_section): New function.
2498 (Incremental_inputs::get_stringpool): Add const.
2499 (Incremental_inputs::command_line): Add const.
2500 (Incremental_inputs::inputs): Remove.
2501 (Incremental_inputs::command_line_key): New function.
2502 (Incremental_inputs::input_file_count): New function.
2503 (Incremental_inputs::input_files): New function.
2504 (Incremental_inputs::relocs_entsize): New function.
2505 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2506 (Incremental_inputs::finalize_inputs): Remove.
2507 (Incremental_inputs::Input_info): Remove.
2508 (Incremental_inputs::lock_): Remove.
2509 (Incremental_inputs::inputs_): Change type.
2510 (Incremental_inputs::inputs_map_): Remove.
2511 (Incremental_inputs::current_object_entry_): New data member.
2512 (Incremental_inputs::inputs_section_): New data member.
2513 (Incremental_inputs::symtab_section_): New data member.
2514 (Incremental_inputs::relocs_section_): New data member.
2515 (Incremental_inputs::reloc_count_): New data member.
2516 (Incremental_inputs_reader): New class.
2517 (Incremental_symtab_reader): New class.
2518 (Incremental_relocs_reader): New class.
2519 * layout.cc (Layout::finalize): Move finalization of incremental info
2520 and creation of incremental info sections to follow finalization of
2521 symbol table. Set offsets for postprocessing sections.
2522 (Layout::create_incremental_info_sections): Call
2523 Incremental_inputs::create_data_sections. Add incremental symtab
2524 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2525 sections to layout after input sections.
2526 * layout.h (struct Timespec): Forward declaration.
2527 (Layout::incremental_inputs): Add const.
2528 (Layout::create_incremental_info_sections): Add parameter.
2529 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2530 * object.cc: Include incremental.h.
2531 (Relobj::finalize_incremental_relocs): New function.
2532 (Sized_relobj::do_layout): Record input sections in incremental info.
2533 * object.h (Object::output_section): New function.
2534 (Object::output_section_offset): Moved from Relobj.
2535 (Object::get_incremental_reloc_base): New function.
2536 (Object::get_incremental_reloc_count): New function.
2537 (Object::do_output_section): New function.
2538 (Object::do_output_section_offset): Moved from Relobj.
2539 (Object::do_get_incremental_reloc_base): New function.
2540 (Object::do_get_incremental_reloc_count): New function.
2541 (Object::Object): Initialize new data members.
2542 (Relobj::output_section): Renamed do_output_section and moved to
2543 protected.
2544 (Relobj::output_section_offset): Moved to Object.
2545 (Relobj::do_get_incremental_reloc_base): New function.
2546 (Relobj::do_get_incremental_reloc_count): New function.
2547 (Relobj::allocate_incremental_reloc_counts): New function.
2548 (Relobj::count_incremental_reloc): New function.
2549 (Relobj::finalize_incremental_relocs): New function.
2550 (Relobj::next_incremental_reloc_index): New function.
2551 (Relobj::reloc_counts_): New data member.
2552 (Relobj::reloc_bases_): New data member.
2553 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2554 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2555 (Sized_relobj::incremental_relocs_scan): New function.
2556 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2557 (Sized_relobj::incremental_relocs_write): New function.
2558 (Sized_relobj::incremental_relocs_write_reltype): New function.
2559 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2560 incremental link.
2561 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2562 archives and object files elsewhere.
2563 (Add_symbols::run): Report object files here.
2564 (Finish_group::run): Report end of archive at end of group.
2565 * reloc.cc: Include layout.h, incremental.h.
2566 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2567 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2568 (Sized_relobj::incremental_relocs_scan): New function.
2569 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2570 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2571 (Sized_relobj::incremental_relocs_write): New function.
2572 (Sized_relobj::incremental_relocs_write_reltype): New function.
2573 * script.cc (read_input_script): Rewrite test for incremental link.
2574 Change call to Incremental_inputs::report_script.
2575 * symtab.h (Symbol_table::first_global_index): New function.
2576 (Symbol_table::output_count): New function.
2577
ce0d1972
DK
25782010-08-12 Doug Kwan <dougkwan@google.com>
2579
2580 * arm.cc (Target_arm::merge_object_attributes): Check command line
2581 options --no-wchar-size-warning and --no-enum-size-warning.
2582 * options.h (General_options): Add ld-compatible options
2583 --no-enum-size-warning and --no-wchar-size-warning.
2584
6e5710ce
ILT
25852010-08-04 Ian Lance Taylor <iant@google.com>
2586
2587 * x86_64.cc (Target_x86_64::Scan::local): Use
2588 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2589 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2590 (Target_x86_64::Scan::global): Likewise.
2591 (Target_x86_64::Relocate::relocate): Likewise.
2592 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2593 Likewise.
2594
fef830db
CC
25952010-08-03 Cary Coutant <ccoutant@google.com>
2596
2597 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2598 to reserve space in merged_strings vector. Keep total input size
2599 for stats.
2600 (Output_merge_string::do_print_merge_stats): Print total input size.
2601 * merge.h (Output_merge_string): Add input_size_ field.
2602 * stringpool.cc (Stringpool_template::string_length): Move
2603 implementations out of Stringpool_template class and place in
2604 stringpool.h.
2605 * stringpool.h (string_length): Move out of Stringpool_template.
2606
1e3811b0
ILT
26072010-08-03 Ian Lance Taylor <iant@google.com>
2608
2609 PR 11712
2610 * layout.cc (relaxation_loop_body): If address of load segment is
2611 set, adjust address to include headers if possible.
2612
7af0c620
ILT
26132010-08-03 Ian Lance Taylor <iant@google.com>
2614
2615 * version.cc (version_string): Bump to 1.10.
2616
22f0da72
ILT
26172010-08-03 Ian Lance Taylor <iant@google.com>
2618
2619 PR 11805
2620 * layout.h (enum Output_section_order): Define.
2621 (class Layout): Update declarations.
2622 * layout.cc (Layout::get_output_section): Add order parameter.
2623 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2624 is_first_non_relro parameters. Change all callers.
2625 (Layout::choose_output_section): Likewise.
2626 (Layout::add_output_section_data): Likewise.
2627 (Layout::make_output_section): Likewise. Set order.
2628 (Layout::default_section_order): New function.
2629 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2630 * output.cc (Output_section::Output_section): Initialize order_.
2631 Don't initialize deleted fields.
2632 (Output_segment::Output_segment): Don't initialize deleted
2633 fields.
2634 (Output_segment::add_output_section_to_load): New function
2635 replacing add_output_section. Change all callers to call this or
2636 add_output_section_to_nonload.
2637 (Output_segment::add_output_section_to_nonload): New function.
2638 (Output_segment::remove_output_section): Rewrite.
2639 (Output_segment::add_initial_output_data): Likewise.
2640 (Output_segment::has_any_data_sections): Likewise.
2641 (Output_segment::is_first_section_relro): Likewise.
2642 (Output_segment::maximum_alignment): Likewise.
2643 (Output_segment::has_dynamic_reloc): New function replacing
2644 dynamic_reloc_count. Change all callers.
2645 (Output_segment::has_dynamic_reloc_list): New function replacing
2646 dynamic_reloc_count_list. Change all callers.
2647 (Output_segment::set_section_addresses): Rewrite.
2648 (Output_segment::set_offset): Rewrite.
2649 (Output_segment::find_first_and_last_list): Remove.
2650 (Output_segment::set_tls_offsets): Rewrite.
2651 (Output_segment::first_section_load_address): Likewise.
2652 (Output_segment::output_section_count): Likewise.
2653 (Output_segment::section_with_lowest_load_address): Likewise.
2654 (Output_segment::write_section_headers): Likewise.
2655 (Output_segment::print_sections_to_map): Likewise.
2656 * output.h (class Output_data): Remove dynamic_reloc_count_
2657 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2658 (Output_data::add_dynamic_reloc): Rewrite.
2659 (Output_data::has_dynamic_reloc): New function.
2660 (Output_data::dynamic_reloc_count): Remove.
2661 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2662 is_last_relro_, is_first_non_relro_, is_interp_,
2663 is_dynamic_linker_section_ fields. Add order and set_order
2664 functions. Remove is_relro_local, set_is_relro_local,
2665 is_last_relro, set_is_last_relro, is_first_non_relro,
2666 set_is_first_non_relro functions, is_interp, set_is_interp,
2667 is_dynamic_linker_section, and set_is_dynamic_linker_section
2668 functions.
2669 (class Output_segment): Change Output_data_list from std::list to
2670 std:;vector. Add output_lists_ field. Remove output_data_ and
2671 output_bss_ fields. Update declarations.
2672
3ff2ccb0
ILT
26732010-08-02 Ian Lance Taylor <iant@google.com>
2674
2675 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2676 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2677 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2678
88a4108b
ILT
26792010-08-02 Ian Lance Taylor <iant@google.com>
2680
2681 PR 11855
2682 * script.cc (Script_options::Script_options): Initialize
2683 symbol_definitions_ and symbol_references_.
2684 (Script_options::add_symbol_assignment): Update
2685 symbol_definitions_ and symbol_references_.
2686 (Script_options::add_symbol_reference): New function.
2687 (script_symbol): New function.
2688 * script.h (class Script_options): Add symbol_definitions_ and
2689 symbol_references_ fields.
2690 (Script_options::referenced_const_iterator): New type.
2691 (Script_options::referenced_begin): New function.
2692 (Script_options::referenced_end): New function.
2693 (Script_options::is_referenced): New function.
2694 (Script_options::any_unreferenced): New function.
2695 * script-c.h (script_symbol): Declare.
2696 * yyscript.y (exp): Call script_symbol.
2697 * symtab.cc: Include "script.h".
2698 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2699 Change all callers. Check symbols referenced by scripts.
2700 (Symbol_table::add_undefined_symbols_from_command_line): Add
2701 layout parameter. Change all callers.
2702 (Symbol_table::do_add_undefined_symbols_from_command_line):
2703 Likewise. Break out loop body. Check symbols referenced by
2704 scripts.
2705 (Symbol_table::add_undefined_symbol_from_command_line): New
2706 function broken out of
2707 do_add_undefined_symbols_from_command_line.
2708 * symtab.h (class Symbol_table): Update declarations.
2709 * archive.cc: Include "layout.h".
2710 (Archive::should_include_member): Add layout parameter. Change
2711 all callers. Check for symbol mentioned in expression.
2712 * archive.h (class Archive): Update declaration.
2713 * object.cc (Sized_relobj::do_should_include_member): Add layout
2714 parameter.
2715 * object.h (Object::should_include_member): Add layout parameter.
2716 Change all callers.
2717 (Object::do_should_include_member): Add layout parameter.
2718 (class Sized_relobj): Update declaration.
2719 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2720 parameter.
2721 * dynobj.h (class Sized_dynobj): Update declaration.
2722 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2723 layout parameter.
2724 * plugin.h (class Sized_pluginobj): Update declaration.
2725
5f1ab67a
ILT
27262010-08-02 Ian Lance Taylor <iant@google.com>
2727
2728 PR 11866
2729 * output.cc (Output_segment::set_offset): Search for the first and
2730 last sections rather than assuming that the list is in order.
2731 (Output_segment::find_first_and_last_list): New function.
2732 * output.h (class Output_segment): Update declarations.
2733 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2734 (relro_strip_test_SOURCES): New variable.
2735 (relro_strip_test_DEPENDENCIES): New variable.
2736 (relro_strip_test_LDFLAGS): New variable.
2737 (relro_strip_test_LDADD): New variable.
2738 (relro_strip_test.so): New target.
2739
a8df5856
ILT
27402010-08-02 Ian Lance Taylor <iant@google.com>
2741
2742 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2743 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2744 (Target_i386::got_tlsdesc_section): New function.
2745 (Target_i386::got_section): Create space for GOT entries for
2746 TLSDESC relocations.
2747 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2748 R_386_TLS_GOTDESC.
2749 (Target_i386::Scan::global): Likewise.
2750 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2751 using TLSDESC GOT.
2752 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2753 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2754 (Target_x86_64::got_tlsdesc_section): New function.
2755 (Target_x86_64::got_section): Create space for GOT entries for
2756 TLSDESC relocations.
2757 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2758 R_386_TLS_GOTDESC.
2759 (Target_x86_64::Scan::global): Likewise.
2760 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2761 using TLSDESC GOT.
2762
0c10a0a6
ILT
27632010-08-02 Ian Lance Taylor <iant@google.com>
2764
2765 * testsuite/final_layout.sh: Use dc to convert from hex to
2766 decimal.
2767
41cbeecc
ST
27682010-07-29 Sriraman Tallam <tmsriram@google.com>
2769
2770 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2771 paramter to the call to gold::gc_process_relocs.
2772 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2773 paramter to the call to gold::gc_process_relocs.
2774 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2775 parameter to the call to gold::gc_process_relocs.
2776 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2777 template parameter to the call to gold::gc_process_relocs.
2778 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2779 paramter to the call to gold::gc_process_relocs.
2780 * gc.h (get_embedded_addend_size): New function.
2781 (gc_process_relocs): Save the size of the reloc for use by ICF.
2782 * icf.cc (get_section_contents): Get the addend from the text section
2783 for SHT_REL relocation sections.
2784 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2785 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2786 * int_encoding.h (read_from_pointer): New overloaded function.
2787 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2788 * testsuite/icf_sht_rel_addend_test.sh: New file.
2789 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2790 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2791
6ea55b82
RW
27922010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2793
2794 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2795 * Makefile.in: Regenerate.
2796 * testsuite/Makefile.in: Regenerate.
2797
9691462b
ILT
27982010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2799
2800 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2801 * gold/testsuite/debug_msg.cc: Likewise.
2802 * gold/testsuite/odr_violation1.cc
2803 * gold/testsuite/odr_violation2.cc
2804
76897331
CC
28052010-07-21 Cary Coutant <ccoutant@google.com>
2806
2807 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2808 string, and length fields.
2809 (Output_merge_string::Merged_strings_list): New type.
2810 (Output_merge_string::Merged_strings_lists): New typedef.
2811 (Output_merge_string): Replace merged_strings_ with
2812 merged_strings_lists_.
2813 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2814 Merged_strings_list per input object and section. Don't store pointer
2815 to the string. Don't store length with each merged string entry.
2816 (Output_merge_string::finalize_merged_data): Loop over list of merged
2817 strings lists. Recompute length of each merged string.
2818
78384e8f
CC
28192010-07-15 Cary Coutant <ccoutant@google.com>
2820
2821 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2822 here.
2823
783659f9
ILT
28242010-07-14 Ian Lance Taylor <iant@google.com>
2825
2826 * descriptors.cc (Descriptors::open): Report correct name in error
2827 message.
2828
131687b4
DK
28292010-07-13 Doug Kwan <dougkwan@google.com>
2830
2831 * arm.cc (Arm_input_section::Arm_input_section): For a
2832 SHT_ARM_EXIDX section, always keeps the input sections.
2833 (Arm_input_section::set_exidx_section_link): New method.
2834 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2835 has_errors_ to false.
2836 (Arm_exidx_input_section::has_errors,
2837 Arm_exidx_input_section::set_has_errors): New methods.
2838 (Arm_exidx_input_section::has_errors_): New data member.
2839 (Arm_relobj::get_exidx_shndx_list): New method.
2840 (Arm_output_section::append_text_sections_to_list): Do not skip
2841 section without SHF_EXECINSTR.
2842 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2843 errors.
2844 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2845 section header. Make error messages more verbose. Check for
2846 a non-executable section linked to an EXIDX section.
2847 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2848 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2849 check that there is no deferred EXIDX section if we exit early.
2850 Instead of not making an EXIDX section in case of an error, make one
2851 and set the has_errors flag of it.
2852 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2853 in a relocatable link.
2854 (Target_arm::do_relax): Look for the EXIDX output section instead of
2855 assuming that it is called .ARM.exidx.
2856 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2857 section list. Do not check for SHF_EXECINSTR section flags but
2858 skip any input section with errors.
2859 * output.cc (Output_section::Output_section): Initialize
2860 always_keeps_input_sections_ to false.
2861 (Output_section::add_input_section): Check for
2862 always_keeps_input_sections_.
2863 * output.h (Output_section::always_keeps_input_sections,
2864 Output_section::set_always_keeps_input_sections): New methods.
2865 (Output_section::always_keeps_input_sections): New data member.
2866
69517287
RÁE
28672010-07-13 Rafael Espindola <espindola@google.com>
2868
2869 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2870 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2871
82742395
ILT
28722010-07-13 Philip Herron <herron.philip@googlemail.com>
2873 Ian Lance Taylor <iant@google.com>
2874
2875 * output.h (Output_section_lookup_maps::add_merge_section):
2876 Correct check of whether value was inserted.
2877 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2878 (Output_section_lookup_maps::add_relaxed_input_section):
2879 Likewise.
2880 * arm.cc (Target_arm::got_section): Remove used local os.
2881 * i386.cc (Target_i386::got_section): Likewise.
2882 * x86_64.cc (Target_x86_64::got_section): Likewise.
2883 * sparc.cc (Target_sparc::got_section): Likewise.
2884 (Target_sparc::relocate): Remove unused local have_got_offset.
2885 * powerpc.cc (Target_powerpc::relocate): Likewise.
2886
f2d707b5
ILT
28872010-07-13 Ian Lance Taylor <iant@google.com>
2888
241531d6
ILT
2889 * compressed_output.cc (zlib_decompress): Fix signature in
2890 !HAVE_ZLIB_H case.
2891
f2d707b5
ILT
2892 * archive.cc (Archive::include_member): Unlock an external member
2893 of a thin archive. Don't bother to delete an object we know is
2894 NULL.
2895
a2e47362
CC
28962010-07-12 Cary Coutant <ccoutant@google.com>
2897
2898 * compressed_output.cc (zlib_decompress): New function.
2899 (get_uncompressed_size): New function.
2900 (decompress_input_section): New function.
2901 * compressed_output.h (get_uncompressed_size): New function.
2902 (decompress_input_section): New function.
2903 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2904 Handle compressed debug sections.
2905 * layout.cc (is_compressed_debug_section): New function.
2906 (Layout::output_section_name): Map compressed section names to
2907 canonical names.
2908 * layout.h (is_compressed_debug_section): New function.
2909 (is_debug_info_section): Recognize compressed debug sections.
2910 * merge.cc: Include compressed_output.h.
2911 (Output_merge_data::do_add_input_section): Handle compressed
2912 debug sections.
2913 (Output_merge_string::do_add_input_section): Handle compressed
2914 debug sections.
2915 * object.cc: Include compressed_output.h.
2916 (Sized_relobj::Sized_relobj): Initialize new data members.
2917 (build_compressed_section_map): New function.
2918 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2919 * object.h (Object::section_is_compressed): New method.
2920 (Object::do_section_is_compressed): New method.
2921 (Sized_relobj::Compressed_section_map): New type.
2922 (Sized_relobj::do_section_is_compressed): New method.
2923 (Sized_relobj::compressed_sections_): New data member.
2924 * output.cc (Output_section::add_input_section): Handle compressed
2925 debug sections.
2926 * reloc.cc: Include compressed_output.h.
2927 (Sized_relobj::write_sections): Handle compressed debug sections.
2928
ce279a62
CC
29292010-07-08 Cary Coutant <ccoutant@google.com>
2930
2931 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2932 weak when resolving to a dynamic def.
2933 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2934 for weak undef/dynamic def cases. Adjust callers.
2935 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2936 undef_binding_weak_.
2937 (Symbol_table::sized_write_globals): Adjust symbol binding.
2938 (Symbol_table::sized_write_symbol): Add binding parameter.
2939 * symtab.h (Symbol::set_undef_binding): New method.
2940 (Symbol::is_undef_binding_weak): New method.
2941 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2942 (Symbol_table::should_override): Add new parameter.
2943 (Symbol_table::sized_write_symbol): Add new parameter.
2944
2945 * testsuite/weak_undef_file1.cc: Add new test case.
2946 * testsuite/weak_undef_file2.cc: Fix header comment.
2947 * testsuite/weak_undef_test.cc: Add new test case.
2948
b2286c10
DK
29492010-06-29 Doug Kwan <dougkwan@google.com>
2950
2951 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2952 Initialize USE_SYMBOL_.
2953 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2954 definition.
2955 (Arm_reloc_property::uses_symbol_): New data member declaration.
2956 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2957 uses symbol value and symbol is undefined but not weakly undefined.
2958
4802450a
RÁE
29592010-06-28 Rafael Espindola <espindola@google.com>
2960
2961 * plugin.cc (Plugin::load): Use dlerror.
2962
e5ca47ba
ILT
29632010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2964
2965 * symtab.cc (detect_odr_violations): When reporting an ODR
2966 violation, report an object where the symbol is defined.
2967
8a75a161
DK
29682010-06-25 Doug Kwan <dougkwan@google.com>
2969
2970 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2971 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2972 definition.
2973 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2974 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2975 target hook to detect function points.
2976 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2977 * icf.h (Icf::check_section_for_function_pointers): Change type of
2978 parameter SECTION_NAME to const reference to std::string. Use
2979 target hook to determine if section may have unsafe pointers.
2980 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2981 method definition.
2982
42218b9f
RÁE
29832010-06-21 Rafael Espindola <espindola@google.com>
2984
2985 * fileread.cc (Input_file::find_fie): New
2986 (Input_file::open): Use Input_file::find_fie.
2987 * fileread.h (Input_file::find_fie): New
2988 * plugin.cc (set_extra_library_path): New.
2989 (Plugin::load): Add set_extra_library_path to the transfer vector.
2990 (Plugin_manager::set_extra_library_path): New.
2991 (Plugin_manager::add_input_file): Use the extra search path if set.
2992 (set_extra_library_path(): New.
2993 * plugin.h (Plugin_manager): Add set_extra_library_path and
2994 extra_search_path_.
2995
a0506cca
CC
29962010-06-19 Cary Coutant <ccoutant@google.com>
2997
2998 * layout.cc (gdb_sections): Add .debug_types.
2999 (lines_only_debug_sections): Likewise.
3000
6508b958
RÁE
30012010-06-18 Rafael Espindola <espindola@google.com>
3002
3003 * plugin.cc (add_input_file,add_input_library)
3004 (Plugin_manager::add_input_file): Make filename arguments const.
3005 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3006 const.
3007
3e235302
DK
30082010-06-16 Doug Kwan <dougkwan@google.com>
3009
3010 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3011 .ARM.attributes section if we have not merged any input
3012 attributes sections.
3013
106e8a6c
DK
30142010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3015
3016 * arm.cc: Allow combining objects with no EABI version
3017 information.
3018
91ff43fe
RÁE
30192010-06-15 Rafael Espindola <espindola@google.com>
3020
3021 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3022
68ed838c
ILT
30232010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3024
3025 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3026 (struct iovec): Correct !HAVE_READV definition.
3027
f3a2388f
CC
30282010-06-10 Cary Coutant <ccoutant@google.com>
3029
3030 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3031 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3032 reloc sections.
3033 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3034
3035 PR 11683
3036 * symtab.h (Symbol::is_placeholder): New member function.
3037 * target-reloc.h (relocate_section): Check for placeholder symbols.
3038
3039 * testsuite/Makefile.am (plugin_test_8): New test.
3040 (plugin_test_9): New test.
3041 * testsuite/Makefile.in: Regenerate.
3042
e1df38aa
NC
30432010-06-09 Nick Clifton <nickc@redhat.com>
3044
3045 * yyscript.y (input_list_element): Allow strings prefixed with
3046 the '-' character. Treat these as libraries.
3047 * script.cc (script_add_library): New function. Adds a library
3048 specified by "-l<name>" found in an input script.
3049 * script-c.h: Add prototype for script_add_library.
3050
25bbe950
DK
30512010-06-07 Doug Kwan <dougkwan@google.com>
3052
3053 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3054 Restrict stub-group size to be within long conditional branch
3055 range when working around cortex-A8 erratum.
3056
0f32ea4c
ILT
30572010-06-07 Damien Diederen <dd@crosstwine.com>
3058
3059 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3060 #ifdef typo.
3061
8fe2a369
ST
30622010-06-03 Sriraman Tallam <tmsriram@google.com>
3063
3064 PR gold/11658
3065 * output.cc
3066 (Output_section::Input_section_sort_entry::compare_section_ordering):
3067 Change to return non-zero correctly.
3068 (Output_section::Input_section_sort_section_order_index_compare
3069 ::operator()): Change to fix ambiguity in comparisons.
3070
6e9ba2ca
ST
30712010-06-01 Sriraman Tallam <tmsriram@google.com>
3072
3073 * gold.h (is_wildcard_string): New function.
3074 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3075 (Layout::layout_eh_frame): Ditto.
3076 (Layout::find_section_order_index): New method.
3077 (Layout::read_layout_from_file): New method.
3078 * layout.h (Layout::find_section_order_index): New method.
3079 (Layout::read_layout_from_file): New method.
3080 (Layout::input_section_position_): New private member.
3081 (Layout::input_section_glob_): New private member.
3082 * main.cc (main): Call read_layout_from_file here.
3083 * options.h (--section-ordering-file): New option.
3084 * output.cc (Output_section::input_section_order_specified_): New
3085 member.
3086 (Output_section::Output_section): Initialize new member.
3087 (Output_section::add_input_section): Add new parameter.
3088 Keep input sections when --section-ordering-file is used.
3089 (Output_section::set_final_data_size): Sort input sections when
3090 section ordering file is specified.
3091 (Output_section::Input_section_sort_entry): Add new parameter.
3092 Check sorting type.
3093 (Output_section::Input_section_sort_entry::compare_section_ordering):
3094 New method.
3095 (Output_section::Input_section_sort_compare::operator()): Change to
3096 consider section_order_index.
3097 (Output_section::Input_section_sort_init_fini_compare::operator()):
3098 Change to consider section_order_index.
3099 (Output_section::Input_section_sort_section_order_index_compare
3100 ::operator()): New method.
3101 (Output_section::sort_attached_input_sections): Change to sort
3102 according to section order when specified.
e1df38aa
NC
3103 (Output_section::add_input_section<32, true>): Add new parameter.
3104 (Output_section::add_input_section<64, true>): Add new parameter.
3105 (Output_section::add_input_section<32, false>): Add new parameter.
3106 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
3107 * output.h (Output_section::add_input_section): Add new parameter.
3108 (Output_section::input_section_order_specified): New
3109 method.
3110 (Output_section::set_input_section_order_specified): New method.
3111 (Input_section::Input_section): Initialize section_order_index_.
3112 (Input_section::section_order_index): New method.
3113 (Input_section::set_section_order_index): New method.
3114 (Input_section::section_order_index_): New member.
3115 (Input_section::Input_section_sort_section_order_index_compare): New
3116 struct.
3117 (Output_section::input_section_order_specified_): New member.
3118 * script-sections.cc (is_wildcard_string): Delete and move modified
3119 method to gold.h.
3120 (Output_section_element_input::Output_section_element_input): Modify
3121 call to is_wildcard_string.
3122 (Output_section_element_input::Input_section_pattern
3123 ::Input_section_pattern): Ditto.
3124 (Output_section_element_input::Output_section_element_input): Ditto.
3125 * testsuite/Makefile.am (final_layout): New test case.
3126 * testsuite/Makefile.in: Regenerate.
3127 * testsuite/final_layout.cc: New file.
3128 * testsuite/final_layout.sh: New file.
3129
3537c84b
RÁE
31302010-06-01 Rafael Espindola <espindola@google.com>
3131
3132 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3133
105b6afd
RÁE
31342010-06-01 Rafael Espindola <espindola@google.com>
3135
3136 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3137 visibility of symbols.
3138
29e11421
DK
31392010-05-27 Doug Kwan <dougkwan@google.com>
3140
3141 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3142 from start of output section instead of address for a local symbol
3143 in a merged or relaxed section when doing a relocatable link.
3144
5e0f337e
RÁE
31452010-05-26 Rafael Espindola <espindola@google.com>
3146
3147 PR 11604
3148 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3149 adding sections the garbage collector removed.
3150 * gold/testsuite/Makefile.am: Add test.
3151 * gold/testsuite/Makefile.in: Regenerate.
3152 * gold/testsuite/plugin_test_7.sh: New.
3153 * gold/testsuite/plugin_test_7_1.c: New.
3154 * gold/testsuite/plugin_test_7_2.c: New.
3155
f4187277
RÁE
31562010-05-26 Rafael Espindola <espindola@google.com>
3157
3158 * script-sections.cc (Output_section_definition::set_section_addresses):
3159 Check for --section-start.
3160
5c388529
DK
31612010-05-26 Doug Kwan <dougkwan@google.com>
3162
3163 * arm.cc (Arm_scan_relocatable_relocs): New class.
3164 (Target_arm::relocate_special_relocatable): New method.
3165 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3166 (Arm_relocate_functions::thumb_branch_common): Same.
3167 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3168 instead of Default_scan_relocatable_relocs.
3169 * target-reloc.h (relocate_for_relocatable): Let target handle
3170 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3171 * target.h (Sized_target::relocate_special_relocatable): New method.
3172
bca1c3ae
ILT
31732010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3174
3175 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3176
0439c796
DK
31772010-05-23 Doug Kwan <dougkwan@google.com>
3178
3179 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3180 instead of a cast.
3181 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3182 with a direct branch, not a conditional branch, to a stub.
3183 * merge.cc (Output_merge_base::record_input_section): New method
3184 defintion.
3185 (Output_merge_data::do_add_input_section): Record input section if
3186 keeps-input-sections flag is set.
3187 (Output_merge_string::do_add_input_section): Ditto.
3188 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3189 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3190 INPUT_SECTIONS_.
3191 (Output_merge_base::keeps_input_sections,
3192 Output_merge_base::set_keeps_input_sections,
3193 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3194 method definitions.
3195 (Output_merge_base::Input_sections): New type declaration.
3196 (Output_merge_base::input_sections_begin,
3197 Output_merge_base::input_sections_end,
3198 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3199 (Output_merge_base::bool keeps_input_sections_,
3200 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3201 Output_merge_base::input_sections_): New data members.
3202 (Output_merge_data::do_set_keeps_input_sections): New method
3203 defintion.
3204 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3205 * output.cc (Output_section::Input_section::relobj): Move method
3206 defintion from class declaration to here and handle merge sections.
3207 (Output_section::Input_section::shndx): Ditto.
3208 (Output_section::Output_section): Remove initializations of removed
3209 data members and initialize new data member LOOKUP_MAPS_.
3210 (Output_section::add_input_section): Set keeps-input-sections flag
3211 for a newly created merge output section as appropriate. Adjust code
3212 to use Output_section_lookup_maps class.
3213 (Output_section::add_relaxed_input_section): Adjst code for lookup
3214 maps code refactoring.
3215 (Output_section::add_merge_input_section): Add a new parameter
3216 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3217 class. If adding input section to a newly created merge output
3218 section fails, remove the new merge section.
3219 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 3220 Adjust code for use of the Output_section_lookup_maps class.
0439c796
DK
3221 (Output_section::find_merge_section): Ditto.
3222 (Output_section::build_lookup_maps): New method defintion.
3223 (Output_section::find_relaxed_input_section): Adjust code to use
3224 Output_section_lookup_maps class.
3225 (Output_section::get_input_sections): Export merge sections. Adjust
3226 code to use Output_section_lookup_maps class.
3227 (Output_section:::add_script_input_section): Adjust code to use
3228 Output_section_lookup_maps class. Update lookup maps for merge
3229 sections also.
3230 (Output_section::discard_states): Use Output_section_lookup_maps.
3231 (Output_section::restore_states): Same.
3232 * output.h (Merge_section_properties): Move class defintion out of
3233 Output_section.
3234 (Output_section_lookup_maps): New class.
3235 (Output_section::Input_section::is_merge_section): New method
3236 defintion.
3237 (Output_section::Input_section::relobj): Move defintion out of class
3238 defintion. Declare method only.
3239 (Output_section::Input_section::shndx): Ditto.
3240 (Output_section::Input_section::output_merge_base): New method defintion.
3241 (Output_section::Input_section::u2_.pomb): New union field.
3242 (Output_section::Merge_section_by_properties_map,
3243 Output_section::Output_section_data_by_input_section_map,
3244 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3245 Remove types.
3246 (Output_section::add_merge_input_section): Add new parameter
3247 KEEPS_INPUT_SECTIONS.
3248 (Output_section::build_lookup_maps): New method declaration.
3249 (Output_section::merge_section_map_,
3250 Output_section::merge_section_by_properties_map_,
3251 Output_section::relaxed_input_section_map_,
3252 Output_section::is_relaxed_input_section_map_valid_): Remove data
3253 members.
3254 (Output_section::lookup_maps_): New data member.
3255
76295588
L
32562010-05-21 Doug Kwan <dougkwan@google.com>
3257
3258 PR gold/11619
3259 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3260 avoid a compilation error.
3261
d103a984
RÁE
32622010-05-19 Rafael Espindola <espindola@google.com>
3263
3264 * script-sections.cc (Output_section_definition::allocate_to_segment):
3265 Update the phdrs_list even when the output section is NULL.
3266 * testsuite/Makefile.am: Add test.
3267 * testsuite/Makefile.in: Regenerate.
3268 * testsuite/script_test_9.cc: New.
3269 * testsuite/script_test_9.sh: New.
3270 * testsuite/script_test_9.t: New.
3271
6625d24e
DK
32722010-05-19 Doug Kwan <dougkwan@google.com>
3273
3274 * arm.cc (Arm_input_section::original_size): New method.
3275 (Arm_input_section::do_addralign): Add a cast.
3276 (Arm_input_section::do_output_offset): Remove static cast.
3277 (Arm_input_section::original_addralign,
3278 Arm_input_section::original_size_): Change type to uint32_t.
3279 (Arm_input_section::init): Add safe casts for section alignment
3280 and size.
3281 (Arm_input_section::set_final_data_size): Do not set address and
3282 offset of stub table.
3283 (Arm_output_section::fix_exidx_coverage): Change use of of
3284 Output_section::Simple_input_section to that of
3285 Output_section::Input_section.
3286 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3287 except for the first pass.
3288 * output.cc (Output_section::get_input_sections): Change type of
3289 input_sections to std::list<Input_section>.
3290 (Output_section::add_script_input_section): Rename from
3291 Output_section::add_simple_input_section. Change type of SIS
3292 parameter from Simple_input_section to Input_section.
3293 * output.h (Output_section::Simple_input_section): Remove class.
3294 (Output_section::Input_section): Change class visibility to public.
3295 (Output_section::Input_section::addralign): Use stored alignments
3296 for special input sections if set.
3297 (Output_section::Input_section::set_addralign): New method.
3298 (Output_section::get_input_sections): Change parameter type from
3299 list of Simple_input_section to list of Input_section.
3300 (Output_section::add_script_input_section): Rename from
3301 Output_section::add_simple_input_section. Change first parameter's
3302 type from Simple_input_section to Input_section and remove the
3303 second and third parameters.
3304 * script-sections.cc (Input_section::Input_section_list): Change
3305 type to list of Output_section::Input_section/
3306 (Input_section_info::Input_section_info): Change parameter type of
3307 INPUT_SECTION to Output_section::Input_section.
3308 (Input_section_info::input_section): Change return type.
3309 (Input_section_info::input_section_): Change type to
3310 Output_section::Input_section.
3311 (Output_section_element_input::set_section_addresses): Adjust code
3312 to use Output_section::Input_section instead of
3313 Output_section::Simple_input_section. Adjust code for renaming
3314 of Output_section::add_simple_input_section.
3315 (Orphan_output_section::set_section_addresses): Ditto.
3316
e1e82ea4
RW
33172010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3318
3319 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3320 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3321
91e75c8a
RÁE
33222010-05-18 Rafael Espindola <espindola@google.com>
3323
3324 * options.cc (General_options::finalize): Handle -nostdlib.
3325 * options.h (nostdlib): New option.
3326 * script.cc (script_add_search_dir): Handle -nostdlib.
3327
da59ad79
DK
33282010-05-12 Doug Kwan <dougkwan@google.com>
3329
3330 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3331 attributes section only if there no attributes section after merging.
3332 (Target_arm::merge_object_attributes): Move value of
e1df38aa 3333 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
3334 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3335 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3336 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3337 and arm_attr_merge_7.stdout.
3338 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3339 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3340 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3341 arm_attr_merge_7b.o): New rules.
3342 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3343 arm_attr_merge_7
3344 * testsuite/Makefile.in: Regenerate.
3345 * testsuite/arm_attr_merge.sh: New file.
3346 * testsuite/arm_attr_merge_[67][ab].s: Same.
3347
3e01a7fd
NC
33482010-05-05 Nick Clifton <nickc@redhat.com>
3349
3350 * po/es.po: Updated Spanish translation.
3351
7ad2014a
L
33522010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3353
3354 * Makefile.am (install-exec-local): Properly install gold as
3355 default cross linker.
3356 * Makefile.in: Regenerated.
3357
4fda8867
NC
33582010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3359 Nick Clifton <nickc@redhat.com>
3360
3361 * configure.ac (install_as_default): Define and set to false
3362 unless --enable-gold or --enable-gold=both/gold has been
3363 specified.
3364 * configure: Regenerate.
3365
3366 * Makefile.am (install-exec-local): Install the executable as
3367 'ld.gold'. If install_as_default is true then also install it as
3368 'ld'.
3369 * Makefile.in: Regenerated.
3370
bd288ea2
ILT
33712010-04-24 Ian Lance Taylor <iant@google.com>
3372
3373 * layout.cc (Layout::layout_reloc): In relocatable link don't
3374 combine reloc sections for grouped sections.
3375
ef38fd8a
ST
33762010-04-23 Sriraman Tallam <tmsriram@google.com>
3377
3378 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3379 sections that are not ordinary to icf.
3380 * icf.cc (get_section_contents): Handle relocation pointing to section
3381 with no object or shndx information.
3382 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3383 * testsuite/Makefile.in: Regenerate.
3384 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3385 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3386
f6973bdc
ILT
33872010-04-22 Ian Lance Taylor <iant@google.com>
3388
3389 * expression.cc (Expression::Expression_eval_info): Add
3390 result_alignment_pointer field.
3391 (Expression::eval_with_dot): Add result_alignment_pointer
3392 parameter. Change all callers.
3393 (Expression::eval_maybe_dot): Likewise.
3394 (class Binary_expression): Add alignment_pointer parameter to
3395 left_value and right_value. Change all callers.
3396 (BINARY_EXPRESSION): Set result alignment.
3397 (class Trinary_expression): Add alignment_pointer parameter to
3398 arg2_value and arg3_value. Change all callers.
3399 (Trinary_cond::value): Set result alignment.
3400 (Max_expression::value, Min_expression::value): Likewise.
3401 (Align_expression::value): Likewise.
3402 * script-sections.cc (class Sections_element): Add dot_alignment
3403 parameter to set_section_addresses virtual function. Update
3404 instantiations.
3405 (class Output_section_element): Likewise.
3406 (Script_sections::create_segments): Add dot_alignment parameter.
3407 Change all callers.
3408 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3409 (Script_sections::set_phdrs_clause_addresses): Likewise.
3410 * script-sections.h: Update declarations.
3411 * script.h: Update declarations.
3412 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3413 min_p_align.
3414 * testsuite/script_test_3.t: Set large alignment.
3415 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3416 segment has expected alignment.
3417
9c9c98a5
NC
34182010-04-22 Nick Clifton <nickc@redhat.com>
3419
3420 * po/gold.pot: Updated by the Translation project.
3421 * po/vi.po: Updated Vietnamese translation.
3422
2253bfba
L
34232010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3424
3425 * testsuite/Makefile.am (check_PROGRAMS): Add
3426 icf_virtual_function_folding_test.
3427 * testsuite/Makefile.in: Regenerated.
3428
85fdf906
AH
34292010-04-15 Andrew Haley <aph@redhat.com>
3430
3431 * options.h (merge_exidx_entries): New option.
3432 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3433 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3434 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3435 (Target_arm::merge_exidx_entries): New function.
3436 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3437 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3438 to Arm_exidx_fixup constructor.
3439 Add new arg, merge_exidx_entries.
3440 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3441 Arm_output_section::fix_exidx_coverage.
3442
ce97fa81
ST
34432010-04-18 Sriraman Tallam <tmsriram@google.com>
3444
3445 * icf.cc (get_section_contents): Check for preemptible functions.
3446 Ignore addend when appropriate.
3447 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3448 section folded.
3449 (add_from_relobj): Check for section folded.
3450 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3451 * symtab.h (should_add_dynsym_entry): Add new parameter.
3452 * target-reloc.h (scan_relocs): Check for section folded.
3453 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3454 Check reloc types for function pointers in shared objects.
3455 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3456 case.
3457 (icf_preemptible_functions_test): New test case.
3458 (icf_string_merge_test): New test case.
3459 * testsuite.Makefile.in: Regenerate.
3460 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3461 bar_glob. Refactor code.
3462 * testsuite/icf_preemptible_functions_test.cc: New file.
3463 * testsuite/icf_preemptible_functions_test.sh: New file.
3464 * testsuite/icf_string_merge_test.cc: New file.
3465 * testsuite/icf_string_merge_test.sh: New file.
3466 * testsuite/icf_virtual_function_folding_test.cc: New file.
3467 * testsuite/icf_virtual_function_folding_test.sh: New file.
3468
04ceb17c
DK
34692010-04-14 Doug Kwan <dougkwan@google.com>
3470
3471 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3472 for local symbol recounting if we remove a section due to ICF.
3473 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3474 there are no regular objects in input.
3475
153e7da4
DK
34762010-04-13 Doug Kwan <dougkwan@google.com>
3477
3478 * arm.cc (Arm_input_section::set_final_data_size): Compute
3479 accurate final data size instead of using current data size.
3480
4dbd9faf
DK
34812010-04-09 Doug Kwan <dougkwan@google.com>
3482
3483 * layout.cc (Layout::choose_output_section): Handle script section
3484 types.
3485 (Layout::make_output_section_for_script): Add section type parameter.
3486 Handle script section types.
3487 * layout.h (Layout::make_output_section_for_script): Add section
3488 type parameter.
3489 * output.cc (Output_section::Output_section): Initialize data member
3490 is_noload_.
3491 (Output_section::do_reset_address_and_file_offset): Do not set address
3492 to 0 if section is a NOLOAD section.
3493 * output.h (Output_section::is_noload): New method.
3494 (Output_section::set_is_noload): Ditto.
3495 (Output_section::is_noload_): New data member.
3496 * script-c.h (Script_section_type): New enum type.
3497 (struct Parser_output_section_header): Add new file section_type.
3498 * script-sections.cc (Sections_element::output_section_name): Add
3499 parameter for returning script section type.
3500 (Output_section_definition::output_section_name): Ditto.
3501 (Output_section_definition::section_type)P; New method.
3502 (Output_section_definiton::script_section_type_name): Ditto.
3503 (Output_section_definition::script_section_type_): New data member.
3504 (Output_section_definition::Output_section_definition): Initialize
3505 data member Output_section_definition::script_section_type_.
3506 (Output_section_definition::create_sections): Pass script section type
3507 to Layout::make_output_section_for_script.
3508 (Output_section_definition::output_section_name): Return script
3509 section type to caller.
3510 (Output_section_definition::set_section_address): Do not advance
3511 dot value and load address if section type is NOLOAD. Set address
3512 of NOLOAD sections regardless of section flags.
3513 (Output_section_definition::print): Print section type if it is
3514 not SCRIPT_SECTION_TYPE_NONE.
3515 (Output_section_definition::section_type): New method.
3516 (Output_section_definition::script_section_type_name): Ditto.
3517 (Script_sections::output_section_name): Add new parameter
3518 PSECTION_TYPE for returning script section type. Pass it to
3519 section elements. Handle discard sections.
3520 (Sort_output_sections::operator()): Handle NOLOAD sections.
3521 * script-sections.h (Script_sections::Section_type): New enum type.
3522 (Script_sections::output_section_name): Add a new parameter for
3523 returning script section type.
3524 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3525 INFO and NOLOAD.
3526 * yyscript.y (union): Add new field SECTION_TYPE.
3527 (COPY, DSECT, INFO, NOLOAD): New tokens.
3528 (opt_address_and_section_type): Change type to output_section_header.
3529 (section_type): New non-terminal
3530 (section_header): Handle section type.
2253bfba 3531 (opt_address_and_section_type): Return section type value.
4dbd9faf 3532
721ea635
L
35332010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3534
3535 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3536 * testsuite/plugin_common_test_2.c (foo): Likewise.
3537
6bf924b0
DK
35382010-04-08 Doug Kwan <dougkwan@google.com>
3539
3540 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3541 Output_merge_data.
3542 * output.cc (Output_section::add_merge_input_section): Simplify
3543 code and return status of Output_merge_base::add_input_section.
e1df38aa 3544 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
3545 returns true.
3546
24af6f92
DK
35472010-04-07 Doug Kwan <dougkwan@google.com>
3548
3549 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3550 if section is marked as containing instructions but has no mapping
3551 symbols.
3552 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3553 correct section index.
3554 (Arm_relobj::find_linked_text_section): Ditto.
3555
00698fc5
CC
35562010-04-07 Cary Coutant <ccoutant@google.com>
3557
3558 * archive.cc (include_member): Destroy Read_symbols_data object before
3559 releasing file.
3560 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3561 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3562 (Read_symbols_data::~Read_symbols_data) New destructor.
3563 (Section_relocs::Section_relocs) New constructor.
3564 (Section_relocs::~Section_relocs) New destructor.
3565 (Read_relocs_data::Read_relocs_data) New constructor.
3566 (Read_relocs_data::~Read_relocs_data) New destructor.
3567 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3568 pointers to NULL after deleting.
3569
7296d933
DK
35702010-04-07 Doug Kwan <dougkwan@google.com>
3571
3572 * arm.cc: Replace "endianity" with "endianness" in comments.
3573 (Arm_exidx_cantunwind): Ditto.
3574 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3575 (Arm_relobj::merge_flags_and_attributes): New method.
3576 (Arm_relobj::merge_flags_and_attributes_): New data member.
3577 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3578 (Arm_relobj::scan_sections_for_stubs): Ditto.
3579 (Arm_relobj::do_read_symbols): Check to see if we really want to
3580 merge processor-specific flags and attributes. Exit early if
3581 an object is empty except for section names and the undefined symbol.
3582 (Target_arm::do_finalize_sections): Move check for ELF format to
3583 Arm_relobj::do_read_symbols. Merge processor specific flags and
3584 attributes from a regular object only when we have determined that
3585 it is aapropriate. Do not create an .ARM.attributes section in
3586 output if there is no regular input object.
3587 (Target_arm::merge_processor_specific_flags): Check
3588 --warn-mismatch before printing any error.
3589 (Target_arm::merge_object_attributes): Ditto.
3590 * gold.cc (queue_middle_tasks): Handle the case in which there is
3591 no regular object in input.
3592 * options.cc (General_options::parse_EB): New method.
3593 (General_options::parse_EL): Same.
3594 (General_options::General_options): Initialize endianness_.
3595 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3596 New options.
3597 (General_options::Endianness): New enum.
3598 (General_options::endianness): New method.
3599 (General_options::endianness_): New data member.
3600 * parameters.cc (Parameters::set_options): Check target endianness.
3601 (Parameters::set_target_once): Ditto.
3602 (Parameters::check_target_endianness): New method.
3603 (parameters_force_valid_target): If either -EL or -EB is specified,
3604 use it to define endianness of default target.
3605 * parameters.h (Parameters::check_target_endianness): New method
3606 declaration.
3607 * target.h (class Target): Change "endianity" to "endianness"
3608 in comments.
3609
efc8d4f2
RW
36102010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3611
3612 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3613 * configure: Regenerate.
3614 * Makefile.in: Regenerate.
3615 * testsuite/Makefile.in: Regenerate.
3616
be234d88
CC
36172010-04-06 Cary Coutant <ccoutant@google.com>
3618
3619 gcc PR lto/42757
3620 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3621 prevailing definitions of common symbols.
3622 * testsuite/plugin_test_6.sh: New test case.
3623 * testsuite/plugin_common_test_1.c: New test case.
3624 * testsuite/plugin_common_test_2.c: New test case.
3625 * testsuite/Makefile.am (plugin_test_6): New test case.
3626 * testsuite/Makefile.in: Regenerate.
3627
bd32c6bd
NC
36282010-04-06 Nick Clifton <nickc@redhat.com>
3629
3630 * po/vi.po: New Vietnamese translation.
3631
323c532f
DK
36322010-03-30 Doug Kwan <dougkwan@google.com>
3633
3634 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3635
4fcd97eb
DK
36362010-03-25 Doug Kwan <dougkwan@google.com>
3637
3638 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3639 to avoid a conversion warning on a 32-bit host.
3640
4ebf39db
ILT
36412010-03-24 Ian Lance Taylor <iant@google.com>
3642
3643 * testsuite/script_test_3.t: Add a TLS segment.
3644 * testsuite/Makefile.am (check_PROGRAMS): Add
3645 tls_phdrs_script_test.
3646 (tls_phdrs_script_test_SOURCES): Define.
3647 (tls_phdrs_script_test_DEPENDENCIES): Define.
3648 (tls_phdrs_script_test_LDFLAGS): Define.
3649 (tls_phdrs_script_test_LDADD): Define.
3650 * testsuite/Makefile.in: Rebuild.
3651
4a599bdd
CC
36522010-03-23 Cary Coutant <ccoutant@google.com>
3653
3654 * fileread.cc (find_or_make_view): Fix comment.
3655
6c93b22c
ILT
36562010-03-23 Ian Lance Taylor <iant@google.com>
3657
3658 * script-sections.cc (class Orphan_section_placement): Define
3659 PLACE_TLS and PLACE_TLS_BSS.
3660 (Orphan_section_placement::Orphan_section_placement): Initialize
3661 new places.
3662 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3663 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3664 (tls_script_test_SOURCES): Define.
3665 (tls_script_test_DEPENDENCIES): Define.
3666 (tls_script_test_LDFLAGS): Define.
3667 (tls_script_test_LDADD): Define.
3668 * testsuite/Makefile.in: Rebuild.
3669
a2c7281b
DK
36702010-03-22 Doug Kwan <dougkwan@google.com>
3671
3672 * arm.cc (Arm_relocate_functions::abs8,
3673 Arm_relocate_functions::abs16): Use correct check for overflow
3674 specified in the ARM ELF specs.
3675 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3676 target of a BLX instruction specially.
3677 (Reloc_stub::stub_type_for_reloc): Ditto.
3678 (Relocate::relocate): Use symbolic names instead of numeric relocation
3679 codes to report error.
3680 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3681 workaround.
3682 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3683 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3684 thumb2_blx_out_of_range.stdout
3685 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3686 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3687 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3688 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3689 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3690 thumb2_blx_in_range, thumb2_blx_in_range.o,
3691 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3692 thumb2_blx_out_of_range.o): New rules.
3693 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3694 thumb2_blx_in_range and thumb2_blx_out_of_range.
3695 * testsuite/Makefile.in: Regenerate.
3696 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3697 * testsuite/thumb_blx_in_range.s: New file.
3698 * testsuite/thumb_blx_out_of_range.s: New file.
3699
b0193076
RÁE
37002010-03-22 Rafael Espindola <espindola@google.com>
3701
3702 * archive.cc (Should_include): Move to archive.h.
3703 (should_include_member): Make it a member of Archive.
3704 (Lib_group): New.
3705 (Add_lib_group_symbols): New.
3706 * archive.h: Include options.h.
3707 (Archive_member): Moved from Archive.
3708 (Should_include): Moved from archive.cc.
3709 (Lib_group): New.
3710 (Add_lib_group_symbols): New.
3711 * dynobj.cc (do_should_include_member): New.
3712 * dynobj.h (do_should_include_member): New.
3713 * gold.cc (queue_initial_tasks): Update call to queue.
3714 * main.cc (main): Print lib group stats.
3715 * object.cc (do_should_include_member): New.
3716 * object.h: Include archive.h.
3717 (Object::should_include_member): New.
3718 (Object::do_should_include_member): New.
3719 (Sized_relobj::do_should_include_member): New.
3720 * options.cc (General_options::parse_start_lib): New.
3721 (General_options::parse_end_lib): New.
3722 (Input_arguments::add_file): Handle lib groups.
3723 (Input_arguments::start_group): Check we are not in a lib.
3724 (Input_arguments::start_lib): New.
3725 (Input_arguments::end_lib): New.
3726 * options.h (General_options): Add start_lib and end_lib.
3727 (Input_argument::lib_): New.
3728 (Input_argument::lib): New.
3729 (Input_argument::is_lib): New.
3730 (Input_file_lib): New.
3731 (Input_arguments::in_lib_): New.
3732 (Input_arguments::in_lib): New.
3733 (Input_arguments::start_lib): New.
3734 (Input_arguments::end_lib_): New.
3735 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3736 in unused members as preempted.
3737 (Sized_pluginobj::do_should_include_member): New.
3738 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3739 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3740 return the blocker.
3741 (Read_symbols::do_whole_lib_group): New.
3742 (Read_symbols::do_lib_group): New.
3743 (Read_symbols::do_read_symbols): Handle lib groups.
3744 (Read_symbols::get_name): Handle lib groups.
3745 * readsyms.h (Read_symbols): Add an archive member pointer.
3746 (Read_symbols::do_whole_lib_group): New.
3747 (Read_symbols::do_lib_group): New.
3748 (Read_symbols::member_): New.
3749 * script.cc (read_input_script): Update call to queue_soon.
3750
d099120c
DK
37512010-03-19 Doug Kwan <dougkwan@google.com>
3752
3753 * arm.cc (Stub_table::Stub_table): Initialize new data members
3754 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3755 (Stub_table::add_reloc_stub): Assign stub offset and update
3756 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3757 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3758 New data members.
3759 (Stub_table::update_data_size_and_addralign): Use
3760 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3761 instead of going over all reloc stubs.
3762 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3763 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3764 Stringpool_template::offset_ to size of Stringpool_char.
3765 (Stringpool_template::new_key_offset): Remove code to initialize
3766 Stringpool_template::offset_.
3767 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3768 Stringpool_template::offset_ to zero.
3769
1aa37384
DK
37702010-03-15 Doug Kwan <dougkwan@google.com>
3771
3772 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3773 offset_.
3774 (Stringpool_template::new_key_offset): New method.
3775 (Stringpool_template::add_string): Assign offsets when adding new
3776 strings.
3777 (Stringpool_template::set_string_offsets): Do not set string offsets
3778 when not optimizing.
3779 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3780 member size_.
3781 (Chunked_vector::clear): Clear size_.
3782 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3783 (Chunked_vector::size): Return size_.
3784 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 3785 (Chunked_vector::size_): New data member.
1aa37384
DK
3786 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3787 (Stringpool_template::new_key_offset): New method declaration.
3788 (Stringpool_template::offset_): New data member.
3789
b672b057
RÁE
37902010-03-15 Rafael Espindola <espindola@google.com>
3791
3792 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3793 Add_symbols' constructor.
3794 * readsyms.h (Add_symbols): Remove the input_group member.
3795
b6848d3c
ILT
37962010-03-10 Ian Lance Taylor <iant@google.com>
3797
3798 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3799 target to ask whether a reference to a symbol requires a stack
3800 split.
3801 * target.h (Target::is_call_to_non_split): New function.
3802 (Target::do_is_call_to_non_split): Declare virtual function.
3803 * target.cc: Include "symtab.h".
3804 (Target::do_is_call_to_non_split): New function.
3805 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3806
a2a5469e
CC
38072010-03-10 Cary Coutant <ccoutant@google.com>
3808
3809 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3810 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3811 (File_read::open[2]): Add whole_file_view_ to list of views.
3812 (File_read::make_view): Remove test of whole_file_view_.
3813 (File_read::find_or_make_view): Create whole_file_view_ if
3814 necessary.
3815 (File_read::clear_views): Replace bool parameter with enum;
3816 adjust all callers. Don't delete views with permanent data;
3817 do delete cached views and views from archives if
3818 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3819 if clearing the corresponding view.
3820 * fileread.h (File_read::Clear_views_mode): New enum.
3821 (File_read::View::is_permanent_view): New method.
3822 (File_read::clear_views): Replace bool parameter
3823 with enum; adjust all callers.
3824 * options.h (General_options): Change keep_files_mapped option;
3825 add map_whole_files.
3826 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3827 releasing the file.
3828 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3829 the file.
3830
8861f32b
DM
38312010-03-10 David S. Miller <davem@davemloft.net>
3832
3833 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3834
d62d0f5f
ST
38352010-03-09 Sriraman Tallam <tmsriram@google.com>
3836
3837 * icf.cc (get_section_contents): Add '@' marker after processing the
3838 merge reloc.
3839
9177756d
DK
38402010-03-08 Doug Kwan <dougkwan@google.com>
3841
3842 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3843 due to a conversion warning.
3844 (Arm_relobj::update_output_local_symbol_count): Check for local
3845 symbol with unset output index.
3846
9e9e071b
ILT
38472010-03-05 Ian Lance Taylor <iant@google.com>
3848
3849 * options.h (class General_options): Add --spare-dynamic-tags.
3850 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3851 --spare-dynamic-tags.
3852
a81ee015
ILT
38532010-03-05 Ian Lance Taylor <iant@google.com>
3854
3855 * incremental.cc: Include "libiberty.h".
3856
44ec90b9
RO
38572010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3858
3859 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3860 function, is_info_ member.
3861 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3862 (Versions::Versions): Update caller.
3863 (Versions::define_base_version): Likewise.
3864 (Versions::add_def): Likewise.
3865
0897ed3b
ST
38662010-03-03 Sriraman Tallam <tmsriram@google.com>
3867
3868 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3869 (Scan::possible_function_pointer_reloc): New function.
3870 (Scan::local_reloc_may_be_function_pointer): Change to call
3871 possible_function_pointer_reloc.
3872 (Scan::global_reloc_may_be_function_pointer): Ditto.
3873 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3874 relocations in ".data.rel.ro._ZTV" section.
3875 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3876 * testsuite/icf_safe_so_test.cc: Ditto.
3877 * testsuite/icf_safe_test.cc: Ditto.
3878 * testsuite/icf_safe_test.sh: Ditto.
3879
d3bbad62
ILT
38802010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3881 Ian Lance Taylor <iant@google.com>
3882
3883 * target-reloc.h (relocate_section): Check the symbol table index
3884 for -1U before setting the local symbol index.
3885 (scan_relocatable_relocs): If copying the relocation, record that
3886 the local symbol is required.
3887 * object.h (Symbol_value::is_output_symtab_index_set): New
3888 function.
3889 (Symbol_value::may_be_discarded_from_output_symtab): New
3890 function.
3891 (Symbol_value::has_output_symtab_entry): New function.
3892 (Symbol_value::needs_output_symtab_entry): Remove.
3893 (Symbol_value::output_symtab_index): Make sure the symbol index is
3894 set.
3895 (Symbol_value::set_output_symtab_index): Make sure the symbol
3896 index is not set. Make sure the new index is valid.
3897 (Symbol_value::set_must_have_output_symtab_entry): New function.
3898 (Symbol_value::has_output_dynsym_entry): New function.
3899 (Symbol_value::set_output_dynsym_index): Make sure the new index
3900 is valid.
3901 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3902 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3903 local symbol if permitted.
3904 (Sized_relobj::do_finalize_local_symbols): Call
3905 is_output_symtab_index_set rather than needs_output_symtab_entry.
3906 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3907 rather than needs_output_symtab_entry. Call
3908 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3909 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3910 is_output_symtab_index_set rather than needs_output_symtab_entry.
3911 * testsuite/discard_locals_relocatable_test.c: New file.
3912 * testsuite/discard_locals_test.sh: Test -r.
3913 * testsuite/Makefile.am (check_DATA): Add
3914 discard_locals_relocatable_test1.syms,
3915 discard_local_relocatable_test2.syms.
3916 (MOSTLYCLEANFILES): Likewise. Also add
3917 discard_locals_relocatable_test1.lout and
3918 discard_locals_relocatable_test2.out.
3919 (discard_locals_relocatable_test1.syms): New target.
3920 (discard_locals_relocatable_test.o): New target.
3921 (discard_locals_relocatable_test1.out): New target.
3922 (discard_locals_relocatable_test2.syms): New target.
3923 (discard_locals_relocatable_test2.out): New target.
3924 (various): Add missing ../ld-new dependencies.
3925 * testsuite/Makefile.in: Rebuild.
3926
7e8ccf26
NC
39272010-03-03 Nick Clifton <nickc@redhat.com>
3928
3929 * po/fi.po: New Finnish translation.
3930
2a0ff005
DK
39312010-03-01 Doug Kwan <dougkwan@google.com>
3932
3933 * layout.cc (Layout::Layout): Force section types of .init_array*,
3934 .preinit_array* and .fini_array* sections.
3935 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3936 Fix check of return value of std::string::find.().
3937 (Output_section::Input_section_sort_compare::operator()): Remove
3938 comment about .init_array.
3939 (Output_section::Input_section_sort_init_fini_compare::operator()):
3940 New method.
3941 (Output_section::sort_attached_input_sections): Handle .init_array
3942 and .fini_array specially.
3943 * output.h (Output_section::Inut_section_sort_compare): Update
3944 comment.
3945 (Output_section::Input_section_sort_init_fini_compare): New struct.
3946
c3e4ae29
DK
39472010-02-26 Doug Kwan <dougkwan@google.com>
3948
3949 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3950 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3951 * testsuite/debug_msg.sh: Avoid matching source line number for
3952 use of global variable undef_int.
3953
2fd9ae7a
DK
39542010-02-26 Doug Kwan <dougkwan@google.com>
3955
3956 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3957 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3958 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3959 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3960 * options.cc (General_options::General_options): Initialize member
3961 fix_v4bx_.
3962 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3963 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3964 and rm_no_fix_v4bx.stdout
3965 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3966 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3967 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3968 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3969 and arm_no_fix_v4bx.
3970 * Makefile.in: Regenerate.
3971 * testsuite/arm_fix_v4bx.s: New file.
3972 * testsuite/arm_fix_v4bx.sh: Ditto.
3973
67ec7d0b
DK
39742010-02-24 Doug Kwan <dougkwan@google.com>
3975
3976 * arm.cc (Target_arm::got_section): Make the .got section the first
3977 non RELRO section in the data segment.
3978 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3979 suffixes of section names.
3980
10165461
DK
39812010-02-24 Doug Kwan <dougkwan@google.com>
3982
3983 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3984 flags and attributes merging if an input file is a binary file.
3985 * fileread.cc (Input_file::open): Record format of original file.
3986 * fileread.h (Input_file::Format): New enum type.
3987 (Input_file::Input_file): Initialize data member format_.
3988 (Input_file::format): New method definition.
3989 (Input_file::format_):: New data member.
3990
4a54abbb
DK
39912010-02-24 Doug Kwan <dougkwan@google.com>
3992
3993 * arm.cc (Arm_output_data_got): New class.
3994 (ARM_TCB_SIZE): New constant
3995 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3996 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3997 If user uses a script with a SECTIONS clause, issue only a warning
3998 for a misplaced EXIDX input section. Otherwise, issue an error.
3999 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4000 garbage collection.
4001 (Target_arm::got_mode_index_entry): Handle static linking.
4002 (Target_arm::Scan::local): Ditto.
4003 (Target_arm::Scan::global): Ditto.
4004 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4005 all incorrectly implemented relocations.
e1df38aa 4006 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
4007 Arm_output_section::fix_exidx_coverage.
4008 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4009 from ".ARM.exidx." and ".ARM.extab.".
4010
ca419a6f
ILT
40112010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4012
4013 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4014 section if it does not already exist.
4015 * attributes.cc (Attributes_section_data::Attributes_section_data):
4016 Don't crash if size is zero.
4017
135b9c78
ILT
40182010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4019 Ian Lance Taylor <iant@google.com>
4020
4021 * gold.cc (queue_middle_tasks): If no input files were opened,
4022 exit.
4023 * workqueue.h (Task_function::Task_function): Assert that there is
4024 a blocker.
4025
bb0bfe4f
DK
40262010-02-22 Doug Kwan <dougkwan@google.com>
4027
4028 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4029 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4030 types to avoid warnings due to different uint64_t implementations
4031 on different hosts.
4032
2a2b6d42
DK
40332010-02-21 Doug Kwan <dougkwan@google.com>
4034
4035 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4036 handling of the maximum backward branch offset.
4037 (Arm_relocate_functions::thumb_branch_common): Ditto.
4038 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4039 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 4040 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
4041 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4042 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4043 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4044 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4045 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4046 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4047 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4048 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4049 thumb2_bl_out_of_range.o): New rules.
4050 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4051 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4052 thumb2_bl_out_of_range
4053 * testsuite/Makefile.in: Regenerate.
4054 * testsuite/arm_bl_in_range.s: New file.
4055 * testsuite/arm_bl_out_of_range.s: Ditto.
4056 * testsuite/arm_branch_in_range.sh: Ditto.
4057 * testsuite/arm_branch_range.t: Ditto.
4058 * testsuite/thumb2_branch_range.t: Ditto.
4059 * testsuite/thumb_bl_in_range.s: Ditto.
4060 * testsuite/thumb_bl_out_of_range.s: Ditto.
4061 * testsuite/thumb_branch_range.t: Ditto.
4062
b487ad64
ST
40632010-02-20 Sriraman Tallam <tmsriram@google.com>
4064
4065 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4066 Add reloc offset information.
4067 * icf.cc (get_section_contents): Change iterators to point to the new
4068 vectors. Add reloc offset information to the contents.
4069 * icf.h (Icf::Sections_reachable_info): New typedef.
4070 (Icf::Sections_reachable_list): New typedef.
4071 (Icf::Offset_info): New typedef.
4072 (Icf::Reloc_info): New struct typedef.
4073 (Icf::Reloc_info_list): New typedef.
4074 (Icf::symbol_reloc_list): Delete method.
4075 (Icf::addend_reloc_list): Delete method.
4076 (Icf::section_reloc_list): Delete method.
4077 (Icf::reloc_info_list): New method.
4078 (Icf::reloc_info_list_): New member.
4079
f96accdf
DK
40802010-02-19 Doug Kwan <dougkwan@google.com>
4081
4082 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4083 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4084 * arm.cc (Arm_relocation_functions): New forward declaration.
4085 (Target_arm::Target_arm): Initialize new data members
4086 got_mod_index_offset_ and tls_base_symbol_defined_.
4087 (Target_arm::Relocate::relocate_tls): New method.
4088 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4089 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4090 New methods.
4091 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4092 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4093 (Target_arm::got_mod_index_offset_,
4094 Target_arm::tls_base_symbol_defined_): New data members.
4095 (Target_arm::Scan::local, Target::Scan::global,
4096 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4097 relocations.
4098
c8761b9a
DK
40992010-02-18 Doug Kwan <dougkwan@google.com>
4100
4101 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4102 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4103 text section as a parameter becuase some broken tools may not set
4104 the link in section header.
4105 (Target_arm::has_got_section): New method.
4106 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4107 without any mapping symbol as data only. Remove warning.
4108 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4109 link in its section header, try to discover the link by inspecting the
4110 REL31 relocation at the beginning of the section.
4111 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4112 in error message.
4113 (Target_arm::Scan::global): Treat any reference to the symbol
4114 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4115
21bb3914
ST
41162010-02-12 Sriraman Tallam <tmsriram@google.com>
4117
4118 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4119 (Scan::global_reloc_may_be_function_pointer): New function.
4120 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4121 (Scan::global_reloc_may_be_function_pointer): New function.
4122 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4123 (Scan::global_reloc_may_be_function_pointer): New function.
4124 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4125 (Scan::global_reloc_may_be_function_pointer): New function.
4126 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4127 (Scan::global_reloc_may_be_function_pointer): New function.
4128 (Scan::possible_function_pointer_reloc): New function.
4129 (Target_x86_64::can_check_for_function_pointers): New function.
4130 * gc.h (gc_process_relocs): Scan relocation types to determine if
4131 function pointers were taken for targets that support it.
4132 * icf.cc (Icf::find_identical_sections): Include functions for
4133 folding in safe ICF whose pointer is not taken.
4134 * icf.h (Secn_fptr_taken_set): New typedef.
4135 (fptr_section_id_): New member.
4136 (section_has_function_pointers): New function.
4137 (set_section_has_function_pointers): New function.
4138 (check_section_for_function_pointers): New function.
4139 * options.h: Fix comment for safe ICF option.
4140 * target.h (can_check_for_function_pointers): New function.
4141 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4142 Modify icf_safe_test for X86-64.
4143 * testsuite/Makefile.in: Regenerate.
4144 * testsuite/icf_safe_so_test.cc: New file.
4145 * testsuite/icf_safe_so_test.sh: New file.
4146 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4147 (main): Change to take pointer to function kept_func_3.
4148 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4149 folding is done correctly for X86-64.
4150
0da6fa6c
DM
41512010-02-12 David S. Miller <davem@davemloft.net>
4152
4153 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4154 is_symbolless parameter.
4155 (Output_reloc<SHT_REL>::is_symbolless): New.
4156 (Output_reloc<SHT_REL>::is_symbolless_): New.
4157 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4158 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4159 (Output_reloc<SHT_RELA>::is_symbolless): New.
4160 (Output_data_reloc::add_global): Handle is_symbolless.
4161 (Output_data_reloc::add_global_relative): Likewise.
4162 (Output_data_reloc::add_local): Likewise.
4163 (Output_data_reloc::add_local_relative): Likewise.
4164 (Output_data_reloc::add_symbolless_global_addend): New.
4165 (Output_data_reloc::add_symbolless_local_addend): New.
4166 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4167 is_symbolless.
4168 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4169 instead of ->is_relative_
4170 (Output_reloc::write): Likewise.
4171 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4172 (Output_reloc::write_rel): Simplify.
4173
4174 * sparc.cc (Target_sparc::Scan::local): Use
4175 ->add_symbolless_local_addend as needed.
4176 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4177 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4178 based upon relocation offset.
4179
e4782e83
DK
41802010-02-11 Doug Kwan <dougkwan@google.com>
4181
4182 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4183 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4184 beginning of function.
4185 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4186 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4187 parameter is_32bit in calls to should_apply_static_reloc.
4188 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4189 (check_DATA): Add arm_abs_global.stdout.
4190 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4191 arm_abs_global.stdout): New rules.
4192 (MOSTLLYCLEANFILES): Add arm_abs_global
4193 * Makefile.in: Regenerate.
4194 * testsuite/arm_abs_global.s: New file.
4195 * testsuite/arm_abs_global.sh: Ditto.
4196 * testsuite/arm_abs_lib.s: Ditto.
4197
93ceb764
ILT
41982010-02-11 Ian Lance Taylor <iant@google.com>
4199
4200 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4201 Read_relocs task.
4202 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4203 Allocate_commons_task first.
4204 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4205 task, rather than symtab_lock_.
4206 (Gc_process_relocs::~Gc_process_relocs): New function.
4207 (Gc_process_relocs::is_runnable): Check this_blocker_.
4208 (Gc_process_relocs::locks): Use next_blocker_ rather than
4209 blocker_.
4210 (Scan_relocs::~Scan_relocs): New function.
4211 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4212 symtab_lock_.
4213 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4214 next_blocker_.
4215 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4216 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4217 constructor accordingly.
4218 (class Gc_process_relocs): Likewise.
4219 (class Scan_relocs): Likewise.
4220 * common.h (class Allocate_commons_task): Remove symtab_lock_
4221 field, and corresponding constructor parameter.
4222 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4223 symtab_lock_.
4224 (Allocate_commons_task::locks): Likewise.
4225
114dfbe1
ILT
42262010-02-11 Ian Lance Taylor <iant@google.com>
4227
4228 * gold-threads.h (class Once): Define.
4229 (class Initialize_lock): Rewrite as child of Once.
4230 * gold-threads.cc (class Once_initialize): Define.
4231 (once_pointer_control): New static variable.
4232 (once_pointer, once_arg): New static variables.
4233 (c_run_once): New static function.
4234 (Once::Once, Once::run_once, Once::internal_run): New functions.
4235 (class Initialize_lock_once): Remove.
4236 (initialize_lock_control): Remove.
4237 (initialize_lock_pointer): Remove.
4238 (initialize_lock_once): Remove.
4239 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4240 (Initialize_lock::initialize): Rewrite.
4241 (Initialize_lock::do_run_once): New function.
4242 * archive.cc (Archive::interpret_header): Only clear name if it is
4243 not already empty.
4244 * fileread.cc: Include "gold-threads.h"
4245 (file_counts_lock): New static variable.
4246 (file_counts_initialize_lock): Likewise.
4247 (File_read::release): Only increment counts when using --stats.
4248 Use a lock around the increment.
4249 * parameters.cc (class Set_parameters_target_once): Define.
4250 (set_parameters_target_once): New static variable.
4251 (Parameters::Parameters): Move here from parameters.h.
4252 (Parameters::set_target): Rewrite.
4253 (Parameters::set_target_once): New function.
4254 (Parameters::clear_target): Move here and rewrite.
4255 * parameters.h (class Parameters): Update declarations. Add
4256 set_parameters_target_once_ field.
4257 (Parameters::Parameters): Move to parameters.cc.
4258 (Parameters::clear_target): Likewise.
4259 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4260 task.
4261 (Start_group::~Start_group): New function.
4262 (Start_group::is_runnable): New function.
4263 (Start_group::locks, Start_group::run): New functions.
4264 (Finish_group::run): Change saw_undefined to size_t.
4265 * readsyms.h (class Start_group): Define.
4266 (class Finish_group): Change saw_undefined_ field to size_t.
4267 (Finish_group::Finish_group): Remove saw_undefined and
4268 this_blocker parameters. Change all callers.
4269 (Finish_group::set_saw_undefined): New function.
4270 (Finish_group::set_blocker): New function.
4271 * symtab.h (class Symbol_table): Change saw_undefined to return
4272 size_t. Change saw_undefined_ field to size_t.
4273 * target-select.cc (Set_target_once::do_run_once): New function.
4274 (Target_selector::Target_selector): Initialize set_target_once_
4275 field. Don't initialize lock_ and initialize_lock_ fields.
4276 (Target_selector::instantiate_target): Rewrite.
4277 (Target_selector::set_target): New function.
4278 * target-select.h (class Set_target_once): Define.
4279 (class Target_selector): Update declarations. Make
4280 Set_target_once a friend. Remove lock_ and initialize_lock_
4281 fields. Add set_target_once_ field.
4282
fa17a3f4
ILT
42832010-02-10 Ian Lance Taylor <iant@google.com>
4284
4285 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4286 queueing any tasks.
4287 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4288 (queue_middle_tasks): Add all blockers before queueing any tasks.
4289 (queue_final_tasks): Likewise.
4290 * token.h (Task_token::add_blockers): New function.
4291 * object.h (Input_objects::number_of_relobjs): New function.
4292
c7177d31
ILT
42932010-02-10 Ian Lance Taylor <iant@google.com>
4294
5de0e392
ILT
4295 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4296 shared, not if not position independent.
4297 * x86_64.cc (Relocate::relocate_tls): Likewise.
4298 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4299 (tls_pie_pic_test): New target.
4300 * testsuite/Makefile.in: Rebuild.
4301
c7177d31
ILT
4302 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4303 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4304 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4305 * testsuite/Makefile.in: Rebuild.
4306
684b268a
DM
43072010-02-09 David S. Miller <davem@davemloft.net>
4308
4309 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4310 R_SPARC_RELATIVE using ->add_local_relative().
4311 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4312
612a8d3d
DM
4313 * output.h (Output_data_dynamic::add_section_size): New method
4314 that takes two Output_data objects.
4315 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4316 entry param. Handle it in initializers.
4317 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4318 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4319 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4320 arg.
4321 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4322 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4323 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4324 for dynrel_includes_plt.
4325 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4326 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4327 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4328 before .rela.plt
4329 (Target_sparc::do_finalize_sections): Update to pass true for
4330 dynrel_includes_plt.
4331 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4332 output before .rela.plt
4333 (Target_powerpc::do_finalize_sections): Update to pass true for
4334 dynrel_includes_plt when 32-bit.
4335
cb1be87e
DK
43362010-02-08 Doug Kwan <dougkwan@google.com>
4337
4338 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4339 method.
4340 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4341 Arm_relobj::scan_section_for_cortex_a8_stubs,
4342 Arm_relobj::do_relocation_section): Instead of calling
4343 Output_section::output_address, use faster
4344 Arm_relobj::simple_input_section_output_address.
4345
705b5121
DM
43462010-02-08 David S. Miller <davem@davemloft.net>
4347
4348 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4349 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4350 relocation helper function.
4351
024c4466
DM
4352 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4353 just like R_SPARC_GOT{10,13,22}.
4354 (Target_sparc::Scan::local): Likewise.
4355 (Target_sparc::Relocate:relocate): Likewise.
4356
9109c078
ILT
43572010-02-06 Ian Lance Taylor <iant@google.com>
4358
4359 * configure.ac: Rewrite targetobjs duplicate removal code to use
4360 only shell constructs.
4361 * configure: Rebuild.
4362
cf846138
DK
43632010-02-05 Doug Kwan <dougkwan@google.com>
4364
4365 PR 11247
4366 * arm.cc (Arm_relobj::section_is_scannable): New method.
4367 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4368 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4369
6cfaf60b
DK
43702010-02-04 Doug Kwan <dougkwan@google.com>
4371
4372 PR 11247
4373 * arm-reloc-property.cc (cstdio): Include.
4374 * configure.ac (targetobjs): Remove duplicates.
4375 * configure: Regenerate.
4376 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4377 big and little endian version for a given address size.
4378
5c57f1be
DK
43792010-02-03 Doug Kwan <dougkwan@google.com>
4380
4381 * arm-reloc-property.cc
4382 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4383 definition.
4384 * arm-reloc-property.h
4385 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4386 New method definition.
4387 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4388 declaration.
4389 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4390 overflow to N.
4391 (GOT_PREL): Change implemented to Y.
4392 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4393 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4394 (Arm_relocate_functions::movw_abs_nc): Remove method.
4395 (Arm_relocate_functions::movt_abs): Ditto.
4396 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4397 (Arm_relocate_functions::thm_movt_abs): Ditto.
4398 (Arm_relocate_functions::movw_rel_nc): Ditto.
4399 (Arm_relocate_functions::movw_rel): Ditto.
4400 (Arm_relocate_functions::movt_rel): Ditto.
4401 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4402 (Arm_relocate_functions:thm_movw_rel): Ditto.
4403 (Arm_relocate_functions:thm_movt_rel): Ditto.
4404 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4405 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4406 New method definitions.
4407 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4408 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4409 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4410 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4411 (Target_arm::Relocate::relocate): Check for non-static or
4412 unimplemented relocation code and exit early. Change calls to
4413 Target_arm::reloc_uses_thumb_bit and
4414 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4415 instead. Refactor code to handle similar relocations to increase
4416 code sharing. Remove check for unsupported relocation code in switch
4417 statement.
4418 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4419 relocation property table to find out size. Change error message to
4420 print out the name of a relocation code instead of the numeric value.
4421 (Target_arm::scan_reloc_for_stub): Use relocation property table
4422 instead of calling Target_arm::reloc_uses_thumb_bit().
4423
218c5831
DK
44242010-02-02 Doug Kwan <dougkwan@google.com>
4425
4426 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4427 types of relaxed input section.
4428
0d31c79d
DK
44292010-02-02 Doug Kwan <dougkwan@google.com>
4430
4431 * Makefile.am (HFILES): Add arm-reloc-property.h.
4432 (DEFFILES): New.
4433 (TARGETSOURCES): Add arm-reloc-property.cc
4434 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4435 (libgold_a_SOURCES): $(DEFFILES)
4436 * Makefile.in: Regenerate.
4437 * arm-reloc-property.cc: New file.
4438 * arm-reloc-property.h: New file.
4439 * arm-reloc.def: New file.
4440 * arm.cc: Update comments.
4441 (arm-reloc-property.h): New included header.
4442 (arm_reloc_property_table): New global variable.
4443 (Target_arm::do_select_as_default_target): New method definition.
4444 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4445 arm-reloc-property to targ_extra_obj.
4446 * parameters.cc (set_parameters_target): Call
4447 Target::select_as_default_target().
4448 * target.h (Target::select_as_default_target): New method definition.
4449 (Target::do_select_as_default_target): Same.
4450
546c7457
DK
44512010-02-01 Doug Kwan <dougkwan@google.com>
4452
4453 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4454 first_output_text_section_.
4455 (Arm_exidx_fixup::first_output_text_section): New method definition.
4456 (Arm_exidx_fixup::first_output_text_section_): New data member.
4457 (Arm_exidx_fixup::process_exidx_section): Record the first text
4458 output section seen.
4459 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4460 and entsize in output section header.
4461
11b861d5
DK
44622010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4463
4464 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4465 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4466 (Arm_relocate_functions::thm_alu11): New Method.
4467 (Arm_relocate_functions::thm_pc8): New Method.
4468 (Arm_relocate_functions::thm_pc12): New Method.
4469 (Target_arm::Scan::local): Handle the relocations.
4470 (Target_arm::Scan::global): Likewise.
4471 (Target_arm::Relocate::relocate): Likewise.
4472 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4473
c9a2c125
DK
44742010-01-29 Doug Kwan <dougkwan@google.com>
4475
4476 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4477 of relocation types as ld.
4478
1521477a
DK
44792010-01-29 Doug Kwan <dougkwan@google.com>
4480
4481 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4482 to public.
4483 (Arm_relocate_functions::thumb_branch_common): Ditto.
4484 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4485 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4486 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4487 Arm_relocate_functions::jump24): Remove.
4488 (Target_arm::Relocate::relocate): Adjust code to call
4489 Arm_relocation_functions::arm_branch_common and
4490 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 4491 wrappers. Merge switch-cases together to reduce source code size.
1521477a 4492
e7eca48c
DK
44932010-01-29 Doug Kwan <dougkwan@google.com>
4494
4495 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4496 output_local_symbol_count_needs_update_.
4497 (Arm_relobj::output_local_symbol_count_needs_update,
4498 Arm_relobj::set_output_local_symbol_count_needs_update,
4499 Arm_relobj::update_output_local_symbol_count): New methods.
4500 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4501 member.
4502 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4503 of pointed function as in a R_ARM_PREL31 relocation.
4504 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4505 for output local symbol count updating.
4506 (Target_arm::do_relax): Update output local symbol counts in objects
4507 if necessary.
4508 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4509
02961d7e
ILT
45102010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4511
4512 * arm.cc: Added support for the ARM relocations:
4513 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4514 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4515 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4516 movw_prel_nc).
4517 (Arm_relocate_functions::movw_rel): New method.
4518 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4519 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4520 thm_movw_prel_nc).
4521 (Arm_relocate_functions::thm_movw_rel): New method.
4522 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4523 thm_movt_prel).
4524 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4525 relocations.
4526 (Target_arm::Scan::global): Likewise.
4527 (Target_arm::Relocate::relocate): Likewise.
4528 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4529 Likewise.
4530
b10d2873
ILT
45312010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4532
4533 * arm.cc: Added support for ARM group relocations.
4534 (Target_arm::reloc_needs_sym_origin): New method.
4535 (Arm_relocate_functions::calc_grp_kn): New method.
4536 (Arm_relocate_functions::calc_grp_residual): New method.
4537 (Arm_relocate_functions::calc_grp_gn): New method.
4538 (Arm_relocate_functions::arm_grp_alu): New Method.
4539 (Arm_relocate_functions::arm_grp_ldr): New Method.
4540 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4541 (Arm_relocate_functions::arm_grp_ldc): New Method.
4542 (Target_arm::Scan::local): Handle the ARM group relocations.
4543 (Target_arm::Scan::global): Likewise.
4544 (Target_arm::Relocate::relocate): Likewise.
4545 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4546 Likewise.
4547
2b328d4e
DK
45482010-01-26 Doug Kwan <dougkwan@google.com>
4549
4550 * arm.cc (set): Include.
4551 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4552 pointer type.
4553 (Arm_output_section::Text_section_list): New type.
4554 (Arm_output_section::append_text_sections_to_list): New method.
4555 (Arm_output_section::fix_exidx_coverage): Ditto.
4556 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4557 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4558 Relobj::set_section_offset() instead of
4559 Sized_relobj::invalidate_section_offset().
4560 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4561 parameter for section headers. Ignore relocation sections for
4562 unallocated sections and EXIDX sections.
4563 (Target_arm::fix_exidx_coverage): New method.
4564 (Target_arm::output_section_address_less_than): New type.
4565 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4566 linked text section instead of the EXIDX section.
4567 (Arm_output_section::create_stub_group): Add an assertion to check
4568 that this is not an EXIDX output section.
4569 (Arm_output_section::append_text_sections_to_list): New method.
4570 (Arm_output_section::fix_exidx_coverage): Ditto.
4571 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4572 Arm_relobj::section_needs_reloc_stub_scanning.
4573 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4574 first pass.
4575 (Target_arm::fix_exidx_coverage): New method.
4576 * object.h (Relobj::set_output_section): New method.
4577 (Sized_relobj::invalidate_section_offset): Remove method.
4578 (Sized_relobj::do_invalidate_section_offset): Remove method.
4579 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4580
c7f3c371
DK
45812010-01-25 Doug Kwan <dougkwan@google.com>
4582
4583 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4584 Fix warning due to signed and unsigned comparison on a 32-bit host.
4585
8923b24c
DK
45862010-01-22 Doug Kwan <dougkwan@google.com>
4587
4588 * arm.cc (Target_arm::do_relax): Record an output section for section
4589 offset adjustment it contains any stub table that has changed.
4590 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4591 offsets in an output section if necessary.
4592 * output.cc (Output_section::Output_section): Initialize
4593 section_offsets_need_adjustments_.
4594 (Output_section::add_input_section_for_script): Renamed to
4595 Output_section::add_simple_input_section.
4596 (Output_section::save_states): Add a comment.
4597 (Output_section::discard_states): New method defintion.
4598 (Output_section::adjust_section_offsets): Same.
4599 * output.h (Output_section::add_input_section_for_script): Renamed to
4600 Output_section::add_simple_input_section.
4601 (Output_section::discard_states): New method declaration.
4602 (Output_section::adjust_section_offsets): Same.
4603 (Output_section::section_offsets_need_adjustment,
4604 Output_section::set_section_offsets_need_adjustment): New method
4605 definitions.
4606 (Output_section::section_offsets_need_adjustment_): New data member.
4607 * script-sections.cc
4608 (Output_section_element_input::set_section_address): Adjust code for
4609 renaming of Output_section::add_input_section_for_script.
4610 (Orphan_output_section::set_section_address): Same.
4611
9b2fd367
DK
46122010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4613
4614 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4615 Fix_v4bx enum values .
4616 * gold/options.h (General_options): New option definitions.
4617 (General_options::fix_v4bx): New method.
4618 (General_options::Fix_v4bx): New enum.
4619 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4620 (General_options::parse_fix_v4bx_interworking): New method.
4621
80d0d023
DK
46222010-01-22 Doug Kwan <dougkwan@google.com>
4623
4624 * arm.cc (Arm_exidx_fixup): New class.
4625
af2cdeae
DK
46262010-01-21 Doug Kwan <dougkwan@google.com>
4627
4628 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4629 classes.
4630 (Arm_exidx_section_offset_map): New type.
4631
993d07c1
DK
46322010-01-21 Doug Kwan <dougkwan@google.com>
4633
4634 * arm.cc (Arm_exidx_input_section): New class.
4635 (Arm_relobj::exidx_input_section_by_link,
4636 Arm_relobj::exidx_input_section_by_shndx,
4637 Arm_relobj::make_exidx_input_section): New methods.
4638 (read_arm_attributes_section): Remove.
4639 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4640 information about them.
4641 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4642 to here.
4643
5ac169d4
DK
46442010-01-20 Doug Kwan <dougkwan@google.com>
4645
4646 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4647 Input_section_specifier to Section_id.
4648 (Target_arm::new_arm_input_section: Adjust code for change of key
4649 type.
4650 (Target_arm::find_arm_input_section): Ditto.
4651 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4652 (Section_id): Remove.
4653 (Garbage_collection::Section_id_hash): Remove.
4654 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4655 (Section_id): Remove.
4656 (Icf::Section_id_hash): Remove.
4657 * object.h (Section_id, Const_section_id, Section_id_hash,
4658 Const_section_id_hash): New type definitions.
4659 * output.cc (Output_section::add_relaxed_input_section): Change to
4660 use Const_section_id instead of Input_section_specifier as key type.
4661 (Output_section::add_merge_input_section): Ditto.
4662 (Output_section::build_relaxation_map): Change to use Section_id
4663 instead of Input_section_specifier as key type.
4664 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4665 Ditto.
4666 (Output_section::convert_input_sections_to_relaxed_sections): Change
4667 to use Const_section_id instead of Input_section_specifier as key type.
4668 (Output_section::find_merge_section): Ditto.
4669 (Output_section::find_relaxed_input_section): Ditto.
4670 * output.h (Input_section_specifier): Remove class.
4671 (Output_section::Output_section_data_by_input_section_map): Change
4672 key type to Const_section_id.
4673 (Output_section::Output_relaxed_input_section_by_input_section_map):
4674 Ditto.
4675 (Output_section::Relaxation_map): Change key type to Section_id.
4676
a2162063
ILT
46772010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4678
4679 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4680 (class Arm_v4bx_stub): New class.
4681 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4682 (Stub_factory::make_arm_v4bx_stub): New method.
4683 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4684 (Stub_table::empty): Handle v4bx stubs.
4685 (Stub_table::add_arm_v4bx_stub): New method.
4686 (Stub_table::find_arm_v4bx_stub): New method.
4687 (Arm_relocate_functions::v4bx): New method.
4688 (Target_arm::fix_v4bx): New method.
4689 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4690 (Stub_table::relocate_stubs): Likewise.
4691 (Stub_table::do_write): Likewise.
4692 (Stub_table::update_data_size_and_addralign): Likewise.
4693 (Stub_table::finalize_stubs): Likewise.
4694 (Target_arm::Scan::local): Likewise.
4695 (Target_arm::Scan::global): Likewise.
4696 (Target_arm::do_finalize_sections): Likewise.
4697 (Target_arm::Relocate::relocate): Likewise.
4698 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4699 Likewise.
4700 (Target_arm::scan_reloc_for_stub): Likewise.
4701 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4702
5696ab0b
ILT
47032010-01-19 Ian Lance Taylor <iant@google.com>
4704
4705 * output.cc (Output_section_headers::do_sized_write): Write large
4706 segment count to sh_info field.
4707 (Output_file_header::do_sized_write): For large segment count,
4708 write PN_XNUM to e_phnum field.
4709
800d0f56
ILT
47102010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4711
4712 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4713 (Arm_relocate_functions::thm_jump8): New function.
4714 (Arm_relocate_functions::thm_jump11): New function.
4715 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4716 R_ARM_THM_JUMP11.
4717 (Target_arm::Scan::global): Likewise.
4718 (Target_arm::Relocate::relocate): Likewise.
4719 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4720 Likewise.
4721
41263c05
DK
47222010-01-14 Doug Kwan <dougkwan@google.com>
4723
4724 * arm.cc (map, utility): Include headers.
4725 (Target_arm::apply_cortex_a8_workaround): New method.
4726 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4727 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4728 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4729 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4730 the --[no-]fix-cortex-a8 command line options.
4731 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4732 (Target_arm::relocate_stub): Use addend in instruction template.
4733 * options.h (DEFINE_bool): Set the user-set flag.
4734 (General_options): Add --[no-]-fix-cortex options.
4735 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 4736 : Update fast look-up map after conversion.
41263c05 4737
459e9b03
ST
47382010-01-14 Sriraman Tallam <tmsriram@google.com>
4739
4740 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4741 in the first pass of do_layout.
4742
b521dfe4
DK
47432010-01-13 Doug Kwan <dougkwan@google.com>
4744
4745 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4746 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4747 apparent compiler problem of not folding static constant integral
4748 data members of elfcpp::Elf_sizes<32>.
4749
44272192
DK
47502010-01-13 Doug Kwan <dougkwan@google.com>
4751
4752 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4753 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4754 Arm_relobj::scan_section_for_cortex_a8_erratum,
4755 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4756 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4757 sections to scan for relocation stubs into a new method
4758 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4759 relocation and Cortex-A8 stub scanning.
4760 (Target_arm::do_relax): Force stubs to be after stubbed sections
4761 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 4762 the beginning of a new relaxation pass. Update a comment.
44272192
DK
4763 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4764
44b71ece
ILT
47652010-01-12 Ian Lance Taylor <iant@google.com>
4766
4767 * target-reloc.h (visibility_error): New inline function.
4768 (relocate_section): Call visibility_error.
4769 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4770 (MOSTLYCLEANFILES): Likewise.
4771 (protected_4_pic.o, protected_3.err): New targets.
4772 * testsuite/protected_4.cc: New file.
4773
a120bc7f
DK
47742010-01-12 Doug Kwan <dougkwan@google.com>
4775
4776 * arm.cc (Cortex_a8_reloc): New class.
4777 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4778 and cortex_a8_relocs_info_.
4779 (Target_arm::fix_cortex_a8): New method definition.
4780 (Target_arm::Cortex_a8_relocs_info): New type.
4781 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4782 New data member declarations.
4783 (Target_arm::scan_reloc_for_stub): Record information about
4784 relocations for THUMB branches that might be exempted from the
4785 Cortex-A8 workaround.
4786 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4787 at the beginning of a relaxation pass.
4788
20138696
DK
47892010-01-12 Doug Kwan <dougkwan@google.com>
4790
4791 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4792 (Arm_relobj::Mapping_symbol_position,
4793 Arm_reloj::Mapping_symbol_position_less,
4794 Arm_relobj::Mapping_symbols_info): New types.
4795 (Target_arm::is_mapping_symbol_name): New method definition.
4796 (Arm_relobj::do_count_local_symbols): Save information about mapping
4797 symbols.
4798
089d69dc
DK
47992010-01-11 Doug Kwan <dougkwan@google.com>
4800
4801 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4802 Arm_relocate_functions::thumb32_branch_upper,
4803 Arm_relocate_functions::thumb32_branch_lower,
4804 Arm_relocate_functions::thumb32_cond_branch_offset,
4805 Arm_relocate_functions::thumb32_cond_branch_upper,
4806 Arm_relocate_functions::thumb32_cond_branch_lower,
4807 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4808 branch offset encoding.
4809 (Arm_relocate_functions::thumb_branch_common): Use new branch
4810 offset encoding methods to avoid code duplication.
4811 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4812 (Stub_addend_reader::operator()): Use new branch encoding method
4813 to avoid code duplication.
4814
99e5bff2
DK
48152010-01-11 Doug Kwan <dougkwan@google.com>
4816
4817 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4818 (Target_arm::do_finalize_sections): Define special EXIDX section
4819 symbols only if referenced.
4820 * gc.h (Garbage_collection::add_reference): New method.
4821 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4822 code duplication.
4823
98e090bd
ILT
48242010-01-11 Ian Lance Taylor <iant@google.com>
4825
d0a91bd8
ILT
4826 * script.cc (Version_script_info::build_expression_list_lookup):
4827 Change complaing about duplicate wildcard match from error to
4828 warning.
4829
98e090bd
ILT
4830 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4831 of 2009-12-30.
4832 (Version_script_info::Version_script_info): Initialize globs_,
4833 default_version_, default_is_global_, and exact_. Don't
4834 initialize globals_ or locals_.
4835 (Version_script_info::build_lookup_tables): Build local symbols
4836 first.
4837 (Version_script_info::unquote): New function.
4838 (Version_script_info::add_exact_match): New function.
4839 (Version_script_info::build_expression_list_lookup): Remove lookup
4840 parameter. Add is_global parameter. Change all callers. Handle
4841 wildcard pattern specially. Unquote pattern. Call
4842 add_exact_match.
4843 (Version_script_info::get_name_to_match): New function.
4844 (Version_script_info::get_symbol_version): New function.
4845 (Version_script_info::get_symbol_version_helper): Remove.
4846 (Version_script_info::check_unmatched_names): Call unquote.
4847 * script.h (class Version_script_info): Change get_symbol_version
4848 to be non-inline and add is_global parameter; change all callers.
4849 Rewrite symbol_is_local. Update declarations. Define struct
4850 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4851 Remove globals_ and locals_ members. Add exact_, globs_,
4852 default_version_, is_global_.
4853 (Version_script_info::Glob): Remove pattern, add expression and
4854 is_global. Update constructor. Change all callers.
4855 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4856 default version.
4857 (Versions::symbol_section_contents): If a symbol is undefined, or
4858 defined in a dynamic object, set the version index to
4859 VER_NDX_LOCAL.
4860 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4861 symbol_is_local.
4862 (Symbol_table::add_from_pluginobj): Likewise.
4863 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4864
d56962d3
DK
48652010-01-11 Doug Kwan <dougkwan@google.com>
4866
4867 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4868 (incremental_dump_LDADD): Add linking option for libintl.
4869 * Makefile.in: Regenerate.
4870
94e6ee91
L
48712010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4872
4873 PR gold/11144
4874 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4875 instead of -Ds.
4876 * testsuite/Makefile.in: Regenerated.
4877
e96c574b
DK
48782010-01-10 Doug Kwan <dougkwan@google.com>
4879
4880 * options.h (DEFINE_var): Use parentheses around argument varname__
4881 in macro body to avoid any unintended subsequent substitutions.
4882
7198066b
ILT
48832010-01-10 Ian Lance Taylor <iant@google.com>
4884
ba4d53bf
ILT
4885 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4886 candidates before doing symbol resolution.
4887
7198066b
ILT
4888 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4889 ODR candidates if only one is weak.
4890
a2beed37
ILT
48912010-01-08 Ian Lance Taylor <iant@google.com>
4892
4893 * script.cc (Version_script_info::build_expression_list_lookup):
4894 Don't warn about ambiguous version, just record the ambiguity.
4895 (Version_script_info::get_symbol_version_helper): Give error if
4896 version is ambiguous.
4897
2fb7225c
DK
48982010-01-08 Doug Kwan <dougkwan@google.com>
4899
4900 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4901 prev_data_size_ and prev_addralign_. Remove initializer for
4902 deleted data member has_been_changed_.
4903 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4904 to determine if the table is empty.
4905 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4906 Remove.
4907 (Stub_table::add_reloc_stub): Define method in class definition
4908 instead of just declaring it there.
4909 (Stub_table::add_cortex_a8_stub): New method definition.
4910 (Stub_table::update_data_size_and_addralign): Ditto.
4911 (Stub_table::finalize_stubs): Ditto.
4912 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4913 (Stub_table::do_addralign_): Return address alignment in the
4914 (Stub_table::do_reset_address_and_file_offset): Define method in
4915 class definition instead of declaring it there. Set current data
4916 size to be the data size of the previous pass.
4917 (Stub_table::set_final_data_size): Use current data size as the
4918 final data size.
4919 (Stub_table::relocate_stub): Change parameter type of stub from
4920 Reloc_stub pointer to Stub pointer.
4921 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4922 (Stub_table::Cortex_a8_stub_list): New typedef.
4923 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4924 Stub_table::prev_addralign_): New data member.
4925 (Arm_relobj::Arm_relobj): Initialize data member
4926 section_has_cortex_a8_workaround_.
4927 (Arm_relobj::section_has_cortex_a8_workaround,
4928 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4929 definitions.
4930 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4931 declarations.
4932 (Target_arm::relocate_stub): Change parameter type of stub from
4933 Reloc_stub pointer to Stub pointer.
4934 (Insn_template::size, Insn_template::alignment): Handle
4935 THUMB16_SPECIAL_TYPE.
4936 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4937 Stub_table::update_data_size_and_addralign,
4938 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4939 definitions.
4940 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4941 (Stub_table::do_write): Ditto.
4942 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4943
880cd20d
ILT
49442010-01-08 Ian Lance Taylor <iant@google.com>
4945
4946 PR 11108
4947 * symtab.h (class Symbol): Remove fields is_target_special_ and
4948 has_plt_offset_. Add field is_defined_in_discarded_section_.
4949 (Symbol::is_defined_in_discarded_section): New function.
4950 (Symbol::set_is_defined_in_discarded_section): New function.
4951 (Symbol::has_plt_offset): Rewrite.
4952 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4953 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4954 Don't initialize is_target_special_ or has_plt_offset_.
4955 Initialize is_defined_in_discarded_section_.
4956 (Symbol_table::add_from_relobj): If appropriate, set
4957 is_defined_in_discarded_section.
4958 * resolve.cc (Symbol::override_base_with_special): Don't test
4959 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4960 * target-reloc.h (relocate_section): Do special handling for
4961 symbols defined in discarded sections for global symbols as well
4962 as local symbols.
4963
2703e3eb
ILT
49642010-01-08 Ian Lance Taylor <iant@google.com>
4965
4966 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4967 the SHT_SYMTAB case.
4968
339d40a3
ILT
49692010-01-08 Ian Lance Taylor <iant@google.com>
4970
4971 * object.cc (Sized_relobj::do_layout): Don't get confused if
4972 layout_eh_frame returns NULL.
4973
abecea76
ILT
49742010-01-08 Ian Lance Taylor <iant@google.com>
4975
4976 PR 11084
4977 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4978 dynamic symbol table, use the normal symbol table.
4979 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4980 symbol table.
4981
6b7dd3f3
ILT
49822010-01-08 Ian Lance Taylor <iant@google.com>
4983
4984 PR 11072
4985 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4986 sections.
4987
36c50e63
L
49882010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4989
4990 * version.cc (print_version): Change to "Copyright 2010".
4991
e291e7b9
ILT
49922010-01-08 Ian Lance Taylor <iant@google.com>
4993
4994 PR 10287
4995 PR 11063
4996 * i386.cc (class Target_i386): Change return type of plt_section
4997 to be non-const.
4998 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4999 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5000 tls_desc_rel_ field.
5001 (Output_data_plt_i386::rel_tls_desc): New function.
5002 (Target_i386::rel_tls_desc_section): New function.
5003 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5004 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5005 R_386_TLS_DESC reloc in rel_tls_desc_section.
5006 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5007 Define struct Tlsdesc_info.
5008 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5009 (Target_x86_64::do_reloc_symbol_index): New function.
5010 (Target_x86_64::add_tlsdesc_info): New function.
5011 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5012 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5013 tlsdesc_rel_ field.
5014 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5015 all callers.
5016 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5017 (Target_x86_64::rela_tlsdesc_section): New function.
5018 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5019 handling.
5020 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5021 (Target_x86_64::do_reloc_addend): New function.
5022 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5023 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5024 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5025 (Output_reloc::type): New function.
5026 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5027 (Output_reloc::is_target_specific): New function.
5028 (Output_reloc::target_arg): New function.
5029 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5030 absolute relocs and target specific relocs.
5031 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5032 add_target_specific.
5033 (class Output_data_reloc) [SHT_RELA]: Likewise.
5034 * output.cc (Output_reloc::Output_reloc): Add four new versions
5035 for absolute relocs and target specific relocs.
5036 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5037 (Output_reloc::get_symbol_index): Likewise.
5038 (Output_reloc::local_section_offset): Check that local_sym_index_
5039 is not TARGET_CODE or 0.
5040 (Output_reloc::symbol_value): Likewise.
5041 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5042 reloc.
5043 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5044 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5045 functions.
5046 * layout.cc (add_target_dynamic_tags): Use output section for
5047 DT_PLTRELSZ and DT_JMPREL.
5048
3a44184e
ILT
50492010-01-07 Ian Lance Taylor <iant@google.com>
5050
5051 PR 11061
5052 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5053 function.
5054 (class Output_data_reloc_generic): Define.
5055 (class Output_data_reloc_base): Change base class to
5056 Output_data_reloc_generic. Change add() method to call
5057 bump_relative_reloc_count for a relative reloc. Remove
5058 sort_relocs_ field.
5059 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5060 to sort_relocs().
5061 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5062 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5063 appropriate.
5064 * layout.h (class Layout): Update declaration.
5065
ea715a34
ILT
50662010-01-07 Ian Lance Taylor <iant@google.com>
5067
5068 * output.h (class Output_data): Add const version of
5069 output_section and do_output_section.
5070 (class Output_section_data): Add const version of
5071 do_output_section.
5072 (class Output_section): Likewise.
5073 * layout.cc (Layout::add_target_dynamic_tags): New function.
5074 * layout.h (class Layout): Update declarations.
5075 * arm.cc (Target_arm::do_finalize_sections): Use
5076 add_target_dynamic_tags.
5077 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5078 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5079 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5080 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5081
659948a4
ILT
50822010-01-07 Ian Lance Taylor <iant@google.com>
5083
5084 PR 11042
5085 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5086 object as needed.
5087
9d3b86f6
ILT
50882010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5089 Ian Lance Taylor <iant@google.com>
5090
5091 PR 11019
5092 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5093 Xindex::read_symtab_xindex.
5094
bb0d3eb0
DK
50952010-01-07 Doug Kwan <dougkwan@google.com>
5096
5097 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5098 (Insn_template::thumb16_bcond_insn): New method declaration.
5099 (Insn_template): Fix spelling.
5100 (Stub::thumb16_special): New method declaration.
5101 (Stub::do_write): Define virtual method which was previously pure
5102 virtual.
5103 (Stub::do_thumb16_special): New method declaration.
5104 (Stub::do_fixed_endian_write): New template member.
5105 (Reloc_stub::do_write): Remove.
5106 (Reloc_stub::do_fixed_endian_write): Remove.
5107 (Cortex_a8_stub): New class definition.
5108 (Stub_factory::make_cortex_a8_stub): New method definition.
5109 (Stub_factory::Stub_factory): Add missing static storage class
5110 qualifier for elf32_arm_stub_a8_veneer_blx.
5111
ffeef7df
ILT
51122010-01-07 Ian Lance Taylor <iant@google.com>
5113
dc3f80fe
ILT
5114 PR 10980
5115 * options.h (class General_options): Add --warn-unresolved-symbols
5116 and --error-unresolved-symbols.
5117 * errors.cc (Errors::undefined_symbol): Implement
5118 --warn-unresolved-symbols.
5119
ffeef7df
ILT
5120 * options.h (class General_options): Add -z text and -z textoff.
5121 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5122
f1ec9ded
ST
51232010-01-06 Sriraman Tallam <tmsriram@google.com>
5124
5125 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5126 (Garbage_collection::cident_sections): New function.
5127 (Garbage_collection::add_cident_section): New function.
5128 (Garbage_collection::cident_sections_): New member.
5129 (gc_process_relocs): Add references to sections whose names are C
5130 identifiers.
5131 * gold.h (cident_section_start_prefix): New constant.
5132 (cident_section_stop_prefix): New constant.
5133 (is_cident): New function.
5134 * layout.cc (Layout::define_section_symbols): Replace string constants
5135 with the newly defined constants.
5136 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5137 C identifiers.
5138 * testsuite/Makefile.am: Add gc_orphan_section_test.
5139 * testsuite/Makefile.in: Regenerate.
5140 * testsuite/gc_orphan_section_test.cc: New file.
5141 * testsuite/gc_orphan_section_test.sh: New file.
5142
6eda8c29
ILT
51432010-01-06 Ian Lance Taylor <iant@google.com>
5144
b9674e17
ILT
5145 PR 10980
5146 * options.h (class General_options): Add --warn-shared-textrel.
5147 * layout.cc (Layout::finish_dynamic_section): Implement
5148 --warn-shared-textrel.
5149
6eda8c29
ILT
5150 PR 10980
5151 * options.h (class General_options): Add --warn-multiple-gp.
5152
32dcd44e
ILT
51532010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5154
5155 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5156 $(THREADSLIB) and $(LIBDL).
5157 * Makefile.in: Rebuild.
5158
a192ba05
ILT
51592010-01-06 Ian Lance Taylor <iant@google.com>
5160
5161 PR 10980
5162 * options.cc (General_options::parse_section_start): New function.
5163 (General_options::section_start): New function.
5164 (General_options::General_options): Initialize all members.
5165 * options.h: Include <map>
5166 (class General_options): Add --section-start. Add section_starts_
5167 member.
5168 * layout.cc (Layout::attach_allocated_section_to_segment): If
5169 --section-start was used, set the address of the segment. Remove
5170 local sort_sections.
5171 (Layout::relaxation_loop_body): If the address of the load segment
5172 has been set by --section-start, don't use it.
5173 * output.h (Output_segment::update_flags_for_output_section): New
5174 function.
5175 * output.cc (Output_segment::add_output_section): Call
5176 update_flags_for_output_section.
5177
dde3f402
ILT
51782010-01-05 Ian Lance Taylor <iant@google.com>
5179
62dfdd4d
ILT
5180 PR 10980
5181 * options.h (class General_options): Add --undefined-version.
5182 * script.cc (struct Version_expression): Add was_matched_by_symbol
5183 field.
5184 (Version_script_info::matched_symbol): New function.
5185 (Version_script_info::get_symbol_version_helper): Call
5186 matched_symbol.
5187 (Version_script_info::check_unmatched_names): New function.
5188 * script.h (class Version_script_info): Update declarations.
5189 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5190
9c4ae156
ILT
5191 * options.h (class General_options): Use DEFINE_bool_alias for
5192 allow_multiple_definition.
5193 * resolve.cc (Symbol_table::should_override): Don't test
5194 allow_multiple_definition.
5195
dde3f402
ILT
5196 PR 10980
5197 * options.h (class General_options): Add --cref.
5198 * main.cc (main): Print cref table if --cref. Don't close mapfile
5199 until after printing cref table.
5200 * cref.cc: Include "symtab.h".
5201 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5202 (Cref_table_compare::operator()): New function.
5203 (Cref_inputs::gather_cref): New function.
5204 (filecol): New static const.
5205 (Cref_inputs::print_cref): New function.
5206 (Cref::print_cref): New function.
5207 * cref.h: Include <cstdio>.
5208 (class Cref): Update declarations.
5209 * mapfile.h (Mapfile::file): New function.
5210 * object.h (class Object): Define Symbols. Declare virtual
5211 do_get_global_symbols.
5212 (Object::get_global_symbols): New function.
5213 * object.cc (Input_objects::add_object): Pass object to cref_ if
5214 --cref.
5215 (Input_objects::archive_start): Likewise.
5216 (Input_objects::archive_stop): Likewise.
5217 (Input_objects::print_cref): New function.
5218 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5219 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5220 --cref.
5221 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5222 function.
5223 * plugin.h (class Sized_pluginobj): Update declarations.
5224
8781f709
ILT
52252010-01-05 Ian Lance Taylor <iant@google.com>
5226
5227 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5228 to is_default_version. Rename insdef to insdefault.
5229 (Symbol_table::add_from_relobj): Rename def to is_default_version
5230 and local to is_forced_local.
5231 (Symbol_table::add_from_pluginobj): Likewise.
5232 (Symbol_table::add_from_dynobj): Likewise.
5233 (Symbol_table::define_special_symbol): Rename insdef to
5234 insdefault.
5235
fe35d28d
ILT
52362010-01-04 Ian Lance Taylor <iant@google.com>
5237
30bc8c46
ILT
5238 PR 10980
5239 * options.h (class General_options): Add
5240 --allow-multiple-definition and -z muldefs.
5241 * resolve.cc (Symbol_table::should_override): Don't warn about a
5242 multiple symbol definition if --allow-multiple-definition or -z
5243 muldefs.
5244
7eaea549
ILT
5245 PR 10980
5246 * options.h (class General_options): Add --add-needed and
5247 --copy-dt-needed-entries. Tweak --as-needed help entry.
5248 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5249 error if --copy-dt-needed-entries aka --add-needed is used and
5250 would cause a change in behaviour.
5251
fe35d28d
ILT
5252 PR 10980
5253 * options.h (class General_options): Add -G as a short version of
5254 --shared. Add no-op options -assert, -g, and -i.
5255
55a2bb35
ST
52562010-01-04 Sriraman Tallam <tmsriram@google.com>
5257
5258 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5259 check for .text or .gnu.linkonce.t sections.
5260 * icf.cc (Icf::find_identical_sections): Ditto.
5261 Change the detection for mangled function name within the section
5262 name.
5263 * icf.h (is_section_foldable_candidate): New function.
5264
719328e1
ILT
52652009-12-30 Ian Lance Taylor <iant@google.com>
5266
5267 PR 10980
5268 * options.h (class General_options): Permit two dashes with
5269 --retain-symbols-file.
5270
d7bb5745
ILT
52712009-12-30 Ian Lance Taylor <iant@google.com>
5272
403a15dd
ILT
5273 PR 10979
5274 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5275 don't put the file header and segment headers in the text
5276 segment.
5277
eda294df
ILT
5278 PR 10979
5279 * common.cc (Sort_commons::operator()): Stabilize sort when both
5280 entries are NULL.
5281 (Symbol_table::do_allocate_commons_list): When allocating common
5282 symbols, skip a symbol which is no longer common.
5283 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5284 an object before checking its type.
5285 * testsuite/common_test_2.c: New file.
5286 * testsuite/common_test_3.c: New file.
5287 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5288 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5289 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5290 (common_test_2_pic.o, common_test_2.so): New targets.
5291 (common_test_3_pic.o, common_test_3.so): New targets.
5292 * testsuite/Makefile.in: Rebuild.
5293
d7bb5745
ILT
5294 PR 10979
5295 * script.cc (read_input_script): If we see a new SECTIONS clause,
5296 and we have added an input section, give an error.
5297 * layout.h (class Layout): Add have_added_input_section function.
5298 Add have_added_input_section_ field.
5299 * layout.cc (Layout::Layout): Initialize
5300 have_added_input_section_.
5301 (Layout::layout): Set have_added_input_section_.
5302 (Layout::layout_eh_frame): Likewise.
5303
fc59c572
ILT
53042009-12-30 Ian Lance Taylor <iant@google.com>
5305
5306 PR 10931
5307 * options.h (class General_options): Add --sort-common option.
5308 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5309 * common.cc (Sort_common): Add sort_order parameter to
5310 constructor. Add sort_order_ field.
5311 (Sort_commons::operator): Check sort_order_.
5312 (Symbol_table::allocate_commons): Determine the sort order.
5313 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5314 Change all callers.
5315 (Symbol_table::do_allocate_commons_list): Likewise.
5316
1c74fab0
ILT
53172009-12-30 Ian Lance Taylor <iant@google.com>
5318
5319 PR 10916
5320 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5321 symbols from this object, don't change the visibility of an
5322 undefined symbol.
5323 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5324
6affe781
ILT
53252009-12-30 Ian Lance Taylor <iant@google.com>
5326
5327 PR 10861
5328 * script.h (class Version_script_info): Define Language enum.
5329 Update declarations. Define Glob, Exact, and Lookup types. Add
5330 new fields globals_, locals_, and is_finalized_.
5331 * script.cc: Various formatting fixes.
5332 (class Parser_closure): Change language_stack_ from a vector of
5333 std::string to one of Version_script_info::Language. Adjust all
5334 uses accordingly.
5335 (class Lazy_demangler): Remove.
5336 (struct Version_expression): Change language from std::string to
5337 Version_script_info::Language.
5338 (Version_script_info::Version_script_info): New function.
5339 (Version_script_info::~Version_script_info): Don't call clear.
5340 (Version_script_info::finalize): New function.
5341 (Version_script_info::build_lookup_tables): New function.
5342 (Version_script_info::build_expression_list_lookup): New
5343 function.
5344 (Version_script_info::get_symbol_version_helper): Rewrite to use
5345 lookup tables.
5346 (Version_script_info::print_expression_list): Adjust to use
5347 Version_script_info::Language.
5348 (script_push_lex_into_version_mode): Check that the version script
5349 has not been finalized.
5350 (version_script_push_lang): Change language string to
5351 Version_script_info::Language.
5352 * options.cc (Command_line::version_script): New function.
5353 * options.h (class General_options): Add finalize_dynamic_list
5354 function. Change version_script from declaration to definition.
5355 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5356 * testsuite/version_script.map: Remove duplicate def of foo.
5357 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5358 version_script.map.
5359 * testsuite/Makefile.in: Rebuild.
5360
818bf354
ILT
53612009-12-30 Ian Lance Taylor <iant@google.com>
5362
5363 PR 10843
5364 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5365 if the input symbol index is 0, make the output symbol index 0.
5366
ebcc8304
ILT
53672009-12-30 Ian Lance Taylor <iant@google.com>
5368
5369 PR 10670
5370 * options.h (class General_options): Add -x/--discard-all.
5371 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5372 --discard-all. If the local symbol needs a dynamic entry, check
5373 that before handling --discard-locals.
5374
176fe33f
ILT
53752009-12-30 Ian Lance Taylor <iant@google.com>
5376
bb321bb1
ILT
5377 PR 10450
5378 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5379 flags to PF_R.
5380 (Output_segment::add_output_section): Don't change the flags if
5381 the type is PT_TLS.
5382
176fe33f
ILT
5383 PR 10450
5384 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5385 GNU hash table if they need a dynamic value. Otherwise, don't add
5386 them if they are defined in a dynamic object or are forced local.
5387
e8cd95c7
ILT
53882009-12-29 Ian Lance Taylor <iant@google.com>
5389
1b81fb71
ILT
5390 PR 10450
5391 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5392 .gnu.hash table for a 32-bit target.
5393
8d6d383d
ILT
5394 PR 10450
5395 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5396 regular and a dynamic object only needs a dynamic symbol table
5397 entry if it is externally visible.
5398
e785ec03
ILT
5399 PR 10450
5400 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5401 constructor. Add global_offset_table_ field.
5402 (Target_i386::got_section): Set global_offset_table_.
5403 (Target_i386::do_finalize_sections): Set global_offset_table_
5404 size.
5405 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5406 in constructor. Add global_offset_table_ field.
5407 (Target_x86_64::got_section): Set global_offset_table_.
5408 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5409 size.
5410
1a2dff53
ILT
5411 * layout.cc (Layout::Layout): Initialize increase_relro_.
5412 (Layout::get_output_section): Add is_relro, is_last_relro, and
5413 is_first_non_relro parameters. Change all callers.
5414 (Layout::choose_output_section): Likewise.
5415 (Layout::add_output_section_data): Likewise.
5416 (Layout::make_output_section): Likewise.
5417 (Layout::set_segment_offsets): Clear increase_relro when using a
5418 linker script.
5419 * layout.h (class Layout): Add increase_relro method. Add
5420 increase_relro_ field. Update declarations.
5421 * output.cc (Output_section::Output_section): Initialize
5422 is_last_relro_ and is_first_non_relro_.
5423 (Output_segment::add_output_section): Group relro sections is
5424 do_sort is true. Handle is_last_relro and is_first_non_relro.
5425 (Output_segment::maximum_alignment): Remove relro handling.
5426 (Output_segment::set_section_addresses): Add increase_relro
5427 parameter. Change all callers. Add initial alignment to align
5428 relro sections on separate page. Remove old relro handling.
5429 (Output_segment::set_section_list_addresses): Remove in_relro
5430 parameter. Change all callers.
5431 (Output_segment::set_offset): Add increase parameter. Change all
5432 callers. Remove old relro handling.
5433 * output.h (class Output_section): Add new methods: is_last_relro,
5434 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5435 Add is_last_relro_ and is_first_non_relro_ fields.
5436 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5437 Create separate .got.plt section. Call increase_relro.
5438 * x86_64.cc (Target_x86_64::got_section): Likewise.
5439 * testsuite/relro_script_test.t: Add .got.plt.
5440
f0ba79e2
ILT
5441 PR 10450
5442 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5443 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5444 (Layout::finalize): Call set_dynamic_symbol_size.
5445 (Layout::set_dynamic_symbol_size): New function.
5446 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5447 set_dynamic_symbol_size.
5448
e8cd95c7
ILT
5449 PR 10450
5450 * output.h (class Output_section): Add is_entsize_zero_ field.
5451 * output.cc (Output_section::Output_section): Initialize
5452 is_entsize_zero_.
5453 (Output_section::set_entsize): If two different entsizes are
5454 requested, force it to zero.
5455 (Output_section::add_input_section): Set flags for .debug_str
5456 before updating section flags. Set entsize.
5457 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5458 and SHF_STRING if all input sections have those flags.
5459
3e1b9a8a
RÁE
54602009-12-29 Rafael Espindola <espindola@google.com>
5461
5462 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
5463 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5464 reporting.
3e1b9a8a 5465
3dcad376
ST
54662009-12-29 Sriraman Tallam <tmsriram@google.com>
5467
5468 * options.cc (General_options::parse_version): Allow -v to exit
5469 without an error if there is nothing to link.
5470
084e2665
ILT
54712009-12-29 Ian Lance Taylor <iant@google.com>
5472
5473 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5474 using a version of gcc before 4.1.
5475 * configure: Rebuild.
5476
250acde3
CD
54772009-12-28 Chris Demetriou <cgd@google.com>
5478
5479 * attributes.cc (Output_attributes_section_data::do_write): Use
5480 std::vector::front rather than std::vector::data.
5481
99fff23b
ILT
54822009-12-28 Ian Lance Taylor <iant@google.com>
5483
5484 * symtab.h (class Symbol_table): Add enum Defined.
5485 * resolve.cc (Symbol_table::should_override): Add defined
5486 parameter. Change all callers. Test whether object is NULL
5487 before calling a method on it.
5488 (Symbol_table::report_resolve_problem): Add defined parameter.
5489 Change all callers.
5490 (Symbol_table::should_override_with_special): Likewise.
5491 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5492 parameter. Change all callers.
5493 (Symbol_table::do_define_in_output_data): Likewise.
5494 (Symbol_table::define_in_output_segment): Likewise.
5495 (Symbol_table::do_define_in_output_segment): Likewise.
5496 (Symbol_table::define_as_constant): Likewise.
5497 (Symbol_table::do_define_as_constant): Likewise.
5498 * script.h (class Symbol_assignment): Add is_defsym parameter to
5499 constructor; change all callers.
5500 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5501 parameter. Change all callers. Add is_defsym_ field.
5502 (class Parser_closure): Add parsing_defsym parameter to
5503 constructor; change all callers. Add parsing_defsym accessor
5504 function. Add parsing_defsym_ field.
5505
556bd683
ILT
55062009-12-28 Ian Lance Taylor <iant@google.com>
5507
5508 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 5509 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 5510
1782c879
ILT
55112009-12-23 Ian Lance Taylor <iant@google.com>
5512
5513 * i386.cc (Target_i386::do_calls_non_split): Recognize
5514 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
5515 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5516 -fsplit-stack prologue when using %r11.
1782c879 5517
329ca2b1
ST
55182009-12-21 Sriraman Tallam <tmsriram@google.com>
5519
5520 * options.cc (General_options::parse_version): Make -v continue and do
5521 the link like GNU ld does.
5522
d675ff46
RÁE
55232009-12-17 Rafael Avila de Espindola <espindola@google.com>
5524
5525 * Makefile.am (CCFILES): Add timer.cc.
5526 (HFILES): Add timer.h.
5527 * configure.ac: Check for sysconf and times.
5528 * main.cc: include timer.h.
5529 (main): Use Timer instead of get_run_time.
5530 * timer.cc: New.
5531 * timer.h: New.
5532 * workqueue.cc: include timer.h.
5533 (Workqueue::find_and_run_task):
5534 Report user, sys and wall time.
5535 * Makefile.in: Regenerate.
5536 * config.in: Regenerate.
5537 * configure: Regenerate.
5538
d6344fb5
DK
55392009-12-16 Doug Kwan <dougkwan@google.com>
5540
5541 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5542 sections.
5543 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5544 relaxed input sections.
5545 * output.cc (Output_section::find_relaxed_input_section): Change
5546 return type to Output_relaxed_input_section pointer. Adjust code
5547 for new type of relaxed_input_section_map_.
5548 * output.h (Output_section::find_relaxed_input_section): Change
5549 return type to Output_relaxed_input_section pointer.
5550 (Output_section::Output_relaxed_input_section_by_input_section_map):
5551 New type.
5552 (Output_section::relaxed_input_section_map_): Change type to
5553 Output_section::Output_relaxed_input_section_by_input_section_map.
5554 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5555 input section.
5556
0e0d5469
ILT
55572009-12-15 Ian Lance Taylor <iant@google.com>
5558
5559 * layout.cc (Layout::create_shstrtab): Only write out after input
5560 sections if we are compressing debug sections.
5561
0649a889
ILT
55622009-12-15 Ian Lance Taylor <iant@google.com>
5563
5564 * archive.cc (Archive::add_symbols): Only look up a symbol without
5565 a version if there is, in fact, a version.
5566
2ea97941
ILT
55672009-12-14 Ian Lance Taylor <iant@google.com>
5568
5569 Revert -Wshadow changes, all changes from:
5570 2009-12-11 Doug Kwan <dougkwan@google.com>
5571 2009-12-11 Nick Clifton <nickc@redhat.com>
5572 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5573
b0eec2cc
DK
55742009-12-11 Doug Kwan <dougkwan@google.com>
5575
5576 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5577 due to -Wshadow.
5578 * attributes.cc (Object_attribute::size): Ditto.
5579 (Attributes_section_data::size): Ditto.
5580 (Attributes_section_data::Attributes_section_data): Ditto.
5581 (Output_attributes_section_data::do_write): Ditto.
5582 * attributes.h (Object_attribute::set_type): Ditto.
5583 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5584
91d6fa6a
NC
55852009-12-11 Nick Clifton <nickc@redhat.com>
5586
5587 * archive.cc: Fix shadowed variable warnings.
5588 * arm.cc: Likewise.
5589 * compressed_output.cc: Likewise.
5590 * compressed_output.h: Likewise.
5591 * configure: Likewise.
5592 * dwarf_reader.cc: Likewise.
5593 * dynobj.cc: Likewise.
5594 * dynobj.h: Likewise.
5595 * ehframe.cc: Likewise.
5596 * ehframe.h: Likewise.
5597 * errors.cc: Likewise.
5598 * expression.cc: Likewise.
5599 * fileread.cc: Likewise.
5600 * fileread.h: Likewise.
5601 * freebsd.h: Likewise.
5602 * i386.cc: Likewise.
5603 * icf.cc: Likewise.
5604 * incremental.h: Likewise.
5605 * layout.cc: Likewise.
5606 * layout.h: Likewise.
5607 * mapfile.cc: Likewise.
5608 * merge.cc: Likewise.
5609 * merge.h: Likewise.
5610 * object.cc: Likewise.
5611 * object.h: Likewise.
5612 * options.h: Likewise.
5613 * output.cc: Likewise.
5614 * output.h: Likewise.
5615 * parameters.cc: Likewise.
5616 * plugin.cc: Likewise.
5617 * powerpc.cc: Likewise.
5618 * reduced_debug_output.cc: Likewise.
5619 * reduced_debug_output.h: Likewise.
5620 * reloc.cc: Likewise.
5621 * reloc.h: Likewise.
5622 * resolve.cc: Likewise.
5623 * script-sections.cc: Likewise.
5624 * script.cc: Likewise.
5625 * script.h: Likewise.
5626 * sparc.cc: Likewise.
5627 * symtab.cc: Likewise.
5628 * symtab.h: Likewise.
5629 * target-select.cc: Likewise.
5630 * target-select.h: Likewise.
5631 * token.h: Likewise.
5632 * workqueue.cc: Likewise.
5633 * workqueue.h: Likewise.
5634 * x86_64.cc: Likewise.
5635
a0351a69
DK
56362009-12-10 Doug Kwan <dougkwan@google.com>
5637
5638 * arm.cc (attributes.h): New include.
5639 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5640 (Arm_relobj::~Arm_relobj): Delete object pointed by
5641 attributes_section_data_.
5642 (Arm_relobj::attributes_section_data): New method definition.
5643 (Arm_relobj::attributes_section_data_): New data member declaration.
5644 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5645 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5646 attributes_section_data_.
5647 (Arm_dynobj::attributes_section_data): New method definition.
5648 (Arm_dynobj::attributes_section_data_): New data member declaration.
5649 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5650 initialization value of may_use_blx_ to false.
5651 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5652 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5653 object attributes to compute results instead of hard-coding.
5654 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5655 Target_arm::get_secondary_compatible_arch,
5656 Target_arm::set_secondary_compatible_arch
5657 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5658 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5659 New method declarations.
5660 (Target_arm::get_aeabi_object_attribute): New method definition.
5661 (Target_arm::attributes_section_data_): New data member declaration.
5662 (read_arm_attributes_section): New template definition.
5663 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5664 (Arm_dynobj::do_read_symbols): Ditto.
5665 (Target_arm::do_finalize_sections): Merge attributes sections from
5666 input. Check for BLX use after attributes section merging.
5667 Fix __exidx_start and __exidx_end visibility. Create an
5668 .ARM.attributes section if necessary.
5669 (Target_arm::get_secondary_compatible_arch,
5670 Target_arm::set_secondary_compatible_arch,
5671 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5672 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 5673 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
5674 New method definitions.
5675
b59befec
ILT
56762009-12-09 Ian Lance Taylor <iant@google.com>
5677
5678 * plugin.cc (Plugin::load): Don't cast from void* to a function
5679 pointer.
5680
1276bc89
ILT
56812009-12-09 Ian Lance Taylor <iant@google.com>
5682
5683 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5684 information fields.
5685
2f2de248
L
56862009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5687
5688 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5689 Replace two_file_shared_1.so with two_file_shared_2.so.
5690 * testsuite/Makefile.in: Regenerated.
5691
4f787271
DK
56922009-12-08 Doug Kwan <dougkwan@google.com>
5693
5694 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5695 (HFILES): Add attributes.h and int_encoding.h.
5696 * Makefile.in: Regenerate.
5697 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5698 function definitions to int_encoding.cc
5699 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5700 prototypes to int_encoding.h
5701 * reduced_debug_output.cc (int_encoding.h): New include.
5702 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5703 function definitions to int_encoding.cc
5704 (insert_into_vector, read_from_pointer): Move template definitions to
5705 int_encoding.h
5706 * attributes.cc: New file.
5707 * attributes.h: New file.
5708 * int_encoding.cc: New file.
5709 * int_encoding.h: New file.
5710
20b52f1a
RÁE
57112009-12-07 Rafael Avila de Espindola <espindola@google.com>
5712
5713 PR gold/11055
5714 * incremental-dump.cc (dump_incremental_inputs): New.
5715 (main): Use dump_incremental_inputs.
5716
53d7974c
L
57172009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5718
5719 PR gold/10893
5720 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5721 checking elfcpp::STT_FUNC.
5722 (Target_i386::Relocate::relocate): Likewise.
5723 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5724
5725 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5726 symbols from shared libraries into normal FUNC symbols.
5727
5728 * symtab.h (Symbol): Add is_func and use it.
5729
05a352e6
DK
57302009-12-05 Doug Kwan <dougkwan@google.com>
5731
5732 * arm.cc (Target_arm::arm_info): Initialize new fields
5733 attributes_section and attributes_vendor.
5734 * i386.cc (Target_i386::i386_info): Same.
5735 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5736 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5737 fields attributes_section and attributes_vendor.
53d7974c 5738 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
5739 * target.h (Target::attributes_section, Target::attributes_vendor,
5740 Target::is_attributes_section, Target::attribute_arg_type,
5741 Target::attributes_order): New method definitions.
5742 (Target::Target_info::attributes_section,
5743 Target::Target_info::attributes_vendor): New fields.
5744 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5745 virtual method definitions.
5746 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5747 attributes_section and attributes_vendor.
5748 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5749
f4e5969c
DK
57502009-12-05 Doug Kwan <dougkwan@google.com>
5751
5752 * arm.cc: Update comments about interworking and stub generation.
5753 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5754 considered as non-PIC.
5755 (Arm_relocate_functions::base_abs): Fix formatting.
5756 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5757 of function to use GOT entry address instead of offset.
5758 (Target_arm::Scan::global): Issue an error if a symbol would need a
5759 PLT does not get one because it is untyped. Remove code to create
5760 dynamic symbols for relative branches.
5761 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5762 takes unsigned integer instead of boolean.
5763
1abce4a6
L
57642009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5765
5766 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5767 (two_file_test_LDADD): Likewise.
5768 (common_test_1_LDADD): Likewise.
5769 (exception_test_LDADD) Likewise.
5770 (weak_test_LDADD): Likewise.
5771 (many_sections_test_LDADD): Likewise.
5772 (initpri1_LDADD): Likewise.
5773 (script_test_1_LDADD): Likewise.
5774 (script_test_2_LDADD): Likewise.
5775 (justsyms_LDADD): Likewise.
5776 (binary_test_LDADD): Likewise.
5777 (large_LDADD): Likewise.
5778 * testsuite/Makefile.in: Regenerated.
5779
adcf2816 57802009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 5781
adcf2816
L
5782 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5783 (Symbol_table::override_with_special): Likewise.
5784 (Symbol_table::add_from_object): Likewise.
5785
28e67f5d
RÁE
57862009-12-04 Rafael Avila de Espindola <espindola@google.com>
5787
5788 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5789 Don't set the data_offset twice.
5790
ae10a101
RÁE
57912009-12-04 Rafael Avila de Espindola <espindola@google.com>
5792
5793 * testsuite/Makefile.in: Regenerate.
5794
f59f41f3
DK
57952009-12-03 Doug Kwan <dougkwan@google.com>
5796
5797 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5798 (Target_arm::do_finalize_sections): Add parameter for symbol table
5799 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5800 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5801 parameter for symbol table pointer.
5802 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5803 an additional parameter for a pointer to symbol table.
5804 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5805 parameter for a symbol table pointer.
5806 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5807 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5808 Ditto.
5809 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5810 parameter for a symbol table pointer.
5811
ca55d848
RÁE
58122009-12-03 Rafael Avila de Espindola <espindola@google.com>
5813
5814 * incremental.cc (Incremental_inputs_header)
5815 (Incremental_inputs_header_write, Incremental_inputs_entry)
5816 (Incremental_inputs_entry_write): Move ...
5817 * incremental.h (Incremental_inputs_header)
5818 (Incremental_inputs_header_write, Incremental_inputs_entry)
5819 (Incremental_inputs_entry_write): here.
5820
3aec4f9c
RÁE
58212009-12-02 Rafael Avila de Espindola <espindola@google.com>
5822
5823 * incremental.cc (make_sized_incremental_binary): Set the target.
5824 Error if it is incompatible.
5825 * output.h (Output_file): Add filename method.
5826
9c0ae74d
RÁE
58272009-12-02 Rafael Avila de Espindola <espindola@google.com>
5828
5829 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5830 from the get_* methods.
5831
a45500ae
RÁE
58322009-12-02 Rafael Avila de Espindola <espindola@google.com>
5833
5834 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5835 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5836 Write 0 for the data_offset of scripts.
5837
325e6408
RÁE
58382009-12-02 Rafael Avila de Espindola <espindola@google.com>
5839
5840 * testsuite/Makefile.am: Add the incremental_test.sh test.
5841 * testsuite/incremental_test.sh: New.
5842 * testsuite/incremental_test_1.c: New.
5843 * testsuite/incremental_test_2.c: New.
5844
954c3e2e
RÁE
58452009-12-01 Rafael Avila de Espindola <espindola@google.com>
5846
5847 * incremental-dump.cc (main): Fix typos.
5848
f8086623
RÁE
58492009-11-27 Rafael Avila de Espindola <espindola@google.com>
5850
5851 PR gold/11025
5852 * incremental-dump.cc (main): Use llu to print 64 bit values.
5853
3b0dd6ac
L
58542009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5855 H.J. Lu <hongjiu.lu@intel.com>
5856
5857 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5858 $(LIBDL).
5859 (incremental_dump_LDADD): Likewise.
5860 * Makefile.in: Regenerated.
5861
a6d1ef57 58622009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 5863
a6d1ef57
DK
5864 Revert:
5865
5866 2009-11-25 Doug Kwan <dougkwan@google.com>
5867
5868 * arm.cc (Target_arm::Target_arm): Move method definition
5869 outside of class definition. Add code to handle
5870 --target1-rel, --target1-abs and --target2= options.
5871 (Target_arm::get_reloc_reloc_type): Change method to be
5872 non-static and const.
5873 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5874 New data member declaration.
5875 (Target_arm::Scan::local, Target_arm::Scan::global,
5876 Target_arm::Relocate::relocate,
5877 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5878 Adjust call to Target_arm::get_real_reloc_type.
5879 (Target_arm::get_real_reloc_type): Use command line options
5880 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5881 * options.h (--target1-rel, --target1-abs, --target2): New
5882 ARM-only options.
5883
50aeb7d4
DK
58842009-11-25 Doug Kwan <dougkwan@google.com>
5885
5886 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5887 class definition. Add code to handle --target1-rel, --target1-abs
5888 and --target2= options.
5889 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5890 and const.
5891 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5892 member declaration.
5893 (Target_arm::Scan::local, Target_arm::Scan::global,
5894 Target_arm::Relocate::relocate,
5895 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5896 call to Target_arm::get_real_reloc_type.
5897 (Target_arm::get_real_reloc_type): Use command line options to
5898 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5899 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5900 options.
5901
51938283
DK
59022009-11-25 Doug Kwan <dougkwan@google.com>
5903
5904 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5905 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5906 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5907 formatting.
5908 (Arm_relocate_functions::thm_call): Replace body with a call to
5909 Arm_relocate_functions::thumb_branch_common.
5910 (Arm_relocate_functions::thm_jump24,
5911 Arm_relocate_functions::thm_xpc22): New method definitions.
5912 (Arm_relocate_functions::thumb_branch_common): New method definition.
5913 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5914 operator.
5915 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5916 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5917
e2b8f3c4
RÁE
59182009-11-24 Rafael Avila de Espindola <espindola@google.com>
5919
5920 * Makefile.am: Build incremental-dump
5921 * Makefile.in: Regenerate.
5922 * incremental-dump.cc: New.
5923 * incremental.cc (Incremental_inputs_header_data,
5924 Incremental_inputs_entry_data): Move to incremental.h
5925 * incremental.h: (Incremental_inputs_header_data,
5926 Incremental_inputs_entry_data): Move from incremental.cc
5927
bcba9aec
RÁE
59282009-11-24 Rafael Avila de Espindola <espindola@google.com>
5929
5930 * incremental.cc (Incremental_inputs_header,
5931 Incremental_inputs_header_write, Incremental_inputs_entry,
5932 Incremental_inputs_entry_write): Add a typedef with the data type.
5933
7c3afe08
RÁE
59342009-11-24 Rafael Avila de Espindola <espindola@google.com>
5935
5936 * incremental.cc (Incremental_inputs_header,
5937 Incremental_inputs_header_write, Incremental_inputs_entry,
5938 Incremental_inputs_entry_write): Update comment about which
5939 type has the filed descriptions.
5940
d204b6e9
DK
59412009-11-15 Doug Kwan <dougkwan@google.com>
5942
5943 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5944 (Arm_relocate_functions::arm_branch_common): Change method defintion
5945 in class definition to a method declaration and update list of formal
5946 parameters.
5947 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5948 Arm_relocation_functions::jump24): Adjust call to
5949 Arm_relocate_functions::arm_branch_common. Update list of formal
5950 parameters.
5951 (Arm_relocate_functions::xpc25): New method definition.
5952 (Arm_relocate_functions::arm_branch_common): Move method defintion
5953 out from class definition. Use stubs for mode-switching and extending
5954 branch ranges.
5955 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5956 specially. Change code to enable use of stubs in ARM branches.
5957
43d12afe
DK
59582009-11-10 Doug Kwan <dougkwan@google.com>
5959
5960 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5961 in method declaration.
5962 (Target_arm::relocate_stub): New method declaration.
5963 (Target_arm::default_target): Change to return a pointer instead of
5964 a const reference.
5965 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5966 Target_arm::default_target.
5967 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5968 method definition.
5969 (Target_arm::relocate_section): Adjust view.
5970 (Target_arm::relocate_stub): New method definition.
5971
ac33a407
DK
59722009-11-10 Doug Kwan <dougkwan@google.com>
5973
5974 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5975 a format warning.
5976 * incremental.cc (open_incremental_binary): Initialized local
5977 variables to avoid warnings.
5978 * object.cc (make_elf_object): Ditto.
5979 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5980 a format warning.
e1df38aa 5981
88ee28e9
L
5982009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5983
5984 PR gold/10930
5985 * testsuite/plugin_test.c: Include "config.h".
5986
2daedcd6
DK
59872009-11-09 Doug Kwan <dougkwan@google.com>
5988
5989 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5990 (arm_symbol_value): Remove.
5991 (Arm_relocate_functions::arm_branch_common,
5992 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5993 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5994 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5995 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5996 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5997 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5998 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5999 Arm_relocate_functions::thm_mobw_abs_nc,
6000 Arm_relocate_functions::thm_mov_abs,
6001 Arm_relocate_functions::movw_prel_nc,
6002 Arm_relocate_functions::thm_movt_abs,
6003 Arm_relocate_functions::movt_prel,
6004 Arm_relocate_functions::thm_movw_prel_nc,
6005 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6006 (Target_arm::Relocate::relocate): Only decompose address into two
6007 parts if relocation type uses the thumb-bit and pass the actual
6008 bit instead of a flag indicating that the thumb-bit is used. Adjust
6009 calls to methods in Arm_relocate_functions for this change.
6010
1276bc89 60112009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
6012
6013 PR 10925
6014 * reloc.cc: Instantiate
6015 Sized_relobj::initialize_input_to_output_maps and
6016 Sized_relobj:free_input_to_output_maps.
6017
e53ad1b5
ILT
60182009-11-06 Ian Lance Taylor <iant@google.com>
6019
6020 PR 10876
6021 * defstd.cc (in_segment): Set only_if_ref true for "end".
6022
eb44217c
DK
60232009-11-06 Doug Kwan <dougkwan@google.com>
6024
6025 * arm.cc (class Reloc_stub): Correct a comment.
6026 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6027 (Target_arm::scan_section_for_stubs): New method declaration.
6028 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6029 Change methods from private to protected.
6030 (Target_arm::do_may_relax): New method definition.
6031 (Target_arm::do_relax, Target_arm::group_sections,
6032 Target_arm::scan_reloc_for_stub,
6033 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6034 (Target_arm::arm_input_section_map_): New data member declaration.
6035 (Target_arm::scan_reloc_for_stub,
6036 Target_arm::scan_reloc_section_for_stubs,
6037 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6038 Target_arm::do_relax): New method definitions.
6039
5d329b7d
ILT
60402009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6041
6042 * configure.ac: Check for (struct stat)::st_mtim
6043 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6044 * config.in: Regenerate.
6045 * configure: Regenerate.
6046
96a0d71b
ILT
60472009-11-05 Ian Lance Taylor <iant@google.com>
6048
6049 PR 10910
6050 * output.cc (Output_segment::add_output_section): Add missing
6051 return statement.
6052
594c8e5e
ILT
60532009-11-04 Ian Lance Taylor <iant@google.com>
6054
6055 PR 10880
6056 * object.h (class Object): Add is_needed and set_is_needed
6057 methods. Add is_needed_ field. Make bool fields into bitfields.
6058 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6059 defined in a dynamic object and referenced by a regular object,
6060 set is_needed for the dynamic object.
6061 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6062 if the file is marked with as_needed and it is not needed.
6063
22b127cc
ILT
60642009-11-04 Ian Lance Taylor <iant@google.com>
6065
6066 PR 10887
6067 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6068 tags if data is discarded by linker script.
6069 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6070 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6071 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6072 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6073
f5c870d2
ILT
60742009-11-04 Ian Lance Taylor <iant@google.com>
6075
6076 * layout.cc (Layout::get_output_section): Add is_interp and
6077 is_dynamic_linker_section parameters. Change all callers.
6078 (Layout::choose_output_section): Likewise.
6079 (Layout::make_output_section): Likewise.
6080 (Layout::add_output_section_data): Add is_dynamic_linker_section
6081 parameter. Change all callers.
6082 * layout.h (class Layout): Update declarations.
6083 * output.h (class Output_section): Add is_interp, set_is_interp,
6084 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6085 Add is_interp_, is_dynamic_linker_section_ fields. Change
6086 generate_code_fills_at_write_ to a bitfield.
6087 * output.cc (Output_section::Output_sections): Initialize new
6088 fields.
6089 (Output_segment::add_output_section): Add do_sort parameter.
6090 Change all callers.
6091
1ae4d23b
ILT
60922009-11-03 Ian Lance Taylor <iant@google.com>
6093
6094 PR 10860
6095 * options.h (class General_options): Add --warn-common.
6096 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6097 merging two common symbols.
6098 (Symbol_table::should_override): Handle --warn-common when merging
6099 a common symbol with a defined symbol. Use report_resolve_problem
6100 for multiple definitions.
6101 (Symbol_table::report_resolve_problem): New function.
6102 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6103
55da9579
DK
61042009-11-03 Doug Kwan <dougkwan@google.com>
6105
6106 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6107 stub_factory_.
6108 (Target_arm::stub_factory): New method definition.
6109 (Target_arm::new_arm_input_section,
6110 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6111 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 6112 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
6113 New type definitions.
6114 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6115 member declarations.
6116 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6117 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6118 New method definitions.
6119
37a9ac43
ILT
61202009-11-03 Ian Lance Taylor <iant@google.com>
6121
6122 * options.h (class General_options): Add --warn_constructors.
6123
b3d6a3d4
ILT
61242009-11-03 Ian Lance Taylor <iant@google.com>
6125
6126 PR 10893
6127 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6128 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6129
934b01dd
ILT
61302009-11-03 Ian Lance Taylor <iant@google.com>
6131
6132 PR 10895
6133 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6134 --msgid-bugs-address.
6135 (install-pdf): New target.
6136 (install-data_yes): Look up one directory to find mkinstalldirs.
6137
03c1939b
L
61382009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6139
6140 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6141 tree.
6142
ebd95253
DK
61432009-10-30 Doug Kwan <dougkwan@google.com>
6144
6145 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6146
e9bbb538
DK
61472009-10-30 Doug Kwan <dougkwan@google.com>
6148
6149 * arm.cc (Stub_addend_reader): New struct template definition
6150 and partial specializations.
6151 (Stub_addend_reader::operator()): New method definition for a
6152 partially specialized template.
6153
d5b40221
DK
61542009-10-30 Doug Kwan <dougkwan@google.com>
6155
6156 * arm.cc (Arm_relobj::processor_specific_flags): New method
6157 definition.
6158 (Arm_relobj::do_read_symbols): New method declaration.
6159 (Arm_relobj::processor_specific_flags_): New data member declaration.
6160 (Arm_dynobj): New class definition.
6161 (Target_arm::do_finalize_sections): Add input_objects parameter.
6162 (Target_arm::do_adjust_elf_header): New method declaration.
6163 (Target_arm::are_eabi_versions_compatible,
6164 (Target_arm::merge_processor_specific_flags): New method declaration.
6165 (Target_arm::do_make_elf_object): New overloaded method definitions
6166 and declaration.
6167 (Arm_relobj::do_read_symbols): New method definition.
6168 (Arm_dynobj::do_read_symbols): Ditto.
6169 (Target_arm::do_finalize_sections): Add input_objects parameters.
6170 Merge processor-specific flags from all input objects.
6171 (Target_arm::are_eabi_versions_compatible,
6172 Target_arm::merge_processor_specific_flags,
6173 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6174 New method definitions.
6175 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6176 Input_objects pointer type parameter.
6177 * layout.cc (Layout::finalize): Pass input objects to target's.
6178 finalize_sections function.
6179 * output.cc (Output_file_header::do_sized_write): Set ELF file
6180 header's processor-specific flags.
6181 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6182 Input_objects pointer type parameter.
6183 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6184 * target.h (Input_objects): New forward class declaration.
6185 (Target::processor_specific_flags,
6186 Target::are_processor_specific_flags_sect): New method definitions.
6187 (Target::finalize_sections): Add input_objects parameter.
6188 (Target::Target): Initialize processor_specific_flags_ and
6189 are_processor_specific_flags_set_.
6190 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6191 parameter.
6192 (Target::set_processor_specific_flags): New method definition.
6193 (Target::processor_specific_flags_,
6194 Target::are_processor_specific_flags_set_): New data member
6195 declarations.
6196 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6197 Input_objects pointer type parameter.
6198
ebabffbd
DK
61992009-10-30 Doug Kwan <dougkwan@google.com>
6200
6201 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6202
ad0f2072
ILT
62032009-10-28 Ian Lance Taylor <iant@google.com>
6204
6205 * object.h (class Relobj): Drop options parameter from
6206 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6207 do_scan_relocs, do_relocate. Change all callers.
6208 (class Sized_relobj): Drop options parameters from
6209 do_gc_process_relocs, do_scan_relocs, do_relocate,
6210 do_relocate_sections, relocate_sections, emit_relocs_scan,
6211 emit_relocs_scan_reltype. Change all callers.
6212 (struct Relocate_info): Remove options field and all references to
6213 it.
6214 * reloc.h (class Read_relocs): Remove options constructor
6215 parameter and options_ field. Change all callers.
6216 (class Gc_process_relocs, class Scan_relocs): Likewise.
6217 (class Relocate_task): Likewise.
6218 * target-reloc.h (scan_relocs): Remove options parameter. Change
6219 all callers.
6220 (scan_relocatable_relocs): Likewise.
6221 * target.h (class Sized_target): Remove options parameter from
6222 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6223 all callers.
6224 * gc.h (gc_process_relocs): Remove options parameter. Change all
6225 callers.
6226 * arm.cc: Update functions to remove options parameters.
6227 * i386.cc: Likewise.
6228 * powerpc.cc: Likewise.
6229 * sparc.cc: Likewise.
6230 * x86_64.cc: Likewise.
6231 * testsuite/testfile.cc: Likewise.
6232
8ffa3667
DK
62332009-10-28 Doug Kwan <dougkwan@google.com>
6234
6235 * arm.cc (Arm_relobj): New class definition.
e1df38aa 6236 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
6237 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6238 New method definitions.
6239
40f36857
CC
62402009-10-28 Cary Coutant <ccoutant@google.com>
6241
6242 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6243 (Plugin::cleanup_done_): New member.
6244 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6245 (Plugin_manager::cleanup_done_): Remove.
6246 (Plugin_manager::add_input_file): Edit error message.
6247 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6248 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6249
2c849493
ILT
62502009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6251
6252 * fileread.cc: (File_read::View::~View): Use the new
6253 data_ownership_ filed.
6254 (File_read::~File_read): Dispose the new whole_file_view_.
6255 (File_read::open): Mmap the whole file if needed.
6256 (File_read::open): Use whole_file_view_ instead of contents_.
6257 (File_read::find_view): Use whole_file_view_ if applicable.
6258 (File_read::do_read): Use whole_file_view_ instead of contents_.
6259 (File_read::make_view): Use whole_file_view_ instead of contents_,
6260 update File_read::View::View call.
6261 (File_read::find_or_make_view): Update File_read::View::View
6262 call.
6263 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6264 remove contents_
6265 (File_read::View::Data_ownership): New enum.
6266 (File_read::View::View): Replace bool mapped_ with Data_ownership
6267 argument.
6268 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6269 (File_read::View::data_ownership_): New field.
6270 (File_read::contents_): Remove (replaced by whole_file_view_).
6271 (File_read::whole_file_view_): New field.
6272 * options.h (class General_options): Add --keep-files-mapped.
6273
24998053
CC
62742009-10-27 Cary Coutant <ccoutant@google.com>
6275
6276 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6277 * testsuite/Makefile.am (plugin_test_5): New test case.
6278 * testsuite/Makefile.in: Regenerate.
6279
72adc4fa
DK
62802009-10-25 Doug Kwan <dougkwan@google.com>
6281
6282 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6283 from private to protected to allow access by child class.
6284 (Sized_relobj::do_relocate_sections): New method declaration.
6285 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 6286 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
6287 Sized_relobj::relocate_sections. Instantiate template explicitly
6288 for different target sizes and endianity.
6289
07f508a2
DK
62902009-10-24 Doug Kwan <dougkwan@google.com>
6291
6292 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6293 (Arm_input_section::as_arm_input_section): New method.
6294 (Arm_output_section): New class definition.
6295 (Arm_output_section::create_stub_group,
6296 Arm_output_section::group_sections): New method definitions.
6297
10ad9fe5
DK
62982009-10-22 Doug Kwan <dougkwan@google.com>
6299
6300 * arm.cc (Arm_input_section): New class definition.
6301 (Arm_input_section::init, Arm_input_section:do_write,
6302 Arm_input_section::set_final_data_size,
6303 Arm_input_section::do_reset_address_and_file_offset): New method
6304 definitions.
6305
56ee5e00
DK
63062009-10-21 Doug Kwan <dougkwan@google.com>
6307
6308 * arm.cc (Stub_table, Arm_input_section): New forward class
6309 declarations.
6310 (Stub_table): New class defintion.
6311 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6312 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6313 New method definition.
6314
b569affa
DK
63152009-10-21 Doug Kwan <dougkwan@google.com>
6316
6317 * arm.cc: Update copyright comments.
6318 (Target_arm): New forward class template declaration.
6319 (Arm_address): New type.
6320 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6321 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6322 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6323 constants.
6324 (Insn_template): Same.
6325 (DEF_STUBS): New macro.
6326 (Stub_type): New enum type.
6327 (Stub_template): New class definition.
6328 (Stub): Same.
6329 (Reloc_stub): Same.
6330 (Stub_factory): Same.
6331 (Target_arm::Target_arm): Initialize may_use_blx_ and
6332 should_force_pic_veneer_.
6333 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6334 Target_arm::should_force_pic_veneer,
6335 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6336 Target_arm::using_thumb_only, Target_arm:;default_target): New
6337 method defintions.
6338 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6339 New data member declarations.
6340 (Insn_template::size, Insn_template::alignment): New method defintions.
6341 (Stub_template::Stub_template): New method definition.
6342 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6343 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6344 (Stub_factory::Stub_factory): New method definition.
6345 * gold.h (string_hash): New template.
6346 * output.h (Input_section_specifier::hash_value): Use
6347 gold::string_hash.
6348 (Input_section_specifier::string_hash): Remove.
6349 * stringpool.cc (Stringpool_template::string_hash): Use
6350 gold::string_hash.
6351
6c172549
DK
63522009-10-20 Doug Kwan <dougkwan@google.com>
6353
6354 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6355 symbols of relaxed input sections.
6356 * output.h (Output_section::find_relaxed_input_section): Make
6357 method public.
6358
c5617f2f
DK
63592009-10-16 Doug Kwan <dougkwan@google.com>
6360
6361 * dynobj.cc (Versions::Versions): Initialize version_script_.
6362 Only insert base version symbol definition for a shared object
6363 if version script defines any version versions.
6364 (Versions::define_base_version): New method definition.
6365 (Versions::add_def): Check that base version is not needed.
6366 (Versions::add_need): Define base version lazily.
6367 * dynobj.h (Versions::define_base_version): New method declaration.
6368 (Versions::needs_base_version_): New data member declaration.
6369 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6370 (check_DATA): Add no_version_test.stdout.
6371 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6372 New make rules.
6373 * testsuite/Makefile.in: Regenerate.
6374 * testsuite/no_version_test.c: New file.
6375 * testsuite/no_version_test.sh: Ditto.
6376
3c12dcdb
DK
63772009-10-16 Doug Kwan <dougkwan@google.com>
6378
6379 * expression.cc (class Segment_start_expression): New class definition.
6380 (Segment_start_expression::value): New method definition.
6381 (script_exp_function_segment_start): Return a new
6382 Segment_start_expression.
6383 * gold/script-c.h (script_saw_segment_start_expression): New function
6384 prototype.
6385 * script-sections.cc (Script_sections::Script_sections): Initialize
6386 SAW_SEGMENT_START_EXPRESSION_ to false.
6387 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6388 and -Tbbs options to specify section addresses if given in
6389 command line and no SEGMENT_START expression is seen in a script.
6390 * script-sections.h (Script_sections::saw_segment_start_expression,
6391 Script_sections::set_saw_segment_start_expression): New method
6392 definition.
6393 (Script_sections::saw_segment_start_expression_): New data member
6394 declaration.
6395 * script.cc (script_saw_segment_start_expression): New function.
6396 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6397 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6398 script_test_7.sh and script_test_8.sh.
6399 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6400 script_test_8.stdout.
6401 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6402 (script_test_6, script_test_6.stdout, script_test_7,
6403 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6404 * Makefile.in: Regenerate.
6405 * testsuite/script_test_6.sh: New file.
6406 * testsuite/script_test_6.t: Same.
6407 * testsuite/script_test_7.sh: Same.
6408 * testsuite/script_test_7.t: Same.
6409 * testsuite/script_test_8.sh: Same.
6410
64b1ae37
DK
64112009-10-16 Doug Kwan <dougkwan@google.com>
6412
6413 * output.cc (Output_segment::set_section_list_address): Cast
6414 expressions to unsigned long long type to avoid format warnings.
6415
661be1e2
ILT
64162009-10-15 Ian Lance Taylor <iant@google.com>
6417
12edd763 6418 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 6419 dot assignment to script_sections_.
12edd763
ILT
6420 * script-sections.cc (Script_sections::add_dot_assignment):
6421 Initialize if necessary.
6422
68b6574b
ILT
6423 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6424 program headers with no load segment if there is a linker script.
6425
661be1e2
ILT
6426 * layout.cc (Layout::set_segment_offsets): Align the file offset
6427 to the segment aligment for -N or -n with no load segment.
6428 * output.cc (Output_segment::add_output_section): Don't crash if
6429 the first section is a TLS section.
6430 (Output_segment::set_section_list_addresses): Print an error
6431 message if the address moves backward in a linker script.
6432 * script-sections.cc
6433 (Output_section_element_input::set_section_addresses): Don't
6434 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6435 (Orphan_output_section::set_section_addresses): Likewise.
6436
f15f61a7
DK
64372009-10-15 Doug Kwan <dougkwan@google.com>
6438
6439 * layout.cc (Layout::finish_dynamic_section): Generate tags
6440 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6441 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6442 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6443
82bb573a
ILT
64442009-10-14 Ian Lance Taylor <iant@google.com>
6445
6446 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6447 fields.
6448 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6449 data_shdr fields of relinfo.
6450 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6451 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6452 R_386_TLS_LDO_32, adjust based on section flags.
6453 (Target_i386::Relocate::fix_up_ldo): Remove.
6454
374ad285
ILT
64552009-10-13 Ian Lance Taylor <iant@google.com>
6456
6457 Add support for -pie.
6458 * options.h (class General_options): Add -pie and
6459 --pic-executable.
6460 (General_options::output_is_position_independent): Test -pie.
6461 (General_options::output_is_executable): Return true if not shared
6462 and not relocatable.
6463 (General_options::output_is_pie): Remove.
6464 * options.cc (General_options::finalize): Reject incompatible uses
6465 of -pie.
6466 * gold.cc (queue_middle_tasks): A -pie link is not static.
6467 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6468 * symtab.cc (Symbol::final_value_is_known): Return false if
6469 output_is_position_independent.
6470 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6471 output_is_position_independent.
6472 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6473 output_is_position_independent.
6474 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6475 output_is_position_independent.
6476 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6477 two_file_pie_test.
6478 (basic_pie_test.o, basic_pie_test): New targets.
6479 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6480 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6481 (two_file_pie_test): New target.
6482 * testsuite/Makefile.in: Rebuild.
6483 * README: Remove note saying that -pie is not supported.
6484
c6585162
ILT
64852009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6486
6487 * options.h (class General_options): Add -init and -fini.
6488 * layout.cc (Layout::finish_dynamic_section): Emit
6489 given init and fini functions.
6490
032ce4e9
ST
64912009-10-13 Sriraman Tallam <tmsriram@google.com>
6492
6493 * gc.h (gc_process_relocs): Check if icf is enabled using new
6494 function.
6495 * gold.cc (queue_initial_tasks): Likewise.
6496 (queue_middle_tasks): Likewise.
6497 * object.cc (do_layout): Likewise.
6498 * symtab.cc (is_section_folded): Likewise.
6499 * main.cc (main): Likewise.
6500 * reloc.cc (Read_relocs::run): Likewise.
6501 (Sized_relobj::do_scan_relocs): Likewise.
6502 * icf.cc (is_function_ctor_or_dtor): New function.
6503 (Icf::find_identical_sections): Check if function is ctor or dtor when
6504 safe icf is chosen.
6505 * options.h (General_options::icf): Change option to be an enum.
6506 (Icf_status): New enum.
6507 (icf_enabled): New method.
6508 (icf_safe_folding): New method.
6509 (set_icf_status): New method.
6510 (icf_status_): New variable.
6511 * (options.cc) (General_options::finalize): Set icf_status_.
6512 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6513 icf_test and icf_keep_unique_test to use the --icf enum flag.
6514 * testsuite/icf_safe_test.sh: New file.
e1df38aa 6515 * testsuite/icf_safe_test.cc: New file.
032ce4e9 6516
f345227a
ST
65172009-10-12 Sriraman Tallam <tmsriram@google.com>
6518
6519 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6520 includes to gc.h and icf.h.
6521 * arm.cc: Include gc.h.
6522 * gold.cc: Likewise.
6523 * i386.cc: Likewise.
6524 * powerpc.cc: Likewise.
6525 * sparc.cc: Likewise.
6526 * x86_64.cc: Likewise.
6527 * gc.h: Include icf.h.
6528
1c7814ed
ILT
65292009-10-11 Ian Lance Taylor <iant@google.com>
6530
6531 * plugin.cc: Include "gold.h" before other header files.
6532
ae3b5189
CD
65332009-10-10 Chris Demetriou <cgd@google.com>
6534
6535 * options.h (Input_file_argument::Input_file_type): New enum.
6536 (Input_file_argument::is_lib_): Replace with...
6537 (Input_file_argument::type_): New member.
6538 (Input_file_argument::Input_file_argument): Take Input_file_type
6539 'type' rather than boolean 'is_lib' as second argument.
6540 (Input_file_argument::is_lib): Use type_.
6541 (Input_file_argument::is_searched_file): New function.
6542 (Input_file_argument::may_need_search): Handle is_searched_file.
6543 * options.cc (General_options::parse_library): Support -l:filename.
6544 (General_options::parse_just_symbols): Update for Input_file_argument
6545 changes.
6546 (Command_line::process): Likewise.
6547 * archive.cc (Archive::get_file_and_offset): Likewise.
6548 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6549 * script.cc (read_script_file, script_add_file): Likewise.
6550 * fileread.cc (Input_file::Input_file): Likewise.
6551 (Input_file::will_search_for): Handle is_searched_file.
6552 (Input_file::open): Likewise.
6553 * readsyms.cc (Read_symbols::get_name): Likewise.
6554 * testsuite/Makefile.am (searched_file_test): New test.
6555 * testsuite/Makefile.in: Regenerate.
6556 * testsuite/searched_file_test.cc: New file.
6557 * testsuite/searched_file_test_lib.cc: New file.
6558
f3048a1d
ILT
65592009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6560 Ian Lance Taylor <iant@google.com>
6561
6562 * descriptor.cc: Include <cstdio> and "binary-io.h".
6563 (Descriptors::open): Open the files in binary mode always.
6564 * script.cc (Lex::get_token): Treat \r as whitespace.
6565
d4780e57
ILT
65662009-10-09 Ian Lance Taylor <iant@google.com>
6567
6568 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6569
d9a893b8
ILT
65702009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6571 Ian Lance Taylor <iant@google.com>
6572
6573 * configure.ac: Check for readv function also.
6574 * fileread.cc (readv): Define if not HAVE_READV.
6575 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6576 does not exist.
6577 * config.in: Regenerate.
6578 * configure: Regenerate.
6579
c0a62865
DK
65802009-10-09 Doug Kwan <dougkwan@google.com>
6581
6582 * layout.cc (Layout::make_output_section): Call target hook to make
6583 ordinary output section.
6584 (Layout::finalize): Adjust parameter list of call the
6585 Target::may_relax().
6586 * layout.h (class Layout::section_list): New method.
6587 * merge.h (Output_merge_base::entsize): Change visibility to public.
6588 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6589 New methods.
6590 (Output_merge_string::do_is_string): New method.
6591 * object.cc (Sized_relobj::do_setup): renamed from
6592 Sized_relobj::set_up.
6593 * object.h (Sized_relobj::adjust_shndx,
6594 Sized_relobj::initializ_input_to_output_maps,
6595 Sized_relobj::free_input_to_output_maps): Change visibilities to
6596 protected.
6597 (Sized_relobj::setup): Virtualize.
6598 (Sized_relobj::do_setup): New method declaration.
6599 (Sized_relobj::invalidate_section_offset,
6600 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6601 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6602 * options.cc (parse_int): New function.
6603 * options.h (parse_int): New declaration.
6604 (DEFINE_int): New macro.
6605 (stub_group_size): New option.
6606 * output.cc (Output_section::Output_section): Initialize memebers
6607 merge_section_map_, merge_section_by_properties_map_,
6608 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6609 (Output_section::add_input_section): Handled deferred code-fill
6610 generation and remove an old comment.
6611 (Output_section::add_relaxed_input_section): New method definition.
6612 (Output_section::add_merge_input_section): Use merge section by
6613 properties map to speed to search. Update merge section maps
6614 as appropriate.
6615 (Output_section::build_relaxation_map): New method definition.
6616 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6617 Same.
6618 (Output_section::relax_input_section): Renamed to
6619 Output_section::convert_input_sections_to_relaxed_sections and change
6620 interface to take a vector of pointers to relaxed sections.
6621 (Output_section::find_merge_section,
6622 Output_section::find_relaxed_input_section): New method definitions.
6623 (Output_section::is_input_address_mapped,
6624 Output_section::output_offset, Output_section::output_address):
6625 Use output section data maps to speed up searching.
6626 (Output_section::find_starting_output_address): Add comments.
6627 (Output_section::do_write,
6628 Output_section::write_to_postprocessing_buffer): Do code-fill
6629 generation as appropriate.
6630 (Output_section::get_input_sections): Invalidate relaxed input section
6631 map.
6632 (Output_section::restore_states): Adjust type of checkpoint .
6633 Invalidate relaxed input section map.
6634 * output.h (Output_merge_base): New class declaration.
6635 (Input_section_specifier): New class defintion.
6636 (class Output_relaxed_input_section) Change base class to
6637 Output_section_data_build.
6638 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6639 base class initializer.
6640 (Output_section::add_relaxed_input_section): New method declaration.
6641 (Output_section::Input_section): Change visibility to protected.
6642 (Output_section::Input_section::relobj,
6643 Output_section::Input_section::shndx): Handle relaxed input sections.
6644 Output_section::input_sections) Change visibility to protected. Also
6645 define overload to return a non-const pointer.
6646 (Output_section::Merge_section_properties): New class defintion.
6647 (Output_section::Merge_section_by_properties_map,
6648 Output_section::Output_section_data_by_input_section_map,
6649 Output_section::Relaxation_map): New types.
6650 (Output_section::relax_input_section): Rename method to
6651 Output_section::convert_input_sections_to_relaxed_sections and change
6652 interface to take a vector of relaxed section pointers.
6653 (Output_section::find_merge_section,
6654 Output_section::find_relaxed_input_section,
6655 Output_section::build_relaxation_map,
6656 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6657 New method declarations.
6658 (Output_section::merge_section_map_
6659 Output_section::merge_section_by_properties_map_,
6660 Output_section::relaxed_input_section_map_,
6661 Output_section::is_relaxed_input_section_map_valid_,
6662 Output_section::generate_code_fills_at_write_): New data members.
6663 * script-sections.cc
6664 (Output_section_element_input::set_section_addresses): Call
6665 current_data_size and addralign methods of relaxed input sections.
6666 (Orphan_output_section::set_section_addresses): Call current_data_size
6667 and addralign methods of relaxed input sections.
6668 * symtab.cc (Symbol_table::compute_final_value): Extract template
6669 from the body of Symbol_table::sized_finalize_symbol.
6670 (Symbol_table::sized_finalized_symbol): Call
6671 Symbol_table::compute_final_value.
6672 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6673 (Symbol_table::compute_final_value): New templated method declaration.
6674 * target.cc (Target::do_make_output_section): New method defintion.
6675 * target.h (Target::make_output_section): New method declaration.
6676 (Target::relax): Add more parameters for input objects, symbol table
6677 and layout. Adjust call to do_relax.
6678 (Target::do_make_output_section): New method declaration.
6679 (Target::do_relax): Add parameters for input objects, symbol table
6680 and layout.
6681
d446d6c4
ILT
66822009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6683
6684 * pread.c: Include stdio.h.
6685
bc06c745
ILT
66862009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6687
6688 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6689 defined.
6690
75aea3d0
ILT
66912009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6692
6693 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6694 Change read_shndx type to unsigned int.
6695 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6696 int.
6697 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6698 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6699 Change read_shndx type to unsigned int.
6700 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6701 int.
6702 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6703 * layout.cc (Layout::create_symtab_sections): Cast the result of
6704 local_symcount * symsize to off_t in the gold_assert.
6705
be8fcb75
ILT
67062009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6707
6708 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6709 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6710 R_ARM_BASE_ABS.
6711 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6712 (Arm_relocate_functions::thm_abs5): New function.
6713 (Arm_relocate_functions::abs12): New function.
6714 (Arm_relocate_functions::abs16): New function.
6715 (Arm_relocate_functions::base_abs): New function.
6716 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6717 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6718 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6719 R_ARM_BASE_ABS.
6720 (Scan::global): Likewise.
6721 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6722 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6723 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6724 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6725 R_ARM_BASE_ABS.
6726
c2a122b6
ILT
67272009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6728
6729 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6730 (Arm_relocate_functions::movt_prel): New function.
6731 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6732 (Arm_relocate_functions::thm_movt_prel): New function.
6733 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6734 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6735 (Scan::global, Relocate::relocate): Likewise.
6736 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6737
c4aa1e2d
ILT
67382009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6739
6740 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6741 Incremental_checker.
6742 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6743 unsigned int.
6744 (class Incremental_inputs_header): New class.
6745 (Incremental_inputs_header_writer): Edit comment.
6746 (Incremental_inputs_entry): New class.
6747 (Incremental_inputs_entry_writer): Edit comment.
6748 (Sized_incremental_binary::do_find_incremental_inputs_section):
6749 Add *strtab_shndx parameter, fill it.
6750 (Sized_incremental_binary::do_check_inputs): New method.
6751 (Incremental_checker::can_incrementally_link_output_file): Use
6752 Sized_incremental_binary::check_inputs.
6753 (Incremental_inputs::report_command_line): Save command line in
6754 command_line_.
6755 * incremental.h:
6756 (Incremental_binary::find_incremental_inputs_section): New
6757 method.
6758 (Incremental_binary::do_find_incremental_inputs_section): Add
6759 strtab_shndx parameter.
6760 (Incremental_binary::do_check_inputs): New pure virtual method.
6761 (Sized_incremental_binary::do_check_inputs): Declare.
6762 (Incremental_checker::Incremental_checker): Add incremental_inputs
6763 parameter, use it to initialize incremental_inputs_.
6764 (Incremental_checker::incremental_inputs_): New field.
6765 (Incremental_checker::command_line): New method.
6766 (Incremental_checker::inputs): New method.
6767 (Incremental_checker::command_line_): New field.
6768
c549a694
ILT
67692009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6770
6771 * incremental.cc: Include <cstdarg> and "target-select.h".
6772 (vexplain_no_incremental): New function.
6773 (explain_no_incremental): New function.
6774 (Incremental_binary::error): New method.
6775 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6776 method.
6777 (make_sized_incremental_binary): New function.
6778 (open_incremental_binary): New function.
6779 (can_incrementally_link_file): Add checks if output is ELF and has
6780 inputs section.
6781 * incremental.h: Include "elfcpp_file.h" and "output.h".
6782 (Incremental_binary): New class.
6783 (Sized_incremental_binary): New class.
6784 (open_incremental_binary): Declare.
6785 * object.cc (is_elf_object): Use
6786 elfcpp::Elf_recognizer::is_elf_file.
6787 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6788 * output.h (Output_file::filesize): New method.
6789
fd3c5f0b
ILT
67902009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6791
6792 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6793 New function.
6794 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6795 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6796 function.
6797 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6798 function.
6799 (Arm_relocate_functions::movw_abs_nc): New function.
6800 (Arm_relocate_functions::movt_abs): New function.
6801 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6802 (Arm_relocate_functions::thm_movt_abs): New function.
6803 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6804 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6805 (Scan::global): Likewise.
6806 (Relocate::relocate): Likewise.
6807 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6808
7f5309a5
ILT
68092009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6810
6811 * arm.cc (Arm_relocate_functions::got_prel) New function.
6812 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6813 (Relocate::relocate): Likewise.
6814 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6815
364c7fa5
ILT
68162009-10-06 Ian Lance Taylor <iant@google.com>
6817
6818 * options.h (class General_options): Define
6819 split_stack_adjust_size parameter.
6820 * object.h (class Object): Add uses_split_stack_ and
6821 has_no_split_stack_ fields. Add uses_split_stack and
6822 has_no_split_stack accessor functions. Declare
6823 handle_split_stack_section.
6824 (class Reloc_symbol_changes): Define.
6825 (class Sized_relobj): Define Function_offsets. Declare
6826 split_stack_adjust, split_stack_adjust_reltype, and
6827 find_functions.
6828 * object.cc (Object::handle_split_stack_section): New function.
6829 (Sized_relobj::do_layout): Call handle_split_stack_section.
6830 * dynobj.cc (Sized_dynobj::do_layout): Call
6831 handle_split_stack_section.
6832 * reloc.cc (Sized_relobj::relocate_sections): Call
6833 split_stack_adjust for executable sections in split_stack
6834 objects. Pass reloc_map to relocate_section.
6835 (Sized_relobj::split_stack_adjust): New function.
6836 (Sized_relobj::split_stack_adjust_reltype): New function.
6837 (Sized_relobj::find_functions): New function.
6838 * target-reloc.h: Include "object.h".
6839 (relocate_section): Add reloc_symbol_changes parameter. Change
6840 all callers.
6841 * target.h (class Target): Add calls_non_split method. Declare
6842 do_calls_non_split virtual method. Declare match_view and
6843 set_view_to_nop.
6844 * target.cc: Include "elfcpp.h".
6845 (Target::do_calls_non_split): New function.
6846 (Target::match_view): New function.
6847 (Target::set_view_to_nop): New function.
6848 * gold.cc (queue_middle_tasks): Give an error if mixing
6849 split-stack and non-split-stack objects with -r.
6850 * i386.cc (Target_i386::relocate_section): Add
6851 reloc_symbol_changes parameter.
6852 (Target_i386::do_calls_non_split): New function.
6853 * x86_64.cc (Target_x86_64::relocate_section): Add
6854 reloc_symbol_changes parameter.
6855 (Target_x86_64::do_calls_non_split): New function.
6856 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6857 parameter.
6858 * powerpc.cc (Target_powerpc::relocate_section): Add
6859 reloc_symbol_changes parameter.
6860 * sparc.cc (Target_sparc::relocate_section): Add
6861 reloc_symbol_changes parameter.
6862 * configure.ac: Call AM_CONDITIONAL for the default target.
6863 * configure: Rebuild.
6864 * testsuite/Makefile.am (TEST_AS): New variable.
6865 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6866 (check_DATA): Add split_i386 and split_x86_64 files.
6867 (SPLIT_DEFSYMS): Define.
6868 (split_i386_[1234n].o): New targets.
6869 (split_i386_[124]): New targets.
6870 (split_i386_[1234r].stdout): New targets.
6871 (split_x86_64_[1234n].o): New targets.
6872 (split_x86_64_[124]): New targets.
6873 (split_x86_64_[1234r].stdout): New targets.
6874 (MOSTLYCLEANFILES): Add new executables.
6875 * testsuite/split_i386.sh: New file.
6876 * testsuite/split_x86_64.sh: New file.
6877 * testsuite/split_i386_1.s: New file.
6878 * testsuite/split_i386_2.s: New file.
6879 * testsuite/split_i386_3.s: New file.
6880 * testsuite/split_i386_4.s: New file.
6881 * testsuite/split_i386_n.s: New file.
6882 * testsuite/split_x86_64_1.s: New file.
6883 * testsuite/split_x86_64_2.s: New file.
6884 * testsuite/split_x86_64_3.s: New file.
6885 * testsuite/split_x86_64_4.s: New file.
6886 * testsuite/split_x86_64_n.s: New file.
6887 * testsuite/testfile.cc (Target_test): Update relocation_section
6888 function.
6889 * testsuite/Makefile.in: Rebuild.
6890
e8a9fcda
ILT
68912009-10-06 Ian Lance Taylor <iant@google.com>
6892
6893 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6894 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6895 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6896 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6897 the address on ldo_addrs_.
6898 (Target_i386::Relocate::fix_up_ldo): New function.
6899
e99daf92
ILT
69002009-10-06 Rafael Espindola <espindola@google.com>
6901
6902 * plugin.cc (add_input_library): New.
6903 (Plugin::load): Add add_input_library to tv.
6904 (Plugin_manager::add_input_file): Add the is_lib argument.
6905 (add_input_file): Update call to Plugin_manager::add_input_file.
6906 (add_input_library): New.
6907 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6908
966d4097
DK
69092009-09-30 Doug Kwan <dougkwan@google.com>
6910
6911 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6912 symbol and call Symbol::may_need_copy_reloc to determine if
6913 a copy reloc is needed.
6914 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6915 nocopyreloc is given in command line.
6916 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6917 given in command line.
6918 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6919 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6920 of the removed Target_i386::may_need_copy_reloc.
6921 * options.h (copyreloc): New option with default value false.
6922 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6923 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6924 instead of the removed Target_powerpc::may_need_copy_reloc.
6925 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6926 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6927 instead of the removed Target_sparc::may_need_copy_reloc.
6928 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6929 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6930 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6931 instead of the removed Target_x86_64::may_need_copy_reloc.
6932
029ba973
ILT
69332009-09-30 Ian Lance Taylor <iant@google.com>
6934
6935 * object.h (class Object): Remove target_ field, and target,
6936 sized_target, and set_target methods.
6937 (Object::sized_target): Remove.
6938 (class Sized_relobj): Update declarations. Remove sized_target.
6939 * object.cc (Sized_relobj::setup): Remove target parameter.
6940 Change all callers.
6941 (Input_objects::add_object): Don't do anything with the target.
6942 (make_elf_sized_object): Add punconfigured parameter. Change all
6943 callers. Set or test parameter target.
6944 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6945 Change all callers.
6946 * parameters.cc (Parameters::set_target): Change parameter type to
6947 be non-const.
6948 (Parameters::default_target): Remove.
6949 (set_parameters_target): Change parameter type to be non-const.
6950 (parameters_force_valid_target): New function.
6951 (parameters_clear_target): New function.
6952 * parameters.h (class Parameters): Update declarations. Remove
6953 default_target method. Add sized_target and clear_target
6954 methods. Change target_ to be non-const.
6955 (set_parameters_target): Update declaration.
6956 (parameters_force_valid_target): Declare.
6957 (parameters_clear_target): Declare.
6958 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6959 as NULL if we aren't searching.
6960 (Add_symbols::run): Don't check for compatible target.
6961 * fileread.cc (Input_file::open_binary): Call
6962 parameters_force_valid_target.
6963 * gold.cc (queue_middle_tasks): Likewise.
6964 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6965 set_target on object.
6966 * dynobj.h (class Sized_dynobj): Update declarations.
6967 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6968 make_elf_object returns NULL.
6969 (Archive::include_member): Don't check whether object target is
6970 compatible.
6971 * output.cc (Output_section::add_input_section): Get target from
6972 parameters.
6973 (Output_section::relax_input_section): Likewise.
6974 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6975 parameters.
6976 (Sized_relobj::do_scan_relocs): Likewise.
6977 (Sized_relobj::relocate_sections): Likewise.
6978 * resolve.cc (Symbol_table::resolve): Likewise.
6979 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6980 parameter. Change all callers.
6981 (Symbol_table::add_from_object): Get target from parameters.
6982 (Symbol_table::add_from_relobj): Don't check object target.
6983 (Symbol_table::add_from_dynobj): Likewise.
6984 (Symbol_table::define_special_symbol): Get target from
6985 parameters.
6986 * symtab.h (class Symbol_table): Update declaration.
6987 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6988 parameter. Change all callers. Clear parameter target.
6989 (Binary_test): Test target here.
6990 * testsuite/object_unittest.cc (gold_testsuite): Remove
6991 target_test_pointer parameter. Change all callers.
6992 (Object_test): Test target here.
6993
a6a22b83
ILT
69942009-09-26 Ian Lance Taylor <iant@google.com>
6995
6996 * testsuite/initpri1.c: Don't try to use constructor priorities if
6997 compiling with gcc before 4.3.
6998
6a8f49fe
ILT
69992009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7000
7001 * testsuite/retain_symbols_file_test.sh (check_present): Change
7002 output file name to retain_symbols_file_test.stdout.
7003 (check_absent): Likewise.
7004
8c604651
CS
70052009-09-18 Craig Silverstein <csilvers@google.com>
7006
7007 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7008 * options.cc: Include <cerrno> and <fstream>.
7009 (General_options::finalize): Parse -retain-symbols-file tag.
7010 * options.h: New flag.
7011 (General_options): New method should_retain_symbol, new
7012 variable symbols_to_retain.
7013 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7014 should_retain_symbol map.
7015 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7016 * testsuite/Makefile.in: Regenerate.
7017 * testsuite/retain_symbols_file_test.sh: New file.
7018
ca58b19f
NC
70192009-09-18 Nick Clifton <nickc@redhat.com>
7020
7021 * po/es.po: Updated Spanish translation.
7022
20e6d0d6
DK
70232009-09-17 Doug Kwan <dougkwan@google.com>
7024
7025 * debug.h (DEBUG_RELAXATION): New constant.
7026 (DEBUG_ALL): Add DEBUG_RELAXATION.
7027 (debug_string_to_enum): Add relaxation debug option.
7028 * layout.cc
7029 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7030 Layout::Relaxation_debug_check::read_sections,
7031 Layout::Relaxation_debug_check::read_sections): New method definitions.
7032 (Layout::Layout): Initialize data members
7033 record_output_section_data_from_scrips_,
7034 script_output_section_data_list_ and relaxation_debug_check_.
7035 (Layout::save_segments, Layout::restore_segments,
7036 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7037 Layout::relaxation_loop_body): New method definitions.
7038 (Layout::finalize): Support relaxation. Move section layout code to
7039 Layout::relaxation_loop_body.
7040 (Layout::set_asection_address_from_script): Move code for orphan
7041 section placement out.
7042 (Layout::place_orphan_sections_in_script): New method definition.
7043 * layout.h (Output_segment_headers, Output_file_header):
7044 New forward class declarations.
7045 (Layout::~Layout): Define.
7046 (Layout::new_output_section_data_from_script): New method definition.
7047 (Layout::place_orphan_sections_in_script): New method declaration.
7048 (Layout::Segment_states): New type declaration.
7049 (Layout::save_segments, Layout::restore_segments,
7050 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7051 Layout::relaxation_loop_body): New method declarations.
7052 (Layout::Output_section_data_list): New type declaration.
7053 (Layout::Relaxation_debug_check): New class definition.
7054 (Layout::record_output_section_data_from_script_,
7055 Layout::script_output_section_data_list_, Layout::segment_states_,
7056 Layout::relaxation_debug_check_): New data members.
7057 * output.cc: (Output_section_headers::do_size): New method definition.
7058 (Output_section_headers::Output_section_headers): Move size
7059 computation to Output_section_headers::do_size.
7060 (Output_segment_headers::do_size): New method definition.
e1df38aa 7061 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
7062 Output_file_header::do_size and call it.
7063 (Output_file_header::do_size): New method definition.
7064 (Output_data_group::Output_data_group): Adjust call to
7065 Output_section_data.
7066 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7067 (Output_symtab_xindex::do_write): Add array bound check.
7068 (Output_section::Input_section::print_to_mapfile): Handle
7069 RELAXED_INPUT_SECTION_CODE.
7070 (Output_section::Output_section): Initialize data member checkpoint_.
7071 (Output_section::~Output_section): Delete checkpoint object pointed
7072 by checkpoint_.
7073 (Output_section::add_input_section): Always add an Input_section if
7074 relaxing.
7075 (Output_section::add_merge_input_section): Add assert.
7076 (Output_section::relax_input_section): New method definition.
7077 (Output_section::set_final_data_size): Set load address to zero for
7078 an unallocated section.
7079 (Output_section::do_address_and_file_offset_have_reset_values):
7080 New method definition.
7081 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7082 Handle relaxed input section.
7083 (Output_section::sort_attached_input_sections): Checkpoint input
7084 section list lazily.
7085 (Output_section::get_input_sections): Change type of input_sections to
7086 list of Simple_input_section pointers. Checkpoint input section list
7087 lazily. Also handle relaxed input sections.
7088 (Output_section::add_input_section_for_script): Take a reference to
7089 a Simple_input_section object instead of Relobj pointer and section
7090 index as parameter. Handle relaxed input sections.
7091 (Output_section::save_states, Output_section::restore_states): New
7092 method definitions.
7093 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7094 (Output_data::is_data_size_fixed): New method definition.
7095 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7096 if it is fixed.
7097 (Output_data::address_and_file_offset_have_reset_values): New method
7098 definition.
7099 (Output_data::do_address_and_file_offset_have_reset_values): New method
7100 definition.
7101 (Output_data::set_data_size): Check that data size is not fixed.
7102 (Output_data::fix_data_size): New method definition.
7103 (Output_data::is_data_size_fixed_): New data member.
7104 (Output_section_headers::set_final_data_size): New method definition.
7105 (Output_section_headers::do_size): New method declaration.
7106 (Output_segment_headers::set_final_data_size): New method definition.
7107 (Output_segment_headers::do_size): New method declaration.
7108 (Output_file_header::set_final_data_size)::New method definition.
7109 (Output_file_header::do_size)::New method declaration.
7110 (Output_section_data::Output_section_data): Add new parameter
7111 is_data_size_fixed and use it to fix data size.
7112 (Output_data_const::Output_data_const): Adjust call to base class
7113 constructor and fix data size.
7114 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7115 base class constructor and fix data size.
7116 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7117 base class constructor and fix data size.
7118 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7119 class constructor and fix data size.
7120 (Output_data_group::set_final_data_size): New method definition.
7121 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7122 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7123 class constructor and fix data size.
7124 (Output_relaxed_input_section): New class definition.
7125 (Output_section::Simple_input_section): New class definition.
7126 (Output_section::get_input_sections): Adjust parameter list.
7127 (Output_section::add_input_section_for_script): Same.
7128 (Output_section::save_states, Output_section::restore_states,
7129 Output_section::do_address_and_file_offset_have_reset_values,
7130 (Output_section::Input_section::Input_section): Handle
7131 RELAXED_INPUT_SECTION_CODE. Add new overload for
7132 Output_relaxed_input_section.
7133 (Output_section::Input_section::is_input_section,
7134 Output_section::Input_section::set_output_section): Handle relaxed
7135 input section.
7136 (Output_section::Input_section::is_relaxed_input_section,
7137 Output_section::Input_section::output_section_data,
7138 Output_section::Input_section::relaxed_input_section): New method
7139 definitions.
7140 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7141 value.
7142 (Output_section::Input_section::u1_): Update comments.
7143 (Output_section::Input_section::u2_): Add new union member poris.
7144 (Output_section::Checkpoint_output_section): New classs definition.
7145 (Output_section::relax_input_section): New method declaration.
7146 (Output_section::checkpoint_): New data member.
7147 (Output_segment): Update comments.
7148 (Output_segment::Output_segment): Un-privatize copy constructor.
7149 (Output_segment::operator=): Un-privatize.
7150 * script-sections.cc (Output_section_element::Input_section_list):
7151 Change element type to Output_section::Simple_input_section.
7152 (Output_section_element_dot_assignment::set_section_addresses):
7153 Register output section data for relaxation clean up.
7154 (Output_data_exression::Output_data_expression): Adjust call to base
7155 constructor to fix data size.
7156 (Output_section_element_data::set_section_addresses): Register
7157 Output_data_expression object for relaxation clean up.
7158 (struct Input_section_info): Replace Relobj pointer and section index
7159 pair with Output_section::Simple_input_section and Convert struct to a
7160 class.
7161 (Input_section_sorter::operator()): Adjust access to
e1df38aa 7162 Input_section_info data member to use accessors.
20e6d0d6
DK
7163 (Output_section_element_input::set_section_addresses): Use layout
7164 parameter. Adjust code to use Output_section::Simple_input_section
7165 and Input_secction_info classes. Register filler for relaxation
7166 clean up.
7167 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7168 and section index pair with Output_section::Simple_input_section
7169 class. Adjust code accordingly.
7170 (Phdrs_element::release_segment): New method definition.
7171 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7172 segment list.
7173 (Script_sections::release_segments): New method definition.
7174 * gold/script-sections.h (Script_sections::release_segments): New
7175 method declaration.
7176 * gold/target.h (Target::may_relax, Target::relax,
7177 Target::do_may_relax, Target::do_relax): New method definitions.
7178
5e445df6
ILT
71792009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7180
7181 * arm.cc (has_signed_unsigned_overflow): New function.
7182 (Arm_relocate_functions::abs8): New function.
7183 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7184 (Target_arm::Scan::global): Likewise.
7185 (Target_arm::relocate::relocate): Likewise.
7186 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7187 Likewise.
7188
8c604651 71892009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
7190
7191 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7192 * testsuite/Makefile.in: Regenerate.
7193
1e9cc1c2
NC
71942009-09-11 Nick Clifton <nickc@redhat.com>
7195
7196 * po/gold.pot: Updated by the Translation project.
7197
6a89f575
CC
71982009-09-08 Cary Coutant <ccoutant@google.com>
7199
7200 * output.cc (Output_file::open): Add execute permission to empty file.
7201 * testsuite/Makefile.am (permission_test): New test.
7202 * testsuite/Makefile.in: Regenerate.
7203
fdcac5af
ILT
72042009-09-02 Ian Lance Taylor <iant@google.com>
7205
7206 * output.cc (Output_file::resize): Call map_no_anonymous rather
7207 than map.
7208
44453f85
ILT
72092009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7210
7211 * gold.cc: Include "incremental.h".
7212 (queue_initial_tasks): Call Incremental_checker methods.
7213 * incremental.cc: Include "output.h".
7214 (Incremental_checker::can_incrementally_link_output_file): New
7215 method.
7216 * incremental.h (Incremental_checker): New class.
7217
7218 * output.cc (Output_file::open_for_modification): New method.
7219 (Output_file::map_anonymous): Changed return type to bool. Record
7220 map in base_ field.
7221 (Output_file::map_no_anonymous): New method, broken out of map.
7222 (Output_file::map): Use map_no_anonymous and map_anonymous.
7223 * output.h (class Output_file): Update declarations.
7224
293c1386
CC
72252009-08-24 Cary Coutant <ccoutant@google.com>
7226
7227 * options.h (Command_line::Pre_options): New class.
7228 (Command_line::pre_options): New member.
7229 * options.cc (gold::options::ready_to_register): New variable.
7230 (One_option::register_option): Do nothing if not registering options.
7231 Assert if same short option registered twice.
7232 (General_options::General_options): Turn off option registration when
7233 done constructing.
7234 (Command_line::Pre_options::Pre_options): New constructor.
7235
f773f3d2
CC
72362009-08-24 Cary Coutant <ccoutant@google.com>
7237
06a73cfe
CC
7238 * options.h (General_options::no_keep_memory): Remove incorrect
7239 short option.
f773f3d2 7240
a15af8e2
RW
72412009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7242
7243 * Makefile.am (am__skiplex, am__skipyacc): New.
7244 * Makefile.in: Regenerate.
7245
c462b41b
RW
72462009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7247
14ec8efd
RW
7248 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7249 (INCLUDES): ... this.
7250 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7251 (AM_CPPFLAGS): Renamed from ...
7252 (INCLUDE): ... this.
7253 * Makefile.in, testsuite/Makefile.in: Regenerate.
7254
81ecdfbb
RW
7255 * Makefile.in: Regenerate.
7256 * aclocal.m4: Likewise.
7257 * config.in: Likewise.
7258 * configure: Likewise.
7259 * testsuite/Makefile.in: Likewise.
7260
c462b41b
RW
7261 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7262 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7263 * Makefile.in: Regenerate.
7264 * testsuite/Makefile.in: Regenerate.
7265
2da73f13
CC
72662009-08-19 Cary Coutant <ccoutant@google.com>
7267
7268 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7269 symbols in shared libraries overridden by hidden or internal symbols
7270 in the main program.
7271
2db70501
CD
72722009-08-19 Chris Demetriou <cgd@google.com>
7273
7274 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7275 checking source file names in error messages.
7276
f733487b
DK
72772009-08-18 Doug Kwan <dougkwan@google.com>
7278
7279 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7280 an elcpp::Ehdr as parameter. Adjust call to set_target.
7281 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7282 an elfcpp::Ehdr as parameter.
7283 * object.cc (Object::set_target): Remove the version that looks up
7284 a target and sets it.
7285 (Sized_relobj::setup): Take a Target object instead of
7286 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7287 (make_elf_sized_object): Find target and ask target to
7288 make an ELF object.
7289 * object.h: (Object::set_target): Remove the version that looks up
7290 a target and sets it.
7291 (Sized_relobj::setup): Take a Target object instead of
7292 an elfcpp:Ehdr as parameter.
7293 * target.cc: Include dynobj.h.
7294 (Target::do_make_elf_object_implementation): New.
7295 (Target::do_make_elf_object): New.
7296 * target.h (Target::make_elf_object): New template declaration.
7297 (Target::do_make_elf_object): New method declarations.
7298 (Target::do_make_elf_object_implementation): New template declaration.
7299
cc70f101
ILT
73002009-08-14 Ian Lance Taylor <iant@google.com>
7301
7302 * gold.h (FUNCTION_NAME): Define.
7303 (gold_unreachable): Use FUNCTION_NAME.
7304
ef5e0cb1
ST
73052009-08-12 Sriraman Tallam <tmsriram@google.com>
7306
7307 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7308 symbol in the --keep-unique list is not found.
7309
48c187ce
ST
73102009-08-12 Sriraman Tallam <tmsriram@google.com>
7311
7312 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7313 been maked as --keep-unique.
7314 (Icf::unfold_section): New function.
7315 * icf.h (Icf::unfold_section): New function.
7316 * options.h (General_options::keep_unique): New option.
7317 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7318 * testsuite/Makefile.in: Regenerate.
7319 * testsuite/icf_keep_unique_test.sh: New file.
7320 * testsuite/icf_keep_unique_test.cc: New file.
7321
645afe0c
CC
73222009-08-12 Cary Coutant <ccoutant@google.com>
7323
7324 PR 10471
7325 * resolve.cc (Symbol_table::resolve): Check for references from
7326 dynamic objects to hidden and internal symbols.
7327 * testsuite/Makefile.am (hidden_test.sh): New test.
7328 * testsuite/Makefile.in: Regenerate.
7329 * testsuite/hidden_test.sh: New script.
7330 * testsuite/hidden_test_1.c: New test source.
7331 * testsuite/hidden_test_main.c: New test source.
7332
11af873f
DK
73332009-08-11 Doug Kwan <dougkwan@google.com>
7334
7335 * arm.cc: Update comments.
7336 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7337 segment to locate the .ARM.exidx section if present.
7338
b9f7d72d
DK
73392009-08-09 Doug Kwan <dougkwan@google.com>
7340
7341 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7342 patch.
7343
ddd3c53c
ST
73442009-08-07 Sriraman Tallam <tmsriram@google.com>
7345 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7346 compiler warnings.
7347
27721062
ST
73482009-08-06 Sriraman Tallam <tmsriram@google.com>
7349
7350 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7351 valid tls_segment only for non-debug-section relocations.
7352 * testsuite/Makefile.am: Add gc_tls_test.
7353 * testsuite/Makefile.in: Regenerate.
7354 * testsuite/gc_tls_test.cc: New file.
7355 * testsuite/gc_tls_test.sh: New file.
7356
ef15dade 73572009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 7358
ef15dade
ST
7359 * icf.cc: New file.
7360 * icf.h: New file.
7361 * Makefile.am (CCFILES): Add icf.cc.
7362 (HFILES): Add icf.h
7363 * Makefile.in: Regenerate.
7364 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7365 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7366 section, symbol and addend information for the relocs.
7367 * gold.cc (queue_middle_tasks): Call identical code folding.
7368 * gold.h: Add defines for multimap.
7369 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7370 to the call of finalize_local_symbols.
7371 * main.cc (main): Create object of class Icf.
7372 * object.cc (Sized_relobj::do_layout): Allow this function to be
7373 called twice during icf.
7374 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7375 to sections marked as identical by icf.
7376 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7377 when available.
7378 (Sized_relobj::do_section_entsize): New function.
7379 * object.h (Object::section_entsize): New function.
7380 (Object::do_section_entsize): New pure virtual function.
7381 (Relobj::finalize_local_symbols): Add new parameter.
7382 (Relobj::do_section_entsize): New function.
7383 * options.h (General_options::icf): New option.
7384 (General_options::icf_iterations): New option.
7385 (General_options::print_icf_sections): New option.
7386 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7387 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7388 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7389 icf.
7390 * symtab.cc (Symbol_table::is_section_folded): New function.
7391 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7392 to sections marked as identical by icf.
7393 * symtab.h (Symbol_table::set_icf): New function.
7394 (Symbol_table::icf): New function.
7395 (Symbol_table::is_section_folded): New function.
7396 (Symbol_table::icf_): New data member.
7397 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7398 * testsuite/Makefile.am: Add commands to build icf_test.
7399 * testsuite/Makefile.in: Regenerate.
7400 * testsuite/icf_test.sh: New file.
7401 * testsuite/icf_test.cc: New file.
7402
c3b65ac4
CD
74032009-07-24 Chris Demetriou <cgd@google.com>
7404
7405 * layout.cc (is_compressible_debug_section): Fix incorrect
7406 comment about compressed section names.
7407
1caf2c51
ILT
74082009-07-20 Ian Lance Taylor <ian@airs.com>
7409
7410 PR 10419
7411 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7412
1ef4d87f
ILT
74132009-07-16 Ian Lance Taylor <iant@google.com>
7414
7415 PR 10400
7416 * layout.h: #include <map>.
7417 (class Kept_section): Change from struct to class. Add accessors
7418 and setters. Add section size to Comdat_group mapping. Change
7419 Comdat_group to std::map. Add is_comdat_ field. Add
7420 linkonce_size field in union.
7421 (class Layout): Update declaration of find_or_add_kept_section.
7422 Don't declare find_kept_object.
7423 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7424 parameter. Add object, shndx, is_comdat, and is_group_name
7425 parameters. Change all callers. Adjust for new Kept_section.
7426 (Layout::find_kept_object): Remove.
7427 * object.cc (Sized_relobj::include_section_group): Update use of
7428 Kept_section. Rename secnum to shndx. Only record
7429 Kept_comdat_section if sections are the same size.
7430 (Sized_relobj::include_linkonce_section): Update use of
7431 Kept_section. Only record Kept_comdat_section if sections are the
7432 same size. Set size of linkonce section.
7433 (Sized_relobj::map_to_kept_section): Update call to
7434 get_kept_comdat_section.
7435 * object.h (class Sized_relobj): Rename fields in
7436 Kept_comdat_section to drop trailing underscores; change object
7437 field to Relobj*. Change Kept_comdat_section_table to store
7438 struct rather than pointer.
7439 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7440 Add kept_object and kept_shndx parameters. Change all callers.
7441 (Sized_relobj::get_kept_comdat_section): Change return type to
7442 bool. Add kept_object and kept_shndx parameters. Change all
7443 callers.
7444 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7445 Layout::find_or_add_kept_section.
7446
37c3b7b0
ILT
74472009-07-09 Ian Lance Taylor <iant@google.com>
7448
7449 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7450 Reserve space in the hash table.
7451
98fa85cb
ILT
74522009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7453
7454 * fileread.cc (File_read::get_mtime): New method.
7455 * fileread.h (Timespec): New structure.
7456 (File_read::get_mtime): New method.
7457 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7458 Renamed from timestamp_nsec.
7459 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7460 Elf_Xword.
e1df38aa 7461 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 7462 timestamp_nsec.
e1df38aa 7463 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
7464 (Incremental_inputs::report_obejct): Save mtime; style fix.
7465 (Incremental_inputs::report_script): Save mtime; style fix.
7466 (Incremental_inputs::finalize_inputs): Style fix.
7467 (Incremental_inputs::finalize): Style fix.
7468 (Incremental_inputs::create_input_section_data): Store inputs
7469 mtime.
7470 * incremental.h (Incremental_inputs::report_script): Add mtime
7471 argument.
7472 (Incremental_inputs::Input_info::Input_info): Intialize only one
7473 union member.
7474 (Incremental_inputs::Input_info::archive): Move to nameless
7475 union.
7476 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7477 (Incremental_inputs::Input_info::script): Move to nameless union.
7478 (Incremental_inputs::mtime): New field.
7479 * script.cc (read_input_script): Pass file mtime to
7480 Incremental_input.
7481 * script.h (Script_info::inputs): Style fix.
7482
c9d70757
ILT
74832009-07-01 Ian Lance Taylor <ian@airs.com>
7484
7485 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7486 instead of 32.
7487
9c547ec3
ILT
74882009-06-24 Ian Lance Taylor <iant@google.com>
7489
7490 PR 10156
7491 * layout.cc (Layout::choose_output_section): If we find an
7492 existing section, update the flags.
7493 (Layout::create_notes): New function, broken out of
7494 Layout::finalize.
7495 (Layout::finalize): Don't create note sections.
7496 (Layout::create_note): Don't crash if linker script discards
7497 section.
7498 (Layout::create_gold_note): Likewise.
7499 (Layout::create_build_id): Likewise. Don't set
7500 after_input_sections on the section.
7501 (Layout::create_executable_stack_info): Remove target parameter.
7502 Change caller.
7503 * layout.h (class Layout): Declare create_notes. Update
7504 declaration of create_executable_stack_info.
7505 * gold.cc (queue_middle_tasks): Call create_notes.
7506 * output.cc (Output_section::update_flags_for_input_section): Move
7507 here from output.h. If SHF_ALLOC flag is newly set, mark address
7508 invalid.
7509 * output.h (Output_data::mark_address_invalid): New function.
7510 (class Output_section): Only declare, not define,
7511 update_flags_for_input_section. Remove set_flags.
7512
55458500
ILT
75132009-06-24 Ian Lance Taylor <iant@google.com>
7514
7515 * script-sections.cc (Output_section_definition::
7516 set_section_addresses): Rename shadowing local load_address to
7517 laddr.
7518
1307d6cd
ILT
75192009-06-24 Ian Lance Taylor <iant@google.com>
7520
7521 PR 10244
7522 * reloc.cc (relocate_sections): Skip empty relocation sections.
7523
ec3f783e
ILT
75242009-06-23 Ian Lance Taylor <iant@google.com>
7525
7526 PR 10156
7527 * layout.cc (Layout::create_note): Use choose_output_section
7528 rather than make_output_section.
7529
459c9f1c
ILT
75302009-06-23 Ian Lance Taylor <iant@google.com>
7531
7532 PR 10237
7533 * options.cc (General_options::parse_V): Set printed_version_.
7534 (General_options::General_options): Initialize printed_version_.
7535 * options.h (class General_options): Add printed_version_ field.
7536 * gold.cc (queue_initial_tasks): If there are no input files,
7537 don't give a fatal error if we printed the version information.
7538 (queue_middle_tasks): If using -r with a shared object, give a
7539 fatal error rather than an ordinary error.
7540
1518dc8f
ILT
75412009-06-23 Ian Lance Taylor <iant@google.com>
7542
7543 PR 10219
7544 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7545 (Layout::make_output_section): Set have_stabstr_section_ if we see
7546 a .stab*str section.
7547 (Layout::finalize): Call link_stabs_sections.
7548 (Layout::link_stabs_sections): New file.
7549 * layout.h (class Layout): Add have_stabstr_section_ field.
7550 Declare link_stabs_sections.
7551
3d857b98
DK
75522009-06-23 Doug Kwan <dougkwan@google.com>
7553
7554 * Makefile.am (libgold_a_LIBADD): New.
7555 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7556 * Makefile.in: Regenerate.
7557 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7558 * configure: Regenerate.
7559 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7560 * fileread.cc: Include sys/state.h
7561 * gold.h: Declare memmem and strndup if found missing.
7562 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7563
0639a6f6
ILT
75642009-06-23 Ian Lance Taylor <iant@google.com>
7565
7566 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7567 * configure: Rebuild.
7568
8d63875c
ILT
75692009-06-23 Ian Lance Taylor <iant@google.com>
7570
7571 PR 10147
7572 * object.cc (Object::section_contents): Don't try to get a view if
7573 the section has length zero.
7574 (Object::handle_gnu_warning_section): If the section is empty, use
7575 the name of the section as the warning.
7576
f7c8a183
ILT
75772009-06-23 Ian Lance Taylor <iant@google.com>
7578
7579 PR 10133
7580 * stringpool.h (class Stringpool_template): Add optimize_ field.
7581 (Stringpool_template::set_optimize): New function.
7582 * stringpool.cc (Stringpool_template::Stringpool_template):
7583 Initialize optimize_ field.
7584 (Stringpool_template::set_string_offsets): Test local optimize
7585 fild rather than parameter.
7586 * layout.cc (Layout::Layout): Call set_optimize on the section
7587 name stringpool.
7588
e6a307ba
ILT
75892009-06-22 Ian Lance Taylor <iant@google.com>
7590
7591 PR 10030
7592 * yyscript.y: Parse TARGET.
7593 * script.cc (script_set_target): New function.
7594 * script-c.h (script_set_target): Declare.
7595 * options.cc (General_options::string_to_object_format): Rename
7596 from string_to_object_format in anonymous namespace. Change
7597 callers.
7598 * options.h (class General_options): Declare
7599 string_to_object_format.
7600
3ee173de
ILT
76012009-06-22 Ian Lance Taylor <iant@google.com>
7602
7603 * script-sections.cc (Script_sections::create_segments): Don't put
7604 program headers in a PT_LOAD segment if -n or -N.
7605
76062009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
7607
7608 PR 10141
7609 * options.h (class General_options): Add -z lazy and -z now. Sort
7610 -z options into alphabetical order.
7611 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7612
cd6739a1 76132009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
7614
7615 * layout.cc (Layout::make_output_section): Call
7616 Target::new_output_section.
7617 (Layout::attach_allocated_section_to_segment): Put large section
7618 sections in a separate load segment with the large segment flag
7619 set.
7620 (Layout::segment_precedes): Sort large data segments after other
7621 load segments.
7622 (align_file_offset): New static function.
7623 (Layout::set_segment_offsets): Use align_file_offset.
7624 * output.h (class Output_section): Add is_small_section_ and
7625 is_large_section_ fields.
7626 (Output_section::is_small_section): New function.
7627 (Output_section::set_is_small_section): New function.
7628 (Output_section::is_large_section): New function.
7629 (Output_section::set_is_large_section): New function.
7630 (Output_section::is_large_data_section): New function.
7631 (class Output_segment): Add is_large_data_segment_ field.
7632 (Output_segment::is_large_data_segment): New function.
7633 (Output_segment::set_is_large_data_segment): New function.
7634 * output.cc (Output_section::Output_section): Initialize new
7635 fields.
7636 (Output_segment::Output_segment): Likewise.
7637 (Output_segment::add_output_section): Add assertion that large
7638 data sections always go in large data segments. Force small data
7639 sections to the end of the list of data sections. Force small BSS
7640 sections to the start of the list of BSS sections. For large BSS
7641 sections to the end of the list of BSS sections.
7642 * symtab.h (class Symbol): Declare is_common_shndx.
7643 (Symbol::is_defined): Check Symbol::is_common_shndx.
7644 (Symbol::is_common): Likewise.
7645 (class Symbol_table): Define enum Commons_section_type. Update
7646 declarations. Add small_commons_ and large_commons_ fields.
7647 * symtab.cc (Symbol::is_common_shndx): New function.
7648 (Symbol_table::Symbol_table): Initialize new fields.
7649 (Symbol_table::add_from_object): Put small and large common
7650 symbols in the right list.
7651 (Symbol_table::sized_finalized_symbol): Check
7652 Symbol::is_common_shndx.
7653 (Symbol_table::sized_write_globals): Likewise.
7654 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7655 common symbol lists. Don't call do_allocate_commons_list if the
7656 list is empty.
7657 (Symbol_table::do_allocate_commons_list): Remove is_tls
7658 parameter. Add comons_section_type parameter. Change all
7659 callers. Handle small and large common symbols.
7660 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7661 Symbol::is_common_shndx.
7662 * resolve.cc (symbol_to_bits): Likewise.
7663 * target.h (Target::small_common_shndx): New function.
7664 (Target::small_common_section_flags): New function.
7665 (Target::large_common_shndx): New function.
7666 (Target::large_common_section_flags): New function.
7667 (Target::new_output_section): New function.
7668 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7669 small_common_section_flags, and large_common_section_flags
7670 fields.
7671 (Target::do_new_output_section): New virtual function.
7672 * arm.cc (Target_arm::arm_info): Initialize new fields.
7673 * i386.cc (Target_i386::i386_info): Likewise.
7674 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7675 Likewise.
7676 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7677 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7678 (Target_x86_64::do_new_output_section): New function.
7679 * configure.ac: Define conditional MCMODEL_MEDIUM.
7680 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7681 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7682 (large_LDFLAGS): Define.
7683 * testsuite/large.c: New file.
7684 * testsuite/testfile.cc (Target_test::test_target_info):
7685 Initialize new fields.
7686 * configure, testsuite/Makefile.in: Rebuild.
7687
bb04269c
DK
76882009-06-05 Doug Kwan <dougkwan@google.com>
7689
7690 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 7691 * Makefile.in: Regenerate.
bb04269c
DK
7692 * i386.cc (class Target_i386): Define new virtual method to
7693 override do_is_local_label_name in parent.
7694 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7695 local symbols if --discard-locals or -X is given.
7696 * options.h (class General_options): Declare new options
7697 '--discard-locals' and '-X' for discarding locals.
7698 * target.h (class Target): Define new methods is_local_label_name.
7699 Declare new virtual method do_is_local_label_name.
7700 * target.cc: New file.
7701 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7702 (check_SCRIPTS): Add discard_locals_test.sh.
7703 (check_DATA): Add discard_local_tests.syms.
7704 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7705 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7706 * testsuite/Makefile.in: Regenerate.
7707 * testsuite/discard_locals_test.c: New file.
7708 * testsuite/discard_locals_test.sh: Same.
7709
805bb01c
DK
77102009-06-05 Doug Kwan <dougkwan@google.com>
7711
7712 * object.cc (Sized_relobj::Sized_relobj): Initialize
7713 discarded_eh_frame_shndx_ to -1U.
7714 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7715 section.
7716 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7717 a discarded .eh_frame section.
7718 (Sized_relobj::do_finalize_local_symbols): Ditto.
7719 * object.h (class Sized_relobj): Declare new member
7720 discarded_eh_frame_shndx_.
7721 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7722 (local_labels_test.o, local_labels_test): New rules.
7723 * testsuite/Makefile.in: Regenerate.
7724
1dcd334d
DK
77252009-06-04 Doug Kwan <dougkwan@google.com>
7726
7727 * layout.cc (Layout::section_name_mapping): Add mapping for
7728 special ARM sections.
7729
96d49306
DK
77302009-06-03 Doug Kwan <dougkwan@google.com>
7731
7732 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7733 (utils::has_overflow): Same.
7734
dff16297
ILT
77352009-06-03 Ian Lance Taylor <iant@google.com>
7736
7737 * layout.cc (Layout::section_name_mapping): New array, replacing
7738 Layout::linkonce_mapping.
7739 (Layout::section_name_mapping_count): New variable, replacing
7740 Layout::linkonce_mapping_count.
7741 (Layout::linkonce_output_name): Remove.
7742 (Layout::output_section_name): Rewrite.
7743 * layout.h (class Layout): Rename Linkonce_mapping to
7744 Section_name_mapping, linkonce_mapping to section_name_mapping,
7745 linkonce_mapping_count to section_name_mapping_count. Don't
7746 declare linkonce_output_name.
7747
c121c671
DK
77482009-06-03 Doug Kwan <dougkwan@google.com>
7749
7750 * gold/arm.cc (namespace utils): New.
7751 (Target_arm::reloc_is_non_pic): Define new method.
7752 (class Arm_relocate_functions): New.
7753 (Target_arm::Relocate::relocate): Handle relocation types used by
7754 Android.
7755
07800fab
ILT
77562009-06-03 Ian Lance Taylor <iant@google.com>
7757
7758 * arm.cc (Target_arm::scan::global): Use || instead of |.
7759
c121c671
DK
77602009-06-02 Doug Kwan <dougkwan@google.com>
7761
7762 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7763 issued_non_pic_error_.
7764 (class Target_arm::Scan): Declare new method check_non_pic.
7765 Define new method symbol_needs_plt_entry.
7766 Declare new data member issued_non_pic_error_.
7767 (class Target_arm::Relocate): Declare new method
7768 should_apply_static_reloc.
7769 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7770 (Target_arm::Scan::check_non_pic): Define new method.
7771 (Target_arm::Scan::local): Handle a small subset of reloc types used
7772 by Android.
7773 (Target_arm::Scan::local): Same.
7774 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7775
b19b0c6d
ILT
77762009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7777
7778 * incremental.cc (Incremental_inputs::report_command_line): Filter
7779 out --incremental-* options.
7780
94cdfcff
DK
77812009-05-29 Doug Kwan <dougkwan@google.com>
7782
7783 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7784 template class.
7785 (class Target_arm): Update comment.
7786 (Target_arm::Target_arm): Initialize new data members GOT_,
7787 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7788 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7789 and Target_arm::rel_dyn_section.
7790 Declare new_enum Target_arm::Got_type.
7791 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7792 and DYNBSS_.
7793 Update commments for member do_dynsym_value.
7794 (Target_arm::got_size, Target_arm::plt_section,
7795 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7796 new methods inside class defintion.
7797 (Target_arm::got_section): Define new method.
7798 (Target_arm::rel_dyn_section): Same.
7799 (Output_data_plt_arm): New template class.
7800 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7801 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7802 (Output_data_plt_arm::add_entry): Same.
7803 (Output_data_plt_arm::first_plt_entry): Define new
7804 static data member for PLT instruction template.
7805 (Output_data_plt_arm::plt_entry): Same.
7806 (Output_data_plt_arm::do_write): Define new method.
7807 (Target_arm::make_plt_entry): Same.
7808 (Target_arm::do_finalize_sections): Same.
7809 (Target_arm::do_dynsym_value): Same.
7810
4a657b0d
DK
78112009-05-28 Doug Kwan <dougkwan@google.com>
7812
7813 * Makefile.am (TARGETSOURCES): Add arm.cc.
7814 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7815 * Makefile.in: Regenerate.
7816 * arm.cc: New file.
7817 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7818
e7ae8c36
DK
78192009-05-26 Doug Kwan <dougkwan@google.com>
7820
7821 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7822 (General_options::check_excluded_libs): Strip off directories in
7823 archive name before matching like GNU ld does.
7824 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7825 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7826 (exclude_libs_test_LDFLAGS): Add linker option
7827 -Wl,--exclude-libs,libexclude_libs_test_3
7828 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7829 an explicit archive without using -l.
7830 (alt/libexclude_libs_test_3.a): New make rule.
7831 * testsuite/Makefile.in: Regenerate.
7832 * testsuite/exclude_libs_test.c : Declare lib3_default().
7833 (main): Call it.
7834 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7835 * exclude_libs_test_3.c: New file.
7836
f12e7348
NC
78372009-05-26 Nick Clifton <nickc@redhat.com>
7838
7839 * po/id.po: New Indonesian translation.
7840 * po/gold.pot: Updated template file.
7841
4daadc0d
ST
78422009-05-22 Sriraman Tallam <tmsriram@google.com>
7843
e1df38aa 7844 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
7845 gc_comdat_test files. Add -Wl,--gc-sections to build
7846 gc_comdat_test.
7847 * testsuite/Makefile.in: Regenerate.
7848 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7849
531813ad
ST
78502009-05-21 Sriraman Tallam <tmsriram@google.com>
7851
7852 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7853 kept comdat section was garbage collected.
7854 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7855 * testsuite/Makefile.in: Regenerate.
7856 * testsuite/gc_comdat_test.sh: New file.
7857 * testsuite/gc_comdat_test_1.cc: New file.
7858 * testsuite/gc_comdat_test_2.cc: New file.
7859
65514900
CC
78602009-05-19 Doug Kwan <dougkwan@google.com>
7861
7862 * archive.cc (Archive::Archive): Move constructor from archive.h
7863 to here. Initialize no_export_.
7864 (Archive::get_elf_object_for_member): Set no_export flag of object.
7865 * archive.h (Archive::Archive): Move constructor body to
7866 archive.cc.
7867 (Archive::no_export): New method.
7868 (Archive::no_export_): New field.
7869 * object.h (Object::Object): Initialize no_export_ to false.
7870 (Object::no_export, Object::set_no_export): New methods.
7871 (Object::no_export_): New field.
7872 * options.cc (General_options::parse_exclude_libs): New method.
7873 (General_options::check_excluded_libs) Same.
7874 * options.h (exclude_libs): New option.
7875 (General_options::check_excluded_libs): New method declaration.
7876 (General_options::excluded_libs_): New field.
7877 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7878 default or protected visibility if an object has no-export flag set.
7879 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7880 (check_SCRIPTS): Add exclude_libs_test.sh.
7881 (check_DATA): Add exclude_libs_test.syms.
7882 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7883 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7884 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7885 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7886 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7887 libexclude_libs_test_2.a): New rules.
7888 * testsuite/Makefile.in: Regenerate.
7889 * testsuite/exclude_libs_test.c: New file.
7890 * testsuite/exclude_libs_test.sh: Ditto.
7891 * testsuite/exclude_libs_test_1.c: Ditto.
7892 * testsuite/exclude_libs_test_2.c: Ditto.
7893
1b77ea50
ILT
78942009-05-15 Ian Lance Taylor <iant@google.com>
7895
7896 * configure.ac: Check for declarations for cases where libiberty.h
7897 checks HAVE_DECL_xxx.
7898 * configure, config.in: Rebuild.
7899
072fe7ce
ILT
79002009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7901
7902 * gold.h (Incremental_argument_list): Remove (invalid) forward
7903 declaration.
7904 * incremental.cc (Incremental_inputs::report_achive): New method.
7905 (Incremental_inputs::report_object): New method.
7906 (Incremental_inputs::report_script): New method.
7907 (Incremental_inputs::finalize_inputs): New method.
7908 (Incremental_inputs::finalize): Call finalize_inputs().
7909 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7910 Create inputs entries.
7911 * incremental.h (Incremental_input_type): New enum.
7912 (Incremental_inputs::Incremental_input): Initialize new fields.
7913 (Incremental_inputs::report_inputs): New method.
7914 (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::Input_info): New struct.
7919 (Incremental_inputs::Input_info_map): New typedef.
7920 (Incremental_inputs::lock_): New field.
7921 (Incremental_inputs::Inputs_): New field.
7922 (Incremental_inputs::Inputs_map): New field.
7923 * main.cc (main): Call Incremental_input::report_inputs.
7924 * options.h (Input_argument_list): Typedef moved from
7925 Input_arguments.
7926 (Input_file_group::Files): Remove, use ::Input_argument_list.
7927 (Input_file_group::Input_argument_list): Remove, use
7928 ::Input_argument_list.
7929 * plugin.cc (Plugin_manager::add_input_file): Add error in
7930 incremental build.
7931 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7932 functions.
7933 * script.cc (read_input_script): Call
7934 Incremental_input::report_script.
7935 * script.h (Script_info): New class.
7936
b0481b0b
ILT
79372009-04-27 Ian Lance Taylor <iant@google.com>
7938
7939 * x86_64.cc (do_adjust_output_section): Set entsize to
7940 plt_entry_size.
7941
b22a5a41 79422009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
7943
7944 * output.cc (Output_file::close): After short writes, continue
7945 writing from the correct offset in the buffer being written.
7946
40fde488
CD
79472009-04-23 Chris Demetriou <cgd@google.com>
7948
7949 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7950 * configure: Regenerate.
7951 * config.in: Regenerate.
7952 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7953 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7954
3ce2c28e
ILT
79552009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7956
7957 * incremental.cc (Incremental_inputs_header_data): Renamed from
7958 Incremental_input_header_data.
7959 (Incremental_inputs_header_data::data_size): New field.
7960 (Incremental_inputs_header_data::put_input_file_count): Renamed
7961 from input_file_count.
7962 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7963 from command_line_offset.
7964 (Incremental_inputs_header_data::put_reserved): Renamed from
7965 put_reserved.
7966 (Incremental_inputs_entry_data): Renamed from
7967 Incremental_input_entry_data.
7968 (Incremental_inputs_entry_data::data_size): New field.
7969 (Incremental_inputs::report_command_line): New method.
7970 (Incremental_inputs::finalize): New method.
7971 (Incremental_inputs::create_incremental_inputs_data): New method.
7972 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7973 * incremental.h: New file.
7974 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7975 (Layout::finalize): Create incremental inputs section in
7976 incremental builds.
7977 (Layout::create_incremental_info_sections): New method.
7978 * layout.h (Layout::incremental_inputs): New method.
7979 (Layout::create_incremental_info_sections): New method.
7980 (Layout::incremental_inputs_): New field.
7981 * main.cc (main): Notify Incremental_input of the command line.
7982
e55bde5e
ILT
79832009-04-01 Ian Lance Taylor <iant@google.com>
7984 Mikolaj Zalewski <mikolajz@google.com>
7985
7986 * gold.h (reserve_unordered_map): Define, three versions, one for
7987 each version of Unordered_map.
7988 * layout.cc (Layout::Layout): Remove options parameter. Add
7989 number_of_input_files parameter. Don't initialize options_.
7990 Initialize number_of_input_files_ and resized_signatures_. Move
7991 sections_are_attached_.
7992 (Layout::layout_group): Reserve space for group_signatures_.
7993 (Layout::find_or_add_kept_section): Change name parameter to be a
7994 reference. Resize signatures_ map when it gets large enough.
7995 (Layout::layout_eh_frame): Use parameters->options() instead of
7996 this->options_.
7997 (Layout::make_output_section): Likewise.
7998 (Layout::attach_allocated_section_to_segment): Likewise.
7999 (Layout::finalize, Layout::create_executable_stack): Likewise.
8000 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8001 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8002 * layout.h (class Layout): Update declarations. Remove options_
8003 field. Add number_of_input_files_ and resized_signatures_
8004 fields. Move sections_are_attached_ field.
8005 * main.cc (main): Pass number of input files to Layout
8006 constructor. Don't pass options.
8007
154b857c
ILT
80082009-03-30 Ian Lance Taylor <iant@google.com>
8009
8010 * ffsll.c (ffsll): Correct implementation.
8011
2f35ab9b
ILT
80122009-03-27 Ian Lance Taylor <iant@google.com>
8013
fd03461a
ILT
8014 * ffsll.c: New file.
8015 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8016 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8017 * ftruncate.c (ftruncate): Declare before definition.
8018 * mremap.c (mremap): Likewise.
8019 * pread.c (pread): Likewise.
8020 * configure, Makefile.in, config.in: Rebuild.
8021
2f35ab9b
ILT
8022 * mremap.c: New file.
8023 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8024 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8025 (mremap): Declare if HAVE_MREMAP is not defined.
8026 * configure, Makefile.in, config.in: Rebuild.
8027
33aea2fd
CC
80282009-03-27 Cary Coutant <ccoutant@google.com>
8029
8030 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8031 position independent.
8032 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8033 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8034
6d479619
CC
80352009-03-24 Cary Coutant <ccoutant@google.com>
8036
8037 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8038 an executable.
8039 (needs_dynamic_reloc): Likewise.
8040
afc06bb8
ILT
80412009-03-24 Ian Lance Taylor <iant@google.com>
8042
8043 * yyscript.y (file_cmd): Recognize EXTERN.
8044 (extern_name_list, extern_name_list_body): New nonterminals.
8045 * script.cc (script_add_extern): Define.
8046 * script-c.h (script_add_extern): Declare.
8047
f6060a4d
ILT
80482009-03-24 Rafael Avila de Espindola <espindola@google.com>
8049
8050 * object.cc (is_elf_object): Define.
8051 * object.h (is_elf_object): Declare.
8052 * archive.cc (Archive::get_elf_object_for_member): Call
8053 is_elf_object.
33aea2fd 8054 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 8055
26736d8e
ILT
80562009-03-24 Elliott Hughes <enh@google.com>
8057
8058 * output.cc (Output_file::map_anonymous): Define.
8059 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8060 try an anonymous one. Report the size if the mmap fails.
8061 * output.h (class Output_file): Declare map_anonymous.
8062
22fd9730
ILT
80632009-03-24 Ian Lance Taylor <iant@google.com>
8064
8065 * target-select.cc (instantiate_target): Don't acquire the lock if
8066 the instantiated_target_ field has already been set.
8067
cb010894
ILT
80682009-03-23 Ian Lance Taylor <iant@google.com>
8069
7f055c20
ILT
8070 * gold-threads.h (class Initialize_lock): Define.
8071 * gold-threads.cc (class Initialize_lock_once): Define.
8072 (initialize_lock_control): New static variable.
8073 (initialize_lock_pointer): New static variable.
8074 (initialize_lock_once): New static function.
8075 (Initialize_lock::Initialize_lock): Define.
8076 (Initialize_lock::initialize): Define.
8077 * target-select.h: Include "gold-threads.h".
8078 (class Target_selector): Add lock_ and initialize_lock_ fields.
8079 Don't define instantiate_target, just declare it.
8080 * target-select.cc (Target_selector::Target_selector): Initialize
8081 new fields.
8082 (Target_selector::instantiate_target): Define.
8083 * descriptors.h: Include "gold-threads.h".
8084 (class Descriptors): Add initialize_lock_ field.
8085 * descriptors.cc (Descriptors::Descriptors): Initialize new
8086 field.
8087 (Descriptors::open): Use initialize_lock_ field
8088 * errors.h (class Errors): Add initialize_lock_ field.
8089 * errors.cc (Errors::Errors): Initialize new field.
8090 (Errors::initialize_lock): Use initialize_lock_ field.
8091 * powerpc.cc (class Target_selector_powerpc): Remove
8092 instantiated_target_ field. In do_recognize call
8093 instantiate_target rather than do_instantiate_target. In
8094 do_instantiate_target just allocate a new target.
8095 * sparc.cc (class Target_selector_sparc): Likewise.
8096
36959681
ILT
8097 * freebsd.h: New file.
8098 * i386.cc: Include "freebsd.h".
8099 (Target_i386): Derive from Target_freebsd rather than
8100 Sized_target.
8101 (Target_selector_i386): Derive from Target_selector_freebsd rather
8102 than Target_selector.
8103 * x86_64.cc: Include "freebsd.h".
8104 (Target_x86_64): Derive from Target_freebsd rather than
8105 Sized_target.
8106 (Target_selector_x86_64): Derive from Target_selector_freebsd
8107 rather than Target_selector.
8108 * target.h (class Target): Add adjust_elf_header and
8109 do_adjust_elf_header.
8110 * output.cc (Output_file_header:: do_sized_write): Call target
8111 adjust_elf_header routine.
8112 * configure.tgt: Set targ_osabi.
8113 * configure.ac: Define GOLD_DEFAULT_OSABI.
8114 * parameters.cc (Parameters::default_target): Pass
8115 GOLD_DEFAULT_OSABI to select_target.
8116 * target-select.h (class Target_selector): Make instantiate_target
8117 protected rather than private.
8118 * Makefile.am (HFILES): Add freebsd.h.
8119 * configure, Makefile.in, config.in: Rebuild.
8120
cb010894
ILT
8121 * merge.cc (do_add_input_section): Correct pend value. Change
8122 message about last entry not being null terminated from error to
8123 warning.
8124
0e879927
ILT
81252009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8126
8127 * incremental.cc: New file.
8128 * Makefile.am (CCFILES): Add incremental.cc.
8129 * Makefile.in: Rebuild.
8130
41105937
PP
81312009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8132
8133 * layout.cc (Layout::output_section_name): Preserve names
8134 of '.note.' sections.
e1df38aa 8135
60439920
ILT
81362009-03-19 Ian Lance Taylor <iant@google.com>
8137
8138 * descriptors.cc (Descriptors::open): Check that the options are
8139 valid before using them.
8140
0d371ad3
ILT
81412009-03-18 Ian Lance Taylor <iant@google.com>
8142
8143 * script-sections.h: Include <list>.
8144 (class Script_sections): Change Sections_elements from std::vector
8145 to std::list. Typedef public Elements_iterator. Add
8146 orphan_section_placement_, data_segment_align_start_, and
8147 saw_data_segment_align_ fields. Remove data_segment_align_index_
8148 field.
8149 * script-sections.cc (class Orphan_section_placement): New class.
8150 (class Sections_element): Add virtual functions is_relro and
8151 orphan_section_init. Remove virtual function place_orphan_here.
8152 (class Output_section_definition): Add is_relro and
8153 orphan_section_init. Remove place_orphan_here.
8154 (class Orphan_output_section): Likewise.
8155 (Script_sections::Script_sections): Update for field changes.
8156 (Script_sections::data_segment_align): Set saw_data_segment_align_
8157 and data_segment_align_start_, not data_segment_align_index.
8158 (Script_sections::data_segment_relro_end): Check
8159 saw_data_segment_align_. Use data_segment_align_start_ rather
8160 than data_segment_align_index_.
8161 (Script_sections::place_orphan): Rewrite to use
8162 Orphan_section_placement.
8163
9201d894
ILT
81642009-03-17 Ian Lance Taylor <iant@google.com>
8165
9c5b8369
ILT
8166 * archive.cc (Archive::add_symbols): Check for a version attached
8167 to the symbol name in the archive map.
8168 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8169 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8170 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8171 (ver_test_11.a): New target.
8172 * testsuite/Makefile.in: Rebuild.
8173
9201d894
ILT
8174 * configure.ac: Check for chsize and posix_fallocate. Replace
8175 ftruncate.
8176 * ftruncate.c: New file, from gnulib.
8177 * output.cc (posix_fallocate): Define dummy version if not
8178 HAVE_POSIX_FALLOCATE.
8179 (Output_file::map): Call posix_fallocate rather than lseek and
8180 write.
8181 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8182 * configure, Makefile.in, config.in: Rebuild.
8183
ef4ab7a8 81842009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 8185
ef4ab7a8
PP
8186 * layout.h (Layout::create_note): Add section_name parameter.
8187 * layout.cc (Layout::create_note): Likewise.
8188 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 8189
8c500701
ILT
81902009-03-17 Ian Lance Taylor <iant@google.com>
8191
e85b18e1
ILT
8192 * descriptors.cc: Include "options.h".
8193 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8194 (Descriptors::open): Always use O_CLOEXEC when opening a new
8195 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8196 then set FD_CLOEXEC.
8197
9efe6174
ILT
8198 * sparc.cc (class Target_sparc): Add has_got_section.
8199 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8200 make sure we have a GOT section.
8201
8202 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8203 (Target_sparc::Scan::local): Likewise.
8204 (Target_sparc::Scan::global): Likewise.
8205 (Target_sparc::Relocate::relocate): Likewise.
8206 (Target_sparc::Relocate::relocate_tls): Likewise.
8207
8c500701
ILT
8208 * symtab.cc (Symbol_table::define_default_version): New function,
8209 broken out of add_from_object.
8210 (Symbol_table::add_from_object): Call define_default_version.
8211 (Symbol_table::define_special_symbol): Add resolve_oldsym
8212 parameter. Change all callers. If the version for a symbol comes
8213 from a version script, resolve it with the symbol with the same
8214 name with no version. Also add the symbol without a version if
8215 appropriate.
8216 (do_define_in_output_data): If resolving with oldsym, don't delete
8217 sym.
8218 (do_define_in_output_segment): Likewise.
8219 (do_define_as_constant): Likewise.
8220 * symtab.h (class Symbol_table): Update declarations.
8221
f1ed28fb
ILT
82222009-03-13 Ian Lance Taylor <iant@google.com>
8223
15f8229b
ILT
8224 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8225 (Read_symbols::requeue): New function.
8226 (Read_symbols::do_read_symbols): If make_elf_object fails because
8227 the target type is not configured, and the file was searched for,
8228 issue a warning and retry with the next directory.
8229 (Add_symbols::run): If the file has an incompatible format, and
8230 it was searched for, requeue the Read_symbols task. On error,
8231 release the object.
8232 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8233 dirindex parameter to constructor. Change all callers. Declare
8234 incompatible_warning and requeue.
8235 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8236 input_argument_ and input_group_ fields. Add them to
8237 constructor. Change all callers.
8238 (class Read_script): Add dirindex_ field. Add it to constructor.
8239 Change all callers.
8240 * archive.cc (Archive::setup): Remove input_objects parameter.
8241 Change all callers.
8242 (Archive::get_file_and_offset): Likewise.
8243 (Archive::read_all_symbols): Likewise.
8244 (Archive::read_symbols): Likewise.
8245 (Archive::get_elf_object_for_member): Remove input_objects
8246 parameter. Add punconfigured parameter. Change all callers.
8247 (Archive::add_symbols): Change return type to bool. Check return
8248 value of include_member.
8249 (Archive::include_all_members): Likewise.
8250 (Archive::include_member): Change return type to bool. Return
8251 false if first included object has incompatible target. Set
8252 included_member_ field.
8253 (Add_archive_symbols::run): If add_symbols returns false, requeue
8254 Read_symbols task.
8255 * archive.h (class Archive): Add included_member_ field.
8256 Initialize it in constructor. Add input_file and searched_for
8257 methods. Update declarations.
8258 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8259 input_argument_ fields. Add them to constructor. Change all
8260 callers.
8261 * script.cc: Include "target-select.h".
8262 (class Parser_closure): Add skip_on_incompatible_target_ and
8263 found_incompatible_target_ fields. Add
8264 skip_on_incompatible_target parameter to constructor. Change all
8265 callers. Add methods skip_on_incompatible_target,
8266 clear_skip_on_incompatible_target, found_incompatible_target, and
8267 set_found_incompatible_target.
8268 (read_input_script): Add dirindex parameter. Change all callers.
8269 If parser finds an incompatible target, requeue Read_symbols
8270 task.
8271 (script_set_symbol): Clear skip_on_incompatible_target in
8272 closure.
8273 (script_add_assertion, script_parse_option): Likewise.
8274 (script_start_sections, script_add_phdr): Likewise.
8275 (script_check_output_format): New function.
8276 * script.h (read_input_script): Update declaration.
8277 * script-c.h (script_check_output_format): Declare.
8278 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8279 (ignore_cmd): Remove OUTPUT_FORMAT.
8280 * fileread.cc (Input_file::Input_file): Add explicit this.
8281 (Input_file::will_search_for): New function.
8282 (Input_file::open): Add pindex parameter. Change all callers.
8283 * fileread.h (class Input_file): Add input_file_argument method.
8284 Declare will_search_for. Update declarations.
8285 * object.cc (make_elf_object): Add punconfigured parameter.
8286 Change all callers.
8287 * object.h (class Object): Make input_file public. Add
8288 searched_for method.
8289 (make_elf_object): Update declaration.
8290 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8291 restart search.
8292 * dirsearch.h (class Dirsearch): Update declaration.
8293 * options.h (class General_options): Add --warn-search-mismatch.
8294 * parameters.cc (Parameters::is_compatible_target): New function.
8295 * parameters.h (class Parameters): Declare is_compatible_target.
8296 * workqueue.cc (Workqueue::add_blocker): New function.
8297 * workqueue.h (class Workqueue): Declare add_blocker.
8298
f1ed28fb
ILT
8299 * fileread.cc (Input_file::open): Remove options parameter.
8300 Change all callers.
8301 (Input_file::open_binary): Likewise.
8302 * script.cc (read_input_script): Likewise.
8303 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8304 options parameter from constructor. Change all callers.
8305 (class Read_script): Likewise.
8306 * fileread.h (class Input_file): Update declarations.
8307 * script.h (read_input_script): Update declaration.
8308
34dd024a
NC
83092009-03-10 Nick Clifton <nickc@redhat.com>
8310
8311 * po/es.po: New Spanish translation.
8312
6d71b17c
CC
83132009-03-06 Cary Coutant <ccoutant@google.com>
8314
8315 * options.cc (parse_short_option): Keep dash_z from registering itself.
8316
031cdbed
ILT
83172009-03-03 Ian Lance Taylor <iant@google.com>
8318
8319 PR 9918
8320 * target-reloc.h (relocate_section): Pass output_section to
8321 relocate.
8322 * i386.cc (Target_i386::should_apply_static_reloc): Add
8323 output_section parameter. Change all callers.
8324 (Target_i386::Relocate::relocate): Add output_section parameter.
8325 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8326 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8327 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8328 * testsuite/two_file_shared.sh: New script.
8329 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8330 (check_DATA): Add two_file_shared.dbg.
8331 (two_file_shared.dbg): New target.
8332 * testsuite/Makefile.in: Rebuild.
8333
15d5fa16
ILT
83342009-03-01 Ian Lance Taylor <iant@google.com>
8335
8336 * configure.ac: Check for byteswap.h.
8337 * configure: Rebuild.
8338 * config.in: Rebuild.
8339
8a4c0b0d
ILT
83402009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8341
8342 * layout.cc (Layout::find_or_add_kept_section): New function.
8343 (Layout::add_comdat): Removed.
8344 * layout.h (struct Kept_section): Move out of class Layout.
8345 Remove trailing underscores from field names. Add group_sections
8346 field. Rename group_ field to is_group. Change all uses.
8347 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8348 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8349 comdat_groups_ field.
8350 (Sized_relobj::include_section_group): Use
8351 find_or_add_kept_section and Kept_section::group_sections.
8352 (Sized_relobj::include_linkonce_section): Likewise.
8353 * object.cc (class Sized_relobj): Don't define Comdat_group or
8354 Comdat_group_table. Remove find_comdat_group and
8355 add_comdat_group. Remove comdat_groups_ field.
8356 * plugin.cc (include_comdat_group): Use
8357 Layout::find_or_add_kept_section.
8358
b4ecf66b
ILT
83592009-02-28 Ian Lance Taylor <iant@google.com>
8360
14359ca0
ILT
8361 * README: --gc-sections and map files are now supported. Document
8362 some build requirements.
8363
b4ecf66b
ILT
8364 PR 6992
8365 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8366 relocatable link set the value of the section symbol to zero.
8367 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8368 relocatable link don't include the section address in the local
8369 symbol value.
8370
0602e05a
ILT
83712009-02-27 Ian Lance Taylor <iant@google.com>
8372
fd9d194f
ILT
8373 PR 6811
8374 * options.h (class Search_directory): Add is_system_directory.
8375 (class General_options): Declare is_in_system_directory.
8376 * options.cc (get_relative_sysroot): Make static.
8377 (get_default_sysroot): Make static.
8378 (General_optoins::is_in_system_directory): New function.
8379 * fileread.cc (Input_file::is_in_system_directory): New function.
8380 * fileread.h (class Input_file): Declare is_in_system_directory.
8381 * object.h (class Object): Add is_in_system_directory.
8382 (class Input_objects): Remove system_library_directory_ field.
8383 * object.cc (Input_objects::add_object): Don't set
8384 system_library_directory_.
8385 (input_objects::found_in_system_library_directory): Remove.
8386 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8387 parameter. Change all callers.
8388 (Symbol_table::sized_write_globals): Likewise.
8389 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8390 Call Object::is_in_system_directory.
8391 * symtab.h (class Symbol_table): Update declarations.
8392
61edd21f
ILT
8393 PR 5990
8394 * descriptors.h (Open_descriptor): Add is_on_stack field.
8395 * descriptors.cc (Descriptors::open): If the descriptor is on the
8396 top of the stack, remove it. Initialize is_on_stack field.
8397 (Descriptors::release): Only add pod to stack if it is not on the
8398 stack already.
8399 (Descriptors::close_some_descriptor): Clear stack_next and
8400 is_on_stack fields.
8401
e29e076a
ILT
8402 PR 7091
8403 * output.cc (Output_section::find_starting_output_address): Rename
8404 from starting_output_address; add PADDR parameter; change return
8405 type.
8406 * output.h (class Output_section): Declare
8407 find_starting_output_address instead of starting_output_address.
8408 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8409 section symbol for which we can't find a merge section.
8410
0602e05a
ILT
8411 PR 9836
8412 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8413 hidden or internal, force the symbol to be local.
8414 * resolve.cc (Symbol::override_visibility): Define.
8415 (Symbol::override_base): Use override_visibility.
8416 (Symbol_table::resolve): Likewise.
8417 (Symbol::override_base_with_special): Likewise.
8418 (Symbol_table::override_with_special): If the visibility is hidden
8419 or internal, force the symbol to be local.
8420 * symtab.h (class Symbol): Add set_visibility and
8421 override_visibility.
8422 * testsuite/ver_test_1.sh: New file.
8423 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8424 (check_DATA): Add ver_test_1.syms.
8425 (ver_test_1.syms): New target.
8426 * testsuite/Makefile.in: Rebuild.
8427
401a9a73
CC
84282009-02-25 Cary Coutant <ccoutant@google.com>
8429
8430 * layout.cc (Layout::choose_output_section): Don't rename sections
8431 when using a linker script that has a SECTIONS clause.
8432 * Makefile.in: Regenerate.
8433
8434 * testsuite/Makefile.am (script_test_5.sh): New test case.
8435 * testsuite/Makefile.in: Regenerate.
8436 * testsuite/script_test_5.cc: New file.
8437 * testsuite/script_test_5.sh: New file.
8438 * testsuite/script_test_5.t: New file.
8439
f488e4b0
CC
84402009-02-13 Rafael Avila de Espindola <espindola@google.com>
8441
8442 * archive.cc (Archive::include_member): Update calls to add_symbols.
8443 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8444 the Layout argument.
8445 * dynobj.h (do_add_symbols): Add the Layout argument.
8446 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8447 Layout argument.
8448 * object.h (Object::add_symbols): Add the Layout argument.
8449 (Object::do_add_symbols): Add the Layout argument.
8450 (Sized_relobj::do_add_symbols): Add the Layout argument.
8451 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8452 Unify the two versions.
8453 (Add_plugin_symbols): Remove.
8454 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8455 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8456 (Add_plugin_symbols): Remove.
8457 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8458 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8459 (Add_symbols::run): Make it work with Pulginobj.
8460
89dd1680
ILT
84612009-02-06 Ian Lance Taylor <iant@google.com>
8462
8463 * object.cc (Sized_relobj::do_layout): Make info message start
8464 with lower case letter.
8465
266d0a74
ILT
84662009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8467
602b464e
ILT
8468 * binary.cc: Fix file comment.
8469
266d0a74
ILT
8470 * options.h (enum Incremental_disposition): Define.
8471 (class General_options): Add new options: --incremental,
8472 --incremental_changed, --incremental_unchanged,
8473 --incremental_unknown. Add incremental_disposition_ and
8474 implicit_incremental_ fields.
8475 (General_options::incremental_disposition): New function.
8476 (class Position_dependent_options): Add incremental_disposition
8477 option.
8478 (Position_dependent_options::copy_from_options): Set incremental
8479 dispositions.
8480 * options.cc (General_options::parse_incremental_changed): New
8481 function.
8482 (General_options::parse_incremental_unchanged): New function.
8483 (General_options::parse_incremental_unknown): New function.
8484 (General_options::General_options): Initialize new fields
8485 incremental_disposition_ and implicit_incremental_.
8486 (General_options::finalize): Check for uasge of --incremental-*
8487 without --incremental.
8488
f073bbf7
CD
84892009-02-06 Chris Demetriou <cgd@google.com>
8490
8491 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8492 pointer and to report location as the file name associated with
8493 the symbol.
8494 (gold_undefined_symbol_at_location): New function to replace the
8495 old gold_undefined_symbol functionality.
8496 * target-reloc.h (relocate_section): Update to use
8497 gold_undefined_symbol_at_location.
8498 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8499 Call gold_undefined_symbol function rather than gold_error.
8500 * errors.h (Errors::undefined_symbol): Take location as a
8501 string, rather than calculating it from a relocation.
8502 * errors.cc (Errors::fatal): Print "fatal error:" before the
8503 formatted message.
8504 (Errors::error, Errors::error_at_location): Print "error: "
8505 before the formatted message.
8506 (Errors::undefined_symbol): Take location as a string, rather
8507 than calculating it from a relocation.
8508 (gold_undefined_symbol_at_location): New function akin to
8509 old gold_undefined_symbol, calculates location from relocation.
8510 (gold_undefined_symbol): Change to take only a Symbol pointer
8511 and to report location as the file name associated with the symbol.
8512 * testsuite/debug_msg.sh: Update for changed error messages.
8513 * testsuite/undef_symbol.sh: Likewise.
8514
8e94a90c
ILT
85152009-02-04 Duncan Sands <baldrick@free.fr>
8516
8517 PR 9812
8518 * reduced_debug_output.h
8519 (Output_reduced_debug_abbrev_section::failed): Use format for
8520 gold_warning.
8521 (Output_reduced_debug_info_section::faild): Likewise.
8522
88a0e15b
ILT
85232009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8524
8525 * script.cc (Lazy_demangler): New class.
8526 (Version_script_info::get_symbol_version_helper): Demangle a
8527 symbol only once.
8528
5efc7cd2
CC
85292009-01-29 Cary Coutant <ccoutant@google.com>
8530
8531 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8532 to __tls_get_addr.
8533 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8534
e0ebcf42
ILT
85352009-01-28 Ian Lance Taylor <iant@google.com>
8536
5efc7cd2 8537 * version.cc (version_string): Bump to 1.9.
75fe7426 8538
e0ebcf42
ILT
8539 * gold.h: Include <cstring> and <stdint.h>.
8540 * version.cc: Include <cstdio>.
8541 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8542 warning.
8543 * reduced_debug_output.cc (insert_into_vector): Rename from
8544 Insert_into_vector; change all callers. Use Swap_unaligned to
8545 avoid aliasing issue; remove union since it is unnecessary.
8546
8e2813be 85472009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
8548
8549 * Makefile.am (CCFILES): Add gc.cc.
8550 (HFILES): Add gc.h.
8551 * Makefile.in: Regenerate.
8552 * gold.cc (Gc_runner): New class.
8553 (queue_initial_tasks): Call garbage collection related tasks
8554 when corresponding options are invoked.
8555 (queue_middle_gc_tasks): New function.
8556 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8557 processed early before laying out sections during garbage collection.
8558 * gold.h (queue_middle_gc_tasks): New function.
8559 (is_prefix_of): Move from "layout.cc".
8560 * i386.cc (Target_i386::gc_process_relocs): New function.
8561 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8562 * main.cc (main): Create object of class "Garbage_collection".
8563 * object.cc (Relobj::copy_symbols_data): New function.
8564 (Relobj::is_section_name_included): New function.
e1df38aa
NC
8565 (Sized_relobj::do_layout): Allow this function to be called twice
8566 during garbage collection and defer layout of section during the
6d03d481
ST
8567 first call.
8568 * object.h (Relobj::get_symbols_data): New function.
8569 (Relobj::is_section_name_included): New function.
8570 (Relobj::copy_symbols_data): New function.
8571 (Relobj::set_symbols_data): New function.
8572 (Relobj::get_relocs_data): New function.
8573 (Relobj::set_relocs_data): New function.
8574 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8575 (Relobj::gc_process_relocs): New function.
8576 (Relobj::do_gc_process_relocs): New pure virtual function.
8577 (Relobj::sd_): New data member.
8578 (Sized_relobj::is_output_section_offset_invalid): New function.
8579 (Sized_relobj::do_gc_process_relocs): New function.
8580 * options.h (General_options::gc_sections): Modify to not be a no-op.
8581 (General_options::print_gc_sections): New option.
8582 * plugin.cc (Plugin_finish::run): Remove function call to
8583 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8584 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8585 * reloc.cc (Read_relocs::run): Add task to process relocs and
8586 determine unreferenced sections when doing garbage collection.
8587 (Gc_process_relocs): New class.
8588 (Sized_relobj::do_gc_process_relocs): New function.
8589 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8590 sections that are garbage collected.
8591 * reloc.h (Gc_process_relocs): New class.
8592 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8593 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8594 symbols whose corresponding sections are garbage collected.
8595 (Symbol_table::Symbol_table): Add new parameter for the garbage
8596 collection object.
8597 (Symbol_table::gc_mark_undef_symbols): New function.
8598 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8599 (Symbol_table::gc_mark_dyn_syms): New function.
8600 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8601 as garbage.
8602 (Symbol_table::add_from_object): Likewise.
8603 (Symbol_table::add_from_relobj): When building shared objects, do not
8604 treat externally visible symbols as garbage.
8605 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8606 table information for static and relocatable links.
8607 * symtab.h (Symbol_table::set_gc): New function.
8608 (Symbol_table::gc): New function.
8609 (Symbol_table::gc_mark_undef_symbols): New function.
8610 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8611 (Symbol_table::gc_mark_dyn_syms): New function.
8612 (Symbol_table::gc_): New data member.
e1df38aa 8613 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
8614 function.
8615 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8616 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8617
3b293544
CF
86182009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8619
8620 * options.h (General_options::gc_sections): Define as a no-op for now.
8621 (General_options::no_keep_memory): Ditto.
8622 (General_options::Bshareable): Define.
8623 * options.cc (General_options::finalize): Honor -Bshareable.
8624
83d22aa8
AS
86252009-01-20 Andreas Schwab <schwab@suse.de>
8626
8627 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8628 read the value in the contents, since we don't use it. Use the
8629 template endianness when writing.
8630 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8631
cd536b21
AS
86322009-01-19 Andreas Schwab <schwab@suse.de>
8633
8634 * configure.tgt (powerpc64-*): Fix targ_obj.
8635
99e9a495
ILT
86362009-01-15 Ian Lance Taylor <iant@google.com>
8637
8638 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8639 local symbols when stripping all symbols.
8640
bbbfea06
CC
86412009-01-14 Cary Coutant <ccoutant@google.com>
8642
99e9a495 8643 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 8644
0f7c0701
CC
86452009-01-14 Cary Coutant <ccoutant@google.com>
8646
8647 * archive.cc (Archive::get_elf_object_for_member): Remove call
8648 to File_read::claim_for_plugin.
8649 * descriptors.cc (Descriptors::open): Remove reference to
8650 is_claimed.
8651 (Descriptors::claim_for_plugin): Remove.
8652 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8653 (Descriptors::is_claimed): Remove.
8654 (claim_descriptor_for_plugin): Remove.
8655 * fileread.cc (File_read::claim_for_plugin): Remove.
8656 * fileread.h (File_read::claim_for_plugin): Remove.
8657 (File_read::descriptor): Reopen descriptor if necessary.
8658 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8659 (Plugin_manager::all_symbols_read): Add task parameter. Change
8660 all callers.
8661 (Plugin_manager::get_input_file): New function.
8662 (Plugin_manager::release_input_file): New function.
8663 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8664 corresponding data member.
8665 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8666 and pass to base constructor. Change all callers.
8667 (get_input_file, release_input_file): New functions.
8668 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8669 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8670 (Plugin_manager::all_symbols_read): Add task parameter.
8671 (Plugin_manager::get_input_file): New function.
8672 (Plugin_manager::release_input_file): New function.
8673 (Plugin_manager::task_): New data member.
8674 (Pluginobj::Pluginobj): Add filesize parameter.
8675 (Pluginobj::filename): New function.
8676 (Pluginobj::descriptor): New function.
8677 (Pluginobj::filesize): New function.
8678 (Pluginobj::filesize_): New data member.
8679 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8680 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8681 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8682
8683 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8684 with archive libraries.
8685 * testsuite/Makefile.in: Regenerate.
8686 * testsuite/plugin_test.c (struct sym_info): New type.
8687 (get_input_file, release_input_file): New static variables.
8688 (onload): Capture new transfer vector entries.
8689 (claim_file_hook): Stop reading at end of file according to filesize.
8690 Factor out parsing of readelf output into separate function.
8691 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8692 APIs and get the source file name from the symbol table. Convert
8693 source file name to corresponding object file name. Print info
8694 message when adding new input files.
8695 (parse_readelf_line): New function.
8696 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8697 * testsuite/plugin_test_2.sh: Likewise.
8698 * testsuite/plugin_test_3.sh: Likewise.
8699 * testsuite/plugin_test_4.sh: New test case.
8700
62a6d109
ILT
87012009-01-07 Ian Lance Taylor <iant@google.com>
8702
8703 * version.cc (version_string): Bump to 1.8.
8704
483620e8
CC
87052008-12-23 Cary Coutant <ccoutant@google.com>
8706
8707 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8708 * plugin.cc (Plugin_manager::finish): Rename as
8709 layout_deferred_objects. Move cleanup to separate function.
8710 (Plugin_manager::cleanup): New function.
8711 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8712 separately.
8713 * plugin.h (Plugin_manager::finish): Rename as
8714 layout_deferred_objects.
8715 (Plugin_manager::cleanup): New function.
8716 (Plugin_manager::cleanup_done): New field.
8717
d66a9eb3
CC
87182008-12-23 Cary Coutant <ccoutant@google.com>
8719
8720 * plugin.cc (is_visible_from_outside): New function.
8721 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8722 so we don't return "IR only" status for exported symbols or -r links.
8723
8724 * testsuite/Makefile.am (plugin_test_3): New test case.
8725 * testsuite/Makefile.in: Regenerate.
8726 * testsuite/plugin_test_3.sh: New file.
8727
5995b570
CC
87282008-12-22 Cary Coutant <ccoutant@google.com>
8729
8730 * object.cc (Sized_relobj::layout_section): New function.
8731 (Sized_relobj::do_layout): Defer layout of input sections until after
8732 plugin has provided replacement files.
8733 (Sized_relobj::do_layout_deferred_sections): New function.
8734 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8735 (Relobj::layout_deferred_sections): New function.
8736 (Relobj::do_layout_deferred_sections): New function.
8737 (Sized_relobj::do_layout_deferred_sections): New function.
8738 (Sized_relobj::layout_section): New function.
8739 (Sized_relobj::Deferred_layout): New structure.
8740 (Sized_relobj::deferred_layout_): New field.
8741 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8742 Change all callers. Layout deferred sections.
8743 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8744 references.
8745 (Plugin_hook::run): Move code from do_plugin_hook inline.
8746 (Plugin_hook::do_plugin_hook): Remove.
8747 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8748 (Plugin_manager::finish): Renamed, was cleanup.
8749 (Plugin_manager::should_defer_layout): New function.
8750 (Plugin_manager::add_deferred_layout_object): New function.
8751 (Plugin_manager::Deferred_layout_list): New type.
8752 (Plugin_manager::deferred_layout_objects_): New field.
8753 (Plugin_hook::do_plugin_hook): Remove.
8754
ee769c88
ILT
87552008-12-17 Ian Lance Taylor <iant@google.com>
8756
8757 * options.h (class General_options): Add --no case for
8758 --export-dynamic.
8759
abc8dcba
CC
87602008-12-16 Cary Coutant <ccoutant@google.com>
8761
8762 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8763 vector.
8764 (Plugin_manager::claim_file): Create plugin object even if
8765 plugin did not call the add_symbols callback.
8766 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8767 asking for more symbols than were added.
8768 * testsuite/Makefile.am (plugin_test_1): Add test case with
8769 no global symbols.
8770 (empty.syms): New target.
8771 * testsuite/Makefile.in: Regenerate.
8772 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8773 message. Don't call add_symbols if no globals.
8774 (all_symbols_read_hook): Don't provide replacement for empty
8775 claimed file.
8776
b0074644
ILT
87772008-12-12 Ian Lance Taylor <iant@google.com>
8778
68943102
ILT
8779 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8780 r_type == 0 for a local symbol with r_sym == 0.
8781 (scan_relocatable_relocs): Pass r_sym to
8782 local_non_section_strategy.
8783 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8784 r_sym parameter.
8785
b0074644
ILT
8786 * configure.ac: Update test for TLS descriptors: they are
8787 supported as of glibc 2.9.
8788 * configure: Rebuild.
8789
c2508178
ILT
87902008-12-11 Ian Lance Taylor <iant@google.com>
8791
8792 PR 7091
8793 * target-reloc.h (Default_scan_relocatable_relocs): For each
8794 function, map r_type == 0 to RELOC_DISCARD.
8795
2756a258
CC
87962008-12-10 Cary Coutant <ccoutant@google.com>
8797
8798 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8799 object to override a kept COMDAT group from a plugin object.
8800
bb6f53d3
ILT
88012008-12-09 Ian Lance Taylor <iant@google.com>
8802
fbc558e1
ILT
8803 PR 7088
8804 * yyscript.y (file_cmd): Handle INPUT.
8805
bb6f53d3
ILT
8806 * testsuite/initpri1.c: Change all declarations to be full
8807 prototypes by adding void, to avoid compiler warnings.
8808
4674ecfc
CC
88092008-12-05 Rafael Avila de Espindola <espindola@google.com>
8810
8811 * options.cc (General_options::parse_plugin_opt): New.
8812 (General_options::add_plugin): The argument now is just the filename.
8813 (General_options::add_plugin_option): New.
8814 * options.h (plugin_opt): New.
8815 (add_plugin): Change argument name.
8816 (add_plugin_option): New.
8817 * plugin.cc (Plugin::load): Don't parse the plugin option.
8818 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8819 (Plugin::add_option): New.
8820 (Plugin::args_): Change type.
8821 (Plugin::filename_): New.
8822 (Plugin_manager::add_plugin_option): New.
8823 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8824 * testsuite/Makefile.in: Regenerate.
8825
fd06b4aa
CC
88262008-12-05 Cary Coutant <ccoutant@google.com>
8827
8828 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8829 Handle --strip-lto-sections option.
8830 * options.h (strip_lto_sections): New option.
8831
6c52134c
CC
88322008-12-01 Cary Coutant <ccoutant@google.com>
8833
8834 * plugin.cc (ld_plugin_message): Change format parameter to const.
8835 Fix mismatch between new[] and delete.
8836
a45248e0
CC
88372008-11-14 Cary Coutant <ccoutant@google.com>
8838
8839 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8840 instead of -1U.
8841
c82fbeee
CS
88422008-11-05 Craig Silverstein <csilvers@google.com>
8843
8844 * options.cc (General_options::parse_dynamic_list): New function.
8845 * options.h (General_options): New flags dynamic_list,
8846 dynamic_list_data, dynamic_list_cpp_new, and
8847 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8848 (General_options::in_dynamic_list): New function.
8849 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8850 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8851 (Lex::can_continue_name): Likewise.
8852 (yylex): Likewise.
8853 (read_script_file): New parameter script_options.
8854 (read_dynamic_list): New function.
8855 (Script_options::define_dynamic_list): New function.
8856 (dynamic_list_keyword_parsecodes): New variable.
8857 (dynamic_list_keywords): New variable.
8858 * script.h (Script_options::define_dynamic_list): New function
8859 prototype.
8860 (read_dynamic_list): New function prototype.
8861 * symtab.cc (strprefix): New macro.
8862 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8863 dynamic_list_data, dynamic_list_cpp_new, and
8864 dynamic_list_cpp_typeinfo.
8865 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8866 (dynamic_list_expr): New rule.
8867 (dynamic_list_nodes): Likewise.
8868 (dynamic_list_node): Likewise.
8869 * testsuite/Makefile.am (dynamic_list): New test.
8870 * testsuite/Makefile.in: Regenerated.
8871 * testsuite/dynamic_list.t: New file.
8872 * testsuite/dynamic_list.sh: New file.
8873
e0bb29a5
CS
88742008-11-05 Craig Silverstein <csilvers@google.com>
8875
8876 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8877 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8878 (t11_last): Likewise.
8879 * testsuite/ver_test_6.c (main): Likewise.
8880
4e1e25e0
CC
88812008-10-07 Cary Coutant <ccoutant@google.com>
8882
8883 * options.c (General_options::finalize): Add check for -static and
8884 -shared.
8885 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8886 is not empty.
8887
92f03fcb
CC
88882008-10-02 Cary Coutant <ccoutant@google.com>
8889
8890 * plugin.cc (make_sized_plugin_object): Fix conditional
8891 compilation to work when not all targets are enabled.
8892
fbd8a257
CC
88932008-09-29 Cary Coutant <ccoutant@google.com>
8894
8895 * archive.cc (Archive::get_file_and_offset): Use filename instead
8896 of name to get library path.
8897 (Archive::include_member): Unlock external member of a thin archive.
8898
8899 * testsuite/Makefile.am (TEST_AR): New variable.
8900 (thin_archive_test_1): New test.
8901 (thin_archive_test_2): New test.
81636b3f
CC
8902 * testsuite/Makefile.in: Regenerate.
8903 * testsuite/thin_archive_main.cc: New file.
8904 * testsuite/thin_archive_test_1.cc: New file.
8905 * testsuite/thin_archive_test_2.cc: New file.
8906 * testsuite/thin_archive_test_3.cc: New file.
8907 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 8908
eff45813
CC
89092008-09-29 Cary Coutant <ccoutant@google.com>
8910
8911 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8912 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8913 instead of -1U.
8914 (Sized_relobj::do_finalize_local_symbols): Likewise.
8915 (Sized_relobj::map_to_kept_section): Likewise.
8916 * object.h (Sized_relobj::invalid_address): New constant.
8917 (Sized_relobj::do_output_section_offset): Check for invalid_address
8918 and return -1ULL.
8919 * output.cc (Output_reloc::local_section_offset): Use constant
8920 invalid_address instead of -1U.
8921 (Output_reloc::get_address): Likewise.
8922 (Output_section::output_address): Change -1U to -1ULL.
8923 * output.h (Output_reloc::invalid_address): New constant.
8924 * reloc.cc (Sized_relobj::write_sections): Use constant
8925 invalid_address instead of -1U.
8926 (Sized_relobj::relocate_sections): Likewise.
8927 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8928 values for merge sections.
8929 * target-reloc.h (relocate_for_relocatable): Use constant
8930 invalid_address instead of -1U.
8931
89fc3421
CC
89322008-09-19 Cary Coutant <ccoutant@google.com>
8933
8934 Add plugin functionality for link-time optimization (LTO).
8935 * configure.ac (plugins): Add --enable-plugins option.
8936 * configure: Regenerate.
8937 * config.in: Regenerate.
8938 * Makefile.am (LIBDL): New variable.
8939 (CCFILES): Add plugin.cc.
8940 (HFILES): Add plugin.h.
8941 (ldadd_var): Add LIBDL.
8942 * Makefile.in: Regenerate.
8943
8944 * archive.cc: Include "plugin.h".
8945 (Archive::setup): Don't preread archive symbols when using a plugin.
8946 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8947 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8948 files.
8949 (Archive::include_member): Add symbols from plugin objects.
8950 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8951 * descriptors.cc (Descriptors::open): Check for file descriptors
8952 abandoned by plugins.
8953 (Descriptors::claim_for_plugin): New function.
8954 * descriptors.h (Descriptors::claim_for_plugin): New function.
8955 (Open_descriptor::is_claimed): New field.
8956 (claim_descriptor_for_plugin): New function.
8957 * fileread.cc (File_read::claim_for_plugin): New function.
8958 * fileread.h (File_read::claim_for_plugin): New function.
8959 (File_read::descriptor): New function.
8960 * gold.cc: Include "plugin.h".
8961 (queue_initial_tasks): Add task to call plugin hooks for generating
8962 new object files.
8963 * main.cc: Include "plugin.h".
8964 (main): Load plugin libraries.
8965 * object.h (Pluginobj): Declare.
8966 (Object::pluginobj): New function.
8967 (Object::do_pluginobj): New function.
8968 (Object::set_target): New function.
8969 * options.cc: Include "plugin.h".
8970 (General_options::parse_plugin): New function.
8971 (General_options::General_options): Initialize plugins_ field.
8972 (General_options::add_plugin): New function.
8973 * options.h (Plugin_manager): Declare.
8974 (General_options): Add --plugin option.
8975 (General_options::has_plugins): New function.
8976 (General_options::plugins): New function.
8977 (General_options::add_plugin): New function.
8978 (General_options::plugins_): New field.
8979 * plugin.cc: New file.
8980 * plugin.h: New file.
8981 * readsyms.cc: Include "plugin.h".
8982 (Read_symbols::do_read_symbols): Check for archive before checking
8983 for ELF file. Call plugin hooks to claim files.
8984 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8985 from a real object file; force override when processing replacement
8986 files.
8987 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8988 (Symbol::init_base_object): Likewise.
8989 (Symbol::init_base_output_data): Likewise.
8990 (Symbol::init_base_output_segment): Likewise.
8991 (Symbol::init_base_constant): Likewise.
8992 (Symbol::init_base_undefined): Likewise.
8993 (Symbol::output_section): Assert that object is not a plugin.
8994 (Symbol_table::add_from_pluginobj): New function.
8995 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8996 undefined.
8997 (Symbol_table::sized_write_globals): Likewise.
8998 (Symbol_table::add_from_pluginobj): Instantiate template.
8999 * symtab.h (Sized_pluginobj): Declare.
9000 (Symbol::in_real_elf): New function.
9001 (Symbol::set_in_real_elf): New function.
9002 (Symbol::in_real_elf_): New field.
9003 (Symbol_table::add_from_pluginobj): New function.
9004
9005 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9006 (LIBDL): New variable.
9007 (LDADD): Add LIBDL.
9008 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9009 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9010 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9011 (MOSTLYCLEANFILES): Likewise.
9012 * testsuite/Makefile.in: Regenerate.
9013 * testsuite/plugin_test.c: New file.
9014 * testsuite/plugin_test_1.sh: New file.
9015 * testsuite/plugin_test_2.sh: New file.
9016
de31bda5
ILT
90172008-09-16 Ian Lance Taylor <iant@google.com>
9018
9c2d0ef9
ILT
9019 * target-reloc.h (relocate_section): Check whether a symbol is
9020 defined by the ABI before reporting an undefined symbol error.
9021 * target.h (Target::is_defined_by_abi): Make parameter const.
9022 (Target::do_is_defined_by_abi): Likewise.
9023 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9024 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9025 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9026 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9027 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9028 * testsuite/Makefile.in: Rebuild.
9029
de31bda5
ILT
9030 * fileread.cc (make_view): Add casts to avoid warning.
9031
9fa33bee
AO
90322008-09-16 Alexandre Oliva <aoliva@redhat.com>
9033
9034 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9035 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9036
183fd0e3
AO
90372008-09-16 Alexandre Oliva <aoliva@redhat.com>
9038
9039 * options.h (General_options::output_is_executable): New.
9040 (General_options::output_is_pie): New.
9041 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9042 for shared libraries.
9043 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9044
7be8330a
CD
90452008-09-11 Chris Demetriou <cgd@google.com>
9046
9047 * options.h (origin): New -z option.
9048 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9049 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9050 in DT_FLAGS_1.
9051
a9caad02
CC
90522008-09-05 Cary Coutant <ccoutant@google.com>
9053
9054 * fileread.cc (File_read::make_view): Add check for attempt to map
9055 beyond end of file.
9056
ae6dce4d
CC
90572008-09-05 Cary Coutant <ccoutant@google.com>
9058
9059 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9060 explicit instantiations.
9061
d7ab2a47
KVH
90622008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9063
9064 PR gold/6858
9065 * options.cc (General_options::finalize): Allow undefined symbols
9066 in shlibs if linking -shared.
9067
9068 PR gold/6859
9069 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9070 symbols as not needing a dynsym entry.
9071
1e52a9c1
CS
90722008-08-20 Craig Silverstein <csilvers@google.com>
9073
9074 * fileread.cc (File_read::open): Do not lock the file unless it
9075 was successfully opened.
9076
d85c80a3
CC
90772008-08-14 Cary Coutant <ccoutant@google.com>
9078
9079 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9080 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9081 * testsuite/tls_test.cc (struct int128): 128-bit struct
9082 for testing TLS relocs with non-zero addend.
9083 (v12): New TLS variable.
9084 (t12): New test.
9085 (t_last): Add check for v12.
9086 * testsuite/tls_test.h (t12): New function.
9087 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9088
2d924fd9
ILT
90892008-08-13 Ian Lance Taylor <iant@google.com>
9090
9091 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9092 set tls_segment_ or relro_segment_.
9093 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9094 when appropriate.
9095 * output.h (Output_section::clear_is_relro): New function.
9096 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9097 sections specially even when output_data_ is empty.
9098 (Output_segment::maximum_alignment): When first section is relro,
9099 only force alignment for PT_LOAD segments.
9100 * script.cc (script_data_segment_align): New function.
9101 (script_data_segment_relro_end): New function.
9102 * script-c.h (script_data_segment_align): Declare.
9103 (script_data_segment_relro_end): Declare.
9104 * script-sections.h (class Script_sections): Declare
9105 data_segment_align and data_segment_relro_end. Add fields
9106 segment_align_index_ and saw_relro_end_.
9107 * script-sections.cc (class Sections_element): Add set_is_relro
9108 virtual function. Add new bool* parameter to place_orphan_here.
9109 Add get_output_section virtual function.
9110 (class Output_section_definition): Add set_is_relro. Add new
9111 bool* parameter to place_orphan_here. Add get_output_section.
9112 Add is_relro_ field.
9113 (Output_section_definition::Output_section_definition): Initialize
9114 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9115 and is_relro_ fields.
9116 (Output_section_definition::place_orphan_here): Add is_relro
9117 parameter.
9118 (Output_section_definition::set_section_addresses): Set relro for
9119 output section.
9120 (Output_section_definition::alternate_constraint): Likewise.
9121 (class Orphan_output_section): Add new bool* parameter to
9122 place_orphan_here. Add get_output_section.
9123 (Orphan_output_section::place_orphan_here): Add is_relro
9124 parameter.
9125 (Script_sections::Script_sections): Initialize
9126 data_segment_align_index_ and saw_relro_end_.
9127 (Script_sections::data_segment_align): New function.
9128 (Script_sections::data_segment_relro_end): New function.
9129 (Script_sections::place_orphan): Set or clear is_relro.
9130 (Script_sections::set_section_addresses): Force alignment of first
9131 TLS section.
9132 * yyscript.y (exp): Call script_data_segment_align and
9133 script_data_segment_relro_end.
9134 * testsuite/relro_script_test.t: New file.
9135 * testsuite/relro_test.cc (using_script): Declare.
9136 (t1, t2): Test using_script.
9137 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9138 (relro_script_test_SOURCES): Define.
9139 (relro_script_test_DEPENDENCIES): Define.
9140 (relro_script_test_LDFLAGS): Define.
9141 (relro_script_test_LDADD): Define.
9142 (relro_script_test.so): New target.
9143 * testsuite/Makefile.in: Rebuild.
9144
f827c9a9
CC
91452008-08-06 Cary Coutant <ccoutant@google.com>
9146
9147 * archive.cc (Archive::total_archives, Archive::total_members)
9148 (Archive::total_members_loaded): New variables.
9149 (Archive::setup): Add parameter. Add option to preread
9150 archive symbols.
9151 (Archive::read_armap): Add counter.
9152 (Archive::get_file_and_offset): New function.
9153 (Archive::get_elf_object_for_member): New function.
9154 (Archive::read_all_symbols): New function.
9155 (Archive::read_symbols): New function.
9156 (Archive::add_symbols): Add counters.
9157 (Archive::include_all_members): Use armap to find members if it's
9158 already built.
9159 (Archive::include_member): Skip reading symbols if already read.
9160 Factored code into Archive::get_file_and_offset and
9161 Archive::get_elf_object_for_member. Changed call to
9162 Mapfile::report_include_archive_member.
9163 (Archive::print_stats): New function.
9164 * archive.h: Declare Object and Read_symbols_data classes.
9165 (Archive::Archive): Add initializers for new members.
9166 (Archive::setup): Add parameter.
9167 (Archive::print_stats): New function.
9168 (Archive::total_archives, Archive::total_members)
9169 (Archive::total_members_loaded): New variables.
9170 (Archive::get_file_and_offset): New function.
9171 (Archive::get_elf_object_for_member): New function.
9172 (Archive::read_all_symbols): New function.
9173 (Archive::read_symbols): New function.
9174 (Archive::Archive_member): New class.
9175 (Archive::members_): New member.
9176 (Archive::num_members_): New member.
9177 * main.cc: Include archive.h.
9178 (main): Call Archive::print_stats.
9179 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9180 archive parameter; member_name is now the fully-decorated name.
9181 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9182 * options.h: (General_options): Add --preread-archive-symbols option.
9183 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9184 Archive::setup.
9185
de4c45bd
ILT
91862008-08-04 Ian Lance Taylor <iant@google.com>
9187
9188 * symtab.h (Symbol::use_plt_offset): New function.
9189 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9190 * powerpc.cc (Relocate::relocate): Likewise.
9191 * sparc.cc (Relocate::relocate): Likewise.
9192 * x86_64.cc (Relocate::relocate): Likewise.
9193 * testsuite/weak_plt.sh: New test.
9194 * testsuite/weak_plt_main.cc: New test.
9195 * testsuite/weak_plt_shared.cc: New test.
9196 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9197 (check_PROGRAMS): Add weak_plt.
9198 (check_DATA): Add weak_plt_shared.so.
9199 (weak_plt_main_pic.o, weak_plt): New targets.
9200 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9201 * testsuite/Makefile.in: Rebuild.
9202
9203 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9204 gcctestdir/ld.
9205 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9206 * testsuite/Makefile.in: Rebuild.
9207
323ee3f4
AM
92082008-08-04 Alan Modra <amodra@bigpond.net.au>
9209
9210 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9211 * Makefile.in: Regenerate.
9212 * po/POTFILES.in: Regenerate.
9213
7c07ecec
ILT
92142008-07-29 Ian Lance Taylor <iant@google.com>
9215
9216 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9217 symbols before other symbols.
9218 * testsuite/script_test_2.cc (test_addr): Declare.
9219 (test_addr_alias): Declare.
9220 (main): Check that test_addr and test_addr_alias have the right
cd536b21 9221 values.
7c07ecec
ILT
9222 * testsuite/script_test_2.t: Define test_addr_alias and
9223 test_addr.
9224
5778530e
ILT
92252008-07-24 Ian Lance Taylor <iant@google.com>
9226
2a00e4fb
ILT
9227 PR 5990
9228 * descriptors.cc: New file.
9229 * descriptors.h: New file.
9230 * gold-threads.h (class Hold_optional_lock): New class.
9231 * fileread.cc: Include "descriptors.h".
9232 (File_read::~File_read): Release descriptor rather than closing
9233 it.
9234 (File_read::open) [file]: Call open_descriptor rather than open.
9235 Set is_descriptor_opened_.
9236 (File_read::open) [memory]: Assert that descriptor is not open.
9237 (File_read::reopen_descriptor): New function.
9238 (File_read::release): Release descriptor.
9239 (File_read::do_read): Make non-const. Reopen descriptor.
9240 (File_read::read): Make non-const.
9241 (File_read::make_view): Reopen descriptor.
9242 (File_read::do_readv): Likewise.
9243 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9244 Update declarations.
9245 * layout.cc: Include "descriptors.h".
9246 (Layout::create_build_id): Use open_descriptor rather than open.
9247 * output.cc: Include "descriptors.h".
9248 (Output_file::open): Use open_descriptor rather than open.
9249 * archive.cc (Archive::const_iterator): Change Archive to be
9250 non-const.
9251 (Archive::begin, Archive::end): Make non-const.
9252 (Archive::count_members): Likewise.
9253 * archive.h (class Archive): Update declarations.
9254 * object.h (Object::read): Make non-const.
9255 * Makefile.am (CCFILES): Add descriptors.cc.
9256 (HFILES): Add descriptors.h.
9257 * Makefile.in: Rebuild.
9258
801647d1
ILT
9259 PR 6716
9260 * gold.h: Always include <clocale>. Add Solaris workarounds
9261 following code in binutils/sysdep.h.
9262
5edd166e
ILT
9263 PR 6048
9264 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9265 this->eh_frame_hdr_ is NULL before using it.
9266
c89ad728
ILT
9267 * dynobj.cc (Versions::Versions): Update comment.
9268
aa86f06b
ILT
9269 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9270 the base version name.
9271
5778530e
ILT
9272 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9273 array size plus one.
9274 (Stringpool_template::set_string_offsets): Subtract one from key
9275 before using it as an array index.
9276 (Stringpool_template::get_offset_with_length): Likewise.
9277 (Stringpool_template::write_to_buffer): Likewise.
9278 * stringpool.h (Stringpool_template::get_offset_from_key):
9279 Likewise.
9280
057ead22
ILT
92812008-07-23 Ian Lance Taylor <iant@google.com>
9282
7f649c59
ILT
9283 PR 6658
9284 * object.h (Merged_symbol_value::value): Do our best to handle a
9285 negative addend.
9286
057ead22
ILT
9287 PR 6647
9288 * script.cc (Version_script_info::get_versions): Don't add empty
9289 version tag to return value.
9290 (Version_script_info::get_symbol_version_helper): Change return
9291 type to bool. Add pversion parameter. Change all callers.
9292 (script_register_vers_node): Don't require a non-NULL tag.
9293 * script.h (class Version_script_info): Update declarations.
9294 (Version_script_info::get_symbol_version): Change return type to
9295 bool. Add version parameter. Change all callers.
9296 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9297 handling. Handle an empty version from a version script.
9298 (Symbol_table::define_special_symbol): Likewise.
9299 * testsuite/ver_test_10.script: New file.
9300 * testsuite/ver_test_10.sh: New file.
9301 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9302 (check_DATA): Add ver_test_10.syms.
9303 (ver_test_10.syms, ver_test_10.so): New target.
9304 * testsuite/Makefile.in: Rebuild.
9305
58e54ac2
CD
93062008-07-23 Simon Baldwin <simonb@google.com>
9307
9308 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9309 to zero for undefined symbols from dynamic libraries.
9310
95d14cd3
ILT
93112008-07-23 Ian Lance Taylor <iant@google.com>
9312
9313 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9314 Change all callers.
9315 * symtab.h (class Symbol_table): Update declaration.
9316 * testsuite/ver_test_9.cc: New file.
9317 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9318 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9319 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9320 (ver_test_9.so, ver_test_9.o): New targets.
9321 * testsuite/Makefile.in: Rebuild.
9322
92de84a6
ILT
93232008-07-22 Ian Lance Taylor <iant@google.com>
9324
34810851
ILT
9325 * options.h (class General_options): Define --check-sections.
9326 * layout.cc (Layout::set_segment_offsets): Handle
9327 --check-sections.
9328
af6156ef
ILT
9329 * options.h (class General_options): Define -n/--nmagic and
9330 -N/--omagic.
9331 * options.cc (General_options::finalize): For -n/--nmagic or
9332 -N/--omagic, set -static.
9333 * layout.cc (Layout::attach_allocated_section_to_segment): If
9334 -N/--omagic, don't put read-only and read-write sections in
9335 different segments.
9336 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9337 finding a read-only segment.
9338 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9339 don't set the minimum segment alignment to the common page size,
9340 and don't set the file offset to the address modulo the page size.
9341 * script-sections.cc (Script_sections::create_segments): If
9342 -n/--omagic, don't put read-only and read-write sections in
9343 different segments.
9344
92de84a6
ILT
9345 * cref.cc: New file.
9346 * cref.h: New file.
9347 * options.h (class General_options): Add --print-symbol-counts.
9348 * main.cc (main): Issue defined symbol report if requested.
9349 * archive.cc (Archive::interpret_header): Make into a const member
9350 function.
9351 (Archive::add_symbols): Call Input_objects::archive_start and
9352 archive_stop.
9353 (Archive::const_iterator): Define new class.
9354 (Archive::begin, Archive::end): New functions.
9355 (Archive::include_all_members): Rewrite to use iterator.
9356 (Archive::count_members): New function.
9357 * archive.h (class Archive): Update declarations.
9358 (Archive::filename): New function.
9359 * object.cc: Include "cref.h".
9360 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9361 (Sized_relobj::do_get_global_symbol_counts): New function.
9362 (Input_objects::add_object): Add object to cross-referencer.
9363 (Input_objects::archive_start): New function.
9364 (Input_objects::archive_stop): New function.
9365 (Input_objects::print_symbol_counts): New function.
9366 * object.h: Declare Cref and Archive.
9367 (Object::get_global_symbol_counts): New function.
9368 (Object::do_get_global_symbol_counts): New pure virtual function.
9369 (class Sized_relobj): Add defined_count_ field. Update
9370 declarations.
9371 (class Input_objects): Add cref_ field. Update constructor.
9372 Update declarations.
9373 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9374 defined_count_.
9375 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9376 symbol counts.
9377 (Sized_dynobj::do_get_global_symbol_counts): New function.
9378 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9379 defined_count_. Update declarations. Define Symbols typedef.
9380 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9381 parameter. Change all callers.
9382 (Symbol_table::add_from_dynobj): Add sympointers and defined
9383 parameters. Change all callers.
9384 * symtab.h (class Symbol_table): Update declarations.
9385 * Makefile.am (CCFILES): Add cref.cc.
9386 (HFILES): Add cref.h.
9387 * Makefile.in: Rebuild.
9388
3f7c5e1d
CD
93892008-07-22 Simon Baldwin <simonb@google.com>
9390
9391 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9392 to zero when writing undefined symbols.
9393
e0b64032
ILT
93942008-07-22 Ian Lance Taylor <iant@google.com>
9395
9396 * output.cc (Output_section::add_input_section): Don't try to
9397 merge empty merge sections.
9398
096b02cf
CS
93992008-07-21 Craig Silverstein <csilvers@google.com>
9400
9401 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9402 Include symbol version in error message.
cd536b21 9403
1d1f116d
CD
94042008-07-20 Chris Demetriou <cgd@google.com>
9405
cd536b21 9406 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
9407 (RANDOM_SEED_CFLAGS): New substituted variable.
9408 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9409 * configure: Rebuild.
9410 * Makefile.in: Likewise.
9411 * testsuite/Makefile.in: Likewise.
9412
a18f591e
ILT
94132008-07-18 Ian Lance Taylor <iant@google.com>
9414
9415 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9416 where we see NAME/NULL and NAME/VERSION as separate symbols.
9417 * testsuite/ver_test_main.cc (main): Call t4.
9418 (t4, t4_2a): Define.
9419 * testsuite/ver_test_2.cc (t4_2): Define.
9420 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9421 * testsuite/ver_test_4.cc (t4_2a): Define.
9422 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9423 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9424
c6e3f6ed
ILT
94252008-07-17 Ian Lance Taylor <iant@google.com>
9426
9427 * dynobj.cc (Versions::add_def): If we give an error about a
9428 missing version, go ahead and create the version anyhow.
9429
ef9beddf
ILT
94302008-07-10 Ian Lance Taylor <iant@google.com>
9431
9432 Handle output sections with more than 0x7fffffff bytes.
9433 * object.h (class Relobj): Change map_to_output_ to
9434 output_sections_, and just keep a section pointer. Change all
9435 uses. Move comdat group support to Sized_relobj.
9436 (Relobj::is_section_specially_mapped): Remove.
9437 (Relobj::output_section): Remove poff parameter. Change all
9438 callers.
9439 (Relobj::output_section_offset): New function.
9440 (Relobj::set_section_offset): Rewrite.
9441 (Relobj::map_to_output): Remove.
9442 (Relobj::output_sections): New function.
9443 (Relobj::do_output_section_offset): New pure virtual function.
9444 (Relobj::do_set_section_offset): Likewise.
9445 (class Sized_relobj): Add section_offsets_ field. Add comdat
9446 group support from Relobj. Update declarations.
9447 (Sized_relobj::get_output_section_offset): New function.
9448 (Sized_relobj::do_output_section_offset): New function.
9449 (Sized_relobj::do_set_section_offset): New function.
9450 * object.cc (Relobj::output_section_address): Remove.
9451 (Sized_relobj::Sized_relobj): Initialize new fields.
9452 (Sized_relobj::include_section_group): Cast find_kept_object to
9453 Sized_relobj.
9454 (Sized_relobj::include_linkonce_section): Likewise.
9455 (Sized_relobj::do_layout): Use separate arrays for output section
9456 and output offset.
9457 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9458 output_sections.
9459 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9460 output_sections and section_offsets.
9461 (Sized_relobj::write_local_symbols): Likewise.
9462 (map_to_kept_section): Compute output address directly.
9463 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9464 output_sections and section_offsets.
9465 (Sized_relobj::write_sections): Likewise.
9466 (Sized_relobj::relocate_sections): Likewise.
9467 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9468 * output.h (class Output_reloc): Update declarations. Change
9469 u2_.relobj to Sized_relobj*.
9470 (class Output_data_reloc): Change add functions to use
9471 Sized_relobj*.
9472 * output.cc (Output_reloc::Output_reloc): Change relobj to
9473 Sized_relobj*.
9474 (Output_reloc::local_section_offset): Change return type to
9475 Elf_Addr. Use get_output_section_offset.
9476 (Output_reloc::get_address): Likewise.
9477 (Output_section::is_input_address_mapped): Don't call
9478 is_section_specially_mapped.
9479 (Output_section::output_offset): Likewise.
9480 (Output_section::output_address): Likewise.
9481 (Output_section::starting_output_address): Likewise.
9482 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9483 parameter to Sized_relobj*.
9484 (Copy_relocs::need_copy_reloc): Likewise.
9485 (Copy_relocs::save): Likewise.
9486 * copy-relocs.h (class Copy_relocs): Update declarations.
9487 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9488 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9489 * target-reloc.h (relocate_for_relocatable): Change
9490 offset_in_output_section type to Elf_Addr. Change code that uses
9491 it as well.
9492 * layout.cc (Layout::layout): Always set *off.
9493 * mapfile.cc (Mapfile::print_input_section): Use
9494 output_section_offset.
9495 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9496 Sized_relobj*.
9497 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9498 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9499 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9500
5cb66f97
ILT
95012008-07-03 Ian Lance Taylor <iant@google.com>
9502
9503 * layout.cc (Layout::include_section): Do not discard unrecognized
9504 SHT_STRTAB sections.
9505
afe47622
CS
95062008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9507
9508 * script.cc (Lex::can_continue_name): Make '?' allowable in
9509 version-script names.
9510 * testsuite/version_script.map: Change glob pattern to use '?'
9511
5adf9721
ILT
95122008-06-30 Manish Singh <yosh@gimp.org>
9513
9514 PR 6585
9515 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9516 Correct typo.
9517
e6fde208
ILT
95182008-06-30 Ian Lance Taylor <iant@google.com>
9519
9520 PR 6660
9521 PR 6682
9522 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9523 versions]: Don't try to read the value in the contents, since we
9524 don't use it. Use the template endianness when writing.
9525
3f2e6a2d
CC
95262008-06-25 Cary Coutant <ccoutant@google.com>
9527
9528 * fileread.cc (File_read::make_view): Assert on zero-length view.
9529 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9530 symbol table when there are no symbols to read.
9531
c43d3a48
CS
95322008-06-23 Craig Silverstein <csilvers@google.com>
9533
9534 * version.cc (version_string): Bump to 1.7
9535
5f494ea0
CS
95362008-06-18 Craig Silverstein <csilvers@google.com>
9537
9538 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9539 constant 0xFFFF to type Valtype.
9540 (Powerpc_relocate_functions::rel16_ha): Likewise.
9541
c42e122e
ILT
95422008-06-17 Ian Lance Taylor <iant@google.com>
9543
f34787f8
ILT
9544 * output.h (Output_section::Input_section): Initialize p2align_ to
9545 zero for Output_section_data constructors.
9546 (Output_section::Input_section::addralign): If not an input
9547 section, return the alignment of the Output_section_data.
9548 * testsuite/copy_test.cc: New file.
9549 * testsuite/copy_test_1.cc: New file.
9550 * testsuite/copy_test_2.cc: New file.
9551 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9552 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9553 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9554 (copy_test_1_pic.o, copy_test_1.so): New targets.
9555 (copy_test_2_pic.o, copy_test_2.so): New targets.
9556 * testsuite/Makefile.in: Rebuild.
9557
c42e122e
ILT
9558 * script-sections.cc (Script_sections::place_orphan): Initialize
9559 local variable exact.
9560
ce3ac18a
DE
95612008-06-13 David Edelsohn <edelsohn@gnu.org>
9562
9563 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9564
42cacb20
DE
95652008-06-12 David Edelsohn <edelsohn@gnu.org>
9566 David S. Miller <davem@davemloft.net>
9567
9568 * powerpc.cc: New file.
9569 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9570 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9571 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9572 * Makefile.in: Rebuild.
9573
7b308235
ILT
95742008-06-09 Ian Lance Taylor <iant@google.com>
9575
9576 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9577 <exception>.
9578 (throwing, orig_terminate): New static variables.
9579 (terminate_handler): New static function.
9580 (t2): Set terminate handler.
9581
f0b886e3
ILT
95822008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9583
9584 PR 6584
cd536b21 9585 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
9586 alignment.
9587
3e90f135
CC
95882008-05-30 Cary Coutant <ccoutant@google.com>
9589
9590 * archive.cc (Archive::include_all_members) Correct to step
9591 over symbol table and extended name table in thin archives.
9592
e09ad04a
ILT
95932008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9594
9595 PR 6407
9596 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9597 calculation.
9598
62b01cb5
ILT
95992008-05-28 Caleb Howe <cshowe@google.com>
9600
9601 * reduced_debug_output.cc: New file.
9602 * reduced_debug_output.h: New file.
92de84a6 9603 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
9604 * options.cc (General_options::finalize): Add strip_debug_non_line
9605 to the strip heirarchy.
9606 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9607 fields.
9608 * layout.cc: Include "reduced_debug_output.h".
9609 (Layout::Layout): Initialize new fields.
9610 (line_only_debug_sections): New static array.
9611 (is_lines_only_debug_sections): New static inline function.
9612 (Layout::include_section): Handle --strip-debug-non-line.
9613 (Layout::make_output_section): If --strip-debug-non-line, build
9614 new output sections for .debug_abbrev and .debug_info.
9615 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9616 gold. Warn about possible overflow.
9617 (read_signed_LEB_128): Likewise.
9618 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9619 (read_signed_LEB_128): Declare.
9620 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9621 (HFILES): Add reduced_debug_output.h.
9622 * Makefile.in: Rebuild.
9623
7d9e3d98
ILT
96242008-05-21 Ian Lance Taylor <iant@google.com>
9625
9626 * mapfile.cc: New file.
9627 * mapfile.h: New file.
9628 * options.h (class General_options): Add -M/--print-map and -Map.
9629 * options.cc (General_options::finalize): Make -M equivalent to
9630 -Map -.
9631 * main.cc: Include <cstdio> and "mapfile.h".
9632 (main): Open mapfile if requested.
9633 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9634 constructor. Change caller.
9635 (queue_initial_tasks): Add mapfile parameter. Change caller.
9636 (queue_middle_tasks): Likewise.
9637 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9638 declarations.
9639 * archive.cc: Include "mapfile.h".
9640 (Archive::add_symbols): Add mapfile parameter. Change all
9641 callers. Pass mapfile, symbol, and reason to include_member.
9642 (Archive::include_all_members): Add mapfile parameter. Change all
9643 callers.
9644 (Archive::include_member): Add mapfile, sym, and why parameters.
9645 Change all callers. Report inclusion to map file.
9646 * archive.h: Include "fileread.h".
9647 (class Archive): Update declarations.
9648 (Archive::file): New const method.
9649 (class Add_archive_symbols): Add mapfile_ field. Update
9650 constructor. Change all callers.
9651 * readsyms.h (class Read_symbols): Likewise.
9652 (class Finish_group): Likewise.
9653 (class Read_script): Likewise.
9654 * common.cc: Include "mapfile.h".
9655 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9656 all callers.
9657 (Symbol_table::do_allocate_commons): Likewise.
9658 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9659 symbol allocation to mapfile.
9660 * common.h (class Allocate_commons_task): Add mapfile_ field.
9661 Update constructor. Change all callers.
9662 * symtab.h (class Symbol_table): Update declarations.
9663 * layout.cc: Include "mapfile.h".
9664 (Layout_task_runner::run): Print information to mapfile.
9665 (Layout::create_gold_note): Change Output_data_fixed_space to
9666 Output_data_zero_fill.
9667 (Layout::create_build_id): Likewise.
9668 (Layout::print_to_mapfile): New function.
9669 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9670 constructor. Change caller.
9671 (class Layout): Declare print_to_mapfile.
9672 * output.cc (Output_section::Input_section::print_to_mapfile): New
9673 function.
9674 (Output_section::add_input_section): If producing a map, always
9675 add to input_sections_ list.
9676 (Output_section::do_print_to_mapfile): New function.
9677 (Output_segment::print_sections_to_mapfile): New function.
9678 (Output_segment::print_section_list_to_mapfile): New function.
9679 * output.h: Include "mapfile.h".
9680 (Output_data::print_to_mapfile): New function.
9681 (Output_data::do_print_to_mapfile): New virtual function.
9682 (Output_segment_headers::do_print_to_mapfile): New function.
9683 (Output_file_header::do_print_to_mapfile): New function.
9684 (Output_data_const::do_print_to_mapfile): New function.
9685 (class Output_data_const_buffer): Add map_name_ field. Update
9686 constructor. Change all callers. Add do_print_to_mapfile
9687 function.
9688 (class Output_data_fixed_space): Likewise.
9689 (class Output_data_space): Likewise.
9690 (class Output_data_zero_fill): New class.
9691 (Output_data_strtab::do_print_to_mapfile): New function.
9692 (Output_data_reloc_base::do_print_to_mapfile): New function.
9693 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9694 (Output_data_group::do_print_to_mapfile): New function.
9695 (Output_data_got::do_print_to_mapfile): New function.
9696 (Output_data_dynamic::do_print_to_mapfile): New function.
9697 (Output_symtab_xindex::do_print_to_mapfile): New function.
9698 (class Output_section): Declare do_print_to_mapflie. Declare
9699 print_to_mapfile in Input_section.
9700 (class Output_segment): Declare new functions.
9701 * object.h (Sized_relobj::symbol_count): New function.
9702 * script-sections.cc
9703 (Output_section_element_dot_assignment::set_section_addresses):
9704 Change Output_data_fixed_space to Output_data_zero_fill.
9705 (Output_data_expression::do_print_to_mapfile): New function.
9706 * script.cc (read_input_script): Add mapfile parameter. Change
9707 all callers.
9708 * script.h (read_input_script): Update declaration.
9709 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9710 (Eh_frame::do_print_to_mapfile): New function.
9711 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9712 (Output_merge_string::do_print_to_mapfile): New function.
9713 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9714 function.
9715 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9716 function.
9717 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9718 function.
9719 * Makefile.am (CCFILES): Add mapfile.cc.
9720 (HFILES): Add mapfile.h.
9721 * Makefile.in: Rebuild.
9722
9f1d377b
ILT
97232008-05-19 Ian Lance Taylor <iant@google.com>
9724
9725 * options.h (class General_options): Add -z relro.
9726 * layout.cc (Layout::Layout): Initialize relro_segment_.
9727 (Layout::add_output_section_data): Return the output section.
9728 (Layout::make_output_section): Rcognize relro sections and mark
9729 them appropriately.
9730 (Layout::attach_allocated_section_to_segment): Put relro sections
9731 in a PT_GNU_RELRO segment.
9732 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9733 section as relro.
9734 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9735 PT_TLS segments.
9736 (Layout::linkonce_mapping): Map d.rel.ro.local to
9737 .data.rel.ro.local.
9738 (Layout::output_section_name): Us .data.rel.ro.local for any
9739 section which begins with that.
9740 * layout.h (class Layout): Update add_output_section_data
9741 declaration. Add relro_segment_ field.
9742 * output.cc (Output_section::Output_section): Initialize is_relro_
9743 and is_relro_local_ fields.
9744 (Output_segment::add_output_section): Group relro sections.
9745 (Output_segment::is_first_section_relro): New function.
9746 (Output_segment::maximum_alignment): If there is a relro section,
9747 align the segment to the common page size.
9748 (Output_segment::set_section_addresses): Track whether we are
9749 looking at relro sections. If the last section is a relro
9750 section, align to the common page size.
9751 (Output_segment::set_section_list_addresses): Add in_relro
9752 parameter. Change all callers. Align to the page size when
9753 moving from relro to non-relro section.
9754 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9755 segment.
9756 * output.h (class Output_section): Add is_relro_ and
9757 is_relro_local_ fields.
9758 (Output_section::is_relro): New function.
9759 (Output_section::set_is_relro): New function.
9760 (Output_section::is_relro_local): New function.
9761 (Output_section::set_is_relro_local): New function.
9762 (class Output_segment): Update declarations.
9763 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9764 * sparc.cc (Target_sparc::got_section): Likewise.
9765 * x86_64.cc (Target_x86_64::got_section): Likewise.
9766 * testsuite/relro_test_main.cc: New file.
9767 * testsuite/relro_test.cc: New file.
9768 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9769 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9770 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9771 (relro_test.so, relro_test_pic.o): New targets.
9772 * testsuite/Makefile.in: Rebuild.
9773
a984ee1d
ILT
97742008-05-16 Ian Lance Taylor <iant@google.com>
9775
01676dcd
ILT
9776 * output.cc (Output_segment::add_output_section): Remove front
9777 parameter.
9778 * output.h (class Output_segment): Remove
9779 add_initial_output_section and overloaded add_output_section.
9780 Update declaration of remaining add_output_section.
9781 * layout.cc (Layout::create_interp): Call add_output_section
9782 rather than add_initial_output_section.
9783 (Layout::finish_dynamic_section): Likewise.
9784
497897f9
ILT
9785 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9786 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9787 know the dynamic type.
9788 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9789 field. Initialize it in constructor.
9790 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9791 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9792 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9793 reloc.
9794
a984ee1d
ILT
9795 * output.cc (Output_reloc::get_address): Change return type to
9796 Elf_Addr.
9797 * output.h (class Output_reloc): Update get_address declaration.
9798 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9799 for section addresses.
9800
55ba0940
ILT
98012008-05-09 Ian Lance Taylor <iant@google.com>
9802
9803 PR 6493
9804 * gold.cc (gold_nomem): Use return value of write.
9805
75517b77
ILT
98062008-05-08 Ian Lance Taylor <iant@google.com>
9807
9808 * symtab.c (Symbol::init_base_output_data): Add version
9809 parameter. Change all callers.
9810 (Symbol::init_base_output_segment): Likewise.
9811 (Symbol::init_base_constant): Likewise.
9812 (Symbol::init_base_undefined): Likewise.
9813 (Sized_symbol::init_output_data): Likewise.
9814 (Sized_symbol::init_output_segment): Likewise.
9815 (Sized_symbol::init_constant): Likewise.
9816 (Sized_symbol::init_undefined): Likewise.
9817 (Symbol_table::do_define_in_output_data): If the new symbol has a
9818 version, mark it as the default.
9819 (Symbol_table::do_define_in_output_segment): Likewise.
9820 (Symbol_table::do_define_as_constant): Likewise.
9821 * symtab.h (class Symbol): Update declarations.
9822 (class Sized_symbol): Likewise.
9823 * resolve.cc (Symbol::override_version): New function.
c42e122e 9824 (Symbol::override_base): Call override_version.
75517b77
ILT
9825 (Symbol::override_base_with_special): Likewise.
9826 * testsuite/ver_script_8.script: New file.
9827 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9828 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9829 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9830 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9831
f1f70eae
ILT
98322008-05-06 Ian Lance Taylor <iant@google.com>
9833
f3e9c5c5
ILT
9834 PR 6049
9835 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9836 functions.
9837 (class General_options): Remove existing --undefined, and add
9838 --no-undefined instead. Add new --undefined as synonym for -u.
9839 * archive.cc (Archive::add_symbols): Check whether symbol was
9840 named with -u.
9841 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9842 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9843 all uses. Add IS_UNDEFINED. Update declarations to split
9844 different versions of init_base. Declare init_base_undefined.
9845 (Symbol::is_defined): Handle IS_UNDEFINED.
9846 (Symbol::is_undefined): Likewise.
9847 (Symbol::is_weak_undefined): Call is_undefined.
9848 (Symbol::is_absolute): Handle IS_CONSTANT.
9849 (class Sized_symbol): Update declarations to split different
9850 versions of init. Declare init_undefined.
9851 (class Symbol_table): Declare new functions.
9852 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9853 Change all callers.
9854 (Symbol::init_base_output_data): Likewise.
9855 (Symbol::init_base_output_segment): Likewise.
9856 (Symbol::init_base_constant): Likewise.
9857 (Symbol::init_base_undefined): New function.
9858 (Sized_symbol::init_object): Rename from init. Change all
9859 callers.
9860 (Sized_symbol::init_output_data): Likewise.
9861 (Sized_symbol::init_output_segment): Likewise.
9862 (Sized_symbol::init_constant): Likewise.
9863 (Sized_symbol::init_undefined): New function.
9864 (Symbol_table::add_undefined_symbols_from_command_line): New
9865 function.
9866 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9867 function.
9868 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9869 (Symbol::output_section): Likewise.
9870 (Symbol::set_output_section): Likewise.
9871 (Symbol_table::sized_finalize_symbol): Likewise.
9872 (Symbol_table::sized_write_globals): Likewise.
9873 * resolve.cc (Symbol_table::should_override): Likewise.
9874 (Symbol::override_base_with_special): Likewise.
9875
8bdcdf2c
ILT
9876 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9877 symbol, change it to have default visibility.
9878 * testsuite/protected_1.cc: New file.
9879 * testsuite/protected_2.cc: New file.
9880 * testsuite/protected_3.cc: New file.
9881 * testsuite/protected_main_1.cc: New file.
9882 * testsuite/protected_main_2.cc: New file.
9883 * testsuite/protected_main_3.cc: New file.
9884 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9885 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9886 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9887 (protected_1.so): New target.
9888 (protected_1_pic.o, protected_2_pic.o): New targets.
9889 (protected_3_pic.o): New target.
9890 (check_PROGRAMS): Add protected_2.
9891 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9892 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9893 * testsuite/Makefile.in: Rebuild.
9894
2b706932
ILT
9895 * options.h (DEFINE_var): Add set_user_set_##varname__.
9896 (DEFINE_bool_alias): New macro.
9897 (class General_options): Define -Bstatic using DEFINE_bool_alias
9898 rather than DEFINE_special. Add --undefined as an alias for -z
9899 defs.
9900 * options.cc (General_options::parse_Bstatic): Remove.
9901
d82a5bcc
ILT
9902 * options.h (class General_options): Add --fatal-warnings.
9903 * main.cc (main): Implement --fatal-warnings.
9904 * errors.h (Errors::warning_count): New function.
9905
f1f70eae
ILT
9906 * options.h (class General_options): Add -Bsymbolic-functions.
9907 * symtab.h (Symbol::is_preemptible): Check for
9908 -Bsymbolic-functions.
9909
8825ac63
ILT
99102008-05-05 Ian Lance Taylor <iant@google.com>
9911
d98bc257
ILT
9912 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9913 as noVARNAME rather than no-VARNAME.
9914 (class General_options): Add option -z combreloc.
9915 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9916 get_address.
9917 (Output_reloc::sort_before) [SHT_REL]: New function.
9918 (Output_reloc::sort_before) [SHT_RELA]: New function.
9919 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9920 Sort_relocs_comparison.
9921 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9922 parameter. Change all callers.
9923 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9924 sort_relocs parameter. Change all callers.
9925 * output.cc (Output_reloc::get_address): New function, broken out
9926 of write_rel.
9927 (Output_reloc::write_rel): Call it.
9928 (Output_reloc::compare): New function.
9929 (Output_data_reloc_base::do_write): Optionally sort relocs.
9930
60b2b4e7
ILT
9931 * configure.ac: If targ_extra_obj is set, link it in.
9932 * configure.tgt: Initialize all variables.
9933 (x86_64*): Set targ_extra_obj and targ_extra_size.
9934 * configure: Rebuild.
9935
8825ac63
ILT
9936 * object.cc (Sized_relobj::include_section_group): Adjust section
9937 indexes read from group data. Build vector to pass to
9938 layout_group.
9939 * layout.cc (Layout::layout_group): Add flags and shndxes
9940 parameters. Remove contents parameter. Change caller. Update
9941 explicit instantiations.
9942 * layout.h (class Layout): Update layout_group declaration.
9943 * output.cc (Output_data_group::Output_data_group): Add flags and
9944 input_shndxes parameters. Remove contents parameter. Change
9945 caller.
9946 (Output_data_group::do_write): Change input_sections_ to
9947 input_shndxes_.
9948 * output.h (class Output_data_group): Update constructor
9949 declaration. Rename input_sections_ to input_shndxes_.
9950 * testsuite/many_sections_test.cc: Add template.
9951
e94cf127
CC
99522008-04-30 Cary Coutant <ccoutant@google.com>
9953
4418b2d5
CC
9954 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9955
e94cf127
CC
9956 * layout.cc (Layout::include_section): Refactored check for debug
9957 info section.
9958 (Layout::add_comdat): Add new parameters. Change type
9959 of signature parameter. Add object and shndx to signatures table.
9960 (Layout::find_kept_object): New function.
9961 * layout.h: Include <cstring>.
9962 (Layout::is_debug_info_section): New function.
9963 (Layout::add_comdat): Add new parameters.
9964 (Layout::find_kept_object): New function.
9965 (Layout::Kept_section): New struct.
9966 (Layout::Signatures): Change type of map range.
9967 * object.cc (Relobj::output_section_address): New function.
9968 (Sized_relobj::include_section_group): Add new parameters. Change
9969 calls to Layout::add_comdat. Change to build table of kept comdat
9970 groups and table mapping discarded sections to kept sections.
9971 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9972 (Sized_relobj::do_layout): Change calls to include_section_group and
9973 include_linkonce_section.
9974 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9975 value to zero when section is discarded.
9976 (Sized_relobj::map_to_kept_section): New function.
9977 * object.h (Relobj::output_section_address): New function.
9978 (Relobj::Comdat_group): New type.
9979 (Relobj::find_comdat_group): New function.
9980 (Relobj::Comdat_group_table): New type.
9981 (Relobj::Kept_comdat_section): New type.
9982 (Relobj::Kept_comdat_section_table): New type.
9983 (Relobj::add_comdat_group): New function.
9984 (Relobj::set_kept_comdat_section): New function.
9985 (Relobj::get_kept_comdat_section): New function.
9986 (Relobj::comdat_groups_): New field.
9987 (Relobj::kept_comdat_sections_): New field.
9988 (Symbol_value::input_value): Update comment.
9989 (Sized_relobj::map_to_kept_section) New function.
9990 (Sized_relobj::include_linkonce_section): Add new parameter.
9991 * target-reloc.h (Comdat_behavior): New type.
9992 (get_comdat_behavior): New function.
9993 (relocate_section): Add code to map a discarded section to the
9994 corresponding kept section when applying a relocation.
9995
e4e5049b
CS
99962008-04-30 Craig Silverstein <csilvers@google.com>
9997
9998 * dwarf_reader.cc (next_generation_count): New static var.
9999 (Addr2line_cache_entry): New struct.
10000 (addr2line_cache): New static var.
10001 (Dwarf_line_info::one_addr2line): Added caching.
10002 (Dwarf_line_info::clear_addr2line_cache): New function.
10003 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10004 cache-size parameter.
10005 (Dwarf_line_info::one_addr2line_cache): New function.
10006 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10007 new cache-size argument to one_addr2line(), and clear cache.
10008
d09e9154
CC
100092008-04-28 Cary Coutant <ccoutant@google.com>
10010
10011 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10012 R_386_PC8 relocations.
10013
7ef73768
ILT
100142008-04-23 Ian Lance Taylor <iant@google.com>
10015
55438702
ILT
10016 * object.cc (Sized_relobj::include_section_group): Check for
10017 invalid section group.
10018
c165fb93
ILT
10019 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10020 header size.
10021
7ef73768
ILT
10022 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10023 than read for file header.
10024 * archive.cc (Archive::include_member): Likewise.
10025
6194aaab
L
100262008-04-23 Paolo Bonzini <bonzini@gnu.org>
10027
10028 * aclocal.m4: Regenerate.
10029 * configure: Regenerate.
10030
d491d34e
ILT
100312008-04-19 Ian Lance Taylor <iant@google.com>
10032
5ea2bac6
ILT
10033 * version.cc (version_string): Bump to 1.6.
10034
7bc3e21a
ILT
10035 * testsuite/Makefile.am (many_sections_r_test): New target.
10036 (many_sections_r_test_SOURCES): Remove.
10037 (many_sections_r_test_DEPENDENCIES): Remove.
10038 (many_sections_r_test_LDFLAGS): Remove.
10039 (many_sections_r_test_LDADD): Remove.
10040
7fcd3aa9
ILT
10041 * object.cc (Sized_relobj::do_add_symbols): Always pass
10042 local_symbol_count_ to add_from_relobj.
10043
4c94d6ae
ILT
10044 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10045 every thousand variables.
10046 * testsuite/Makefile.in: Rebuild.
10047
d491d34e
ILT
10048 * object.cc (Xindex::initialize_symtab_xindex): New function.
10049 (Xindex::read_symtab_xindex): New function.
10050 (Xindex::sym_xindex_to_shndx): New function.
10051 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10052 available.
10053 (Sized_relobj::do_initialize_xindex): New function.
10054 (Sized_relobj::do_read_symbols): Adjust section links.
10055 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10056 parameter. Change all callers.
10057 (Sized_relobj::include_section_group): Adjust section links and
10058 symbol section indexes.
10059 (Sized_relobj::do_layout): Adjust section links.
10060 (Sized_relobj::do_count_local_symbols): Adjust section links and
10061 symbol section indexes.
10062 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10063 ordinary and special symbols.
10064 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10065 dynsym_xindex parameters. Change all callers. Adjust section
10066 links. Use SHN_XINDEX when needed.
10067 (Sized_relobj::get_symbol_location_info): Adjust section links.
10068 Don't get fooled by special symbols.
10069 * object.h (class Xindex): Define.
10070 (class Object): Add xindex_ parameter. Declare virtual functoin
10071 do_initialize_xindex.
10072 (Object::adjust_sym_shndx): New function.
10073 (Object::set_xindex): New protected function.
10074 (class Symbol_value): Add is_ordinary_shndx_ field.
10075 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10076 (Symbol_value::value): Assert ordinary section.
10077 (Symbol_value::initialize_input_to_output_map): Likewise.
10078 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10079 Change all callers.
10080 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10081 all callers.
10082 (class Sized_relobj): Update declarations.
10083 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10084 parameter. Change all callers.
10085 (Sized_relobj::adjust_shndx): New function.
10086 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10087 field.
10088 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10089 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10090 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10091 (Sized_dynobj::read_dynsym_section): Adjust section links.
10092 (Sized_dynobj::read_dynamic): Likewise.
10093 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10094 section links.
10095 (Sized_dynobj::do_initialize_xindex): New function.
10096 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10097 do_initialize_xindex.
10098 (Sized_dynobj::adjust_shndx): New function.
10099 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10100 dynsym_xindex_ fields.
10101 (Layout::finalize): Add a call to set_section_indexes before
10102 creating the symtab sections.
10103 (Layout::set_section_indexes): Don't do anything if the section
10104 already has a section index.
10105 (Layout::create_symtab_sections): Add shnum parameter. Change
10106 caller. Create .symtab_shndx section if needed.
10107 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10108 caller.
10109 (Layout::allocated_output_section_count): New function.
10110 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10111 needed.
10112 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10113 fields. Update declarations.
10114 (Layout::symtab_xindex): New function.
10115 (Layout::dynsym_xindex): New function.
10116 (class Write_symbols_task): Add layout_ field.
10117 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10118 Change caller.
10119 * output.cc (Output_section_headers::Output_section_headers): Add
10120 shstrtab_section parameter. Change all callers.
10121 (Output_section_headers::do_sized_write): Store overflow values
10122 for section count and section string table section index in
10123 section header zero.
10124 (Output_file_header::do_sized_write): Check for overflow of
10125 section count and section string table section index.
10126 (Output_symtab_xindex::do_write): New function.
10127 (Output_symtab_xindex::endian_do_write): New function.
10128 * output.h (class Output_section_headers): Add shstrtab_section_.
10129 Update declarations.
10130 (class Output_symtab_xindex): Define.
10131 (Output_section::has_out_shndx): New function.
10132 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10133 field.
10134 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10135 Change all callers.
10136 (Sized_symbol::init): Likewise.
10137 (Symbol::output_section): Check for ordinary symbol.
10138 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10139 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10140 callers.
10141 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10142 Change all callers. Simplify handling of symbols from sections
10143 not included in the link.
10144 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10145 distinction.
10146 (Weak_alias_sorter::operator()): Assert that symbols are
10147 ordinary.
10148 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10149 distinction.
10150 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10151 parameters. Change all callers.
10152 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10153 symbol distinction. Use SHN_XINDEX when needed.
10154 (Symbol_table::write_section_symbol): Add symtab_xindex
10155 parameter. Change all callers.
10156 (Symbol_table::sized_write_section_symbol): Likewise. Use
10157 SHN_XINDEX when needed.
10158 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10159 declarations.
10160 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10161 (Symbol::is_defined): Check is_ordinary.
10162 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10163 (Symbol::is_absolute, Symbol::is_common): Likewise.
10164 (class Sized_symbol): Update declarations.
10165 (class Symbol_table): Update declarations.
10166 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10167 parameters. Change all callers.
10168 (Sized_symbol::override): Likewise.
10169 (Symbol_table::override): Likewise.
10170 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10171 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10172 is_ordinary, and orig_st_shndx parameters. Change all callers.
10173 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10174 to be in an ordinary section.
10175 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10176 object and is_ordinary parameters. Change all callers.
10177 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10178 Change all callers. Don't add undefined or non-ordinary symbols
10179 to reloc_map_.
10180 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10181 Change all callers.
10182 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10183 declarations.
10184 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10185 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10186 (Sized_relobj::relocate_sections): Likewise.
10187 * target-reloc.h (scan_relocs): Adjust section symbol index.
10188 (scan_relocatable_relocs): Likewise.
10189 * i386.cc (Scan::local): Check for ordinary symbols.
10190 * sparc.cc (Scan::local): Likewise.
10191 * x86_64.cc (Scan::local): Likewise.
10192 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10193 to symbol_section_and_value.
10194 * testsuite/many_sections_test.cc: New file.
10195 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10196 (check_PROGRAMS): Add many_sections_test.
10197 (many_sections_test_SOURCES): Define.
10198 (many_sections_test_DEPENDENCIES): Define.
10199 (many_sections_test_LDFLAGS): Define.
10200 (BUILT_SOURCES): Add many_sections_define.h.
10201 (many_sections_define.h): New target.
10202 (BUILT_SOURCES): Add many_sections_check.h.
10203 (many_sections_check.h): New target.
10204 (check_PROGRAMS): Add many_sections_r_test.
10205 (many_sections_r_test_SOURCES): Define.
10206 (many_sections_r_test_DEPENDENCIES): Define.
10207 (many_sections_r_test_LDFLAGS): Define.
10208 (many_sections_r_test_LDADD): Define.
10209 (many_sections_r_test.o): New target.
10210 * testsuite/Makefile.in: Rebuild.
10211
c5818ff1
CC
102122008-04-17 Cary Coutant <ccoutant@google.com>
10213
10214 * errors.cc (Errors::info): New function.
10215 (gold_info): New function.
10216 * errors.h (Errors::info): New function.
10217 * gold.h (gold_info): New function.
10218 * object.cc (Input_objects::add_object): Print trace output.
10219 * options.cc (options::parse_set): New function.
10220 (General_options::parse_wrap): Deleted.
10221 (General_options::General_options): Deleted initializer.
10222 * options.h (options::String_set): New typedef.
10223 (options::parse_set): New function.
10224 (DEFINE_set): New macro.
10225 (General_options::wrap): Changed to use DEFINE_set. Changed
10226 callers of any_wrap_symbols and is_wrap_symbol.
10227 (General_options::trace, General_options::trace_symbol):
10228 New options.
10229 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10230 (General_options::wrap_symbols_): Deleted.
10231 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10232
b5be4a7c
DM
102332008-04-17 David S. Miller <davem@davemloft.net>
10234
10235 * options.cc (General_options::parse_V): New function.
10236 * options.h: Add entries for -V and -Qy.
10237
155a0dd7
ILT
102382008-04-17 Ian Lance Taylor <iant@google.com>
10239
10240 * common.cc (Symbol_table::allocate_commons): Remove options
10241 parameter. Change caller.
10242 (Symbol_table::do_allocate_commons): Remove options parameter.
10243 Change caller. Just call do_allocate_commons_list twice.
10244 (Symbol_table::do_allocate_commons_list): New function, broken out
10245 of do_allocate_commons.
10246 * common.h (class Allocate_commons_task): Remove options_ field.
10247 Update constructor.
10248 * symtab.cc (Symbol_table::Symbol_table): Initialize
10249 tls_commons_.
10250 (Symbol_table::add_from_object): Put TLS common symbols on
10251 tls_commons_ list.
10252 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10253 which are IN_OUTPUT_DATA.
10254 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10255 allocate_commons and do_allocate_commons declarations. Declare
10256 do_allocate_commons_list.
10257 * gold.cc (queue_middle_tasks): Update creation of
10258 Allocate_commons_task to not pass options.
10259 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10260 (TLS_TEST_C_FLAGS): New variable.
10261 (tls_test_c_pic.o): New target.
10262 (tls_test_shared.so): Link in tls_test_c_pic.o.
10263 (tls_test_c_pic_ie.o): New target.
10264 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10265 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10266 (tls_test_c.o): New target.
10267 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10268 (tls_pic_test_LDADD): Likewise.
10269 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10270 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10271 (tls_test_c_gnu2.o): New target.
10272 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10273 tls_test_c_gnu2.o.
10274 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10275 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10276 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10277 * testsuite/tls_test.cc: Include "config.h".
10278 (t_last): Call t11_last.
10279 * testsuite/tls_test.h (t11, t11_last): Declare.
10280 * testsuite/tls_test_c.c: New file.
10281 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10282 * configure.ac: Check for OpenMP support.
10283 * configure, config.in, Makefile.in: Rebuild.
10284 * testsuite/Makefile.in: Rebuild.
10285
edfbb029
CC
102862008-04-16 Cary Coutant <ccoutant@google.com>
10287
10288 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10289 (Target_i386::tls_base_symbol_defined_): New field.
10290 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10291 (Target_i386::Scan::global): Likewise.
10292 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10293 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10294 (Target_x86_64::tls_base_symbol_defined_): New field.
10295 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10296 (Target_x86_64::Scan::global): Likewise.
10297
f3c69fca
CC
102982008-04-16 Cary Coutant <ccoutant@google.com>
10299
10300 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10301 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10302 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10303 building shared libraries.
10304 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10305 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10306 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10307 * testsuite/Makefile.in: Rebuild.
10308 * testsuite/weak_undef.h: New file.
10309 * testsuite/weak_undef_file1.cc: Add extra test cases.
10310 * testsuite/weak_undef_file2.cc: Likewise.
10311 * testsuite/weak_undef_test.cc: Likewise.
10312
7c414435
DM
103132008-04-16 David S. Miller <davem@davemloft.net>
10314
32b769e1
DM
10315 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10316 Add issued_non_pic_error_ field. Declare check_non_pic.
10317 (Target_sparc::Scan::check_non_pic): New function.
10318 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10319 (Target_sparc::Scan::global): Likewise.
10320
11936fb1
DM
10321 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10322 * configure: Rebuild.
10323
7c414435
DM
10324 * options.h (DEFINE_enable): New macro.
10325 (new_dtags): New enable option.
10326 (initfirst, interpose, loadfltr, nodefaultlib,
10327 nodelete, nodlopen, nodump): New -z options.
10328 * layout.cc (Layout:finish_dynamic_section): If new
10329 dtags enabled, emit DT_RUNPATH. Also, emit a
10330 DT_FLAGS_1 containing any specified -z flags.
10331
85c7bf8b
ILT
103322008-04-16 Ian Lance Taylor <iant@google.com>
10333
12c0daef
ILT
10334 * copy-relocs.cc: New file.
10335 * copy-relocs.h: New file.
10336 * reloc.cc: Remove Copy_relocs code.
10337 * reloc.h: Likewise.
10338 * reloc-types.h (struct Reloc_types) [both versions]: Add
10339 get_reloc_addend_noerror.
10340 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10341 variants of add_global which take an addend which must be zero.
10342 * i386.cc: Include "copy-relocs.h".
10343 (class Target_i386): Change type of copy_relocs_ to variable,
10344 update initializer.
10345 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10346 Change all callers.
10347 (Target_i386::do_finalize_sections): Change handling of
10348 copy_relocs_.
10349 * sparc.cc: Include "copy-relocs.h".
10350 (class Target_sparc): Change type of copy_relocs_ to variable,
10351 update initializer.
10352 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10353 Change all callers.
10354 (Target_sparc::do_finalize_sections): Change handling of
10355 copy_relocs_.
10356 * x86_64.cc: Include "copy-relocs.h".
10357 (class Target_x86_64): Change type of copy_relocs_ to variable,
10358 update initializer.
10359 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10360 class. Change all callers.
10361 (Target_x86_64::do_finalize_sections): Change handling of
10362 copy_relocs_.
10363 * Makefile.am (CCFILES): Add copy-relocs.cc.
10364 (HFILES): Add copy-relocs.h.
10365
4f4995b6
ILT
10366 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10367
85c7bf8b
ILT
10368 * testsuite/script_test_4.sh: Permit leading zeroes.
10369
4f2a9edd
ILT
103702008-04-15 Ian Lance Taylor <iant@google.com>
10371
e6188289
ILT
10372 * script-sections.cc (Script_sections::create_segments): Use
10373 header_size_adjustment even when there is enough room for the
10374 headers.
10375 * testsuite/script_test_4.sh: New file.
10376 * testsuite/script_test_4.t: New file.
10377 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10378 (check_DATA): Add script_test_4.stdout.
10379 (MOSTLYCLEANFILES): Likewise.
10380 (script_test_4): New target.
10381 (script_test_4.stdout): New target.
10382 * testsuite/Makefile.in: Rebuild.
10383
4f2a9edd
ILT
10384 * sparc.cc: Add definitions for Output_data_plt_sparc class
10385 constants.
10386
f5314dd5
DM
103872008-04-14 David S. Miller <davem@davemloft.net>
10388
10389 * sparc.cc: New file.
10390 * Makefile.am (TARGETSOURCES): Add sparc.cc
10391 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10392 * configure.tgt: Document targ_extra_size and
10393 targ_extra_big_endian. Add entries for sparc-* and
10394 sparc64-*.
10395 * configure.ac: Handle targ_extra_size and
10396 targ_extra_big_endian.
10397 * Makefile.in: Rebuild.
10398 * configure: Likewise.
10399 * po/POTFILES.in: Likewise.
10400 * po/gold.pot: Likewise.
10401
154e0e9a
ILT
104022008-04-14 Ian Lance Taylor <iant@google.com>
10403
10404 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10405 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10406 in the name/type/flags to section mapping. Don't call
10407 allocate_output_section.
10408 (Layout::choose_output_section): Change parameter from adjust_name
10409 to is_input_section. Don't permit input sections after sections
10410 are attached to segments. Don't call allocate_output_section.
10411 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10412 not write_enable_output_section.
10413 (Layout::make_output_section): Don't push to
10414 unattached_section_list_ nor call attach_to_segment. Call
10415 attach_section_to_segment if sections are attached.
10416 (Layout::attach_sections_to_segments): New function.
10417 (Layout::attach_section_to_segment): New function.
10418 (Layout::attach_allocated_section_to_segment): Rename from
10419 attach_to_segment. Remove flags parameter.
10420 (Layout::allocate_output_section): Remove function.
10421 (Layout::write_enable_output_section): Remove function.
10422 * layout.h (class Layout): Update for above changes. Add new
10423 field sections_are_attached_.
10424 * output.h (Output_section::update_flags_for_input_section): New
10425 function.
10426 * output.cc (Output_section::add_input_section): Call
10427 update_flags_for_input_section.
10428 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10429
009a67a2
CC
104302008-04-11 Cary Coutant <ccoutant@google.com>
10431
10432 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10433 thought unnecessary.
10434 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10435
759b1a24
ILT
104362008-04-11 Ian Lance Taylor <iant@google.com>
10437
10438 * output.h (class Output_section_data): Remove inline definition
10439 of set_addralign.
10440 * output.cc (Output_section_data::set_addralign): New function.
10441
c2b45e22
CC
104422008-04-11 Cary Coutant <ccoutant@google.com>
10443
10444 Add support for TLS descriptors for i386 and x86_64.
10445 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10446 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10447 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10448 GOT_TYPE_TLS_DESC.
10449 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10450 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10451 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10452 relocations.
10453 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10454 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10455 Fix problem with initial-exec relocations.
10456 (Target_i386::Relocate::relocate_tls): Likewise.
10457 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10458 relaxation.
10459 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10460 support for section-plus-offset dynamic table entries.
10461 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10462 (Output_data_dynamic::Dynamic_entry): Add support for
10463 section-plus-offset dynamic table entries.
10464 (Output_data_dynamic::Classification): Likewise.
10465 (Output_data_dynamic::classification_): Renamed offset_.
10466 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10467 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10468 (Target_x86_64::make_plt_section): New function.
10469 (Target_x86_64::reserve_tlsdesc_entries): New function.
10470 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10471 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10472 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10473 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10474 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10475 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10476 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10477 add extra PLT entry for TLS descriptors.
10478 (Output_data_plt_x86_64::got_): New field.
10479 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10480 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10481 fields.
10482 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10483 descriptors.
10484 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10485 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10486 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10487 R_386_TLS_DESC_CALL relocations.
10488 (Target_x86_64::Scan::global): Likewise.
10489 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10490 for TLS descriptors.
10491 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10492 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10493 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10494 GD-to-IE relaxation.
10495 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10496 and TLS_DESCRIPTORS.
10497 * Makefile.in: Rebuild.
10498 * configure: Rebuild.
10499 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10500 (tls_test_shared2.so): New target.
10501 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10502 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10503 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10504 (tls_shared_gd_to_ie_test_LDADD): New variable.
10505 (tls_shared_gnu2_gd_to_ie_test): New target.
10506 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10507 New targets.
10508 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10509 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10510 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10511 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10512 (tls_shared_gnu2_test): New target.
10513 (tls_test_gnu2_shared.so): New target.
10514 (tls_shared_gnu2_test_SOURCES): New variable.
10515 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10516 (tls_shared_gnu2_test_LDFLAGS): New variable.
10517 (tls_shared_gnu2_test_LDADD): New variable.
10518 * testsuite/Makefile.in: Rebuild.
10519 * testsuite/Makefile.
10520
83bfb6b7
ILT
105212008-04-11 Ian Lance Taylor <iant@google.com>
10522
10523 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10524 justsyms.t.
10525 * testsuite/Makefile.in: Rebuild.
10526
10527 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10528 long.
10529 * testsuite/script_test_2.cc (main): Adjust test.
10530
706e1f5e
ILT
105312008-04-11 David S. Miller <davem@davemloft.net>
10532 Ian Lance Taylor <iant@google.com>
10533
10534 * options.h (General_options): Add entries for '-Y' and
10535 '-relax'.
10536 * options.cc (General_options:finalize): If -Y was used, add those
10537 entries to the library path instead of the default "/lib" and
10538 "/usr/lib".
10539
7c98e6bb
DM
105402008-04-11 David S. Miller <davem@davemloft.net>
10541
10542 * testsuite/justsyms.t: Start at 0x100.
10543 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
10544 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10545 long.
10546 * testsuite/script_test_2.cc: Adjust string and section length
10547 checks.
7c98e6bb 10548
99a37bfd
ILT
105492008-04-09 Ian Lance Taylor <iant@google.com>
10550
2cefc357
ILT
10551 PR gold/5996
10552 * script-sections.cc (Sections_element::allocate_to_segment): Add
10553 orphan parameter.
10554 (Output_section_definition::allocate_to_segment): Likewise.
10555 (Orphan_output_section::allocate_to_segment): Likewise.
10556 (Script_sections::attach_sections_using_phdrs_clause): Don't
10557 propagate non-PT_LOAD segments to orphan sections.
10558 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10559 readelf rather than objdump.
10560 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10561 .interp section and PT_INTERP segment are the same size.
10562 * testsuite/Makefile.in: Rebuild.
10563
99a37bfd
ILT
10564 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10565 aliases for symbols defined in the same object.
10566 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10567 (weak_alias_test_SOURCES): New variable.
10568 (weak_alias_test_DEPENDENCIES): New variable.
10569 (weak_alias_test_LDFLAGS): New variable.
10570 (weak_alias_test_LDADD): New variable.
10571 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10572 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10573 (weak_alias_test_3.o): New target.
10574 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10575 * testsuite/weak_alias_test_main.cc: New file.
10576 * testsuite/weak_alias_test_1.cc: New file.
10577 * testsuite/weak_alias_test_2.cc: New file.
10578 * testsuite/weak_alias_test_3.cc: New file.
10579
780e49c5
ILT
105802008-04-08 Ian Lance Taylor <iant@google.com>
10581
cdb0b8f5
ILT
10582 * options.h (class General_options): Add --noinhibit-exec option.
10583 * main.cc (main): Check --noinhibit-exec.
10584
0864d551
ILT
10585 * options.h (class General_options): Define --wrap as a special
10586 option. Add wrap_symbols_ field.
10587 (General_options::any_wrap_symbols): New function.
10588 (General_options::is_wrap_symbol): New function.
10589 * options.cc (General_options::parse_wrap): New function.
10590 (General_options::General_options): Initialize wrap_symbols_.
10591 * symtab.cc (Symbol_table::wrap_symbol): New function.
10592 (Symbol_table::add_from_object): Handle --wrap.
10593 * symtab.h (class Symbol_table): Declare wrap_symbol.
10594 * target.h (Target::wrap_char): New function.
10595 (Target::Target_info): Add wrap_char field.
10596 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10597 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10598 * testsuite/testfile.cc (Target_test::test_target_info):
10599 Likewise.
10600
789aa6de
ILT
10601 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10602 there is one.
10603
2c38906f
ILT
10604 * layout.h (class Layout): Add added_eh_frame_data_ field.
10605 * layout.cc (Layout::Layout): Initialize new field.
10606 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10607 output section until we find a section we merged successfully.
10608 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10609 that the size be non-zero.
10610
780e49c5
ILT
10611 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10612 qualifier.
10613
7fcd0256
ILT
106142008-04-08 Craig Silverstein <csilvers@google.com>
10615
10616 * configure.ac: Export new conditional variable HAVE_ZLIB.
10617 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10618 on HAVE_ZLIB.
10619 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10620 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10621
6835af53
ILT
106222008-04-07 Ian Lance Taylor <iant@google.com>
10623
e24f324c
ILT
10624 * version.cc (version_string): Set to "1.5".
10625
a036edd8
ILT
10626 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10627 Add issued_non_pic_error_ field. Declare check_non_pic.
10628 (Target_x86_64::Scan::check_non_pic): New function.
10629 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10630 (Target_x86_64::Scan::global): Likewise.
10631
624f8810
ILT
10632 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10633 addend parameter. Change caller. Handle merge sections.
10634 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10635 Address to Addend. Don't add in the result of
10636 local_section_offset, pass down the addend and use the returned
10637 value.
10638 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10639 Update declarations of local_section_offset and symbol_value.
10640 * testsuite/two_file_test_1.cc (t18): New function.
10641 * testsuite/two_file_test_2.cc (f18): New function.
10642 * testsuite/two_file_test_main.cc (main): Call t18.
10643 * testsuite/two_file_test.h (t18, f18): Declare.
10644
6835af53
ILT
10645 * configure.ac: Don't test for objdump, c++filt, or readelf.
10646 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10647 conditionals.
10648 (TEST_READELF): New variable.
10649 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10650 (check_PROGRAMS): Add two_file_strip_test.
10651 (two_file_strip_test): New target.
10652 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10653 (two_file_same_shared_strip_test_SOURCES): New variable.
10654 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10655 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10656 (two_file_same_shared_strip_test_LDADD): New variable.
10657 (two_file_shared_strip.so): New target.
10658 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10659 (ver_test_5.syms, ver_test_7.syms): Likewise.
10660 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10661 (strip_test_3.stdout): Use TEST_OBJDUMP.
10662 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10663
86925eef
CC
106642008-04-04 Cary Coutant <ccoutant@google.com>
10665
10666 * symtab.h (Symbol::is_weak_undefined): New function.
10667 (Symbol::is_strong_undefined): New function.
10668 (Symbol::is_absolute): New function.
10669 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10670 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10671 absolute symbols.
10672 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10673 (weak_undef_test): New target.
10674 * testsuite/Makefile.in: Rebuild.
10675 * testsuite/weak_undef_file1.cc: New file.
10676 * testsuite/weak_undef_file2.cc: New file.
10677 * testsuite/weak_undef_test.cc: New file.
10678
126f3ece
ILT
106792008-04-03 Craig Silverstein <csilvers@google.com>
10680
10681 * compressed_output.h (class Output_compressed_section): Use
10682 unsigned buffer.
10683 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10684 add zlib header.
10685 (zlib_compressed_suffix): Removed.
10686 (Output_compressed_section::set_final_data_size): Use unsigned
10687 buffers.
10688 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10689 Fix linker invocation.
10690 (flagstest_o_specialfile_and_compress_debug_sections):
10691 Likewise.
10692 * testsuite/Makefile.in: Regenerated.
10693
deae2a14
DM
106942008-04-02 David S. Miller <davem@davemloft.net>
10695
10696 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10697 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10698
70752818
ILT
106992008-04-02 Craig Silverstein <csilvers@google.com>
10700
10701 * TODO: New file.
10702
39d0cb0e
ILT
107032008-04-02 Ian Lance Taylor <iant@google.com>
10704
10705 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10706 parameters. Update for new key type to views_. Change all
10707 callers.
10708 (File_read::read): Adjust for byteshift in returned view.
10709 (File_read::add_view): New function, broken out of
10710 find_and_make_view.
10711 (File_read::make_view): New function, broken out of
10712 find_and_make_view.
10713 (File_read::find_or_make_view): Add offset and aligned
10714 parameters. Rewrite accordingly. Change all callers.
10715 (File_read::get_view): Add offset and aligned parameters. Adjust
10716 for byteshift in return value.
10717 (File_read::get_lasting_view): Likewise.
10718 * fileread.h (class File_read): Update declarations.
10719 (class File_read::View): Add byteshift_ field. Add byteshift to
10720 constructor. Add byteshift method.
10721 * archive.h (Archive::clear_uncached_views): New function.
10722 (Archive::get_view): Add aligned parameter. Change all callers.
10723 * object.h (Object::get_view): Add aligned parameter. Change all
10724 callers.
10725 (Object::get_lasting_view): Likewise.
10726
10727 * fileread.cc (File_read::release): Don't call clear_views if
10728 there are multiple objects.
10729 * fileread.h (File_read::clear_uncached_views): New function.
10730 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10731 on the archive.
10732
a1207466
CC
107332008-03-31 Cary Coutant <ccoutant@google.com>
10734
10735 Add thin archive support.
10736 * archive.cc (Archive::armagt): New const.
10737 (Archive::setup): Remove task parameter and calls to unlock.
10738 (Archive::unlock_nested_archives): New function.
10739 (Archive::read_header): Add nested_off parameter. Change
10740 all callers.
10741 (Archive::interpret_header): Likewise.
10742 (Archive::include_all_members): Change to handle thin
10743 archives.
10744 (Archive::include_member): Likewise.
10745 * archive.h (Archive::Archive): Add new parameters and
10746 initializers.
10747 (Archive::armagt): New const.
10748 (Archive::setup): Remove task parameter.
10749 (Archive::unlock_nested_archives): New function.
10750 (Archive::read_header): Add nested_off parameter.
10751 (Archive::interpret_header): Likewise.
10752 (Archive::Nested_archive_table): New typedef.
10753 (Archive::is_thin_archive_): New field.
10754 (Archive::nested_archives_): New field.
10755 (Archive::options_): New field.
10756 (Archive::dirpath_): New field.
10757 (Archive::task_): New field.
10758 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10759 for thin archives. Pass additional parameters to
10760 Archive::Archive. Unlock the archive file after calling
10761 Archive::setup.
cd536b21 10762
479f6503
ILT
107632008-03-29 Ian Lance Taylor <iant@google.com>
10764
686c8caf
ILT
10765 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10766 version symbol to be local.
10767 * testsuite/ver_test_4.sh: New file.
10768 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10769 (check_DATA): Add ver_test_4.syms.
10770 (ver_test_4.syms): New target.
10771 * testsuite/Makefile.in: Rebuild.
10772
ab794b6b
ILT
10773 * output.cc
10774 (Output_section::Input_section_sort_entry::has_priority): New
10775 function.
10776 (Output_section::Input_section_sort_entry::match_file_name): New
10777 function.
10778 (Output_section::Input_section_sort_entry::match_section_name):
10779 Remove.
10780 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10781 Remove.
10782 (Output_section::Input_section_sort_entry::match_section_file):
10783 Remove.
10784 (Output_section::Input_section_sort_compare::operator()): Rewrite
10785 using new Input_section_sort_entry functions. Sort crtbegin and
10786 crtend first. Sort sections with no priority before sections with
10787 a priority.
10788 * testsuite/initpri1.c (d3): Check j != 4.
10789 (cd5): New constructor/destructor function.
10790 (main): Check j != 2.
10791
479f6503
ILT
10792 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10793 new symbol when resolving, don't call set_is_default.
10794 * testsuite/ver_test_7.cc: New file.
10795 * testsuite/ver_test_7.sh: New file.
10796 * testsuite/Makefile.am (ver_test_7.so): New target.
10797 (ver_test_7.o): New target.
10798 (check_SCRIPTS): Add ver_test_7.sh.
10799 (check_DATA): Add ver_test_7.syms.
10800 (ver_test_7.syms): New target.
10801
2fd32231
ILT
108022008-03-28 Ian Lance Taylor <iant@google.com>
10803
10804 * layout.cc (Layout::layout): If we see an input section with a
10805 name that needs sorting, set the must_sort flag for the output
10806 section.
10807 (Layout::make_output_section): If the name of the output section
10808 indicates that it might require sorting, set the may_sort flag.
10809 * output.h (Output_section::may_sort_attached_input_sections): New
10810 function.
10811 (Output_section::set_may_sort_attached_input_sections): New
10812 function.
10813 (Output_section::must_sort_attached_input_sections): New
10814 function.
10815 (Output_section::set_must_sort_attached_input_sections): New
10816 function.
10817 (class Output_section): Declare Input_section_sort_entry. Define
10818 Input_section_sort_compare. Declare
10819 sort_attached_input_sections. Add new fields:
10820 may_sort_attached_input_sections_,
10821 must_sort_attached_input_sections_,
10822 attached_input_sections_are_sorted_.
10823 * output.cc (Output_section::Output_section): Initialize new
10824 fields.
10825 (Output_section::add_input_section): Add an entry to
10826 input_sections_ if may_sort or must_sort are true.
10827 (Output_section::set_final_data_size): Call
10828 sort_attached_input_sections if necessary.
10829 (Output_section::Input_section_sort_entry): Define new class.
10830 (Output_section::Input_section_sort_compare::operator()): New
10831 function.
10832 (Output_section::sort_attached_input_sections): New function.
10833 * configure.ac: Check whether the compiler supports constructor
10834 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10835 * testsuite/initpri1.c: New file.
10836 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10837 CONSTRUCTOR_PRIORITY.
10838 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10839 (initpri1_LDFLAGS): New variable.
10840 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10841
18e6b24e
ILT
108422008-03-27 Ian Lance Taylor <iant@google.com>
10843
49bdd526
ILT
10844 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10845 * testsuite/common_test_1.c: New file.
10846 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10847 (common_test_1_SOURCES): New variable.
10848 (common_test_1_DEPENDENCIES): New variable.
10849 (common_test_1_LDFLAGS): New variable.
10850
18e6b24e
ILT
10851 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10852 and commons_ correctly when NAME/VERSION does not override
10853 NAME/NULL.
10854 * testsuite/ver_test_6.c: New file.
10855 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10856 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10857 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10858
04bf7072
ILT
108592008-03-26 Ian Lance Taylor <iant@google.com>
10860
5871526f
ILT
10861 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10862 of an undefined symbol from a version script.
10863 * testsuite/Makefile.am (ver_test_5.so): New target.
10864 (ver_test_5.o): New target.
10865 (check_SCRIPTS): Add ver_test_5.sh.
10866 (check_DATA): Add ver_test_5.syms.
10867 (ver_test_5.syms): New target.
10868 * testsuite/ver_test_5.cc: New file.
10869 * testsuite/ver_test_5.script: New file.
10870 * testsuite/ver_test_5.sh: New file.
10871 * Makefile.in, testsuite/Makefile.in: Rebuild.
10872
04bf7072
ILT
10873 PR gold/5986
10874 Fix problems building gold with gcc 4.3.0.
10875 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10876 (gold_error_at_location, gold_warning_at_location): Use it.
10877 * configure.ac: Check whether we can compile and use a template
10878 function with a printf attribute.
10879 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10880 when jumping over bytes.
10881 * object.cc: Instantiate Object::read_section_data.
10882 * debug.h: Include <cstring>
10883 * dwarf_reader.cc: Include <algorithm>
10884 * main.cc: Include <cstring>.
10885 * options.cc: Include <cstring>.
10886 * output.cc: Include <cstring>.
10887 * script.cc: Include <cstring>.
10888 * script.h: Include <string>.
10889 * symtab.cc: Include <cstring> and <algorithm>.
10890 * target-select.cc: Include <cstring>.
10891 * version.cc: Include <string>.
10892 * testsuite/testmain.cc: Include <cstdlib>.
10893 * configure, config.in: Rebuild.
10894
874c5b28
ILT
108952008-03-25 Ian Lance Taylor <iant@google.com>
10896
819d6c3a
ILT
10897 * options.cc: Include "../bfd/bfdver.h".
10898 (options::help): Print bug reporting address.
10899
f4b2c6f5
ILT
10900 * version.cc (print_version): Adjust output for current value of
10901 BFD_VERSION_STRING.
10902
10903 * NEWS: New file.
10904
e96caa79
ILT
10905 * options.cc (options::help): Print list of supported targets.
10906 * target-select.h: Include <vector>.
10907 (class Target_selector): Make machine_, size_, and is_big_endian_
10908 fields const. Add bfd_name_ and instantiated_target_ fields.
10909 (Target_selector::Target_selector): Add bfd_name parameter.
10910 (Target_selector::recognize): Make non-virtual, call
10911 do_recognize.
10912 (Target_selector::recognize_by_name): Make non-virtual, call
10913 do_recognize_by_name.
10914 (Target_selector::supported_names): New function.
10915 (Target_selector::bfd_name): New function.
10916 (Target_selector::do_instantiate_target): New pure virtual
10917 function.
10918 (Target_selector::do_recognize): New virtual function.
10919 (Target_selector::do_recognize_by_name): New virtual function.
10920 (Target_selector::instantiate_target): New private function.
10921 (supported_target_names): Declare.
10922 * target-select.cc (Target_selector::Target_selector): Update for
10923 new parameter and fields.
10924 (select_target_by_name): Check that the name matches before
10925 calling recognize_by_name.
10926 (supported_target_names): New function.
10927 * i386.cc (class Target_selector_i386): Update Target_selector
10928 constructor call. Remove recognize and recognize_by_name. Add
10929 do_instantiate_target.
10930 * x86_64.cc (class Target_selector_x86_64): Likewise.
10931 * testsuite/testfile.cc (class Target_selector_test): Update for
10932 changes to Target_selector.
10933
874c5b28
ILT
10934 * README: Rewrite, with some notes on unsupported features.
10935
0a65a3a7
CC
109362008-03-24 Cary Coutant <ccoutant@google.com>
10937
10938 * i386.cc (Target_i386::Got_type): New enum declaration.
10939 (Target_i386::Scan::local): Updated callers of Output_data_got
10940 member functions.
10941 (Target_i386::Scan::global): Likewise.
10942 (Target_i386::Relocate::relocate): Likewise.
10943 (Target_i386::Relocate::relocate_tls): Likewise.
10944 * object.h (Got_offset_list): New class.
10945 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10946 (Sized_relobj::local_got_offset): Likewise.
10947 (Sized_relobj::set_local_got_offset): Likewise.
10948 (Sized_relobj::local_has_tls_got_offset): Removed.
10949 (Sized_relobj::local_tls_got_offset): Removed.
10950 (Sized_relobj::set_local_tls_got_offset): Removed.
10951 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10952 * output.cc (Output_data_got::add_global): Added got_type parameter.
10953 (Output_data_got::add_global_with_rel): Likewise.
10954 (Output_data_got::add_global_with_rela): Likewise.
10955 (Output_data_got::add_global_pair_with_rel): New function.
10956 (Output_data_got::add_global_pair_with_rela): New function.
10957 (Output_data_got::add_local): Added got_type parameter.
10958 (Output_data_got::add_local_with_rel): Likewise.
10959 (Output_data_got::add_local_with_rela): Likewise.
10960 (Output_data_got::add_local_pair_with_rel): New function.
10961 (Output_data_got::add_local_pair_with_rela): New function.
10962 (Output_data_got::add_global_tls): Removed.
10963 (Output_data_got::add_global_tls_with_rel): Removed.
10964 (Output_data_got::add_global_tls_with_rela): Removed.
10965 (Output_data_got::add_local_tls): Removed.
10966 (Output_data_got::add_local_tls_with_rel): Removed.
10967 (Output_data_got::add_local_tls_with_rela): Removed.
10968 * output.h (Output_data_got::add_global): Added got_type parameter.
10969 (Output_data_got::add_global_with_rel): Likewise.
10970 (Output_data_got::add_global_with_rela): Likewise.
10971 (Output_data_got::add_global_pair_with_rel): New function.
10972 (Output_data_got::add_global_pair_with_rela): New function.
10973 (Output_data_got::add_local): Added got_type parameter.
10974 (Output_data_got::add_local_with_rel): Likewise.
10975 (Output_data_got::add_local_with_rela): Likewise.
10976 (Output_data_got::add_local_pair_with_rel): New function.
10977 (Output_data_got::add_local_pair_with_rela): New function.
10978 (Output_data_got::add_global_tls): Removed.
10979 (Output_data_got::add_global_tls_with_rel): Removed.
10980 (Output_data_got::add_global_tls_with_rela): Removed.
10981 (Output_data_got::add_local_tls): Removed.
10982 (Output_data_got::add_local_tls_with_rel): Removed.
10983 (Output_data_got::add_local_tls_with_rela): Removed.
10984 * resolve.cc (Symbol::override_base_with_special): Removed
10985 reference to has_got_offset_ field.
10986 * symtab.cc (Symbol::init_fields): Replaced initialization
10987 of got_offset_ with got_offsets_. Removed initialization
10988 of has_got_offset_
53fcba31 10989 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
10990 (Symbol::got_offset): Likewise.
10991 (Symbol::set_got_offset): Likewise.
10992 (Symbol::has_tls_got_offset): Removed.
10993 (Symbol::tls_got_offset): Removed.
10994 (Symbol::set_tls_got_offset): Removed.
10995 (Symbol::got_offset_): Removed.
10996 (Symbol::tls_mod_got_offset_): Removed.
10997 (Symbol::tls_pair_got_offset_): Removed.
10998 (Symbol::got_offsets_): New field.
10999 (Symbol::has_got_offset): Removed.
11000 (Symbol::has_tls_mod_got_offset): Removed.
11001 (Symbol::has_tls_pair_got_offset): Removed.
11002 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11003 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11004 member functions.
11005 (Target_x86_64::Scan::global): Likewise.
11006 (Target_x86_64::Relocate::relocate): Likewise.
11007 (Target_x86_64::Relocate::relocate_tls): Likewise.
11008
bd52eafb
BE
110092008-03-25 Ben Elliston <bje@au.ibm.com>
11010
11011 * yyscript.y: Fix spelling error in comment.
11012
8b105e34
ILT
110132008-03-24 Ian Lance Taylor <iant@google.com>
11014
8ed814a9
ILT
11015 * options.h (class General_options): Define build_id option.
11016 * layout.h (class Layout): Declare write_build_id, create_note,
11017 create_build_id. Add build_id_note_ member.
11018 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11019 "libiberty.h", "md5.h", "sha1.h".
11020 (Layout::Layout): Initialize eh_frame_data_,
11021 eh_frame_hdr_section_, and build_id_note_.
11022 (Layout::finalize): Call create_build_id.
11023 (Layout::create_note): New function, broken out of
11024 Layout::create_gold_note.
11025 (Layout::create_gold_note): Call create_note.
11026 (Layout::create_build_id): New function.
11027 (Layout::write_build_id): New function.
11028 (Close_task_runner::run): Call write_build_id.
11029
8b105e34
ILT
11030 * x86_64.cc: Correct license to GPLv3.
11031
086a1841
ILT
110322008-03-23 Ian Lance Taylor <iant@google.com>
11033
11034 * options.cc: Include "demangle.h".
11035 (parse_optional_string): New function.
11036 (parse_long_option): Handle takes_optional_argument.
11037 (parse_short_option): Update dash_z initializer. Handle
11038 takes_optional_argument.
11039 (General_options::General_options): Initialize do_demangle_.
11040 (General_options::finalize): Set do_demangle_. Handle demangling
11041 style.
11042 * options.h (parse_optional_string): Declare.
11043 (struct One_option): Add optional_arg field. Update constructor.
11044 Update call constructor calls. Add takes_optional_argument
11045 function.
11046 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11047 (DEFINE_optional_string): Define.
11048 (General_options::demangle): Change from DEFINE_bool to
11049 DEFINE_optional_string.
11050 (General_options::no_demangle): New function.
11051 (General_options::do_demangle): New function.
11052 (General_options::set_do_demangle): New function.
11053 (General_options::execstack_status_): Move definition to end of
11054 class definition.
11055 (General_options::static_): Likewise.
11056 (General_options::do_demangle_): New field.
11057 * object.cc (big_endian>::get_symbol_location_info): Call
11058 Options::do_demangle, not Options::demangle.
11059 * symtab.cc (demangle): Likewise.
11060
cbb93e63
ILT
110612008-03-22 Ian Lance Taylor <iant@google.com>
11062
11063 * gold.h: Include <cstddef> and <sys/types.h>
11064 * options.h: Include <cstring>.
11065
ec531623
ILT
110662008-03-21 Ian Lance Taylor <iant@google.com>
11067
11068 * Added source code to GNU binutils.
This page took 0.671278 seconds and 4 git commands to generate.