1 2011-04-22 Doug Kwan <dougkwan@google.com>
3 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4 flag of a SHT_ARM_EXIDX section.
5 * testsuite/Makefile.am (arm_exidx_test): New test rules.
6 * testsuite/Makefile.in: Regenerate.
7 * testsuite/arm_exidx_test.s: New file.
8 * testsuite/arm_exidx_test.sh: Same.
10 2011-04-20 Cary Coutant <ccoutant@google.com>
13 * archive.h (Incremental_archive_entry::Archive_member):
14 Initialize arg_serial_ (second constructor).
16 2011-04-17 Ian Lance Taylor <iant@google.com>
18 * object.cc (Relocate_info::location): Simplify location string.
19 * errors.cc (Errors::error_at_location): Don't print program
21 (Errors::warning_at_location): Likewise.
22 (Errors::undefined_symbol): Likewise.
23 * testsuite/debug_msg.sh: Update accordingly.
25 2011-04-14 Cary Coutant <ccoutant@google.com>
27 * gold/layout.cc (Layout::symtab_section_offset): New function.
28 * gold/layout.h (Layout::symtab_section_offset): New function.
29 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
31 2011-04-12 Ian Lance Taylor <iant@google.com>
33 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
35 * output.h (class Output_file): Add map_is_allocated_ field.
36 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
37 not available, provide stubs. If mremap is not available, #define
39 (MREMAP_MAYMOVE): Define if not defined.
40 (Output_file::Output_file): Initialize map_is_allocated_.
41 (Output_file::resize): Check map_is_allocated_.
42 (Output_file::map_anonymous): If mmap fails, use malloc.
43 (Output_file::unmap): Don't do anything for an anonymous map.
44 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
45 is not available, provide stubs.
46 (File_read::View::~View): Use free rather than delete[].
47 (File_read::make_view): Use malloc rather than new[]. If mmap
49 (File_read::find_or_make_view): Use malloc rather than new[].
50 * gold.h: Remove HAVE_REMAP code.
51 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
52 exists. Rename mremap to gold_mremap. If mmap is not available
54 * configure, config.in: Rebuild.
56 2011-04-11 Ian Lance Taylor <iant@google.com>
58 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
59 initialize local variable v.
61 2011-04-11 Cary Coutant <ccoutant@google.com>
63 * archive.cc (Archive::include_member): Adjust call to
65 (Add_archive_symbols::run): Track argument serial numbers.
66 (Lib_group::include_member): Likewise.
67 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
68 * archive.h (Incremental_archive_entry::Archive_member):
69 Initialize arg_serial_.
70 (Archive_member::arg_serial_): New data member.
71 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
72 (Sized_dynobj::do_add_symbols): Track symbols when doing an
74 (Sized_dynobj::do_for_all_local_got_entries): New function.
75 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
77 * fileread.cc (get_mtime): New function.
78 * fileread.h (get_mtime): New function.
79 * gold.cc (queue_initial_tasks): Check for incremental update.
80 (process_incremental_input): New function.
81 (queue_middle_tasks): Don't force valid target for incremental
83 * incremental-dump.cc (find_input_containing_global): Adjust
84 size of symbol info entry.
85 (dump_incremental_inputs): Dump argument serial number and
86 in_system_directory flag; bias shndx by 1; print symbol names
87 when dumping per-file symbol lists; use new symbol info readers.
89 (Output_section_incremental_inputs:update_data_size): New function.
90 (Sized_incremental_binary::setup_readers): Setup input readers
91 for each input file; build maps for files added from libraries
93 (Sized_incremental_binary::check_input_args): New function.
94 (Sized_incremental_binary::do_check_inputs): Build map of argument
95 serial numbers to input arguments.
96 (Sized_incremental_binary::do_file_has_changed): Rename
97 do_file_is_unchanged to this; compare file modification times.
98 (Sized_incremental_binary::do_init_layout): New function.
99 (Sized_incremental_binary::do_reserve_layout): New function.
100 (Sized_incremental_binary::do_get_input_reader): Remove.
101 (Sized_incremental_binary::get_symtab_view): New function.
102 (Incremental_checker::can_incrementally_link_output_file): Remove.
103 (Incremental_inputs::report_command_line): Exclude --debug options.
104 (Incremental_inputs::report_archive_begin): Add parameter; track
105 argument serial numbers; don't put input file entry for archive
106 before archive members.
107 (Incremental_inputs::report_archive_end): Put input file entry
108 for archive after archive members.
109 (Incremental_inputs::report_object): Add parameter; track argument
110 serial numbers and in_system_directory flag.
111 (Incremental_inputs::report_script): Add parameter; track argument
113 (Output_section_incremental_inputs::set_final_data_size): Adjust
114 size of symbol info entry; check for forwarding symbols.
115 (Output_section_incremental_inputs::write_input_files): Write
116 in_system_directory flag and argument serial number.
117 (Output_section_incremental_inputs::write_info_blocks): Map section
118 indices between incremental info and original input file; store
119 input section index for each symbol.
120 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
121 change operator() to visit().
122 (class Global_got_offset_visitor): Likewise.
123 (class Global_symbol_visitor_got_plt):
124 (Output_section_incremental_inputs::write_got_plt): Use new visitor
126 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
127 (Sized_incr_relobj::do_read_symbols): New function.
128 (Sized_incr_relobj::do_layout): New function.
129 (Sized_incr_relobj::do_layout_deferred_sections): New function.
130 (Sized_incr_relobj::do_add_symbols): New function.
131 (Sized_incr_relobj::do_should_include_member): New function.
132 (Sized_incr_relobj::do_for_all_global_symbols): New function.
133 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
134 (Sized_incr_relobj::do_section_size): New function.
135 (Sized_incr_relobj::do_section_name): New function.
136 (Sized_incr_relobj::do_section_contents): New function.
137 (Sized_incr_relobj::do_section_flags): New function.
138 (Sized_incr_relobj::do_section_entsize): New function.
139 (Sized_incr_relobj::do_section_address): New function.
140 (Sized_incr_relobj::do_section_type): New function.
141 (Sized_incr_relobj::do_section_link): New function.
142 (Sized_incr_relobj::do_section_info): New function.
143 (Sized_incr_relobj::do_section_addralign): New function.
144 (Sized_incr_relobj::do_initialize_xindex): New function.
145 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
146 (Sized_incr_relobj::do_read_relocs): New function.
147 (Sized_incr_relobj::do_gc_process_relocs): New function.
148 (Sized_incr_relobj::do_scan_relocs): New function.
149 (Sized_incr_relobj::do_count_local_symbols): New function.
150 (Sized_incr_relobj::do_finalize_local_symbols): New function.
151 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
152 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
153 (Sized_incr_relobj::do_relocate): New function.
154 (Sized_incr_relobj::do_set_section_offset): New function.
155 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
156 (Sized_incr_dynobj::do_read_symbols): New function.
157 (Sized_incr_dynobj::do_layout): New function.
158 (Sized_incr_dynobj::do_add_symbols): New function.
159 (Sized_incr_dynobj::do_should_include_member): New function.
160 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
161 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
162 (Sized_incr_dynobj::do_section_size): New function.
163 (Sized_incr_dynobj::do_section_name): New function.
164 (Sized_incr_dynobj::do_section_contents): New function.
165 (Sized_incr_dynobj::do_section_flags): New function.
166 (Sized_incr_dynobj::do_section_entsize): New function.
167 (Sized_incr_dynobj::do_section_address): New function.
168 (Sized_incr_dynobj::do_section_type): New function.
169 (Sized_incr_dynobj::do_section_link): New function.
170 (Sized_incr_dynobj::do_section_info): New function.
171 (Sized_incr_dynobj::do_section_addralign): New function.
172 (Sized_incr_dynobj::do_initialize_xindex): New function.
173 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
174 (make_sized_incremental_object): New function.
175 (Incremental_library::copy_unused_symbols): New function.
176 (Incremental_library::do_for_all_unused_symbols): New function.
177 * incremental.h (enum Incremental_input_flags): New type.
178 (class Incremental_checker): Remove.
179 (Incremental_input_entry::Incremental_input_entry): Add argument
181 (Incremental_input_entry::arg_serial): New function.
182 (Incremental_input_entry::set_is_in_system_directory): New function.
183 (Incremental_input_entry::is_in_system_directory): New function.
184 (Incremental_input_entry::arg_serial_): New data member.
185 (Incremental_input_entry::is_in_system_directory_): New data member.
186 (class Script_info): Move here from script.h.
187 (Script_info::Script_info): Add filename parameter.
188 (Script_info::filename): New function.
189 (Script_info::filename_): New data member.
190 (Incremental_script_entry::Incremental_script_entry): Add argument
192 (Incremental_object_entry::Incremental_object_entry): Likewise.
193 (Incremental_object_entry::add_input_section): Build list of input
194 sections with map to original shndx.
195 (Incremental_object_entry::get_input_section_index): New function.
196 (Incremental_object_entry::shndx_): New data member.
197 (Incremental_object_entry::name_key_): Rename; adjust all refs.
198 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
199 (Incremental_archive_entry::Incremental_archive_entry): Add argument
201 (Incremental_inputs::report_archive_begin): Likewise.
202 (Incremental_inputs::report_object): Likewise.
203 (Incremental_inputs::report_script): Likewise.
204 (class Incremental_global_symbol_reader): New class.
205 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
206 and store flags and input file type.
207 (Incremental_input_entry_reader::arg_serial): New function.
208 (Incremental_input_entry_reader::type): Extract type from flags.
209 (Incremental_input_entry_reader::is_in_system_directory): New function.
210 (Incremental_input_entry_reader::get_input_section_count): Call
211 accessor function for type.
212 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
213 function for type; adjust size of global symbol entry.
214 (Incremental_input_entry_reader::get_global_symbol_count): Call
215 accessor function for type.
216 (Incremental_input_entry_reader::get_object_count): Likewise.
217 (Incremental_input_entry_reader::get_object_offset): Likewise.
218 (Incremental_input_entry_reader::get_member_count): Likewise.
219 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
220 (Incremental_input_entry_reader::get_member_offset): Likewise.
221 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
222 (Incremental_input_entry_reader::Global_symbol_info): Remove.
223 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
224 (Incremental_input_entry_reader::get_global_symbol_reader): New
226 (Incremental_input_entry_reader::get_output_symbol_index): New
228 (Incremental_input_entry_reader::type_): Remove.
229 (Incremental_input_entry_reader::flags_): New data member.
230 (Incremental_inputs_reader::input_file_offset): New function.
231 (Incremental_inputs_reader::input_file_index): New function.
232 (Incremental_inputs_reader::input_file): Call input_file_offset.
233 (Incremental_inputs_reader::input_file_at_offset): New function.
234 (Incremental_relocs_reader::get_r_type): Reformat.
235 (Incremental_relocs_reader::get_r_shndx): Reformat.
236 (Incremental_relocs_reader::get_r_offset): Reformat.
237 (Incremental_relocs_reader::data): New function.
238 (Incremental_binary::Incremental_binary): Initialize new data members.
239 (Incremental_binary::check_inputs): Add cmdline parameter.
240 (Incremental_binary::file_is_unchanged): Remove.
241 (Input_reader::arg_serial): New function.
242 (Input_reader::get_unused_symbol_count): New function.
243 (Input_reader::get_unused_symbol): New function.
244 (Input_reader::do_arg_serial): New function.
245 (Input_reader::do_get_unused_symbol_count): New function.
246 (Input_reader::do_get_unused_symbol): New function.
247 (Incremental_binary::input_file_count): New function.
248 (Incremental_binary::get_input_reader): Change signature to use
249 index instead of filename.
250 (Incremental_binary::file_has_changed): New function.
251 (Incremental_binary::get_input_argument): New function.
252 (Incremental_binary::get_library): New function.
253 (Incremental_binary::get_script_info): New function.
254 (Incremental_binary::init_layout): New function.
255 (Incremental_binary::reserve_layout): New function.
256 (Incremental_binary::output_file): New function.
257 (Incremental_binary::do_check_inputs): New function.
258 (Incremental_binary::do_file_is_unchanged): Remove.
259 (Incremental_binary::do_file_has_changed): New function.
260 (Incremental_binary::do_init_layout): New function.
261 (Incremental_binary::do_reserve_layout): New function.
262 (Incremental_binary::do_input_file_count): New function.
263 (Incremental_binary::do_get_input_reader): Change signature.
264 (Incremental_binary::input_args_map_): New data member.
265 (Incremental_binary::library_map_): New data member.
266 (Incremental_binary::script_map_): New data member.
267 (Sized_incremental_binary::Sized_incremental_binary): Initialize
269 (Sized_incremental_binary::output_section): New function.
270 (Sized_incremental_binary::inputs_reader): Add const.
271 (Sized_incremental_binary::symtab_reader): Add const.
272 (Sized_incremental_binary::relocs_reader): Add const.
273 (Sized_incremental_binary::got_plt_reader): Add const.
274 (Sized_incremental_binary::get_symtab_view): New function.
275 (Sized_incremental_binary::Inputs_reader): New typedef.
276 (Sized_incremental_binary::Input_entry_reader): New typedef.
277 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
278 (Sized_incremental_binary::do_file_is_unchanged): Remove.
279 (Sized_incremental_binary::do_file_has_changed): New function.
280 (Sized_incremental_binary::do_init_layout): New function.
281 (Sized_incremental_binary::do_reserve_layout): New function.
282 (Sized_input_reader::Inputs_reader): Remove.
283 (Sized_input_reader::Input_entry_reader): Remove.
284 (Sized_input_reader::do_arg_serial): New function.
285 (Sized_input_reader::do_get_unused_symbol_count): New function.
286 (Sized_input_reader::do_get_unused_symbol): New function.
287 (Sized_incremental_binary::do_input_file_count): New function.
288 (Sized_incremental_binary::do_get_input_reader): Change signature;
289 use index instead of filename.
290 (Sized_incremental_binary::section_map_): New data member.
291 (Sized_incremental_binary::input_entry_readers_): New data member.
292 (class Sized_incr_relobj): New class.
293 (class Sized_incr_dynobj): New class.
294 (make_sized_incremental_object): New function.
295 (class Incremental_library): New class.
296 * layout.cc (Free_list::num_lists): New static data member.
297 (Free_list::num_nodes): New static data member.
298 (Free_list::num_removes): New static data member.
299 (Free_list::num_remove_visits): New static data member.
300 (Free_list::num_allocates): New static data member.
301 (Free_list::num_allocate_visits): New static data member.
302 (Free_list::init): New function.
303 (Free_list::remove): New function.
304 (Free_list::allocate): New function.
305 (Free_list::dump): New function.
306 (Free_list::print_stats): New function.
307 (Layout_task_runner::run): Resize output file for incremental updates.
308 (Layout::Layout): Initialize new data members.
309 (Layout::set_incremental_base): New function.
310 (Layout::init_fixed_output_section): New function.
311 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
313 (Layout::create_gold_note): Do not create gold note section for
315 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
316 for incremental updates.
317 (Layout::set_section_offsets): For incremental updates, allocate space
319 (Layout::create_symtab_sections): Layout with offsets relative to
320 start of section; for incremental updates, allocate space from free
322 (Layout::create_shdrs): For incremental updates, allocate space from
324 (Layout::finish_dynamic_section): For incremental updates, do not
325 check --as-needed (fixed in subsequent patch).
326 * layout.h (class Free_list): New class.
327 (Layout::set_incremental_base): New function.
328 (Layout::incremental_base): New function.
329 (Layout::init_fixed_output_section): New function.
330 (Layout::allocate): New function.
331 (Layout::incremental_base_): New data member.
332 (Layout::free_list_): New data member.
333 * main.cc (main): Print Free_list statistics.
334 * object.cc (Relobj::finalize_incremental_relocs): Add
335 clear_counts parameter; clear counts only when clear_counts is set.
336 (Sized_relobj::Sized_relobj): Initialize new base class.
337 (Sized_relobj::do_layout): Don't report special sections.
338 (Sized_relobj::do_for_all_local_got_entries): New function.
339 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
340 symtab_off to all symbol table offsets.
341 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
342 * object.h (class Got_offset_list): Move to top of file.
343 (Object::Object): Allow case where input_file == NULL.
344 (Object::~Object): Likewise.
345 (Object::input_file): Assert that input_file != NULL.
346 (Object::lock): Allow case where input_file == NULL.
347 (Object::unlock): Likewise.
348 (Object::is_locked): Likewise.
349 (Object::token): Likewise.
350 (Object::release): Likewise.
351 (Object::is_incremental): New function.
352 (Object::get_mtime): New function.
353 (Object::for_all_local_got_entries): New function.
354 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
355 (Object::set_is_in_system_directory): New function.
356 (Object::is_in_system_directory): New function.
357 (Object::do_is_incremental): New function.
358 (Object::do_get_mtime): New function.
359 (Object::do_for_all_local_got_entries): New function.
360 (Object::is_in_system_directory_): New data member.
361 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
362 (class Sized_relobj_base): New class.
363 (class Sized_relobj): Derive from Sized_relobj_base.
364 (class Sized_relobj::Symbols): Redeclare from base class.
365 (class Sized_relobj::local_got_offset_list): Remove.
366 (class Sized_relobj::Output_sections): Redeclare from base class.
367 (class Sized_relobj::do_for_all_local_got_entries): New function.
368 (class Sized_relobj::write_local_symbols): Add offset parameter.
369 (class Sized_relobj::local_symbol_offset_): Update comment.
370 (class Sized_relobj::local_dynsym_offset_): Update comment.
371 * options.cc (Input_arguments::add_file): Remove const.
372 * options.h (Input_file_argument::Input_file_argument):
373 Initialize arg_serial_ (all constructors).
374 (Input_file_argument::set_arg_serial): New function.
375 (Input_file_argument::arg_serial): New function.
376 (Input_file_argument::arg_serial_): New data member.
377 (Input_arguments::Input_arguments): Initialize file_count_.
378 (Input_arguments::add_file): Remove const.
379 (Input_arguments::number_of_input_files): New function.
380 (Input_arguments::file_count_): New data member.
381 (Command_line::number_of_input_files): Call
382 Input_arguments::number_of_input_files.
383 * output.cc (Output_segment_headers::Output_segment_headers):
385 (Output_section::Input_section::current_data_size): New function.
386 (Output_section::Output_section): Initialize new data members.
387 (Output_section::add_input_section): Don't do merge sections for
388 an incremental link; allocate space from free list for an
390 (Output_section::add_output_section_data): Allocate space from
391 free list for an incremental update.
392 (Output_section::update_data_size): New function.
393 (Output_section::set_fixed_layout): New function.
394 (Output_section::reserve): New function.
395 (Output_segment::set_section_addresses): Remove const.
396 (Output_segment::set_section_list_addresses): Remove const; allocate
397 space from free list for an incremental update.
398 (Output_segment::set_offset): Adjust size of RELRO segment for an
400 * output.h (Output_data::current_data_size): Move here from
402 (Output_data::pre_finalize_data_size): New function.
403 (Output_data::update_data_size): New function.
404 (Output_section_headers::update_data_size): new function.
405 (Output_section_data_build::current_data_size): Move to Output_data.
406 (Output_data_strtab::update_data_size): New function.
407 (Output_section::current_data_size): Move to Output_data.
408 (Output_section::set_fixed_layout): New function.
409 (Output_section::has_fixed_layout): New function.
410 (Output_section::reserve): New function.
411 (Output_section::update_data_size): New function.
412 (Output_section::has_fixed_layout_): New data member.
413 (Output_section::free_list_): New data member.
414 (Output_segment::set_section_addresses): Remove const.
415 (Output_segment::set_section_list_addresses): Remove const.
416 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
418 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
420 * readsyms.cc (Read_symbols::do_read_symbols): Add library
421 parameter when calling Add_symbols constructor; store argument
422 serial number for members of a lib group.
423 (Add_symbols::locks): Allow case where token == NULL.
424 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
425 (Read_member::~Read_member): New function.
426 (Read_member::is_runnable): New function.
427 (Read_member::locks): New function.
428 (Read_member::run): New function.
429 (Check_script::~Check_script): New function.
430 (Check_script::is_runnable): New function.
431 (Check_script::locks): New function.
432 (Check_script::run): New function.
433 (Check_library::~Check_library): New function.
434 (Check_library::is_runnable): New function.
435 (Check_library::locks): New function.
436 (Check_library::run): New function.
437 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
438 (Add_symbols::library_): New data member.
439 (class Read_member): New class.
440 (class Check_script): New class.
441 (class Check_library): New class.
442 * reloc.cc (Read_relocs::is_runnable): Allow case where
444 (Read_relocs::locks): Likewise.
445 (Scan_relocs::locks): Likewise.
446 (Relocate_task::locks): Likewise.
447 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
449 (Sized_relobj::incremental_relocs_scan): Fix comment.
450 (Sized_relobj::do_relocate): Pass output file offset to
452 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
453 from class declaration.
454 * script.cc (read_input_script): Allocate Script_info; pass
455 argument serial number to report_script.
456 * script.h (class Script_info): Move to incremental.h.
457 * symtab.cc (Symbol_table::add_from_incrobj): New function.
458 * symtab.h (Symbol_table::add_from_incrobj): New function.
459 (Symbol_table::set_file_offset): New function.
461 2011-04-05 Cary Coutant <ccoutant@google.com>
463 * incremental-dump.cc (dump_incremental_inputs): Change signature
464 to take a Sized_incremental_binary; change caller. Use readers
465 in Sized_incremental_binary.
467 (Sized_incremental_binary::find_incremental_inputs_sections):
468 Rename do_find_incremental_inputs_sections to this.
469 (Sized_incremental_binary::setup_readers): New function.
470 (Sized_incremental_binary::do_check_inputs): Check
471 has_incremental_info_ flag; move setup code to setup_readers;
473 (Sized_incremental_binary::do_file_is_unchanged): New function.
474 (Sized_incremental_binary::do_get_input_reader): New function.
475 * incremental.h (class Incremental_binary): Move to end of file.
476 (Incremental_binary::file_is_unchanged): New function.
477 (Incremental_binary::do_file_is_unchanged): New function.
478 (Incremental_binary::Input_reader): New class.
479 (Incremental_binary::get_input_reader): New function.
480 (class Sized_incremental_binary): Move to end of file.
481 (Sized_incremental_binary::Sized_incremental_binary): Setup the
482 input section reader classes.
483 (Sized_incremental_binary::has_incremental_info): New function.
484 (Sized_incremental_binary::inputs_reader): New function.
485 (Sized_incremental_binary::symtab_reader): New function.
486 (Sized_incremental_binary::relocs_reader): New function.
487 (Sized_incremental_binary::got_plt_reader): New function.
488 (Sized_incremental_binary::do_file_is_unchanged): New function.
489 (Sized_incremental_binary::Sized_input_reader): New class.
490 (Sized_incremental_binary::get_input_reader): New function.
491 (Sized_incremental_binary::find_incremental_inputs_sections):
492 Rename do_find_incremental_inputs_sections to this.
493 (Sized_incremental_binary::setup_readers): New function.
494 (Sized_incremental_binary::has_incremental_info_): New data member.
495 (Sized_incremental_binary::inputs_reader_): New data member.
496 (Sized_incremental_binary::symtab_reader_): New data member.
497 (Sized_incremental_binary::relocs_reader_): New data member.
498 (Sized_incremental_binary::got_plt_reader_): New data member.
499 (Sized_incremental_binary::current_input_file_): New data member.
501 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
504 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
507 2011-03-30 Cary Coutant <ccoutant@google.com>
509 * archive.cc (Archive::include_member): Adjust call to report_object.
510 (Add_archive_symbols::run): Add script_info to call to
511 report_archive_begin.
512 (Lib_group::include_member): Adjust call to report_object.
513 (Add_lib_group_symbols::run): Adjust call to report_object.
514 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
515 blocks. Add object count for script input files.
516 * incremental.cc (Incremental_inputs::report_archive_begin): Add
517 script_info parameter; change all callers.
518 (Incremental_inputs::report_object): Add script_info parameter;
520 (Incremental_inputs::report_script): Store backpointer to
521 incremental info entry.
522 (Output_section_incremental_inputs::set_final_data_size): Record
523 additional information for scripts.
524 (Output_section_incremental_inputs::write_info_blocks): Likewise.
525 * incremental.h (Incremental_script_entry::add_object): New function.
526 (Incremental_script_entry::get_object_count): New function.
527 (Incremental_script_entry::get_object): New function.
528 (Incremental_script_entry::objects_): New data member; adjust
530 (Incremental_inputs::report_archive_begin): Add script_info parameter.
531 (Incremental_inputs::report_object): Add script_info parameter.
532 (Incremental_inputs_reader::get_object_count): New function.
533 (Incremental_inputs_reader::get_object_offset): New function.
534 * options.cc (Input_arguments::add_file): Return reference to
536 * options.h (Input_argument::set_script_info): New function.
537 (Input_argument::script_info): New function.
538 (Input_argument::script_info_): New data member; adjust all
540 (Input_file_group::add_file): Return reference to new input argument.
541 (Input_file_lib::add_file): Likewise.
542 (Input_arguments::add_file): Likewise.
543 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
544 * script.cc (Parser_closure::Parser_closure): Add script_info
545 parameter; adjust all callers.
546 (Parser_closure::script_info): New function.
547 (Parser_closure::script_info_): New data member.
548 (read_input_script): Report scripts earlier to incremental info.
549 (script_add_file): Set script_info in Input_argument.
550 (script_add_library): Likewise.
551 * script.h (Script_options::Script_info): Rewrite class.
553 2011-03-29 Cary Coutant <ccoutant@google.com>
555 * archive.cc (Library_base::should_include_member): Move
556 method here from class Archive.
557 (Archive::Archive): Initialize base class.
558 (Archive::should_include_member): Move to base class.
559 (Archive::do_for_all_unused_symbols): New function.
560 (Add_archive_symbols::run): Remove redundant access to
562 (Lib_group::Lib_group): Initialize base class.
563 (Lib_group::do_filename): New function.
564 (Lib_group::include_member): Pass pointer to Lib_group to
566 (Lib_group::do_for_all_unused_symbols): New function.
567 (Add_lib_group_symbols::run): Report archive information for
569 * archive.h (class Library_base): New base class.
570 (class Archive): Derive from Library_base.
571 (Archive::filename): Move to base class.
572 (Archive::set_incremental_info): Likewise.
573 (Archive::incremental_info): Likewise.
574 (Archive::Should_include): Likewise.
575 (Archive::should_include_member): Likewise.
576 (Archive::Armap_entry): Remove.
577 (Archive::Unused_symbol_iterator): Remove.
578 (Archive::unused_symbols_begin): Remove.
579 (Archive::unused_symbols_end): Remove.
580 (Archive::do_filename): New function.
581 (Archive::do_get_mtime): New function.
582 (Archive::do_for_all_unused_symbols): New function.
583 (Archive::task_): Move to base class.
584 (Archive::incremental_info_): Likewise.
585 (class Lib_group): Derive from Library_base.
586 (Lib_group::do_filename): New function.
587 (Lib_group::do_get_mtime): New function.
588 (Lib_group::do_for_all_unused_symbols): New function.
589 (Lib_group::task_): Move to base class.
590 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
592 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
594 * incremental.cc (Incremental_inputs::report_archive_begin):
595 Use Library_base; call library's get_mtime; add incremental inputs
596 entry before members.
597 (class Unused_symbol_visitor): New class.
598 (Incremental_inputs::report_archive_end): Use Library_base; use
599 visitor class to record unused symbols; don't add incremental inputs
601 (Incremental_inputs::report_object): Use Library_base.
603 (Incremental_archive_entry::Incremental_archive_entry): Remove
604 unused Archive parameter.
605 (Incremental_inputs::report_archive_begin): Use Library_base.
606 (Incremental_inputs::report_archive_end): Likewise.
607 (Incremental_inputs::report_object): Likewise.
608 * object.cc (Sized_relobj::do_for_all_global_symbols): New
610 * object.h (Object::for_all_global_symbols): New function.
611 (Object::do_for_all_global_symbols): New function.
612 (Sized_relobj::do_for_all_global_symbols): New function.
613 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
615 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
618 2011-03-27 Ian Lance Taylor <iant@google.com>
620 * archive.cc (Archive::interpret_header): Return -1 if something
621 goes wrong. Change callers accordingly.
623 2011-03-25 Cary Coutant <ccoutant@google.com>
625 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
626 * testsuite/Makefile.in: Regenerate.
628 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
630 * plugin.cc (get_view): New.
631 (Plugin::load): Pass get_view to the plugin.
632 (Plugin_manager::get_view): New.
634 2011-03-21 Ian Lance Taylor <iant@google.com>
636 * testsuite/final_layout.sh: Rewrite to not use dc.
637 * testsuite/relro_test.sh: Fail if dc is not present.
639 2011-03-21 Sriraman Tallam <tmsriram@google.com>
641 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
643 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
644 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
646 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
647 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
649 2011-03-14 Ian Lance Taylor <iant@google.com>
651 * script-sections.cc (Sort_output_sections::script_compare):
652 Rename from is_before, change return type.
653 (Sort_output_sections::operator()): Adjust accordingly.
655 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
658 * testsuite/odr_violation2.cc: Add comment to make all error line
659 numbers double digits.
660 * testsuite/debug_msg.sh: Adjust expected errors.
662 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
664 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
665 but mark earlier ones as non-canonical
666 (offset_to_iterator): Update search target and example
667 (do_addr2line): Return extra lines in a vector*
668 (format_file_lineno): Extract from do_addr2line
669 (one_addr2line): Add vector* out-param
670 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
671 when a lineno entry appeared last for its instruction
672 (Dwarf_line_info): Add vector* out-param
673 * object.cc (Relocate_info): Pass NULL for the vector* out-param
674 * symtab.cc (Odr_violation_compare): Include the lineno in the
676 (linenos_from_loc): New. Combine the canonical line for an
677 address with its other lines.
678 (True_if_intersect): New. Helper functor to make
679 std::set_intersection a query.
680 (detect_odr_violations): Compare sets of lines instead of just
681 one line for each function. This became less deterministic, but
682 has fewer false positives.
683 * symtab.h: Declarations.
684 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
685 mix an optimized and non-optimized object in the same binary
686 (odr_violation2.so): Same.
687 * testsuite/Makefile.in: Regenerate from Makefile.am.
688 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
689 * testsuite/debug_msg.sh: Update line numbers and add
691 * testsuite/odr_violation1.cc: Use OdrDerived, in a
692 non-optimized context.
693 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
694 isn't inlined, and use OdrDerived in an optimized context.
695 * testsuite/odr_header1.h: Defines OdrDerived, where
696 optimization will change the
697 first-instruction-in-the-destructor's file and line number.
698 * testsuite/odr_header2.h: Defines OdrBase.
700 2011-03-09 Ian Lance Taylor <iant@google.com>
702 * fileread.cc (File_read::clear_views): Don't delete the whole
705 2011-03-08 Ian Lance Taylor <iant@google.com>
708 * fileread.cc: #include <climits>.
709 (GOLD_IOV_MAX): Define.
710 (File_read::read_multiple): Limit number of entries by iov_max.
711 * fileread.h (class File_read): Always set max_readv_entries to
714 2011-03-07 Ian Lance Taylor <iant@google.com>
717 * options.h (class General_options): Add -dy and -dn.
719 2011-03-02 Cary Coutant <ccoutant@google.com>
721 * testsuite/script_test_9.t: Add TLS segment.
723 2011-03-02 Simon Baldwin <simonb@google.com>
725 * configure.ac: Add check for gnu_indirect_function support in
726 the toolchain building binutils.
727 * configure: Rebuild.
729 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
731 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
733 (Symbol_table::sized_finalize_symbol) Mark symbol only present
734 in plugin files as not needed in the symbol table.
736 2011-02-11 Sriraman Tallam <tmsriram@google.com>
738 * output.cc (Output_section::add_input_section): Delay fill
739 generation for section ordering.
741 2011-02-09 Ian Lance Taylor <iant@google.com>
744 * object.h (class Sized_relobj): Remove clear_local_symbols.
745 * reloc.cc (Sized_relobj::do_relocate): Don't call
748 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
750 * plugin.cc (is_visible_from_outside): Return true for symbols
753 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
755 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
758 2011-02-02 Sriraman Tallam <tmsriram@google.com>
760 * icf.h (is_section_foldable_candidate): Change type of parameter
762 * icf.cc (Icf::find_identical_sections): Change type of local variable
763 section_name to be std::string.
764 (is_function_ctor_or_dtor): Change type of parameter to std::string.
766 2011-01-25 Ian Lance Taylor <iant@google.com>
768 * script.cc (script_add_extern): Rewrite to use
769 add_symbol_reference.
771 2011-01-25 Doug Kwan <dougkwan@google.com>
773 * icf.cc (get_section_contents): Always lock section's object.
775 2011-01-24 Ian Lance Taylor <iant@google.com>
777 * options.h (class General_options): Accept
778 --no-detect-odr-violations.
780 2011-01-24 Ian Lance Taylor <iant@google.com>
782 * version.cc (version_string): Bump to 1.11.
784 2011-01-24 Ian Lance Taylor <iant@google.com>
786 * plugin.cc (class Plugin_rescan): Define new class.
787 (Plugin_manager::claim_file): Set any_claimed_.
788 (Plugin_manager::save_archive): New function.
789 (Plugin_manager::save_input_group): New function.
790 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
792 (Plugin_manager::new_undefined_symbol): New function.
793 (Plugin_manager::rescan): New function.
794 (Plugin_manager::rescannable_defines): New function.
795 (Plugin_manager::add_input_file): Set any_added_.
796 * plugin.h (class Plugin_manager): define new fields rescannable_,
797 undefined_symbols_, any_claimed_, and any_added_. Declare
798 Plugin_rescan as friend. Declare new functions.
799 (Plugin_manager::Rescannable): Define type.
800 (Plugin_manager::Rescannable_list): Define type.
801 (Plugin_manager::Undefined_symbol_list): Define type.
802 (Plugin_manager::Plugin_manager): Initialize new fields.
803 * archive.cc (Archive::defines_symbol): New function.
804 (Add_archive_symbols::run): Pass archive to plugins if any.
805 * archive.h (class Archive): Declare defines_symbol.
806 * readsyms.cc (Input_group::~Input_group): New function.
807 (Finish_group::run): Pass input_group to plugins if any.
808 * readsyms.h (class Input_group): Declare destructor.
809 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
812 2011-01-10 Ian Lance Taylor <iant@google.com>
814 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
816 (Layout::set_segment_offsets): Reset increase_relro before calling
817 set_section_addresses a second time.
819 2011-01-04 Cary Coutant <ccoutant@google.com>
821 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
822 sections before NOBITS sections.
824 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
826 * version.cc (print_version): Update copyright to 2011.
828 2010-12-23 Cary Coutant <ccoutant@google.com>
830 * output.h (Output_data_reloc::add_output_section): Pass OD instead
831 of OS to this->add. Add OD parameter to second form of the function.
833 2010-12-20 Ian Lance Taylor <iant@google.com>
835 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
836 second of two consecutive entries with same offset.
838 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
840 * testsuite/Makefile.am (ifuncmain2static_LDADD)
841 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
842 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
843 to avoid unneeded links against $(LDADD).
844 * testsuite/Makefile.in: Regenerate.
846 2010-12-15 Ian Lance Taylor <iant@google.com>
849 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
850 for R_X86_64_32 and R_X86_64_PC32.
851 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
852 ver_matching_def_pic.o.
853 (ver_matching_def_pic.o): New target.
855 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
857 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
858 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
859 Move definition before File_read::View member definitions.
860 (File_read::View::~View): Initialize and hold lock before
861 updating current_mapped_bytes.
863 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
865 * dwarf_reader.cc: Remove outdated comment.
866 * gold-threads.cc: Fix typo in error message.
867 * archive.cc: Fix typos in comments.
868 * archive.h: Likewise.
869 * arm-reloc-property.cc: Likewise.
870 * arm-reloc-property.h: Likewise.
871 * arm-reloc.def: Likewise.
873 * attributes.h: Likewise.
875 * ehframe.cc: Likewise.
876 * fileread.h: Likewise.
880 * incremental.h: Likewise.
881 * int_encoding.cc: Likewise.
882 * layout.h: Likewise.
885 * object.cc: Likewise.
886 * object.h: Likewise.
887 * options.cc: Likewise.
888 * readsyms.cc: Likewise.
889 * reduced_debug_output.cc: Likewise.
890 * reloc.cc: Likewise.
891 * script-sections.cc: Likewise.
892 * sparc.cc: Likewise.
893 * symtab.h: Likewise.
894 * target-reloc.h: Likewise.
895 * target.cc: Likewise.
896 * target.h: Likewise.
897 * timer.cc: Likewise.
899 * x86_64.cc: Likewise.
901 2010-12-09 Cary Coutant <ccoutant@google.com>
903 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
905 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
906 parameter; change all callers.
907 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
908 * options.h (warn_execstack): New option.
910 2010-12-07 Doug Kwan <dougkwan@google.com>
912 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
913 like function call relocations.
915 2010-12-07 Ian Lance Taylor <iant@google.com>
917 * archive.cc (Archive::get_elf_object_for_member): Permit
918 punconfigured to be NULL.
919 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
920 (Archive::include_member): Pass NULL to get_elf_object_for_member
921 if we searched for the archive and this is the first included
924 2010-12-01 Ian Lance Taylor <iant@google.com>
926 * dwarf_reader.h (class Sized_dwarf_line_info): Add
927 track_relocs_type_ field.
928 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
929 Set track_relocs_type_.
930 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
931 contents when using RELA relocs.
932 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
934 * reloc.cc (Track_relocs::next_addend): New function.
935 * reloc.h (class Track_relocs): Declare next_addend.
937 2010-12-01 Ian Lance Taylor <iant@google.com>
939 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
942 2010-12-01 Ian Lance Taylor <iant@google.com>
944 * README: Update compilers known to work and fail.
946 2010-11-23 Matthias Klose <doko@ubuntu.com>
948 * configure.in: For --enable-gold, handle value `default' instead of
949 `both*'. Always install ld as ld.bfd, install as ld if gold is
951 * configure: Regenerate.
953 2010-11-18 Doug Kwan <dougkwan@google.com>
955 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
956 and right_alignment to be zero. Store result alignment only if it is
957 greater than existing alignment.
959 2010-11-16 Cary Coutant <ccoutant@google.com>
962 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
963 Check for ".zdebug_line".
965 2010-11-16 Doug Kwan <dougkwan@google.com>
966 Cary Coutant <ccoutant@google.com>
968 * output.h (Output_segment::set_section_addresses): Pass increase_relro
969 by reference; adjust all callers.
970 * output.cc (Output_segment::set_section_addresses): Adjust references
971 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
973 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
974 end at page boundary.
976 2010-11-16 Cary Coutant <ccoutant@google.com>
979 * layout.cc (Layout::choose_output_section): Transform names of
980 compressed sections even when using a script with a SECTIONS clause.
981 (Layout::output_section_name): Remove code to transform
982 compressed debug section names.
983 * output.cc (Output_section::add_input_section): Use uncompressed
984 section size when tracking input sections.
986 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
988 * symtab.h (Symbol::NON_PIC_REF): Remove.
989 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
990 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
991 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
992 (Symbol::use_plt_offset): Take a flags argument and pass it
993 directly to needs_dynamic_reloc. Restrict check for undefined
994 weak symbols to function calls.
995 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
996 (Target_arm::Scan::global): Use it.
997 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
998 (Target_arm::Relocate::relocate): Likewise.
999 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1000 parameter with an r_type parameter. Use get_reference_flags
1002 (Target_arm::Relocate::relocate): Update accordingly.
1003 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1004 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1005 (Target_i386::Scan::global): Likewise.
1006 (Target_i386::Relocate::relocate): Likewise.
1007 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1008 parameter with an r_type parameter. Use get_reference_flags
1010 (Target_i386::Relocate::relocate): Update accordingly.
1011 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1012 (Target_powerpc::Scan::global): Use it.
1013 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1014 (Target_powerpc::Relocate::relocate): Likewise.
1015 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1016 (Target_sparc::Scan::global): Use it.
1017 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1018 (Target_sparc::Relocate::relocate): Likewise.
1019 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1020 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1021 (Target_x86_64::Scan::global): Likewise.
1022 (Target_x86_64::Relocate::relocate): Likewise.
1024 2010-11-08 Doug Kwan <dougkwan@google.com>
1025 Cary Coutant <ccoutant@google.com>
1027 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1028 (Arm_exidx_merge_section::section_contents_): New data member.
1029 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1030 (Arm_input_section::~Arm_input_section): De-allocate memory.
1031 (Arm_input_section::original_contents_): New data member.
1032 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1033 in parameters instead of calling Object::section_contents without
1035 (Arm_output_section::group_section): New parameter TASK. Pass it
1036 to callees that need locking objects.
1037 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1038 to lock EXIDX input sections. Fix a formatting issue. Call
1039 Arm_exidx_merged_section::build_contents to create merged section
1041 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1042 to lock object of stub table owner.
1043 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1044 TEXT_SIZE to initialize data member TEXT_SIZE_.
1045 (Arm_exidx_input_section::addralign): Fix typo in comment.
1046 (Arm_exidx_input_section::text_size): New method.
1047 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1048 that require locking objects. Lock objects before scanning for stubs
1049 and updating local symbols.
1050 (Arm_input_section<big_endian>::init): Copy contents of original
1052 (Arm_input_section<big_endian>::do_write): Use saved contents of
1053 original input section instead of calling Object::section_contents
1055 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1056 size without calling Object::section_size().
1057 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1058 for size. Allocate a buffer for merged EXIDX entries.
1059 (Arm_exidx_merged_section::build_contents): New method.
1060 (Arm_exidx_merged_section::do_write): Move merge section contents
1061 building code to Arm_exidx_merged_section::build_contetns. Write
1062 out contetns in buffer instead of building it on the fly.
1063 (Arm_relobj::make_exidx_input_section): Also pass text section size
1064 to Arm_exidx_input_section constructor.
1065 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1066 (Arm_dynobj::do_read_symbols): Fix memory leak.
1067 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1068 * target.h: (class Task): Add forward declaration.
1069 (Target::relax): Add new parameter TASK and pass it to
1071 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1073 2010-11-05 Cary Coutant <ccoutant@google.com>
1076 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1077 object when reading from the file.
1078 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1080 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1081 when reading section contents.
1082 (get_section_contents): Likewise.
1083 (icf::find_identical_sections): Likewise.
1084 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1085 object when reading from the file.
1086 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1087 the object when doing deferred section layout.
1089 2010-11-03 Nick Clifton <nickc@redhat.com>
1092 * script.h (class Symbol_assignment: name): New member. Returns
1093 the name of the symbol.
1094 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1095 Returns true if the given symbol name is on the list of
1096 assignments wating to be processed.
1097 * archive.cc (should_incldue_member): If the symbol is undefined,
1098 check to see if it is on the list of symbols pending assignment.
1100 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1102 * script-sections.cc (Script_sections::find_memory_region): Check
1103 for a NULL output section pointer.
1105 2010-10-29 Doug Kwan <dougkwan@google.com>
1107 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1108 Output_section::add_relaxed_input_section.
1109 * output.cc (Output_section::add_relaxed_input_section): Add new
1110 arguments LAYOUT and NAME. Set section order index.
1111 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1112 Copy section order index.
1113 * output.h (Output_section::add_relaxed_input_section): Add new
1114 arguments LAYOUT and NAME.
1116 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1118 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1119 NATIVE_OR_CROSS_LINKER.
1120 * testsuite/Makefile.in: Regenerate.
1122 2010-10-20 Doug Kwan <dougkwan@google.com>
1124 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1125 without SHF_LINK_ORDER flags.
1126 * layout.cc (Layout::choose_output_section): Do not filter
1127 SHF_LINK_ORDER flag in a relocatable link.
1129 2010-10-17 Cary Coutant <ccoutant@google.com>
1131 * output.h (Output_segment::set_section_addresses): Change function
1132 signature. Update all callers.
1133 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1135 (Output_segment::set_section_addresses): Align after last TLS
1136 section. Add padding before last relro section instead of after.
1138 2010-10-17 Doug Kwan <dougkwan@google.com>
1140 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1141 GOT output section to be writable.
1143 2010-10-14 Cary Coutant <ccoutant@google.com>
1145 * debug.h (DEBUG_INCREMENTAL): New flag.
1146 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1147 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1149 * incremental.cc (report_command_line): Ignore all forms of
1151 * layout.cc (Layout::Layout): Check parameters for incremental link
1153 * options.cc (General_options::parse_incremental): New function.
1154 (General_options::parse_no_incremental): New function.
1155 (General_options::parse_incremental_full): New function.
1156 (General_options::parse_incremental_update): New function.
1157 (General_options::incremental_mode_): New data member.
1158 (General_options::finalize): Check incremental_mode_.
1159 * options.h (General_options): Update help text for --incremental.
1160 Add --no-incremental, --incremental-full, --incremental-update.
1161 (General_options::Incremental_mode): New enum type.
1162 (General_options::incremental_mode): New function.
1163 (General_options::incremental_mode_): New data member.
1164 * parameters.cc (Parameters::incremental_mode_): New data member.
1165 (Parameters::set_options): Set incremental_mode_.
1166 (Parameters::set_incremental_full): New function.
1167 (Parameters::incremental): New function.
1168 (Parameters::incremental_update): New function.
1169 (set_parameters_incremental_full): New function.
1170 * parameters.h (Parameters::set_incremental_full): New function.
1171 (Parameters::incremental): New function.
1172 (Parameters::incremental_update): New function.
1173 (Parameters::incremental_mode_): New data member.
1174 (set_parameters_incremental_full): New function.
1175 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1176 incremental link mode.
1177 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1178 (Sized_relobj::do_relocate_sections): Likewise.
1179 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1181 * testsuite/Makefile.in: Regenerate.
1182 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1184 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1186 * script-sections.h (class Script_sections): Make
1187 Sections_elements typedef public.
1188 * script-sections.cc (class Sort_output_sections): Add elements_
1189 field. Add constructor which sets it; change all callers.
1190 (Sort_output_sections::is_before): New function.
1191 (Sort_output_sections::operator()): Call is_before.
1192 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1194 * testsuite/script_test_10.sh: New test. Test script section
1196 * testsuite/script_test_10.t: Likewise.
1197 * testsuite/script_test_10.s: Likewise.
1198 * testsuite/Makefile.am: Wrap the cross linker tests and the
1199 common tests into NATIVE_OR_CROSS_LINKER.
1200 (check_SCRIPTS): Add script_test_10.sh.
1201 (check_DATA): Add script_test_10.stdout.
1202 (script_test_10.o, script_test_10): New targets.
1203 (script_test_10.stdout): New target.
1204 * configure, testsuite/Makefile.in: Regenerate.
1206 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1208 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1209 error for the deprecated relocations.
1210 (Target_arm::Scan::global): Likewise.
1211 (Target_arm::Relocate::relocate): Likewise.
1213 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1215 * fileread.cc (Input_file::find_file): Initialize *found_name
1216 and *namep when using the fallback search for case 4.
1218 2010-10-11 Cary Coutant <ccoutant@google.com>
1220 * options.h (class General_options): Redefine -z lazy as an alias for
1221 the negation of -z now.
1223 2010-10-11 Ian Lance Taylor <iant@google.com>
1225 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1228 2010-10-06 Nick Clifton <nickc@redhat.com>
1230 * script-sections.cc(class Memory_region): Remove
1231 current_lma_offset_ field. Rename current_vma_offset_ to
1232 current_offset_. Add last_section_ field.
1233 (Memory_region::get_current_vma_address): Rename to
1234 get_current_address.
1235 (Memory_region::get_current_lma_address): Delete.
1236 (Memory_region::increment_vma_offset): Rename to
1238 (Memory_region::increment_lma_offset): Delete.
1239 (Memory_region::attributes_compatible): New method. Returns
1240 true if the provided section is compatible with the region.
1241 (Memory_region::get_last_section): New method. Returns the last
1242 section to use the region.
1243 (Memory_region::set_last_section): New method. Stores the last
1244 section to use the region.
1245 (Script_sections::block_in_region): New method. Returns true if
1246 a block of memory is contained within a region.
1247 (Script_sections::find_memory_region): New method. Locates a
1248 memory region to be used to set a VMA or LMA address.
1249 (Output_section_definition::set_section_addresses): Add code to
1250 check for addresses set by memory regions.
1251 (Output_segment::set_section_addresses): Remove memory region
1253 (Script_sections::create_segment): Add a warning if a header
1254 segment is created outside of any region.
1255 * script-sections.h (class Script_sections): Add prototypes for
1256 find_memory_region and block_in_region methods.
1257 * testsuite/memory_test.s: Use .long instead of .word.
1258 * testsuite/memory_test.t: Add some more output sections.
1259 * testsuite/memory_test.sh: Update expected output.
1261 2010-10-02 Doug Kwan <dougkwan@google.com>
1263 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1264 defintion to symtab.h
1265 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1266 declaration to defintion.
1268 2010-10-01 Nick Clifton <nickc@redhat.com>
1270 * expression.cc (eval): Replace dummy argument with NULL.
1271 (eval_maybe_dot): Check for a NULL result section pointer.
1272 (Symbol_expression::value): Likewise.
1273 (Dot_expression::value): Likewise.
1274 (BINARY_EXPRESSION): Likewise.
1275 (Max_expression::value): Likewise.
1276 (Min_expression::value): Likewise.
1277 (Absolute_expression::value): Likewise.
1278 (Addr_expression::value_from_output_section): Likewise.
1279 (Loaddddr_expression::value_from_output_section): Likewise.
1280 (Segment_start_expression::value): Likewise.
1281 * script-sections.cc
1282 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1284 (Sections_elememt_dot_assignment::set_section_addresses):
1286 (Output_data_expression::do_write_to_buffer): Likewise.
1287 (Output_section_definition::finalize_symbols): Likewise.
1288 (Output_section_definition::set_section_addresses): Likewise.
1290 2010-09-30 Doug Kwan <dougkwan@google.com>
1292 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1294 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1296 * target.h (Target::can_icf_inline_merge_sections): New virtual
1298 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1300 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1302 * icf.cc (get_section_contents): Inline merge sections only when
1305 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1307 * configure: Regenerate.
1309 2010-09-17 Ian Lance Taylor <iant@google.com>
1311 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1312 * testsuite/Makefile.am (memory_test.o): New target.
1313 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1315 * testsuite/Makefile.in: Rebuild.
1317 2010-09-17 Doug Kwan <dougkwan@google.com>
1319 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1320 defintion if relocation uses GOT entries of the symbol.
1321 * testsuite/icf_safe_test.sh: Fix test.
1322 * testsuite/icf_safe_so_test.sh: Fix test.
1324 2010-09-16 Cary Coutant <ccoutant@google.com>
1326 * script_sections.cc (class Memory_region): Remove "NULL" from
1327 vector initializations.
1329 2010-09-15 Cary Coutant <ccoutant@google.com>
1331 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1332 Resolve forwarding symbols.
1334 2010-09-15 Doug Kwan <dougkwan@google.com>
1336 * gold/testsuite/script_test_3.t: Add ARM special sections.
1337 * gold/testsuite/script_test_4.t: Same.
1338 * gold/testsuite/script_test_5.t: Same.
1339 * gold/testsuite/script_test_6.t: Same.
1340 * gold/testsuite/script_test_7.t: Same.
1341 * gold/testsuite/script_test_7.t: Same.
1342 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1344 2010-09-14 Cary Coutant <ccoutant@google.com>
1346 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1347 (Target_x86_64::Relocate::relocate_tls): Replace check for
1348 saw_tls_block_reloc_ with test for executable section.
1350 2010-09-12 Cary Coutant <ccoutant@google.com>
1352 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1353 position-independent executables to shared libraries need dynamic
1355 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1356 position-independent executables.
1357 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1358 * testsuite/Makefile.in: Regenerate.
1360 2010-09-10 Nick Clifton <nickc@redhat.com>
1363 * testsuite/memory_test.t: Discard any sections that are not
1366 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1369 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1370 "This::" to work around a bug in gcc 4.2.
1372 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1374 2010-09-09 Rafael Espindola <espindola@google.com>
1376 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1377 sections with different PF_X flags in the same segment.
1378 (Layout::find_first_load_seg): Search all segments to find the first
1380 * options.h (rosegment): New.
1382 2010-09-08 Rafael Espindola <espindola@google.com>
1384 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1386 2010-09-08 Doug Kwan <dougkwan@google.com>
1388 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1389 (Arm_relobj::do_relocate_sections): Add new parameter for output
1390 file to match the parent.
1391 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1392 of local symbols instead of input values. Update code to track
1393 changes in gold::relocate_section.
1394 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1395 (Sized_relobj::compute_final_local_value_internal): New methods.
1396 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1397 body into private version of Sized_relobj::compute_final_local_value.
1398 Call the inline method.
1399 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1400 merged symbol value if there is one.
1401 (Symbol_value::has_output_value): New method defintiion.
1402 (Sized_relobj::Compute_final_local_value_status): New enum type.
1403 (Sized_relobj::compute_final_local_value): New methods.
1404 (Sized_relobj::compute_final_local_value_internal): New methods.
1405 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1406 and arm_cortex_a8.sh.
1407 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1408 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1410 * Makefile.in: Regenerate.
1411 * testsuite/arm_bl_out_of_range.s: Update test.
1412 * testsuite/thumb_bl_out_of_range.s: Ditto.
1413 * testsuite/thumb_blx_out_of_range.s: Ditto.
1414 * testsuite/arm_branch_out_of_range.sh: New file.
1415 * testsuite/arm_cortex_a8.sh: Ditto.
1416 * testsuite/arm_cortex_a8_b.s: Ditto.
1417 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1418 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1419 * testsuite/arm_cortex_a8_bl.s: Ditto.
1420 * testsuite/arm_cortex_a8_blx.s: Ditto.
1421 * testsuite/arm_cortex_a8_local.s: Ditto.
1422 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1423 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1425 2010-09-08 Rafael Espindola <espindola@google.com>
1427 * Makefile.am (memory_test.stdout): Run readelf with -W.
1428 * Makefile.in: Regenerate.
1429 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1432 2010-09-08 Rafael Espindola <espindola@google.com>
1434 * script-sections.cc (Script_sections::add_memory_region): Convert
1435 field precision to int.
1436 * script.cc (script_set_section_region, script_set_section_region):
1437 Convert field precision to int.
1439 2010-09-08 Rafael Espindola <espindola@google.com>
1441 * arm.cc (do_finalize_sections): Create the __exidx_start and
1442 __exdix_end symbols even when the section is missing.
1444 2010-09-08 Nick Clifton <nickc@redhat.com>
1446 * README: Remove claim that MEMORY is not supported.
1447 * expression.cc (script_exp_function_origin)
1448 (script_exp_function_length): Move from here to ...
1449 * script.cc: ... here.
1450 (script_set_section_region, script_add_memory)
1451 (script_parse_memory_attr, script_include_directive): New
1453 * script-sections.cc
1454 (class Memory_region): New class.
1455 (class Output_section_definition): Add set_memory_region,
1456 set_section_vma, set_section_lma and get_section_name methods.
1457 (class Script_Sections): Add add_memory_region,
1458 find_memory_region, find_memory_region_origin,
1459 find_memory_region_length and set_memory_region methods.
1460 Have set_section_addresses method walk the list of set memory
1462 Extend the print methos to display memory regions.
1463 * script-sections.h: Add prototypes for new methods.
1464 Add enum for MEMORY region attributes.
1465 * yyscript.y: Add support for parsing MEMORY regions.
1466 * script-c.h: Add prototypes for new functions.
1467 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1468 * testsuite/Makefile.in: Regenerate.
1469 * testsuite/memory_test.sh: New script.
1470 * testsuite/memory_test.s: New assembler source file.
1471 * testsuite/memory_test.t: New linker script.
1473 2010-08-27 Doug Kwan <dougkwan@google.com>
1475 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1476 reference override an existing dynamic weak reference.
1477 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1478 * testsuite/Makefile.in: Regenerate.
1479 * testsuite/dyn_weak_ref.sh: New file.
1480 * testsuite/dyn_weak_ref_1.c: Ditto.
1481 * testsuite/dyn_weak_ref_2.c: Ditto.
1483 2010-08-27 Ian Lance Taylor <iant@google.com>
1485 * incremental.h (class Incremental_input_entry): Add virtual
1488 2010-08-27 Ian Lance Taylor <iant@google.com>
1490 * testsuite/start_lib_test_3.c: Mark t3 as used.
1492 2010-08-27 Nick Clifton <nickc@redhat.com>
1494 * options.cc (version_script): Fix small typo in previous
1497 2010-08-25 Nick Clifton <nickc@redhat.com>
1499 * archive.cc: Formatting fixes: Remove whitespace between
1500 typename and following asterisk. Remove whitespace between
1501 function name and opening parenthesis.
1502 * archive.h: Likewise.
1504 * attributes.cc: Likewise.
1505 * attributes.h: Likewise.
1506 * common.cc: Likewise.
1507 * copy-relocs.cc: Likewise.
1508 * dirsearch.h: Likewise.
1509 * dynobj.cc: Likewise.
1510 * ehframe.cc: Likewise.
1511 * ehframe.h: Likewise.
1512 * expression.cc: Likewise.
1513 * fileread.cc: Likewise.
1514 * fileread.h: Likewise.
1516 * gold-threads.cc: Likewise.
1517 * gold.cc: Likewise.
1518 * i386.cc: Likewise.
1520 * incremental-dump.cc: Likewise.
1521 * incremental.cc: Likewise.
1522 * layout.cc: Likewise.
1523 * layout.h: Likewise.
1524 * main.cc: Likewise.
1525 * merge.cc: Likewise.
1526 * merge.h: Likewise.
1527 * object.cc: Likewise.
1528 * object.h: Likewise.
1529 * options.cc: Likewise.
1530 * options.h: Likewise.
1531 * output.cc: Likewise.
1532 * output.h: Likewise.
1533 * plugin.cc: Likewise.
1534 * plugin.h: Likewise.
1535 * powerpc.cc: Likewise.
1536 * reloc.cc: Likewise.
1537 * script-c.h: Likewise.
1538 * script-sections.cc: Likewise.
1539 * script.cc: Likewise.
1540 * stringpool.cc: Likewise.
1541 * symtab.cc: Likewise.
1542 * symtab.h: Likewise.
1543 * target.cc: Likewise.
1544 * timer.cc: Likewise.
1545 * timer.h: Likewise.
1546 * version.cc: Likewise.
1547 * x86_64.cc: Likewise.
1549 2010-08-24 Nick Clifton <nickc@redhat.com>
1552 * layout.cc (segment_precedes): Sort segments by their physical
1553 addresses, if they have been set.
1555 2010-08-23 Cary Coutant <ccoutant@google.com>
1557 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1559 (Lib_group::include_member): Unlock object after deleting its
1561 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1564 2010-08-19 Neil Vachharajani <nvachhar@google.com>
1565 Cary Coutant <ccoutant@google.com>
1567 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1568 constructor, and set_blocker.
1569 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1571 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1572 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1573 * testsuite/Makefile.am (start_lib_test): New test case.
1574 * testsuite/Makefile.in: Regenerate.
1575 * testsuite/start_lib_test_main.c: New file.
1576 * testsuite/start_lib_test_1.c: New file.
1577 * testsuite/start_lib_test_2.c: New file.
1578 * testsuite/start_lib_test_3.c: New file.
1580 2010-08-19 Ian Lance Taylor <iant@google.com>
1582 * Makefile.in: Rebuild with automake 1.11.1.
1583 * aclocal.m4: Likewise.
1584 * testsuite/Makefile.in: Likewise.
1586 2010-08-19 Ian Lance Taylor <iant@google.com>
1589 * i386.cc (class Output_data_plt_i386): Update declarations.
1590 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1591 local_ifuncs_ fields.
1592 (Target_i386::do_plt_section_for_global): New function.
1593 (Target_i386::do_plt_section_for_local): New function.
1594 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1595 parameter; change all callers. Initialize global_ifuncs_ and
1596 local_ifuncs_. If doing a static link define __rel_iplt_start and
1598 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1599 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1600 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1602 (Target_i386::make_plt_section): New function, broken out of
1603 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1604 (Target_i386::make_plt_entry): Call make_plt_section.
1605 (Target_i386::make_local_ifunc_plt_entry): New function.
1606 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1607 (Target_i386::Scan::local): Handle IFUNC symbols. Add
1608 R_386_IRELATIVE to switch.
1609 (Target_i386::Scan::global): Likewise.
1610 (Target_i386::Relocate::relocate): Likewise.
1611 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1613 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1614 (Target_x86_64::do_plt_section_for_global): New function.
1615 (Target_x86_64::do_plt_section_for_local): New function.
1616 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1617 parameter; change all callers. If doing a static link define
1618 __rela_iplt_start and __rela_iplt_end.
1619 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1620 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1621 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1623 (Target_x86_64::make_local_ifunc_plt_entry): New function.
1624 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1626 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1627 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
1628 R_X86_64_IRELATIVE to switch.
1629 (Target_x86_64::Scan::global): Likewise.
1630 (Target_x86_64::Relocate::relocate): Likewise.
1631 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1633 * target.h (class Target): Add plt_section_for_global and
1634 plt_section_for_local functions. Add do_plt_section_for_global
1635 and do_plt_section_for_local virtual functions.
1636 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
1637 clarifying comments.
1638 (Symbol::use_plt_offset): Handle IFUNC symbol.
1639 * object.cc (Sized_relobj::Sized_relobj): Initialize
1641 (Sized_relobj::local_has_plt_offset): New function.
1642 (Sized_relobj::local_plt_offset): New function.
1643 (Sized_relobj::set_local_plt_offset): New function.
1644 (Sized_relobj::do_count): Handle IFUNC symbol.
1645 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
1646 a bit away from input_shndx_ field. Add set_is_func_symbol and
1647 is_ifunc_symbol functions.
1648 (class Sized_relobj): Update declarations. Remove Tls_got_entry
1649 and Local_tls_got_offsets. Define Local_plt_offsets. Add
1650 local_plt_offsets_ field.
1651 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1652 * output.h (class Output_section_data): Add non-const
1653 output_section function.
1654 (class Output_data_got): Update declarations.
1655 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1656 Add use_plt_offset parameter to global and local constructors.
1657 Change all callers. Change local_sym_index_ field to 31 bits.
1658 Change GSYM_CODE and CONSTANT_CODE accordingly.
1659 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1660 doing a static link don't set sh_link field.
1661 (Output_data_got::Got_entry::write): Use PLT offset if
1663 (Output_data_got::add_global_plt): New function.
1664 (Output_data_got::add_local_plt): New function.
1665 * target-reloc.h (relocate_section): Handle IFUNC symbol.
1666 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1667 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1668 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1669 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1671 * testsuite/ifunc-sel.h: New file.
1672 * testsuite/ifuncmain1.c: New file.
1673 * testsuite/ifuncmain1vis.c: New file.
1674 * testsuite/ifuncmod1.c: New file.
1675 * testsuite/ifuncdep2.c: New file.
1676 * testsuite/ifuncmain2.c: New file.
1677 * testsuite/ifuncmain3.c: New file.
1678 * testsuite/ifuncmod3.c: New file.
1679 * testsuite/ifuncmain4.c: New file.
1680 * testsuite/ifuncmain5.c: New file.
1681 * testsuite/ifuncmod5.c: New file.
1682 * testsuite/ifuncmain6pie.c: New file.
1683 * testsuite/ifuncmod6.c: New file.
1684 * testsuite/ifuncmain7.c: New file.
1685 * configure, testsuite/Makefile.in: Rebuild.
1687 2010-08-18 Ian Lance Taylor <iant@google.com>
1690 (Output_section_incremental_inputs::write_input_files): Add cast
1691 to avoid signed/unsigned comparison warning.
1692 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1694 2010-08-12 Cary Coutant <ccoutant@google.com>
1696 * common.cc (Sort_commons::operator()): Remove unnecessary code.
1698 2010-08-13 Ian Lance Taylor <iant@google.com>
1700 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1702 2010-08-12 Cary Coutant <ccoutant@google.com>
1703 Doug Kwan <dougkwan@google.com>
1705 * resolve.cc (Symbol_table::should_override): When a weak dynamic
1706 defintion overrides non-weak undef, remember that the original undef
1708 * symtab.cc (Symbol_table::sized_write_global): For undef without
1709 an original weak binding, set binding to global in output.
1710 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1711 * testsuite/Makefile.in: Regenerate.
1712 * testsuite/strong_ref_weak_def.sh: New file.
1713 * testsuite/strong_ref_weak_def_1.c: Ditto.
1714 * testsuite/strong_ref_weak_def_2.c: Ditto.
1716 2010-08-12 Cary Coutant <ccoutant@google.com>
1718 * testsuite/incremental_test.sh: Rewrite.
1719 * testsuite/incremental_test_1.c: Rewrite.
1720 * testsuite/incremental_test_2.c: Rewrite.
1722 2010-08-12 Cary Coutant <ccoutant@google.com>
1724 * arm.cc (Target_arm::got_size): Add const.
1725 (Target_arm::got_entry_count): New function.
1726 (Target_arm::plt_entry_count): New function.
1727 (Target_arm::first_plt_entry_offset): New function.
1728 (Target_arm::plt_entry_size): New function.
1729 (Output_data_plt_arm::entry_count): New function.
1730 (Output_data_plt_arm::first_plt_entry_offset): New function.
1731 (Output_data_plt_arm::get_plt_entry_size): New function.
1732 * i386.cc (Target_i386::got_size): Add const.
1733 (Target_i386::got_entry_count): New function.
1734 (Target_i386::plt_entry_count): New function.
1735 (Target_i386::first_plt_entry_offset): New function.
1736 (Target_i386::plt_entry_size): New function.
1737 (Output_data_plt_i386::entry_count): New function.
1738 (Output_data_plt_i386::first_plt_entry_offset): New function.
1739 (Output_data_plt_i386::get_plt_entry_size): New function.
1740 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1741 find_incremental_inputs_sections. Dump incremental_got_plt section.
1742 * incremental.cc: Include target.h.
1743 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1744 parameter. Adjust all callers. Find incremental_got_plt section.
1745 (Incremental_inputs::create_data_sections): Create incremental_got_plt
1747 (Output_section_incremental_inputs::set_final_data_size): Calculate
1748 size of incremental_got_plt section.
1749 (Output_section_incremental_inputs::do_write): Write the
1750 incremental_got_plt section.
1751 (Got_plt_view_info): New struct.
1752 (Local_got_offset_visitor): New class.
1753 (Global_got_offset_visitor): New class.
1754 (Global_symbol_visitor_got_plt): New class.
1755 (Output_section_incremental_inputs::write_got_plt): New function.
1756 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1757 Add parameter. Adjust all callers.
1758 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1759 (Incremental_inputs::got_plt_section): New function.
1760 (Incremental_inputs::got_plt_section_): New data member.
1761 (Incremental_got_plt_reader): New class.
1762 * layout.cc (Layout::create_incremental_info_sections): Add the
1763 incremental_got_plt section.
1764 * object.h (Got_offset_list::get_list): New function.
1765 (Got offset_list::for_all_got_offsets): New function.
1766 (Sized_relobj::local_got_offset_list): New function.
1767 * powerpc.cc (Target_powerpc::got_size): Add const.
1768 (Target_powerpc::got_entry_count): New function.
1769 (Target_powerpc::plt_entry_count): New function.
1770 (Target_powerpc::first_plt_entry_offset): New function.
1771 (Target_powerpc::plt_entry_size): New function.
1772 (Output_data_plt_powerpc::entry_count): New function.
1773 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1774 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1775 * sparc.cc (Target_sparc::got_size): Add const.
1776 (Target_sparc::got_entry_count): New function.
1777 (Target_sparc::plt_entry_count): New function.
1778 (Target_sparc::first_plt_entry_offset): New function.
1779 (Target_sparc::plt_entry_size): New function.
1780 (Output_data_plt_sparc::entry_count): New function.
1781 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1782 (Output_data_plt_sparc::get_plt_entry_size): New function.
1783 * symtab.h (Symbol::got_offset_list): New function.
1784 (Symbol_table::for_all_symbols): New function.
1785 * target.h (Sized_target::got_entry_count): New function.
1786 (Sized_target::plt_entry_count): New function.
1787 (Sized_target::plt_entry_size): New function.
1788 * x86_64.cc (Target_x86_64::got_size): Add const.
1789 (Target_x86_64::got_entry_count): New function.
1790 (Target_x86_64::plt_entry_count): New function.
1791 (Target_x86_64::first_plt_entry_offset): New function.
1792 (Target_x86_64::plt_entry_size): New function.
1793 (Output_data_plt_x86_64::entry_count): New function.
1794 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1795 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1797 2010-08-12 Cary Coutant <ccoutant@google.com>
1799 * archive.cc: Include incremental.h.
1800 (Archive::Archive): Initialize incremental_info_.
1801 (Archive::include_member): Record archive members in incremental info.
1802 (Add_archive_symbols::run): Record begin and end of an archive in
1804 (Lib_group::include_member): Record objects in incremental info.
1805 * archive.h (Incremental_archive_entry): Forward declaration.
1806 (Archive::set_incremental_info): New member function.
1807 (Archive::incremental_info): New member function.
1808 (Archive::Unused_symbol_iterator): New class.
1809 (Archive::unused_symbols_begin): New member function.
1810 (Archive::unused_symbols_end): New member function.
1811 (Archive::incremental_info_): New data member.
1812 * incremental-dump.cc (find_input_containing_global): New function.
1813 (dump_incremental_inputs): Dump new incremental info sections.
1814 * incremental.cc: Include symtab.h.
1815 (Output_section_incremental_inputs): New class.
1816 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1817 new incremental info sections.
1818 (Sized_incremental_binary::do_check_inputs): Likewise.
1819 (Incremental_inputs::report_archive): Remove.
1820 (Incremental_inputs::report_archive_begin): New function.
1821 (Incremental_inputs::report_archive_end): New function.
1822 (Incremental_inputs::report_object): New function.
1823 (Incremental_inputs::finalize_inputs): Remove.
1824 (Incremental_inputs::report_input_section): New function.
1825 (Incremental_inputs::report_script): Rewrite.
1826 (Incremental_inputs::finalize): Do nothing but finalize string table.
1827 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1828 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1829 (Incremental_inputs::create_data_sections): New function.
1830 (Incremental_inputs::relocs_entsize): New function.
1831 (Output_section_incremental_inputs::set_final_data_size): New function.
1832 (Output_section_incremental_inputs::do_write): New function.
1833 (Output_section_incremental_inputs::write_header): New function.
1834 (Output_section_incremental_inputs::write_input_files): New function.
1835 (Output_section_incremental_inputs::write_info_blocks): New function.
1836 (Output_section_incremental_inputs::write_symtab): New function.
1837 * incremental.h (Incremental_script_entry): Forward declaration.
1838 (Incremental_object_entry): Forward declaration.
1839 (Incremental_archive_entry): Forward declaration.
1840 (Incremental_inputs): Forward declaration.
1841 (Incremental_inputs_header_data): Remove.
1842 (Incremental_inputs_header): Remove.
1843 (Incremental_inputs_header_write): Remove.
1844 (Incremental_inputs_entry_data): Remove.
1845 (Incremental_inputs_entry): Remove.
1846 (Incremental_inputs_entry_write): Remove.
1847 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1848 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1849 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1850 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1852 (Incremental_input_entry): New class.
1853 (Incremental_script_entry): New class.
1854 (Incremental_object_entry): New class.
1855 (Incremental_archive_entry): New class.
1856 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1857 (Incremental_inputs::report_inputs): Remove.
1858 (Incremental_inputs::report_archive): Remove.
1859 (Incremental_inputs::report_archive_begin): New function.
1860 (Incremental_inputs::report_archive_end): New function.
1861 (Incremental_inputs::report_object): Change prototype.
1862 (Incremental_inputs::report_input_section): New function.
1863 (Incremental_inputs::report_script): Change prototype.
1864 (Incremental_inputs::get_reloc_count): New function.
1865 (Incremental_inputs::set_reloc_count): New function.
1866 (Incremental_inputs::create_data_sections): New function.
1867 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1868 (Incremental_inputs::inputs_section): New function.
1869 (Incremental_inputs::symtab_section): New function.
1870 (Incremental_inputs::relocs_section): New function.
1871 (Incremental_inputs::get_stringpool): Add const.
1872 (Incremental_inputs::command_line): Add const.
1873 (Incremental_inputs::inputs): Remove.
1874 (Incremental_inputs::command_line_key): New function.
1875 (Incremental_inputs::input_file_count): New function.
1876 (Incremental_inputs::input_files): New function.
1877 (Incremental_inputs::relocs_entsize): New function.
1878 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1879 (Incremental_inputs::finalize_inputs): Remove.
1880 (Incremental_inputs::Input_info): Remove.
1881 (Incremental_inputs::lock_): Remove.
1882 (Incremental_inputs::inputs_): Change type.
1883 (Incremental_inputs::inputs_map_): Remove.
1884 (Incremental_inputs::current_object_entry_): New data member.
1885 (Incremental_inputs::inputs_section_): New data member.
1886 (Incremental_inputs::symtab_section_): New data member.
1887 (Incremental_inputs::relocs_section_): New data member.
1888 (Incremental_inputs::reloc_count_): New data member.
1889 (Incremental_inputs_reader): New class.
1890 (Incremental_symtab_reader): New class.
1891 (Incremental_relocs_reader): New class.
1892 * layout.cc (Layout::finalize): Move finalization of incremental info
1893 and creation of incremental info sections to follow finalization of
1894 symbol table. Set offsets for postprocessing sections.
1895 (Layout::create_incremental_info_sections): Call
1896 Incremental_inputs::create_data_sections. Add incremental symtab
1897 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1898 sections to layout after input sections.
1899 * layout.h (struct Timespec): Forward declaration.
1900 (Layout::incremental_inputs): Add const.
1901 (Layout::create_incremental_info_sections): Add parameter.
1902 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1903 * object.cc: Include incremental.h.
1904 (Relobj::finalize_incremental_relocs): New function.
1905 (Sized_relobj::do_layout): Record input sections in incremental info.
1906 * object.h (Object::output_section): New function.
1907 (Object::output_section_offset): Moved from Relobj.
1908 (Object::get_incremental_reloc_base): New function.
1909 (Object::get_incremental_reloc_count): New function.
1910 (Object::do_output_section): New function.
1911 (Object::do_output_section_offset): Moved from Relobj.
1912 (Object::do_get_incremental_reloc_base): New function.
1913 (Object::do_get_incremental_reloc_count): New function.
1914 (Object::Object): Initialize new data members.
1915 (Relobj::output_section): Renamed do_output_section and moved to
1917 (Relobj::output_section_offset): Moved to Object.
1918 (Relobj::do_get_incremental_reloc_base): New function.
1919 (Relobj::do_get_incremental_reloc_count): New function.
1920 (Relobj::allocate_incremental_reloc_counts): New function.
1921 (Relobj::count_incremental_reloc): New function.
1922 (Relobj::finalize_incremental_relocs): New function.
1923 (Relobj::next_incremental_reloc_index): New function.
1924 (Relobj::reloc_counts_): New data member.
1925 (Relobj::reloc_bases_): New data member.
1926 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
1927 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
1928 (Sized_relobj::incremental_relocs_scan): New function.
1929 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1930 (Sized_relobj::incremental_relocs_write): New function.
1931 (Sized_relobj::incremental_relocs_write_reltype): New function.
1932 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1934 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1935 archives and object files elsewhere.
1936 (Add_symbols::run): Report object files here.
1937 (Finish_group::run): Report end of archive at end of group.
1938 * reloc.cc: Include layout.h, incremental.h.
1939 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1940 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1941 (Sized_relobj::incremental_relocs_scan): New function.
1942 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1943 (Sized_relobj::do_relocate_sections): Write incremental relocations.
1944 (Sized_relobj::incremental_relocs_write): New function.
1945 (Sized_relobj::incremental_relocs_write_reltype): New function.
1946 * script.cc (read_input_script): Rewrite test for incremental link.
1947 Change call to Incremental_inputs::report_script.
1948 * symtab.h (Symbol_table::first_global_index): New function.
1949 (Symbol_table::output_count): New function.
1951 2010-08-12 Doug Kwan <dougkwan@google.com>
1953 * arm.cc (Target_arm::merge_object_attributes): Check command line
1954 options --no-wchar-size-warning and --no-enum-size-warning.
1955 * options.h (General_options): Add ld-compatible options
1956 --no-enum-size-warning and --no-wchar-size-warning.
1958 2010-08-04 Ian Lance Taylor <iant@google.com>
1960 * x86_64.cc (Target_x86_64::Scan::local): Use
1961 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1962 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1963 (Target_x86_64::Scan::global): Likewise.
1964 (Target_x86_64::Relocate::relocate): Likewise.
1965 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1968 2010-08-03 Cary Coutant <ccoutant@google.com>
1970 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1971 to reserve space in merged_strings vector. Keep total input size
1973 (Output_merge_string::do_print_merge_stats): Print total input size.
1974 * merge.h (Output_merge_string): Add input_size_ field.
1975 * stringpool.cc (Stringpool_template::string_length): Move
1976 implementations out of Stringpool_template class and place in
1978 * stringpool.h (string_length): Move out of Stringpool_template.
1980 2010-08-03 Ian Lance Taylor <iant@google.com>
1983 * layout.cc (relaxation_loop_body): If address of load segment is
1984 set, adjust address to include headers if possible.
1986 2010-08-03 Ian Lance Taylor <iant@google.com>
1988 * version.cc (version_string): Bump to 1.10.
1990 2010-08-03 Ian Lance Taylor <iant@google.com>
1993 * layout.h (enum Output_section_order): Define.
1994 (class Layout): Update declarations.
1995 * layout.cc (Layout::get_output_section): Add order parameter.
1996 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1997 is_first_non_relro parameters. Change all callers.
1998 (Layout::choose_output_section): Likewise.
1999 (Layout::add_output_section_data): Likewise.
2000 (Layout::make_output_section): Likewise. Set order.
2001 (Layout::default_section_order): New function.
2002 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2003 * output.cc (Output_section::Output_section): Initialize order_.
2004 Don't initialize deleted fields.
2005 (Output_segment::Output_segment): Don't initialize deleted
2007 (Output_segment::add_output_section_to_load): New function
2008 replacing add_output_section. Change all callers to call this or
2009 add_output_section_to_nonload.
2010 (Output_segment::add_output_section_to_nonload): New function.
2011 (Output_segment::remove_output_section): Rewrite.
2012 (Output_segment::add_initial_output_data): Likewise.
2013 (Output_segment::has_any_data_sections): Likewise.
2014 (Output_segment::is_first_section_relro): Likewise.
2015 (Output_segment::maximum_alignment): Likewise.
2016 (Output_segment::has_dynamic_reloc): New function replacing
2017 dynamic_reloc_count. Change all callers.
2018 (Output_segment::has_dynamic_reloc_list): New function replacing
2019 dynamic_reloc_count_list. Change all callers.
2020 (Output_segment::set_section_addresses): Rewrite.
2021 (Output_segment::set_offset): Rewrite.
2022 (Output_segment::find_first_and_last_list): Remove.
2023 (Output_segment::set_tls_offsets): Rewrite.
2024 (Output_segment::first_section_load_address): Likewise.
2025 (Output_segment::output_section_count): Likewise.
2026 (Output_segment::section_with_lowest_load_address): Likewise.
2027 (Output_segment::write_section_headers): Likewise.
2028 (Output_segment::print_sections_to_map): Likewise.
2029 * output.h (class Output_data): Remove dynamic_reloc_count_
2030 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2031 (Output_data::add_dynamic_reloc): Rewrite.
2032 (Output_data::has_dynamic_reloc): New function.
2033 (Output_data::dynamic_reloc_count): Remove.
2034 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2035 is_last_relro_, is_first_non_relro_, is_interp_,
2036 is_dynamic_linker_section_ fields. Add order and set_order
2037 functions. Remove is_relro_local, set_is_relro_local,
2038 is_last_relro, set_is_last_relro, is_first_non_relro,
2039 set_is_first_non_relro functions, is_interp, set_is_interp,
2040 is_dynamic_linker_section, and set_is_dynamic_linker_section
2042 (class Output_segment): Change Output_data_list from std::list to
2043 std:;vector. Add output_lists_ field. Remove output_data_ and
2044 output_bss_ fields. Update declarations.
2046 2010-08-02 Ian Lance Taylor <iant@google.com>
2048 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2049 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2050 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2052 2010-08-02 Ian Lance Taylor <iant@google.com>
2055 * script.cc (Script_options::Script_options): Initialize
2056 symbol_definitions_ and symbol_references_.
2057 (Script_options::add_symbol_assignment): Update
2058 symbol_definitions_ and symbol_references_.
2059 (Script_options::add_symbol_reference): New function.
2060 (script_symbol): New function.
2061 * script.h (class Script_options): Add symbol_definitions_ and
2062 symbol_references_ fields.
2063 (Script_options::referenced_const_iterator): New type.
2064 (Script_options::referenced_begin): New function.
2065 (Script_options::referenced_end): New function.
2066 (Script_options::is_referenced): New function.
2067 (Script_options::any_unreferenced): New function.
2068 * script-c.h (script_symbol): Declare.
2069 * yyscript.y (exp): Call script_symbol.
2070 * symtab.cc: Include "script.h".
2071 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2072 Change all callers. Check symbols referenced by scripts.
2073 (Symbol_table::add_undefined_symbols_from_command_line): Add
2074 layout parameter. Change all callers.
2075 (Symbol_table::do_add_undefined_symbols_from_command_line):
2076 Likewise. Break out loop body. Check symbols referenced by
2078 (Symbol_table::add_undefined_symbol_from_command_line): New
2079 function broken out of
2080 do_add_undefined_symbols_from_command_line.
2081 * symtab.h (class Symbol_table): Update declarations.
2082 * archive.cc: Include "layout.h".
2083 (Archive::should_include_member): Add layout parameter. Change
2084 all callers. Check for symbol mentioned in expression.
2085 * archive.h (class Archive): Update declaration.
2086 * object.cc (Sized_relobj::do_should_include_member): Add layout
2088 * object.h (Object::should_include_member): Add layout parameter.
2090 (Object::do_should_include_member): Add layout parameter.
2091 (class Sized_relobj): Update declaration.
2092 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2094 * dynobj.h (class Sized_dynobj): Update declaration.
2095 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2097 * plugin.h (class Sized_pluginobj): Update declaration.
2099 2010-08-02 Ian Lance Taylor <iant@google.com>
2102 * output.cc (Output_segment::set_offset): Search for the first and
2103 last sections rather than assuming that the list is in order.
2104 (Output_segment::find_first_and_last_list): New function.
2105 * output.h (class Output_segment): Update declarations.
2106 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2107 (relro_strip_test_SOURCES): New variable.
2108 (relro_strip_test_DEPENDENCIES): New variable.
2109 (relro_strip_test_LDFLAGS): New variable.
2110 (relro_strip_test_LDADD): New variable.
2111 (relro_strip_test.so): New target.
2113 2010-08-02 Ian Lance Taylor <iant@google.com>
2115 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2116 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2117 (Target_i386::got_tlsdesc_section): New function.
2118 (Target_i386::got_section): Create space for GOT entries for
2119 TLSDESC relocations.
2120 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2122 (Target_i386::Scan::global): Likewise.
2123 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2125 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2126 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2127 (Target_x86_64::got_tlsdesc_section): New function.
2128 (Target_x86_64::got_section): Create space for GOT entries for
2129 TLSDESC relocations.
2130 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2132 (Target_x86_64::Scan::global): Likewise.
2133 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2136 2010-08-02 Ian Lance Taylor <iant@google.com>
2138 * testsuite/final_layout.sh: Use dc to convert from hex to
2141 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2143 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2144 paramter to the call to gold::gc_process_relocs.
2145 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2146 paramter to the call to gold::gc_process_relocs.
2147 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2148 parameter to the call to gold::gc_process_relocs.
2149 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2150 template parameter to the call to gold::gc_process_relocs.
2151 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2152 paramter to the call to gold::gc_process_relocs.
2153 * gc.h (get_embedded_addend_size): New function.
2154 (gc_process_relocs): Save the size of the reloc for use by ICF.
2155 * icf.cc (get_section_contents): Get the addend from the text section
2156 for SHT_REL relocation sections.
2157 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2158 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2159 * int_encoding.h (read_from_pointer): New overloaded function.
2160 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2161 * testsuite/icf_sht_rel_addend_test.sh: New file.
2162 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2163 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2165 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2167 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2168 * Makefile.in: Regenerate.
2169 * testsuite/Makefile.in: Regenerate.
2171 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2173 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2174 * gold/testsuite/debug_msg.cc: Likewise.
2175 * gold/testsuite/odr_violation1.cc
2176 * gold/testsuite/odr_violation2.cc
2178 2010-07-21 Cary Coutant <ccoutant@google.com>
2180 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2181 string, and length fields.
2182 (Output_merge_string::Merged_strings_list): New type.
2183 (Output_merge_string::Merged_strings_lists): New typedef.
2184 (Output_merge_string): Replace merged_strings_ with
2185 merged_strings_lists_.
2186 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2187 Merged_strings_list per input object and section. Don't store pointer
2188 to the string. Don't store length with each merged string entry.
2189 (Output_merge_string::finalize_merged_data): Loop over list of merged
2190 strings lists. Recompute length of each merged string.
2192 2010-07-15 Cary Coutant <ccoutant@google.com>
2194 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2197 2010-07-14 Ian Lance Taylor <iant@google.com>
2199 * descriptors.cc (Descriptors::open): Report correct name in error
2202 2010-07-13 Doug Kwan <dougkwan@google.com>
2204 * arm.cc (Arm_input_section::Arm_input_section): For a
2205 SHT_ARM_EXIDX section, always keeps the input sections.
2206 (Arm_input_section::set_exidx_section_link): New method.
2207 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2208 has_errors_ to false.
2209 (Arm_exidx_input_section::has_errors,
2210 Arm_exidx_input_section::set_has_errors): New methods.
2211 (Arm_exidx_input_section::has_errors_): New data member.
2212 (Arm_relobj::get_exidx_shndx_list): New method.
2213 (Arm_output_section::append_text_sections_to_list): Do not skip
2214 section without SHF_EXECINSTR.
2215 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2217 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2218 section header. Make error messages more verbose. Check for
2219 a non-executable section linked to an EXIDX section.
2220 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2221 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2222 check that there is no deferred EXIDX section if we exit early.
2223 Instead of not making an EXIDX section in case of an error, make one
2224 and set the has_errors flag of it.
2225 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2226 in a relocatable link.
2227 (Target_arm::do_relax): Look for the EXIDX output section instead of
2228 assuming that it is called .ARM.exidx.
2229 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2230 section list. Do not check for SHF_EXECINSTR section flags but
2231 skip any input section with errors.
2232 * output.cc (Output_section::Output_section): Initialize
2233 always_keeps_input_sections_ to false.
2234 (Output_section::add_input_section): Check for
2235 always_keeps_input_sections_.
2236 * output.h (Output_section::always_keeps_input_sections,
2237 Output_section::set_always_keeps_input_sections): New methods.
2238 (Output_section::always_keeps_input_sections): New data member.
2240 2010-07-13 Rafael Espindola <espindola@google.com>
2242 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2243 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2245 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2246 Ian Lance Taylor <iant@google.com>
2248 * output.h (Output_section_lookup_maps::add_merge_section):
2249 Correct check of whether value was inserted.
2250 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2251 (Output_section_lookup_maps::add_relaxed_input_section):
2253 * arm.cc (Target_arm::got_section): Remove used local os.
2254 * i386.cc (Target_i386::got_section): Likewise.
2255 * x86_64.cc (Target_x86_64::got_section): Likewise.
2256 * sparc.cc (Target_sparc::got_section): Likewise.
2257 (Target_sparc::relocate): Remove unused local have_got_offset.
2258 * powerpc.cc (Target_powerpc::relocate): Likewise.
2260 2010-07-13 Ian Lance Taylor <iant@google.com>
2262 * compressed_output.cc (zlib_decompress): Fix signature in
2265 * archive.cc (Archive::include_member): Unlock an external member
2266 of a thin archive. Don't bother to delete an object we know is
2269 2010-07-12 Cary Coutant <ccoutant@google.com>
2271 * compressed_output.cc (zlib_decompress): New function.
2272 (get_uncompressed_size): New function.
2273 (decompress_input_section): New function.
2274 * compressed_output.h (get_uncompressed_size): New function.
2275 (decompress_input_section): New function.
2276 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2277 Handle compressed debug sections.
2278 * layout.cc (is_compressed_debug_section): New function.
2279 (Layout::output_section_name): Map compressed section names to
2281 * layout.h (is_compressed_debug_section): New function.
2282 (is_debug_info_section): Recognize compressed debug sections.
2283 * merge.cc: Include compressed_output.h.
2284 (Output_merge_data::do_add_input_section): Handle compressed
2286 (Output_merge_string::do_add_input_section): Handle compressed
2288 * object.cc: Include compressed_output.h.
2289 (Sized_relobj::Sized_relobj): Initialize new data members.
2290 (build_compressed_section_map): New function.
2291 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2292 * object.h (Object::section_is_compressed): New method.
2293 (Object::do_section_is_compressed): New method.
2294 (Sized_relobj::Compressed_section_map): New type.
2295 (Sized_relobj::do_section_is_compressed): New method.
2296 (Sized_relobj::compressed_sections_): New data member.
2297 * output.cc (Output_section::add_input_section): Handle compressed
2299 * reloc.cc: Include compressed_output.h.
2300 (Sized_relobj::write_sections): Handle compressed debug sections.
2302 2010-07-08 Cary Coutant <ccoutant@google.com>
2304 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2305 weak when resolving to a dynamic def.
2306 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2307 for weak undef/dynamic def cases. Adjust callers.
2308 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2309 undef_binding_weak_.
2310 (Symbol_table::sized_write_globals): Adjust symbol binding.
2311 (Symbol_table::sized_write_symbol): Add binding parameter.
2312 * symtab.h (Symbol::set_undef_binding): New method.
2313 (Symbol::is_undef_binding_weak): New method.
2314 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2315 (Symbol_table::should_override): Add new parameter.
2316 (Symbol_table::sized_write_symbol): Add new parameter.
2318 * testsuite/weak_undef_file1.cc: Add new test case.
2319 * testsuite/weak_undef_file2.cc: Fix header comment.
2320 * testsuite/weak_undef_test.cc: Add new test case.
2322 2010-06-29 Doug Kwan <dougkwan@google.com>
2324 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2325 Initialize USE_SYMBOL_.
2326 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2328 (Arm_reloc_property::uses_symbol_): New data member declaration.
2329 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2330 uses symbol value and symbol is undefined but not weakly undefined.
2332 2010-06-28 Rafael Espindola <espindola@google.com>
2334 * plugin.cc (Plugin::load): Use dlerror.
2336 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2338 * symtab.cc (detect_odr_violations): When reporting an ODR
2339 violation, report an object where the symbol is defined.
2341 2010-06-25 Doug Kwan <dougkwan@google.com>
2343 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2344 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2346 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2347 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2348 target hook to detect function points.
2349 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2350 * icf.h (Icf::check_section_for_function_pointers): Change type of
2351 parameter SECTION_NAME to const reference to std::string. Use
2352 target hook to determine if section may have unsafe pointers.
2353 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2356 2010-06-21 Rafael Espindola <espindola@google.com>
2358 * fileread.cc (Input_file::find_fie): New
2359 (Input_file::open): Use Input_file::find_fie.
2360 * fileread.h (Input_file::find_fie): New
2361 * plugin.cc (set_extra_library_path): New.
2362 (Plugin::load): Add set_extra_library_path to the transfer vector.
2363 (Plugin_manager::set_extra_library_path): New.
2364 (Plugin_manager::add_input_file): Use the extra search path if set.
2365 (set_extra_library_path(): New.
2366 * plugin.h (Plugin_manager): Add set_extra_library_path and
2369 2010-06-19 Cary Coutant <ccoutant@google.com>
2371 * layout.cc (gdb_sections): Add .debug_types.
2372 (lines_only_debug_sections): Likewise.
2374 2010-06-18 Rafael Espindola <espindola@google.com>
2376 * plugin.cc (add_input_file,add_input_library)
2377 (Plugin_manager::add_input_file): Make filename arguments const.
2378 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2381 2010-06-16 Doug Kwan <dougkwan@google.com>
2383 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2384 .ARM.attributes section if we have not merged any input
2385 attributes sections.
2387 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2389 * arm.cc: Allow combining objects with no EABI version
2392 2010-06-15 Rafael Espindola <espindola@google.com>
2394 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2396 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2398 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2399 (struct iovec): Correct !HAVE_READV definition.
2401 2010-06-10 Cary Coutant <ccoutant@google.com>
2403 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2404 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2406 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2409 * symtab.h (Symbol::is_placeholder): New member function.
2410 * target-reloc.h (relocate_section): Check for placeholder symbols.
2412 * testsuite/Makefile.am (plugin_test_8): New test.
2413 (plugin_test_9): New test.
2414 * testsuite/Makefile.in: Regenerate.
2416 2010-06-09 Nick Clifton <nickc@redhat.com>
2418 * yyscript.y (input_list_element): Allow strings prefixed with
2419 the '-' character. Treat these as libraries.
2420 * script.cc (script_add_library): New function. Adds a library
2421 specified by "-l<name>" found in an input script.
2422 * script-c.h: Add prototype for script_add_library.
2424 2010-06-07 Doug Kwan <dougkwan@google.com>
2426 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2427 Restrict stub-group size to be within long conditional branch
2428 range when working around cortex-A8 erratum.
2430 2010-06-07 Damien Diederen <dd@crosstwine.com>
2432 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2435 2010-06-03 Sriraman Tallam <tmsriram@google.com>
2439 (Output_section::Input_section_sort_entry::compare_section_ordering):
2440 Change to return non-zero correctly.
2441 (Output_section::Input_section_sort_section_order_index_compare
2442 ::operator()): Change to fix ambiguity in comparisons.
2444 2010-06-01 Sriraman Tallam <tmsriram@google.com>
2446 * gold.h (is_wildcard_string): New function.
2447 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2448 (Layout::layout_eh_frame): Ditto.
2449 (Layout::find_section_order_index): New method.
2450 (Layout::read_layout_from_file): New method.
2451 * layout.h (Layout::find_section_order_index): New method.
2452 (Layout::read_layout_from_file): New method.
2453 (Layout::input_section_position_): New private member.
2454 (Layout::input_section_glob_): New private member.
2455 * main.cc (main): Call read_layout_from_file here.
2456 * options.h (--section-ordering-file): New option.
2457 * output.cc (Output_section::input_section_order_specified_): New
2459 (Output_section::Output_section): Initialize new member.
2460 (Output_section::add_input_section): Add new parameter.
2461 Keep input sections when --section-ordering-file is used.
2462 (Output_section::set_final_data_size): Sort input sections when
2463 section ordering file is specified.
2464 (Output_section::Input_section_sort_entry): Add new parameter.
2466 (Output_section::Input_section_sort_entry::compare_section_ordering):
2468 (Output_section::Input_section_sort_compare::operator()): Change to
2469 consider section_order_index.
2470 (Output_section::Input_section_sort_init_fini_compare::operator()):
2471 Change to consider section_order_index.
2472 (Output_section::Input_section_sort_section_order_index_compare
2473 ::operator()): New method.
2474 (Output_section::sort_attached_input_sections): Change to sort
2475 according to section order when specified.
2476 (Output_section::add_input_section<32, true>): Add new parameter.
2477 (Output_section::add_input_section<64, true>): Add new parameter.
2478 (Output_section::add_input_section<32, false>): Add new parameter.
2479 (Output_section::add_input_section<64, false>): Add new parameter.
2480 * output.h (Output_section::add_input_section): Add new parameter.
2481 (Output_section::input_section_order_specified): New
2483 (Output_section::set_input_section_order_specified): New method.
2484 (Input_section::Input_section): Initialize section_order_index_.
2485 (Input_section::section_order_index): New method.
2486 (Input_section::set_section_order_index): New method.
2487 (Input_section::section_order_index_): New member.
2488 (Input_section::Input_section_sort_section_order_index_compare): New
2490 (Output_section::input_section_order_specified_): New member.
2491 * script-sections.cc (is_wildcard_string): Delete and move modified
2493 (Output_section_element_input::Output_section_element_input): Modify
2494 call to is_wildcard_string.
2495 (Output_section_element_input::Input_section_pattern
2496 ::Input_section_pattern): Ditto.
2497 (Output_section_element_input::Output_section_element_input): Ditto.
2498 * testsuite/Makefile.am (final_layout): New test case.
2499 * testsuite/Makefile.in: Regenerate.
2500 * testsuite/final_layout.cc: New file.
2501 * testsuite/final_layout.sh: New file.
2503 2010-06-01 Rafael Espindola <espindola@google.com>
2505 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2507 2010-06-01 Rafael Espindola <espindola@google.com>
2509 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2510 visibility of symbols.
2512 2010-05-27 Doug Kwan <dougkwan@google.com>
2514 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2515 from start of output section instead of address for a local symbol
2516 in a merged or relaxed section when doing a relocatable link.
2518 2010-05-26 Rafael Espindola <espindola@google.com>
2521 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2522 adding sections the garbage collector removed.
2523 * gold/testsuite/Makefile.am: Add test.
2524 * gold/testsuite/Makefile.in: Regenerate.
2525 * gold/testsuite/plugin_test_7.sh: New.
2526 * gold/testsuite/plugin_test_7_1.c: New.
2527 * gold/testsuite/plugin_test_7_2.c: New.
2529 2010-05-26 Rafael Espindola <espindola@google.com>
2531 * script-sections.cc (Output_section_definition::set_section_addresses):
2532 Check for --section-start.
2534 2010-05-26 Doug Kwan <dougkwan@google.com>
2536 * arm.cc (Arm_scan_relocatable_relocs): New class.
2537 (Target_arm::relocate_special_relocatable): New method.
2538 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2539 (Arm_relocate_functions::thumb_branch_common): Same.
2540 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2541 instead of Default_scan_relocatable_relocs.
2542 * target-reloc.h (relocate_for_relocatable): Let target handle
2543 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2544 * target.h (Sized_target::relocate_special_relocatable): New method.
2546 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2548 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2550 2010-05-23 Doug Kwan <dougkwan@google.com>
2552 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2554 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2555 with a direct branch, not a conditional branch, to a stub.
2556 * merge.cc (Output_merge_base::record_input_section): New method
2558 (Output_merge_data::do_add_input_section): Record input section if
2559 keeps-input-sections flag is set.
2560 (Output_merge_string::do_add_input_section): Ditto.
2561 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2562 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2564 (Output_merge_base::keeps_input_sections,
2565 Output_merge_base::set_keeps_input_sections,
2566 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2568 (Output_merge_base::Input_sections): New type declaration.
2569 (Output_merge_base::input_sections_begin,
2570 Output_merge_base::input_sections_end,
2571 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2572 (Output_merge_base::bool keeps_input_sections_,
2573 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2574 Output_merge_base::input_sections_): New data members.
2575 (Output_merge_data::do_set_keeps_input_sections): New method
2577 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2578 * output.cc (Output_section::Input_section::relobj): Move method
2579 defintion from class declaration to here and handle merge sections.
2580 (Output_section::Input_section::shndx): Ditto.
2581 (Output_section::Output_section): Remove initializations of removed
2582 data members and initialize new data member LOOKUP_MAPS_.
2583 (Output_section::add_input_section): Set keeps-input-sections flag
2584 for a newly created merge output section as appropriate. Adjust code
2585 to use Output_section_lookup_maps class.
2586 (Output_section::add_relaxed_input_section): Adjst code for lookup
2587 maps code refactoring.
2588 (Output_section::add_merge_input_section): Add a new parameter
2589 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2590 class. If adding input section to a newly created merge output
2591 section fails, remove the new merge section.
2592 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2593 Adjust code for use of the Output_section_lookup_maps class.
2594 (Output_section::find_merge_section): Ditto.
2595 (Output_section::build_lookup_maps): New method defintion.
2596 (Output_section::find_relaxed_input_section): Adjust code to use
2597 Output_section_lookup_maps class.
2598 (Output_section::get_input_sections): Export merge sections. Adjust
2599 code to use Output_section_lookup_maps class.
2600 (Output_section:::add_script_input_section): Adjust code to use
2601 Output_section_lookup_maps class. Update lookup maps for merge
2603 (Output_section::discard_states): Use Output_section_lookup_maps.
2604 (Output_section::restore_states): Same.
2605 * output.h (Merge_section_properties): Move class defintion out of
2607 (Output_section_lookup_maps): New class.
2608 (Output_section::Input_section::is_merge_section): New method
2610 (Output_section::Input_section::relobj): Move defintion out of class
2611 defintion. Declare method only.
2612 (Output_section::Input_section::shndx): Ditto.
2613 (Output_section::Input_section::output_merge_base): New method defintion.
2614 (Output_section::Input_section::u2_.pomb): New union field.
2615 (Output_section::Merge_section_by_properties_map,
2616 Output_section::Output_section_data_by_input_section_map,
2617 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2619 (Output_section::add_merge_input_section): Add new parameter
2620 KEEPS_INPUT_SECTIONS.
2621 (Output_section::build_lookup_maps): New method declaration.
2622 (Output_section::merge_section_map_,
2623 Output_section::merge_section_by_properties_map_,
2624 Output_section::relaxed_input_section_map_,
2625 Output_section::is_relaxed_input_section_map_valid_): Remove data
2627 (Output_section::lookup_maps_): New data member.
2629 2010-05-21 Doug Kwan <dougkwan@google.com>
2632 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2633 avoid a compilation error.
2635 2010-05-19 Rafael Espindola <espindola@google.com>
2637 * script-sections.cc (Output_section_definition::allocate_to_segment):
2638 Update the phdrs_list even when the output section is NULL.
2639 * testsuite/Makefile.am: Add test.
2640 * testsuite/Makefile.in: Regenerate.
2641 * testsuite/script_test_9.cc: New.
2642 * testsuite/script_test_9.sh: New.
2643 * testsuite/script_test_9.t: New.
2645 2010-05-19 Doug Kwan <dougkwan@google.com>
2647 * arm.cc (Arm_input_section::original_size): New method.
2648 (Arm_input_section::do_addralign): Add a cast.
2649 (Arm_input_section::do_output_offset): Remove static cast.
2650 (Arm_input_section::original_addralign,
2651 Arm_input_section::original_size_): Change type to uint32_t.
2652 (Arm_input_section::init): Add safe casts for section alignment
2654 (Arm_input_section::set_final_data_size): Do not set address and
2655 offset of stub table.
2656 (Arm_output_section::fix_exidx_coverage): Change use of of
2657 Output_section::Simple_input_section to that of
2658 Output_section::Input_section.
2659 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2660 except for the first pass.
2661 * output.cc (Output_section::get_input_sections): Change type of
2662 input_sections to std::list<Input_section>.
2663 (Output_section::add_script_input_section): Rename from
2664 Output_section::add_simple_input_section. Change type of SIS
2665 parameter from Simple_input_section to Input_section.
2666 * output.h (Output_section::Simple_input_section): Remove class.
2667 (Output_section::Input_section): Change class visibility to public.
2668 (Output_section::Input_section::addralign): Use stored alignments
2669 for special input sections if set.
2670 (Output_section::Input_section::set_addralign): New method.
2671 (Output_section::get_input_sections): Change parameter type from
2672 list of Simple_input_section to list of Input_section.
2673 (Output_section::add_script_input_section): Rename from
2674 Output_section::add_simple_input_section. Change first parameter's
2675 type from Simple_input_section to Input_section and remove the
2676 second and third parameters.
2677 * script-sections.cc (Input_section::Input_section_list): Change
2678 type to list of Output_section::Input_section/
2679 (Input_section_info::Input_section_info): Change parameter type of
2680 INPUT_SECTION to Output_section::Input_section.
2681 (Input_section_info::input_section): Change return type.
2682 (Input_section_info::input_section_): Change type to
2683 Output_section::Input_section.
2684 (Output_section_element_input::set_section_addresses): Adjust code
2685 to use Output_section::Input_section instead of
2686 Output_section::Simple_input_section. Adjust code for renaming
2687 of Output_section::add_simple_input_section.
2688 (Orphan_output_section::set_section_addresses): Ditto.
2690 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2692 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2693 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2695 2010-05-18 Rafael Espindola <espindola@google.com>
2697 * options.cc (General_options::finalize): Handle -nostdlib.
2698 * options.h (nostdlib): New option.
2699 * script.cc (script_add_search_dir): Handle -nostdlib.
2701 2010-05-12 Doug Kwan <dougkwan@google.com>
2703 * arm.cc (Target_arm::do_finalize_sections): Create an empty
2704 attributes section only if there no attributes section after merging.
2705 (Target_arm::merge_object_attributes): Move value of
2706 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2707 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2708 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2709 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2710 and arm_attr_merge_7.stdout.
2711 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2712 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2713 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2714 arm_attr_merge_7b.o): New rules.
2715 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2717 * testsuite/Makefile.in: Regenerate.
2718 * testsuite/arm_attr_merge.sh: New file.
2719 * testsuite/arm_attr_merge_[67][ab].s: Same.
2721 2010-05-05 Nick Clifton <nickc@redhat.com>
2723 * po/es.po: Updated Spanish translation.
2725 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2727 * Makefile.am (install-exec-local): Properly install gold as
2728 default cross linker.
2729 * Makefile.in: Regenerated.
2731 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2732 Nick Clifton <nickc@redhat.com>
2734 * configure.ac (install_as_default): Define and set to false
2735 unless --enable-gold or --enable-gold=both/gold has been
2737 * configure: Regenerate.
2739 * Makefile.am (install-exec-local): Install the executable as
2740 'ld.gold'. If install_as_default is true then also install it as
2742 * Makefile.in: Regenerated.
2744 2010-04-24 Ian Lance Taylor <iant@google.com>
2746 * layout.cc (Layout::layout_reloc): In relocatable link don't
2747 combine reloc sections for grouped sections.
2749 2010-04-23 Sriraman Tallam <tmsriram@google.com>
2751 * gc.h (gc_process_relocs): Pass information on relocs pointing to
2752 sections that are not ordinary to icf.
2753 * icf.cc (get_section_contents): Handle relocation pointing to section
2754 with no object or shndx information.
2755 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2756 * testsuite/Makefile.in: Regenerate.
2757 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2758 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2760 2010-04-22 Ian Lance Taylor <iant@google.com>
2762 * expression.cc (Expression::Expression_eval_info): Add
2763 result_alignment_pointer field.
2764 (Expression::eval_with_dot): Add result_alignment_pointer
2765 parameter. Change all callers.
2766 (Expression::eval_maybe_dot): Likewise.
2767 (class Binary_expression): Add alignment_pointer parameter to
2768 left_value and right_value. Change all callers.
2769 (BINARY_EXPRESSION): Set result alignment.
2770 (class Trinary_expression): Add alignment_pointer parameter to
2771 arg2_value and arg3_value. Change all callers.
2772 (Trinary_cond::value): Set result alignment.
2773 (Max_expression::value, Min_expression::value): Likewise.
2774 (Align_expression::value): Likewise.
2775 * script-sections.cc (class Sections_element): Add dot_alignment
2776 parameter to set_section_addresses virtual function. Update
2778 (class Output_section_element): Likewise.
2779 (Script_sections::create_segments): Add dot_alignment parameter.
2781 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2782 (Script_sections::set_phdrs_clause_addresses): Likewise.
2783 * script-sections.h: Update declarations.
2784 * script.h: Update declarations.
2785 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2787 * testsuite/script_test_3.t: Set large alignment.
2788 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2789 segment has expected alignment.
2791 2010-04-22 Nick Clifton <nickc@redhat.com>
2793 * po/gold.pot: Updated by the Translation project.
2794 * po/vi.po: Updated Vietnamese translation.
2796 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
2798 * testsuite/Makefile.am (check_PROGRAMS): Add
2799 icf_virtual_function_folding_test.
2800 * testsuite/Makefile.in: Regenerated.
2802 2010-04-15 Andrew Haley <aph@redhat.com>
2804 * options.h (merge_exidx_entries): New option.
2805 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2806 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2807 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2808 (Target_arm::merge_exidx_entries): New function.
2809 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2810 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2811 to Arm_exidx_fixup constructor.
2812 Add new arg, merge_exidx_entries.
2813 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2814 Arm_output_section::fix_exidx_coverage.
2816 2010-04-18 Sriraman Tallam <tmsriram@google.com>
2818 * icf.cc (get_section_contents): Check for preemptible functions.
2819 Ignore addend when appropriate.
2820 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2822 (add_from_relobj): Check for section folded.
2823 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2824 * symtab.h (should_add_dynsym_entry): Add new parameter.
2825 * target-reloc.h (scan_relocs): Check for section folded.
2826 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2827 Check reloc types for function pointers in shared objects.
2828 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2830 (icf_preemptible_functions_test): New test case.
2831 (icf_string_merge_test): New test case.
2832 * testsuite.Makefile.in: Regenerate.
2833 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2834 bar_glob. Refactor code.
2835 * testsuite/icf_preemptible_functions_test.cc: New file.
2836 * testsuite/icf_preemptible_functions_test.sh: New file.
2837 * testsuite/icf_string_merge_test.cc: New file.
2838 * testsuite/icf_string_merge_test.sh: New file.
2839 * testsuite/icf_virtual_function_folding_test.cc: New file.
2840 * testsuite/icf_virtual_function_folding_test.sh: New file.
2842 2010-04-14 Doug Kwan <dougkwan@google.com>
2844 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2845 for local symbol recounting if we remove a section due to ICF.
2846 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2847 there are no regular objects in input.
2849 2010-04-13 Doug Kwan <dougkwan@google.com>
2851 * arm.cc (Arm_input_section::set_final_data_size): Compute
2852 accurate final data size instead of using current data size.
2854 2010-04-09 Doug Kwan <dougkwan@google.com>
2856 * layout.cc (Layout::choose_output_section): Handle script section
2858 (Layout::make_output_section_for_script): Add section type parameter.
2859 Handle script section types.
2860 * layout.h (Layout::make_output_section_for_script): Add section
2862 * output.cc (Output_section::Output_section): Initialize data member
2864 (Output_section::do_reset_address_and_file_offset): Do not set address
2865 to 0 if section is a NOLOAD section.
2866 * output.h (Output_section::is_noload): New method.
2867 (Output_section::set_is_noload): Ditto.
2868 (Output_section::is_noload_): New data member.
2869 * script-c.h (Script_section_type): New enum type.
2870 (struct Parser_output_section_header): Add new file section_type.
2871 * script-sections.cc (Sections_element::output_section_name): Add
2872 parameter for returning script section type.
2873 (Output_section_definition::output_section_name): Ditto.
2874 (Output_section_definition::section_type)P; New method.
2875 (Output_section_definiton::script_section_type_name): Ditto.
2876 (Output_section_definition::script_section_type_): New data member.
2877 (Output_section_definition::Output_section_definition): Initialize
2878 data member Output_section_definition::script_section_type_.
2879 (Output_section_definition::create_sections): Pass script section type
2880 to Layout::make_output_section_for_script.
2881 (Output_section_definition::output_section_name): Return script
2882 section type to caller.
2883 (Output_section_definition::set_section_address): Do not advance
2884 dot value and load address if section type is NOLOAD. Set address
2885 of NOLOAD sections regardless of section flags.
2886 (Output_section_definition::print): Print section type if it is
2887 not SCRIPT_SECTION_TYPE_NONE.
2888 (Output_section_definition::section_type): New method.
2889 (Output_section_definition::script_section_type_name): Ditto.
2890 (Script_sections::output_section_name): Add new parameter
2891 PSECTION_TYPE for returning script section type. Pass it to
2892 section elements. Handle discard sections.
2893 (Sort_output_sections::operator()): Handle NOLOAD sections.
2894 * script-sections.h (Script_sections::Section_type): New enum type.
2895 (Script_sections::output_section_name): Add a new parameter for
2896 returning script section type.
2897 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2899 * yyscript.y (union): Add new field SECTION_TYPE.
2900 (COPY, DSECT, INFO, NOLOAD): New tokens.
2901 (opt_address_and_section_type): Change type to output_section_header.
2902 (section_type): New non-terminal
2903 (section_header): Handle section type.
2904 (opt_address_and_section_type): Return section type value.
2906 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
2908 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2909 * testsuite/plugin_common_test_2.c (foo): Likewise.
2911 2010-04-08 Doug Kwan <dougkwan@google.com>
2913 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2915 * output.cc (Output_section::add_merge_input_section): Simplify
2916 code and return status of Output_merge_base::add_input_section.
2917 Update merge section map only if Output_merge_base::add_input_section
2920 2010-04-07 Doug Kwan <dougkwan@google.com>
2922 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2923 if section is marked as containing instructions but has no mapping
2925 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2926 correct section index.
2927 (Arm_relobj::find_linked_text_section): Ditto.
2929 2010-04-07 Cary Coutant <ccoutant@google.com>
2931 * archive.cc (include_member): Destroy Read_symbols_data object before
2933 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2934 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2935 (Read_symbols_data::~Read_symbols_data) New destructor.
2936 (Section_relocs::Section_relocs) New constructor.
2937 (Section_relocs::~Section_relocs) New destructor.
2938 (Read_relocs_data::Read_relocs_data) New constructor.
2939 (Read_relocs_data::~Read_relocs_data) New destructor.
2940 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2941 pointers to NULL after deleting.
2943 2010-04-07 Doug Kwan <dougkwan@google.com>
2945 * arm.cc: Replace "endianity" with "endianness" in comments.
2946 (Arm_exidx_cantunwind): Ditto.
2947 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2948 (Arm_relobj::merge_flags_and_attributes): New method.
2949 (Arm_relobj::merge_flags_and_attributes_): New data member.
2950 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2951 (Arm_relobj::scan_sections_for_stubs): Ditto.
2952 (Arm_relobj::do_read_symbols): Check to see if we really want to
2953 merge processor-specific flags and attributes. Exit early if
2954 an object is empty except for section names and the undefined symbol.
2955 (Target_arm::do_finalize_sections): Move check for ELF format to
2956 Arm_relobj::do_read_symbols. Merge processor specific flags and
2957 attributes from a regular object only when we have determined that
2958 it is aapropriate. Do not create an .ARM.attributes section in
2959 output if there is no regular input object.
2960 (Target_arm::merge_processor_specific_flags): Check
2961 --warn-mismatch before printing any error.
2962 (Target_arm::merge_object_attributes): Ditto.
2963 * gold.cc (queue_middle_tasks): Handle the case in which there is
2964 no regular object in input.
2965 * options.cc (General_options::parse_EB): New method.
2966 (General_options::parse_EL): Same.
2967 (General_options::General_options): Initialize endianness_.
2968 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2970 (General_options::Endianness): New enum.
2971 (General_options::endianness): New method.
2972 (General_options::endianness_): New data member.
2973 * parameters.cc (Parameters::set_options): Check target endianness.
2974 (Parameters::set_target_once): Ditto.
2975 (Parameters::check_target_endianness): New method.
2976 (parameters_force_valid_target): If either -EL or -EB is specified,
2977 use it to define endianness of default target.
2978 * parameters.h (Parameters::check_target_endianness): New method
2980 * target.h (class Target): Change "endianity" to "endianness"
2983 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2985 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2986 * configure: Regenerate.
2987 * Makefile.in: Regenerate.
2988 * testsuite/Makefile.in: Regenerate.
2990 2010-04-06 Cary Coutant <ccoutant@google.com>
2993 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2994 prevailing definitions of common symbols.
2995 * testsuite/plugin_test_6.sh: New test case.
2996 * testsuite/plugin_common_test_1.c: New test case.
2997 * testsuite/plugin_common_test_2.c: New test case.
2998 * testsuite/Makefile.am (plugin_test_6): New test case.
2999 * testsuite/Makefile.in: Regenerate.
3001 2010-04-06 Nick Clifton <nickc@redhat.com>
3003 * po/vi.po: New Vietnamese translation.
3005 2010-03-30 Doug Kwan <dougkwan@google.com>
3007 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3009 2010-03-25 Doug Kwan <dougkwan@google.com>
3011 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3012 to avoid a conversion warning on a 32-bit host.
3014 2010-03-24 Ian Lance Taylor <iant@google.com>
3016 * testsuite/script_test_3.t: Add a TLS segment.
3017 * testsuite/Makefile.am (check_PROGRAMS): Add
3018 tls_phdrs_script_test.
3019 (tls_phdrs_script_test_SOURCES): Define.
3020 (tls_phdrs_script_test_DEPENDENCIES): Define.
3021 (tls_phdrs_script_test_LDFLAGS): Define.
3022 (tls_phdrs_script_test_LDADD): Define.
3023 * testsuite/Makefile.in: Rebuild.
3025 2010-03-23 Cary Coutant <ccoutant@google.com>
3027 * fileread.cc (find_or_make_view): Fix comment.
3029 2010-03-23 Ian Lance Taylor <iant@google.com>
3031 * script-sections.cc (class Orphan_section_placement): Define
3032 PLACE_TLS and PLACE_TLS_BSS.
3033 (Orphan_section_placement::Orphan_section_placement): Initialize
3035 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3036 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3037 (tls_script_test_SOURCES): Define.
3038 (tls_script_test_DEPENDENCIES): Define.
3039 (tls_script_test_LDFLAGS): Define.
3040 (tls_script_test_LDADD): Define.
3041 * testsuite/Makefile.in: Rebuild.
3043 2010-03-22 Doug Kwan <dougkwan@google.com>
3045 * arm.cc (Arm_relocate_functions::abs8,
3046 Arm_relocate_functions::abs16): Use correct check for overflow
3047 specified in the ARM ELF specs.
3048 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3049 target of a BLX instruction specially.
3050 (Reloc_stub::stub_type_for_reloc): Ditto.
3051 (Relocate::relocate): Use symbolic names instead of numeric relocation
3052 codes to report error.
3053 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3055 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3056 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3057 thumb2_blx_out_of_range.stdout
3058 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3059 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3060 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3061 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3062 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3063 thumb2_blx_in_range, thumb2_blx_in_range.o,
3064 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3065 thumb2_blx_out_of_range.o): New rules.
3066 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3067 thumb2_blx_in_range and thumb2_blx_out_of_range.
3068 * testsuite/Makefile.in: Regenerate.
3069 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3070 * testsuite/thumb_blx_in_range.s: New file.
3071 * testsuite/thumb_blx_out_of_range.s: New file.
3073 2010-03-22 Rafael Espindola <espindola@google.com>
3075 * archive.cc (Should_include): Move to archive.h.
3076 (should_include_member): Make it a member of Archive.
3078 (Add_lib_group_symbols): New.
3079 * archive.h: Include options.h.
3080 (Archive_member): Moved from Archive.
3081 (Should_include): Moved from archive.cc.
3083 (Add_lib_group_symbols): New.
3084 * dynobj.cc (do_should_include_member): New.
3085 * dynobj.h (do_should_include_member): New.
3086 * gold.cc (queue_initial_tasks): Update call to queue.
3087 * main.cc (main): Print lib group stats.
3088 * object.cc (do_should_include_member): New.
3089 * object.h: Include archive.h.
3090 (Object::should_include_member): New.
3091 (Object::do_should_include_member): New.
3092 (Sized_relobj::do_should_include_member): New.
3093 * options.cc (General_options::parse_start_lib): New.
3094 (General_options::parse_end_lib): New.
3095 (Input_arguments::add_file): Handle lib groups.
3096 (Input_arguments::start_group): Check we are not in a lib.
3097 (Input_arguments::start_lib): New.
3098 (Input_arguments::end_lib): New.
3099 * options.h (General_options): Add start_lib and end_lib.
3100 (Input_argument::lib_): New.
3101 (Input_argument::lib): New.
3102 (Input_argument::is_lib): New.
3103 (Input_file_lib): New.
3104 (Input_arguments::in_lib_): New.
3105 (Input_arguments::in_lib): New.
3106 (Input_arguments::start_lib): New.
3107 (Input_arguments::end_lib_): New.
3108 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3109 in unused members as preempted.
3110 (Sized_pluginobj::do_should_include_member): New.
3111 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3112 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3114 (Read_symbols::do_whole_lib_group): New.
3115 (Read_symbols::do_lib_group): New.
3116 (Read_symbols::do_read_symbols): Handle lib groups.
3117 (Read_symbols::get_name): Handle lib groups.
3118 * readsyms.h (Read_symbols): Add an archive member pointer.
3119 (Read_symbols::do_whole_lib_group): New.
3120 (Read_symbols::do_lib_group): New.
3121 (Read_symbols::member_): New.
3122 * script.cc (read_input_script): Update call to queue_soon.
3124 2010-03-19 Doug Kwan <dougkwan@google.com>
3126 * arm.cc (Stub_table::Stub_table): Initialize new data members
3127 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3128 (Stub_table::add_reloc_stub): Assign stub offset and update
3129 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3130 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3132 (Stub_table::update_data_size_and_addralign): Use
3133 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3134 instead of going over all reloc stubs.
3135 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3136 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3137 Stringpool_template::offset_ to size of Stringpool_char.
3138 (Stringpool_template::new_key_offset): Remove code to initialize
3139 Stringpool_template::offset_.
3140 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3141 Stringpool_template::offset_ to zero.
3143 2010-03-15 Doug Kwan <dougkwan@google.com>
3145 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3147 (Stringpool_template::new_key_offset): New method.
3148 (Stringpool_template::add_string): Assign offsets when adding new
3150 (Stringpool_template::set_string_offsets): Do not set string offsets
3151 when not optimizing.
3152 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3154 (Chunked_vector::clear): Clear size_.
3155 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3156 (Chunked_vector::size): Return size_.
3157 (Chunked_vector::push_back): Use size_ to find insert position.
3158 (Chunked_vector::size_): New data member.
3159 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3160 (Stringpool_template::new_key_offset): New method declaration.
3161 (Stringpool_template::offset_): New data member.
3163 2010-03-15 Rafael Espindola <espindola@google.com>
3165 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3166 Add_symbols' constructor.
3167 * readsyms.h (Add_symbols): Remove the input_group member.
3169 2010-03-10 Ian Lance Taylor <iant@google.com>
3171 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3172 target to ask whether a reference to a symbol requires a stack
3174 * target.h (Target::is_call_to_non_split): New function.
3175 (Target::do_is_call_to_non_split): Declare virtual function.
3176 * target.cc: Include "symtab.h".
3177 (Target::do_is_call_to_non_split): New function.
3178 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3180 2010-03-10 Cary Coutant <ccoutant@google.com>
3182 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3183 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3184 (File_read::open[2]): Add whole_file_view_ to list of views.
3185 (File_read::make_view): Remove test of whole_file_view_.
3186 (File_read::find_or_make_view): Create whole_file_view_ if
3188 (File_read::clear_views): Replace bool parameter with enum;
3189 adjust all callers. Don't delete views with permanent data;
3190 do delete cached views and views from archives if
3191 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3192 if clearing the corresponding view.
3193 * fileread.h (File_read::Clear_views_mode): New enum.
3194 (File_read::View::is_permanent_view): New method.
3195 (File_read::clear_views): Replace bool parameter
3196 with enum; adjust all callers.
3197 * options.h (General_options): Change keep_files_mapped option;
3198 add map_whole_files.
3199 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3201 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3204 2010-03-10 David S. Miller <davem@davemloft.net>
3206 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3208 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3210 * icf.cc (get_section_contents): Add '@' marker after processing the
3213 2010-03-08 Doug Kwan <dougkwan@google.com>
3215 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3216 due to a conversion warning.
3217 (Arm_relobj::update_output_local_symbol_count): Check for local
3218 symbol with unset output index.
3220 2010-03-05 Ian Lance Taylor <iant@google.com>
3222 * options.h (class General_options): Add --spare-dynamic-tags.
3223 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3224 --spare-dynamic-tags.
3226 2010-03-05 Ian Lance Taylor <iant@google.com>
3228 * incremental.cc: Include "libiberty.h".
3230 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3232 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3233 function, is_info_ member.
3234 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3235 (Versions::Versions): Update caller.
3236 (Versions::define_base_version): Likewise.
3237 (Versions::add_def): Likewise.
3239 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3241 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3242 (Scan::possible_function_pointer_reloc): New function.
3243 (Scan::local_reloc_may_be_function_pointer): Change to call
3244 possible_function_pointer_reloc.
3245 (Scan::global_reloc_may_be_function_pointer): Ditto.
3246 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3247 relocations in ".data.rel.ro._ZTV" section.
3248 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3249 * testsuite/icf_safe_so_test.cc: Ditto.
3250 * testsuite/icf_safe_test.cc: Ditto.
3251 * testsuite/icf_safe_test.sh: Ditto.
3253 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3254 Ian Lance Taylor <iant@google.com>
3256 * target-reloc.h (relocate_section): Check the symbol table index
3257 for -1U before setting the local symbol index.
3258 (scan_relocatable_relocs): If copying the relocation, record that
3259 the local symbol is required.
3260 * object.h (Symbol_value::is_output_symtab_index_set): New
3262 (Symbol_value::may_be_discarded_from_output_symtab): New
3264 (Symbol_value::has_output_symtab_entry): New function.
3265 (Symbol_value::needs_output_symtab_entry): Remove.
3266 (Symbol_value::output_symtab_index): Make sure the symbol index is
3268 (Symbol_value::set_output_symtab_index): Make sure the symbol
3269 index is not set. Make sure the new index is valid.
3270 (Symbol_value::set_must_have_output_symtab_entry): New function.
3271 (Symbol_value::has_output_dynsym_entry): New function.
3272 (Symbol_value::set_output_dynsym_index): Make sure the new index
3274 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3275 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3276 local symbol if permitted.
3277 (Sized_relobj::do_finalize_local_symbols): Call
3278 is_output_symtab_index_set rather than needs_output_symtab_entry.
3279 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3280 rather than needs_output_symtab_entry. Call
3281 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3282 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3283 is_output_symtab_index_set rather than needs_output_symtab_entry.
3284 * testsuite/discard_locals_relocatable_test.c: New file.
3285 * testsuite/discard_locals_test.sh: Test -r.
3286 * testsuite/Makefile.am (check_DATA): Add
3287 discard_locals_relocatable_test1.syms,
3288 discard_local_relocatable_test2.syms.
3289 (MOSTLYCLEANFILES): Likewise. Also add
3290 discard_locals_relocatable_test1.lout and
3291 discard_locals_relocatable_test2.out.
3292 (discard_locals_relocatable_test1.syms): New target.
3293 (discard_locals_relocatable_test.o): New target.
3294 (discard_locals_relocatable_test1.out): New target.
3295 (discard_locals_relocatable_test2.syms): New target.
3296 (discard_locals_relocatable_test2.out): New target.
3297 (various): Add missing ../ld-new dependencies.
3298 * testsuite/Makefile.in: Rebuild.
3300 2010-03-03 Nick Clifton <nickc@redhat.com>
3302 * po/fi.po: New Finnish translation.
3304 2010-03-01 Doug Kwan <dougkwan@google.com>
3306 * layout.cc (Layout::Layout): Force section types of .init_array*,
3307 .preinit_array* and .fini_array* sections.
3308 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3309 Fix check of return value of std::string::find.().
3310 (Output_section::Input_section_sort_compare::operator()): Remove
3311 comment about .init_array.
3312 (Output_section::Input_section_sort_init_fini_compare::operator()):
3314 (Output_section::sort_attached_input_sections): Handle .init_array
3315 and .fini_array specially.
3316 * output.h (Output_section::Inut_section_sort_compare): Update
3318 (Output_section::Input_section_sort_init_fini_compare): New struct.
3320 2010-02-26 Doug Kwan <dougkwan@google.com>
3322 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3323 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3324 * testsuite/debug_msg.sh: Avoid matching source line number for
3325 use of global variable undef_int.
3327 2010-02-26 Doug Kwan <dougkwan@google.com>
3329 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3330 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3331 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3332 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3333 * options.cc (General_options::General_options): Initialize member
3335 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3336 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3337 and rm_no_fix_v4bx.stdout
3338 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3339 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3340 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3341 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3342 and arm_no_fix_v4bx.
3343 * Makefile.in: Regenerate.
3344 * testsuite/arm_fix_v4bx.s: New file.
3345 * testsuite/arm_fix_v4bx.sh: Ditto.
3347 2010-02-24 Doug Kwan <dougkwan@google.com>
3349 * arm.cc (Target_arm::got_section): Make the .got section the first
3350 non RELRO section in the data segment.
3351 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3352 suffixes of section names.
3354 2010-02-24 Doug Kwan <dougkwan@google.com>
3356 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3357 flags and attributes merging if an input file is a binary file.
3358 * fileread.cc (Input_file::open): Record format of original file.
3359 * fileread.h (Input_file::Format): New enum type.
3360 (Input_file::Input_file): Initialize data member format_.
3361 (Input_file::format): New method definition.
3362 (Input_file::format_):: New data member.
3364 2010-02-24 Doug Kwan <dougkwan@google.com>
3366 * arm.cc (Arm_output_data_got): New class.
3367 (ARM_TCB_SIZE): New constant
3368 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3369 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3370 If user uses a script with a SECTIONS clause, issue only a warning
3371 for a misplaced EXIDX input section. Otherwise, issue an error.
3372 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3374 (Target_arm::got_mode_index_entry): Handle static linking.
3375 (Target_arm::Scan::local): Ditto.
3376 (Target_arm::Scan::global): Ditto.
3377 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3378 all incorrectly implemented relocations.
3379 (Target_arm::fix_exidx_coverage): Pass layout to
3380 Arm_output_section::fix_exidx_coverage.
3381 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3382 from ".ARM.exidx." and ".ARM.extab.".
3384 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3386 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3387 section if it does not already exist.
3388 * attributes.cc (Attributes_section_data::Attributes_section_data):
3389 Don't crash if size is zero.
3391 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3392 Ian Lance Taylor <iant@google.com>
3394 * gold.cc (queue_middle_tasks): If no input files were opened,
3396 * workqueue.h (Task_function::Task_function): Assert that there is
3399 2010-02-22 Doug Kwan <dougkwan@google.com>
3401 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3402 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3403 types to avoid warnings due to different uint64_t implementations
3406 2010-02-21 Doug Kwan <dougkwan@google.com>
3408 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3409 handling of the maximum backward branch offset.
3410 (Arm_relocate_functions::thumb_branch_common): Ditto.
3411 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3412 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3413 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3414 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3415 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3416 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3417 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3418 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3419 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3420 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3421 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3422 thumb2_bl_out_of_range.o): New rules.
3423 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3424 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3425 thumb2_bl_out_of_range
3426 * testsuite/Makefile.in: Regenerate.
3427 * testsuite/arm_bl_in_range.s: New file.
3428 * testsuite/arm_bl_out_of_range.s: Ditto.
3429 * testsuite/arm_branch_in_range.sh: Ditto.
3430 * testsuite/arm_branch_range.t: Ditto.
3431 * testsuite/thumb2_branch_range.t: Ditto.
3432 * testsuite/thumb_bl_in_range.s: Ditto.
3433 * testsuite/thumb_bl_out_of_range.s: Ditto.
3434 * testsuite/thumb_branch_range.t: Ditto.
3436 2010-02-20 Sriraman Tallam <tmsriram@google.com>
3438 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3439 Add reloc offset information.
3440 * icf.cc (get_section_contents): Change iterators to point to the new
3441 vectors. Add reloc offset information to the contents.
3442 * icf.h (Icf::Sections_reachable_info): New typedef.
3443 (Icf::Sections_reachable_list): New typedef.
3444 (Icf::Offset_info): New typedef.
3445 (Icf::Reloc_info): New struct typedef.
3446 (Icf::Reloc_info_list): New typedef.
3447 (Icf::symbol_reloc_list): Delete method.
3448 (Icf::addend_reloc_list): Delete method.
3449 (Icf::section_reloc_list): Delete method.
3450 (Icf::reloc_info_list): New method.
3451 (Icf::reloc_info_list_): New member.
3453 2010-02-19 Doug Kwan <dougkwan@google.com>
3455 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3456 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3457 * arm.cc (Arm_relocation_functions): New forward declaration.
3458 (Target_arm::Target_arm): Initialize new data members
3459 got_mod_index_offset_ and tls_base_symbol_defined_.
3460 (Target_arm::Relocate::relocate_tls): New method.
3461 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3462 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3464 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3465 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3466 (Target_arm::got_mod_index_offset_,
3467 Target_arm::tls_base_symbol_defined_): New data members.
3468 (Target_arm::Scan::local, Target::Scan::global,
3469 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3472 2010-02-18 Doug Kwan <dougkwan@google.com>
3474 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3475 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3476 text section as a parameter becuase some broken tools may not set
3477 the link in section header.
3478 (Target_arm::has_got_section): New method.
3479 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3480 without any mapping symbol as data only. Remove warning.
3481 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3482 link in its section header, try to discover the link by inspecting the
3483 REL31 relocation at the beginning of the section.
3484 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3486 (Target_arm::Scan::global): Treat any reference to the symbol
3487 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3489 2010-02-12 Sriraman Tallam <tmsriram@google.com>
3491 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3492 (Scan::global_reloc_may_be_function_pointer): New function.
3493 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3494 (Scan::global_reloc_may_be_function_pointer): New function.
3495 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3496 (Scan::global_reloc_may_be_function_pointer): New function.
3497 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3498 (Scan::global_reloc_may_be_function_pointer): New function.
3499 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3500 (Scan::global_reloc_may_be_function_pointer): New function.
3501 (Scan::possible_function_pointer_reloc): New function.
3502 (Target_x86_64::can_check_for_function_pointers): New function.
3503 * gc.h (gc_process_relocs): Scan relocation types to determine if
3504 function pointers were taken for targets that support it.
3505 * icf.cc (Icf::find_identical_sections): Include functions for
3506 folding in safe ICF whose pointer is not taken.
3507 * icf.h (Secn_fptr_taken_set): New typedef.
3508 (fptr_section_id_): New member.
3509 (section_has_function_pointers): New function.
3510 (set_section_has_function_pointers): New function.
3511 (check_section_for_function_pointers): New function.
3512 * options.h: Fix comment for safe ICF option.
3513 * target.h (can_check_for_function_pointers): New function.
3514 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3515 Modify icf_safe_test for X86-64.
3516 * testsuite/Makefile.in: Regenerate.
3517 * testsuite/icf_safe_so_test.cc: New file.
3518 * testsuite/icf_safe_so_test.sh: New file.
3519 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3520 (main): Change to take pointer to function kept_func_3.
3521 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3522 folding is done correctly for X86-64.
3524 2010-02-12 David S. Miller <davem@davemloft.net>
3526 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3527 is_symbolless parameter.
3528 (Output_reloc<SHT_REL>::is_symbolless): New.
3529 (Output_reloc<SHT_REL>::is_symbolless_): New.
3530 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3531 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3532 (Output_reloc<SHT_RELA>::is_symbolless): New.
3533 (Output_data_reloc::add_global): Handle is_symbolless.
3534 (Output_data_reloc::add_global_relative): Likewise.
3535 (Output_data_reloc::add_local): Likewise.
3536 (Output_data_reloc::add_local_relative): Likewise.
3537 (Output_data_reloc::add_symbolless_global_addend): New.
3538 (Output_data_reloc::add_symbolless_local_addend): New.
3539 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3541 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3542 instead of ->is_relative_
3543 (Output_reloc::write): Likewise.
3544 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3545 (Output_reloc::write_rel): Simplify.
3547 * sparc.cc (Target_sparc::Scan::local): Use
3548 ->add_symbolless_local_addend as needed.
3549 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3550 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3551 based upon relocation offset.
3553 2010-02-11 Doug Kwan <dougkwan@google.com>
3555 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3556 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3557 beginning of function.
3558 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3559 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3560 parameter is_32bit in calls to should_apply_static_reloc.
3561 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3562 (check_DATA): Add arm_abs_global.stdout.
3563 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3564 arm_abs_global.stdout): New rules.
3565 (MOSTLLYCLEANFILES): Add arm_abs_global
3566 * Makefile.in: Regenerate.
3567 * testsuite/arm_abs_global.s: New file.
3568 * testsuite/arm_abs_global.sh: Ditto.
3569 * testsuite/arm_abs_lib.s: Ditto.
3571 2010-02-11 Ian Lance Taylor <iant@google.com>
3573 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3575 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3576 Allocate_commons_task first.
3577 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3578 task, rather than symtab_lock_.
3579 (Gc_process_relocs::~Gc_process_relocs): New function.
3580 (Gc_process_relocs::is_runnable): Check this_blocker_.
3581 (Gc_process_relocs::locks): Use next_blocker_ rather than
3583 (Scan_relocs::~Scan_relocs): New function.
3584 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3586 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3588 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3589 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3590 constructor accordingly.
3591 (class Gc_process_relocs): Likewise.
3592 (class Scan_relocs): Likewise.
3593 * common.h (class Allocate_commons_task): Remove symtab_lock_
3594 field, and corresponding constructor parameter.
3595 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3597 (Allocate_commons_task::locks): Likewise.
3599 2010-02-11 Ian Lance Taylor <iant@google.com>
3601 * gold-threads.h (class Once): Define.
3602 (class Initialize_lock): Rewrite as child of Once.
3603 * gold-threads.cc (class Once_initialize): Define.
3604 (once_pointer_control): New static variable.
3605 (once_pointer, once_arg): New static variables.
3606 (c_run_once): New static function.
3607 (Once::Once, Once::run_once, Once::internal_run): New functions.
3608 (class Initialize_lock_once): Remove.
3609 (initialize_lock_control): Remove.
3610 (initialize_lock_pointer): Remove.
3611 (initialize_lock_once): Remove.
3612 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3613 (Initialize_lock::initialize): Rewrite.
3614 (Initialize_lock::do_run_once): New function.
3615 * archive.cc (Archive::interpret_header): Only clear name if it is
3617 * fileread.cc: Include "gold-threads.h"
3618 (file_counts_lock): New static variable.
3619 (file_counts_initialize_lock): Likewise.
3620 (File_read::release): Only increment counts when using --stats.
3621 Use a lock around the increment.
3622 * parameters.cc (class Set_parameters_target_once): Define.
3623 (set_parameters_target_once): New static variable.
3624 (Parameters::Parameters): Move here from parameters.h.
3625 (Parameters::set_target): Rewrite.
3626 (Parameters::set_target_once): New function.
3627 (Parameters::clear_target): Move here and rewrite.
3628 * parameters.h (class Parameters): Update declarations. Add
3629 set_parameters_target_once_ field.
3630 (Parameters::Parameters): Move to parameters.cc.
3631 (Parameters::clear_target): Likewise.
3632 * readsyms.cc (Read_symbols::do_group): Create a Start_group
3634 (Start_group::~Start_group): New function.
3635 (Start_group::is_runnable): New function.
3636 (Start_group::locks, Start_group::run): New functions.
3637 (Finish_group::run): Change saw_undefined to size_t.
3638 * readsyms.h (class Start_group): Define.
3639 (class Finish_group): Change saw_undefined_ field to size_t.
3640 (Finish_group::Finish_group): Remove saw_undefined and
3641 this_blocker parameters. Change all callers.
3642 (Finish_group::set_saw_undefined): New function.
3643 (Finish_group::set_blocker): New function.
3644 * symtab.h (class Symbol_table): Change saw_undefined to return
3645 size_t. Change saw_undefined_ field to size_t.
3646 * target-select.cc (Set_target_once::do_run_once): New function.
3647 (Target_selector::Target_selector): Initialize set_target_once_
3648 field. Don't initialize lock_ and initialize_lock_ fields.
3649 (Target_selector::instantiate_target): Rewrite.
3650 (Target_selector::set_target): New function.
3651 * target-select.h (class Set_target_once): Define.
3652 (class Target_selector): Update declarations. Make
3653 Set_target_once a friend. Remove lock_ and initialize_lock_
3654 fields. Add set_target_once_ field.
3656 2010-02-10 Ian Lance Taylor <iant@google.com>
3658 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3660 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
3661 (queue_middle_tasks): Add all blockers before queueing any tasks.
3662 (queue_final_tasks): Likewise.
3663 * token.h (Task_token::add_blockers): New function.
3664 * object.h (Input_objects::number_of_relobjs): New function.
3666 2010-02-10 Ian Lance Taylor <iant@google.com>
3668 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3669 shared, not if not position independent.
3670 * x86_64.cc (Relocate::relocate_tls): Likewise.
3671 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3672 (tls_pie_pic_test): New target.
3673 * testsuite/Makefile.in: Rebuild.
3675 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3676 (tls_test_main_pie.o, tls_test_pie.o): New targets.
3677 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3678 * testsuite/Makefile.in: Rebuild.
3680 2010-02-09 David S. Miller <davem@davemloft.net>
3682 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3683 R_SPARC_RELATIVE using ->add_local_relative().
3684 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3686 * output.h (Output_data_dynamic::add_section_size): New method
3687 that takes two Output_data objects.
3688 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3689 entry param. Handle it in initializers.
3690 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3691 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3692 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3694 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3695 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3696 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3697 for dynrel_includes_plt.
3698 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3699 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3700 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3702 (Target_sparc::do_finalize_sections): Update to pass true for
3703 dynrel_includes_plt.
3704 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3705 output before .rela.plt
3706 (Target_powerpc::do_finalize_sections): Update to pass true for
3707 dynrel_includes_plt when 32-bit.
3709 2010-02-08 Doug Kwan <dougkwan@google.com>
3711 * arm.cc (Arm_relobj::simple_input_section_output_address): New
3713 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3714 Arm_relobj::scan_section_for_cortex_a8_stubs,
3715 Arm_relobj::do_relocation_section): Instead of calling
3716 Output_section::output_address, use faster
3717 Arm_relobj::simple_input_section_output_address.
3719 2010-02-08 David S. Miller <davem@davemloft.net>
3721 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3722 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3723 relocation helper function.
3725 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3726 just like R_SPARC_GOT{10,13,22}.
3727 (Target_sparc::Scan::local): Likewise.
3728 (Target_sparc::Relocate:relocate): Likewise.
3730 2010-02-06 Ian Lance Taylor <iant@google.com>
3732 * configure.ac: Rewrite targetobjs duplicate removal code to use
3733 only shell constructs.
3734 * configure: Rebuild.
3736 2010-02-05 Doug Kwan <dougkwan@google.com>
3739 * arm.cc (Arm_relobj::section_is_scannable): New method.
3740 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3741 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3743 2010-02-04 Doug Kwan <dougkwan@google.com>
3746 * arm-reloc-property.cc (cstdio): Include.
3747 * configure.ac (targetobjs): Remove duplicates.
3748 * configure: Regenerate.
3749 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3750 big and little endian version for a given address size.
3752 2010-02-03 Doug Kwan <dougkwan@google.com>
3754 * arm-reloc-property.cc
3755 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3757 * arm-reloc-property.h
3758 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3759 New method definition.
3760 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3762 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3764 (GOT_PREL): Change implemented to Y.
3765 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3766 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3767 (Arm_relocate_functions::movw_abs_nc): Remove method.
3768 (Arm_relocate_functions::movt_abs): Ditto.
3769 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3770 (Arm_relocate_functions::thm_movt_abs): Ditto.
3771 (Arm_relocate_functions::movw_rel_nc): Ditto.
3772 (Arm_relocate_functions::movw_rel): Ditto.
3773 (Arm_relocate_functions::movt_rel): Ditto.
3774 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3775 (Arm_relocate_functions:thm_movw_rel): Ditto.
3776 (Arm_relocate_functions:thm_movt_rel): Ditto.
3777 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3778 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3779 New method definitions.
3780 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3781 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3782 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3783 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3784 (Target_arm::Relocate::relocate): Check for non-static or
3785 unimplemented relocation code and exit early. Change calls to
3786 Target_arm::reloc_uses_thumb_bit and
3787 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3788 instead. Refactor code to handle similar relocations to increase
3789 code sharing. Remove check for unsupported relocation code in switch
3791 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3792 relocation property table to find out size. Change error message to
3793 print out the name of a relocation code instead of the numeric value.
3794 (Target_arm::scan_reloc_for_stub): Use relocation property table
3795 instead of calling Target_arm::reloc_uses_thumb_bit().
3797 2010-02-02 Doug Kwan <dougkwan@google.com>
3799 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3800 types of relaxed input section.
3802 2010-02-02 Doug Kwan <dougkwan@google.com>
3804 * Makefile.am (HFILES): Add arm-reloc-property.h.
3806 (TARGETSOURCES): Add arm-reloc-property.cc
3807 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3808 (libgold_a_SOURCES): $(DEFFILES)
3809 * Makefile.in: Regenerate.
3810 * arm-reloc-property.cc: New file.
3811 * arm-reloc-property.h: New file.
3812 * arm-reloc.def: New file.
3813 * arm.cc: Update comments.
3814 (arm-reloc-property.h): New included header.
3815 (arm_reloc_property_table): New global variable.
3816 (Target_arm::do_select_as_default_target): New method definition.
3817 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3818 arm-reloc-property to targ_extra_obj.
3819 * parameters.cc (set_parameters_target): Call
3820 Target::select_as_default_target().
3821 * target.h (Target::select_as_default_target): New method definition.
3822 (Target::do_select_as_default_target): Same.
3824 2010-02-01 Doug Kwan <dougkwan@google.com>
3826 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3827 first_output_text_section_.
3828 (Arm_exidx_fixup::first_output_text_section): New method definition.
3829 (Arm_exidx_fixup::first_output_text_section_): New data member.
3830 (Arm_exidx_fixup::process_exidx_section): Record the first text
3831 output section seen.
3832 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3833 and entsize in output section header.
3835 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3837 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3838 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3839 (Arm_relocate_functions::thm_alu11): New Method.
3840 (Arm_relocate_functions::thm_pc8): New Method.
3841 (Arm_relocate_functions::thm_pc12): New Method.
3842 (Target_arm::Scan::local): Handle the relocations.
3843 (Target_arm::Scan::global): Likewise.
3844 (Target_arm::Relocate::relocate): Likewise.
3845 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3847 2010-01-29 Doug Kwan <dougkwan@google.com>
3849 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3850 of relocation types as ld.
3852 2010-01-29 Doug Kwan <dougkwan@google.com>
3854 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3856 (Arm_relocate_functions::thumb_branch_common): Ditto.
3857 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3858 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3859 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3860 Arm_relocate_functions::jump24): Remove.
3861 (Target_arm::Relocate::relocate): Adjust code to call
3862 Arm_relocation_functions::arm_branch_common and
3863 Arm_relocation_functions::thumb_branch_common instead of their removed
3864 wrappers. Merge switch-cases together to reduce source code size.
3866 2010-01-29 Doug Kwan <dougkwan@google.com>
3868 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3869 output_local_symbol_count_needs_update_.
3870 (Arm_relobj::output_local_symbol_count_needs_update,
3871 Arm_relobj::set_output_local_symbol_count_needs_update,
3872 Arm_relobj::update_output_local_symbol_count): New methods.
3873 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3875 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3876 of pointed function as in a R_ARM_PREL31 relocation.
3877 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3878 for output local symbol count updating.
3879 (Target_arm::do_relax): Update output local symbol counts in objects
3881 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3883 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3885 * arm.cc: Added support for the ARM relocations:
3886 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3887 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3888 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3890 (Arm_relocate_functions::movw_rel): New method.
3891 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3892 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3894 (Arm_relocate_functions::thm_movw_rel): New method.
3895 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3897 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3899 (Target_arm::Scan::global): Likewise.
3900 (Target_arm::Relocate::relocate): Likewise.
3901 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3904 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3906 * arm.cc: Added support for ARM group relocations.
3907 (Target_arm::reloc_needs_sym_origin): New method.
3908 (Arm_relocate_functions::calc_grp_kn): New method.
3909 (Arm_relocate_functions::calc_grp_residual): New method.
3910 (Arm_relocate_functions::calc_grp_gn): New method.
3911 (Arm_relocate_functions::arm_grp_alu): New Method.
3912 (Arm_relocate_functions::arm_grp_ldr): New Method.
3913 (Arm_relocate_functions::arm_grp_ldrs): New Method.
3914 (Arm_relocate_functions::arm_grp_ldc): New Method.
3915 (Target_arm::Scan::local): Handle the ARM group relocations.
3916 (Target_arm::Scan::global): Likewise.
3917 (Target_arm::Relocate::relocate): Likewise.
3918 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3921 2010-01-26 Doug Kwan <dougkwan@google.com>
3923 * arm.cc (set): Include.
3924 (class Arm_exidx_fixup): Change type of last_input_section_ to const
3926 (Arm_output_section::Text_section_list): New type.
3927 (Arm_output_section::append_text_sections_to_list): New method.
3928 (Arm_output_section::fix_exidx_coverage): Ditto.
3929 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3930 (Arm_relobj::convert_input_section_to_relaxed_section): Use
3931 Relobj::set_section_offset() instead of
3932 Sized_relobj::invalidate_section_offset().
3933 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3934 parameter for section headers. Ignore relocation sections for
3935 unallocated sections and EXIDX sections.
3936 (Target_arm::fix_exidx_coverage): New method.
3937 (Target_arm::output_section_address_less_than): New type.
3938 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3939 linked text section instead of the EXIDX section.
3940 (Arm_output_section::create_stub_group): Add an assertion to check
3941 that this is not an EXIDX output section.
3942 (Arm_output_section::append_text_sections_to_list): New method.
3943 (Arm_output_section::fix_exidx_coverage): Ditto.
3944 (Arm_relobj::scan_sections_for_stubs): Adjust call to
3945 Arm_relobj::section_needs_reloc_stub_scanning.
3946 (Target_arm::do_relax): Fix EXIDX output section coverage in the
3948 (Target_arm::fix_exidx_coverage): New method.
3949 * object.h (Relobj::set_output_section): New method.
3950 (Sized_relobj::invalidate_section_offset): Remove method.
3951 (Sized_relobj::do_invalidate_section_offset): Remove method.
3952 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3954 2010-01-25 Doug Kwan <dougkwan@google.com>
3956 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3957 Fix warning due to signed and unsigned comparison on a 32-bit host.
3959 2010-01-22 Doug Kwan <dougkwan@google.com>
3961 * arm.cc (Target_arm::do_relax): Record an output section for section
3962 offset adjustment it contains any stub table that has changed.
3963 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3964 offsets in an output section if necessary.
3965 * output.cc (Output_section::Output_section): Initialize
3966 section_offsets_need_adjustments_.
3967 (Output_section::add_input_section_for_script): Renamed to
3968 Output_section::add_simple_input_section.
3969 (Output_section::save_states): Add a comment.
3970 (Output_section::discard_states): New method defintion.
3971 (Output_section::adjust_section_offsets): Same.
3972 * output.h (Output_section::add_input_section_for_script): Renamed to
3973 Output_section::add_simple_input_section.
3974 (Output_section::discard_states): New method declaration.
3975 (Output_section::adjust_section_offsets): Same.
3976 (Output_section::section_offsets_need_adjustment,
3977 Output_section::set_section_offsets_need_adjustment): New method
3979 (Output_section::section_offsets_need_adjustment_): New data member.
3980 * script-sections.cc
3981 (Output_section_element_input::set_section_address): Adjust code for
3982 renaming of Output_section::add_input_section_for_script.
3983 (Orphan_output_section::set_section_address): Same.
3985 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3987 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3988 Fix_v4bx enum values .
3989 * gold/options.h (General_options): New option definitions.
3990 (General_options::fix_v4bx): New method.
3991 (General_options::Fix_v4bx): New enum.
3992 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3993 (General_options::parse_fix_v4bx_interworking): New method.
3995 2010-01-22 Doug Kwan <dougkwan@google.com>
3997 * arm.cc (Arm_exidx_fixup): New class.
3999 2010-01-21 Doug Kwan <dougkwan@google.com>
4001 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4003 (Arm_exidx_section_offset_map): New type.
4005 2010-01-21 Doug Kwan <dougkwan@google.com>
4007 * arm.cc (Arm_exidx_input_section): New class.
4008 (Arm_relobj::exidx_input_section_by_link,
4009 Arm_relobj::exidx_input_section_by_shndx,
4010 Arm_relobj::make_exidx_input_section): New methods.
4011 (read_arm_attributes_section): Remove.
4012 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4013 information about them.
4014 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4017 2010-01-20 Doug Kwan <dougkwan@google.com>
4019 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4020 Input_section_specifier to Section_id.
4021 (Target_arm::new_arm_input_section: Adjust code for change of key
4023 (Target_arm::find_arm_input_section): Ditto.
4024 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4025 (Section_id): Remove.
4026 (Garbage_collection::Section_id_hash): Remove.
4027 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4028 (Section_id): Remove.
4029 (Icf::Section_id_hash): Remove.
4030 * object.h (Section_id, Const_section_id, Section_id_hash,
4031 Const_section_id_hash): New type definitions.
4032 * output.cc (Output_section::add_relaxed_input_section): Change to
4033 use Const_section_id instead of Input_section_specifier as key type.
4034 (Output_section::add_merge_input_section): Ditto.
4035 (Output_section::build_relaxation_map): Change to use Section_id
4036 instead of Input_section_specifier as key type.
4037 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4039 (Output_section::convert_input_sections_to_relaxed_sections): Change
4040 to use Const_section_id instead of Input_section_specifier as key type.
4041 (Output_section::find_merge_section): Ditto.
4042 (Output_section::find_relaxed_input_section): Ditto.
4043 * output.h (Input_section_specifier): Remove class.
4044 (Output_section::Output_section_data_by_input_section_map): Change
4045 key type to Const_section_id.
4046 (Output_section::Output_relaxed_input_section_by_input_section_map):
4048 (Output_section::Relaxation_map): Change key type to Section_id.
4050 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4052 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4053 (class Arm_v4bx_stub): New class.
4054 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4055 (Stub_factory::make_arm_v4bx_stub): New method.
4056 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4057 (Stub_table::empty): Handle v4bx stubs.
4058 (Stub_table::add_arm_v4bx_stub): New method.
4059 (Stub_table::find_arm_v4bx_stub): New method.
4060 (Arm_relocate_functions::v4bx): New method.
4061 (Target_arm::fix_v4bx): New method.
4062 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4063 (Stub_table::relocate_stubs): Likewise.
4064 (Stub_table::do_write): Likewise.
4065 (Stub_table::update_data_size_and_addralign): Likewise.
4066 (Stub_table::finalize_stubs): Likewise.
4067 (Target_arm::Scan::local): Likewise.
4068 (Target_arm::Scan::global): Likewise.
4069 (Target_arm::do_finalize_sections): Likewise.
4070 (Target_arm::Relocate::relocate): Likewise.
4071 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4073 (Target_arm::scan_reloc_for_stub): Likewise.
4074 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4076 2010-01-19 Ian Lance Taylor <iant@google.com>
4078 * output.cc (Output_section_headers::do_sized_write): Write large
4079 segment count to sh_info field.
4080 (Output_file_header::do_sized_write): For large segment count,
4081 write PN_XNUM to e_phnum field.
4083 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4085 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4086 (Arm_relocate_functions::thm_jump8): New function.
4087 (Arm_relocate_functions::thm_jump11): New function.
4088 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4090 (Target_arm::Scan::global): Likewise.
4091 (Target_arm::Relocate::relocate): Likewise.
4092 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4095 2010-01-14 Doug Kwan <dougkwan@google.com>
4097 * arm.cc (map, utility): Include headers.
4098 (Target_arm::apply_cortex_a8_workaround): New method.
4099 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4100 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4101 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4102 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4103 the --[no-]fix-cortex-a8 command line options.
4104 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4105 (Target_arm::relocate_stub): Use addend in instruction template.
4106 * options.h (DEFINE_bool): Set the user-set flag.
4107 (General_options): Add --[no-]-fix-cortex options.
4108 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4109 : Update fast look-up map after conversion.
4111 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4113 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4114 in the first pass of do_layout.
4116 2010-01-13 Doug Kwan <dougkwan@google.com>
4118 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4119 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4120 apparent compiler problem of not folding static constant integral
4121 data members of elfcpp::Elf_sizes<32>.
4123 2010-01-13 Doug Kwan <dougkwan@google.com>
4125 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4126 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4127 Arm_relobj::scan_section_for_cortex_a8_erratum,
4128 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4129 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4130 sections to scan for relocation stubs into a new method
4131 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4132 relocation and Cortex-A8 stub scanning.
4133 (Target_arm::do_relax): Force stubs to be after stubbed sections
4134 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4135 the beginning of a new relaxation pass. Update a comment.
4136 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4138 2010-01-12 Ian Lance Taylor <iant@google.com>
4140 * target-reloc.h (visibility_error): New inline function.
4141 (relocate_section): Call visibility_error.
4142 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4143 (MOSTLYCLEANFILES): Likewise.
4144 (protected_4_pic.o, protected_3.err): New targets.
4145 * testsuite/protected_4.cc: New file.
4147 2010-01-12 Doug Kwan <dougkwan@google.com>
4149 * arm.cc (Cortex_a8_reloc): New class.
4150 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4151 and cortex_a8_relocs_info_.
4152 (Target_arm::fix_cortex_a8): New method definition.
4153 (Target_arm::Cortex_a8_relocs_info): New type.
4154 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4155 New data member declarations.
4156 (Target_arm::scan_reloc_for_stub): Record information about
4157 relocations for THUMB branches that might be exempted from the
4158 Cortex-A8 workaround.
4159 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4160 at the beginning of a relaxation pass.
4162 2010-01-12 Doug Kwan <dougkwan@google.com>
4164 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4165 (Arm_relobj::Mapping_symbol_position,
4166 Arm_reloj::Mapping_symbol_position_less,
4167 Arm_relobj::Mapping_symbols_info): New types.
4168 (Target_arm::is_mapping_symbol_name): New method definition.
4169 (Arm_relobj::do_count_local_symbols): Save information about mapping
4172 2010-01-11 Doug Kwan <dougkwan@google.com>
4174 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4175 Arm_relocate_functions::thumb32_branch_upper,
4176 Arm_relocate_functions::thumb32_branch_lower,
4177 Arm_relocate_functions::thumb32_cond_branch_offset,
4178 Arm_relocate_functions::thumb32_cond_branch_upper,
4179 Arm_relocate_functions::thumb32_cond_branch_lower,
4180 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4181 branch offset encoding.
4182 (Arm_relocate_functions::thumb_branch_common): Use new branch
4183 offset encoding methods to avoid code duplication.
4184 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4185 (Stub_addend_reader::operator()): Use new branch encoding method
4186 to avoid code duplication.
4188 2010-01-11 Doug Kwan <dougkwan@google.com>
4190 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4191 (Target_arm::do_finalize_sections): Define special EXIDX section
4192 symbols only if referenced.
4193 * gc.h (Garbage_collection::add_reference): New method.
4194 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4197 2010-01-11 Ian Lance Taylor <iant@google.com>
4199 * script.cc (Version_script_info::build_expression_list_lookup):
4200 Change complaing about duplicate wildcard match from error to
4203 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4205 (Version_script_info::Version_script_info): Initialize globs_,
4206 default_version_, default_is_global_, and exact_. Don't
4207 initialize globals_ or locals_.
4208 (Version_script_info::build_lookup_tables): Build local symbols
4210 (Version_script_info::unquote): New function.
4211 (Version_script_info::add_exact_match): New function.
4212 (Version_script_info::build_expression_list_lookup): Remove lookup
4213 parameter. Add is_global parameter. Change all callers. Handle
4214 wildcard pattern specially. Unquote pattern. Call
4216 (Version_script_info::get_name_to_match): New function.
4217 (Version_script_info::get_symbol_version): New function.
4218 (Version_script_info::get_symbol_version_helper): Remove.
4219 (Version_script_info::check_unmatched_names): Call unquote.
4220 * script.h (class Version_script_info): Change get_symbol_version
4221 to be non-inline and add is_global parameter; change all callers.
4222 Rewrite symbol_is_local. Update declarations. Define struct
4223 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4224 Remove globals_ and locals_ members. Add exact_, globs_,
4225 default_version_, is_global_.
4226 (Version_script_info::Glob): Remove pattern, add expression and
4227 is_global. Update constructor. Change all callers.
4228 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4230 (Versions::symbol_section_contents): If a symbol is undefined, or
4231 defined in a dynamic object, set the version index to
4233 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4235 (Symbol_table::add_from_pluginobj): Likewise.
4236 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4238 2010-01-11 Doug Kwan <dougkwan@google.com>
4240 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4241 (incremental_dump_LDADD): Add linking option for libintl.
4242 * Makefile.in: Regenerate.
4244 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4247 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4249 * testsuite/Makefile.in: Regenerated.
4251 2010-01-10 Doug Kwan <dougkwan@google.com>
4253 * options.h (DEFINE_var): Use parentheses around argument varname__
4254 in macro body to avoid any unintended subsequent substitutions.
4256 2010-01-10 Ian Lance Taylor <iant@google.com>
4258 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4259 candidates before doing symbol resolution.
4261 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4262 ODR candidates if only one is weak.
4264 2010-01-08 Ian Lance Taylor <iant@google.com>
4266 * script.cc (Version_script_info::build_expression_list_lookup):
4267 Don't warn about ambiguous version, just record the ambiguity.
4268 (Version_script_info::get_symbol_version_helper): Give error if
4269 version is ambiguous.
4271 2010-01-08 Doug Kwan <dougkwan@google.com>
4273 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4274 prev_data_size_ and prev_addralign_. Remove initializer for
4275 deleted data member has_been_changed_.
4276 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4277 to determine if the table is empty.
4278 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4280 (Stub_table::add_reloc_stub): Define method in class definition
4281 instead of just declaring it there.
4282 (Stub_table::add_cortex_a8_stub): New method definition.
4283 (Stub_table::update_data_size_and_addralign): Ditto.
4284 (Stub_table::finalize_stubs): Ditto.
4285 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4286 (Stub_table::do_addralign_): Return address alignment in the
4287 (Stub_table::do_reset_address_and_file_offset): Define method in
4288 class definition instead of declaring it there. Set current data
4289 size to be the data size of the previous pass.
4290 (Stub_table::set_final_data_size): Use current data size as the
4292 (Stub_table::relocate_stub): Change parameter type of stub from
4293 Reloc_stub pointer to Stub pointer.
4294 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4295 (Stub_table::Cortex_a8_stub_list): New typedef.
4296 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4297 Stub_table::prev_addralign_): New data member.
4298 (Arm_relobj::Arm_relobj): Initialize data member
4299 section_has_cortex_a8_workaround_.
4300 (Arm_relobj::section_has_cortex_a8_workaround,
4301 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4303 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4305 (Target_arm::relocate_stub): Change parameter type of stub from
4306 Reloc_stub pointer to Stub pointer.
4307 (Insn_template::size, Insn_template::alignment): Handle
4308 THUMB16_SPECIAL_TYPE.
4309 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4310 Stub_table::update_data_size_and_addralign,
4311 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4313 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4314 (Stub_table::do_write): Ditto.
4315 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4317 2010-01-08 Ian Lance Taylor <iant@google.com>
4320 * symtab.h (class Symbol): Remove fields is_target_special_ and
4321 has_plt_offset_. Add field is_defined_in_discarded_section_.
4322 (Symbol::is_defined_in_discarded_section): New function.
4323 (Symbol::set_is_defined_in_discarded_section): New function.
4324 (Symbol::has_plt_offset): Rewrite.
4325 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4326 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4327 Don't initialize is_target_special_ or has_plt_offset_.
4328 Initialize is_defined_in_discarded_section_.
4329 (Symbol_table::add_from_relobj): If appropriate, set
4330 is_defined_in_discarded_section.
4331 * resolve.cc (Symbol::override_base_with_special): Don't test
4332 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4333 * target-reloc.h (relocate_section): Do special handling for
4334 symbols defined in discarded sections for global symbols as well
4337 2010-01-08 Ian Lance Taylor <iant@google.com>
4339 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4340 the SHT_SYMTAB case.
4342 2010-01-08 Ian Lance Taylor <iant@google.com>
4344 * object.cc (Sized_relobj::do_layout): Don't get confused if
4345 layout_eh_frame returns NULL.
4347 2010-01-08 Ian Lance Taylor <iant@google.com>
4350 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4351 dynamic symbol table, use the normal symbol table.
4352 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4355 2010-01-08 Ian Lance Taylor <iant@google.com>
4358 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4361 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4363 * version.cc (print_version): Change to "Copyright 2010".
4365 2010-01-08 Ian Lance Taylor <iant@google.com>
4369 * i386.cc (class Target_i386): Change return type of plt_section
4371 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4372 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4373 tls_desc_rel_ field.
4374 (Output_data_plt_i386::rel_tls_desc): New function.
4375 (Target_i386::rel_tls_desc_section): New function.
4376 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4377 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4378 R_386_TLS_DESC reloc in rel_tls_desc_section.
4379 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4380 Define struct Tlsdesc_info.
4381 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4382 (Target_x86_64::do_reloc_symbol_index): New function.
4383 (Target_x86_64::add_tlsdesc_info): New function.
4384 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4385 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4387 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4389 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4390 (Target_x86_64::rela_tlsdesc_section): New function.
4391 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4393 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4394 (Target_x86_64::do_reloc_addend): New function.
4395 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4396 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4397 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4398 (Output_reloc::type): New function.
4399 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4400 (Output_reloc::is_target_specific): New function.
4401 (Output_reloc::target_arg): New function.
4402 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4403 absolute relocs and target specific relocs.
4404 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4405 add_target_specific.
4406 (class Output_data_reloc) [SHT_RELA]: Likewise.
4407 * output.cc (Output_reloc::Output_reloc): Add four new versions
4408 for absolute relocs and target specific relocs.
4409 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4410 (Output_reloc::get_symbol_index): Likewise.
4411 (Output_reloc::local_section_offset): Check that local_sym_index_
4412 is not TARGET_CODE or 0.
4413 (Output_reloc::symbol_value): Likewise.
4414 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4416 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4417 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4419 * layout.cc (add_target_dynamic_tags): Use output section for
4420 DT_PLTRELSZ and DT_JMPREL.
4422 2010-01-07 Ian Lance Taylor <iant@google.com>
4425 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4427 (class Output_data_reloc_generic): Define.
4428 (class Output_data_reloc_base): Change base class to
4429 Output_data_reloc_generic. Change add() method to call
4430 bump_relative_reloc_count for a relative reloc. Remove
4432 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4434 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4435 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4437 * layout.h (class Layout): Update declaration.
4439 2010-01-07 Ian Lance Taylor <iant@google.com>
4441 * output.h (class Output_data): Add const version of
4442 output_section and do_output_section.
4443 (class Output_section_data): Add const version of
4445 (class Output_section): Likewise.
4446 * layout.cc (Layout::add_target_dynamic_tags): New function.
4447 * layout.h (class Layout): Update declarations.
4448 * arm.cc (Target_arm::do_finalize_sections): Use
4449 add_target_dynamic_tags.
4450 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4451 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4452 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4453 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4455 2010-01-07 Ian Lance Taylor <iant@google.com>
4458 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4461 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4462 Ian Lance Taylor <iant@google.com>
4465 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4466 Xindex::read_symtab_xindex.
4468 2010-01-07 Doug Kwan <dougkwan@google.com>
4470 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4471 (Insn_template::thumb16_bcond_insn): New method declaration.
4472 (Insn_template): Fix spelling.
4473 (Stub::thumb16_special): New method declaration.
4474 (Stub::do_write): Define virtual method which was previously pure
4476 (Stub::do_thumb16_special): New method declaration.
4477 (Stub::do_fixed_endian_write): New template member.
4478 (Reloc_stub::do_write): Remove.
4479 (Reloc_stub::do_fixed_endian_write): Remove.
4480 (Cortex_a8_stub): New class definition.
4481 (Stub_factory::make_cortex_a8_stub): New method definition.
4482 (Stub_factory::Stub_factory): Add missing static storage class
4483 qualifier for elf32_arm_stub_a8_veneer_blx.
4485 2010-01-07 Ian Lance Taylor <iant@google.com>
4488 * options.h (class General_options): Add --warn-unresolved-symbols
4489 and --error-unresolved-symbols.
4490 * errors.cc (Errors::undefined_symbol): Implement
4491 --warn-unresolved-symbols.
4493 * options.h (class General_options): Add -z text and -z textoff.
4494 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4496 2010-01-06 Sriraman Tallam <tmsriram@google.com>
4498 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4499 (Garbage_collection::cident_sections): New function.
4500 (Garbage_collection::add_cident_section): New function.
4501 (Garbage_collection::cident_sections_): New member.
4502 (gc_process_relocs): Add references to sections whose names are C
4504 * gold.h (cident_section_start_prefix): New constant.
4505 (cident_section_stop_prefix): New constant.
4506 (is_cident): New function.
4507 * layout.cc (Layout::define_section_symbols): Replace string constants
4508 with the newly defined constants.
4509 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4511 * testsuite/Makefile.am: Add gc_orphan_section_test.
4512 * testsuite/Makefile.in: Regenerate.
4513 * testsuite/gc_orphan_section_test.cc: New file.
4514 * testsuite/gc_orphan_section_test.sh: New file.
4516 2010-01-06 Ian Lance Taylor <iant@google.com>
4519 * options.h (class General_options): Add --warn-shared-textrel.
4520 * layout.cc (Layout::finish_dynamic_section): Implement
4521 --warn-shared-textrel.
4524 * options.h (class General_options): Add --warn-multiple-gp.
4526 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4528 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4529 $(THREADSLIB) and $(LIBDL).
4530 * Makefile.in: Rebuild.
4532 2010-01-06 Ian Lance Taylor <iant@google.com>
4535 * options.cc (General_options::parse_section_start): New function.
4536 (General_options::section_start): New function.
4537 (General_options::General_options): Initialize all members.
4538 * options.h: Include <map>
4539 (class General_options): Add --section-start. Add section_starts_
4541 * layout.cc (Layout::attach_allocated_section_to_segment): If
4542 --section-start was used, set the address of the segment. Remove
4543 local sort_sections.
4544 (Layout::relaxation_loop_body): If the address of the load segment
4545 has been set by --section-start, don't use it.
4546 * output.h (Output_segment::update_flags_for_output_section): New
4548 * output.cc (Output_segment::add_output_section): Call
4549 update_flags_for_output_section.
4551 2010-01-05 Ian Lance Taylor <iant@google.com>
4554 * options.h (class General_options): Add --undefined-version.
4555 * script.cc (struct Version_expression): Add was_matched_by_symbol
4557 (Version_script_info::matched_symbol): New function.
4558 (Version_script_info::get_symbol_version_helper): Call
4560 (Version_script_info::check_unmatched_names): New function.
4561 * script.h (class Version_script_info): Update declarations.
4562 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4564 * options.h (class General_options): Use DEFINE_bool_alias for
4565 allow_multiple_definition.
4566 * resolve.cc (Symbol_table::should_override): Don't test
4567 allow_multiple_definition.
4570 * options.h (class General_options): Add --cref.
4571 * main.cc (main): Print cref table if --cref. Don't close mapfile
4572 until after printing cref table.
4573 * cref.cc: Include "symtab.h".
4574 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4575 (Cref_table_compare::operator()): New function.
4576 (Cref_inputs::gather_cref): New function.
4577 (filecol): New static const.
4578 (Cref_inputs::print_cref): New function.
4579 (Cref::print_cref): New function.
4580 * cref.h: Include <cstdio>.
4581 (class Cref): Update declarations.
4582 * mapfile.h (Mapfile::file): New function.
4583 * object.h (class Object): Define Symbols. Declare virtual
4584 do_get_global_symbols.
4585 (Object::get_global_symbols): New function.
4586 * object.cc (Input_objects::add_object): Pass object to cref_ if
4588 (Input_objects::archive_start): Likewise.
4589 (Input_objects::archive_stop): Likewise.
4590 (Input_objects::print_cref): New function.
4591 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4592 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4594 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4596 * plugin.h (class Sized_pluginobj): Update declarations.
4598 2010-01-05 Ian Lance Taylor <iant@google.com>
4600 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4601 to is_default_version. Rename insdef to insdefault.
4602 (Symbol_table::add_from_relobj): Rename def to is_default_version
4603 and local to is_forced_local.
4604 (Symbol_table::add_from_pluginobj): Likewise.
4605 (Symbol_table::add_from_dynobj): Likewise.
4606 (Symbol_table::define_special_symbol): Rename insdef to
4609 2010-01-04 Ian Lance Taylor <iant@google.com>
4612 * options.h (class General_options): Add
4613 --allow-multiple-definition and -z muldefs.
4614 * resolve.cc (Symbol_table::should_override): Don't warn about a
4615 multiple symbol definition if --allow-multiple-definition or -z
4619 * options.h (class General_options): Add --add-needed and
4620 --copy-dt-needed-entries. Tweak --as-needed help entry.
4621 * object.cc (Input_objects::check_dynamic_dependencies): Give an
4622 error if --copy-dt-needed-entries aka --add-needed is used and
4623 would cause a change in behaviour.
4626 * options.h (class General_options): Add -G as a short version of
4627 --shared. Add no-op options -assert, -g, and -i.
4629 2010-01-04 Sriraman Tallam <tmsriram@google.com>
4631 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4632 check for .text or .gnu.linkonce.t sections.
4633 * icf.cc (Icf::find_identical_sections): Ditto.
4634 Change the detection for mangled function name within the section
4636 * icf.h (is_section_foldable_candidate): New function.
4638 2009-12-30 Ian Lance Taylor <iant@google.com>
4641 * options.h (class General_options): Permit two dashes with
4642 --retain-symbols-file.
4644 2009-12-30 Ian Lance Taylor <iant@google.com>
4647 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4648 don't put the file header and segment headers in the text
4652 * common.cc (Sort_commons::operator()): Stabilize sort when both
4654 (Symbol_table::do_allocate_commons_list): When allocating common
4655 symbols, skip a symbol which is no longer common.
4656 * symtab.h (Symbol::is_common): Test whether the symbol comes from
4657 an object before checking its type.
4658 * testsuite/common_test_2.c: New file.
4659 * testsuite/common_test_3.c: New file.
4660 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4661 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4662 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4663 (common_test_2_pic.o, common_test_2.so): New targets.
4664 (common_test_3_pic.o, common_test_3.so): New targets.
4665 * testsuite/Makefile.in: Rebuild.
4668 * script.cc (read_input_script): If we see a new SECTIONS clause,
4669 and we have added an input section, give an error.
4670 * layout.h (class Layout): Add have_added_input_section function.
4671 Add have_added_input_section_ field.
4672 * layout.cc (Layout::Layout): Initialize
4673 have_added_input_section_.
4674 (Layout::layout): Set have_added_input_section_.
4675 (Layout::layout_eh_frame): Likewise.
4677 2009-12-30 Ian Lance Taylor <iant@google.com>
4680 * options.h (class General_options): Add --sort-common option.
4681 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4682 * common.cc (Sort_common): Add sort_order parameter to
4683 constructor. Add sort_order_ field.
4684 (Sort_commons::operator): Check sort_order_.
4685 (Symbol_table::allocate_commons): Determine the sort order.
4686 (Symbol_table::do_allocate_commons): Add sort_order parameter.
4688 (Symbol_table::do_allocate_commons_list): Likewise.
4690 2009-12-30 Ian Lance Taylor <iant@google.com>
4693 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4694 symbols from this object, don't change the visibility of an
4696 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4698 2009-12-30 Ian Lance Taylor <iant@google.com>
4701 * script.h (class Version_script_info): Define Language enum.
4702 Update declarations. Define Glob, Exact, and Lookup types. Add
4703 new fields globals_, locals_, and is_finalized_.
4704 * script.cc: Various formatting fixes.
4705 (class Parser_closure): Change language_stack_ from a vector of
4706 std::string to one of Version_script_info::Language. Adjust all
4708 (class Lazy_demangler): Remove.
4709 (struct Version_expression): Change language from std::string to
4710 Version_script_info::Language.
4711 (Version_script_info::Version_script_info): New function.
4712 (Version_script_info::~Version_script_info): Don't call clear.
4713 (Version_script_info::finalize): New function.
4714 (Version_script_info::build_lookup_tables): New function.
4715 (Version_script_info::build_expression_list_lookup): New
4717 (Version_script_info::get_symbol_version_helper): Rewrite to use
4719 (Version_script_info::print_expression_list): Adjust to use
4720 Version_script_info::Language.
4721 (script_push_lex_into_version_mode): Check that the version script
4722 has not been finalized.
4723 (version_script_push_lang): Change language string to
4724 Version_script_info::Language.
4725 * options.cc (Command_line::version_script): New function.
4726 * options.h (class General_options): Add finalize_dynamic_list
4727 function. Change version_script from declaration to definition.
4728 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4729 * testsuite/version_script.map: Remove duplicate def of foo.
4730 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4732 * testsuite/Makefile.in: Rebuild.
4734 2009-12-30 Ian Lance Taylor <iant@google.com>
4737 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4738 if the input symbol index is 0, make the output symbol index 0.
4740 2009-12-30 Ian Lance Taylor <iant@google.com>
4743 * options.h (class General_options): Add -x/--discard-all.
4744 * object.cc (Sized_relobj::do_count_local_symbols): Handle
4745 --discard-all. If the local symbol needs a dynamic entry, check
4746 that before handling --discard-locals.
4748 2009-12-30 Ian Lance Taylor <iant@google.com>
4751 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4753 (Output_segment::add_output_section): Don't change the flags if
4757 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4758 GNU hash table if they need a dynamic value. Otherwise, don't add
4759 them if they are defined in a dynamic object or are forced local.
4761 2009-12-29 Ian Lance Taylor <iant@google.com>
4764 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4765 .gnu.hash table for a 32-bit target.
4768 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4769 regular and a dynamic object only needs a dynamic symbol table
4770 entry if it is externally visible.
4773 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4774 constructor. Add global_offset_table_ field.
4775 (Target_i386::got_section): Set global_offset_table_.
4776 (Target_i386::do_finalize_sections): Set global_offset_table_
4778 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4779 in constructor. Add global_offset_table_ field.
4780 (Target_x86_64::got_section): Set global_offset_table_.
4781 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4784 * layout.cc (Layout::Layout): Initialize increase_relro_.
4785 (Layout::get_output_section): Add is_relro, is_last_relro, and
4786 is_first_non_relro parameters. Change all callers.
4787 (Layout::choose_output_section): Likewise.
4788 (Layout::add_output_section_data): Likewise.
4789 (Layout::make_output_section): Likewise.
4790 (Layout::set_segment_offsets): Clear increase_relro when using a
4792 * layout.h (class Layout): Add increase_relro method. Add
4793 increase_relro_ field. Update declarations.
4794 * output.cc (Output_section::Output_section): Initialize
4795 is_last_relro_ and is_first_non_relro_.
4796 (Output_segment::add_output_section): Group relro sections is
4797 do_sort is true. Handle is_last_relro and is_first_non_relro.
4798 (Output_segment::maximum_alignment): Remove relro handling.
4799 (Output_segment::set_section_addresses): Add increase_relro
4800 parameter. Change all callers. Add initial alignment to align
4801 relro sections on separate page. Remove old relro handling.
4802 (Output_segment::set_section_list_addresses): Remove in_relro
4803 parameter. Change all callers.
4804 (Output_segment::set_offset): Add increase parameter. Change all
4805 callers. Remove old relro handling.
4806 * output.h (class Output_section): Add new methods: is_last_relro,
4807 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4808 Add is_last_relro_ and is_first_non_relro_ fields.
4809 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4810 Create separate .got.plt section. Call increase_relro.
4811 * x86_64.cc (Target_x86_64::got_section): Likewise.
4812 * testsuite/relro_script_test.t: Add .got.plt.
4815 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4816 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4817 (Layout::finalize): Call set_dynamic_symbol_size.
4818 (Layout::set_dynamic_symbol_size): New function.
4819 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4820 set_dynamic_symbol_size.
4823 * output.h (class Output_section): Add is_entsize_zero_ field.
4824 * output.cc (Output_section::Output_section): Initialize
4826 (Output_section::set_entsize): If two different entsizes are
4827 requested, force it to zero.
4828 (Output_section::add_input_section): Set flags for .debug_str
4829 before updating section flags. Set entsize.
4830 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4831 and SHF_STRING if all input sections have those flags.
4833 2009-12-29 Rafael Espindola <espindola@google.com>
4835 * main.cc (main): Fix the sys time reporting.
4836 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4839 2009-12-29 Sriraman Tallam <tmsriram@google.com>
4841 * options.cc (General_options::parse_version): Allow -v to exit
4842 without an error if there is nothing to link.
4844 2009-12-29 Ian Lance Taylor <iant@google.com>
4846 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4847 using a version of gcc before 4.1.
4848 * configure: Rebuild.
4850 2009-12-28 Chris Demetriou <cgd@google.com>
4852 * attributes.cc (Output_attributes_section_data::do_write): Use
4853 std::vector::front rather than std::vector::data.
4855 2009-12-28 Ian Lance Taylor <iant@google.com>
4857 * symtab.h (class Symbol_table): Add enum Defined.
4858 * resolve.cc (Symbol_table::should_override): Add defined
4859 parameter. Change all callers. Test whether object is NULL
4860 before calling a method on it.
4861 (Symbol_table::report_resolve_problem): Add defined parameter.
4863 (Symbol_table::should_override_with_special): Likewise.
4864 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4865 parameter. Change all callers.
4866 (Symbol_table::do_define_in_output_data): Likewise.
4867 (Symbol_table::define_in_output_segment): Likewise.
4868 (Symbol_table::do_define_in_output_segment): Likewise.
4869 (Symbol_table::define_as_constant): Likewise.
4870 (Symbol_table::do_define_as_constant): Likewise.
4871 * script.h (class Symbol_assignment): Add is_defsym parameter to
4872 constructor; change all callers.
4873 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4874 parameter. Change all callers. Add is_defsym_ field.
4875 (class Parser_closure): Add parsing_defsym parameter to
4876 constructor; change all callers. Add parsing_defsym accessor
4877 function. Add parsing_defsym_ field.
4879 2009-12-28 Ian Lance Taylor <iant@google.com>
4881 * gold.cc (queue_middle_tasks): Fix formatting.
4882 * object.cc (Relobj::is_section_name_included): Likewise.
4884 2009-12-23 Ian Lance Taylor <iant@google.com>
4886 * i386.cc (Target_i386::do_calls_non_split): Recognize
4887 -fsplit-stack prologue for a function with a static chain.
4888 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4889 -fsplit-stack prologue when using %r11.
4891 2009-12-21 Sriraman Tallam <tmsriram@google.com>
4893 * options.cc (General_options::parse_version): Make -v continue and do
4894 the link like GNU ld does.
4896 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
4898 * Makefile.am (CCFILES): Add timer.cc.
4899 (HFILES): Add timer.h.
4900 * configure.ac: Check for sysconf and times.
4901 * main.cc: include timer.h.
4902 (main): Use Timer instead of get_run_time.
4905 * workqueue.cc: include timer.h.
4906 (Workqueue::find_and_run_task):
4907 Report user, sys and wall time.
4908 * Makefile.in: Regenerate.
4909 * config.in: Regenerate.
4910 * configure: Regenerate.
4912 2009-12-16 Doug Kwan <dougkwan@google.com>
4914 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4916 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4917 relaxed input sections.
4918 * output.cc (Output_section::find_relaxed_input_section): Change
4919 return type to Output_relaxed_input_section pointer. Adjust code
4920 for new type of relaxed_input_section_map_.
4921 * output.h (Output_section::find_relaxed_input_section): Change
4922 return type to Output_relaxed_input_section pointer.
4923 (Output_section::Output_relaxed_input_section_by_input_section_map):
4925 (Output_section::relaxed_input_section_map_): Change type to
4926 Output_section::Output_relaxed_input_section_by_input_section_map.
4927 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4930 2009-12-15 Ian Lance Taylor <iant@google.com>
4932 * layout.cc (Layout::create_shstrtab): Only write out after input
4933 sections if we are compressing debug sections.
4935 2009-12-15 Ian Lance Taylor <iant@google.com>
4937 * archive.cc (Archive::add_symbols): Only look up a symbol without
4938 a version if there is, in fact, a version.
4940 2009-12-14 Ian Lance Taylor <iant@google.com>
4942 Revert -Wshadow changes, all changes from:
4943 2009-12-11 Doug Kwan <dougkwan@google.com>
4944 2009-12-11 Nick Clifton <nickc@redhat.com>
4945 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4947 2009-12-11 Doug Kwan <dougkwan@google.com>
4949 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4951 * attributes.cc (Object_attribute::size): Ditto.
4952 (Attributes_section_data::size): Ditto.
4953 (Attributes_section_data::Attributes_section_data): Ditto.
4954 (Output_attributes_section_data::do_write): Ditto.
4955 * attributes.h (Object_attribute::set_type): Ditto.
4956 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4958 2009-12-11 Nick Clifton <nickc@redhat.com>
4960 * archive.cc: Fix shadowed variable warnings.
4962 * compressed_output.cc: Likewise.
4963 * compressed_output.h: Likewise.
4964 * configure: Likewise.
4965 * dwarf_reader.cc: Likewise.
4966 * dynobj.cc: Likewise.
4967 * dynobj.h: Likewise.
4968 * ehframe.cc: Likewise.
4969 * ehframe.h: Likewise.
4970 * errors.cc: Likewise.
4971 * expression.cc: Likewise.
4972 * fileread.cc: Likewise.
4973 * fileread.h: Likewise.
4974 * freebsd.h: Likewise.
4975 * i386.cc: Likewise.
4977 * incremental.h: Likewise.
4978 * layout.cc: Likewise.
4979 * layout.h: Likewise.
4980 * mapfile.cc: Likewise.
4981 * merge.cc: Likewise.
4982 * merge.h: Likewise.
4983 * object.cc: Likewise.
4984 * object.h: Likewise.
4985 * options.h: Likewise.
4986 * output.cc: Likewise.
4987 * output.h: Likewise.
4988 * parameters.cc: Likewise.
4989 * plugin.cc: Likewise.
4990 * powerpc.cc: Likewise.
4991 * reduced_debug_output.cc: Likewise.
4992 * reduced_debug_output.h: Likewise.
4993 * reloc.cc: Likewise.
4994 * reloc.h: Likewise.
4995 * resolve.cc: Likewise.
4996 * script-sections.cc: Likewise.
4997 * script.cc: Likewise.
4998 * script.h: Likewise.
4999 * sparc.cc: Likewise.
5000 * symtab.cc: Likewise.
5001 * symtab.h: Likewise.
5002 * target-select.cc: Likewise.
5003 * target-select.h: Likewise.
5004 * token.h: Likewise.
5005 * workqueue.cc: Likewise.
5006 * workqueue.h: Likewise.
5007 * x86_64.cc: Likewise.
5009 2009-12-10 Doug Kwan <dougkwan@google.com>
5011 * arm.cc (attributes.h): New include.
5012 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5013 (Arm_relobj::~Arm_relobj): Delete object pointed by
5014 attributes_section_data_.
5015 (Arm_relobj::attributes_section_data): New method definition.
5016 (Arm_relobj::attributes_section_data_): New data member declaration.
5017 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5018 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5019 attributes_section_data_.
5020 (Arm_dynobj::attributes_section_data): New method definition.
5021 (Arm_dynobj::attributes_section_data_): New data member declaration.
5022 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5023 initialization value of may_use_blx_ to false.
5024 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5025 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5026 object attributes to compute results instead of hard-coding.
5027 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5028 Target_arm::get_secondary_compatible_arch,
5029 Target_arm::set_secondary_compatible_arch
5030 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5031 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5032 New method declarations.
5033 (Target_arm::get_aeabi_object_attribute): New method definition.
5034 (Target_arm::attributes_section_data_): New data member declaration.
5035 (read_arm_attributes_section): New template definition.
5036 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5037 (Arm_dynobj::do_read_symbols): Ditto.
5038 (Target_arm::do_finalize_sections): Merge attributes sections from
5039 input. Check for BLX use after attributes section merging.
5040 Fix __exidx_start and __exidx_end visibility. Create an
5041 .ARM.attributes section if necessary.
5042 (Target_arm::get_secondary_compatible_arch,
5043 Target_arm::set_secondary_compatible_arch,
5044 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5045 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5046 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5047 New method definitions.
5049 2009-12-09 Ian Lance Taylor <iant@google.com>
5051 * plugin.cc (Plugin::load): Don't cast from void* to a function
5054 2009-12-09 Ian Lance Taylor <iant@google.com>
5056 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5059 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5061 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5062 Replace two_file_shared_1.so with two_file_shared_2.so.
5063 * testsuite/Makefile.in: Regenerated.
5065 2009-12-08 Doug Kwan <dougkwan@google.com>
5067 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5068 (HFILES): Add attributes.h and int_encoding.h.
5069 * Makefile.in: Regenerate.
5070 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5071 function definitions to int_encoding.cc
5072 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5073 prototypes to int_encoding.h
5074 * reduced_debug_output.cc (int_encoding.h): New include.
5075 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5076 function definitions to int_encoding.cc
5077 (insert_into_vector, read_from_pointer): Move template definitions to
5079 * attributes.cc: New file.
5080 * attributes.h: New file.
5081 * int_encoding.cc: New file.
5082 * int_encoding.h: New file.
5084 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5087 * incremental-dump.cc (dump_incremental_inputs): New.
5088 (main): Use dump_incremental_inputs.
5090 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5093 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5094 checking elfcpp::STT_FUNC.
5095 (Target_i386::Relocate::relocate): Likewise.
5096 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5098 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5099 symbols from shared libraries into normal FUNC symbols.
5101 * symtab.h (Symbol): Add is_func and use it.
5103 2009-12-05 Doug Kwan <dougkwan@google.com>
5105 * arm.cc (Target_arm::arm_info): Initialize new fields
5106 attributes_section and attributes_vendor.
5107 * i386.cc (Target_i386::i386_info): Same.
5108 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5109 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5110 fields attributes_section and attributes_vendor.
5111 * sparc.cc (Target_sparc::sparc_info): Same.
5112 * target.h (Target::attributes_section, Target::attributes_vendor,
5113 Target::is_attributes_section, Target::attribute_arg_type,
5114 Target::attributes_order): New method definitions.
5115 (Target::Target_info::attributes_section,
5116 Target::Target_info::attributes_vendor): New fields.
5117 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5118 virtual method definitions.
5119 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5120 attributes_section and attributes_vendor.
5121 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5123 2009-12-05 Doug Kwan <dougkwan@google.com>
5125 * arm.cc: Update comments about interworking and stub generation.
5126 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5127 considered as non-PIC.
5128 (Arm_relocate_functions::base_abs): Fix formatting.
5129 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5130 of function to use GOT entry address instead of offset.
5131 (Target_arm::Scan::global): Issue an error if a symbol would need a
5132 PLT does not get one because it is untyped. Remove code to create
5133 dynamic symbols for relative branches.
5134 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5135 takes unsigned integer instead of boolean.
5137 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5139 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5140 (two_file_test_LDADD): Likewise.
5141 (common_test_1_LDADD): Likewise.
5142 (exception_test_LDADD) Likewise.
5143 (weak_test_LDADD): Likewise.
5144 (many_sections_test_LDADD): Likewise.
5145 (initpri1_LDADD): Likewise.
5146 (script_test_1_LDADD): Likewise.
5147 (script_test_2_LDADD): Likewise.
5148 (justsyms_LDADD): Likewise.
5149 (binary_test_LDADD): Likewise.
5150 (large_LDADD): Likewise.
5151 * testsuite/Makefile.in: Regenerated.
5153 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5155 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5156 (Symbol_table::override_with_special): Likewise.
5157 (Symbol_table::add_from_object): Likewise.
5159 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5161 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5162 Don't set the data_offset twice.
5164 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5166 * testsuite/Makefile.in: Regenerate.
5168 2009-12-03 Doug Kwan <dougkwan@google.com>
5170 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5171 (Target_arm::do_finalize_sections): Add parameter for symbol table
5172 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5173 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5174 parameter for symbol table pointer.
5175 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5176 an additional parameter for a pointer to symbol table.
5177 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5178 parameter for a symbol table pointer.
5179 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5180 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5182 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5183 parameter for a symbol table pointer.
5185 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5187 * incremental.cc (Incremental_inputs_header)
5188 (Incremental_inputs_header_write, Incremental_inputs_entry)
5189 (Incremental_inputs_entry_write): Move ...
5190 * incremental.h (Incremental_inputs_header)
5191 (Incremental_inputs_header_write, Incremental_inputs_entry)
5192 (Incremental_inputs_entry_write): here.
5194 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5196 * incremental.cc (make_sized_incremental_binary): Set the target.
5197 Error if it is incompatible.
5198 * output.h (Output_file): Add filename method.
5200 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5202 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5203 from the get_* methods.
5205 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5207 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5208 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5209 Write 0 for the data_offset of scripts.
5211 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5213 * testsuite/Makefile.am: Add the incremental_test.sh test.
5214 * testsuite/incremental_test.sh: New.
5215 * testsuite/incremental_test_1.c: New.
5216 * testsuite/incremental_test_2.c: New.
5218 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5220 * incremental-dump.cc (main): Fix typos.
5222 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5225 * incremental-dump.cc (main): Use llu to print 64 bit values.
5227 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5228 H.J. Lu <hongjiu.lu@intel.com>
5230 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5232 (incremental_dump_LDADD): Likewise.
5233 * Makefile.in: Regenerated.
5235 2009-11-25 Doug Kwan <dougkwan@google.com>
5239 2009-11-25 Doug Kwan <dougkwan@google.com>
5241 * arm.cc (Target_arm::Target_arm): Move method definition
5242 outside of class definition. Add code to handle
5243 --target1-rel, --target1-abs and --target2= options.
5244 (Target_arm::get_reloc_reloc_type): Change method to be
5245 non-static and const.
5246 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5247 New data member declaration.
5248 (Target_arm::Scan::local, Target_arm::Scan::global,
5249 Target_arm::Relocate::relocate,
5250 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5251 Adjust call to Target_arm::get_real_reloc_type.
5252 (Target_arm::get_real_reloc_type): Use command line options
5253 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5254 * options.h (--target1-rel, --target1-abs, --target2): New
5257 2009-11-25 Doug Kwan <dougkwan@google.com>
5259 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5260 class definition. Add code to handle --target1-rel, --target1-abs
5261 and --target2= options.
5262 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5264 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5266 (Target_arm::Scan::local, Target_arm::Scan::global,
5267 Target_arm::Relocate::relocate,
5268 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5269 call to Target_arm::get_real_reloc_type.
5270 (Target_arm::get_real_reloc_type): Use command line options to
5271 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5272 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5275 2009-11-25 Doug Kwan <dougkwan@google.com>
5277 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5278 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5279 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5281 (Arm_relocate_functions::thm_call): Replace body with a call to
5282 Arm_relocate_functions::thumb_branch_common.
5283 (Arm_relocate_functions::thm_jump24,
5284 Arm_relocate_functions::thm_xpc22): New method definitions.
5285 (Arm_relocate_functions::thumb_branch_common): New method definition.
5286 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5288 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5289 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5291 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5293 * Makefile.am: Build incremental-dump
5294 * Makefile.in: Regenerate.
5295 * incremental-dump.cc: New.
5296 * incremental.cc (Incremental_inputs_header_data,
5297 Incremental_inputs_entry_data): Move to incremental.h
5298 * incremental.h: (Incremental_inputs_header_data,
5299 Incremental_inputs_entry_data): Move from incremental.cc
5301 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5303 * incremental.cc (Incremental_inputs_header,
5304 Incremental_inputs_header_write, Incremental_inputs_entry,
5305 Incremental_inputs_entry_write): Add a typedef with the data type.
5307 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5309 * incremental.cc (Incremental_inputs_header,
5310 Incremental_inputs_header_write, Incremental_inputs_entry,
5311 Incremental_inputs_entry_write): Update comment about which
5312 type has the filed descriptions.
5314 2009-11-15 Doug Kwan <dougkwan@google.com>
5316 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5317 (Arm_relocate_functions::arm_branch_common): Change method defintion
5318 in class definition to a method declaration and update list of formal
5320 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5321 Arm_relocation_functions::jump24): Adjust call to
5322 Arm_relocate_functions::arm_branch_common. Update list of formal
5324 (Arm_relocate_functions::xpc25): New method definition.
5325 (Arm_relocate_functions::arm_branch_common): Move method defintion
5326 out from class definition. Use stubs for mode-switching and extending
5328 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5329 specially. Change code to enable use of stubs in ARM branches.
5331 2009-11-10 Doug Kwan <dougkwan@google.com>
5333 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5334 in method declaration.
5335 (Target_arm::relocate_stub): New method declaration.
5336 (Target_arm::default_target): Change to return a pointer instead of
5338 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5339 Target_arm::default_target.
5340 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5342 (Target_arm::relocate_section): Adjust view.
5343 (Target_arm::relocate_stub): New method definition.
5345 2009-11-10 Doug Kwan <dougkwan@google.com>
5347 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5349 * incremental.cc (open_incremental_binary): Initialized local
5350 variables to avoid warnings.
5351 * object.cc (make_elf_object): Ditto.
5352 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5355 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5358 * testsuite/plugin_test.c: Include "config.h".
5360 2009-11-09 Doug Kwan <dougkwan@google.com>
5362 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5363 (arm_symbol_value): Remove.
5364 (Arm_relocate_functions::arm_branch_common,
5365 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5366 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5367 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5368 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5369 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5370 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5371 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5372 Arm_relocate_functions::thm_mobw_abs_nc,
5373 Arm_relocate_functions::thm_mov_abs,
5374 Arm_relocate_functions::movw_prel_nc,
5375 Arm_relocate_functions::thm_movt_abs,
5376 Arm_relocate_functions::movt_prel,
5377 Arm_relocate_functions::thm_movw_prel_nc,
5378 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5379 (Target_arm::Relocate::relocate): Only decompose address into two
5380 parts if relocation type uses the thumb-bit and pass the actual
5381 bit instead of a flag indicating that the thumb-bit is used. Adjust
5382 calls to methods in Arm_relocate_functions for this change.
5384 2009-11-08 Ian Lance Taylor <iant@google.com>
5387 * reloc.cc: Instantiate
5388 Sized_relobj::initialize_input_to_output_maps and
5389 Sized_relobj:free_input_to_output_maps.
5391 2009-11-06 Ian Lance Taylor <iant@google.com>
5394 * defstd.cc (in_segment): Set only_if_ref true for "end".
5396 2009-11-06 Doug Kwan <dougkwan@google.com>
5398 * arm.cc (class Reloc_stub): Correct a comment.
5399 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5400 (Target_arm::scan_section_for_stubs): New method declaration.
5401 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5402 Change methods from private to protected.
5403 (Target_arm::do_may_relax): New method definition.
5404 (Target_arm::do_relax, Target_arm::group_sections,
5405 Target_arm::scan_reloc_for_stub,
5406 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5407 (Target_arm::arm_input_section_map_): New data member declaration.
5408 (Target_arm::scan_reloc_for_stub,
5409 Target_arm::scan_reloc_section_for_stubs,
5410 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5411 Target_arm::do_relax): New method definitions.
5413 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5415 * configure.ac: Check for (struct stat)::st_mtim
5416 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5417 * config.in: Regenerate.
5418 * configure: Regenerate.
5420 2009-11-05 Ian Lance Taylor <iant@google.com>
5423 * output.cc (Output_segment::add_output_section): Add missing
5426 2009-11-04 Ian Lance Taylor <iant@google.com>
5429 * object.h (class Object): Add is_needed and set_is_needed
5430 methods. Add is_needed_ field. Make bool fields into bitfields.
5431 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5432 defined in a dynamic object and referenced by a regular object,
5433 set is_needed for the dynamic object.
5434 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5435 if the file is marked with as_needed and it is not needed.
5437 2009-11-04 Ian Lance Taylor <iant@google.com>
5440 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5441 tags if data is discarded by linker script.
5442 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5443 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5444 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5445 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5447 2009-11-04 Ian Lance Taylor <iant@google.com>
5449 * layout.cc (Layout::get_output_section): Add is_interp and
5450 is_dynamic_linker_section parameters. Change all callers.
5451 (Layout::choose_output_section): Likewise.
5452 (Layout::make_output_section): Likewise.
5453 (Layout::add_output_section_data): Add is_dynamic_linker_section
5454 parameter. Change all callers.
5455 * layout.h (class Layout): Update declarations.
5456 * output.h (class Output_section): Add is_interp, set_is_interp,
5457 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5458 Add is_interp_, is_dynamic_linker_section_ fields. Change
5459 generate_code_fills_at_write_ to a bitfield.
5460 * output.cc (Output_section::Output_sections): Initialize new
5462 (Output_segment::add_output_section): Add do_sort parameter.
5465 2009-11-03 Ian Lance Taylor <iant@google.com>
5468 * options.h (class General_options): Add --warn-common.
5469 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5470 merging two common symbols.
5471 (Symbol_table::should_override): Handle --warn-common when merging
5472 a common symbol with a defined symbol. Use report_resolve_problem
5473 for multiple definitions.
5474 (Symbol_table::report_resolve_problem): New function.
5475 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5477 2009-11-03 Doug Kwan <dougkwan@google.com>
5479 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5481 (Target_arm::stub_factory): New method definition.
5482 (Target_arm::new_arm_input_section,
5483 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5484 Target_arm::reloc_uses_thumb_bit): New method declarations.
5485 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5486 New type definitions.
5487 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5488 member declarations.
5489 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5490 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5491 New method definitions.
5493 2009-11-03 Ian Lance Taylor <iant@google.com>
5495 * options.h (class General_options): Add --warn_constructors.
5497 2009-11-03 Ian Lance Taylor <iant@google.com>
5500 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5501 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5503 2009-11-03 Ian Lance Taylor <iant@google.com>
5506 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5507 --msgid-bugs-address.
5508 (install-pdf): New target.
5509 (install-data_yes): Look up one directory to find mkinstalldirs.
5511 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5513 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5516 2009-10-30 Doug Kwan <dougkwan@google.com>
5518 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5520 2009-10-30 Doug Kwan <dougkwan@google.com>
5522 * arm.cc (Stub_addend_reader): New struct template definition
5523 and partial specializations.
5524 (Stub_addend_reader::operator()): New method definition for a
5525 partially specialized template.
5527 2009-10-30 Doug Kwan <dougkwan@google.com>
5529 * arm.cc (Arm_relobj::processor_specific_flags): New method
5531 (Arm_relobj::do_read_symbols): New method declaration.
5532 (Arm_relobj::processor_specific_flags_): New data member declaration.
5533 (Arm_dynobj): New class definition.
5534 (Target_arm::do_finalize_sections): Add input_objects parameter.
5535 (Target_arm::do_adjust_elf_header): New method declaration.
5536 (Target_arm::are_eabi_versions_compatible,
5537 (Target_arm::merge_processor_specific_flags): New method declaration.
5538 (Target_arm::do_make_elf_object): New overloaded method definitions
5540 (Arm_relobj::do_read_symbols): New method definition.
5541 (Arm_dynobj::do_read_symbols): Ditto.
5542 (Target_arm::do_finalize_sections): Add input_objects parameters.
5543 Merge processor-specific flags from all input objects.
5544 (Target_arm::are_eabi_versions_compatible,
5545 Target_arm::merge_processor_specific_flags,
5546 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5547 New method definitions.
5548 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5549 Input_objects pointer type parameter.
5550 * layout.cc (Layout::finalize): Pass input objects to target's.
5551 finalize_sections function.
5552 * output.cc (Output_file_header::do_sized_write): Set ELF file
5553 header's processor-specific flags.
5554 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5555 Input_objects pointer type parameter.
5556 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5557 * target.h (Input_objects): New forward class declaration.
5558 (Target::processor_specific_flags,
5559 Target::are_processor_specific_flags_sect): New method definitions.
5560 (Target::finalize_sections): Add input_objects parameter.
5561 (Target::Target): Initialize processor_specific_flags_ and
5562 are_processor_specific_flags_set_.
5563 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5565 (Target::set_processor_specific_flags): New method definition.
5566 (Target::processor_specific_flags_,
5567 Target::are_processor_specific_flags_set_): New data member
5569 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5570 Input_objects pointer type parameter.
5572 2009-10-30 Doug Kwan <dougkwan@google.com>
5574 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5576 2009-10-28 Ian Lance Taylor <iant@google.com>
5578 * object.h (class Relobj): Drop options parameter from
5579 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5580 do_scan_relocs, do_relocate. Change all callers.
5581 (class Sized_relobj): Drop options parameters from
5582 do_gc_process_relocs, do_scan_relocs, do_relocate,
5583 do_relocate_sections, relocate_sections, emit_relocs_scan,
5584 emit_relocs_scan_reltype. Change all callers.
5585 (struct Relocate_info): Remove options field and all references to
5587 * reloc.h (class Read_relocs): Remove options constructor
5588 parameter and options_ field. Change all callers.
5589 (class Gc_process_relocs, class Scan_relocs): Likewise.
5590 (class Relocate_task): Likewise.
5591 * target-reloc.h (scan_relocs): Remove options parameter. Change
5593 (scan_relocatable_relocs): Likewise.
5594 * target.h (class Sized_target): Remove options parameter from
5595 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5597 * gc.h (gc_process_relocs): Remove options parameter. Change all
5599 * arm.cc: Update functions to remove options parameters.
5600 * i386.cc: Likewise.
5601 * powerpc.cc: Likewise.
5602 * sparc.cc: Likewise.
5603 * x86_64.cc: Likewise.
5604 * testsuite/testfile.cc: Likewise.
5606 2009-10-28 Doug Kwan <dougkwan@google.com>
5608 * arm.cc (Arm_relobj): New class definition.
5609 (Arm_relobj::scan_sections_for_stubs,
5610 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5611 New method definitions.
5613 2009-10-28 Cary Coutant <ccoutant@google.com>
5615 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5616 (Plugin::cleanup_done_): New member.
5617 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5618 (Plugin_manager::cleanup_done_): Remove.
5619 (Plugin_manager::add_input_file): Edit error message.
5620 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5621 (Plugin_manager::cleanup): Remove use of cleanup_done_.
5623 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
5625 * fileread.cc: (File_read::View::~View): Use the new
5626 data_ownership_ filed.
5627 (File_read::~File_read): Dispose the new whole_file_view_.
5628 (File_read::open): Mmap the whole file if needed.
5629 (File_read::open): Use whole_file_view_ instead of contents_.
5630 (File_read::find_view): Use whole_file_view_ if applicable.
5631 (File_read::do_read): Use whole_file_view_ instead of contents_.
5632 (File_read::make_view): Use whole_file_view_ instead of contents_,
5633 update File_read::View::View call.
5634 (File_read::find_or_make_view): Update File_read::View::View
5636 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5638 (File_read::View::Data_ownership): New enum.
5639 (File_read::View::View): Replace bool mapped_ with Data_ownership
5641 (File_read::View::mapped_): Remove (replaced by data_ownership_).
5642 (File_read::View::data_ownership_): New field.
5643 (File_read::contents_): Remove (replaced by whole_file_view_).
5644 (File_read::whole_file_view_): New field.
5645 * options.h (class General_options): Add --keep-files-mapped.
5647 2009-10-27 Cary Coutant <ccoutant@google.com>
5649 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5650 * testsuite/Makefile.am (plugin_test_5): New test case.
5651 * testsuite/Makefile.in: Regenerate.
5653 2009-10-25 Doug Kwan <dougkwan@google.com>
5655 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5656 from private to protected to allow access by child class.
5657 (Sized_relobj::do_relocate_sections): New method declaration.
5658 (Sized_relobj::relocate_sections): Virtualize.
5659 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5660 Sized_relobj::relocate_sections. Instantiate template explicitly
5661 for different target sizes and endianity.
5663 2009-10-24 Doug Kwan <dougkwan@google.com>
5665 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5666 (Arm_input_section::as_arm_input_section): New method.
5667 (Arm_output_section): New class definition.
5668 (Arm_output_section::create_stub_group,
5669 Arm_output_section::group_sections): New method definitions.
5671 2009-10-22 Doug Kwan <dougkwan@google.com>
5673 * arm.cc (Arm_input_section): New class definition.
5674 (Arm_input_section::init, Arm_input_section:do_write,
5675 Arm_input_section::set_final_data_size,
5676 Arm_input_section::do_reset_address_and_file_offset): New method
5679 2009-10-21 Doug Kwan <dougkwan@google.com>
5681 * arm.cc (Stub_table, Arm_input_section): New forward class
5683 (Stub_table): New class defintion.
5684 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5685 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5686 New method definition.
5688 2009-10-21 Doug Kwan <dougkwan@google.com>
5690 * arm.cc: Update copyright comments.
5691 (Target_arm): New forward class template declaration.
5692 (Arm_address): New type.
5693 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5694 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5695 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5697 (Insn_template): Same.
5698 (DEF_STUBS): New macro.
5699 (Stub_type): New enum type.
5700 (Stub_template): New class definition.
5703 (Stub_factory): Same.
5704 (Target_arm::Target_arm): Initialize may_use_blx_ and
5705 should_force_pic_veneer_.
5706 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5707 Target_arm::should_force_pic_veneer,
5708 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5709 Target_arm::using_thumb_only, Target_arm:;default_target): New
5711 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5712 New data member declarations.
5713 (Insn_template::size, Insn_template::alignment): New method defintions.
5714 (Stub_template::Stub_template): New method definition.
5715 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5716 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5717 (Stub_factory::Stub_factory): New method definition.
5718 * gold.h (string_hash): New template.
5719 * output.h (Input_section_specifier::hash_value): Use
5721 (Input_section_specifier::string_hash): Remove.
5722 * stringpool.cc (Stringpool_template::string_hash): Use
5725 2009-10-20 Doug Kwan <dougkwan@google.com>
5727 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5728 symbols of relaxed input sections.
5729 * output.h (Output_section::find_relaxed_input_section): Make
5732 2009-10-16 Doug Kwan <dougkwan@google.com>
5734 * dynobj.cc (Versions::Versions): Initialize version_script_.
5735 Only insert base version symbol definition for a shared object
5736 if version script defines any version versions.
5737 (Versions::define_base_version): New method definition.
5738 (Versions::add_def): Check that base version is not needed.
5739 (Versions::add_need): Define base version lazily.
5740 * dynobj.h (Versions::define_base_version): New method declaration.
5741 (Versions::needs_base_version_): New data member declaration.
5742 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5743 (check_DATA): Add no_version_test.stdout.
5744 (libno_version_test.so, no_version_test.o no_version_test.stdout):
5746 * testsuite/Makefile.in: Regenerate.
5747 * testsuite/no_version_test.c: New file.
5748 * testsuite/no_version_test.sh: Ditto.
5750 2009-10-16 Doug Kwan <dougkwan@google.com>
5752 * expression.cc (class Segment_start_expression): New class definition.
5753 (Segment_start_expression::value): New method definition.
5754 (script_exp_function_segment_start): Return a new
5755 Segment_start_expression.
5756 * gold/script-c.h (script_saw_segment_start_expression): New function
5758 * script-sections.cc (Script_sections::Script_sections): Initialize
5759 SAW_SEGMENT_START_EXPRESSION_ to false.
5760 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5761 and -Tbbs options to specify section addresses if given in
5762 command line and no SEGMENT_START expression is seen in a script.
5763 * script-sections.h (Script_sections::saw_segment_start_expression,
5764 Script_sections::set_saw_segment_start_expression): New method
5766 (Script_sections::saw_segment_start_expression_): New data member
5768 * script.cc (script_saw_segment_start_expression): New function.
5769 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5770 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5771 script_test_7.sh and script_test_8.sh.
5772 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5773 script_test_8.stdout.
5774 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5775 (script_test_6, script_test_6.stdout, script_test_7,
5776 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5777 * Makefile.in: Regenerate.
5778 * testsuite/script_test_6.sh: New file.
5779 * testsuite/script_test_6.t: Same.
5780 * testsuite/script_test_7.sh: Same.
5781 * testsuite/script_test_7.t: Same.
5782 * testsuite/script_test_8.sh: Same.
5784 2009-10-16 Doug Kwan <dougkwan@google.com>
5786 * output.cc (Output_segment::set_section_list_address): Cast
5787 expressions to unsigned long long type to avoid format warnings.
5789 2009-10-15 Ian Lance Taylor <iant@google.com>
5791 * script.cc (Script_options::add_symbol_assignment): Always add a
5792 dot assignment to script_sections_.
5793 * script-sections.cc (Script_sections::add_dot_assignment):
5794 Initialize if necessary.
5796 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5797 program headers with no load segment if there is a linker script.
5799 * layout.cc (Layout::set_segment_offsets): Align the file offset
5800 to the segment aligment for -N or -n with no load segment.
5801 * output.cc (Output_segment::add_output_section): Don't crash if
5802 the first section is a TLS section.
5803 (Output_segment::set_section_list_addresses): Print an error
5804 message if the address moves backward in a linker script.
5805 * script-sections.cc
5806 (Output_section_element_input::set_section_addresses): Don't
5807 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5808 (Orphan_output_section::set_section_addresses): Likewise.
5810 2009-10-15 Doug Kwan <dougkwan@google.com>
5812 * layout.cc (Layout::finish_dynamic_section): Generate tags
5813 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5814 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5815 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5817 2009-10-14 Ian Lance Taylor <iant@google.com>
5819 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5821 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5822 data_shdr fields of relinfo.
5823 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5824 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5825 R_386_TLS_LDO_32, adjust based on section flags.
5826 (Target_i386::Relocate::fix_up_ldo): Remove.
5828 2009-10-13 Ian Lance Taylor <iant@google.com>
5830 Add support for -pie.
5831 * options.h (class General_options): Add -pie and
5833 (General_options::output_is_position_independent): Test -pie.
5834 (General_options::output_is_executable): Return true if not shared
5835 and not relocatable.
5836 (General_options::output_is_pie): Remove.
5837 * options.cc (General_options::finalize): Reject incompatible uses
5839 * gold.cc (queue_middle_tasks): A -pie link is not static.
5840 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5841 * symtab.cc (Symbol::final_value_is_known): Return false if
5842 output_is_position_independent.
5843 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5844 output_is_position_independent.
5845 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5846 output_is_position_independent.
5847 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5848 output_is_position_independent.
5849 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5851 (basic_pie_test.o, basic_pie_test): New targets.
5852 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5853 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5854 (two_file_pie_test): New target.
5855 * testsuite/Makefile.in: Rebuild.
5856 * README: Remove note saying that -pie is not supported.
5858 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
5860 * options.h (class General_options): Add -init and -fini.
5861 * layout.cc (Layout::finish_dynamic_section): Emit
5862 given init and fini functions.
5864 2009-10-13 Sriraman Tallam <tmsriram@google.com>
5866 * gc.h (gc_process_relocs): Check if icf is enabled using new
5868 * gold.cc (queue_initial_tasks): Likewise.
5869 (queue_middle_tasks): Likewise.
5870 * object.cc (do_layout): Likewise.
5871 * symtab.cc (is_section_folded): Likewise.
5872 * main.cc (main): Likewise.
5873 * reloc.cc (Read_relocs::run): Likewise.
5874 (Sized_relobj::do_scan_relocs): Likewise.
5875 * icf.cc (is_function_ctor_or_dtor): New function.
5876 (Icf::find_identical_sections): Check if function is ctor or dtor when
5878 * options.h (General_options::icf): Change option to be an enum.
5879 (Icf_status): New enum.
5880 (icf_enabled): New method.
5881 (icf_safe_folding): New method.
5882 (set_icf_status): New method.
5883 (icf_status_): New variable.
5884 * (options.cc) (General_options::finalize): Set icf_status_.
5885 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5886 icf_test and icf_keep_unique_test to use the --icf enum flag.
5887 * testsuite/icf_safe_test.sh: New file.
5888 * testsuite/icf_safe_test.cc: New file.
5890 2009-10-12 Sriraman Tallam <tmsriram@google.com>
5892 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5893 includes to gc.h and icf.h.
5894 * arm.cc: Include gc.h.
5895 * gold.cc: Likewise.
5896 * i386.cc: Likewise.
5897 * powerpc.cc: Likewise.
5898 * sparc.cc: Likewise.
5899 * x86_64.cc: Likewise.
5900 * gc.h: Include icf.h.
5902 2009-10-11 Ian Lance Taylor <iant@google.com>
5904 * plugin.cc: Include "gold.h" before other header files.
5906 2009-10-10 Chris Demetriou <cgd@google.com>
5908 * options.h (Input_file_argument::Input_file_type): New enum.
5909 (Input_file_argument::is_lib_): Replace with...
5910 (Input_file_argument::type_): New member.
5911 (Input_file_argument::Input_file_argument): Take Input_file_type
5912 'type' rather than boolean 'is_lib' as second argument.
5913 (Input_file_argument::is_lib): Use type_.
5914 (Input_file_argument::is_searched_file): New function.
5915 (Input_file_argument::may_need_search): Handle is_searched_file.
5916 * options.cc (General_options::parse_library): Support -l:filename.
5917 (General_options::parse_just_symbols): Update for Input_file_argument
5919 (Command_line::process): Likewise.
5920 * archive.cc (Archive::get_file_and_offset): Likewise.
5921 * plugin.cc (Plugin_manager::release_input_file): Likewise.
5922 * script.cc (read_script_file, script_add_file): Likewise.
5923 * fileread.cc (Input_file::Input_file): Likewise.
5924 (Input_file::will_search_for): Handle is_searched_file.
5925 (Input_file::open): Likewise.
5926 * readsyms.cc (Read_symbols::get_name): Likewise.
5927 * testsuite/Makefile.am (searched_file_test): New test.
5928 * testsuite/Makefile.in: Regenerate.
5929 * testsuite/searched_file_test.cc: New file.
5930 * testsuite/searched_file_test_lib.cc: New file.
5932 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5933 Ian Lance Taylor <iant@google.com>
5935 * descriptor.cc: Include <cstdio> and "binary-io.h".
5936 (Descriptors::open): Open the files in binary mode always.
5937 * script.cc (Lex::get_token): Treat \r as whitespace.
5939 2009-10-09 Ian Lance Taylor <iant@google.com>
5941 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5943 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5944 Ian Lance Taylor <iant@google.com>
5946 * configure.ac: Check for readv function also.
5947 * fileread.cc (readv): Define if not HAVE_READV.
5948 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5950 * config.in: Regenerate.
5951 * configure: Regenerate.
5953 2009-10-09 Doug Kwan <dougkwan@google.com>
5955 * layout.cc (Layout::make_output_section): Call target hook to make
5956 ordinary output section.
5957 (Layout::finalize): Adjust parameter list of call the
5958 Target::may_relax().
5959 * layout.h (class Layout::section_list): New method.
5960 * merge.h (Output_merge_base::entsize): Change visibility to public.
5961 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5963 (Output_merge_string::do_is_string): New method.
5964 * object.cc (Sized_relobj::do_setup): renamed from
5965 Sized_relobj::set_up.
5966 * object.h (Sized_relobj::adjust_shndx,
5967 Sized_relobj::initializ_input_to_output_maps,
5968 Sized_relobj::free_input_to_output_maps): Change visibilities to
5970 (Sized_relobj::setup): Virtualize.
5971 (Sized_relobj::do_setup): New method declaration.
5972 (Sized_relobj::invalidate_section_offset,
5973 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5974 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5975 * options.cc (parse_int): New function.
5976 * options.h (parse_int): New declaration.
5977 (DEFINE_int): New macro.
5978 (stub_group_size): New option.
5979 * output.cc (Output_section::Output_section): Initialize memebers
5980 merge_section_map_, merge_section_by_properties_map_,
5981 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5982 (Output_section::add_input_section): Handled deferred code-fill
5983 generation and remove an old comment.
5984 (Output_section::add_relaxed_input_section): New method definition.
5985 (Output_section::add_merge_input_section): Use merge section by
5986 properties map to speed to search. Update merge section maps
5988 (Output_section::build_relaxation_map): New method definition.
5989 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5991 (Output_section::relax_input_section): Renamed to
5992 Output_section::convert_input_sections_to_relaxed_sections and change
5993 interface to take a vector of pointers to relaxed sections.
5994 (Output_section::find_merge_section,
5995 Output_section::find_relaxed_input_section): New method definitions.
5996 (Output_section::is_input_address_mapped,
5997 Output_section::output_offset, Output_section::output_address):
5998 Use output section data maps to speed up searching.
5999 (Output_section::find_starting_output_address): Add comments.
6000 (Output_section::do_write,
6001 Output_section::write_to_postprocessing_buffer): Do code-fill
6002 generation as appropriate.
6003 (Output_section::get_input_sections): Invalidate relaxed input section
6005 (Output_section::restore_states): Adjust type of checkpoint .
6006 Invalidate relaxed input section map.
6007 * output.h (Output_merge_base): New class declaration.
6008 (Input_section_specifier): New class defintion.
6009 (class Output_relaxed_input_section) Change base class to
6010 Output_section_data_build.
6011 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6012 base class initializer.
6013 (Output_section::add_relaxed_input_section): New method declaration.
6014 (Output_section::Input_section): Change visibility to protected.
6015 (Output_section::Input_section::relobj,
6016 Output_section::Input_section::shndx): Handle relaxed input sections.
6017 Output_section::input_sections) Change visibility to protected. Also
6018 define overload to return a non-const pointer.
6019 (Output_section::Merge_section_properties): New class defintion.
6020 (Output_section::Merge_section_by_properties_map,
6021 Output_section::Output_section_data_by_input_section_map,
6022 Output_section::Relaxation_map): New types.
6023 (Output_section::relax_input_section): Rename method to
6024 Output_section::convert_input_sections_to_relaxed_sections and change
6025 interface to take a vector of relaxed section pointers.
6026 (Output_section::find_merge_section,
6027 Output_section::find_relaxed_input_section,
6028 Output_section::build_relaxation_map,
6029 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6030 New method declarations.
6031 (Output_section::merge_section_map_
6032 Output_section::merge_section_by_properties_map_,
6033 Output_section::relaxed_input_section_map_,
6034 Output_section::is_relaxed_input_section_map_valid_,
6035 Output_section::generate_code_fills_at_write_): New data members.
6036 * script-sections.cc
6037 (Output_section_element_input::set_section_addresses): Call
6038 current_data_size and addralign methods of relaxed input sections.
6039 (Orphan_output_section::set_section_addresses): Call current_data_size
6040 and addralign methods of relaxed input sections.
6041 * symtab.cc (Symbol_table::compute_final_value): Extract template
6042 from the body of Symbol_table::sized_finalize_symbol.
6043 (Symbol_table::sized_finalized_symbol): Call
6044 Symbol_table::compute_final_value.
6045 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6046 (Symbol_table::compute_final_value): New templated method declaration.
6047 * target.cc (Target::do_make_output_section): New method defintion.
6048 * target.h (Target::make_output_section): New method declaration.
6049 (Target::relax): Add more parameters for input objects, symbol table
6050 and layout. Adjust call to do_relax.
6051 (Target::do_make_output_section): New method declaration.
6052 (Target::do_relax): Add parameters for input objects, symbol table
6055 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6057 * pread.c: Include stdio.h.
6059 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6061 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6064 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6066 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6067 Change read_shndx type to unsigned int.
6068 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6070 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6071 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6072 Change read_shndx type to unsigned int.
6073 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6075 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6076 * layout.cc (Layout::create_symtab_sections): Cast the result of
6077 local_symcount * symsize to off_t in the gold_assert.
6079 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6081 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6082 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6084 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6085 (Arm_relocate_functions::thm_abs5): New function.
6086 (Arm_relocate_functions::abs12): New function.
6087 (Arm_relocate_functions::abs16): New function.
6088 (Arm_relocate_functions::base_abs): New function.
6089 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6090 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6091 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6093 (Scan::global): Likewise.
6094 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6095 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6096 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6097 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6100 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6102 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6103 (Arm_relocate_functions::movt_prel): New function.
6104 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6105 (Arm_relocate_functions::thm_movt_prel): New function.
6106 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6107 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6108 (Scan::global, Relocate::relocate): Likewise.
6109 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6111 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6113 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6114 Incremental_checker.
6115 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6117 (class Incremental_inputs_header): New class.
6118 (Incremental_inputs_header_writer): Edit comment.
6119 (Incremental_inputs_entry): New class.
6120 (Incremental_inputs_entry_writer): Edit comment.
6121 (Sized_incremental_binary::do_find_incremental_inputs_section):
6122 Add *strtab_shndx parameter, fill it.
6123 (Sized_incremental_binary::do_check_inputs): New method.
6124 (Incremental_checker::can_incrementally_link_output_file): Use
6125 Sized_incremental_binary::check_inputs.
6126 (Incremental_inputs::report_command_line): Save command line in
6129 (Incremental_binary::find_incremental_inputs_section): New
6131 (Incremental_binary::do_find_incremental_inputs_section): Add
6132 strtab_shndx parameter.
6133 (Incremental_binary::do_check_inputs): New pure virtual method.
6134 (Sized_incremental_binary::do_check_inputs): Declare.
6135 (Incremental_checker::Incremental_checker): Add incremental_inputs
6136 parameter, use it to initialize incremental_inputs_.
6137 (Incremental_checker::incremental_inputs_): New field.
6138 (Incremental_checker::command_line): New method.
6139 (Incremental_checker::inputs): New method.
6140 (Incremental_checker::command_line_): New field.
6142 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6144 * incremental.cc: Include <cstdarg> and "target-select.h".
6145 (vexplain_no_incremental): New function.
6146 (explain_no_incremental): New function.
6147 (Incremental_binary::error): New method.
6148 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6150 (make_sized_incremental_binary): New function.
6151 (open_incremental_binary): New function.
6152 (can_incrementally_link_file): Add checks if output is ELF and has
6154 * incremental.h: Include "elfcpp_file.h" and "output.h".
6155 (Incremental_binary): New class.
6156 (Sized_incremental_binary): New class.
6157 (open_incremental_binary): Declare.
6158 * object.cc (is_elf_object): Use
6159 elfcpp::Elf_recognizer::is_elf_file.
6160 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6161 * output.h (Output_file::filesize): New method.
6163 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6165 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6167 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6168 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6170 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6172 (Arm_relocate_functions::movw_abs_nc): New function.
6173 (Arm_relocate_functions::movt_abs): New function.
6174 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6175 (Arm_relocate_functions::thm_movt_abs): New function.
6176 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6177 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6178 (Scan::global): Likewise.
6179 (Relocate::relocate): Likewise.
6180 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6182 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6184 * arm.cc (Arm_relocate_functions::got_prel) New function.
6185 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6186 (Relocate::relocate): Likewise.
6187 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6189 2009-10-06 Ian Lance Taylor <iant@google.com>
6191 * options.h (class General_options): Define
6192 split_stack_adjust_size parameter.
6193 * object.h (class Object): Add uses_split_stack_ and
6194 has_no_split_stack_ fields. Add uses_split_stack and
6195 has_no_split_stack accessor functions. Declare
6196 handle_split_stack_section.
6197 (class Reloc_symbol_changes): Define.
6198 (class Sized_relobj): Define Function_offsets. Declare
6199 split_stack_adjust, split_stack_adjust_reltype, and
6201 * object.cc (Object::handle_split_stack_section): New function.
6202 (Sized_relobj::do_layout): Call handle_split_stack_section.
6203 * dynobj.cc (Sized_dynobj::do_layout): Call
6204 handle_split_stack_section.
6205 * reloc.cc (Sized_relobj::relocate_sections): Call
6206 split_stack_adjust for executable sections in split_stack
6207 objects. Pass reloc_map to relocate_section.
6208 (Sized_relobj::split_stack_adjust): New function.
6209 (Sized_relobj::split_stack_adjust_reltype): New function.
6210 (Sized_relobj::find_functions): New function.
6211 * target-reloc.h: Include "object.h".
6212 (relocate_section): Add reloc_symbol_changes parameter. Change
6214 * target.h (class Target): Add calls_non_split method. Declare
6215 do_calls_non_split virtual method. Declare match_view and
6217 * target.cc: Include "elfcpp.h".
6218 (Target::do_calls_non_split): New function.
6219 (Target::match_view): New function.
6220 (Target::set_view_to_nop): New function.
6221 * gold.cc (queue_middle_tasks): Give an error if mixing
6222 split-stack and non-split-stack objects with -r.
6223 * i386.cc (Target_i386::relocate_section): Add
6224 reloc_symbol_changes parameter.
6225 (Target_i386::do_calls_non_split): New function.
6226 * x86_64.cc (Target_x86_64::relocate_section): Add
6227 reloc_symbol_changes parameter.
6228 (Target_x86_64::do_calls_non_split): New function.
6229 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6231 * powerpc.cc (Target_powerpc::relocate_section): Add
6232 reloc_symbol_changes parameter.
6233 * sparc.cc (Target_sparc::relocate_section): Add
6234 reloc_symbol_changes parameter.
6235 * configure.ac: Call AM_CONDITIONAL for the default target.
6236 * configure: Rebuild.
6237 * testsuite/Makefile.am (TEST_AS): New variable.
6238 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6239 (check_DATA): Add split_i386 and split_x86_64 files.
6240 (SPLIT_DEFSYMS): Define.
6241 (split_i386_[1234n].o): New targets.
6242 (split_i386_[124]): New targets.
6243 (split_i386_[1234r].stdout): New targets.
6244 (split_x86_64_[1234n].o): New targets.
6245 (split_x86_64_[124]): New targets.
6246 (split_x86_64_[1234r].stdout): New targets.
6247 (MOSTLYCLEANFILES): Add new executables.
6248 * testsuite/split_i386.sh: New file.
6249 * testsuite/split_x86_64.sh: New file.
6250 * testsuite/split_i386_1.s: New file.
6251 * testsuite/split_i386_2.s: New file.
6252 * testsuite/split_i386_3.s: New file.
6253 * testsuite/split_i386_4.s: New file.
6254 * testsuite/split_i386_n.s: New file.
6255 * testsuite/split_x86_64_1.s: New file.
6256 * testsuite/split_x86_64_2.s: New file.
6257 * testsuite/split_x86_64_3.s: New file.
6258 * testsuite/split_x86_64_4.s: New file.
6259 * testsuite/split_x86_64_n.s: New file.
6260 * testsuite/testfile.cc (Target_test): Update relocation_section
6262 * testsuite/Makefile.in: Rebuild.
6264 2009-10-06 Ian Lance Taylor <iant@google.com>
6266 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6267 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6268 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6269 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6270 the address on ldo_addrs_.
6271 (Target_i386::Relocate::fix_up_ldo): New function.
6273 2009-10-06 Rafael Espindola <espindola@google.com>
6275 * plugin.cc (add_input_library): New.
6276 (Plugin::load): Add add_input_library to tv.
6277 (Plugin_manager::add_input_file): Add the is_lib argument.
6278 (add_input_file): Update call to Plugin_manager::add_input_file.
6279 (add_input_library): New.
6280 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6282 2009-09-30 Doug Kwan <dougkwan@google.com>
6284 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6285 symbol and call Symbol::may_need_copy_reloc to determine if
6286 a copy reloc is needed.
6287 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6288 nocopyreloc is given in command line.
6289 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6290 given in command line.
6291 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6292 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6293 of the removed Target_i386::may_need_copy_reloc.
6294 * options.h (copyreloc): New option with default value false.
6295 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6296 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6297 instead of the removed Target_powerpc::may_need_copy_reloc.
6298 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6299 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6300 instead of the removed Target_sparc::may_need_copy_reloc.
6301 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6302 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6303 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6304 instead of the removed Target_x86_64::may_need_copy_reloc.
6306 2009-09-30 Ian Lance Taylor <iant@google.com>
6308 * object.h (class Object): Remove target_ field, and target,
6309 sized_target, and set_target methods.
6310 (Object::sized_target): Remove.
6311 (class Sized_relobj): Update declarations. Remove sized_target.
6312 * object.cc (Sized_relobj::setup): Remove target parameter.
6314 (Input_objects::add_object): Don't do anything with the target.
6315 (make_elf_sized_object): Add punconfigured parameter. Change all
6316 callers. Set or test parameter target.
6317 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6319 * parameters.cc (Parameters::set_target): Change parameter type to
6321 (Parameters::default_target): Remove.
6322 (set_parameters_target): Change parameter type to be non-const.
6323 (parameters_force_valid_target): New function.
6324 (parameters_clear_target): New function.
6325 * parameters.h (class Parameters): Update declarations. Remove
6326 default_target method. Add sized_target and clear_target
6327 methods. Change target_ to be non-const.
6328 (set_parameters_target): Update declaration.
6329 (parameters_force_valid_target): Declare.
6330 (parameters_clear_target): Declare.
6331 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6332 as NULL if we aren't searching.
6333 (Add_symbols::run): Don't check for compatible target.
6334 * fileread.cc (Input_file::open_binary): Call
6335 parameters_force_valid_target.
6336 * gold.cc (queue_middle_tasks): Likewise.
6337 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6338 set_target on object.
6339 * dynobj.h (class Sized_dynobj): Update declarations.
6340 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6341 make_elf_object returns NULL.
6342 (Archive::include_member): Don't check whether object target is
6344 * output.cc (Output_section::add_input_section): Get target from
6346 (Output_section::relax_input_section): Likewise.
6347 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6349 (Sized_relobj::do_scan_relocs): Likewise.
6350 (Sized_relobj::relocate_sections): Likewise.
6351 * resolve.cc (Symbol_table::resolve): Likewise.
6352 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6353 parameter. Change all callers.
6354 (Symbol_table::add_from_object): Get target from parameters.
6355 (Symbol_table::add_from_relobj): Don't check object target.
6356 (Symbol_table::add_from_dynobj): Likewise.
6357 (Symbol_table::define_special_symbol): Get target from
6359 * symtab.h (class Symbol_table): Update declaration.
6360 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6361 parameter. Change all callers. Clear parameter target.
6362 (Binary_test): Test target here.
6363 * testsuite/object_unittest.cc (gold_testsuite): Remove
6364 target_test_pointer parameter. Change all callers.
6365 (Object_test): Test target here.
6367 2009-09-26 Ian Lance Taylor <iant@google.com>
6369 * testsuite/initpri1.c: Don't try to use constructor priorities if
6370 compiling with gcc before 4.3.
6372 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6374 * testsuite/retain_symbols_file_test.sh (check_present): Change
6375 output file name to retain_symbols_file_test.stdout.
6376 (check_absent): Likewise.
6378 2009-09-18 Craig Silverstein <csilvers@google.com>
6380 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6381 * options.cc: Include <cerrno> and <fstream>.
6382 (General_options::finalize): Parse -retain-symbols-file tag.
6383 * options.h: New flag.
6384 (General_options): New method should_retain_symbol, new
6385 variable symbols_to_retain.
6386 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6387 should_retain_symbol map.
6388 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6389 * testsuite/Makefile.in: Regenerate.
6390 * testsuite/retain_symbols_file_test.sh: New file.
6392 2009-09-18 Nick Clifton <nickc@redhat.com>
6394 * po/es.po: Updated Spanish translation.
6396 2009-09-17 Doug Kwan <dougkwan@google.com>
6398 * debug.h (DEBUG_RELAXATION): New constant.
6399 (DEBUG_ALL): Add DEBUG_RELAXATION.
6400 (debug_string_to_enum): Add relaxation debug option.
6402 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6403 Layout::Relaxation_debug_check::read_sections,
6404 Layout::Relaxation_debug_check::read_sections): New method definitions.
6405 (Layout::Layout): Initialize data members
6406 record_output_section_data_from_scrips_,
6407 script_output_section_data_list_ and relaxation_debug_check_.
6408 (Layout::save_segments, Layout::restore_segments,
6409 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6410 Layout::relaxation_loop_body): New method definitions.
6411 (Layout::finalize): Support relaxation. Move section layout code to
6412 Layout::relaxation_loop_body.
6413 (Layout::set_asection_address_from_script): Move code for orphan
6414 section placement out.
6415 (Layout::place_orphan_sections_in_script): New method definition.
6416 * layout.h (Output_segment_headers, Output_file_header):
6417 New forward class declarations.
6418 (Layout::~Layout): Define.
6419 (Layout::new_output_section_data_from_script): New method definition.
6420 (Layout::place_orphan_sections_in_script): New method declaration.
6421 (Layout::Segment_states): New type declaration.
6422 (Layout::save_segments, Layout::restore_segments,
6423 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6424 Layout::relaxation_loop_body): New method declarations.
6425 (Layout::Output_section_data_list): New type declaration.
6426 (Layout::Relaxation_debug_check): New class definition.
6427 (Layout::record_output_section_data_from_script_,
6428 Layout::script_output_section_data_list_, Layout::segment_states_,
6429 Layout::relaxation_debug_check_): New data members.
6430 * output.cc: (Output_section_headers::do_size): New method definition.
6431 (Output_section_headers::Output_section_headers): Move size
6432 computation to Output_section_headers::do_size.
6433 (Output_segment_headers::do_size): New method definition.
6434 (Output_file_header::Output_file_header): Move size computation to
6435 Output_file_header::do_size and call it.
6436 (Output_file_header::do_size): New method definition.
6437 (Output_data_group::Output_data_group): Adjust call to
6438 Output_section_data.
6439 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6440 (Output_symtab_xindex::do_write): Add array bound check.
6441 (Output_section::Input_section::print_to_mapfile): Handle
6442 RELAXED_INPUT_SECTION_CODE.
6443 (Output_section::Output_section): Initialize data member checkpoint_.
6444 (Output_section::~Output_section): Delete checkpoint object pointed
6446 (Output_section::add_input_section): Always add an Input_section if
6448 (Output_section::add_merge_input_section): Add assert.
6449 (Output_section::relax_input_section): New method definition.
6450 (Output_section::set_final_data_size): Set load address to zero for
6451 an unallocated section.
6452 (Output_section::do_address_and_file_offset_have_reset_values):
6453 New method definition.
6454 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6455 Handle relaxed input section.
6456 (Output_section::sort_attached_input_sections): Checkpoint input
6457 section list lazily.
6458 (Output_section::get_input_sections): Change type of input_sections to
6459 list of Simple_input_section pointers. Checkpoint input section list
6460 lazily. Also handle relaxed input sections.
6461 (Output_section::add_input_section_for_script): Take a reference to
6462 a Simple_input_section object instead of Relobj pointer and section
6463 index as parameter. Handle relaxed input sections.
6464 (Output_section::save_states, Output_section::restore_states): New
6466 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6467 (Output_data::is_data_size_fixed): New method definition.
6468 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6470 (Output_data::address_and_file_offset_have_reset_values): New method
6472 (Output_data::do_address_and_file_offset_have_reset_values): New method
6474 (Output_data::set_data_size): Check that data size is not fixed.
6475 (Output_data::fix_data_size): New method definition.
6476 (Output_data::is_data_size_fixed_): New data member.
6477 (Output_section_headers::set_final_data_size): New method definition.
6478 (Output_section_headers::do_size): New method declaration.
6479 (Output_segment_headers::set_final_data_size): New method definition.
6480 (Output_segment_headers::do_size): New method declaration.
6481 (Output_file_header::set_final_data_size)::New method definition.
6482 (Output_file_header::do_size)::New method declaration.
6483 (Output_section_data::Output_section_data): Add new parameter
6484 is_data_size_fixed and use it to fix data size.
6485 (Output_data_const::Output_data_const): Adjust call to base class
6486 constructor and fix data size.
6487 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6488 base class constructor and fix data size.
6489 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6490 base class constructor and fix data size.
6491 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6492 class constructor and fix data size.
6493 (Output_data_group::set_final_data_size): New method definition.
6494 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6495 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6496 class constructor and fix data size.
6497 (Output_relaxed_input_section): New class definition.
6498 (Output_section::Simple_input_section): New class definition.
6499 (Output_section::get_input_sections): Adjust parameter list.
6500 (Output_section::add_input_section_for_script): Same.
6501 (Output_section::save_states, Output_section::restore_states,
6502 Output_section::do_address_and_file_offset_have_reset_values,
6503 (Output_section::Input_section::Input_section): Handle
6504 RELAXED_INPUT_SECTION_CODE. Add new overload for
6505 Output_relaxed_input_section.
6506 (Output_section::Input_section::is_input_section,
6507 Output_section::Input_section::set_output_section): Handle relaxed
6509 (Output_section::Input_section::is_relaxed_input_section,
6510 Output_section::Input_section::output_section_data,
6511 Output_section::Input_section::relaxed_input_section): New method
6513 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6515 (Output_section::Input_section::u1_): Update comments.
6516 (Output_section::Input_section::u2_): Add new union member poris.
6517 (Output_section::Checkpoint_output_section): New classs definition.
6518 (Output_section::relax_input_section): New method declaration.
6519 (Output_section::checkpoint_): New data member.
6520 (Output_segment): Update comments.
6521 (Output_segment::Output_segment): Un-privatize copy constructor.
6522 (Output_segment::operator=): Un-privatize.
6523 * script-sections.cc (Output_section_element::Input_section_list):
6524 Change element type to Output_section::Simple_input_section.
6525 (Output_section_element_dot_assignment::set_section_addresses):
6526 Register output section data for relaxation clean up.
6527 (Output_data_exression::Output_data_expression): Adjust call to base
6528 constructor to fix data size.
6529 (Output_section_element_data::set_section_addresses): Register
6530 Output_data_expression object for relaxation clean up.
6531 (struct Input_section_info): Replace Relobj pointer and section index
6532 pair with Output_section::Simple_input_section and Convert struct to a
6534 (Input_section_sorter::operator()): Adjust access to
6535 Input_section_info data member to use accessors.
6536 (Output_section_element_input::set_section_addresses): Use layout
6537 parameter. Adjust code to use Output_section::Simple_input_section
6538 and Input_secction_info classes. Register filler for relaxation
6540 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6541 and section index pair with Output_section::Simple_input_section
6542 class. Adjust code accordingly.
6543 (Phdrs_element::release_segment): New method definition.
6544 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6546 (Script_sections::release_segments): New method definition.
6547 * gold/script-sections.h (Script_sections::release_segments): New
6549 * gold/target.h (Target::may_relax, Target::relax,
6550 Target::do_may_relax, Target::do_relax): New method definitions.
6552 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6554 * arm.cc (has_signed_unsigned_overflow): New function.
6555 (Arm_relocate_functions::abs8): New function.
6556 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6557 (Target_arm::Scan::global): Likewise.
6558 (Target_arm::relocate::relocate): Likewise.
6559 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6562 2009-09-16 Cary Coutant <ccoutant@google.com>
6564 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6565 * testsuite/Makefile.in: Regenerate.
6567 2009-09-11 Nick Clifton <nickc@redhat.com>
6569 * po/gold.pot: Updated by the Translation project.
6571 2009-09-08 Cary Coutant <ccoutant@google.com>
6573 * output.cc (Output_file::open): Add execute permission to empty file.
6574 * testsuite/Makefile.am (permission_test): New test.
6575 * testsuite/Makefile.in: Regenerate.
6577 2009-09-02 Ian Lance Taylor <iant@google.com>
6579 * output.cc (Output_file::resize): Call map_no_anonymous rather
6582 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
6584 * gold.cc: Include "incremental.h".
6585 (queue_initial_tasks): Call Incremental_checker methods.
6586 * incremental.cc: Include "output.h".
6587 (Incremental_checker::can_incrementally_link_output_file): New
6589 * incremental.h (Incremental_checker): New class.
6591 * output.cc (Output_file::open_for_modification): New method.
6592 (Output_file::map_anonymous): Changed return type to bool. Record
6594 (Output_file::map_no_anonymous): New method, broken out of map.
6595 (Output_file::map): Use map_no_anonymous and map_anonymous.
6596 * output.h (class Output_file): Update declarations.
6598 2009-08-24 Cary Coutant <ccoutant@google.com>
6600 * options.h (Command_line::Pre_options): New class.
6601 (Command_line::pre_options): New member.
6602 * options.cc (gold::options::ready_to_register): New variable.
6603 (One_option::register_option): Do nothing if not registering options.
6604 Assert if same short option registered twice.
6605 (General_options::General_options): Turn off option registration when
6607 (Command_line::Pre_options::Pre_options): New constructor.
6609 2009-08-24 Cary Coutant <ccoutant@google.com>
6611 * options.h (General_options::no_keep_memory): Remove incorrect
6614 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6616 * Makefile.am (am__skiplex, am__skipyacc): New.
6617 * Makefile.in: Regenerate.
6619 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6621 * Makefile.am (AM_CPPFLAGS): Renamed from ...
6622 (INCLUDES): ... this.
6623 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6624 (AM_CPPFLAGS): Renamed from ...
6625 (INCLUDE): ... this.
6626 * Makefile.in, testsuite/Makefile.in: Regenerate.
6628 * Makefile.in: Regenerate.
6629 * aclocal.m4: Likewise.
6630 * config.in: Likewise.
6631 * configure: Likewise.
6632 * testsuite/Makefile.in: Likewise.
6634 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6635 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6636 * Makefile.in: Regenerate.
6637 * testsuite/Makefile.in: Regenerate.
6639 2009-08-19 Cary Coutant <ccoutant@google.com>
6641 * resolve.cc (Symbol_table::resolve): Don't complain about defined
6642 symbols in shared libraries overridden by hidden or internal symbols
6643 in the main program.
6645 2009-08-19 Chris Demetriou <cgd@google.com>
6647 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6648 checking source file names in error messages.
6650 2009-08-18 Doug Kwan <dougkwan@google.com>
6652 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6653 an elcpp::Ehdr as parameter. Adjust call to set_target.
6654 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6655 an elfcpp::Ehdr as parameter.
6656 * object.cc (Object::set_target): Remove the version that looks up
6657 a target and sets it.
6658 (Sized_relobj::setup): Take a Target object instead of
6659 an elfcpp::Ehdr as parameter. Adjust call to set_target.
6660 (make_elf_sized_object): Find target and ask target to
6662 * object.h: (Object::set_target): Remove the version that looks up
6663 a target and sets it.
6664 (Sized_relobj::setup): Take a Target object instead of
6665 an elfcpp:Ehdr as parameter.
6666 * target.cc: Include dynobj.h.
6667 (Target::do_make_elf_object_implementation): New.
6668 (Target::do_make_elf_object): New.
6669 * target.h (Target::make_elf_object): New template declaration.
6670 (Target::do_make_elf_object): New method declarations.
6671 (Target::do_make_elf_object_implementation): New template declaration.
6673 2009-08-14 Ian Lance Taylor <iant@google.com>
6675 * gold.h (FUNCTION_NAME): Define.
6676 (gold_unreachable): Use FUNCTION_NAME.
6678 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6680 * icf.cc (Icf::find_identical_sections): Issue a warning when a
6681 symbol in the --keep-unique list is not found.
6683 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6685 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6686 been maked as --keep-unique.
6687 (Icf::unfold_section): New function.
6688 * icf.h (Icf::unfold_section): New function.
6689 * options.h (General_options::keep_unique): New option.
6690 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6691 * testsuite/Makefile.in: Regenerate.
6692 * testsuite/icf_keep_unique_test.sh: New file.
6693 * testsuite/icf_keep_unique_test.cc: New file.
6695 2009-08-12 Cary Coutant <ccoutant@google.com>
6698 * resolve.cc (Symbol_table::resolve): Check for references from
6699 dynamic objects to hidden and internal symbols.
6700 * testsuite/Makefile.am (hidden_test.sh): New test.
6701 * testsuite/Makefile.in: Regenerate.
6702 * testsuite/hidden_test.sh: New script.
6703 * testsuite/hidden_test_1.c: New test source.
6704 * testsuite/hidden_test_main.c: New test source.
6706 2009-08-11 Doug Kwan <dougkwan@google.com>
6708 * arm.cc: Update comments.
6709 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6710 segment to locate the .ARM.exidx section if present.
6712 2009-08-09 Doug Kwan <dougkwan@google.com>
6714 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6717 2009-08-07 Sriraman Tallam <tmsriram@google.com>
6718 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6721 2009-08-06 Sriraman Tallam <tmsriram@google.com>
6723 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6724 valid tls_segment only for non-debug-section relocations.
6725 * testsuite/Makefile.am: Add gc_tls_test.
6726 * testsuite/Makefile.in: Regenerate.
6727 * testsuite/gc_tls_test.cc: New file.
6728 * testsuite/gc_tls_test.sh: New file.
6730 2009-08-05 Sriraman Tallam <tmsriram@google.com>
6734 * Makefile.am (CCFILES): Add icf.cc.
6736 * Makefile.in: Regenerate.
6737 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6738 * gc.h (gc_process_relocs): Populate lists used by icf to contain
6739 section, symbol and addend information for the relocs.
6740 * gold.cc (queue_middle_tasks): Call identical code folding.
6741 * gold.h: Add defines for multimap.
6742 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6743 to the call of finalize_local_symbols.
6744 * main.cc (main): Create object of class Icf.
6745 * object.cc (Sized_relobj::do_layout): Allow this function to be
6746 called twice during icf.
6747 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6748 to sections marked as identical by icf.
6749 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6751 (Sized_relobj::do_section_entsize): New function.
6752 * object.h (Object::section_entsize): New function.
6753 (Object::do_section_entsize): New pure virtual function.
6754 (Relobj::finalize_local_symbols): Add new parameter.
6755 (Relobj::do_section_entsize): New function.
6756 * options.h (General_options::icf): New option.
6757 (General_options::icf_iterations): New option.
6758 (General_options::print_icf_sections): New option.
6759 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6760 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6761 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6763 * symtab.cc (Symbol_table::is_section_folded): New function.
6764 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6765 to sections marked as identical by icf.
6766 * symtab.h (Symbol_table::set_icf): New function.
6767 (Symbol_table::icf): New function.
6768 (Symbol_table::is_section_folded): New function.
6769 (Symbol_table::icf_): New data member.
6770 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6771 * testsuite/Makefile.am: Add commands to build icf_test.
6772 * testsuite/Makefile.in: Regenerate.
6773 * testsuite/icf_test.sh: New file.
6774 * testsuite/icf_test.cc: New file.
6776 2009-07-24 Chris Demetriou <cgd@google.com>
6778 * layout.cc (is_compressible_debug_section): Fix incorrect
6779 comment about compressed section names.
6781 2009-07-20 Ian Lance Taylor <ian@airs.com>
6784 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6786 2009-07-16 Ian Lance Taylor <iant@google.com>
6789 * layout.h: #include <map>.
6790 (class Kept_section): Change from struct to class. Add accessors
6791 and setters. Add section size to Comdat_group mapping. Change
6792 Comdat_group to std::map. Add is_comdat_ field. Add
6793 linkonce_size field in union.
6794 (class Layout): Update declaration of find_or_add_kept_section.
6795 Don't declare find_kept_object.
6796 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6797 parameter. Add object, shndx, is_comdat, and is_group_name
6798 parameters. Change all callers. Adjust for new Kept_section.
6799 (Layout::find_kept_object): Remove.
6800 * object.cc (Sized_relobj::include_section_group): Update use of
6801 Kept_section. Rename secnum to shndx. Only record
6802 Kept_comdat_section if sections are the same size.
6803 (Sized_relobj::include_linkonce_section): Update use of
6804 Kept_section. Only record Kept_comdat_section if sections are the
6805 same size. Set size of linkonce section.
6806 (Sized_relobj::map_to_kept_section): Update call to
6807 get_kept_comdat_section.
6808 * object.h (class Sized_relobj): Rename fields in
6809 Kept_comdat_section to drop trailing underscores; change object
6810 field to Relobj*. Change Kept_comdat_section_table to store
6811 struct rather than pointer.
6812 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6813 Add kept_object and kept_shndx parameters. Change all callers.
6814 (Sized_relobj::get_kept_comdat_section): Change return type to
6815 bool. Add kept_object and kept_shndx parameters. Change all
6817 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6818 Layout::find_or_add_kept_section.
6820 2009-07-09 Ian Lance Taylor <iant@google.com>
6822 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6823 Reserve space in the hash table.
6825 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
6827 * fileread.cc (File_read::get_mtime): New method.
6828 * fileread.h (Timespec): New structure.
6829 (File_read::get_mtime): New method.
6830 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6831 Renamed from timestamp_nsec.
6832 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6834 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6836 (Incremental_inputs::report_archive): Save mtime; style fix.
6837 (Incremental_inputs::report_obejct): Save mtime; style fix.
6838 (Incremental_inputs::report_script): Save mtime; style fix.
6839 (Incremental_inputs::finalize_inputs): Style fix.
6840 (Incremental_inputs::finalize): Style fix.
6841 (Incremental_inputs::create_input_section_data): Store inputs
6843 * incremental.h (Incremental_inputs::report_script): Add mtime
6845 (Incremental_inputs::Input_info::Input_info): Intialize only one
6847 (Incremental_inputs::Input_info::archive): Move to nameless
6849 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6850 (Incremental_inputs::Input_info::script): Move to nameless union.
6851 (Incremental_inputs::mtime): New field.
6852 * script.cc (read_input_script): Pass file mtime to
6854 * script.h (Script_info::inputs): Style fix.
6856 2009-07-01 Ian Lance Taylor <ian@airs.com>
6858 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6861 2009-06-24 Ian Lance Taylor <iant@google.com>
6864 * layout.cc (Layout::choose_output_section): If we find an
6865 existing section, update the flags.
6866 (Layout::create_notes): New function, broken out of
6868 (Layout::finalize): Don't create note sections.
6869 (Layout::create_note): Don't crash if linker script discards
6871 (Layout::create_gold_note): Likewise.
6872 (Layout::create_build_id): Likewise. Don't set
6873 after_input_sections on the section.
6874 (Layout::create_executable_stack_info): Remove target parameter.
6876 * layout.h (class Layout): Declare create_notes. Update
6877 declaration of create_executable_stack_info.
6878 * gold.cc (queue_middle_tasks): Call create_notes.
6879 * output.cc (Output_section::update_flags_for_input_section): Move
6880 here from output.h. If SHF_ALLOC flag is newly set, mark address
6882 * output.h (Output_data::mark_address_invalid): New function.
6883 (class Output_section): Only declare, not define,
6884 update_flags_for_input_section. Remove set_flags.
6886 2009-06-24 Ian Lance Taylor <iant@google.com>
6888 * script-sections.cc (Output_section_definition::
6889 set_section_addresses): Rename shadowing local load_address to
6892 2009-06-24 Ian Lance Taylor <iant@google.com>
6895 * reloc.cc (relocate_sections): Skip empty relocation sections.
6897 2009-06-23 Ian Lance Taylor <iant@google.com>
6900 * layout.cc (Layout::create_note): Use choose_output_section
6901 rather than make_output_section.
6903 2009-06-23 Ian Lance Taylor <iant@google.com>
6906 * options.cc (General_options::parse_V): Set printed_version_.
6907 (General_options::General_options): Initialize printed_version_.
6908 * options.h (class General_options): Add printed_version_ field.
6909 * gold.cc (queue_initial_tasks): If there are no input files,
6910 don't give a fatal error if we printed the version information.
6911 (queue_middle_tasks): If using -r with a shared object, give a
6912 fatal error rather than an ordinary error.
6914 2009-06-23 Ian Lance Taylor <iant@google.com>
6917 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6918 (Layout::make_output_section): Set have_stabstr_section_ if we see
6919 a .stab*str section.
6920 (Layout::finalize): Call link_stabs_sections.
6921 (Layout::link_stabs_sections): New file.
6922 * layout.h (class Layout): Add have_stabstr_section_ field.
6923 Declare link_stabs_sections.
6925 2009-06-23 Doug Kwan <dougkwan@google.com>
6927 * Makefile.am (libgold_a_LIBADD): New.
6928 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6929 * Makefile.in: Regenerate.
6930 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6931 * configure: Regenerate.
6932 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6933 * fileread.cc: Include sys/state.h
6934 * gold.h: Declare memmem and strndup if found missing.
6935 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6937 2009-06-23 Ian Lance Taylor <iant@google.com>
6939 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6940 * configure: Rebuild.
6942 2009-06-23 Ian Lance Taylor <iant@google.com>
6945 * object.cc (Object::section_contents): Don't try to get a view if
6946 the section has length zero.
6947 (Object::handle_gnu_warning_section): If the section is empty, use
6948 the name of the section as the warning.
6950 2009-06-23 Ian Lance Taylor <iant@google.com>
6953 * stringpool.h (class Stringpool_template): Add optimize_ field.
6954 (Stringpool_template::set_optimize): New function.
6955 * stringpool.cc (Stringpool_template::Stringpool_template):
6956 Initialize optimize_ field.
6957 (Stringpool_template::set_string_offsets): Test local optimize
6958 fild rather than parameter.
6959 * layout.cc (Layout::Layout): Call set_optimize on the section
6962 2009-06-22 Ian Lance Taylor <iant@google.com>
6965 * yyscript.y: Parse TARGET.
6966 * script.cc (script_set_target): New function.
6967 * script-c.h (script_set_target): Declare.
6968 * options.cc (General_options::string_to_object_format): Rename
6969 from string_to_object_format in anonymous namespace. Change
6971 * options.h (class General_options): Declare
6972 string_to_object_format.
6974 2009-06-22 Ian Lance Taylor <iant@google.com>
6976 * script-sections.cc (Script_sections::create_segments): Don't put
6977 program headers in a PT_LOAD segment if -n or -N.
6979 2009-06-22 Ian Lance Taylor <iant@google.com>
6982 * options.h (class General_options): Add -z lazy and -z now. Sort
6983 -z options into alphabetical order.
6984 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6986 2009-06-21 Ian Lance Taylor <iant@google.com>
6988 * layout.cc (Layout::make_output_section): Call
6989 Target::new_output_section.
6990 (Layout::attach_allocated_section_to_segment): Put large section
6991 sections in a separate load segment with the large segment flag
6993 (Layout::segment_precedes): Sort large data segments after other
6995 (align_file_offset): New static function.
6996 (Layout::set_segment_offsets): Use align_file_offset.
6997 * output.h (class Output_section): Add is_small_section_ and
6998 is_large_section_ fields.
6999 (Output_section::is_small_section): New function.
7000 (Output_section::set_is_small_section): New function.
7001 (Output_section::is_large_section): New function.
7002 (Output_section::set_is_large_section): New function.
7003 (Output_section::is_large_data_section): New function.
7004 (class Output_segment): Add is_large_data_segment_ field.
7005 (Output_segment::is_large_data_segment): New function.
7006 (Output_segment::set_is_large_data_segment): New function.
7007 * output.cc (Output_section::Output_section): Initialize new
7009 (Output_segment::Output_segment): Likewise.
7010 (Output_segment::add_output_section): Add assertion that large
7011 data sections always go in large data segments. Force small data
7012 sections to the end of the list of data sections. Force small BSS
7013 sections to the start of the list of BSS sections. For large BSS
7014 sections to the end of the list of BSS sections.
7015 * symtab.h (class Symbol): Declare is_common_shndx.
7016 (Symbol::is_defined): Check Symbol::is_common_shndx.
7017 (Symbol::is_common): Likewise.
7018 (class Symbol_table): Define enum Commons_section_type. Update
7019 declarations. Add small_commons_ and large_commons_ fields.
7020 * symtab.cc (Symbol::is_common_shndx): New function.
7021 (Symbol_table::Symbol_table): Initialize new fields.
7022 (Symbol_table::add_from_object): Put small and large common
7023 symbols in the right list.
7024 (Symbol_table::sized_finalized_symbol): Check
7025 Symbol::is_common_shndx.
7026 (Symbol_table::sized_write_globals): Likewise.
7027 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7028 common symbol lists. Don't call do_allocate_commons_list if the
7030 (Symbol_table::do_allocate_commons_list): Remove is_tls
7031 parameter. Add comons_section_type parameter. Change all
7032 callers. Handle small and large common symbols.
7033 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7034 Symbol::is_common_shndx.
7035 * resolve.cc (symbol_to_bits): Likewise.
7036 * target.h (Target::small_common_shndx): New function.
7037 (Target::small_common_section_flags): New function.
7038 (Target::large_common_shndx): New function.
7039 (Target::large_common_section_flags): New function.
7040 (Target::new_output_section): New function.
7041 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7042 small_common_section_flags, and large_common_section_flags
7044 (Target::do_new_output_section): New virtual function.
7045 * arm.cc (Target_arm::arm_info): Initialize new fields.
7046 * i386.cc (Target_i386::i386_info): Likewise.
7047 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7049 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7050 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7051 (Target_x86_64::do_new_output_section): New function.
7052 * configure.ac: Define conditional MCMODEL_MEDIUM.
7053 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7054 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7055 (large_LDFLAGS): Define.
7056 * testsuite/large.c: New file.
7057 * testsuite/testfile.cc (Target_test::test_target_info):
7058 Initialize new fields.
7059 * configure, testsuite/Makefile.in: Rebuild.
7061 2009-06-05 Doug Kwan <dougkwan@google.com>
7063 * Makefile.am (CCFILES): Add target.cc.
7064 * Makefile.in: Regenerate.
7065 * i386.cc (class Target_i386): Define new virtual method to
7066 override do_is_local_label_name in parent.
7067 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7068 local symbols if --discard-locals or -X is given.
7069 * options.h (class General_options): Declare new options
7070 '--discard-locals' and '-X' for discarding locals.
7071 * target.h (class Target): Define new methods is_local_label_name.
7072 Declare new virtual method do_is_local_label_name.
7073 * target.cc: New file.
7074 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7075 (check_SCRIPTS): Add discard_locals_test.sh.
7076 (check_DATA): Add discard_local_tests.syms.
7077 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7078 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7079 * testsuite/Makefile.in: Regenerate.
7080 * testsuite/discard_locals_test.c: New file.
7081 * testsuite/discard_locals_test.sh: Same.
7083 2009-06-05 Doug Kwan <dougkwan@google.com>
7085 * object.cc (Sized_relobj::Sized_relobj): Initialize
7086 discarded_eh_frame_shndx_ to -1U.
7087 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7089 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7090 a discarded .eh_frame section.
7091 (Sized_relobj::do_finalize_local_symbols): Ditto.
7092 * object.h (class Sized_relobj): Declare new member
7093 discarded_eh_frame_shndx_.
7094 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7095 (local_labels_test.o, local_labels_test): New rules.
7096 * testsuite/Makefile.in: Regenerate.
7098 2009-06-04 Doug Kwan <dougkwan@google.com>
7100 * layout.cc (Layout::section_name_mapping): Add mapping for
7101 special ARM sections.
7103 2009-06-03 Doug Kwan <dougkwan@google.com>
7105 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7106 (utils::has_overflow): Same.
7108 2009-06-03 Ian Lance Taylor <iant@google.com>
7110 * layout.cc (Layout::section_name_mapping): New array, replacing
7111 Layout::linkonce_mapping.
7112 (Layout::section_name_mapping_count): New variable, replacing
7113 Layout::linkonce_mapping_count.
7114 (Layout::linkonce_output_name): Remove.
7115 (Layout::output_section_name): Rewrite.
7116 * layout.h (class Layout): Rename Linkonce_mapping to
7117 Section_name_mapping, linkonce_mapping to section_name_mapping,
7118 linkonce_mapping_count to section_name_mapping_count. Don't
7119 declare linkonce_output_name.
7121 2009-06-03 Doug Kwan <dougkwan@google.com>
7123 * gold/arm.cc (namespace utils): New.
7124 (Target_arm::reloc_is_non_pic): Define new method.
7125 (class Arm_relocate_functions): New.
7126 (Target_arm::Relocate::relocate): Handle relocation types used by
7129 2009-06-03 Ian Lance Taylor <iant@google.com>
7131 * arm.cc (Target_arm::scan::global): Use || instead of |.
7133 2009-06-02 Doug Kwan <dougkwan@google.com>
7135 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7136 issued_non_pic_error_.
7137 (class Target_arm::Scan): Declare new method check_non_pic.
7138 Define new method symbol_needs_plt_entry.
7139 Declare new data member issued_non_pic_error_.
7140 (class Target_arm::Relocate): Declare new method
7141 should_apply_static_reloc.
7142 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7143 (Target_arm::Scan::check_non_pic): Define new method.
7144 (Target_arm::Scan::local): Handle a small subset of reloc types used
7146 (Target_arm::Scan::local): Same.
7147 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7149 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7151 * incremental.cc (Incremental_inputs::report_command_line): Filter
7152 out --incremental-* options.
7154 2009-05-29 Doug Kwan <dougkwan@google.com>
7156 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7158 (class Target_arm): Update comment.
7159 (Target_arm::Target_arm): Initialize new data members GOT_,
7160 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7161 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7162 and Target_arm::rel_dyn_section.
7163 Declare new_enum Target_arm::Got_type.
7164 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7166 Update commments for member do_dynsym_value.
7167 (Target_arm::got_size, Target_arm::plt_section,
7168 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7169 new methods inside class defintion.
7170 (Target_arm::got_section): Define new method.
7171 (Target_arm::rel_dyn_section): Same.
7172 (Output_data_plt_arm): New template class.
7173 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7174 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7175 (Output_data_plt_arm::add_entry): Same.
7176 (Output_data_plt_arm::first_plt_entry): Define new
7177 static data member for PLT instruction template.
7178 (Output_data_plt_arm::plt_entry): Same.
7179 (Output_data_plt_arm::do_write): Define new method.
7180 (Target_arm::make_plt_entry): Same.
7181 (Target_arm::do_finalize_sections): Same.
7182 (Target_arm::do_dynsym_value): Same.
7184 2009-05-28 Doug Kwan <dougkwan@google.com>
7186 * Makefile.am (TARGETSOURCES): Add arm.cc.
7187 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7188 * Makefile.in: Regenerate.
7190 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7192 2009-05-26 Doug Kwan <dougkwan@google.com>
7194 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7195 (General_options::check_excluded_libs): Strip off directories in
7196 archive name before matching like GNU ld does.
7197 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7198 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7199 (exclude_libs_test_LDFLAGS): Add linker option
7200 -Wl,--exclude-libs,libexclude_libs_test_3
7201 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7202 an explicit archive without using -l.
7203 (alt/libexclude_libs_test_3.a): New make rule.
7204 * testsuite/Makefile.in: Regenerate.
7205 * testsuite/exclude_libs_test.c : Declare lib3_default().
7207 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7208 * exclude_libs_test_3.c: New file.
7210 2009-05-26 Nick Clifton <nickc@redhat.com>
7212 * po/id.po: New Indonesian translation.
7213 * po/gold.pot: Updated template file.
7215 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7217 * testsuite/Makefile.am: Add -ffunction-sections to compile
7218 gc_comdat_test files. Add -Wl,--gc-sections to build
7220 * testsuite/Makefile.in: Regenerate.
7221 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7223 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7225 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7226 kept comdat section was garbage collected.
7227 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7228 * testsuite/Makefile.in: Regenerate.
7229 * testsuite/gc_comdat_test.sh: New file.
7230 * testsuite/gc_comdat_test_1.cc: New file.
7231 * testsuite/gc_comdat_test_2.cc: New file.
7233 2009-05-19 Doug Kwan <dougkwan@google.com>
7235 * archive.cc (Archive::Archive): Move constructor from archive.h
7236 to here. Initialize no_export_.
7237 (Archive::get_elf_object_for_member): Set no_export flag of object.
7238 * archive.h (Archive::Archive): Move constructor body to
7240 (Archive::no_export): New method.
7241 (Archive::no_export_): New field.
7242 * object.h (Object::Object): Initialize no_export_ to false.
7243 (Object::no_export, Object::set_no_export): New methods.
7244 (Object::no_export_): New field.
7245 * options.cc (General_options::parse_exclude_libs): New method.
7246 (General_options::check_excluded_libs) Same.
7247 * options.h (exclude_libs): New option.
7248 (General_options::check_excluded_libs): New method declaration.
7249 (General_options::excluded_libs_): New field.
7250 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7251 default or protected visibility if an object has no-export flag set.
7252 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7253 (check_SCRIPTS): Add exclude_libs_test.sh.
7254 (check_DATA): Add exclude_libs_test.syms.
7255 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7256 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7257 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7258 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7259 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7260 libexclude_libs_test_2.a): New rules.
7261 * testsuite/Makefile.in: Regenerate.
7262 * testsuite/exclude_libs_test.c: New file.
7263 * testsuite/exclude_libs_test.sh: Ditto.
7264 * testsuite/exclude_libs_test_1.c: Ditto.
7265 * testsuite/exclude_libs_test_2.c: Ditto.
7267 2009-05-15 Ian Lance Taylor <iant@google.com>
7269 * configure.ac: Check for declarations for cases where libiberty.h
7270 checks HAVE_DECL_xxx.
7271 * configure, config.in: Rebuild.
7273 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7275 * gold.h (Incremental_argument_list): Remove (invalid) forward
7277 * incremental.cc (Incremental_inputs::report_achive): New method.
7278 (Incremental_inputs::report_object): New method.
7279 (Incremental_inputs::report_script): New method.
7280 (Incremental_inputs::finalize_inputs): New method.
7281 (Incremental_inputs::finalize): Call finalize_inputs().
7282 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7283 Create inputs entries.
7284 * incremental.h (Incremental_input_type): New enum.
7285 (Incremental_inputs::Incremental_input): Initialize new fields.
7286 (Incremental_inputs::report_inputs): New method.
7287 (Incremental_inputs::report_achive): New method.
7288 (Incremental_inputs::report_object): New method.
7289 (Incremental_inputs::report_script): New method.
7290 (Incremental_inputs::finalize_inputs): New method.
7291 (Incremental_inputs::Input_info): New struct.
7292 (Incremental_inputs::Input_info_map): New typedef.
7293 (Incremental_inputs::lock_): New field.
7294 (Incremental_inputs::Inputs_): New field.
7295 (Incremental_inputs::Inputs_map): New field.
7296 * main.cc (main): Call Incremental_input::report_inputs.
7297 * options.h (Input_argument_list): Typedef moved from
7299 (Input_file_group::Files): Remove, use ::Input_argument_list.
7300 (Input_file_group::Input_argument_list): Remove, use
7301 ::Input_argument_list.
7302 * plugin.cc (Plugin_manager::add_input_file): Add error in
7304 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7306 * script.cc (read_input_script): Call
7307 Incremental_input::report_script.
7308 * script.h (Script_info): New class.
7310 2009-04-27 Ian Lance Taylor <iant@google.com>
7312 * x86_64.cc (do_adjust_output_section): Set entsize to
7315 2009-04-23 Elliott Hughes <enh@google.com>
7317 * output.cc (Output_file::close): After short writes, continue
7318 writing from the correct offset in the buffer being written.
7320 2009-04-23 Chris Demetriou <cgd@google.com>
7322 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7323 * configure: Regenerate.
7324 * config.in: Regenerate.
7325 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7326 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7328 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7330 * incremental.cc (Incremental_inputs_header_data): Renamed from
7331 Incremental_input_header_data.
7332 (Incremental_inputs_header_data::data_size): New field.
7333 (Incremental_inputs_header_data::put_input_file_count): Renamed
7334 from input_file_count.
7335 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7336 from command_line_offset.
7337 (Incremental_inputs_header_data::put_reserved): Renamed from
7339 (Incremental_inputs_entry_data): Renamed from
7340 Incremental_input_entry_data.
7341 (Incremental_inputs_entry_data::data_size): New field.
7342 (Incremental_inputs::report_command_line): New method.
7343 (Incremental_inputs::finalize): New method.
7344 (Incremental_inputs::create_incremental_inputs_data): New method.
7345 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7346 * incremental.h: New file.
7347 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7348 (Layout::finalize): Create incremental inputs section in
7350 (Layout::create_incremental_info_sections): New method.
7351 * layout.h (Layout::incremental_inputs): New method.
7352 (Layout::create_incremental_info_sections): New method.
7353 (Layout::incremental_inputs_): New field.
7354 * main.cc (main): Notify Incremental_input of the command line.
7356 2009-04-01 Ian Lance Taylor <iant@google.com>
7357 Mikolaj Zalewski <mikolajz@google.com>
7359 * gold.h (reserve_unordered_map): Define, three versions, one for
7360 each version of Unordered_map.
7361 * layout.cc (Layout::Layout): Remove options parameter. Add
7362 number_of_input_files parameter. Don't initialize options_.
7363 Initialize number_of_input_files_ and resized_signatures_. Move
7364 sections_are_attached_.
7365 (Layout::layout_group): Reserve space for group_signatures_.
7366 (Layout::find_or_add_kept_section): Change name parameter to be a
7367 reference. Resize signatures_ map when it gets large enough.
7368 (Layout::layout_eh_frame): Use parameters->options() instead of
7370 (Layout::make_output_section): Likewise.
7371 (Layout::attach_allocated_section_to_segment): Likewise.
7372 (Layout::finalize, Layout::create_executable_stack): Likewise.
7373 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7374 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7375 * layout.h (class Layout): Update declarations. Remove options_
7376 field. Add number_of_input_files_ and resized_signatures_
7377 fields. Move sections_are_attached_ field.
7378 * main.cc (main): Pass number of input files to Layout
7379 constructor. Don't pass options.
7381 2009-03-30 Ian Lance Taylor <iant@google.com>
7383 * ffsll.c (ffsll): Correct implementation.
7385 2009-03-27 Ian Lance Taylor <iant@google.com>
7387 * ffsll.c: New file.
7388 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7389 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7390 * ftruncate.c (ftruncate): Declare before definition.
7391 * mremap.c (mremap): Likewise.
7392 * pread.c (pread): Likewise.
7393 * configure, Makefile.in, config.in: Rebuild.
7395 * mremap.c: New file.
7396 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7397 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7398 (mremap): Declare if HAVE_MREMAP is not defined.
7399 * configure, Makefile.in, config.in: Rebuild.
7401 2009-03-27 Cary Coutant <ccoutant@google.com>
7403 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7404 position independent.
7405 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7406 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7408 2009-03-24 Cary Coutant <ccoutant@google.com>
7410 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7412 (needs_dynamic_reloc): Likewise.
7414 2009-03-24 Ian Lance Taylor <iant@google.com>
7416 * yyscript.y (file_cmd): Recognize EXTERN.
7417 (extern_name_list, extern_name_list_body): New nonterminals.
7418 * script.cc (script_add_extern): Define.
7419 * script-c.h (script_add_extern): Declare.
7421 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
7423 * object.cc (is_elf_object): Define.
7424 * object.h (is_elf_object): Declare.
7425 * archive.cc (Archive::get_elf_object_for_member): Call
7427 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7429 2009-03-24 Elliott Hughes <enh@google.com>
7431 * output.cc (Output_file::map_anonymous): Define.
7432 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7433 try an anonymous one. Report the size if the mmap fails.
7434 * output.h (class Output_file): Declare map_anonymous.
7436 2009-03-24 Ian Lance Taylor <iant@google.com>
7438 * target-select.cc (instantiate_target): Don't acquire the lock if
7439 the instantiated_target_ field has already been set.
7441 2009-03-23 Ian Lance Taylor <iant@google.com>
7443 * gold-threads.h (class Initialize_lock): Define.
7444 * gold-threads.cc (class Initialize_lock_once): Define.
7445 (initialize_lock_control): New static variable.
7446 (initialize_lock_pointer): New static variable.
7447 (initialize_lock_once): New static function.
7448 (Initialize_lock::Initialize_lock): Define.
7449 (Initialize_lock::initialize): Define.
7450 * target-select.h: Include "gold-threads.h".
7451 (class Target_selector): Add lock_ and initialize_lock_ fields.
7452 Don't define instantiate_target, just declare it.
7453 * target-select.cc (Target_selector::Target_selector): Initialize
7455 (Target_selector::instantiate_target): Define.
7456 * descriptors.h: Include "gold-threads.h".
7457 (class Descriptors): Add initialize_lock_ field.
7458 * descriptors.cc (Descriptors::Descriptors): Initialize new
7460 (Descriptors::open): Use initialize_lock_ field
7461 * errors.h (class Errors): Add initialize_lock_ field.
7462 * errors.cc (Errors::Errors): Initialize new field.
7463 (Errors::initialize_lock): Use initialize_lock_ field.
7464 * powerpc.cc (class Target_selector_powerpc): Remove
7465 instantiated_target_ field. In do_recognize call
7466 instantiate_target rather than do_instantiate_target. In
7467 do_instantiate_target just allocate a new target.
7468 * sparc.cc (class Target_selector_sparc): Likewise.
7470 * freebsd.h: New file.
7471 * i386.cc: Include "freebsd.h".
7472 (Target_i386): Derive from Target_freebsd rather than
7474 (Target_selector_i386): Derive from Target_selector_freebsd rather
7475 than Target_selector.
7476 * x86_64.cc: Include "freebsd.h".
7477 (Target_x86_64): Derive from Target_freebsd rather than
7479 (Target_selector_x86_64): Derive from Target_selector_freebsd
7480 rather than Target_selector.
7481 * target.h (class Target): Add adjust_elf_header and
7482 do_adjust_elf_header.
7483 * output.cc (Output_file_header:: do_sized_write): Call target
7484 adjust_elf_header routine.
7485 * configure.tgt: Set targ_osabi.
7486 * configure.ac: Define GOLD_DEFAULT_OSABI.
7487 * parameters.cc (Parameters::default_target): Pass
7488 GOLD_DEFAULT_OSABI to select_target.
7489 * target-select.h (class Target_selector): Make instantiate_target
7490 protected rather than private.
7491 * Makefile.am (HFILES): Add freebsd.h.
7492 * configure, Makefile.in, config.in: Rebuild.
7494 * merge.cc (do_add_input_section): Correct pend value. Change
7495 message about last entry not being null terminated from error to
7498 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7500 * incremental.cc: New file.
7501 * Makefile.am (CCFILES): Add incremental.cc.
7502 * Makefile.in: Rebuild.
7504 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7506 * layout.cc (Layout::output_section_name): Preserve names
7507 of '.note.' sections.
7509 2009-03-19 Ian Lance Taylor <iant@google.com>
7511 * descriptors.cc (Descriptors::open): Check that the options are
7512 valid before using them.
7514 2009-03-18 Ian Lance Taylor <iant@google.com>
7516 * script-sections.h: Include <list>.
7517 (class Script_sections): Change Sections_elements from std::vector
7518 to std::list. Typedef public Elements_iterator. Add
7519 orphan_section_placement_, data_segment_align_start_, and
7520 saw_data_segment_align_ fields. Remove data_segment_align_index_
7522 * script-sections.cc (class Orphan_section_placement): New class.
7523 (class Sections_element): Add virtual functions is_relro and
7524 orphan_section_init. Remove virtual function place_orphan_here.
7525 (class Output_section_definition): Add is_relro and
7526 orphan_section_init. Remove place_orphan_here.
7527 (class Orphan_output_section): Likewise.
7528 (Script_sections::Script_sections): Update for field changes.
7529 (Script_sections::data_segment_align): Set saw_data_segment_align_
7530 and data_segment_align_start_, not data_segment_align_index.
7531 (Script_sections::data_segment_relro_end): Check
7532 saw_data_segment_align_. Use data_segment_align_start_ rather
7533 than data_segment_align_index_.
7534 (Script_sections::place_orphan): Rewrite to use
7535 Orphan_section_placement.
7537 2009-03-17 Ian Lance Taylor <iant@google.com>
7539 * archive.cc (Archive::add_symbols): Check for a version attached
7540 to the symbol name in the archive map.
7541 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7542 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7543 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7544 (ver_test_11.a): New target.
7545 * testsuite/Makefile.in: Rebuild.
7547 * configure.ac: Check for chsize and posix_fallocate. Replace
7549 * ftruncate.c: New file, from gnulib.
7550 * output.cc (posix_fallocate): Define dummy version if not
7551 HAVE_POSIX_FALLOCATE.
7552 (Output_file::map): Call posix_fallocate rather than lseek and
7554 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7555 * configure, Makefile.in, config.in: Rebuild.
7557 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
7559 * layout.h (Layout::create_note): Add section_name parameter.
7560 * layout.cc (Layout::create_note): Likewise.
7561 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7563 2009-03-17 Ian Lance Taylor <iant@google.com>
7565 * descriptors.cc: Include "options.h".
7566 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7567 (Descriptors::open): Always use O_CLOEXEC when opening a new
7568 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7569 then set FD_CLOEXEC.
7571 * sparc.cc (class Target_sparc): Add has_got_section.
7572 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7573 make sure we have a GOT section.
7575 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7576 (Target_sparc::Scan::local): Likewise.
7577 (Target_sparc::Scan::global): Likewise.
7578 (Target_sparc::Relocate::relocate): Likewise.
7579 (Target_sparc::Relocate::relocate_tls): Likewise.
7581 * symtab.cc (Symbol_table::define_default_version): New function,
7582 broken out of add_from_object.
7583 (Symbol_table::add_from_object): Call define_default_version.
7584 (Symbol_table::define_special_symbol): Add resolve_oldsym
7585 parameter. Change all callers. If the version for a symbol comes
7586 from a version script, resolve it with the symbol with the same
7587 name with no version. Also add the symbol without a version if
7589 (do_define_in_output_data): If resolving with oldsym, don't delete
7591 (do_define_in_output_segment): Likewise.
7592 (do_define_as_constant): Likewise.
7593 * symtab.h (class Symbol_table): Update declarations.
7595 2009-03-13 Ian Lance Taylor <iant@google.com>
7597 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7598 (Read_symbols::requeue): New function.
7599 (Read_symbols::do_read_symbols): If make_elf_object fails because
7600 the target type is not configured, and the file was searched for,
7601 issue a warning and retry with the next directory.
7602 (Add_symbols::run): If the file has an incompatible format, and
7603 it was searched for, requeue the Read_symbols task. On error,
7605 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
7606 dirindex parameter to constructor. Change all callers. Declare
7607 incompatible_warning and requeue.
7608 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7609 input_argument_ and input_group_ fields. Add them to
7610 constructor. Change all callers.
7611 (class Read_script): Add dirindex_ field. Add it to constructor.
7613 * archive.cc (Archive::setup): Remove input_objects parameter.
7615 (Archive::get_file_and_offset): Likewise.
7616 (Archive::read_all_symbols): Likewise.
7617 (Archive::read_symbols): Likewise.
7618 (Archive::get_elf_object_for_member): Remove input_objects
7619 parameter. Add punconfigured parameter. Change all callers.
7620 (Archive::add_symbols): Change return type to bool. Check return
7621 value of include_member.
7622 (Archive::include_all_members): Likewise.
7623 (Archive::include_member): Change return type to bool. Return
7624 false if first included object has incompatible target. Set
7625 included_member_ field.
7626 (Add_archive_symbols::run): If add_symbols returns false, requeue
7628 * archive.h (class Archive): Add included_member_ field.
7629 Initialize it in constructor. Add input_file and searched_for
7630 methods. Update declarations.
7631 (class Add_archive_symbols): Add dirpath_, dirindex_, and
7632 input_argument_ fields. Add them to constructor. Change all
7634 * script.cc: Include "target-select.h".
7635 (class Parser_closure): Add skip_on_incompatible_target_ and
7636 found_incompatible_target_ fields. Add
7637 skip_on_incompatible_target parameter to constructor. Change all
7638 callers. Add methods skip_on_incompatible_target,
7639 clear_skip_on_incompatible_target, found_incompatible_target, and
7640 set_found_incompatible_target.
7641 (read_input_script): Add dirindex parameter. Change all callers.
7642 If parser finds an incompatible target, requeue Read_symbols
7644 (script_set_symbol): Clear skip_on_incompatible_target in
7646 (script_add_assertion, script_parse_option): Likewise.
7647 (script_start_sections, script_add_phdr): Likewise.
7648 (script_check_output_format): New function.
7649 * script.h (read_input_script): Update declaration.
7650 * script-c.h (script_check_output_format): Declare.
7651 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7652 (ignore_cmd): Remove OUTPUT_FORMAT.
7653 * fileread.cc (Input_file::Input_file): Add explicit this.
7654 (Input_file::will_search_for): New function.
7655 (Input_file::open): Add pindex parameter. Change all callers.
7656 * fileread.h (class Input_file): Add input_file_argument method.
7657 Declare will_search_for. Update declarations.
7658 * object.cc (make_elf_object): Add punconfigured parameter.
7660 * object.h (class Object): Make input_file public. Add
7661 searched_for method.
7662 (make_elf_object): Update declaration.
7663 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
7665 * dirsearch.h (class Dirsearch): Update declaration.
7666 * options.h (class General_options): Add --warn-search-mismatch.
7667 * parameters.cc (Parameters::is_compatible_target): New function.
7668 * parameters.h (class Parameters): Declare is_compatible_target.
7669 * workqueue.cc (Workqueue::add_blocker): New function.
7670 * workqueue.h (class Workqueue): Declare add_blocker.
7672 * fileread.cc (Input_file::open): Remove options parameter.
7674 (Input_file::open_binary): Likewise.
7675 * script.cc (read_input_script): Likewise.
7676 * readsyms.h (class Read_symbols): Remove options_ field. Remove
7677 options parameter from constructor. Change all callers.
7678 (class Read_script): Likewise.
7679 * fileread.h (class Input_file): Update declarations.
7680 * script.h (read_input_script): Update declaration.
7682 2009-03-10 Nick Clifton <nickc@redhat.com>
7684 * po/es.po: New Spanish translation.
7686 2009-03-06 Cary Coutant <ccoutant@google.com>
7688 * options.cc (parse_short_option): Keep dash_z from registering itself.
7690 2009-03-03 Ian Lance Taylor <iant@google.com>
7693 * target-reloc.h (relocate_section): Pass output_section to
7695 * i386.cc (Target_i386::should_apply_static_reloc): Add
7696 output_section parameter. Change all callers.
7697 (Target_i386::Relocate::relocate): Add output_section parameter.
7698 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7699 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7700 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7701 * testsuite/two_file_shared.sh: New script.
7702 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7703 (check_DATA): Add two_file_shared.dbg.
7704 (two_file_shared.dbg): New target.
7705 * testsuite/Makefile.in: Rebuild.
7707 2009-03-01 Ian Lance Taylor <iant@google.com>
7709 * configure.ac: Check for byteswap.h.
7710 * configure: Rebuild.
7711 * config.in: Rebuild.
7713 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
7715 * layout.cc (Layout::find_or_add_kept_section): New function.
7716 (Layout::add_comdat): Removed.
7717 * layout.h (struct Kept_section): Move out of class Layout.
7718 Remove trailing underscores from field names. Add group_sections
7719 field. Rename group_ field to is_group. Change all uses.
7720 (class Layout): Declare find_or_add_kept_section, not add_comdat.
7721 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7722 comdat_groups_ field.
7723 (Sized_relobj::include_section_group): Use
7724 find_or_add_kept_section and Kept_section::group_sections.
7725 (Sized_relobj::include_linkonce_section): Likewise.
7726 * object.cc (class Sized_relobj): Don't define Comdat_group or
7727 Comdat_group_table. Remove find_comdat_group and
7728 add_comdat_group. Remove comdat_groups_ field.
7729 * plugin.cc (include_comdat_group): Use
7730 Layout::find_or_add_kept_section.
7732 2009-02-28 Ian Lance Taylor <iant@google.com>
7734 * README: --gc-sections and map files are now supported. Document
7735 some build requirements.
7738 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7739 relocatable link set the value of the section symbol to zero.
7740 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7741 relocatable link don't include the section address in the local
7744 2009-02-27 Ian Lance Taylor <iant@google.com>
7747 * options.h (class Search_directory): Add is_system_directory.
7748 (class General_options): Declare is_in_system_directory.
7749 * options.cc (get_relative_sysroot): Make static.
7750 (get_default_sysroot): Make static.
7751 (General_optoins::is_in_system_directory): New function.
7752 * fileread.cc (Input_file::is_in_system_directory): New function.
7753 * fileread.h (class Input_file): Declare is_in_system_directory.
7754 * object.h (class Object): Add is_in_system_directory.
7755 (class Input_objects): Remove system_library_directory_ field.
7756 * object.cc (Input_objects::add_object): Don't set
7757 system_library_directory_.
7758 (input_objects::found_in_system_library_directory): Remove.
7759 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7760 parameter. Change all callers.
7761 (Symbol_table::sized_write_globals): Likewise.
7762 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7763 Call Object::is_in_system_directory.
7764 * symtab.h (class Symbol_table): Update declarations.
7767 * descriptors.h (Open_descriptor): Add is_on_stack field.
7768 * descriptors.cc (Descriptors::open): If the descriptor is on the
7769 top of the stack, remove it. Initialize is_on_stack field.
7770 (Descriptors::release): Only add pod to stack if it is not on the
7772 (Descriptors::close_some_descriptor): Clear stack_next and
7776 * output.cc (Output_section::find_starting_output_address): Rename
7777 from starting_output_address; add PADDR parameter; change return
7779 * output.h (class Output_section): Declare
7780 find_starting_output_address instead of starting_output_address.
7781 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7782 section symbol for which we can't find a merge section.
7785 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7786 hidden or internal, force the symbol to be local.
7787 * resolve.cc (Symbol::override_visibility): Define.
7788 (Symbol::override_base): Use override_visibility.
7789 (Symbol_table::resolve): Likewise.
7790 (Symbol::override_base_with_special): Likewise.
7791 (Symbol_table::override_with_special): If the visibility is hidden
7792 or internal, force the symbol to be local.
7793 * symtab.h (class Symbol): Add set_visibility and
7794 override_visibility.
7795 * testsuite/ver_test_1.sh: New file.
7796 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7797 (check_DATA): Add ver_test_1.syms.
7798 (ver_test_1.syms): New target.
7799 * testsuite/Makefile.in: Rebuild.
7801 2009-02-25 Cary Coutant <ccoutant@google.com>
7803 * layout.cc (Layout::choose_output_section): Don't rename sections
7804 when using a linker script that has a SECTIONS clause.
7805 * Makefile.in: Regenerate.
7807 * testsuite/Makefile.am (script_test_5.sh): New test case.
7808 * testsuite/Makefile.in: Regenerate.
7809 * testsuite/script_test_5.cc: New file.
7810 * testsuite/script_test_5.sh: New file.
7811 * testsuite/script_test_5.t: New file.
7813 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
7815 * archive.cc (Archive::include_member): Update calls to add_symbols.
7816 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7817 the Layout argument.
7818 * dynobj.h (do_add_symbols): Add the Layout argument.
7819 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7821 * object.h (Object::add_symbols): Add the Layout argument.
7822 (Object::do_add_symbols): Add the Layout argument.
7823 (Sized_relobj::do_add_symbols): Add the Layout argument.
7824 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7825 Unify the two versions.
7826 (Add_plugin_symbols): Remove.
7827 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7828 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7829 (Add_plugin_symbols): Remove.
7830 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7831 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7832 (Add_symbols::run): Make it work with Pulginobj.
7834 2009-02-06 Ian Lance Taylor <iant@google.com>
7836 * object.cc (Sized_relobj::do_layout): Make info message start
7837 with lower case letter.
7839 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
7841 * binary.cc: Fix file comment.
7843 * options.h (enum Incremental_disposition): Define.
7844 (class General_options): Add new options: --incremental,
7845 --incremental_changed, --incremental_unchanged,
7846 --incremental_unknown. Add incremental_disposition_ and
7847 implicit_incremental_ fields.
7848 (General_options::incremental_disposition): New function.
7849 (class Position_dependent_options): Add incremental_disposition
7851 (Position_dependent_options::copy_from_options): Set incremental
7853 * options.cc (General_options::parse_incremental_changed): New
7855 (General_options::parse_incremental_unchanged): New function.
7856 (General_options::parse_incremental_unknown): New function.
7857 (General_options::General_options): Initialize new fields
7858 incremental_disposition_ and implicit_incremental_.
7859 (General_options::finalize): Check for uasge of --incremental-*
7860 without --incremental.
7862 2009-02-06 Chris Demetriou <cgd@google.com>
7864 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7865 pointer and to report location as the file name associated with
7867 (gold_undefined_symbol_at_location): New function to replace the
7868 old gold_undefined_symbol functionality.
7869 * target-reloc.h (relocate_section): Update to use
7870 gold_undefined_symbol_at_location.
7871 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7872 Call gold_undefined_symbol function rather than gold_error.
7873 * errors.h (Errors::undefined_symbol): Take location as a
7874 string, rather than calculating it from a relocation.
7875 * errors.cc (Errors::fatal): Print "fatal error:" before the
7877 (Errors::error, Errors::error_at_location): Print "error: "
7878 before the formatted message.
7879 (Errors::undefined_symbol): Take location as a string, rather
7880 than calculating it from a relocation.
7881 (gold_undefined_symbol_at_location): New function akin to
7882 old gold_undefined_symbol, calculates location from relocation.
7883 (gold_undefined_symbol): Change to take only a Symbol pointer
7884 and to report location as the file name associated with the symbol.
7885 * testsuite/debug_msg.sh: Update for changed error messages.
7886 * testsuite/undef_symbol.sh: Likewise.
7888 2009-02-04 Duncan Sands <baldrick@free.fr>
7891 * reduced_debug_output.h
7892 (Output_reduced_debug_abbrev_section::failed): Use format for
7894 (Output_reduced_debug_info_section::faild): Likewise.
7896 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
7898 * script.cc (Lazy_demangler): New class.
7899 (Version_script_info::get_symbol_version_helper): Demangle a
7902 2009-01-29 Cary Coutant <ccoutant@google.com>
7904 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7906 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7908 2009-01-28 Ian Lance Taylor <iant@google.com>
7910 * version.cc (version_string): Bump to 1.9.
7912 * gold.h: Include <cstring> and <stdint.h>.
7913 * version.cc: Include <cstdio>.
7914 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7916 * reduced_debug_output.cc (insert_into_vector): Rename from
7917 Insert_into_vector; change all callers. Use Swap_unaligned to
7918 avoid aliasing issue; remove union since it is unnecessary.
7920 2009-01-27 Sriraman Tallam <tmsriram@google.com>
7922 * Makefile.am (CCFILES): Add gc.cc.
7924 * Makefile.in: Regenerate.
7925 * gold.cc (Gc_runner): New class.
7926 (queue_initial_tasks): Call garbage collection related tasks
7927 when corresponding options are invoked.
7928 (queue_middle_gc_tasks): New function.
7929 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7930 processed early before laying out sections during garbage collection.
7931 * gold.h (queue_middle_gc_tasks): New function.
7932 (is_prefix_of): Move from "layout.cc".
7933 * i386.cc (Target_i386::gc_process_relocs): New function.
7934 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7935 * main.cc (main): Create object of class "Garbage_collection".
7936 * object.cc (Relobj::copy_symbols_data): New function.
7937 (Relobj::is_section_name_included): New function.
7938 (Sized_relobj::do_layout): Allow this function to be called twice
7939 during garbage collection and defer layout of section during the
7941 * object.h (Relobj::get_symbols_data): New function.
7942 (Relobj::is_section_name_included): New function.
7943 (Relobj::copy_symbols_data): New function.
7944 (Relobj::set_symbols_data): New function.
7945 (Relobj::get_relocs_data): New function.
7946 (Relobj::set_relocs_data): New function.
7947 (Relobj::is_output_section_offset_invalid): New pure virtual function.
7948 (Relobj::gc_process_relocs): New function.
7949 (Relobj::do_gc_process_relocs): New pure virtual function.
7950 (Relobj::sd_): New data member.
7951 (Sized_relobj::is_output_section_offset_invalid): New function.
7952 (Sized_relobj::do_gc_process_relocs): New function.
7953 * options.h (General_options::gc_sections): Modify to not be a no-op.
7954 (General_options::print_gc_sections): New option.
7955 * plugin.cc (Plugin_finish::run): Remove function call to
7956 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7957 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7958 * reloc.cc (Read_relocs::run): Add task to process relocs and
7959 determine unreferenced sections when doing garbage collection.
7960 (Gc_process_relocs): New class.
7961 (Sized_relobj::do_gc_process_relocs): New function.
7962 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7963 sections that are garbage collected.
7964 * reloc.h (Gc_process_relocs): New class.
7965 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7966 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7967 symbols whose corresponding sections are garbage collected.
7968 (Symbol_table::Symbol_table): Add new parameter for the garbage
7970 (Symbol_table::gc_mark_undef_symbols): New function.
7971 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7972 (Symbol_table::gc_mark_dyn_syms): New function.
7973 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7975 (Symbol_table::add_from_object): Likewise.
7976 (Symbol_table::add_from_relobj): When building shared objects, do not
7977 treat externally visible symbols as garbage.
7978 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7979 table information for static and relocatable links.
7980 * symtab.h (Symbol_table::set_gc): New function.
7981 (Symbol_table::gc): New function.
7982 (Symbol_table::gc_mark_undef_symbols): New function.
7983 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7984 (Symbol_table::gc_mark_dyn_syms): New function.
7985 (Symbol_table::gc_): New data member.
7986 * target.h (Sized_target::gc_process_relocs): New pure virtual
7988 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7989 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7991 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7993 * options.h (General_options::gc_sections): Define as a no-op for now.
7994 (General_options::no_keep_memory): Ditto.
7995 (General_options::Bshareable): Define.
7996 * options.cc (General_options::finalize): Honor -Bshareable.
7998 2009-01-20 Andreas Schwab <schwab@suse.de>
8000 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8001 read the value in the contents, since we don't use it. Use the
8002 template endianness when writing.
8003 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8005 2009-01-19 Andreas Schwab <schwab@suse.de>
8007 * configure.tgt (powerpc64-*): Fix targ_obj.
8009 2009-01-15 Ian Lance Taylor <iant@google.com>
8011 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8012 local symbols when stripping all symbols.
8014 2009-01-14 Cary Coutant <ccoutant@google.com>
8016 * output.cc (Output_reloc): Add explicit instantiations.
8018 2009-01-14 Cary Coutant <ccoutant@google.com>
8020 * archive.cc (Archive::get_elf_object_for_member): Remove call
8021 to File_read::claim_for_plugin.
8022 * descriptors.cc (Descriptors::open): Remove reference to
8024 (Descriptors::claim_for_plugin): Remove.
8025 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8026 (Descriptors::is_claimed): Remove.
8027 (claim_descriptor_for_plugin): Remove.
8028 * fileread.cc (File_read::claim_for_plugin): Remove.
8029 * fileread.h (File_read::claim_for_plugin): Remove.
8030 (File_read::descriptor): Reopen descriptor if necessary.
8031 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8032 (Plugin_manager::all_symbols_read): Add task parameter. Change
8034 (Plugin_manager::get_input_file): New function.
8035 (Plugin_manager::release_input_file): New function.
8036 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8037 corresponding data member.
8038 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8039 and pass to base constructor. Change all callers.
8040 (get_input_file, release_input_file): New functions.
8041 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8042 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8043 (Plugin_manager::all_symbols_read): Add task parameter.
8044 (Plugin_manager::get_input_file): New function.
8045 (Plugin_manager::release_input_file): New function.
8046 (Plugin_manager::task_): New data member.
8047 (Pluginobj::Pluginobj): Add filesize parameter.
8048 (Pluginobj::filename): New function.
8049 (Pluginobj::descriptor): New function.
8050 (Pluginobj::filesize): New function.
8051 (Pluginobj::filesize_): New data member.
8052 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8053 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8054 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8056 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8057 with archive libraries.
8058 * testsuite/Makefile.in: Regenerate.
8059 * testsuite/plugin_test.c (struct sym_info): New type.
8060 (get_input_file, release_input_file): New static variables.
8061 (onload): Capture new transfer vector entries.
8062 (claim_file_hook): Stop reading at end of file according to filesize.
8063 Factor out parsing of readelf output into separate function.
8064 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8065 APIs and get the source file name from the symbol table. Convert
8066 source file name to corresponding object file name. Print info
8067 message when adding new input files.
8068 (parse_readelf_line): New function.
8069 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8070 * testsuite/plugin_test_2.sh: Likewise.
8071 * testsuite/plugin_test_3.sh: Likewise.
8072 * testsuite/plugin_test_4.sh: New test case.
8074 2009-01-07 Ian Lance Taylor <iant@google.com>
8076 * version.cc (version_string): Bump to 1.8.
8078 2008-12-23 Cary Coutant <ccoutant@google.com>
8080 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8081 * plugin.cc (Plugin_manager::finish): Rename as
8082 layout_deferred_objects. Move cleanup to separate function.
8083 (Plugin_manager::cleanup): New function.
8084 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8086 * plugin.h (Plugin_manager::finish): Rename as
8087 layout_deferred_objects.
8088 (Plugin_manager::cleanup): New function.
8089 (Plugin_manager::cleanup_done): New field.
8091 2008-12-23 Cary Coutant <ccoutant@google.com>
8093 * plugin.cc (is_visible_from_outside): New function.
8094 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8095 so we don't return "IR only" status for exported symbols or -r links.
8097 * testsuite/Makefile.am (plugin_test_3): New test case.
8098 * testsuite/Makefile.in: Regenerate.
8099 * testsuite/plugin_test_3.sh: New file.
8101 2008-12-22 Cary Coutant <ccoutant@google.com>
8103 * object.cc (Sized_relobj::layout_section): New function.
8104 (Sized_relobj::do_layout): Defer layout of input sections until after
8105 plugin has provided replacement files.
8106 (Sized_relobj::do_layout_deferred_sections): New function.
8107 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8108 (Relobj::layout_deferred_sections): New function.
8109 (Relobj::do_layout_deferred_sections): New function.
8110 (Sized_relobj::do_layout_deferred_sections): New function.
8111 (Sized_relobj::layout_section): New function.
8112 (Sized_relobj::Deferred_layout): New structure.
8113 (Sized_relobj::deferred_layout_): New field.
8114 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8115 Change all callers. Layout deferred sections.
8116 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8118 (Plugin_hook::run): Move code from do_plugin_hook inline.
8119 (Plugin_hook::do_plugin_hook): Remove.
8120 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8121 (Plugin_manager::finish): Renamed, was cleanup.
8122 (Plugin_manager::should_defer_layout): New function.
8123 (Plugin_manager::add_deferred_layout_object): New function.
8124 (Plugin_manager::Deferred_layout_list): New type.
8125 (Plugin_manager::deferred_layout_objects_): New field.
8126 (Plugin_hook::do_plugin_hook): Remove.
8128 2008-12-17 Ian Lance Taylor <iant@google.com>
8130 * options.h (class General_options): Add --no case for
8133 2008-12-16 Cary Coutant <ccoutant@google.com>
8135 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8137 (Plugin_manager::claim_file): Create plugin object even if
8138 plugin did not call the add_symbols callback.
8139 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8140 asking for more symbols than were added.
8141 * testsuite/Makefile.am (plugin_test_1): Add test case with
8143 (empty.syms): New target.
8144 * testsuite/Makefile.in: Regenerate.
8145 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8146 message. Don't call add_symbols if no globals.
8147 (all_symbols_read_hook): Don't provide replacement for empty
8150 2008-12-12 Ian Lance Taylor <iant@google.com>
8152 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8153 r_type == 0 for a local symbol with r_sym == 0.
8154 (scan_relocatable_relocs): Pass r_sym to
8155 local_non_section_strategy.
8156 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8159 * configure.ac: Update test for TLS descriptors: they are
8160 supported as of glibc 2.9.
8161 * configure: Rebuild.
8163 2008-12-11 Ian Lance Taylor <iant@google.com>
8166 * target-reloc.h (Default_scan_relocatable_relocs): For each
8167 function, map r_type == 0 to RELOC_DISCARD.
8169 2008-12-10 Cary Coutant <ccoutant@google.com>
8171 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8172 object to override a kept COMDAT group from a plugin object.
8174 2008-12-09 Ian Lance Taylor <iant@google.com>
8177 * yyscript.y (file_cmd): Handle INPUT.
8179 * testsuite/initpri1.c: Change all declarations to be full
8180 prototypes by adding void, to avoid compiler warnings.
8182 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8184 * options.cc (General_options::parse_plugin_opt): New.
8185 (General_options::add_plugin): The argument now is just the filename.
8186 (General_options::add_plugin_option): New.
8187 * options.h (plugin_opt): New.
8188 (add_plugin): Change argument name.
8189 (add_plugin_option): New.
8190 * plugin.cc (Plugin::load): Don't parse the plugin option.
8191 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8192 (Plugin::add_option): New.
8193 (Plugin::args_): Change type.
8194 (Plugin::filename_): New.
8195 (Plugin_manager::add_plugin_option): New.
8196 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8197 * testsuite/Makefile.in: Regenerate.
8199 2008-12-05 Cary Coutant <ccoutant@google.com>
8201 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8202 Handle --strip-lto-sections option.
8203 * options.h (strip_lto_sections): New option.
8205 2008-12-01 Cary Coutant <ccoutant@google.com>
8207 * plugin.cc (ld_plugin_message): Change format parameter to const.
8208 Fix mismatch between new[] and delete.
8210 2008-11-14 Cary Coutant <ccoutant@google.com>
8212 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8215 2008-11-05 Craig Silverstein <csilvers@google.com>
8217 * options.cc (General_options::parse_dynamic_list): New function.
8218 * options.h (General_options): New flags dynamic_list,
8219 dynamic_list_data, dynamic_list_cpp_new, and
8220 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8221 (General_options::in_dynamic_list): New function.
8222 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8223 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8224 (Lex::can_continue_name): Likewise.
8226 (read_script_file): New parameter script_options.
8227 (read_dynamic_list): New function.
8228 (Script_options::define_dynamic_list): New function.
8229 (dynamic_list_keyword_parsecodes): New variable.
8230 (dynamic_list_keywords): New variable.
8231 * script.h (Script_options::define_dynamic_list): New function
8233 (read_dynamic_list): New function prototype.
8234 * symtab.cc (strprefix): New macro.
8235 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8236 dynamic_list_data, dynamic_list_cpp_new, and
8237 dynamic_list_cpp_typeinfo.
8238 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8239 (dynamic_list_expr): New rule.
8240 (dynamic_list_nodes): Likewise.
8241 (dynamic_list_node): Likewise.
8242 * testsuite/Makefile.am (dynamic_list): New test.
8243 * testsuite/Makefile.in: Regenerated.
8244 * testsuite/dynamic_list.t: New file.
8245 * testsuite/dynamic_list.sh: New file.
8247 2008-11-05 Craig Silverstein <csilvers@google.com>
8249 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8250 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8251 (t11_last): Likewise.
8252 * testsuite/ver_test_6.c (main): Likewise.
8254 2008-10-07 Cary Coutant <ccoutant@google.com>
8256 * options.c (General_options::finalize): Add check for -static and
8258 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8261 2008-10-02 Cary Coutant <ccoutant@google.com>
8263 * plugin.cc (make_sized_plugin_object): Fix conditional
8264 compilation to work when not all targets are enabled.
8266 2008-09-29 Cary Coutant <ccoutant@google.com>
8268 * archive.cc (Archive::get_file_and_offset): Use filename instead
8269 of name to get library path.
8270 (Archive::include_member): Unlock external member of a thin archive.
8272 * testsuite/Makefile.am (TEST_AR): New variable.
8273 (thin_archive_test_1): New test.
8274 (thin_archive_test_2): New test.
8275 * testsuite/Makefile.in: Regenerate.
8276 * testsuite/thin_archive_main.cc: New file.
8277 * testsuite/thin_archive_test_1.cc: New file.
8278 * testsuite/thin_archive_test_2.cc: New file.
8279 * testsuite/thin_archive_test_3.cc: New file.
8280 * testsuite/thin_archive_test_4.cc: New file.
8282 2008-09-29 Cary Coutant <ccoutant@google.com>
8284 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8285 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8287 (Sized_relobj::do_finalize_local_symbols): Likewise.
8288 (Sized_relobj::map_to_kept_section): Likewise.
8289 * object.h (Sized_relobj::invalid_address): New constant.
8290 (Sized_relobj::do_output_section_offset): Check for invalid_address
8292 * output.cc (Output_reloc::local_section_offset): Use constant
8293 invalid_address instead of -1U.
8294 (Output_reloc::get_address): Likewise.
8295 (Output_section::output_address): Change -1U to -1ULL.
8296 * output.h (Output_reloc::invalid_address): New constant.
8297 * reloc.cc (Sized_relobj::write_sections): Use constant
8298 invalid_address instead of -1U.
8299 (Sized_relobj::relocate_sections): Likewise.
8300 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8301 values for merge sections.
8302 * target-reloc.h (relocate_for_relocatable): Use constant
8303 invalid_address instead of -1U.
8305 2008-09-19 Cary Coutant <ccoutant@google.com>
8307 Add plugin functionality for link-time optimization (LTO).
8308 * configure.ac (plugins): Add --enable-plugins option.
8309 * configure: Regenerate.
8310 * config.in: Regenerate.
8311 * Makefile.am (LIBDL): New variable.
8312 (CCFILES): Add plugin.cc.
8313 (HFILES): Add plugin.h.
8314 (ldadd_var): Add LIBDL.
8315 * Makefile.in: Regenerate.
8317 * archive.cc: Include "plugin.h".
8318 (Archive::setup): Don't preread archive symbols when using a plugin.
8319 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8320 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8322 (Archive::include_member): Add symbols from plugin objects.
8323 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8324 * descriptors.cc (Descriptors::open): Check for file descriptors
8325 abandoned by plugins.
8326 (Descriptors::claim_for_plugin): New function.
8327 * descriptors.h (Descriptors::claim_for_plugin): New function.
8328 (Open_descriptor::is_claimed): New field.
8329 (claim_descriptor_for_plugin): New function.
8330 * fileread.cc (File_read::claim_for_plugin): New function.
8331 * fileread.h (File_read::claim_for_plugin): New function.
8332 (File_read::descriptor): New function.
8333 * gold.cc: Include "plugin.h".
8334 (queue_initial_tasks): Add task to call plugin hooks for generating
8336 * main.cc: Include "plugin.h".
8337 (main): Load plugin libraries.
8338 * object.h (Pluginobj): Declare.
8339 (Object::pluginobj): New function.
8340 (Object::do_pluginobj): New function.
8341 (Object::set_target): New function.
8342 * options.cc: Include "plugin.h".
8343 (General_options::parse_plugin): New function.
8344 (General_options::General_options): Initialize plugins_ field.
8345 (General_options::add_plugin): New function.
8346 * options.h (Plugin_manager): Declare.
8347 (General_options): Add --plugin option.
8348 (General_options::has_plugins): New function.
8349 (General_options::plugins): New function.
8350 (General_options::add_plugin): New function.
8351 (General_options::plugins_): New field.
8352 * plugin.cc: New file.
8353 * plugin.h: New file.
8354 * readsyms.cc: Include "plugin.h".
8355 (Read_symbols::do_read_symbols): Check for archive before checking
8356 for ELF file. Call plugin hooks to claim files.
8357 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8358 from a real object file; force override when processing replacement
8360 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8361 (Symbol::init_base_object): Likewise.
8362 (Symbol::init_base_output_data): Likewise.
8363 (Symbol::init_base_output_segment): Likewise.
8364 (Symbol::init_base_constant): Likewise.
8365 (Symbol::init_base_undefined): Likewise.
8366 (Symbol::output_section): Assert that object is not a plugin.
8367 (Symbol_table::add_from_pluginobj): New function.
8368 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8370 (Symbol_table::sized_write_globals): Likewise.
8371 (Symbol_table::add_from_pluginobj): Instantiate template.
8372 * symtab.h (Sized_pluginobj): Declare.
8373 (Symbol::in_real_elf): New function.
8374 (Symbol::set_in_real_elf): New function.
8375 (Symbol::in_real_elf_): New field.
8376 (Symbol_table::add_from_pluginobj): New function.
8378 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8379 (LIBDL): New variable.
8381 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8382 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8383 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8384 (MOSTLYCLEANFILES): Likewise.
8385 * testsuite/Makefile.in: Regenerate.
8386 * testsuite/plugin_test.c: New file.
8387 * testsuite/plugin_test_1.sh: New file.
8388 * testsuite/plugin_test_2.sh: New file.
8390 2008-09-16 Ian Lance Taylor <iant@google.com>
8392 * target-reloc.h (relocate_section): Check whether a symbol is
8393 defined by the ABI before reporting an undefined symbol error.
8394 * target.h (Target::is_defined_by_abi): Make parameter const.
8395 (Target::do_is_defined_by_abi): Likewise.
8396 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8397 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8398 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8399 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8400 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8401 * testsuite/Makefile.in: Rebuild.
8403 * fileread.cc (make_view): Add casts to avoid warning.
8405 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8407 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8408 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8410 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8412 * options.h (General_options::output_is_executable): New.
8413 (General_options::output_is_pie): New.
8414 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8415 for shared libraries.
8416 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8418 2008-09-11 Chris Demetriou <cgd@google.com>
8420 * options.h (origin): New -z option.
8421 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8422 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8425 2008-09-05 Cary Coutant <ccoutant@google.com>
8427 * fileread.cc (File_read::make_view): Add check for attempt to map
8430 2008-09-05 Cary Coutant <ccoutant@google.com>
8432 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8433 explicit instantiations.
8435 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8438 * options.cc (General_options::finalize): Allow undefined symbols
8439 in shlibs if linking -shared.
8442 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8443 symbols as not needing a dynsym entry.
8445 2008-08-20 Craig Silverstein <csilvers@google.com>
8447 * fileread.cc (File_read::open): Do not lock the file unless it
8448 was successfully opened.
8450 2008-08-14 Cary Coutant <ccoutant@google.com>
8452 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8453 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8454 * testsuite/tls_test.cc (struct int128): 128-bit struct
8455 for testing TLS relocs with non-zero addend.
8456 (v12): New TLS variable.
8458 (t_last): Add check for v12.
8459 * testsuite/tls_test.h (t12): New function.
8460 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8462 2008-08-13 Ian Lance Taylor <iant@google.com>
8464 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8465 set tls_segment_ or relro_segment_.
8466 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8468 * output.h (Output_section::clear_is_relro): New function.
8469 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8470 sections specially even when output_data_ is empty.
8471 (Output_segment::maximum_alignment): When first section is relro,
8472 only force alignment for PT_LOAD segments.
8473 * script.cc (script_data_segment_align): New function.
8474 (script_data_segment_relro_end): New function.
8475 * script-c.h (script_data_segment_align): Declare.
8476 (script_data_segment_relro_end): Declare.
8477 * script-sections.h (class Script_sections): Declare
8478 data_segment_align and data_segment_relro_end. Add fields
8479 segment_align_index_ and saw_relro_end_.
8480 * script-sections.cc (class Sections_element): Add set_is_relro
8481 virtual function. Add new bool* parameter to place_orphan_here.
8482 Add get_output_section virtual function.
8483 (class Output_section_definition): Add set_is_relro. Add new
8484 bool* parameter to place_orphan_here. Add get_output_section.
8485 Add is_relro_ field.
8486 (Output_section_definition::Output_section_definition): Initialize
8487 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8488 and is_relro_ fields.
8489 (Output_section_definition::place_orphan_here): Add is_relro
8491 (Output_section_definition::set_section_addresses): Set relro for
8493 (Output_section_definition::alternate_constraint): Likewise.
8494 (class Orphan_output_section): Add new bool* parameter to
8495 place_orphan_here. Add get_output_section.
8496 (Orphan_output_section::place_orphan_here): Add is_relro
8498 (Script_sections::Script_sections): Initialize
8499 data_segment_align_index_ and saw_relro_end_.
8500 (Script_sections::data_segment_align): New function.
8501 (Script_sections::data_segment_relro_end): New function.
8502 (Script_sections::place_orphan): Set or clear is_relro.
8503 (Script_sections::set_section_addresses): Force alignment of first
8505 * yyscript.y (exp): Call script_data_segment_align and
8506 script_data_segment_relro_end.
8507 * testsuite/relro_script_test.t: New file.
8508 * testsuite/relro_test.cc (using_script): Declare.
8509 (t1, t2): Test using_script.
8510 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8511 (relro_script_test_SOURCES): Define.
8512 (relro_script_test_DEPENDENCIES): Define.
8513 (relro_script_test_LDFLAGS): Define.
8514 (relro_script_test_LDADD): Define.
8515 (relro_script_test.so): New target.
8516 * testsuite/Makefile.in: Rebuild.
8518 2008-08-06 Cary Coutant <ccoutant@google.com>
8520 * archive.cc (Archive::total_archives, Archive::total_members)
8521 (Archive::total_members_loaded): New variables.
8522 (Archive::setup): Add parameter. Add option to preread
8524 (Archive::read_armap): Add counter.
8525 (Archive::get_file_and_offset): New function.
8526 (Archive::get_elf_object_for_member): New function.
8527 (Archive::read_all_symbols): New function.
8528 (Archive::read_symbols): New function.
8529 (Archive::add_symbols): Add counters.
8530 (Archive::include_all_members): Use armap to find members if it's
8532 (Archive::include_member): Skip reading symbols if already read.
8533 Factored code into Archive::get_file_and_offset and
8534 Archive::get_elf_object_for_member. Changed call to
8535 Mapfile::report_include_archive_member.
8536 (Archive::print_stats): New function.
8537 * archive.h: Declare Object and Read_symbols_data classes.
8538 (Archive::Archive): Add initializers for new members.
8539 (Archive::setup): Add parameter.
8540 (Archive::print_stats): New function.
8541 (Archive::total_archives, Archive::total_members)
8542 (Archive::total_members_loaded): New variables.
8543 (Archive::get_file_and_offset): New function.
8544 (Archive::get_elf_object_for_member): New function.
8545 (Archive::read_all_symbols): New function.
8546 (Archive::read_symbols): New function.
8547 (Archive::Archive_member): New class.
8548 (Archive::members_): New member.
8549 (Archive::num_members_): New member.
8550 * main.cc: Include archive.h.
8551 (main): Call Archive::print_stats.
8552 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8553 archive parameter; member_name is now the fully-decorated name.
8554 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8555 * options.h: (General_options): Add --preread-archive-symbols option.
8556 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8559 2008-08-04 Ian Lance Taylor <iant@google.com>
8561 * symtab.h (Symbol::use_plt_offset): New function.
8562 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8563 * powerpc.cc (Relocate::relocate): Likewise.
8564 * sparc.cc (Relocate::relocate): Likewise.
8565 * x86_64.cc (Relocate::relocate): Likewise.
8566 * testsuite/weak_plt.sh: New test.
8567 * testsuite/weak_plt_main.cc: New test.
8568 * testsuite/weak_plt_shared.cc: New test.
8569 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8570 (check_PROGRAMS): Add weak_plt.
8571 (check_DATA): Add weak_plt_shared.so.
8572 (weak_plt_main_pic.o, weak_plt): New targets.
8573 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8574 * testsuite/Makefile.in: Rebuild.
8576 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8578 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8579 * testsuite/Makefile.in: Rebuild.
8581 2008-08-04 Alan Modra <amodra@bigpond.net.au>
8583 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8584 * Makefile.in: Regenerate.
8585 * po/POTFILES.in: Regenerate.
8587 2008-07-29 Ian Lance Taylor <iant@google.com>
8589 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8590 symbols before other symbols.
8591 * testsuite/script_test_2.cc (test_addr): Declare.
8592 (test_addr_alias): Declare.
8593 (main): Check that test_addr and test_addr_alias have the right
8595 * testsuite/script_test_2.t: Define test_addr_alias and
8598 2008-07-24 Ian Lance Taylor <iant@google.com>
8601 * descriptors.cc: New file.
8602 * descriptors.h: New file.
8603 * gold-threads.h (class Hold_optional_lock): New class.
8604 * fileread.cc: Include "descriptors.h".
8605 (File_read::~File_read): Release descriptor rather than closing
8607 (File_read::open) [file]: Call open_descriptor rather than open.
8608 Set is_descriptor_opened_.
8609 (File_read::open) [memory]: Assert that descriptor is not open.
8610 (File_read::reopen_descriptor): New function.
8611 (File_read::release): Release descriptor.
8612 (File_read::do_read): Make non-const. Reopen descriptor.
8613 (File_read::read): Make non-const.
8614 (File_read::make_view): Reopen descriptor.
8615 (File_read::do_readv): Likewise.
8616 * fileread.h (class File_read): Add is_descriptor_opened_ field.
8617 Update declarations.
8618 * layout.cc: Include "descriptors.h".
8619 (Layout::create_build_id): Use open_descriptor rather than open.
8620 * output.cc: Include "descriptors.h".
8621 (Output_file::open): Use open_descriptor rather than open.
8622 * archive.cc (Archive::const_iterator): Change Archive to be
8624 (Archive::begin, Archive::end): Make non-const.
8625 (Archive::count_members): Likewise.
8626 * archive.h (class Archive): Update declarations.
8627 * object.h (Object::read): Make non-const.
8628 * Makefile.am (CCFILES): Add descriptors.cc.
8629 (HFILES): Add descriptors.h.
8630 * Makefile.in: Rebuild.
8633 * gold.h: Always include <clocale>. Add Solaris workarounds
8634 following code in binutils/sysdep.h.
8637 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8638 this->eh_frame_hdr_ is NULL before using it.
8640 * dynobj.cc (Versions::Versions): Update comment.
8642 * dynobj.cc (Versions::Versions): If there is an soname, use it as
8643 the base version name.
8645 * stringpool.cc (Stringpool_template::add_with_length): Set key to
8646 array size plus one.
8647 (Stringpool_template::set_string_offsets): Subtract one from key
8648 before using it as an array index.
8649 (Stringpool_template::get_offset_with_length): Likewise.
8650 (Stringpool_template::write_to_buffer): Likewise.
8651 * stringpool.h (Stringpool_template::get_offset_from_key):
8654 2008-07-23 Ian Lance Taylor <iant@google.com>
8657 * object.h (Merged_symbol_value::value): Do our best to handle a
8661 * script.cc (Version_script_info::get_versions): Don't add empty
8662 version tag to return value.
8663 (Version_script_info::get_symbol_version_helper): Change return
8664 type to bool. Add pversion parameter. Change all callers.
8665 (script_register_vers_node): Don't require a non-NULL tag.
8666 * script.h (class Version_script_info): Update declarations.
8667 (Version_script_info::get_symbol_version): Change return type to
8668 bool. Add version parameter. Change all callers.
8669 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8670 handling. Handle an empty version from a version script.
8671 (Symbol_table::define_special_symbol): Likewise.
8672 * testsuite/ver_test_10.script: New file.
8673 * testsuite/ver_test_10.sh: New file.
8674 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8675 (check_DATA): Add ver_test_10.syms.
8676 (ver_test_10.syms, ver_test_10.so): New target.
8677 * testsuite/Makefile.in: Rebuild.
8679 2008-07-23 Simon Baldwin <simonb@google.com>
8681 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8682 to zero for undefined symbols from dynamic libraries.
8684 2008-07-23 Ian Lance Taylor <iant@google.com>
8686 * symtab.cc (Symbol_table::resolve): Remove version parameter.
8688 * symtab.h (class Symbol_table): Update declaration.
8689 * testsuite/ver_test_9.cc: New file.
8690 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8691 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8692 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8693 (ver_test_9.so, ver_test_9.o): New targets.
8694 * testsuite/Makefile.in: Rebuild.
8696 2008-07-22 Ian Lance Taylor <iant@google.com>
8698 * options.h (class General_options): Define --check-sections.
8699 * layout.cc (Layout::set_segment_offsets): Handle
8702 * options.h (class General_options): Define -n/--nmagic and
8704 * options.cc (General_options::finalize): For -n/--nmagic or
8705 -N/--omagic, set -static.
8706 * layout.cc (Layout::attach_allocated_section_to_segment): If
8707 -N/--omagic, don't put read-only and read-write sections in
8709 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8710 finding a read-only segment.
8711 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8712 don't set the minimum segment alignment to the common page size,
8713 and don't set the file offset to the address modulo the page size.
8714 * script-sections.cc (Script_sections::create_segments): If
8715 -n/--omagic, don't put read-only and read-write sections in
8718 * cref.cc: New file.
8720 * options.h (class General_options): Add --print-symbol-counts.
8721 * main.cc (main): Issue defined symbol report if requested.
8722 * archive.cc (Archive::interpret_header): Make into a const member
8724 (Archive::add_symbols): Call Input_objects::archive_start and
8726 (Archive::const_iterator): Define new class.
8727 (Archive::begin, Archive::end): New functions.
8728 (Archive::include_all_members): Rewrite to use iterator.
8729 (Archive::count_members): New function.
8730 * archive.h (class Archive): Update declarations.
8731 (Archive::filename): New function.
8732 * object.cc: Include "cref.h".
8733 (Sized_relobj::Sized_relobj): Initialize defined_count_.
8734 (Sized_relobj::do_get_global_symbol_counts): New function.
8735 (Input_objects::add_object): Add object to cross-referencer.
8736 (Input_objects::archive_start): New function.
8737 (Input_objects::archive_stop): New function.
8738 (Input_objects::print_symbol_counts): New function.
8739 * object.h: Declare Cref and Archive.
8740 (Object::get_global_symbol_counts): New function.
8741 (Object::do_get_global_symbol_counts): New pure virtual function.
8742 (class Sized_relobj): Add defined_count_ field. Update
8744 (class Input_objects): Add cref_ field. Update constructor.
8745 Update declarations.
8746 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8748 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8750 (Sized_dynobj::do_get_global_symbol_counts): New function.
8751 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8752 defined_count_. Update declarations. Define Symbols typedef.
8753 * symtab.cc (Symbol_table::add_from_relobj): Add defined
8754 parameter. Change all callers.
8755 (Symbol_table::add_from_dynobj): Add sympointers and defined
8756 parameters. Change all callers.
8757 * symtab.h (class Symbol_table): Update declarations.
8758 * Makefile.am (CCFILES): Add cref.cc.
8759 (HFILES): Add cref.h.
8760 * Makefile.in: Rebuild.
8762 2008-07-22 Simon Baldwin <simonb@google.com>
8764 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8765 to zero when writing undefined symbols.
8767 2008-07-22 Ian Lance Taylor <iant@google.com>
8769 * output.cc (Output_section::add_input_section): Don't try to
8770 merge empty merge sections.
8772 2008-07-21 Craig Silverstein <csilvers@google.com>
8774 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8775 Include symbol version in error message.
8777 2008-07-20 Chris Demetriou <cgd@google.com>
8779 * configure.ac (gold_cv_c_random_seed): New configured variable.
8780 (RANDOM_SEED_CFLAGS): New substituted variable.
8781 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8782 * configure: Rebuild.
8783 * Makefile.in: Likewise.
8784 * testsuite/Makefile.in: Likewise.
8786 2008-07-18 Ian Lance Taylor <iant@google.com>
8788 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8789 where we see NAME/NULL and NAME/VERSION as separate symbols.
8790 * testsuite/ver_test_main.cc (main): Call t4.
8791 (t4, t4_2a): Define.
8792 * testsuite/ver_test_2.cc (t4_2): Define.
8793 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8794 * testsuite/ver_test_4.cc (t4_2a): Define.
8795 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8796 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8798 2008-07-17 Ian Lance Taylor <iant@google.com>
8800 * dynobj.cc (Versions::add_def): If we give an error about a
8801 missing version, go ahead and create the version anyhow.
8803 2008-07-10 Ian Lance Taylor <iant@google.com>
8805 Handle output sections with more than 0x7fffffff bytes.
8806 * object.h (class Relobj): Change map_to_output_ to
8807 output_sections_, and just keep a section pointer. Change all
8808 uses. Move comdat group support to Sized_relobj.
8809 (Relobj::is_section_specially_mapped): Remove.
8810 (Relobj::output_section): Remove poff parameter. Change all
8812 (Relobj::output_section_offset): New function.
8813 (Relobj::set_section_offset): Rewrite.
8814 (Relobj::map_to_output): Remove.
8815 (Relobj::output_sections): New function.
8816 (Relobj::do_output_section_offset): New pure virtual function.
8817 (Relobj::do_set_section_offset): Likewise.
8818 (class Sized_relobj): Add section_offsets_ field. Add comdat
8819 group support from Relobj. Update declarations.
8820 (Sized_relobj::get_output_section_offset): New function.
8821 (Sized_relobj::do_output_section_offset): New function.
8822 (Sized_relobj::do_set_section_offset): New function.
8823 * object.cc (Relobj::output_section_address): Remove.
8824 (Sized_relobj::Sized_relobj): Initialize new fields.
8825 (Sized_relobj::include_section_group): Cast find_kept_object to
8827 (Sized_relobj::include_linkonce_section): Likewise.
8828 (Sized_relobj::do_layout): Use separate arrays for output section
8830 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8832 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8833 output_sections and section_offsets.
8834 (Sized_relobj::write_local_symbols): Likewise.
8835 (map_to_kept_section): Compute output address directly.
8836 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8837 output_sections and section_offsets.
8838 (Sized_relobj::write_sections): Likewise.
8839 (Sized_relobj::relocate_sections): Likewise.
8840 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8841 * output.h (class Output_reloc): Update declarations. Change
8842 u2_.relobj to Sized_relobj*.
8843 (class Output_data_reloc): Change add functions to use
8845 * output.cc (Output_reloc::Output_reloc): Change relobj to
8847 (Output_reloc::local_section_offset): Change return type to
8848 Elf_Addr. Use get_output_section_offset.
8849 (Output_reloc::get_address): Likewise.
8850 (Output_section::is_input_address_mapped): Don't call
8851 is_section_specially_mapped.
8852 (Output_section::output_offset): Likewise.
8853 (Output_section::output_address): Likewise.
8854 (Output_section::starting_output_address): Likewise.
8855 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8856 parameter to Sized_relobj*.
8857 (Copy_relocs::need_copy_reloc): Likewise.
8858 (Copy_relocs::save): Likewise.
8859 * copy-relocs.h (class Copy_relocs): Update declarations.
8860 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8861 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8862 * target-reloc.h (relocate_for_relocatable): Change
8863 offset_in_output_section type to Elf_Addr. Change code that uses
8865 * layout.cc (Layout::layout): Always set *off.
8866 * mapfile.cc (Mapfile::print_input_section): Use
8867 output_section_offset.
8868 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8870 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8871 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8872 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8874 2008-07-03 Ian Lance Taylor <iant@google.com>
8876 * layout.cc (Layout::include_section): Do not discard unrecognized
8877 SHT_STRTAB sections.
8879 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
8881 * script.cc (Lex::can_continue_name): Make '?' allowable in
8882 version-script names.
8883 * testsuite/version_script.map: Change glob pattern to use '?'
8885 2008-06-30 Manish Singh <yosh@gimp.org>
8888 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8891 2008-06-30 Ian Lance Taylor <iant@google.com>
8895 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8896 versions]: Don't try to read the value in the contents, since we
8897 don't use it. Use the template endianness when writing.
8899 2008-06-25 Cary Coutant <ccoutant@google.com>
8901 * fileread.cc (File_read::make_view): Assert on zero-length view.
8902 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8903 symbol table when there are no symbols to read.
8905 2008-06-23 Craig Silverstein <csilvers@google.com>
8907 * version.cc (version_string): Bump to 1.7
8909 2008-06-18 Craig Silverstein <csilvers@google.com>
8911 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8912 constant 0xFFFF to type Valtype.
8913 (Powerpc_relocate_functions::rel16_ha): Likewise.
8915 2008-06-17 Ian Lance Taylor <iant@google.com>
8917 * output.h (Output_section::Input_section): Initialize p2align_ to
8918 zero for Output_section_data constructors.
8919 (Output_section::Input_section::addralign): If not an input
8920 section, return the alignment of the Output_section_data.
8921 * testsuite/copy_test.cc: New file.
8922 * testsuite/copy_test_1.cc: New file.
8923 * testsuite/copy_test_2.cc: New file.
8924 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8925 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8926 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8927 (copy_test_1_pic.o, copy_test_1.so): New targets.
8928 (copy_test_2_pic.o, copy_test_2.so): New targets.
8929 * testsuite/Makefile.in: Rebuild.
8931 * script-sections.cc (Script_sections::place_orphan): Initialize
8932 local variable exact.
8934 2008-06-13 David Edelsohn <edelsohn@gnu.org>
8936 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8938 2008-06-12 David Edelsohn <edelsohn@gnu.org>
8939 David S. Miller <davem@davemloft.net>
8941 * powerpc.cc: New file.
8942 * Makefile.am (TARGETSOURCES): Add powerpc.cc
8943 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8944 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8945 * Makefile.in: Rebuild.
8947 2008-06-09 Ian Lance Taylor <iant@google.com>
8949 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8951 (throwing, orig_terminate): New static variables.
8952 (terminate_handler): New static function.
8953 (t2): Set terminate handler.
8955 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
8958 * binary.cc (Binary_to_elf::sized_convert): Fix .data
8961 2008-05-30 Cary Coutant <ccoutant@google.com>
8963 * archive.cc (Archive::include_all_members) Correct to step
8964 over symbol table and extended name table in thin archives.
8966 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8969 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8972 2008-05-28 Caleb Howe <cshowe@google.com>
8974 * reduced_debug_output.cc: New file.
8975 * reduced_debug_output.h: New file.
8976 * options.h (class General_options): Add --strip-debug-non-line.
8977 * options.cc (General_options::finalize): Add strip_debug_non_line
8978 to the strip heirarchy.
8979 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8981 * layout.cc: Include "reduced_debug_output.h".
8982 (Layout::Layout): Initialize new fields.
8983 (line_only_debug_sections): New static array.
8984 (is_lines_only_debug_sections): New static inline function.
8985 (Layout::include_section): Handle --strip-debug-non-line.
8986 (Layout::make_output_section): If --strip-debug-non-line, build
8987 new output sections for .debug_abbrev and .debug_info.
8988 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8989 gold. Warn about possible overflow.
8990 (read_signed_LEB_128): Likewise.
8991 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8992 (read_signed_LEB_128): Declare.
8993 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8994 (HFILES): Add reduced_debug_output.h.
8995 * Makefile.in: Rebuild.
8997 2008-05-21 Ian Lance Taylor <iant@google.com>
8999 * mapfile.cc: New file.
9000 * mapfile.h: New file.
9001 * options.h (class General_options): Add -M/--print-map and -Map.
9002 * options.cc (General_options::finalize): Make -M equivalent to
9004 * main.cc: Include <cstdio> and "mapfile.h".
9005 (main): Open mapfile if requested.
9006 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9007 constructor. Change caller.
9008 (queue_initial_tasks): Add mapfile parameter. Change caller.
9009 (queue_middle_tasks): Likewise.
9010 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9012 * archive.cc: Include "mapfile.h".
9013 (Archive::add_symbols): Add mapfile parameter. Change all
9014 callers. Pass mapfile, symbol, and reason to include_member.
9015 (Archive::include_all_members): Add mapfile parameter. Change all
9017 (Archive::include_member): Add mapfile, sym, and why parameters.
9018 Change all callers. Report inclusion to map file.
9019 * archive.h: Include "fileread.h".
9020 (class Archive): Update declarations.
9021 (Archive::file): New const method.
9022 (class Add_archive_symbols): Add mapfile_ field. Update
9023 constructor. Change all callers.
9024 * readsyms.h (class Read_symbols): Likewise.
9025 (class Finish_group): Likewise.
9026 (class Read_script): Likewise.
9027 * common.cc: Include "mapfile.h".
9028 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9030 (Symbol_table::do_allocate_commons): Likewise.
9031 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9032 symbol allocation to mapfile.
9033 * common.h (class Allocate_commons_task): Add mapfile_ field.
9034 Update constructor. Change all callers.
9035 * symtab.h (class Symbol_table): Update declarations.
9036 * layout.cc: Include "mapfile.h".
9037 (Layout_task_runner::run): Print information to mapfile.
9038 (Layout::create_gold_note): Change Output_data_fixed_space to
9039 Output_data_zero_fill.
9040 (Layout::create_build_id): Likewise.
9041 (Layout::print_to_mapfile): New function.
9042 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9043 constructor. Change caller.
9044 (class Layout): Declare print_to_mapfile.
9045 * output.cc (Output_section::Input_section::print_to_mapfile): New
9047 (Output_section::add_input_section): If producing a map, always
9048 add to input_sections_ list.
9049 (Output_section::do_print_to_mapfile): New function.
9050 (Output_segment::print_sections_to_mapfile): New function.
9051 (Output_segment::print_section_list_to_mapfile): New function.
9052 * output.h: Include "mapfile.h".
9053 (Output_data::print_to_mapfile): New function.
9054 (Output_data::do_print_to_mapfile): New virtual function.
9055 (Output_segment_headers::do_print_to_mapfile): New function.
9056 (Output_file_header::do_print_to_mapfile): New function.
9057 (Output_data_const::do_print_to_mapfile): New function.
9058 (class Output_data_const_buffer): Add map_name_ field. Update
9059 constructor. Change all callers. Add do_print_to_mapfile
9061 (class Output_data_fixed_space): Likewise.
9062 (class Output_data_space): Likewise.
9063 (class Output_data_zero_fill): New class.
9064 (Output_data_strtab::do_print_to_mapfile): New function.
9065 (Output_data_reloc_base::do_print_to_mapfile): New function.
9066 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9067 (Output_data_group::do_print_to_mapfile): New function.
9068 (Output_data_got::do_print_to_mapfile): New function.
9069 (Output_data_dynamic::do_print_to_mapfile): New function.
9070 (Output_symtab_xindex::do_print_to_mapfile): New function.
9071 (class Output_section): Declare do_print_to_mapflie. Declare
9072 print_to_mapfile in Input_section.
9073 (class Output_segment): Declare new functions.
9074 * object.h (Sized_relobj::symbol_count): New function.
9075 * script-sections.cc
9076 (Output_section_element_dot_assignment::set_section_addresses):
9077 Change Output_data_fixed_space to Output_data_zero_fill.
9078 (Output_data_expression::do_print_to_mapfile): New function.
9079 * script.cc (read_input_script): Add mapfile parameter. Change
9081 * script.h (read_input_script): Update declaration.
9082 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9083 (Eh_frame::do_print_to_mapfile): New function.
9084 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9085 (Output_merge_string::do_print_to_mapfile): New function.
9086 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9088 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9090 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9092 * Makefile.am (CCFILES): Add mapfile.cc.
9093 (HFILES): Add mapfile.h.
9094 * Makefile.in: Rebuild.
9096 2008-05-19 Ian Lance Taylor <iant@google.com>
9098 * options.h (class General_options): Add -z relro.
9099 * layout.cc (Layout::Layout): Initialize relro_segment_.
9100 (Layout::add_output_section_data): Return the output section.
9101 (Layout::make_output_section): Rcognize relro sections and mark
9103 (Layout::attach_allocated_section_to_segment): Put relro sections
9104 in a PT_GNU_RELRO segment.
9105 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9107 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9109 (Layout::linkonce_mapping): Map d.rel.ro.local to
9111 (Layout::output_section_name): Us .data.rel.ro.local for any
9112 section which begins with that.
9113 * layout.h (class Layout): Update add_output_section_data
9114 declaration. Add relro_segment_ field.
9115 * output.cc (Output_section::Output_section): Initialize is_relro_
9116 and is_relro_local_ fields.
9117 (Output_segment::add_output_section): Group relro sections.
9118 (Output_segment::is_first_section_relro): New function.
9119 (Output_segment::maximum_alignment): If there is a relro section,
9120 align the segment to the common page size.
9121 (Output_segment::set_section_addresses): Track whether we are
9122 looking at relro sections. If the last section is a relro
9123 section, align to the common page size.
9124 (Output_segment::set_section_list_addresses): Add in_relro
9125 parameter. Change all callers. Align to the page size when
9126 moving from relro to non-relro section.
9127 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9129 * output.h (class Output_section): Add is_relro_ and
9130 is_relro_local_ fields.
9131 (Output_section::is_relro): New function.
9132 (Output_section::set_is_relro): New function.
9133 (Output_section::is_relro_local): New function.
9134 (Output_section::set_is_relro_local): New function.
9135 (class Output_segment): Update declarations.
9136 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9137 * sparc.cc (Target_sparc::got_section): Likewise.
9138 * x86_64.cc (Target_x86_64::got_section): Likewise.
9139 * testsuite/relro_test_main.cc: New file.
9140 * testsuite/relro_test.cc: New file.
9141 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9142 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9143 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9144 (relro_test.so, relro_test_pic.o): New targets.
9145 * testsuite/Makefile.in: Rebuild.
9147 2008-05-16 Ian Lance Taylor <iant@google.com>
9149 * output.cc (Output_segment::add_output_section): Remove front
9151 * output.h (class Output_segment): Remove
9152 add_initial_output_section and overloaded add_output_section.
9153 Update declaration of remaining add_output_section.
9154 * layout.cc (Layout::create_interp): Call add_output_section
9155 rather than add_initial_output_section.
9156 (Layout::finish_dynamic_section): Likewise.
9158 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9159 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9160 know the dynamic type.
9161 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9162 field. Initialize it in constructor.
9163 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9164 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9165 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9168 * output.cc (Output_reloc::get_address): Change return type to
9170 * output.h (class Output_reloc): Update get_address declaration.
9171 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9172 for section addresses.
9174 2008-05-09 Ian Lance Taylor <iant@google.com>
9177 * gold.cc (gold_nomem): Use return value of write.
9179 2008-05-08 Ian Lance Taylor <iant@google.com>
9181 * symtab.c (Symbol::init_base_output_data): Add version
9182 parameter. Change all callers.
9183 (Symbol::init_base_output_segment): Likewise.
9184 (Symbol::init_base_constant): Likewise.
9185 (Symbol::init_base_undefined): Likewise.
9186 (Sized_symbol::init_output_data): Likewise.
9187 (Sized_symbol::init_output_segment): Likewise.
9188 (Sized_symbol::init_constant): Likewise.
9189 (Sized_symbol::init_undefined): Likewise.
9190 (Symbol_table::do_define_in_output_data): If the new symbol has a
9191 version, mark it as the default.
9192 (Symbol_table::do_define_in_output_segment): Likewise.
9193 (Symbol_table::do_define_as_constant): Likewise.
9194 * symtab.h (class Symbol): Update declarations.
9195 (class Sized_symbol): Likewise.
9196 * resolve.cc (Symbol::override_version): New function.
9197 (Symbol::override_base): Call override_version.
9198 (Symbol::override_base_with_special): Likewise.
9199 * testsuite/ver_script_8.script: New file.
9200 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9201 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9202 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9203 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9205 2008-05-06 Ian Lance Taylor <iant@google.com>
9208 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9210 (class General_options): Remove existing --undefined, and add
9211 --no-undefined instead. Add new --undefined as synonym for -u.
9212 * archive.cc (Archive::add_symbols): Check whether symbol was
9214 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9215 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9216 all uses. Add IS_UNDEFINED. Update declarations to split
9217 different versions of init_base. Declare init_base_undefined.
9218 (Symbol::is_defined): Handle IS_UNDEFINED.
9219 (Symbol::is_undefined): Likewise.
9220 (Symbol::is_weak_undefined): Call is_undefined.
9221 (Symbol::is_absolute): Handle IS_CONSTANT.
9222 (class Sized_symbol): Update declarations to split different
9223 versions of init. Declare init_undefined.
9224 (class Symbol_table): Declare new functions.
9225 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9227 (Symbol::init_base_output_data): Likewise.
9228 (Symbol::init_base_output_segment): Likewise.
9229 (Symbol::init_base_constant): Likewise.
9230 (Symbol::init_base_undefined): New function.
9231 (Sized_symbol::init_object): Rename from init. Change all
9233 (Sized_symbol::init_output_data): Likewise.
9234 (Sized_symbol::init_output_segment): Likewise.
9235 (Sized_symbol::init_constant): Likewise.
9236 (Sized_symbol::init_undefined): New function.
9237 (Symbol_table::add_undefined_symbols_from_command_line): New
9239 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9241 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9242 (Symbol::output_section): Likewise.
9243 (Symbol::set_output_section): Likewise.
9244 (Symbol_table::sized_finalize_symbol): Likewise.
9245 (Symbol_table::sized_write_globals): Likewise.
9246 * resolve.cc (Symbol_table::should_override): Likewise.
9247 (Symbol::override_base_with_special): Likewise.
9249 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9250 symbol, change it to have default visibility.
9251 * testsuite/protected_1.cc: New file.
9252 * testsuite/protected_2.cc: New file.
9253 * testsuite/protected_3.cc: New file.
9254 * testsuite/protected_main_1.cc: New file.
9255 * testsuite/protected_main_2.cc: New file.
9256 * testsuite/protected_main_3.cc: New file.
9257 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9258 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9259 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9260 (protected_1.so): New target.
9261 (protected_1_pic.o, protected_2_pic.o): New targets.
9262 (protected_3_pic.o): New target.
9263 (check_PROGRAMS): Add protected_2.
9264 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9265 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9266 * testsuite/Makefile.in: Rebuild.
9268 * options.h (DEFINE_var): Add set_user_set_##varname__.
9269 (DEFINE_bool_alias): New macro.
9270 (class General_options): Define -Bstatic using DEFINE_bool_alias
9271 rather than DEFINE_special. Add --undefined as an alias for -z
9273 * options.cc (General_options::parse_Bstatic): Remove.
9275 * options.h (class General_options): Add --fatal-warnings.
9276 * main.cc (main): Implement --fatal-warnings.
9277 * errors.h (Errors::warning_count): New function.
9279 * options.h (class General_options): Add -Bsymbolic-functions.
9280 * symtab.h (Symbol::is_preemptible): Check for
9281 -Bsymbolic-functions.
9283 2008-05-05 Ian Lance Taylor <iant@google.com>
9285 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9286 as noVARNAME rather than no-VARNAME.
9287 (class General_options): Add option -z combreloc.
9288 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9290 (Output_reloc::sort_before) [SHT_REL]: New function.
9291 (Output_reloc::sort_before) [SHT_RELA]: New function.
9292 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9293 Sort_relocs_comparison.
9294 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9295 parameter. Change all callers.
9296 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9297 sort_relocs parameter. Change all callers.
9298 * output.cc (Output_reloc::get_address): New function, broken out
9300 (Output_reloc::write_rel): Call it.
9301 (Output_reloc::compare): New function.
9302 (Output_data_reloc_base::do_write): Optionally sort relocs.
9304 * configure.ac: If targ_extra_obj is set, link it in.
9305 * configure.tgt: Initialize all variables.
9306 (x86_64*): Set targ_extra_obj and targ_extra_size.
9307 * configure: Rebuild.
9309 * object.cc (Sized_relobj::include_section_group): Adjust section
9310 indexes read from group data. Build vector to pass to
9312 * layout.cc (Layout::layout_group): Add flags and shndxes
9313 parameters. Remove contents parameter. Change caller. Update
9314 explicit instantiations.
9315 * layout.h (class Layout): Update layout_group declaration.
9316 * output.cc (Output_data_group::Output_data_group): Add flags and
9317 input_shndxes parameters. Remove contents parameter. Change
9319 (Output_data_group::do_write): Change input_sections_ to
9321 * output.h (class Output_data_group): Update constructor
9322 declaration. Rename input_sections_ to input_shndxes_.
9323 * testsuite/many_sections_test.cc: Add template.
9325 2008-04-30 Cary Coutant <ccoutant@google.com>
9327 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9329 * layout.cc (Layout::include_section): Refactored check for debug
9331 (Layout::add_comdat): Add new parameters. Change type
9332 of signature parameter. Add object and shndx to signatures table.
9333 (Layout::find_kept_object): New function.
9334 * layout.h: Include <cstring>.
9335 (Layout::is_debug_info_section): New function.
9336 (Layout::add_comdat): Add new parameters.
9337 (Layout::find_kept_object): New function.
9338 (Layout::Kept_section): New struct.
9339 (Layout::Signatures): Change type of map range.
9340 * object.cc (Relobj::output_section_address): New function.
9341 (Sized_relobj::include_section_group): Add new parameters. Change
9342 calls to Layout::add_comdat. Change to build table of kept comdat
9343 groups and table mapping discarded sections to kept sections.
9344 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9345 (Sized_relobj::do_layout): Change calls to include_section_group and
9346 include_linkonce_section.
9347 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9348 value to zero when section is discarded.
9349 (Sized_relobj::map_to_kept_section): New function.
9350 * object.h (Relobj::output_section_address): New function.
9351 (Relobj::Comdat_group): New type.
9352 (Relobj::find_comdat_group): New function.
9353 (Relobj::Comdat_group_table): New type.
9354 (Relobj::Kept_comdat_section): New type.
9355 (Relobj::Kept_comdat_section_table): New type.
9356 (Relobj::add_comdat_group): New function.
9357 (Relobj::set_kept_comdat_section): New function.
9358 (Relobj::get_kept_comdat_section): New function.
9359 (Relobj::comdat_groups_): New field.
9360 (Relobj::kept_comdat_sections_): New field.
9361 (Symbol_value::input_value): Update comment.
9362 (Sized_relobj::map_to_kept_section) New function.
9363 (Sized_relobj::include_linkonce_section): Add new parameter.
9364 * target-reloc.h (Comdat_behavior): New type.
9365 (get_comdat_behavior): New function.
9366 (relocate_section): Add code to map a discarded section to the
9367 corresponding kept section when applying a relocation.
9369 2008-04-30 Craig Silverstein <csilvers@google.com>
9371 * dwarf_reader.cc (next_generation_count): New static var.
9372 (Addr2line_cache_entry): New struct.
9373 (addr2line_cache): New static var.
9374 (Dwarf_line_info::one_addr2line): Added caching.
9375 (Dwarf_line_info::clear_addr2line_cache): New function.
9376 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9377 cache-size parameter.
9378 (Dwarf_line_info::one_addr2line_cache): New function.
9379 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9380 new cache-size argument to one_addr2line(), and clear cache.
9382 2008-04-28 Cary Coutant <ccoutant@google.com>
9384 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9385 R_386_PC8 relocations.
9387 2008-04-23 Ian Lance Taylor <iant@google.com>
9389 * object.cc (Sized_relobj::include_section_group): Check for
9390 invalid section group.
9392 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9395 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9396 than read for file header.
9397 * archive.cc (Archive::include_member): Likewise.
9399 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
9401 * aclocal.m4: Regenerate.
9402 * configure: Regenerate.
9404 2008-04-19 Ian Lance Taylor <iant@google.com>
9406 * version.cc (version_string): Bump to 1.6.
9408 * testsuite/Makefile.am (many_sections_r_test): New target.
9409 (many_sections_r_test_SOURCES): Remove.
9410 (many_sections_r_test_DEPENDENCIES): Remove.
9411 (many_sections_r_test_LDFLAGS): Remove.
9412 (many_sections_r_test_LDADD): Remove.
9414 * object.cc (Sized_relobj::do_add_symbols): Always pass
9415 local_symbol_count_ to add_from_relobj.
9417 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9418 every thousand variables.
9419 * testsuite/Makefile.in: Rebuild.
9421 * object.cc (Xindex::initialize_symtab_xindex): New function.
9422 (Xindex::read_symtab_xindex): New function.
9423 (Xindex::sym_xindex_to_shndx): New function.
9424 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9426 (Sized_relobj::do_initialize_xindex): New function.
9427 (Sized_relobj::do_read_symbols): Adjust section links.
9428 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9429 parameter. Change all callers.
9430 (Sized_relobj::include_section_group): Adjust section links and
9431 symbol section indexes.
9432 (Sized_relobj::do_layout): Adjust section links.
9433 (Sized_relobj::do_count_local_symbols): Adjust section links and
9434 symbol section indexes.
9435 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9436 ordinary and special symbols.
9437 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9438 dynsym_xindex parameters. Change all callers. Adjust section
9439 links. Use SHN_XINDEX when needed.
9440 (Sized_relobj::get_symbol_location_info): Adjust section links.
9441 Don't get fooled by special symbols.
9442 * object.h (class Xindex): Define.
9443 (class Object): Add xindex_ parameter. Declare virtual functoin
9444 do_initialize_xindex.
9445 (Object::adjust_sym_shndx): New function.
9446 (Object::set_xindex): New protected function.
9447 (class Symbol_value): Add is_ordinary_shndx_ field.
9448 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9449 (Symbol_value::value): Assert ordinary section.
9450 (Symbol_value::initialize_input_to_output_map): Likewise.
9451 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9453 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9455 (class Sized_relobj): Update declarations.
9456 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9457 parameter. Change all callers.
9458 (Sized_relobj::adjust_shndx): New function.
9459 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9461 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9462 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9463 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9464 (Sized_dynobj::read_dynsym_section): Adjust section links.
9465 (Sized_dynobj::read_dynamic): Likewise.
9466 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9468 (Sized_dynobj::do_initialize_xindex): New function.
9469 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9470 do_initialize_xindex.
9471 (Sized_dynobj::adjust_shndx): New function.
9472 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9473 dynsym_xindex_ fields.
9474 (Layout::finalize): Add a call to set_section_indexes before
9475 creating the symtab sections.
9476 (Layout::set_section_indexes): Don't do anything if the section
9477 already has a section index.
9478 (Layout::create_symtab_sections): Add shnum parameter. Change
9479 caller. Create .symtab_shndx section if needed.
9480 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9482 (Layout::allocated_output_section_count): New function.
9483 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9485 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9486 fields. Update declarations.
9487 (Layout::symtab_xindex): New function.
9488 (Layout::dynsym_xindex): New function.
9489 (class Write_symbols_task): Add layout_ field.
9490 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9492 * output.cc (Output_section_headers::Output_section_headers): Add
9493 shstrtab_section parameter. Change all callers.
9494 (Output_section_headers::do_sized_write): Store overflow values
9495 for section count and section string table section index in
9496 section header zero.
9497 (Output_file_header::do_sized_write): Check for overflow of
9498 section count and section string table section index.
9499 (Output_symtab_xindex::do_write): New function.
9500 (Output_symtab_xindex::endian_do_write): New function.
9501 * output.h (class Output_section_headers): Add shstrtab_section_.
9502 Update declarations.
9503 (class Output_symtab_xindex): Define.
9504 (Output_section::has_out_shndx): New function.
9505 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9507 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9509 (Sized_symbol::init): Likewise.
9510 (Symbol::output_section): Check for ordinary symbol.
9511 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9512 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9514 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9515 Change all callers. Simplify handling of symbols from sections
9516 not included in the link.
9517 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9519 (Weak_alias_sorter::operator()): Assert that symbols are
9521 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9523 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9524 parameters. Change all callers.
9525 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9526 symbol distinction. Use SHN_XINDEX when needed.
9527 (Symbol_table::write_section_symbol): Add symtab_xindex
9528 parameter. Change all callers.
9529 (Symbol_table::sized_write_section_symbol): Likewise. Use
9530 SHN_XINDEX when needed.
9531 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9533 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9534 (Symbol::is_defined): Check is_ordinary.
9535 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9536 (Symbol::is_absolute, Symbol::is_common): Likewise.
9537 (class Sized_symbol): Update declarations.
9538 (class Symbol_table): Update declarations.
9539 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9540 parameters. Change all callers.
9541 (Sized_symbol::override): Likewise.
9542 (Symbol_table::override): Likewise.
9543 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9544 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9545 is_ordinary, and orig_st_shndx parameters. Change all callers.
9546 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9547 to be in an ordinary section.
9548 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9549 object and is_ordinary parameters. Change all callers.
9550 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9551 Change all callers. Don't add undefined or non-ordinary symbols
9553 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9555 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9557 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9558 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9559 (Sized_relobj::relocate_sections): Likewise.
9560 * target-reloc.h (scan_relocs): Adjust section symbol index.
9561 (scan_relocatable_relocs): Likewise.
9562 * i386.cc (Scan::local): Check for ordinary symbols.
9563 * sparc.cc (Scan::local): Likewise.
9564 * x86_64.cc (Scan::local): Likewise.
9565 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9566 to symbol_section_and_value.
9567 * testsuite/many_sections_test.cc: New file.
9568 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9569 (check_PROGRAMS): Add many_sections_test.
9570 (many_sections_test_SOURCES): Define.
9571 (many_sections_test_DEPENDENCIES): Define.
9572 (many_sections_test_LDFLAGS): Define.
9573 (BUILT_SOURCES): Add many_sections_define.h.
9574 (many_sections_define.h): New target.
9575 (BUILT_SOURCES): Add many_sections_check.h.
9576 (many_sections_check.h): New target.
9577 (check_PROGRAMS): Add many_sections_r_test.
9578 (many_sections_r_test_SOURCES): Define.
9579 (many_sections_r_test_DEPENDENCIES): Define.
9580 (many_sections_r_test_LDFLAGS): Define.
9581 (many_sections_r_test_LDADD): Define.
9582 (many_sections_r_test.o): New target.
9583 * testsuite/Makefile.in: Rebuild.
9585 2008-04-17 Cary Coutant <ccoutant@google.com>
9587 * errors.cc (Errors::info): New function.
9588 (gold_info): New function.
9589 * errors.h (Errors::info): New function.
9590 * gold.h (gold_info): New function.
9591 * object.cc (Input_objects::add_object): Print trace output.
9592 * options.cc (options::parse_set): New function.
9593 (General_options::parse_wrap): Deleted.
9594 (General_options::General_options): Deleted initializer.
9595 * options.h (options::String_set): New typedef.
9596 (options::parse_set): New function.
9597 (DEFINE_set): New macro.
9598 (General_options::wrap): Changed to use DEFINE_set. Changed
9599 callers of any_wrap_symbols and is_wrap_symbol.
9600 (General_options::trace, General_options::trace_symbol):
9602 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9603 (General_options::wrap_symbols_): Deleted.
9604 * symtab.cc (Symbol_table::add_from_object): Print trace output.
9606 2008-04-17 David S. Miller <davem@davemloft.net>
9608 * options.cc (General_options::parse_V): New function.
9609 * options.h: Add entries for -V and -Qy.
9611 2008-04-17 Ian Lance Taylor <iant@google.com>
9613 * common.cc (Symbol_table::allocate_commons): Remove options
9614 parameter. Change caller.
9615 (Symbol_table::do_allocate_commons): Remove options parameter.
9616 Change caller. Just call do_allocate_commons_list twice.
9617 (Symbol_table::do_allocate_commons_list): New function, broken out
9618 of do_allocate_commons.
9619 * common.h (class Allocate_commons_task): Remove options_ field.
9621 * symtab.cc (Symbol_table::Symbol_table): Initialize
9623 (Symbol_table::add_from_object): Put TLS common symbols on
9625 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9626 which are IN_OUTPUT_DATA.
9627 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
9628 allocate_commons and do_allocate_commons declarations. Declare
9629 do_allocate_commons_list.
9630 * gold.cc (queue_middle_tasks): Update creation of
9631 Allocate_commons_task to not pass options.
9632 * testsuite/Makefile.am (INCLUDES): Add -I.. .
9633 (TLS_TEST_C_FLAGS): New variable.
9634 (tls_test_c_pic.o): New target.
9635 (tls_test_shared.so): Link in tls_test_c_pic.o.
9636 (tls_test_c_pic_ie.o): New target.
9637 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9638 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9639 (tls_test_c.o): New target.
9640 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9641 (tls_pic_test_LDADD): Likewise.
9642 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9643 (tls_shared_gd_to_ie_test_LDADD): Likewise.
9644 (tls_test_c_gnu2.o): New target.
9645 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9647 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9648 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9649 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9650 * testsuite/tls_test.cc: Include "config.h".
9651 (t_last): Call t11_last.
9652 * testsuite/tls_test.h (t11, t11_last): Declare.
9653 * testsuite/tls_test_c.c: New file.
9654 * testsuite/tls_test_main.cc (thread_routine): Call t11.
9655 * configure.ac: Check for OpenMP support.
9656 * configure, config.in, Makefile.in: Rebuild.
9657 * testsuite/Makefile.in: Rebuild.
9659 2008-04-16 Cary Coutant <ccoutant@google.com>
9661 * i386.cc (Target_i386::define_tls_base_symbol): New function.
9662 (Target_i386::tls_base_symbol_defined_): New field.
9663 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9664 (Target_i386::Scan::global): Likewise.
9665 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9666 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9667 (Target_x86_64::tls_base_symbol_defined_): New field.
9668 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9669 (Target_x86_64::Scan::global): Likewise.
9671 2008-04-16 Cary Coutant <ccoutant@google.com>
9673 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9674 (Symbol::needs_plt_entry): Allow weak undefined symbols.
9675 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9676 building shared libraries.
9677 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9678 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9679 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9680 * testsuite/Makefile.in: Rebuild.
9681 * testsuite/weak_undef.h: New file.
9682 * testsuite/weak_undef_file1.cc: Add extra test cases.
9683 * testsuite/weak_undef_file2.cc: Likewise.
9684 * testsuite/weak_undef_test.cc: Likewise.
9686 2008-04-16 David S. Miller <davem@davemloft.net>
9688 * sparc.cc (Target_sparc::Scan): Change from struct to class.
9689 Add issued_non_pic_error_ field. Declare check_non_pic.
9690 (Target_sparc::Scan::check_non_pic): New function.
9691 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9692 (Target_sparc::Scan::global): Likewise.
9694 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9695 * configure: Rebuild.
9697 * options.h (DEFINE_enable): New macro.
9698 (new_dtags): New enable option.
9699 (initfirst, interpose, loadfltr, nodefaultlib,
9700 nodelete, nodlopen, nodump): New -z options.
9701 * layout.cc (Layout:finish_dynamic_section): If new
9702 dtags enabled, emit DT_RUNPATH. Also, emit a
9703 DT_FLAGS_1 containing any specified -z flags.
9705 2008-04-16 Ian Lance Taylor <iant@google.com>
9707 * copy-relocs.cc: New file.
9708 * copy-relocs.h: New file.
9709 * reloc.cc: Remove Copy_relocs code.
9710 * reloc.h: Likewise.
9711 * reloc-types.h (struct Reloc_types) [both versions]: Add
9712 get_reloc_addend_noerror.
9713 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9714 variants of add_global which take an addend which must be zero.
9715 * i386.cc: Include "copy-relocs.h".
9716 (class Target_i386): Change type of copy_relocs_ to variable,
9718 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9720 (Target_i386::do_finalize_sections): Change handling of
9722 * sparc.cc: Include "copy-relocs.h".
9723 (class Target_sparc): Change type of copy_relocs_ to variable,
9725 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9727 (Target_sparc::do_finalize_sections): Change handling of
9729 * x86_64.cc: Include "copy-relocs.h".
9730 (class Target_x86_64): Change type of copy_relocs_ to variable,
9732 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9733 class. Change all callers.
9734 (Target_x86_64::do_finalize_sections): Change handling of
9736 * Makefile.am (CCFILES): Add copy-relocs.cc.
9737 (HFILES): Add copy-relocs.h.
9739 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9741 * testsuite/script_test_4.sh: Permit leading zeroes.
9743 2008-04-15 Ian Lance Taylor <iant@google.com>
9745 * script-sections.cc (Script_sections::create_segments): Use
9746 header_size_adjustment even when there is enough room for the
9748 * testsuite/script_test_4.sh: New file.
9749 * testsuite/script_test_4.t: New file.
9750 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9751 (check_DATA): Add script_test_4.stdout.
9752 (MOSTLYCLEANFILES): Likewise.
9753 (script_test_4): New target.
9754 (script_test_4.stdout): New target.
9755 * testsuite/Makefile.in: Rebuild.
9757 * sparc.cc: Add definitions for Output_data_plt_sparc class
9760 2008-04-14 David S. Miller <davem@davemloft.net>
9762 * sparc.cc: New file.
9763 * Makefile.am (TARGETSOURCES): Add sparc.cc
9764 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9765 * configure.tgt: Document targ_extra_size and
9766 targ_extra_big_endian. Add entries for sparc-* and
9768 * configure.ac: Handle targ_extra_size and
9769 targ_extra_big_endian.
9770 * Makefile.in: Rebuild.
9771 * configure: Likewise.
9772 * po/POTFILES.in: Likewise.
9773 * po/gold.pot: Likewise.
9775 2008-04-14 Ian Lance Taylor <iant@google.com>
9777 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9778 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9779 in the name/type/flags to section mapping. Don't call
9780 allocate_output_section.
9781 (Layout::choose_output_section): Change parameter from adjust_name
9782 to is_input_section. Don't permit input sections after sections
9783 are attached to segments. Don't call allocate_output_section.
9784 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9785 not write_enable_output_section.
9786 (Layout::make_output_section): Don't push to
9787 unattached_section_list_ nor call attach_to_segment. Call
9788 attach_section_to_segment if sections are attached.
9789 (Layout::attach_sections_to_segments): New function.
9790 (Layout::attach_section_to_segment): New function.
9791 (Layout::attach_allocated_section_to_segment): Rename from
9792 attach_to_segment. Remove flags parameter.
9793 (Layout::allocate_output_section): Remove function.
9794 (Layout::write_enable_output_section): Remove function.
9795 * layout.h (class Layout): Update for above changes. Add new
9796 field sections_are_attached_.
9797 * output.h (Output_section::update_flags_for_input_section): New
9799 * output.cc (Output_section::add_input_section): Call
9800 update_flags_for_input_section.
9801 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9803 2008-04-11 Cary Coutant <ccoutant@google.com>
9805 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9806 thought unnecessary.
9807 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9809 2008-04-11 Ian Lance Taylor <iant@google.com>
9811 * output.h (class Output_section_data): Remove inline definition
9813 * output.cc (Output_section_data::set_addralign): New function.
9815 2008-04-11 Cary Coutant <ccoutant@google.com>
9817 Add support for TLS descriptors for i386 and x86_64.
9818 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9819 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9820 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9822 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9823 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9824 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9826 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9827 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9828 Fix problem with initial-exec relocations.
9829 (Target_i386::Relocate::relocate_tls): Likewise.
9830 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9832 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9833 support for section-plus-offset dynamic table entries.
9834 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9835 (Output_data_dynamic::Dynamic_entry): Add support for
9836 section-plus-offset dynamic table entries.
9837 (Output_data_dynamic::Classification): Likewise.
9838 (Output_data_dynamic::classification_): Renamed offset_.
9839 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9840 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9841 (Target_x86_64::make_plt_section): New function.
9842 (Target_x86_64::reserve_tlsdesc_entries): New function.
9843 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9844 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9845 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9846 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9847 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9848 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9849 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9850 add extra PLT entry for TLS descriptors.
9851 (Output_data_plt_x86_64::got_): New field.
9852 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9853 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9855 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9857 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9858 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9859 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9860 R_386_TLS_DESC_CALL relocations.
9861 (Target_x86_64::Scan::global): Likewise.
9862 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9863 for TLS descriptors.
9864 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9865 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9866 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9867 GD-to-IE relaxation.
9868 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9869 and TLS_DESCRIPTORS.
9870 * Makefile.in: Rebuild.
9871 * configure: Rebuild.
9872 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9873 (tls_test_shared2.so): New target.
9874 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9875 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9876 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9877 (tls_shared_gd_to_ie_test_LDADD): New variable.
9878 (tls_shared_gnu2_gd_to_ie_test): New target.
9879 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9881 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9882 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9883 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9884 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9885 (tls_shared_gnu2_test): New target.
9886 (tls_test_gnu2_shared.so): New target.
9887 (tls_shared_gnu2_test_SOURCES): New variable.
9888 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9889 (tls_shared_gnu2_test_LDFLAGS): New variable.
9890 (tls_shared_gnu2_test_LDADD): New variable.
9891 * testsuite/Makefile.in: Rebuild.
9892 * testsuite/Makefile.
9894 2008-04-11 Ian Lance Taylor <iant@google.com>
9896 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9898 * testsuite/Makefile.in: Rebuild.
9900 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9902 * testsuite/script_test_2.cc (main): Adjust test.
9904 2008-04-11 David S. Miller <davem@davemloft.net>
9905 Ian Lance Taylor <iant@google.com>
9907 * options.h (General_options): Add entries for '-Y' and
9909 * options.cc (General_options:finalize): If -Y was used, add those
9910 entries to the library path instead of the default "/lib" and
9913 2008-04-11 David S. Miller <davem@davemloft.net>
9915 * testsuite/justsyms.t: Start at 0x100.
9916 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9917 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9919 * testsuite/script_test_2.cc: Adjust string and section length
9922 2008-04-09 Ian Lance Taylor <iant@google.com>
9925 * script-sections.cc (Sections_element::allocate_to_segment): Add
9927 (Output_section_definition::allocate_to_segment): Likewise.
9928 (Orphan_output_section::allocate_to_segment): Likewise.
9929 (Script_sections::attach_sections_using_phdrs_clause): Don't
9930 propagate non-PT_LOAD segments to orphan sections.
9931 * testsuite/Makefile.am (script_test_3.stdout): Generate using
9932 readelf rather than objdump.
9933 * testsuite/script_test_3.sh: Adjust accordingly. Test that
9934 .interp section and PT_INTERP segment are the same size.
9935 * testsuite/Makefile.in: Rebuild.
9937 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9938 aliases for symbols defined in the same object.
9939 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9940 (weak_alias_test_SOURCES): New variable.
9941 (weak_alias_test_DEPENDENCIES): New variable.
9942 (weak_alias_test_LDFLAGS): New variable.
9943 (weak_alias_test_LDADD): New variable.
9944 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9945 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9946 (weak_alias_test_3.o): New target.
9947 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9948 * testsuite/weak_alias_test_main.cc: New file.
9949 * testsuite/weak_alias_test_1.cc: New file.
9950 * testsuite/weak_alias_test_2.cc: New file.
9951 * testsuite/weak_alias_test_3.cc: New file.
9953 2008-04-08 Ian Lance Taylor <iant@google.com>
9955 * options.h (class General_options): Add --noinhibit-exec option.
9956 * main.cc (main): Check --noinhibit-exec.
9958 * options.h (class General_options): Define --wrap as a special
9959 option. Add wrap_symbols_ field.
9960 (General_options::any_wrap_symbols): New function.
9961 (General_options::is_wrap_symbol): New function.
9962 * options.cc (General_options::parse_wrap): New function.
9963 (General_options::General_options): Initialize wrap_symbols_.
9964 * symtab.cc (Symbol_table::wrap_symbol): New function.
9965 (Symbol_table::add_from_object): Handle --wrap.
9966 * symtab.h (class Symbol_table): Declare wrap_symbol.
9967 * target.h (Target::wrap_char): New function.
9968 (Target::Target_info): Add wrap_char field.
9969 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9970 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9971 * testsuite/testfile.cc (Target_test::test_target_info):
9974 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9977 * layout.h (class Layout): Add added_eh_frame_data_ field.
9978 * layout.cc (Layout::Layout): Initialize new field.
9979 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9980 output section until we find a section we merged successfully.
9981 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9982 that the size be non-zero.
9984 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9987 2008-04-08 Craig Silverstein <csilvers@google.com>
9989 * configure.ac: Export new conditional variable HAVE_ZLIB.
9990 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9992 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9993 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9995 2008-04-07 Ian Lance Taylor <iant@google.com>
9997 * version.cc (version_string): Set to "1.5".
9999 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10000 Add issued_non_pic_error_ field. Declare check_non_pic.
10001 (Target_x86_64::Scan::check_non_pic): New function.
10002 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10003 (Target_x86_64::Scan::global): Likewise.
10005 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10006 addend parameter. Change caller. Handle merge sections.
10007 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10008 Address to Addend. Don't add in the result of
10009 local_section_offset, pass down the addend and use the returned
10011 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10012 Update declarations of local_section_offset and symbol_value.
10013 * testsuite/two_file_test_1.cc (t18): New function.
10014 * testsuite/two_file_test_2.cc (f18): New function.
10015 * testsuite/two_file_test_main.cc (main): Call t18.
10016 * testsuite/two_file_test.h (t18, f18): Declare.
10018 * configure.ac: Don't test for objdump, c++filt, or readelf.
10019 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10021 (TEST_READELF): New variable.
10022 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10023 (check_PROGRAMS): Add two_file_strip_test.
10024 (two_file_strip_test): New target.
10025 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10026 (two_file_same_shared_strip_test_SOURCES): New variable.
10027 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10028 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10029 (two_file_same_shared_strip_test_LDADD): New variable.
10030 (two_file_shared_strip.so): New target.
10031 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10032 (ver_test_5.syms, ver_test_7.syms): Likewise.
10033 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10034 (strip_test_3.stdout): Use TEST_OBJDUMP.
10035 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10037 2008-04-04 Cary Coutant <ccoutant@google.com>
10039 * symtab.h (Symbol::is_weak_undefined): New function.
10040 (Symbol::is_strong_undefined): New function.
10041 (Symbol::is_absolute): New function.
10042 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10043 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10045 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10046 (weak_undef_test): New target.
10047 * testsuite/Makefile.in: Rebuild.
10048 * testsuite/weak_undef_file1.cc: New file.
10049 * testsuite/weak_undef_file2.cc: New file.
10050 * testsuite/weak_undef_test.cc: New file.
10052 2008-04-03 Craig Silverstein <csilvers@google.com>
10054 * compressed_output.h (class Output_compressed_section): Use
10056 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10058 (zlib_compressed_suffix): Removed.
10059 (Output_compressed_section::set_final_data_size): Use unsigned
10061 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10062 Fix linker invocation.
10063 (flagstest_o_specialfile_and_compress_debug_sections):
10065 * testsuite/Makefile.in: Regenerated.
10067 2008-04-02 David S. Miller <davem@davemloft.net>
10069 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10070 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10072 2008-04-02 Craig Silverstein <csilvers@google.com>
10076 2008-04-02 Ian Lance Taylor <iant@google.com>
10078 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10079 parameters. Update for new key type to views_. Change all
10081 (File_read::read): Adjust for byteshift in returned view.
10082 (File_read::add_view): New function, broken out of
10083 find_and_make_view.
10084 (File_read::make_view): New function, broken out of
10085 find_and_make_view.
10086 (File_read::find_or_make_view): Add offset and aligned
10087 parameters. Rewrite accordingly. Change all callers.
10088 (File_read::get_view): Add offset and aligned parameters. Adjust
10089 for byteshift in return value.
10090 (File_read::get_lasting_view): Likewise.
10091 * fileread.h (class File_read): Update declarations.
10092 (class File_read::View): Add byteshift_ field. Add byteshift to
10093 constructor. Add byteshift method.
10094 * archive.h (Archive::clear_uncached_views): New function.
10095 (Archive::get_view): Add aligned parameter. Change all callers.
10096 * object.h (Object::get_view): Add aligned parameter. Change all
10098 (Object::get_lasting_view): Likewise.
10100 * fileread.cc (File_read::release): Don't call clear_views if
10101 there are multiple objects.
10102 * fileread.h (File_read::clear_uncached_views): New function.
10103 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10106 2008-03-31 Cary Coutant <ccoutant@google.com>
10108 Add thin archive support.
10109 * archive.cc (Archive::armagt): New const.
10110 (Archive::setup): Remove task parameter and calls to unlock.
10111 (Archive::unlock_nested_archives): New function.
10112 (Archive::read_header): Add nested_off parameter. Change
10114 (Archive::interpret_header): Likewise.
10115 (Archive::include_all_members): Change to handle thin
10117 (Archive::include_member): Likewise.
10118 * archive.h (Archive::Archive): Add new parameters and
10120 (Archive::armagt): New const.
10121 (Archive::setup): Remove task parameter.
10122 (Archive::unlock_nested_archives): New function.
10123 (Archive::read_header): Add nested_off parameter.
10124 (Archive::interpret_header): Likewise.
10125 (Archive::Nested_archive_table): New typedef.
10126 (Archive::is_thin_archive_): New field.
10127 (Archive::nested_archives_): New field.
10128 (Archive::options_): New field.
10129 (Archive::dirpath_): New field.
10130 (Archive::task_): New field.
10131 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10132 for thin archives. Pass additional parameters to
10133 Archive::Archive. Unlock the archive file after calling
10136 2008-03-29 Ian Lance Taylor <iant@google.com>
10138 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10139 version symbol to be local.
10140 * testsuite/ver_test_4.sh: New file.
10141 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10142 (check_DATA): Add ver_test_4.syms.
10143 (ver_test_4.syms): New target.
10144 * testsuite/Makefile.in: Rebuild.
10147 (Output_section::Input_section_sort_entry::has_priority): New
10149 (Output_section::Input_section_sort_entry::match_file_name): New
10151 (Output_section::Input_section_sort_entry::match_section_name):
10153 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10155 (Output_section::Input_section_sort_entry::match_section_file):
10157 (Output_section::Input_section_sort_compare::operator()): Rewrite
10158 using new Input_section_sort_entry functions. Sort crtbegin and
10159 crtend first. Sort sections with no priority before sections with
10161 * testsuite/initpri1.c (d3): Check j != 4.
10162 (cd5): New constructor/destructor function.
10163 (main): Check j != 2.
10165 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10166 new symbol when resolving, don't call set_is_default.
10167 * testsuite/ver_test_7.cc: New file.
10168 * testsuite/ver_test_7.sh: New file.
10169 * testsuite/Makefile.am (ver_test_7.so): New target.
10170 (ver_test_7.o): New target.
10171 (check_SCRIPTS): Add ver_test_7.sh.
10172 (check_DATA): Add ver_test_7.syms.
10173 (ver_test_7.syms): New target.
10175 2008-03-28 Ian Lance Taylor <iant@google.com>
10177 * layout.cc (Layout::layout): If we see an input section with a
10178 name that needs sorting, set the must_sort flag for the output
10180 (Layout::make_output_section): If the name of the output section
10181 indicates that it might require sorting, set the may_sort flag.
10182 * output.h (Output_section::may_sort_attached_input_sections): New
10184 (Output_section::set_may_sort_attached_input_sections): New
10186 (Output_section::must_sort_attached_input_sections): New
10188 (Output_section::set_must_sort_attached_input_sections): New
10190 (class Output_section): Declare Input_section_sort_entry. Define
10191 Input_section_sort_compare. Declare
10192 sort_attached_input_sections. Add new fields:
10193 may_sort_attached_input_sections_,
10194 must_sort_attached_input_sections_,
10195 attached_input_sections_are_sorted_.
10196 * output.cc (Output_section::Output_section): Initialize new
10198 (Output_section::add_input_section): Add an entry to
10199 input_sections_ if may_sort or must_sort are true.
10200 (Output_section::set_final_data_size): Call
10201 sort_attached_input_sections if necessary.
10202 (Output_section::Input_section_sort_entry): Define new class.
10203 (Output_section::Input_section_sort_compare::operator()): New
10205 (Output_section::sort_attached_input_sections): New function.
10206 * configure.ac: Check whether the compiler supports constructor
10207 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10208 * testsuite/initpri1.c: New file.
10209 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10210 CONSTRUCTOR_PRIORITY.
10211 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10212 (initpri1_LDFLAGS): New variable.
10213 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10215 2008-03-27 Ian Lance Taylor <iant@google.com>
10217 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10218 * testsuite/common_test_1.c: New file.
10219 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10220 (common_test_1_SOURCES): New variable.
10221 (common_test_1_DEPENDENCIES): New variable.
10222 (common_test_1_LDFLAGS): New variable.
10224 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10225 and commons_ correctly when NAME/VERSION does not override
10227 * testsuite/ver_test_6.c: New file.
10228 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10229 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10230 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10232 2008-03-26 Ian Lance Taylor <iant@google.com>
10234 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10235 of an undefined symbol from a version script.
10236 * testsuite/Makefile.am (ver_test_5.so): New target.
10237 (ver_test_5.o): New target.
10238 (check_SCRIPTS): Add ver_test_5.sh.
10239 (check_DATA): Add ver_test_5.syms.
10240 (ver_test_5.syms): New target.
10241 * testsuite/ver_test_5.cc: New file.
10242 * testsuite/ver_test_5.script: New file.
10243 * testsuite/ver_test_5.sh: New file.
10244 * Makefile.in, testsuite/Makefile.in: Rebuild.
10247 Fix problems building gold with gcc 4.3.0.
10248 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10249 (gold_error_at_location, gold_warning_at_location): Use it.
10250 * configure.ac: Check whether we can compile and use a template
10251 function with a printf attribute.
10252 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10253 when jumping over bytes.
10254 * object.cc: Instantiate Object::read_section_data.
10255 * debug.h: Include <cstring>
10256 * dwarf_reader.cc: Include <algorithm>
10257 * main.cc: Include <cstring>.
10258 * options.cc: Include <cstring>.
10259 * output.cc: Include <cstring>.
10260 * script.cc: Include <cstring>.
10261 * script.h: Include <string>.
10262 * symtab.cc: Include <cstring> and <algorithm>.
10263 * target-select.cc: Include <cstring>.
10264 * version.cc: Include <string>.
10265 * testsuite/testmain.cc: Include <cstdlib>.
10266 * configure, config.in: Rebuild.
10268 2008-03-25 Ian Lance Taylor <iant@google.com>
10270 * options.cc: Include "../bfd/bfdver.h".
10271 (options::help): Print bug reporting address.
10273 * version.cc (print_version): Adjust output for current value of
10274 BFD_VERSION_STRING.
10278 * options.cc (options::help): Print list of supported targets.
10279 * target-select.h: Include <vector>.
10280 (class Target_selector): Make machine_, size_, and is_big_endian_
10281 fields const. Add bfd_name_ and instantiated_target_ fields.
10282 (Target_selector::Target_selector): Add bfd_name parameter.
10283 (Target_selector::recognize): Make non-virtual, call
10285 (Target_selector::recognize_by_name): Make non-virtual, call
10286 do_recognize_by_name.
10287 (Target_selector::supported_names): New function.
10288 (Target_selector::bfd_name): New function.
10289 (Target_selector::do_instantiate_target): New pure virtual
10291 (Target_selector::do_recognize): New virtual function.
10292 (Target_selector::do_recognize_by_name): New virtual function.
10293 (Target_selector::instantiate_target): New private function.
10294 (supported_target_names): Declare.
10295 * target-select.cc (Target_selector::Target_selector): Update for
10296 new parameter and fields.
10297 (select_target_by_name): Check that the name matches before
10298 calling recognize_by_name.
10299 (supported_target_names): New function.
10300 * i386.cc (class Target_selector_i386): Update Target_selector
10301 constructor call. Remove recognize and recognize_by_name. Add
10302 do_instantiate_target.
10303 * x86_64.cc (class Target_selector_x86_64): Likewise.
10304 * testsuite/testfile.cc (class Target_selector_test): Update for
10305 changes to Target_selector.
10307 * README: Rewrite, with some notes on unsupported features.
10309 2008-03-24 Cary Coutant <ccoutant@google.com>
10311 * i386.cc (Target_i386::Got_type): New enum declaration.
10312 (Target_i386::Scan::local): Updated callers of Output_data_got
10314 (Target_i386::Scan::global): Likewise.
10315 (Target_i386::Relocate::relocate): Likewise.
10316 (Target_i386::Relocate::relocate_tls): Likewise.
10317 * object.h (Got_offset_list): New class.
10318 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10319 (Sized_relobj::local_got_offset): Likewise.
10320 (Sized_relobj::set_local_got_offset): Likewise.
10321 (Sized_relobj::local_has_tls_got_offset): Removed.
10322 (Sized_relobj::local_tls_got_offset): Removed.
10323 (Sized_relobj::set_local_tls_got_offset): Removed.
10324 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10325 * output.cc (Output_data_got::add_global): Added got_type parameter.
10326 (Output_data_got::add_global_with_rel): Likewise.
10327 (Output_data_got::add_global_with_rela): Likewise.
10328 (Output_data_got::add_global_pair_with_rel): New function.
10329 (Output_data_got::add_global_pair_with_rela): New function.
10330 (Output_data_got::add_local): Added got_type parameter.
10331 (Output_data_got::add_local_with_rel): Likewise.
10332 (Output_data_got::add_local_with_rela): Likewise.
10333 (Output_data_got::add_local_pair_with_rel): New function.
10334 (Output_data_got::add_local_pair_with_rela): New function.
10335 (Output_data_got::add_global_tls): Removed.
10336 (Output_data_got::add_global_tls_with_rel): Removed.
10337 (Output_data_got::add_global_tls_with_rela): Removed.
10338 (Output_data_got::add_local_tls): Removed.
10339 (Output_data_got::add_local_tls_with_rel): Removed.
10340 (Output_data_got::add_local_tls_with_rela): Removed.
10341 * output.h (Output_data_got::add_global): Added got_type parameter.
10342 (Output_data_got::add_global_with_rel): Likewise.
10343 (Output_data_got::add_global_with_rela): Likewise.
10344 (Output_data_got::add_global_pair_with_rel): New function.
10345 (Output_data_got::add_global_pair_with_rela): New function.
10346 (Output_data_got::add_local): Added got_type parameter.
10347 (Output_data_got::add_local_with_rel): Likewise.
10348 (Output_data_got::add_local_with_rela): Likewise.
10349 (Output_data_got::add_local_pair_with_rel): New function.
10350 (Output_data_got::add_local_pair_with_rela): New function.
10351 (Output_data_got::add_global_tls): Removed.
10352 (Output_data_got::add_global_tls_with_rel): Removed.
10353 (Output_data_got::add_global_tls_with_rela): Removed.
10354 (Output_data_got::add_local_tls): Removed.
10355 (Output_data_got::add_local_tls_with_rel): Removed.
10356 (Output_data_got::add_local_tls_with_rela): Removed.
10357 * resolve.cc (Symbol::override_base_with_special): Removed
10358 reference to has_got_offset_ field.
10359 * symtab.cc (Symbol::init_fields): Replaced initialization
10360 of got_offset_ with got_offsets_. Removed initialization
10362 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10363 (Symbol::got_offset): Likewise.
10364 (Symbol::set_got_offset): Likewise.
10365 (Symbol::has_tls_got_offset): Removed.
10366 (Symbol::tls_got_offset): Removed.
10367 (Symbol::set_tls_got_offset): Removed.
10368 (Symbol::got_offset_): Removed.
10369 (Symbol::tls_mod_got_offset_): Removed.
10370 (Symbol::tls_pair_got_offset_): Removed.
10371 (Symbol::got_offsets_): New field.
10372 (Symbol::has_got_offset): Removed.
10373 (Symbol::has_tls_mod_got_offset): Removed.
10374 (Symbol::has_tls_pair_got_offset): Removed.
10375 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10376 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10378 (Target_x86_64::Scan::global): Likewise.
10379 (Target_x86_64::Relocate::relocate): Likewise.
10380 (Target_x86_64::Relocate::relocate_tls): Likewise.
10382 2008-03-25 Ben Elliston <bje@au.ibm.com>
10384 * yyscript.y: Fix spelling error in comment.
10386 2008-03-24 Ian Lance Taylor <iant@google.com>
10388 * options.h (class General_options): Define build_id option.
10389 * layout.h (class Layout): Declare write_build_id, create_note,
10390 create_build_id. Add build_id_note_ member.
10391 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10392 "libiberty.h", "md5.h", "sha1.h".
10393 (Layout::Layout): Initialize eh_frame_data_,
10394 eh_frame_hdr_section_, and build_id_note_.
10395 (Layout::finalize): Call create_build_id.
10396 (Layout::create_note): New function, broken out of
10397 Layout::create_gold_note.
10398 (Layout::create_gold_note): Call create_note.
10399 (Layout::create_build_id): New function.
10400 (Layout::write_build_id): New function.
10401 (Close_task_runner::run): Call write_build_id.
10403 * x86_64.cc: Correct license to GPLv3.
10405 2008-03-23 Ian Lance Taylor <iant@google.com>
10407 * options.cc: Include "demangle.h".
10408 (parse_optional_string): New function.
10409 (parse_long_option): Handle takes_optional_argument.
10410 (parse_short_option): Update dash_z initializer. Handle
10411 takes_optional_argument.
10412 (General_options::General_options): Initialize do_demangle_.
10413 (General_options::finalize): Set do_demangle_. Handle demangling
10415 * options.h (parse_optional_string): Declare.
10416 (struct One_option): Add optional_arg field. Update constructor.
10417 Update call constructor calls. Add takes_optional_argument
10419 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10420 (DEFINE_optional_string): Define.
10421 (General_options::demangle): Change from DEFINE_bool to
10422 DEFINE_optional_string.
10423 (General_options::no_demangle): New function.
10424 (General_options::do_demangle): New function.
10425 (General_options::set_do_demangle): New function.
10426 (General_options::execstack_status_): Move definition to end of
10428 (General_options::static_): Likewise.
10429 (General_options::do_demangle_): New field.
10430 * object.cc (big_endian>::get_symbol_location_info): Call
10431 Options::do_demangle, not Options::demangle.
10432 * symtab.cc (demangle): Likewise.
10434 2008-03-22 Ian Lance Taylor <iant@google.com>
10436 * gold.h: Include <cstddef> and <sys/types.h>
10437 * options.h: Include <cstring>.
10439 2008-03-21 Ian Lance Taylor <iant@google.com>
10441 * Added source code to GNU binutils.