1 2011-04-17 Ian Lance Taylor <iant@google.com>
3 * object.cc (Relocate_info::location): Simplify location string.
4 * errors.cc (Errors::error_at_location): Don't print program
6 (Errors::warning_at_location): Likewise.
7 (Errors::undefined_symbol): Likewise.
8 * testsuite/debug_msg.sh: Update accordingly.
10 2011-04-14 Cary Coutant <ccoutant@google.com>
12 * gold/layout.cc (Layout::symtab_section_offset): New function.
13 * gold/layout.h (Layout::symtab_section_offset): New function.
14 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
16 2011-04-12 Ian Lance Taylor <iant@google.com>
18 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
20 * output.h (class Output_file): Add map_is_allocated_ field.
21 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
22 not available, provide stubs. If mremap is not available, #define
24 (MREMAP_MAYMOVE): Define if not defined.
25 (Output_file::Output_file): Initialize map_is_allocated_.
26 (Output_file::resize): Check map_is_allocated_.
27 (Output_file::map_anonymous): If mmap fails, use malloc.
28 (Output_file::unmap): Don't do anything for an anonymous map.
29 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
30 is not available, provide stubs.
31 (File_read::View::~View): Use free rather than delete[].
32 (File_read::make_view): Use malloc rather than new[]. If mmap
34 (File_read::find_or_make_view): Use malloc rather than new[].
35 * gold.h: Remove HAVE_REMAP code.
36 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
37 exists. Rename mremap to gold_mremap. If mmap is not available
39 * configure, config.in: Rebuild.
41 2011-04-11 Ian Lance Taylor <iant@google.com>
43 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
44 initialize local variable v.
46 2011-04-11 Cary Coutant <ccoutant@google.com>
48 * archive.cc (Archive::include_member): Adjust call to
50 (Add_archive_symbols::run): Track argument serial numbers.
51 (Lib_group::include_member): Likewise.
52 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
53 * archive.h (Incremental_archive_entry::Archive_member):
54 Initialize arg_serial_.
55 (Archive_member::arg_serial_): New data member.
56 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
57 (Sized_dynobj::do_add_symbols): Track symbols when doing an
59 (Sized_dynobj::do_for_all_local_got_entries): New function.
60 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
62 * fileread.cc (get_mtime): New function.
63 * fileread.h (get_mtime): New function.
64 * gold.cc (queue_initial_tasks): Check for incremental update.
65 (process_incremental_input): New function.
66 (queue_middle_tasks): Don't force valid target for incremental
68 * incremental-dump.cc (find_input_containing_global): Adjust
69 size of symbol info entry.
70 (dump_incremental_inputs): Dump argument serial number and
71 in_system_directory flag; bias shndx by 1; print symbol names
72 when dumping per-file symbol lists; use new symbol info readers.
74 (Output_section_incremental_inputs:update_data_size): New function.
75 (Sized_incremental_binary::setup_readers): Setup input readers
76 for each input file; build maps for files added from libraries
78 (Sized_incremental_binary::check_input_args): New function.
79 (Sized_incremental_binary::do_check_inputs): Build map of argument
80 serial numbers to input arguments.
81 (Sized_incremental_binary::do_file_has_changed): Rename
82 do_file_is_unchanged to this; compare file modification times.
83 (Sized_incremental_binary::do_init_layout): New function.
84 (Sized_incremental_binary::do_reserve_layout): New function.
85 (Sized_incremental_binary::do_get_input_reader): Remove.
86 (Sized_incremental_binary::get_symtab_view): New function.
87 (Incremental_checker::can_incrementally_link_output_file): Remove.
88 (Incremental_inputs::report_command_line): Exclude --debug options.
89 (Incremental_inputs::report_archive_begin): Add parameter; track
90 argument serial numbers; don't put input file entry for archive
91 before archive members.
92 (Incremental_inputs::report_archive_end): Put input file entry
93 for archive after archive members.
94 (Incremental_inputs::report_object): Add parameter; track argument
95 serial numbers and in_system_directory flag.
96 (Incremental_inputs::report_script): Add parameter; track argument
98 (Output_section_incremental_inputs::set_final_data_size): Adjust
99 size of symbol info entry; check for forwarding symbols.
100 (Output_section_incremental_inputs::write_input_files): Write
101 in_system_directory flag and argument serial number.
102 (Output_section_incremental_inputs::write_info_blocks): Map section
103 indices between incremental info and original input file; store
104 input section index for each symbol.
105 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
106 change operator() to visit().
107 (class Global_got_offset_visitor): Likewise.
108 (class Global_symbol_visitor_got_plt):
109 (Output_section_incremental_inputs::write_got_plt): Use new visitor
111 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
112 (Sized_incr_relobj::do_read_symbols): New function.
113 (Sized_incr_relobj::do_layout): New function.
114 (Sized_incr_relobj::do_layout_deferred_sections): New function.
115 (Sized_incr_relobj::do_add_symbols): New function.
116 (Sized_incr_relobj::do_should_include_member): New function.
117 (Sized_incr_relobj::do_for_all_global_symbols): New function.
118 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
119 (Sized_incr_relobj::do_section_size): New function.
120 (Sized_incr_relobj::do_section_name): New function.
121 (Sized_incr_relobj::do_section_contents): New function.
122 (Sized_incr_relobj::do_section_flags): New function.
123 (Sized_incr_relobj::do_section_entsize): New function.
124 (Sized_incr_relobj::do_section_address): New function.
125 (Sized_incr_relobj::do_section_type): New function.
126 (Sized_incr_relobj::do_section_link): New function.
127 (Sized_incr_relobj::do_section_info): New function.
128 (Sized_incr_relobj::do_section_addralign): New function.
129 (Sized_incr_relobj::do_initialize_xindex): New function.
130 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
131 (Sized_incr_relobj::do_read_relocs): New function.
132 (Sized_incr_relobj::do_gc_process_relocs): New function.
133 (Sized_incr_relobj::do_scan_relocs): New function.
134 (Sized_incr_relobj::do_count_local_symbols): New function.
135 (Sized_incr_relobj::do_finalize_local_symbols): New function.
136 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
137 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
138 (Sized_incr_relobj::do_relocate): New function.
139 (Sized_incr_relobj::do_set_section_offset): New function.
140 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
141 (Sized_incr_dynobj::do_read_symbols): New function.
142 (Sized_incr_dynobj::do_layout): New function.
143 (Sized_incr_dynobj::do_add_symbols): New function.
144 (Sized_incr_dynobj::do_should_include_member): New function.
145 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
146 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
147 (Sized_incr_dynobj::do_section_size): New function.
148 (Sized_incr_dynobj::do_section_name): New function.
149 (Sized_incr_dynobj::do_section_contents): New function.
150 (Sized_incr_dynobj::do_section_flags): New function.
151 (Sized_incr_dynobj::do_section_entsize): New function.
152 (Sized_incr_dynobj::do_section_address): New function.
153 (Sized_incr_dynobj::do_section_type): New function.
154 (Sized_incr_dynobj::do_section_link): New function.
155 (Sized_incr_dynobj::do_section_info): New function.
156 (Sized_incr_dynobj::do_section_addralign): New function.
157 (Sized_incr_dynobj::do_initialize_xindex): New function.
158 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
159 (make_sized_incremental_object): New function.
160 (Incremental_library::copy_unused_symbols): New function.
161 (Incremental_library::do_for_all_unused_symbols): New function.
162 * incremental.h (enum Incremental_input_flags): New type.
163 (class Incremental_checker): Remove.
164 (Incremental_input_entry::Incremental_input_entry): Add argument
166 (Incremental_input_entry::arg_serial): New function.
167 (Incremental_input_entry::set_is_in_system_directory): New function.
168 (Incremental_input_entry::is_in_system_directory): New function.
169 (Incremental_input_entry::arg_serial_): New data member.
170 (Incremental_input_entry::is_in_system_directory_): New data member.
171 (class Script_info): Move here from script.h.
172 (Script_info::Script_info): Add filename parameter.
173 (Script_info::filename): New function.
174 (Script_info::filename_): New data member.
175 (Incremental_script_entry::Incremental_script_entry): Add argument
177 (Incremental_object_entry::Incremental_object_entry): Likewise.
178 (Incremental_object_entry::add_input_section): Build list of input
179 sections with map to original shndx.
180 (Incremental_object_entry::get_input_section_index): New function.
181 (Incremental_object_entry::shndx_): New data member.
182 (Incremental_object_entry::name_key_): Rename; adjust all refs.
183 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
184 (Incremental_archive_entry::Incremental_archive_entry): Add argument
186 (Incremental_inputs::report_archive_begin): Likewise.
187 (Incremental_inputs::report_object): Likewise.
188 (Incremental_inputs::report_script): Likewise.
189 (class Incremental_global_symbol_reader): New class.
190 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
191 and store flags and input file type.
192 (Incremental_input_entry_reader::arg_serial): New function.
193 (Incremental_input_entry_reader::type): Extract type from flags.
194 (Incremental_input_entry_reader::is_in_system_directory): New function.
195 (Incremental_input_entry_reader::get_input_section_count): Call
196 accessor function for type.
197 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
198 function for type; adjust size of global symbol entry.
199 (Incremental_input_entry_reader::get_global_symbol_count): Call
200 accessor function for type.
201 (Incremental_input_entry_reader::get_object_count): Likewise.
202 (Incremental_input_entry_reader::get_object_offset): Likewise.
203 (Incremental_input_entry_reader::get_member_count): Likewise.
204 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
205 (Incremental_input_entry_reader::get_member_offset): Likewise.
206 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
207 (Incremental_input_entry_reader::Global_symbol_info): Remove.
208 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
209 (Incremental_input_entry_reader::get_global_symbol_reader): New
211 (Incremental_input_entry_reader::get_output_symbol_index): New
213 (Incremental_input_entry_reader::type_): Remove.
214 (Incremental_input_entry_reader::flags_): New data member.
215 (Incremental_inputs_reader::input_file_offset): New function.
216 (Incremental_inputs_reader::input_file_index): New function.
217 (Incremental_inputs_reader::input_file): Call input_file_offset.
218 (Incremental_inputs_reader::input_file_at_offset): New function.
219 (Incremental_relocs_reader::get_r_type): Reformat.
220 (Incremental_relocs_reader::get_r_shndx): Reformat.
221 (Incremental_relocs_reader::get_r_offset): Reformat.
222 (Incremental_relocs_reader::data): New function.
223 (Incremental_binary::Incremental_binary): Initialize new data members.
224 (Incremental_binary::check_inputs): Add cmdline parameter.
225 (Incremental_binary::file_is_unchanged): Remove.
226 (Input_reader::arg_serial): New function.
227 (Input_reader::get_unused_symbol_count): New function.
228 (Input_reader::get_unused_symbol): New function.
229 (Input_reader::do_arg_serial): New function.
230 (Input_reader::do_get_unused_symbol_count): New function.
231 (Input_reader::do_get_unused_symbol): New function.
232 (Incremental_binary::input_file_count): New function.
233 (Incremental_binary::get_input_reader): Change signature to use
234 index instead of filename.
235 (Incremental_binary::file_has_changed): New function.
236 (Incremental_binary::get_input_argument): New function.
237 (Incremental_binary::get_library): New function.
238 (Incremental_binary::get_script_info): New function.
239 (Incremental_binary::init_layout): New function.
240 (Incremental_binary::reserve_layout): New function.
241 (Incremental_binary::output_file): New function.
242 (Incremental_binary::do_check_inputs): New function.
243 (Incremental_binary::do_file_is_unchanged): Remove.
244 (Incremental_binary::do_file_has_changed): New function.
245 (Incremental_binary::do_init_layout): New function.
246 (Incremental_binary::do_reserve_layout): New function.
247 (Incremental_binary::do_input_file_count): New function.
248 (Incremental_binary::do_get_input_reader): Change signature.
249 (Incremental_binary::input_args_map_): New data member.
250 (Incremental_binary::library_map_): New data member.
251 (Incremental_binary::script_map_): New data member.
252 (Sized_incremental_binary::Sized_incremental_binary): Initialize
254 (Sized_incremental_binary::output_section): New function.
255 (Sized_incremental_binary::inputs_reader): Add const.
256 (Sized_incremental_binary::symtab_reader): Add const.
257 (Sized_incremental_binary::relocs_reader): Add const.
258 (Sized_incremental_binary::got_plt_reader): Add const.
259 (Sized_incremental_binary::get_symtab_view): New function.
260 (Sized_incremental_binary::Inputs_reader): New typedef.
261 (Sized_incremental_binary::Input_entry_reader): New typedef.
262 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
263 (Sized_incremental_binary::do_file_is_unchanged): Remove.
264 (Sized_incremental_binary::do_file_has_changed): New function.
265 (Sized_incremental_binary::do_init_layout): New function.
266 (Sized_incremental_binary::do_reserve_layout): New function.
267 (Sized_input_reader::Inputs_reader): Remove.
268 (Sized_input_reader::Input_entry_reader): Remove.
269 (Sized_input_reader::do_arg_serial): New function.
270 (Sized_input_reader::do_get_unused_symbol_count): New function.
271 (Sized_input_reader::do_get_unused_symbol): New function.
272 (Sized_incremental_binary::do_input_file_count): New function.
273 (Sized_incremental_binary::do_get_input_reader): Change signature;
274 use index instead of filename.
275 (Sized_incremental_binary::section_map_): New data member.
276 (Sized_incremental_binary::input_entry_readers_): New data member.
277 (class Sized_incr_relobj): New class.
278 (class Sized_incr_dynobj): New class.
279 (make_sized_incremental_object): New function.
280 (class Incremental_library): New class.
281 * layout.cc (Free_list::num_lists): New static data member.
282 (Free_list::num_nodes): New static data member.
283 (Free_list::num_removes): New static data member.
284 (Free_list::num_remove_visits): New static data member.
285 (Free_list::num_allocates): New static data member.
286 (Free_list::num_allocate_visits): New static data member.
287 (Free_list::init): New function.
288 (Free_list::remove): New function.
289 (Free_list::allocate): New function.
290 (Free_list::dump): New function.
291 (Free_list::print_stats): New function.
292 (Layout_task_runner::run): Resize output file for incremental updates.
293 (Layout::Layout): Initialize new data members.
294 (Layout::set_incremental_base): New function.
295 (Layout::init_fixed_output_section): New function.
296 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
298 (Layout::create_gold_note): Do not create gold note section for
300 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
301 for incremental updates.
302 (Layout::set_section_offsets): For incremental updates, allocate space
304 (Layout::create_symtab_sections): Layout with offsets relative to
305 start of section; for incremental updates, allocate space from free
307 (Layout::create_shdrs): For incremental updates, allocate space from
309 (Layout::finish_dynamic_section): For incremental updates, do not
310 check --as-needed (fixed in subsequent patch).
311 * layout.h (class Free_list): New class.
312 (Layout::set_incremental_base): New function.
313 (Layout::incremental_base): New function.
314 (Layout::init_fixed_output_section): New function.
315 (Layout::allocate): New function.
316 (Layout::incremental_base_): New data member.
317 (Layout::free_list_): New data member.
318 * main.cc (main): Print Free_list statistics.
319 * object.cc (Relobj::finalize_incremental_relocs): Add
320 clear_counts parameter; clear counts only when clear_counts is set.
321 (Sized_relobj::Sized_relobj): Initialize new base class.
322 (Sized_relobj::do_layout): Don't report special sections.
323 (Sized_relobj::do_for_all_local_got_entries): New function.
324 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
325 symtab_off to all symbol table offsets.
326 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
327 * object.h (class Got_offset_list): Move to top of file.
328 (Object::Object): Allow case where input_file == NULL.
329 (Object::~Object): Likewise.
330 (Object::input_file): Assert that input_file != NULL.
331 (Object::lock): Allow case where input_file == NULL.
332 (Object::unlock): Likewise.
333 (Object::is_locked): Likewise.
334 (Object::token): Likewise.
335 (Object::release): Likewise.
336 (Object::is_incremental): New function.
337 (Object::get_mtime): New function.
338 (Object::for_all_local_got_entries): New function.
339 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
340 (Object::set_is_in_system_directory): New function.
341 (Object::is_in_system_directory): New function.
342 (Object::do_is_incremental): New function.
343 (Object::do_get_mtime): New function.
344 (Object::do_for_all_local_got_entries): New function.
345 (Object::is_in_system_directory_): New data member.
346 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
347 (class Sized_relobj_base): New class.
348 (class Sized_relobj): Derive from Sized_relobj_base.
349 (class Sized_relobj::Symbols): Redeclare from base class.
350 (class Sized_relobj::local_got_offset_list): Remove.
351 (class Sized_relobj::Output_sections): Redeclare from base class.
352 (class Sized_relobj::do_for_all_local_got_entries): New function.
353 (class Sized_relobj::write_local_symbols): Add offset parameter.
354 (class Sized_relobj::local_symbol_offset_): Update comment.
355 (class Sized_relobj::local_dynsym_offset_): Update comment.
356 * options.cc (Input_arguments::add_file): Remove const.
357 * options.h (Input_file_argument::Input_file_argument):
358 Initialize arg_serial_ (all constructors).
359 (Input_file_argument::set_arg_serial): New function.
360 (Input_file_argument::arg_serial): New function.
361 (Input_file_argument::arg_serial_): New data member.
362 (Input_arguments::Input_arguments): Initialize file_count_.
363 (Input_arguments::add_file): Remove const.
364 (Input_arguments::number_of_input_files): New function.
365 (Input_arguments::file_count_): New data member.
366 (Command_line::number_of_input_files): Call
367 Input_arguments::number_of_input_files.
368 * output.cc (Output_segment_headers::Output_segment_headers):
370 (Output_section::Input_section::current_data_size): New function.
371 (Output_section::Output_section): Initialize new data members.
372 (Output_section::add_input_section): Don't do merge sections for
373 an incremental link; allocate space from free list for an
375 (Output_section::add_output_section_data): Allocate space from
376 free list for an incremental update.
377 (Output_section::update_data_size): New function.
378 (Output_section::set_fixed_layout): New function.
379 (Output_section::reserve): New function.
380 (Output_segment::set_section_addresses): Remove const.
381 (Output_segment::set_section_list_addresses): Remove const; allocate
382 space from free list for an incremental update.
383 (Output_segment::set_offset): Adjust size of RELRO segment for an
385 * output.h (Output_data::current_data_size): Move here from
387 (Output_data::pre_finalize_data_size): New function.
388 (Output_data::update_data_size): New function.
389 (Output_section_headers::update_data_size): new function.
390 (Output_section_data_build::current_data_size): Move to Output_data.
391 (Output_data_strtab::update_data_size): New function.
392 (Output_section::current_data_size): Move to Output_data.
393 (Output_section::set_fixed_layout): New function.
394 (Output_section::has_fixed_layout): New function.
395 (Output_section::reserve): New function.
396 (Output_section::update_data_size): New function.
397 (Output_section::has_fixed_layout_): New data member.
398 (Output_section::free_list_): New data member.
399 (Output_segment::set_section_addresses): Remove const.
400 (Output_segment::set_section_list_addresses): Remove const.
401 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
403 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
405 * readsyms.cc (Read_symbols::do_read_symbols): Add library
406 parameter when calling Add_symbols constructor; store argument
407 serial number for members of a lib group.
408 (Add_symbols::locks): Allow case where token == NULL.
409 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
410 (Read_member::~Read_member): New function.
411 (Read_member::is_runnable): New function.
412 (Read_member::locks): New function.
413 (Read_member::run): New function.
414 (Check_script::~Check_script): New function.
415 (Check_script::is_runnable): New function.
416 (Check_script::locks): New function.
417 (Check_script::run): New function.
418 (Check_library::~Check_library): New function.
419 (Check_library::is_runnable): New function.
420 (Check_library::locks): New function.
421 (Check_library::run): New function.
422 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
423 (Add_symbols::library_): New data member.
424 (class Read_member): New class.
425 (class Check_script): New class.
426 (class Check_library): New class.
427 * reloc.cc (Read_relocs::is_runnable): Allow case where
429 (Read_relocs::locks): Likewise.
430 (Scan_relocs::locks): Likewise.
431 (Relocate_task::locks): Likewise.
432 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
434 (Sized_relobj::incremental_relocs_scan): Fix comment.
435 (Sized_relobj::do_relocate): Pass output file offset to
437 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
438 from class declaration.
439 * script.cc (read_input_script): Allocate Script_info; pass
440 argument serial number to report_script.
441 * script.h (class Script_info): Move to incremental.h.
442 * symtab.cc (Symbol_table::add_from_incrobj): New function.
443 * symtab.h (Symbol_table::add_from_incrobj): New function.
444 (Symbol_table::set_file_offset): New function.
446 2011-04-05 Cary Coutant <ccoutant@google.com>
448 * incremental-dump.cc (dump_incremental_inputs): Change signature
449 to take a Sized_incremental_binary; change caller. Use readers
450 in Sized_incremental_binary.
452 (Sized_incremental_binary::find_incremental_inputs_sections):
453 Rename do_find_incremental_inputs_sections to this.
454 (Sized_incremental_binary::setup_readers): New function.
455 (Sized_incremental_binary::do_check_inputs): Check
456 has_incremental_info_ flag; move setup code to setup_readers;
458 (Sized_incremental_binary::do_file_is_unchanged): New function.
459 (Sized_incremental_binary::do_get_input_reader): New function.
460 * incremental.h (class Incremental_binary): Move to end of file.
461 (Incremental_binary::file_is_unchanged): New function.
462 (Incremental_binary::do_file_is_unchanged): New function.
463 (Incremental_binary::Input_reader): New class.
464 (Incremental_binary::get_input_reader): New function.
465 (class Sized_incremental_binary): Move to end of file.
466 (Sized_incremental_binary::Sized_incremental_binary): Setup the
467 input section reader classes.
468 (Sized_incremental_binary::has_incremental_info): New function.
469 (Sized_incremental_binary::inputs_reader): New function.
470 (Sized_incremental_binary::symtab_reader): New function.
471 (Sized_incremental_binary::relocs_reader): New function.
472 (Sized_incremental_binary::got_plt_reader): New function.
473 (Sized_incremental_binary::do_file_is_unchanged): New function.
474 (Sized_incremental_binary::Sized_input_reader): New class.
475 (Sized_incremental_binary::get_input_reader): New function.
476 (Sized_incremental_binary::find_incremental_inputs_sections):
477 Rename do_find_incremental_inputs_sections to this.
478 (Sized_incremental_binary::setup_readers): New function.
479 (Sized_incremental_binary::has_incremental_info_): New data member.
480 (Sized_incremental_binary::inputs_reader_): New data member.
481 (Sized_incremental_binary::symtab_reader_): New data member.
482 (Sized_incremental_binary::relocs_reader_): New data member.
483 (Sized_incremental_binary::got_plt_reader_): New data member.
484 (Sized_incremental_binary::current_input_file_): New data member.
486 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
489 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
492 2011-03-30 Cary Coutant <ccoutant@google.com>
494 * archive.cc (Archive::include_member): Adjust call to report_object.
495 (Add_archive_symbols::run): Add script_info to call to
496 report_archive_begin.
497 (Lib_group::include_member): Adjust call to report_object.
498 (Add_lib_group_symbols::run): Adjust call to report_object.
499 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
500 blocks. Add object count for script input files.
501 * incremental.cc (Incremental_inputs::report_archive_begin): Add
502 script_info parameter; change all callers.
503 (Incremental_inputs::report_object): Add script_info parameter;
505 (Incremental_inputs::report_script): Store backpointer to
506 incremental info entry.
507 (Output_section_incremental_inputs::set_final_data_size): Record
508 additional information for scripts.
509 (Output_section_incremental_inputs::write_info_blocks): Likewise.
510 * incremental.h (Incremental_script_entry::add_object): New function.
511 (Incremental_script_entry::get_object_count): New function.
512 (Incremental_script_entry::get_object): New function.
513 (Incremental_script_entry::objects_): New data member; adjust
515 (Incremental_inputs::report_archive_begin): Add script_info parameter.
516 (Incremental_inputs::report_object): Add script_info parameter.
517 (Incremental_inputs_reader::get_object_count): New function.
518 (Incremental_inputs_reader::get_object_offset): New function.
519 * options.cc (Input_arguments::add_file): Return reference to
521 * options.h (Input_argument::set_script_info): New function.
522 (Input_argument::script_info): New function.
523 (Input_argument::script_info_): New data member; adjust all
525 (Input_file_group::add_file): Return reference to new input argument.
526 (Input_file_lib::add_file): Likewise.
527 (Input_arguments::add_file): Likewise.
528 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
529 * script.cc (Parser_closure::Parser_closure): Add script_info
530 parameter; adjust all callers.
531 (Parser_closure::script_info): New function.
532 (Parser_closure::script_info_): New data member.
533 (read_input_script): Report scripts earlier to incremental info.
534 (script_add_file): Set script_info in Input_argument.
535 (script_add_library): Likewise.
536 * script.h (Script_options::Script_info): Rewrite class.
538 2011-03-29 Cary Coutant <ccoutant@google.com>
540 * archive.cc (Library_base::should_include_member): Move
541 method here from class Archive.
542 (Archive::Archive): Initialize base class.
543 (Archive::should_include_member): Move to base class.
544 (Archive::do_for_all_unused_symbols): New function.
545 (Add_archive_symbols::run): Remove redundant access to
547 (Lib_group::Lib_group): Initialize base class.
548 (Lib_group::do_filename): New function.
549 (Lib_group::include_member): Pass pointer to Lib_group to
551 (Lib_group::do_for_all_unused_symbols): New function.
552 (Add_lib_group_symbols::run): Report archive information for
554 * archive.h (class Library_base): New base class.
555 (class Archive): Derive from Library_base.
556 (Archive::filename): Move to base class.
557 (Archive::set_incremental_info): Likewise.
558 (Archive::incremental_info): Likewise.
559 (Archive::Should_include): Likewise.
560 (Archive::should_include_member): Likewise.
561 (Archive::Armap_entry): Remove.
562 (Archive::Unused_symbol_iterator): Remove.
563 (Archive::unused_symbols_begin): Remove.
564 (Archive::unused_symbols_end): Remove.
565 (Archive::do_filename): New function.
566 (Archive::do_get_mtime): New function.
567 (Archive::do_for_all_unused_symbols): New function.
568 (Archive::task_): Move to base class.
569 (Archive::incremental_info_): Likewise.
570 (class Lib_group): Derive from Library_base.
571 (Lib_group::do_filename): New function.
572 (Lib_group::do_get_mtime): New function.
573 (Lib_group::do_for_all_unused_symbols): New function.
574 (Lib_group::task_): Move to base class.
575 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
577 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
579 * incremental.cc (Incremental_inputs::report_archive_begin):
580 Use Library_base; call library's get_mtime; add incremental inputs
581 entry before members.
582 (class Unused_symbol_visitor): New class.
583 (Incremental_inputs::report_archive_end): Use Library_base; use
584 visitor class to record unused symbols; don't add incremental inputs
586 (Incremental_inputs::report_object): Use Library_base.
588 (Incremental_archive_entry::Incremental_archive_entry): Remove
589 unused Archive parameter.
590 (Incremental_inputs::report_archive_begin): Use Library_base.
591 (Incremental_inputs::report_archive_end): Likewise.
592 (Incremental_inputs::report_object): Likewise.
593 * object.cc (Sized_relobj::do_for_all_global_symbols): New
595 * object.h (Object::for_all_global_symbols): New function.
596 (Object::do_for_all_global_symbols): New function.
597 (Sized_relobj::do_for_all_global_symbols): New function.
598 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
600 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
603 2011-03-27 Ian Lance Taylor <iant@google.com>
605 * archive.cc (Archive::interpret_header): Return -1 if something
606 goes wrong. Change callers accordingly.
608 2011-03-25 Cary Coutant <ccoutant@google.com>
610 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
611 * testsuite/Makefile.in: Regenerate.
613 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
615 * plugin.cc (get_view): New.
616 (Plugin::load): Pass get_view to the plugin.
617 (Plugin_manager::get_view): New.
619 2011-03-21 Ian Lance Taylor <iant@google.com>
621 * testsuite/final_layout.sh: Rewrite to not use dc.
622 * testsuite/relro_test.sh: Fail if dc is not present.
624 2011-03-21 Sriraman Tallam <tmsriram@google.com>
626 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
628 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
629 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
631 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
632 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
634 2011-03-14 Ian Lance Taylor <iant@google.com>
636 * script-sections.cc (Sort_output_sections::script_compare):
637 Rename from is_before, change return type.
638 (Sort_output_sections::operator()): Adjust accordingly.
640 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
643 * testsuite/odr_violation2.cc: Add comment to make all error line
644 numbers double digits.
645 * testsuite/debug_msg.sh: Adjust expected errors.
647 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
649 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
650 but mark earlier ones as non-canonical
651 (offset_to_iterator): Update search target and example
652 (do_addr2line): Return extra lines in a vector*
653 (format_file_lineno): Extract from do_addr2line
654 (one_addr2line): Add vector* out-param
655 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
656 when a lineno entry appeared last for its instruction
657 (Dwarf_line_info): Add vector* out-param
658 * object.cc (Relocate_info): Pass NULL for the vector* out-param
659 * symtab.cc (Odr_violation_compare): Include the lineno in the
661 (linenos_from_loc): New. Combine the canonical line for an
662 address with its other lines.
663 (True_if_intersect): New. Helper functor to make
664 std::set_intersection a query.
665 (detect_odr_violations): Compare sets of lines instead of just
666 one line for each function. This became less deterministic, but
667 has fewer false positives.
668 * symtab.h: Declarations.
669 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
670 mix an optimized and non-optimized object in the same binary
671 (odr_violation2.so): Same.
672 * testsuite/Makefile.in: Regenerate from Makefile.am.
673 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
674 * testsuite/debug_msg.sh: Update line numbers and add
676 * testsuite/odr_violation1.cc: Use OdrDerived, in a
677 non-optimized context.
678 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
679 isn't inlined, and use OdrDerived in an optimized context.
680 * testsuite/odr_header1.h: Defines OdrDerived, where
681 optimization will change the
682 first-instruction-in-the-destructor's file and line number.
683 * testsuite/odr_header2.h: Defines OdrBase.
685 2011-03-09 Ian Lance Taylor <iant@google.com>
687 * fileread.cc (File_read::clear_views): Don't delete the whole
690 2011-03-08 Ian Lance Taylor <iant@google.com>
693 * fileread.cc: #include <climits>.
694 (GOLD_IOV_MAX): Define.
695 (File_read::read_multiple): Limit number of entries by iov_max.
696 * fileread.h (class File_read): Always set max_readv_entries to
699 2011-03-07 Ian Lance Taylor <iant@google.com>
702 * options.h (class General_options): Add -dy and -dn.
704 2011-03-02 Cary Coutant <ccoutant@google.com>
706 * testsuite/script_test_9.t: Add TLS segment.
708 2011-03-02 Simon Baldwin <simonb@google.com>
710 * configure.ac: Add check for gnu_indirect_function support in
711 the toolchain building binutils.
712 * configure: Rebuild.
714 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
716 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
718 (Symbol_table::sized_finalize_symbol) Mark symbol only present
719 in plugin files as not needed in the symbol table.
721 2011-02-11 Sriraman Tallam <tmsriram@google.com>
723 * output.cc (Output_section::add_input_section): Delay fill
724 generation for section ordering.
726 2011-02-09 Ian Lance Taylor <iant@google.com>
729 * object.h (class Sized_relobj): Remove clear_local_symbols.
730 * reloc.cc (Sized_relobj::do_relocate): Don't call
733 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
735 * plugin.cc (is_visible_from_outside): Return true for symbols
738 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
740 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
743 2011-02-02 Sriraman Tallam <tmsriram@google.com>
745 * icf.h (is_section_foldable_candidate): Change type of parameter
747 * icf.cc (Icf::find_identical_sections): Change type of local variable
748 section_name to be std::string.
749 (is_function_ctor_or_dtor): Change type of parameter to std::string.
751 2011-01-25 Ian Lance Taylor <iant@google.com>
753 * script.cc (script_add_extern): Rewrite to use
754 add_symbol_reference.
756 2011-01-25 Doug Kwan <dougkwan@google.com>
758 * icf.cc (get_section_contents): Always lock section's object.
760 2011-01-24 Ian Lance Taylor <iant@google.com>
762 * options.h (class General_options): Accept
763 --no-detect-odr-violations.
765 2011-01-24 Ian Lance Taylor <iant@google.com>
767 * version.cc (version_string): Bump to 1.11.
769 2011-01-24 Ian Lance Taylor <iant@google.com>
771 * plugin.cc (class Plugin_rescan): Define new class.
772 (Plugin_manager::claim_file): Set any_claimed_.
773 (Plugin_manager::save_archive): New function.
774 (Plugin_manager::save_input_group): New function.
775 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
777 (Plugin_manager::new_undefined_symbol): New function.
778 (Plugin_manager::rescan): New function.
779 (Plugin_manager::rescannable_defines): New function.
780 (Plugin_manager::add_input_file): Set any_added_.
781 * plugin.h (class Plugin_manager): define new fields rescannable_,
782 undefined_symbols_, any_claimed_, and any_added_. Declare
783 Plugin_rescan as friend. Declare new functions.
784 (Plugin_manager::Rescannable): Define type.
785 (Plugin_manager::Rescannable_list): Define type.
786 (Plugin_manager::Undefined_symbol_list): Define type.
787 (Plugin_manager::Plugin_manager): Initialize new fields.
788 * archive.cc (Archive::defines_symbol): New function.
789 (Add_archive_symbols::run): Pass archive to plugins if any.
790 * archive.h (class Archive): Declare defines_symbol.
791 * readsyms.cc (Input_group::~Input_group): New function.
792 (Finish_group::run): Pass input_group to plugins if any.
793 * readsyms.h (class Input_group): Declare destructor.
794 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
797 2011-01-10 Ian Lance Taylor <iant@google.com>
799 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
801 (Layout::set_segment_offsets): Reset increase_relro before calling
802 set_section_addresses a second time.
804 2011-01-04 Cary Coutant <ccoutant@google.com>
806 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
807 sections before NOBITS sections.
809 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
811 * version.cc (print_version): Update copyright to 2011.
813 2010-12-23 Cary Coutant <ccoutant@google.com>
815 * output.h (Output_data_reloc::add_output_section): Pass OD instead
816 of OS to this->add. Add OD parameter to second form of the function.
818 2010-12-20 Ian Lance Taylor <iant@google.com>
820 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
821 second of two consecutive entries with same offset.
823 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
825 * testsuite/Makefile.am (ifuncmain2static_LDADD)
826 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
827 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
828 to avoid unneeded links against $(LDADD).
829 * testsuite/Makefile.in: Regenerate.
831 2010-12-15 Ian Lance Taylor <iant@google.com>
834 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
835 for R_X86_64_32 and R_X86_64_PC32.
836 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
837 ver_matching_def_pic.o.
838 (ver_matching_def_pic.o): New target.
840 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
842 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
843 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
844 Move definition before File_read::View member definitions.
845 (File_read::View::~View): Initialize and hold lock before
846 updating current_mapped_bytes.
848 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
850 * dwarf_reader.cc: Remove outdated comment.
851 * gold-threads.cc: Fix typo in error message.
852 * archive.cc: Fix typos in comments.
853 * archive.h: Likewise.
854 * arm-reloc-property.cc: Likewise.
855 * arm-reloc-property.h: Likewise.
856 * arm-reloc.def: Likewise.
858 * attributes.h: Likewise.
860 * ehframe.cc: Likewise.
861 * fileread.h: Likewise.
865 * incremental.h: Likewise.
866 * int_encoding.cc: Likewise.
867 * layout.h: Likewise.
870 * object.cc: Likewise.
871 * object.h: Likewise.
872 * options.cc: Likewise.
873 * readsyms.cc: Likewise.
874 * reduced_debug_output.cc: Likewise.
875 * reloc.cc: Likewise.
876 * script-sections.cc: Likewise.
877 * sparc.cc: Likewise.
878 * symtab.h: Likewise.
879 * target-reloc.h: Likewise.
880 * target.cc: Likewise.
881 * target.h: Likewise.
882 * timer.cc: Likewise.
884 * x86_64.cc: Likewise.
886 2010-12-09 Cary Coutant <ccoutant@google.com>
888 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
890 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
891 parameter; change all callers.
892 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
893 * options.h (warn_execstack): New option.
895 2010-12-07 Doug Kwan <dougkwan@google.com>
897 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
898 like function call relocations.
900 2010-12-07 Ian Lance Taylor <iant@google.com>
902 * archive.cc (Archive::get_elf_object_for_member): Permit
903 punconfigured to be NULL.
904 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
905 (Archive::include_member): Pass NULL to get_elf_object_for_member
906 if we searched for the archive and this is the first included
909 2010-12-01 Ian Lance Taylor <iant@google.com>
911 * dwarf_reader.h (class Sized_dwarf_line_info): Add
912 track_relocs_type_ field.
913 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
914 Set track_relocs_type_.
915 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
916 contents when using RELA relocs.
917 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
919 * reloc.cc (Track_relocs::next_addend): New function.
920 * reloc.h (class Track_relocs): Declare next_addend.
922 2010-12-01 Ian Lance Taylor <iant@google.com>
924 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
927 2010-12-01 Ian Lance Taylor <iant@google.com>
929 * README: Update compilers known to work and fail.
931 2010-11-23 Matthias Klose <doko@ubuntu.com>
933 * configure.in: For --enable-gold, handle value `default' instead of
934 `both*'. Always install ld as ld.bfd, install as ld if gold is
936 * configure: Regenerate.
938 2010-11-18 Doug Kwan <dougkwan@google.com>
940 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
941 and right_alignment to be zero. Store result alignment only if it is
942 greater than existing alignment.
944 2010-11-16 Cary Coutant <ccoutant@google.com>
947 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
948 Check for ".zdebug_line".
950 2010-11-16 Doug Kwan <dougkwan@google.com>
951 Cary Coutant <ccoutant@google.com>
953 * output.h (Output_segment::set_section_addresses): Pass increase_relro
954 by reference; adjust all callers.
955 * output.cc (Output_segment::set_section_addresses): Adjust references
956 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
958 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
959 end at page boundary.
961 2010-11-16 Cary Coutant <ccoutant@google.com>
964 * layout.cc (Layout::choose_output_section): Transform names of
965 compressed sections even when using a script with a SECTIONS clause.
966 (Layout::output_section_name): Remove code to transform
967 compressed debug section names.
968 * output.cc (Output_section::add_input_section): Use uncompressed
969 section size when tracking input sections.
971 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
973 * symtab.h (Symbol::NON_PIC_REF): Remove.
974 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
975 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
976 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
977 (Symbol::use_plt_offset): Take a flags argument and pass it
978 directly to needs_dynamic_reloc. Restrict check for undefined
979 weak symbols to function calls.
980 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
981 (Target_arm::Scan::global): Use it.
982 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
983 (Target_arm::Relocate::relocate): Likewise.
984 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
985 parameter with an r_type parameter. Use get_reference_flags
987 (Target_arm::Relocate::relocate): Update accordingly.
988 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
989 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
990 (Target_i386::Scan::global): Likewise.
991 (Target_i386::Relocate::relocate): Likewise.
992 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
993 parameter with an r_type parameter. Use get_reference_flags
995 (Target_i386::Relocate::relocate): Update accordingly.
996 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
997 (Target_powerpc::Scan::global): Use it.
998 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
999 (Target_powerpc::Relocate::relocate): Likewise.
1000 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1001 (Target_sparc::Scan::global): Use it.
1002 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1003 (Target_sparc::Relocate::relocate): Likewise.
1004 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1005 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1006 (Target_x86_64::Scan::global): Likewise.
1007 (Target_x86_64::Relocate::relocate): Likewise.
1009 2010-11-08 Doug Kwan <dougkwan@google.com>
1010 Cary Coutant <ccoutant@google.com>
1012 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1013 (Arm_exidx_merge_section::section_contents_): New data member.
1014 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1015 (Arm_input_section::~Arm_input_section): De-allocate memory.
1016 (Arm_input_section::original_contents_): New data member.
1017 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1018 in parameters instead of calling Object::section_contents without
1020 (Arm_output_section::group_section): New parameter TASK. Pass it
1021 to callees that need locking objects.
1022 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1023 to lock EXIDX input sections. Fix a formatting issue. Call
1024 Arm_exidx_merged_section::build_contents to create merged section
1026 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1027 to lock object of stub table owner.
1028 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1029 TEXT_SIZE to initialize data member TEXT_SIZE_.
1030 (Arm_exidx_input_section::addralign): Fix typo in comment.
1031 (Arm_exidx_input_section::text_size): New method.
1032 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1033 that require locking objects. Lock objects before scanning for stubs
1034 and updating local symbols.
1035 (Arm_input_section<big_endian>::init): Copy contents of original
1037 (Arm_input_section<big_endian>::do_write): Use saved contents of
1038 original input section instead of calling Object::section_contents
1040 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1041 size without calling Object::section_size().
1042 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1043 for size. Allocate a buffer for merged EXIDX entries.
1044 (Arm_exidx_merged_section::build_contents): New method.
1045 (Arm_exidx_merged_section::do_write): Move merge section contents
1046 building code to Arm_exidx_merged_section::build_contetns. Write
1047 out contetns in buffer instead of building it on the fly.
1048 (Arm_relobj::make_exidx_input_section): Also pass text section size
1049 to Arm_exidx_input_section constructor.
1050 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1051 (Arm_dynobj::do_read_symbols): Fix memory leak.
1052 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1053 * target.h: (class Task): Add forward declaration.
1054 (Target::relax): Add new parameter TASK and pass it to
1056 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1058 2010-11-05 Cary Coutant <ccoutant@google.com>
1061 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1062 object when reading from the file.
1063 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1065 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1066 when reading section contents.
1067 (get_section_contents): Likewise.
1068 (icf::find_identical_sections): Likewise.
1069 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1070 object when reading from the file.
1071 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1072 the object when doing deferred section layout.
1074 2010-11-03 Nick Clifton <nickc@redhat.com>
1077 * script.h (class Symbol_assignment: name): New member. Returns
1078 the name of the symbol.
1079 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1080 Returns true if the given symbol name is on the list of
1081 assignments wating to be processed.
1082 * archive.cc (should_incldue_member): If the symbol is undefined,
1083 check to see if it is on the list of symbols pending assignment.
1085 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1087 * script-sections.cc (Script_sections::find_memory_region): Check
1088 for a NULL output section pointer.
1090 2010-10-29 Doug Kwan <dougkwan@google.com>
1092 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1093 Output_section::add_relaxed_input_section.
1094 * output.cc (Output_section::add_relaxed_input_section): Add new
1095 arguments LAYOUT and NAME. Set section order index.
1096 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1097 Copy section order index.
1098 * output.h (Output_section::add_relaxed_input_section): Add new
1099 arguments LAYOUT and NAME.
1101 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1103 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1104 NATIVE_OR_CROSS_LINKER.
1105 * testsuite/Makefile.in: Regenerate.
1107 2010-10-20 Doug Kwan <dougkwan@google.com>
1109 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1110 without SHF_LINK_ORDER flags.
1111 * layout.cc (Layout::choose_output_section): Do not filter
1112 SHF_LINK_ORDER flag in a relocatable link.
1114 2010-10-17 Cary Coutant <ccoutant@google.com>
1116 * output.h (Output_segment::set_section_addresses): Change function
1117 signature. Update all callers.
1118 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1120 (Output_segment::set_section_addresses): Align after last TLS
1121 section. Add padding before last relro section instead of after.
1123 2010-10-17 Doug Kwan <dougkwan@google.com>
1125 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1126 GOT output section to be writable.
1128 2010-10-14 Cary Coutant <ccoutant@google.com>
1130 * debug.h (DEBUG_INCREMENTAL): New flag.
1131 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1132 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1134 * incremental.cc (report_command_line): Ignore all forms of
1136 * layout.cc (Layout::Layout): Check parameters for incremental link
1138 * options.cc (General_options::parse_incremental): New function.
1139 (General_options::parse_no_incremental): New function.
1140 (General_options::parse_incremental_full): New function.
1141 (General_options::parse_incremental_update): New function.
1142 (General_options::incremental_mode_): New data member.
1143 (General_options::finalize): Check incremental_mode_.
1144 * options.h (General_options): Update help text for --incremental.
1145 Add --no-incremental, --incremental-full, --incremental-update.
1146 (General_options::Incremental_mode): New enum type.
1147 (General_options::incremental_mode): New function.
1148 (General_options::incremental_mode_): New data member.
1149 * parameters.cc (Parameters::incremental_mode_): New data member.
1150 (Parameters::set_options): Set incremental_mode_.
1151 (Parameters::set_incremental_full): New function.
1152 (Parameters::incremental): New function.
1153 (Parameters::incremental_update): New function.
1154 (set_parameters_incremental_full): New function.
1155 * parameters.h (Parameters::set_incremental_full): New function.
1156 (Parameters::incremental): New function.
1157 (Parameters::incremental_update): New function.
1158 (Parameters::incremental_mode_): New data member.
1159 (set_parameters_incremental_full): New function.
1160 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1161 incremental link mode.
1162 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1163 (Sized_relobj::do_relocate_sections): Likewise.
1164 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1166 * testsuite/Makefile.in: Regenerate.
1167 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1169 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1171 * script-sections.h (class Script_sections): Make
1172 Sections_elements typedef public.
1173 * script-sections.cc (class Sort_output_sections): Add elements_
1174 field. Add constructor which sets it; change all callers.
1175 (Sort_output_sections::is_before): New function.
1176 (Sort_output_sections::operator()): Call is_before.
1177 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1179 * testsuite/script_test_10.sh: New test. Test script section
1181 * testsuite/script_test_10.t: Likewise.
1182 * testsuite/script_test_10.s: Likewise.
1183 * testsuite/Makefile.am: Wrap the cross linker tests and the
1184 common tests into NATIVE_OR_CROSS_LINKER.
1185 (check_SCRIPTS): Add script_test_10.sh.
1186 (check_DATA): Add script_test_10.stdout.
1187 (script_test_10.o, script_test_10): New targets.
1188 (script_test_10.stdout): New target.
1189 * configure, testsuite/Makefile.in: Regenerate.
1191 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1193 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1194 error for the deprecated relocations.
1195 (Target_arm::Scan::global): Likewise.
1196 (Target_arm::Relocate::relocate): Likewise.
1198 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1200 * fileread.cc (Input_file::find_file): Initialize *found_name
1201 and *namep when using the fallback search for case 4.
1203 2010-10-11 Cary Coutant <ccoutant@google.com>
1205 * options.h (class General_options): Redefine -z lazy as an alias for
1206 the negation of -z now.
1208 2010-10-11 Ian Lance Taylor <iant@google.com>
1210 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1213 2010-10-06 Nick Clifton <nickc@redhat.com>
1215 * script-sections.cc(class Memory_region): Remove
1216 current_lma_offset_ field. Rename current_vma_offset_ to
1217 current_offset_. Add last_section_ field.
1218 (Memory_region::get_current_vma_address): Rename to
1219 get_current_address.
1220 (Memory_region::get_current_lma_address): Delete.
1221 (Memory_region::increment_vma_offset): Rename to
1223 (Memory_region::increment_lma_offset): Delete.
1224 (Memory_region::attributes_compatible): New method. Returns
1225 true if the provided section is compatible with the region.
1226 (Memory_region::get_last_section): New method. Returns the last
1227 section to use the region.
1228 (Memory_region::set_last_section): New method. Stores the last
1229 section to use the region.
1230 (Script_sections::block_in_region): New method. Returns true if
1231 a block of memory is contained within a region.
1232 (Script_sections::find_memory_region): New method. Locates a
1233 memory region to be used to set a VMA or LMA address.
1234 (Output_section_definition::set_section_addresses): Add code to
1235 check for addresses set by memory regions.
1236 (Output_segment::set_section_addresses): Remove memory region
1238 (Script_sections::create_segment): Add a warning if a header
1239 segment is created outside of any region.
1240 * script-sections.h (class Script_sections): Add prototypes for
1241 find_memory_region and block_in_region methods.
1242 * testsuite/memory_test.s: Use .long instead of .word.
1243 * testsuite/memory_test.t: Add some more output sections.
1244 * testsuite/memory_test.sh: Update expected output.
1246 2010-10-02 Doug Kwan <dougkwan@google.com>
1248 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1249 defintion to symtab.h
1250 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1251 declaration to defintion.
1253 2010-10-01 Nick Clifton <nickc@redhat.com>
1255 * expression.cc (eval): Replace dummy argument with NULL.
1256 (eval_maybe_dot): Check for a NULL result section pointer.
1257 (Symbol_expression::value): Likewise.
1258 (Dot_expression::value): Likewise.
1259 (BINARY_EXPRESSION): Likewise.
1260 (Max_expression::value): Likewise.
1261 (Min_expression::value): Likewise.
1262 (Absolute_expression::value): Likewise.
1263 (Addr_expression::value_from_output_section): Likewise.
1264 (Loaddddr_expression::value_from_output_section): Likewise.
1265 (Segment_start_expression::value): Likewise.
1266 * script-sections.cc
1267 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1269 (Sections_elememt_dot_assignment::set_section_addresses):
1271 (Output_data_expression::do_write_to_buffer): Likewise.
1272 (Output_section_definition::finalize_symbols): Likewise.
1273 (Output_section_definition::set_section_addresses): Likewise.
1275 2010-09-30 Doug Kwan <dougkwan@google.com>
1277 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1279 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1281 * target.h (Target::can_icf_inline_merge_sections): New virtual
1283 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1285 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1287 * icf.cc (get_section_contents): Inline merge sections only when
1290 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1292 * configure: Regenerate.
1294 2010-09-17 Ian Lance Taylor <iant@google.com>
1296 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1297 * testsuite/Makefile.am (memory_test.o): New target.
1298 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1300 * testsuite/Makefile.in: Rebuild.
1302 2010-09-17 Doug Kwan <dougkwan@google.com>
1304 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1305 defintion if relocation uses GOT entries of the symbol.
1306 * testsuite/icf_safe_test.sh: Fix test.
1307 * testsuite/icf_safe_so_test.sh: Fix test.
1309 2010-09-16 Cary Coutant <ccoutant@google.com>
1311 * script_sections.cc (class Memory_region): Remove "NULL" from
1312 vector initializations.
1314 2010-09-15 Cary Coutant <ccoutant@google.com>
1316 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1317 Resolve forwarding symbols.
1319 2010-09-15 Doug Kwan <dougkwan@google.com>
1321 * gold/testsuite/script_test_3.t: Add ARM special sections.
1322 * gold/testsuite/script_test_4.t: Same.
1323 * gold/testsuite/script_test_5.t: Same.
1324 * gold/testsuite/script_test_6.t: Same.
1325 * gold/testsuite/script_test_7.t: Same.
1326 * gold/testsuite/script_test_7.t: Same.
1327 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1329 2010-09-14 Cary Coutant <ccoutant@google.com>
1331 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1332 (Target_x86_64::Relocate::relocate_tls): Replace check for
1333 saw_tls_block_reloc_ with test for executable section.
1335 2010-09-12 Cary Coutant <ccoutant@google.com>
1337 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1338 position-independent executables to shared libraries need dynamic
1340 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1341 position-independent executables.
1342 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1343 * testsuite/Makefile.in: Regenerate.
1345 2010-09-10 Nick Clifton <nickc@redhat.com>
1348 * testsuite/memory_test.t: Discard any sections that are not
1351 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1354 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1355 "This::" to work around a bug in gcc 4.2.
1357 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1359 2010-09-09 Rafael Espindola <espindola@google.com>
1361 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1362 sections with different PF_X flags in the same segment.
1363 (Layout::find_first_load_seg): Search all segments to find the first
1365 * options.h (rosegment): New.
1367 2010-09-08 Rafael Espindola <espindola@google.com>
1369 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1371 2010-09-08 Doug Kwan <dougkwan@google.com>
1373 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1374 (Arm_relobj::do_relocate_sections): Add new parameter for output
1375 file to match the parent.
1376 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1377 of local symbols instead of input values. Update code to track
1378 changes in gold::relocate_section.
1379 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1380 (Sized_relobj::compute_final_local_value_internal): New methods.
1381 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1382 body into private version of Sized_relobj::compute_final_local_value.
1383 Call the inline method.
1384 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1385 merged symbol value if there is one.
1386 (Symbol_value::has_output_value): New method defintiion.
1387 (Sized_relobj::Compute_final_local_value_status): New enum type.
1388 (Sized_relobj::compute_final_local_value): New methods.
1389 (Sized_relobj::compute_final_local_value_internal): New methods.
1390 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1391 and arm_cortex_a8.sh.
1392 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1393 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1395 * Makefile.in: Regenerate.
1396 * testsuite/arm_bl_out_of_range.s: Update test.
1397 * testsuite/thumb_bl_out_of_range.s: Ditto.
1398 * testsuite/thumb_blx_out_of_range.s: Ditto.
1399 * testsuite/arm_branch_out_of_range.sh: New file.
1400 * testsuite/arm_cortex_a8.sh: Ditto.
1401 * testsuite/arm_cortex_a8_b.s: Ditto.
1402 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1403 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1404 * testsuite/arm_cortex_a8_bl.s: Ditto.
1405 * testsuite/arm_cortex_a8_blx.s: Ditto.
1406 * testsuite/arm_cortex_a8_local.s: Ditto.
1407 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1408 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1410 2010-09-08 Rafael Espindola <espindola@google.com>
1412 * Makefile.am (memory_test.stdout): Run readelf with -W.
1413 * Makefile.in: Regenerate.
1414 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1417 2010-09-08 Rafael Espindola <espindola@google.com>
1419 * script-sections.cc (Script_sections::add_memory_region): Convert
1420 field precision to int.
1421 * script.cc (script_set_section_region, script_set_section_region):
1422 Convert field precision to int.
1424 2010-09-08 Rafael Espindola <espindola@google.com>
1426 * arm.cc (do_finalize_sections): Create the __exidx_start and
1427 __exdix_end symbols even when the section is missing.
1429 2010-09-08 Nick Clifton <nickc@redhat.com>
1431 * README: Remove claim that MEMORY is not supported.
1432 * expression.cc (script_exp_function_origin)
1433 (script_exp_function_length): Move from here to ...
1434 * script.cc: ... here.
1435 (script_set_section_region, script_add_memory)
1436 (script_parse_memory_attr, script_include_directive): New
1438 * script-sections.cc
1439 (class Memory_region): New class.
1440 (class Output_section_definition): Add set_memory_region,
1441 set_section_vma, set_section_lma and get_section_name methods.
1442 (class Script_Sections): Add add_memory_region,
1443 find_memory_region, find_memory_region_origin,
1444 find_memory_region_length and set_memory_region methods.
1445 Have set_section_addresses method walk the list of set memory
1447 Extend the print methos to display memory regions.
1448 * script-sections.h: Add prototypes for new methods.
1449 Add enum for MEMORY region attributes.
1450 * yyscript.y: Add support for parsing MEMORY regions.
1451 * script-c.h: Add prototypes for new functions.
1452 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1453 * testsuite/Makefile.in: Regenerate.
1454 * testsuite/memory_test.sh: New script.
1455 * testsuite/memory_test.s: New assembler source file.
1456 * testsuite/memory_test.t: New linker script.
1458 2010-08-27 Doug Kwan <dougkwan@google.com>
1460 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1461 reference override an existing dynamic weak reference.
1462 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1463 * testsuite/Makefile.in: Regenerate.
1464 * testsuite/dyn_weak_ref.sh: New file.
1465 * testsuite/dyn_weak_ref_1.c: Ditto.
1466 * testsuite/dyn_weak_ref_2.c: Ditto.
1468 2010-08-27 Ian Lance Taylor <iant@google.com>
1470 * incremental.h (class Incremental_input_entry): Add virtual
1473 2010-08-27 Ian Lance Taylor <iant@google.com>
1475 * testsuite/start_lib_test_3.c: Mark t3 as used.
1477 2010-08-27 Nick Clifton <nickc@redhat.com>
1479 * options.cc (version_script): Fix small typo in previous
1482 2010-08-25 Nick Clifton <nickc@redhat.com>
1484 * archive.cc: Formatting fixes: Remove whitespace between
1485 typename and following asterisk. Remove whitespace between
1486 function name and opening parenthesis.
1487 * archive.h: Likewise.
1489 * attributes.cc: Likewise.
1490 * attributes.h: Likewise.
1491 * common.cc: Likewise.
1492 * copy-relocs.cc: Likewise.
1493 * dirsearch.h: Likewise.
1494 * dynobj.cc: Likewise.
1495 * ehframe.cc: Likewise.
1496 * ehframe.h: Likewise.
1497 * expression.cc: Likewise.
1498 * fileread.cc: Likewise.
1499 * fileread.h: Likewise.
1501 * gold-threads.cc: Likewise.
1502 * gold.cc: Likewise.
1503 * i386.cc: Likewise.
1505 * incremental-dump.cc: Likewise.
1506 * incremental.cc: Likewise.
1507 * layout.cc: Likewise.
1508 * layout.h: Likewise.
1509 * main.cc: Likewise.
1510 * merge.cc: Likewise.
1511 * merge.h: Likewise.
1512 * object.cc: Likewise.
1513 * object.h: Likewise.
1514 * options.cc: Likewise.
1515 * options.h: Likewise.
1516 * output.cc: Likewise.
1517 * output.h: Likewise.
1518 * plugin.cc: Likewise.
1519 * plugin.h: Likewise.
1520 * powerpc.cc: Likewise.
1521 * reloc.cc: Likewise.
1522 * script-c.h: Likewise.
1523 * script-sections.cc: Likewise.
1524 * script.cc: Likewise.
1525 * stringpool.cc: Likewise.
1526 * symtab.cc: Likewise.
1527 * symtab.h: Likewise.
1528 * target.cc: Likewise.
1529 * timer.cc: Likewise.
1530 * timer.h: Likewise.
1531 * version.cc: Likewise.
1532 * x86_64.cc: Likewise.
1534 2010-08-24 Nick Clifton <nickc@redhat.com>
1537 * layout.cc (segment_precedes): Sort segments by their physical
1538 addresses, if they have been set.
1540 2010-08-23 Cary Coutant <ccoutant@google.com>
1542 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1544 (Lib_group::include_member): Unlock object after deleting its
1546 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1549 2010-08-19 Neil Vachharajani <nvachhar@google.com>
1550 Cary Coutant <ccoutant@google.com>
1552 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1553 constructor, and set_blocker.
1554 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1556 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1557 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1558 * testsuite/Makefile.am (start_lib_test): New test case.
1559 * testsuite/Makefile.in: Regenerate.
1560 * testsuite/start_lib_test_main.c: New file.
1561 * testsuite/start_lib_test_1.c: New file.
1562 * testsuite/start_lib_test_2.c: New file.
1563 * testsuite/start_lib_test_3.c: New file.
1565 2010-08-19 Ian Lance Taylor <iant@google.com>
1567 * Makefile.in: Rebuild with automake 1.11.1.
1568 * aclocal.m4: Likewise.
1569 * testsuite/Makefile.in: Likewise.
1571 2010-08-19 Ian Lance Taylor <iant@google.com>
1574 * i386.cc (class Output_data_plt_i386): Update declarations.
1575 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1576 local_ifuncs_ fields.
1577 (Target_i386::do_plt_section_for_global): New function.
1578 (Target_i386::do_plt_section_for_local): New function.
1579 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1580 parameter; change all callers. Initialize global_ifuncs_ and
1581 local_ifuncs_. If doing a static link define __rel_iplt_start and
1583 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1584 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1585 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1587 (Target_i386::make_plt_section): New function, broken out of
1588 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1589 (Target_i386::make_plt_entry): Call make_plt_section.
1590 (Target_i386::make_local_ifunc_plt_entry): New function.
1591 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1592 (Target_i386::Scan::local): Handle IFUNC symbols. Add
1593 R_386_IRELATIVE to switch.
1594 (Target_i386::Scan::global): Likewise.
1595 (Target_i386::Relocate::relocate): Likewise.
1596 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1598 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1599 (Target_x86_64::do_plt_section_for_global): New function.
1600 (Target_x86_64::do_plt_section_for_local): New function.
1601 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1602 parameter; change all callers. If doing a static link define
1603 __rela_iplt_start and __rela_iplt_end.
1604 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1605 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1606 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1608 (Target_x86_64::make_local_ifunc_plt_entry): New function.
1609 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1611 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1612 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
1613 R_X86_64_IRELATIVE to switch.
1614 (Target_x86_64::Scan::global): Likewise.
1615 (Target_x86_64::Relocate::relocate): Likewise.
1616 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1618 * target.h (class Target): Add plt_section_for_global and
1619 plt_section_for_local functions. Add do_plt_section_for_global
1620 and do_plt_section_for_local virtual functions.
1621 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
1622 clarifying comments.
1623 (Symbol::use_plt_offset): Handle IFUNC symbol.
1624 * object.cc (Sized_relobj::Sized_relobj): Initialize
1626 (Sized_relobj::local_has_plt_offset): New function.
1627 (Sized_relobj::local_plt_offset): New function.
1628 (Sized_relobj::set_local_plt_offset): New function.
1629 (Sized_relobj::do_count): Handle IFUNC symbol.
1630 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
1631 a bit away from input_shndx_ field. Add set_is_func_symbol and
1632 is_ifunc_symbol functions.
1633 (class Sized_relobj): Update declarations. Remove Tls_got_entry
1634 and Local_tls_got_offsets. Define Local_plt_offsets. Add
1635 local_plt_offsets_ field.
1636 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1637 * output.h (class Output_section_data): Add non-const
1638 output_section function.
1639 (class Output_data_got): Update declarations.
1640 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1641 Add use_plt_offset parameter to global and local constructors.
1642 Change all callers. Change local_sym_index_ field to 31 bits.
1643 Change GSYM_CODE and CONSTANT_CODE accordingly.
1644 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1645 doing a static link don't set sh_link field.
1646 (Output_data_got::Got_entry::write): Use PLT offset if
1648 (Output_data_got::add_global_plt): New function.
1649 (Output_data_got::add_local_plt): New function.
1650 * target-reloc.h (relocate_section): Handle IFUNC symbol.
1651 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1652 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1653 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1654 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1656 * testsuite/ifunc-sel.h: New file.
1657 * testsuite/ifuncmain1.c: New file.
1658 * testsuite/ifuncmain1vis.c: New file.
1659 * testsuite/ifuncmod1.c: New file.
1660 * testsuite/ifuncdep2.c: New file.
1661 * testsuite/ifuncmain2.c: New file.
1662 * testsuite/ifuncmain3.c: New file.
1663 * testsuite/ifuncmod3.c: New file.
1664 * testsuite/ifuncmain4.c: New file.
1665 * testsuite/ifuncmain5.c: New file.
1666 * testsuite/ifuncmod5.c: New file.
1667 * testsuite/ifuncmain6pie.c: New file.
1668 * testsuite/ifuncmod6.c: New file.
1669 * testsuite/ifuncmain7.c: New file.
1670 * configure, testsuite/Makefile.in: Rebuild.
1672 2010-08-18 Ian Lance Taylor <iant@google.com>
1675 (Output_section_incremental_inputs::write_input_files): Add cast
1676 to avoid signed/unsigned comparison warning.
1677 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1679 2010-08-12 Cary Coutant <ccoutant@google.com>
1681 * common.cc (Sort_commons::operator()): Remove unnecessary code.
1683 2010-08-13 Ian Lance Taylor <iant@google.com>
1685 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1687 2010-08-12 Cary Coutant <ccoutant@google.com>
1688 Doug Kwan <dougkwan@google.com>
1690 * resolve.cc (Symbol_table::should_override): When a weak dynamic
1691 defintion overrides non-weak undef, remember that the original undef
1693 * symtab.cc (Symbol_table::sized_write_global): For undef without
1694 an original weak binding, set binding to global in output.
1695 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1696 * testsuite/Makefile.in: Regenerate.
1697 * testsuite/strong_ref_weak_def.sh: New file.
1698 * testsuite/strong_ref_weak_def_1.c: Ditto.
1699 * testsuite/strong_ref_weak_def_2.c: Ditto.
1701 2010-08-12 Cary Coutant <ccoutant@google.com>
1703 * testsuite/incremental_test.sh: Rewrite.
1704 * testsuite/incremental_test_1.c: Rewrite.
1705 * testsuite/incremental_test_2.c: Rewrite.
1707 2010-08-12 Cary Coutant <ccoutant@google.com>
1709 * arm.cc (Target_arm::got_size): Add const.
1710 (Target_arm::got_entry_count): New function.
1711 (Target_arm::plt_entry_count): New function.
1712 (Target_arm::first_plt_entry_offset): New function.
1713 (Target_arm::plt_entry_size): New function.
1714 (Output_data_plt_arm::entry_count): New function.
1715 (Output_data_plt_arm::first_plt_entry_offset): New function.
1716 (Output_data_plt_arm::get_plt_entry_size): New function.
1717 * i386.cc (Target_i386::got_size): Add const.
1718 (Target_i386::got_entry_count): New function.
1719 (Target_i386::plt_entry_count): New function.
1720 (Target_i386::first_plt_entry_offset): New function.
1721 (Target_i386::plt_entry_size): New function.
1722 (Output_data_plt_i386::entry_count): New function.
1723 (Output_data_plt_i386::first_plt_entry_offset): New function.
1724 (Output_data_plt_i386::get_plt_entry_size): New function.
1725 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1726 find_incremental_inputs_sections. Dump incremental_got_plt section.
1727 * incremental.cc: Include target.h.
1728 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1729 parameter. Adjust all callers. Find incremental_got_plt section.
1730 (Incremental_inputs::create_data_sections): Create incremental_got_plt
1732 (Output_section_incremental_inputs::set_final_data_size): Calculate
1733 size of incremental_got_plt section.
1734 (Output_section_incremental_inputs::do_write): Write the
1735 incremental_got_plt section.
1736 (Got_plt_view_info): New struct.
1737 (Local_got_offset_visitor): New class.
1738 (Global_got_offset_visitor): New class.
1739 (Global_symbol_visitor_got_plt): New class.
1740 (Output_section_incremental_inputs::write_got_plt): New function.
1741 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1742 Add parameter. Adjust all callers.
1743 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1744 (Incremental_inputs::got_plt_section): New function.
1745 (Incremental_inputs::got_plt_section_): New data member.
1746 (Incremental_got_plt_reader): New class.
1747 * layout.cc (Layout::create_incremental_info_sections): Add the
1748 incremental_got_plt section.
1749 * object.h (Got_offset_list::get_list): New function.
1750 (Got offset_list::for_all_got_offsets): New function.
1751 (Sized_relobj::local_got_offset_list): New function.
1752 * powerpc.cc (Target_powerpc::got_size): Add const.
1753 (Target_powerpc::got_entry_count): New function.
1754 (Target_powerpc::plt_entry_count): New function.
1755 (Target_powerpc::first_plt_entry_offset): New function.
1756 (Target_powerpc::plt_entry_size): New function.
1757 (Output_data_plt_powerpc::entry_count): New function.
1758 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1759 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1760 * sparc.cc (Target_sparc::got_size): Add const.
1761 (Target_sparc::got_entry_count): New function.
1762 (Target_sparc::plt_entry_count): New function.
1763 (Target_sparc::first_plt_entry_offset): New function.
1764 (Target_sparc::plt_entry_size): New function.
1765 (Output_data_plt_sparc::entry_count): New function.
1766 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1767 (Output_data_plt_sparc::get_plt_entry_size): New function.
1768 * symtab.h (Symbol::got_offset_list): New function.
1769 (Symbol_table::for_all_symbols): New function.
1770 * target.h (Sized_target::got_entry_count): New function.
1771 (Sized_target::plt_entry_count): New function.
1772 (Sized_target::plt_entry_size): New function.
1773 * x86_64.cc (Target_x86_64::got_size): Add const.
1774 (Target_x86_64::got_entry_count): New function.
1775 (Target_x86_64::plt_entry_count): New function.
1776 (Target_x86_64::first_plt_entry_offset): New function.
1777 (Target_x86_64::plt_entry_size): New function.
1778 (Output_data_plt_x86_64::entry_count): New function.
1779 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1780 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1782 2010-08-12 Cary Coutant <ccoutant@google.com>
1784 * archive.cc: Include incremental.h.
1785 (Archive::Archive): Initialize incremental_info_.
1786 (Archive::include_member): Record archive members in incremental info.
1787 (Add_archive_symbols::run): Record begin and end of an archive in
1789 (Lib_group::include_member): Record objects in incremental info.
1790 * archive.h (Incremental_archive_entry): Forward declaration.
1791 (Archive::set_incremental_info): New member function.
1792 (Archive::incremental_info): New member function.
1793 (Archive::Unused_symbol_iterator): New class.
1794 (Archive::unused_symbols_begin): New member function.
1795 (Archive::unused_symbols_end): New member function.
1796 (Archive::incremental_info_): New data member.
1797 * incremental-dump.cc (find_input_containing_global): New function.
1798 (dump_incremental_inputs): Dump new incremental info sections.
1799 * incremental.cc: Include symtab.h.
1800 (Output_section_incremental_inputs): New class.
1801 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1802 new incremental info sections.
1803 (Sized_incremental_binary::do_check_inputs): Likewise.
1804 (Incremental_inputs::report_archive): Remove.
1805 (Incremental_inputs::report_archive_begin): New function.
1806 (Incremental_inputs::report_archive_end): New function.
1807 (Incremental_inputs::report_object): New function.
1808 (Incremental_inputs::finalize_inputs): Remove.
1809 (Incremental_inputs::report_input_section): New function.
1810 (Incremental_inputs::report_script): Rewrite.
1811 (Incremental_inputs::finalize): Do nothing but finalize string table.
1812 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1813 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1814 (Incremental_inputs::create_data_sections): New function.
1815 (Incremental_inputs::relocs_entsize): New function.
1816 (Output_section_incremental_inputs::set_final_data_size): New function.
1817 (Output_section_incremental_inputs::do_write): New function.
1818 (Output_section_incremental_inputs::write_header): New function.
1819 (Output_section_incremental_inputs::write_input_files): New function.
1820 (Output_section_incremental_inputs::write_info_blocks): New function.
1821 (Output_section_incremental_inputs::write_symtab): New function.
1822 * incremental.h (Incremental_script_entry): Forward declaration.
1823 (Incremental_object_entry): Forward declaration.
1824 (Incremental_archive_entry): Forward declaration.
1825 (Incremental_inputs): Forward declaration.
1826 (Incremental_inputs_header_data): Remove.
1827 (Incremental_inputs_header): Remove.
1828 (Incremental_inputs_header_write): Remove.
1829 (Incremental_inputs_entry_data): Remove.
1830 (Incremental_inputs_entry): Remove.
1831 (Incremental_inputs_entry_write): Remove.
1832 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1833 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1834 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1835 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1837 (Incremental_input_entry): New class.
1838 (Incremental_script_entry): New class.
1839 (Incremental_object_entry): New class.
1840 (Incremental_archive_entry): New class.
1841 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1842 (Incremental_inputs::report_inputs): Remove.
1843 (Incremental_inputs::report_archive): Remove.
1844 (Incremental_inputs::report_archive_begin): New function.
1845 (Incremental_inputs::report_archive_end): New function.
1846 (Incremental_inputs::report_object): Change prototype.
1847 (Incremental_inputs::report_input_section): New function.
1848 (Incremental_inputs::report_script): Change prototype.
1849 (Incremental_inputs::get_reloc_count): New function.
1850 (Incremental_inputs::set_reloc_count): New function.
1851 (Incremental_inputs::create_data_sections): New function.
1852 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1853 (Incremental_inputs::inputs_section): New function.
1854 (Incremental_inputs::symtab_section): New function.
1855 (Incremental_inputs::relocs_section): New function.
1856 (Incremental_inputs::get_stringpool): Add const.
1857 (Incremental_inputs::command_line): Add const.
1858 (Incremental_inputs::inputs): Remove.
1859 (Incremental_inputs::command_line_key): New function.
1860 (Incremental_inputs::input_file_count): New function.
1861 (Incremental_inputs::input_files): New function.
1862 (Incremental_inputs::relocs_entsize): New function.
1863 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1864 (Incremental_inputs::finalize_inputs): Remove.
1865 (Incremental_inputs::Input_info): Remove.
1866 (Incremental_inputs::lock_): Remove.
1867 (Incremental_inputs::inputs_): Change type.
1868 (Incremental_inputs::inputs_map_): Remove.
1869 (Incremental_inputs::current_object_entry_): New data member.
1870 (Incremental_inputs::inputs_section_): New data member.
1871 (Incremental_inputs::symtab_section_): New data member.
1872 (Incremental_inputs::relocs_section_): New data member.
1873 (Incremental_inputs::reloc_count_): New data member.
1874 (Incremental_inputs_reader): New class.
1875 (Incremental_symtab_reader): New class.
1876 (Incremental_relocs_reader): New class.
1877 * layout.cc (Layout::finalize): Move finalization of incremental info
1878 and creation of incremental info sections to follow finalization of
1879 symbol table. Set offsets for postprocessing sections.
1880 (Layout::create_incremental_info_sections): Call
1881 Incremental_inputs::create_data_sections. Add incremental symtab
1882 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1883 sections to layout after input sections.
1884 * layout.h (struct Timespec): Forward declaration.
1885 (Layout::incremental_inputs): Add const.
1886 (Layout::create_incremental_info_sections): Add parameter.
1887 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1888 * object.cc: Include incremental.h.
1889 (Relobj::finalize_incremental_relocs): New function.
1890 (Sized_relobj::do_layout): Record input sections in incremental info.
1891 * object.h (Object::output_section): New function.
1892 (Object::output_section_offset): Moved from Relobj.
1893 (Object::get_incremental_reloc_base): New function.
1894 (Object::get_incremental_reloc_count): New function.
1895 (Object::do_output_section): New function.
1896 (Object::do_output_section_offset): Moved from Relobj.
1897 (Object::do_get_incremental_reloc_base): New function.
1898 (Object::do_get_incremental_reloc_count): New function.
1899 (Object::Object): Initialize new data members.
1900 (Relobj::output_section): Renamed do_output_section and moved to
1902 (Relobj::output_section_offset): Moved to Object.
1903 (Relobj::do_get_incremental_reloc_base): New function.
1904 (Relobj::do_get_incremental_reloc_count): New function.
1905 (Relobj::allocate_incremental_reloc_counts): New function.
1906 (Relobj::count_incremental_reloc): New function.
1907 (Relobj::finalize_incremental_relocs): New function.
1908 (Relobj::next_incremental_reloc_index): New function.
1909 (Relobj::reloc_counts_): New data member.
1910 (Relobj::reloc_bases_): New data member.
1911 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
1912 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
1913 (Sized_relobj::incremental_relocs_scan): New function.
1914 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1915 (Sized_relobj::incremental_relocs_write): New function.
1916 (Sized_relobj::incremental_relocs_write_reltype): New function.
1917 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1919 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1920 archives and object files elsewhere.
1921 (Add_symbols::run): Report object files here.
1922 (Finish_group::run): Report end of archive at end of group.
1923 * reloc.cc: Include layout.h, incremental.h.
1924 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1925 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1926 (Sized_relobj::incremental_relocs_scan): New function.
1927 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1928 (Sized_relobj::do_relocate_sections): Write incremental relocations.
1929 (Sized_relobj::incremental_relocs_write): New function.
1930 (Sized_relobj::incremental_relocs_write_reltype): New function.
1931 * script.cc (read_input_script): Rewrite test for incremental link.
1932 Change call to Incremental_inputs::report_script.
1933 * symtab.h (Symbol_table::first_global_index): New function.
1934 (Symbol_table::output_count): New function.
1936 2010-08-12 Doug Kwan <dougkwan@google.com>
1938 * arm.cc (Target_arm::merge_object_attributes): Check command line
1939 options --no-wchar-size-warning and --no-enum-size-warning.
1940 * options.h (General_options): Add ld-compatible options
1941 --no-enum-size-warning and --no-wchar-size-warning.
1943 2010-08-04 Ian Lance Taylor <iant@google.com>
1945 * x86_64.cc (Target_x86_64::Scan::local): Use
1946 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1947 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1948 (Target_x86_64::Scan::global): Likewise.
1949 (Target_x86_64::Relocate::relocate): Likewise.
1950 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1953 2010-08-03 Cary Coutant <ccoutant@google.com>
1955 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1956 to reserve space in merged_strings vector. Keep total input size
1958 (Output_merge_string::do_print_merge_stats): Print total input size.
1959 * merge.h (Output_merge_string): Add input_size_ field.
1960 * stringpool.cc (Stringpool_template::string_length): Move
1961 implementations out of Stringpool_template class and place in
1963 * stringpool.h (string_length): Move out of Stringpool_template.
1965 2010-08-03 Ian Lance Taylor <iant@google.com>
1968 * layout.cc (relaxation_loop_body): If address of load segment is
1969 set, adjust address to include headers if possible.
1971 2010-08-03 Ian Lance Taylor <iant@google.com>
1973 * version.cc (version_string): Bump to 1.10.
1975 2010-08-03 Ian Lance Taylor <iant@google.com>
1978 * layout.h (enum Output_section_order): Define.
1979 (class Layout): Update declarations.
1980 * layout.cc (Layout::get_output_section): Add order parameter.
1981 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1982 is_first_non_relro parameters. Change all callers.
1983 (Layout::choose_output_section): Likewise.
1984 (Layout::add_output_section_data): Likewise.
1985 (Layout::make_output_section): Likewise. Set order.
1986 (Layout::default_section_order): New function.
1987 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1988 * output.cc (Output_section::Output_section): Initialize order_.
1989 Don't initialize deleted fields.
1990 (Output_segment::Output_segment): Don't initialize deleted
1992 (Output_segment::add_output_section_to_load): New function
1993 replacing add_output_section. Change all callers to call this or
1994 add_output_section_to_nonload.
1995 (Output_segment::add_output_section_to_nonload): New function.
1996 (Output_segment::remove_output_section): Rewrite.
1997 (Output_segment::add_initial_output_data): Likewise.
1998 (Output_segment::has_any_data_sections): Likewise.
1999 (Output_segment::is_first_section_relro): Likewise.
2000 (Output_segment::maximum_alignment): Likewise.
2001 (Output_segment::has_dynamic_reloc): New function replacing
2002 dynamic_reloc_count. Change all callers.
2003 (Output_segment::has_dynamic_reloc_list): New function replacing
2004 dynamic_reloc_count_list. Change all callers.
2005 (Output_segment::set_section_addresses): Rewrite.
2006 (Output_segment::set_offset): Rewrite.
2007 (Output_segment::find_first_and_last_list): Remove.
2008 (Output_segment::set_tls_offsets): Rewrite.
2009 (Output_segment::first_section_load_address): Likewise.
2010 (Output_segment::output_section_count): Likewise.
2011 (Output_segment::section_with_lowest_load_address): Likewise.
2012 (Output_segment::write_section_headers): Likewise.
2013 (Output_segment::print_sections_to_map): Likewise.
2014 * output.h (class Output_data): Remove dynamic_reloc_count_
2015 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2016 (Output_data::add_dynamic_reloc): Rewrite.
2017 (Output_data::has_dynamic_reloc): New function.
2018 (Output_data::dynamic_reloc_count): Remove.
2019 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2020 is_last_relro_, is_first_non_relro_, is_interp_,
2021 is_dynamic_linker_section_ fields. Add order and set_order
2022 functions. Remove is_relro_local, set_is_relro_local,
2023 is_last_relro, set_is_last_relro, is_first_non_relro,
2024 set_is_first_non_relro functions, is_interp, set_is_interp,
2025 is_dynamic_linker_section, and set_is_dynamic_linker_section
2027 (class Output_segment): Change Output_data_list from std::list to
2028 std:;vector. Add output_lists_ field. Remove output_data_ and
2029 output_bss_ fields. Update declarations.
2031 2010-08-02 Ian Lance Taylor <iant@google.com>
2033 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2034 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2035 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2037 2010-08-02 Ian Lance Taylor <iant@google.com>
2040 * script.cc (Script_options::Script_options): Initialize
2041 symbol_definitions_ and symbol_references_.
2042 (Script_options::add_symbol_assignment): Update
2043 symbol_definitions_ and symbol_references_.
2044 (Script_options::add_symbol_reference): New function.
2045 (script_symbol): New function.
2046 * script.h (class Script_options): Add symbol_definitions_ and
2047 symbol_references_ fields.
2048 (Script_options::referenced_const_iterator): New type.
2049 (Script_options::referenced_begin): New function.
2050 (Script_options::referenced_end): New function.
2051 (Script_options::is_referenced): New function.
2052 (Script_options::any_unreferenced): New function.
2053 * script-c.h (script_symbol): Declare.
2054 * yyscript.y (exp): Call script_symbol.
2055 * symtab.cc: Include "script.h".
2056 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2057 Change all callers. Check symbols referenced by scripts.
2058 (Symbol_table::add_undefined_symbols_from_command_line): Add
2059 layout parameter. Change all callers.
2060 (Symbol_table::do_add_undefined_symbols_from_command_line):
2061 Likewise. Break out loop body. Check symbols referenced by
2063 (Symbol_table::add_undefined_symbol_from_command_line): New
2064 function broken out of
2065 do_add_undefined_symbols_from_command_line.
2066 * symtab.h (class Symbol_table): Update declarations.
2067 * archive.cc: Include "layout.h".
2068 (Archive::should_include_member): Add layout parameter. Change
2069 all callers. Check for symbol mentioned in expression.
2070 * archive.h (class Archive): Update declaration.
2071 * object.cc (Sized_relobj::do_should_include_member): Add layout
2073 * object.h (Object::should_include_member): Add layout parameter.
2075 (Object::do_should_include_member): Add layout parameter.
2076 (class Sized_relobj): Update declaration.
2077 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2079 * dynobj.h (class Sized_dynobj): Update declaration.
2080 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2082 * plugin.h (class Sized_pluginobj): Update declaration.
2084 2010-08-02 Ian Lance Taylor <iant@google.com>
2087 * output.cc (Output_segment::set_offset): Search for the first and
2088 last sections rather than assuming that the list is in order.
2089 (Output_segment::find_first_and_last_list): New function.
2090 * output.h (class Output_segment): Update declarations.
2091 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2092 (relro_strip_test_SOURCES): New variable.
2093 (relro_strip_test_DEPENDENCIES): New variable.
2094 (relro_strip_test_LDFLAGS): New variable.
2095 (relro_strip_test_LDADD): New variable.
2096 (relro_strip_test.so): New target.
2098 2010-08-02 Ian Lance Taylor <iant@google.com>
2100 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2101 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2102 (Target_i386::got_tlsdesc_section): New function.
2103 (Target_i386::got_section): Create space for GOT entries for
2104 TLSDESC relocations.
2105 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2107 (Target_i386::Scan::global): Likewise.
2108 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2110 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2111 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2112 (Target_x86_64::got_tlsdesc_section): New function.
2113 (Target_x86_64::got_section): Create space for GOT entries for
2114 TLSDESC relocations.
2115 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2117 (Target_x86_64::Scan::global): Likewise.
2118 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2121 2010-08-02 Ian Lance Taylor <iant@google.com>
2123 * testsuite/final_layout.sh: Use dc to convert from hex to
2126 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2128 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2129 paramter to the call to gold::gc_process_relocs.
2130 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2131 paramter to the call to gold::gc_process_relocs.
2132 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2133 parameter to the call to gold::gc_process_relocs.
2134 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2135 template parameter to the call to gold::gc_process_relocs.
2136 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2137 paramter to the call to gold::gc_process_relocs.
2138 * gc.h (get_embedded_addend_size): New function.
2139 (gc_process_relocs): Save the size of the reloc for use by ICF.
2140 * icf.cc (get_section_contents): Get the addend from the text section
2141 for SHT_REL relocation sections.
2142 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2143 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2144 * int_encoding.h (read_from_pointer): New overloaded function.
2145 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2146 * testsuite/icf_sht_rel_addend_test.sh: New file.
2147 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2148 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2150 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2152 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2153 * Makefile.in: Regenerate.
2154 * testsuite/Makefile.in: Regenerate.
2156 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2158 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2159 * gold/testsuite/debug_msg.cc: Likewise.
2160 * gold/testsuite/odr_violation1.cc
2161 * gold/testsuite/odr_violation2.cc
2163 2010-07-21 Cary Coutant <ccoutant@google.com>
2165 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2166 string, and length fields.
2167 (Output_merge_string::Merged_strings_list): New type.
2168 (Output_merge_string::Merged_strings_lists): New typedef.
2169 (Output_merge_string): Replace merged_strings_ with
2170 merged_strings_lists_.
2171 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2172 Merged_strings_list per input object and section. Don't store pointer
2173 to the string. Don't store length with each merged string entry.
2174 (Output_merge_string::finalize_merged_data): Loop over list of merged
2175 strings lists. Recompute length of each merged string.
2177 2010-07-15 Cary Coutant <ccoutant@google.com>
2179 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2182 2010-07-14 Ian Lance Taylor <iant@google.com>
2184 * descriptors.cc (Descriptors::open): Report correct name in error
2187 2010-07-13 Doug Kwan <dougkwan@google.com>
2189 * arm.cc (Arm_input_section::Arm_input_section): For a
2190 SHT_ARM_EXIDX section, always keeps the input sections.
2191 (Arm_input_section::set_exidx_section_link): New method.
2192 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2193 has_errors_ to false.
2194 (Arm_exidx_input_section::has_errors,
2195 Arm_exidx_input_section::set_has_errors): New methods.
2196 (Arm_exidx_input_section::has_errors_): New data member.
2197 (Arm_relobj::get_exidx_shndx_list): New method.
2198 (Arm_output_section::append_text_sections_to_list): Do not skip
2199 section without SHF_EXECINSTR.
2200 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2202 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2203 section header. Make error messages more verbose. Check for
2204 a non-executable section linked to an EXIDX section.
2205 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2206 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2207 check that there is no deferred EXIDX section if we exit early.
2208 Instead of not making an EXIDX section in case of an error, make one
2209 and set the has_errors flag of it.
2210 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2211 in a relocatable link.
2212 (Target_arm::do_relax): Look for the EXIDX output section instead of
2213 assuming that it is called .ARM.exidx.
2214 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2215 section list. Do not check for SHF_EXECINSTR section flags but
2216 skip any input section with errors.
2217 * output.cc (Output_section::Output_section): Initialize
2218 always_keeps_input_sections_ to false.
2219 (Output_section::add_input_section): Check for
2220 always_keeps_input_sections_.
2221 * output.h (Output_section::always_keeps_input_sections,
2222 Output_section::set_always_keeps_input_sections): New methods.
2223 (Output_section::always_keeps_input_sections): New data member.
2225 2010-07-13 Rafael Espindola <espindola@google.com>
2227 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2228 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2230 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2231 Ian Lance Taylor <iant@google.com>
2233 * output.h (Output_section_lookup_maps::add_merge_section):
2234 Correct check of whether value was inserted.
2235 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2236 (Output_section_lookup_maps::add_relaxed_input_section):
2238 * arm.cc (Target_arm::got_section): Remove used local os.
2239 * i386.cc (Target_i386::got_section): Likewise.
2240 * x86_64.cc (Target_x86_64::got_section): Likewise.
2241 * sparc.cc (Target_sparc::got_section): Likewise.
2242 (Target_sparc::relocate): Remove unused local have_got_offset.
2243 * powerpc.cc (Target_powerpc::relocate): Likewise.
2245 2010-07-13 Ian Lance Taylor <iant@google.com>
2247 * compressed_output.cc (zlib_decompress): Fix signature in
2250 * archive.cc (Archive::include_member): Unlock an external member
2251 of a thin archive. Don't bother to delete an object we know is
2254 2010-07-12 Cary Coutant <ccoutant@google.com>
2256 * compressed_output.cc (zlib_decompress): New function.
2257 (get_uncompressed_size): New function.
2258 (decompress_input_section): New function.
2259 * compressed_output.h (get_uncompressed_size): New function.
2260 (decompress_input_section): New function.
2261 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2262 Handle compressed debug sections.
2263 * layout.cc (is_compressed_debug_section): New function.
2264 (Layout::output_section_name): Map compressed section names to
2266 * layout.h (is_compressed_debug_section): New function.
2267 (is_debug_info_section): Recognize compressed debug sections.
2268 * merge.cc: Include compressed_output.h.
2269 (Output_merge_data::do_add_input_section): Handle compressed
2271 (Output_merge_string::do_add_input_section): Handle compressed
2273 * object.cc: Include compressed_output.h.
2274 (Sized_relobj::Sized_relobj): Initialize new data members.
2275 (build_compressed_section_map): New function.
2276 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2277 * object.h (Object::section_is_compressed): New method.
2278 (Object::do_section_is_compressed): New method.
2279 (Sized_relobj::Compressed_section_map): New type.
2280 (Sized_relobj::do_section_is_compressed): New method.
2281 (Sized_relobj::compressed_sections_): New data member.
2282 * output.cc (Output_section::add_input_section): Handle compressed
2284 * reloc.cc: Include compressed_output.h.
2285 (Sized_relobj::write_sections): Handle compressed debug sections.
2287 2010-07-08 Cary Coutant <ccoutant@google.com>
2289 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2290 weak when resolving to a dynamic def.
2291 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2292 for weak undef/dynamic def cases. Adjust callers.
2293 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2294 undef_binding_weak_.
2295 (Symbol_table::sized_write_globals): Adjust symbol binding.
2296 (Symbol_table::sized_write_symbol): Add binding parameter.
2297 * symtab.h (Symbol::set_undef_binding): New method.
2298 (Symbol::is_undef_binding_weak): New method.
2299 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2300 (Symbol_table::should_override): Add new parameter.
2301 (Symbol_table::sized_write_symbol): Add new parameter.
2303 * testsuite/weak_undef_file1.cc: Add new test case.
2304 * testsuite/weak_undef_file2.cc: Fix header comment.
2305 * testsuite/weak_undef_test.cc: Add new test case.
2307 2010-06-29 Doug Kwan <dougkwan@google.com>
2309 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2310 Initialize USE_SYMBOL_.
2311 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2313 (Arm_reloc_property::uses_symbol_): New data member declaration.
2314 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2315 uses symbol value and symbol is undefined but not weakly undefined.
2317 2010-06-28 Rafael Espindola <espindola@google.com>
2319 * plugin.cc (Plugin::load): Use dlerror.
2321 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2323 * symtab.cc (detect_odr_violations): When reporting an ODR
2324 violation, report an object where the symbol is defined.
2326 2010-06-25 Doug Kwan <dougkwan@google.com>
2328 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2329 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2331 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2332 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2333 target hook to detect function points.
2334 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2335 * icf.h (Icf::check_section_for_function_pointers): Change type of
2336 parameter SECTION_NAME to const reference to std::string. Use
2337 target hook to determine if section may have unsafe pointers.
2338 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2341 2010-06-21 Rafael Espindola <espindola@google.com>
2343 * fileread.cc (Input_file::find_fie): New
2344 (Input_file::open): Use Input_file::find_fie.
2345 * fileread.h (Input_file::find_fie): New
2346 * plugin.cc (set_extra_library_path): New.
2347 (Plugin::load): Add set_extra_library_path to the transfer vector.
2348 (Plugin_manager::set_extra_library_path): New.
2349 (Plugin_manager::add_input_file): Use the extra search path if set.
2350 (set_extra_library_path(): New.
2351 * plugin.h (Plugin_manager): Add set_extra_library_path and
2354 2010-06-19 Cary Coutant <ccoutant@google.com>
2356 * layout.cc (gdb_sections): Add .debug_types.
2357 (lines_only_debug_sections): Likewise.
2359 2010-06-18 Rafael Espindola <espindola@google.com>
2361 * plugin.cc (add_input_file,add_input_library)
2362 (Plugin_manager::add_input_file): Make filename arguments const.
2363 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2366 2010-06-16 Doug Kwan <dougkwan@google.com>
2368 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2369 .ARM.attributes section if we have not merged any input
2370 attributes sections.
2372 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2374 * arm.cc: Allow combining objects with no EABI version
2377 2010-06-15 Rafael Espindola <espindola@google.com>
2379 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2381 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2383 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2384 (struct iovec): Correct !HAVE_READV definition.
2386 2010-06-10 Cary Coutant <ccoutant@google.com>
2388 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2389 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2391 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2394 * symtab.h (Symbol::is_placeholder): New member function.
2395 * target-reloc.h (relocate_section): Check for placeholder symbols.
2397 * testsuite/Makefile.am (plugin_test_8): New test.
2398 (plugin_test_9): New test.
2399 * testsuite/Makefile.in: Regenerate.
2401 2010-06-09 Nick Clifton <nickc@redhat.com>
2403 * yyscript.y (input_list_element): Allow strings prefixed with
2404 the '-' character. Treat these as libraries.
2405 * script.cc (script_add_library): New function. Adds a library
2406 specified by "-l<name>" found in an input script.
2407 * script-c.h: Add prototype for script_add_library.
2409 2010-06-07 Doug Kwan <dougkwan@google.com>
2411 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2412 Restrict stub-group size to be within long conditional branch
2413 range when working around cortex-A8 erratum.
2415 2010-06-07 Damien Diederen <dd@crosstwine.com>
2417 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2420 2010-06-03 Sriraman Tallam <tmsriram@google.com>
2424 (Output_section::Input_section_sort_entry::compare_section_ordering):
2425 Change to return non-zero correctly.
2426 (Output_section::Input_section_sort_section_order_index_compare
2427 ::operator()): Change to fix ambiguity in comparisons.
2429 2010-06-01 Sriraman Tallam <tmsriram@google.com>
2431 * gold.h (is_wildcard_string): New function.
2432 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2433 (Layout::layout_eh_frame): Ditto.
2434 (Layout::find_section_order_index): New method.
2435 (Layout::read_layout_from_file): New method.
2436 * layout.h (Layout::find_section_order_index): New method.
2437 (Layout::read_layout_from_file): New method.
2438 (Layout::input_section_position_): New private member.
2439 (Layout::input_section_glob_): New private member.
2440 * main.cc (main): Call read_layout_from_file here.
2441 * options.h (--section-ordering-file): New option.
2442 * output.cc (Output_section::input_section_order_specified_): New
2444 (Output_section::Output_section): Initialize new member.
2445 (Output_section::add_input_section): Add new parameter.
2446 Keep input sections when --section-ordering-file is used.
2447 (Output_section::set_final_data_size): Sort input sections when
2448 section ordering file is specified.
2449 (Output_section::Input_section_sort_entry): Add new parameter.
2451 (Output_section::Input_section_sort_entry::compare_section_ordering):
2453 (Output_section::Input_section_sort_compare::operator()): Change to
2454 consider section_order_index.
2455 (Output_section::Input_section_sort_init_fini_compare::operator()):
2456 Change to consider section_order_index.
2457 (Output_section::Input_section_sort_section_order_index_compare
2458 ::operator()): New method.
2459 (Output_section::sort_attached_input_sections): Change to sort
2460 according to section order when specified.
2461 (Output_section::add_input_section<32, true>): Add new parameter.
2462 (Output_section::add_input_section<64, true>): Add new parameter.
2463 (Output_section::add_input_section<32, false>): Add new parameter.
2464 (Output_section::add_input_section<64, false>): Add new parameter.
2465 * output.h (Output_section::add_input_section): Add new parameter.
2466 (Output_section::input_section_order_specified): New
2468 (Output_section::set_input_section_order_specified): New method.
2469 (Input_section::Input_section): Initialize section_order_index_.
2470 (Input_section::section_order_index): New method.
2471 (Input_section::set_section_order_index): New method.
2472 (Input_section::section_order_index_): New member.
2473 (Input_section::Input_section_sort_section_order_index_compare): New
2475 (Output_section::input_section_order_specified_): New member.
2476 * script-sections.cc (is_wildcard_string): Delete and move modified
2478 (Output_section_element_input::Output_section_element_input): Modify
2479 call to is_wildcard_string.
2480 (Output_section_element_input::Input_section_pattern
2481 ::Input_section_pattern): Ditto.
2482 (Output_section_element_input::Output_section_element_input): Ditto.
2483 * testsuite/Makefile.am (final_layout): New test case.
2484 * testsuite/Makefile.in: Regenerate.
2485 * testsuite/final_layout.cc: New file.
2486 * testsuite/final_layout.sh: New file.
2488 2010-06-01 Rafael Espindola <espindola@google.com>
2490 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2492 2010-06-01 Rafael Espindola <espindola@google.com>
2494 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2495 visibility of symbols.
2497 2010-05-27 Doug Kwan <dougkwan@google.com>
2499 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2500 from start of output section instead of address for a local symbol
2501 in a merged or relaxed section when doing a relocatable link.
2503 2010-05-26 Rafael Espindola <espindola@google.com>
2506 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2507 adding sections the garbage collector removed.
2508 * gold/testsuite/Makefile.am: Add test.
2509 * gold/testsuite/Makefile.in: Regenerate.
2510 * gold/testsuite/plugin_test_7.sh: New.
2511 * gold/testsuite/plugin_test_7_1.c: New.
2512 * gold/testsuite/plugin_test_7_2.c: New.
2514 2010-05-26 Rafael Espindola <espindola@google.com>
2516 * script-sections.cc (Output_section_definition::set_section_addresses):
2517 Check for --section-start.
2519 2010-05-26 Doug Kwan <dougkwan@google.com>
2521 * arm.cc (Arm_scan_relocatable_relocs): New class.
2522 (Target_arm::relocate_special_relocatable): New method.
2523 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2524 (Arm_relocate_functions::thumb_branch_common): Same.
2525 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2526 instead of Default_scan_relocatable_relocs.
2527 * target-reloc.h (relocate_for_relocatable): Let target handle
2528 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2529 * target.h (Sized_target::relocate_special_relocatable): New method.
2531 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2533 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2535 2010-05-23 Doug Kwan <dougkwan@google.com>
2537 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2539 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2540 with a direct branch, not a conditional branch, to a stub.
2541 * merge.cc (Output_merge_base::record_input_section): New method
2543 (Output_merge_data::do_add_input_section): Record input section if
2544 keeps-input-sections flag is set.
2545 (Output_merge_string::do_add_input_section): Ditto.
2546 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2547 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2549 (Output_merge_base::keeps_input_sections,
2550 Output_merge_base::set_keeps_input_sections,
2551 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2553 (Output_merge_base::Input_sections): New type declaration.
2554 (Output_merge_base::input_sections_begin,
2555 Output_merge_base::input_sections_end,
2556 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2557 (Output_merge_base::bool keeps_input_sections_,
2558 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2559 Output_merge_base::input_sections_): New data members.
2560 (Output_merge_data::do_set_keeps_input_sections): New method
2562 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2563 * output.cc (Output_section::Input_section::relobj): Move method
2564 defintion from class declaration to here and handle merge sections.
2565 (Output_section::Input_section::shndx): Ditto.
2566 (Output_section::Output_section): Remove initializations of removed
2567 data members and initialize new data member LOOKUP_MAPS_.
2568 (Output_section::add_input_section): Set keeps-input-sections flag
2569 for a newly created merge output section as appropriate. Adjust code
2570 to use Output_section_lookup_maps class.
2571 (Output_section::add_relaxed_input_section): Adjst code for lookup
2572 maps code refactoring.
2573 (Output_section::add_merge_input_section): Add a new parameter
2574 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2575 class. If adding input section to a newly created merge output
2576 section fails, remove the new merge section.
2577 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2578 Adjust code for use of the Output_section_lookup_maps class.
2579 (Output_section::find_merge_section): Ditto.
2580 (Output_section::build_lookup_maps): New method defintion.
2581 (Output_section::find_relaxed_input_section): Adjust code to use
2582 Output_section_lookup_maps class.
2583 (Output_section::get_input_sections): Export merge sections. Adjust
2584 code to use Output_section_lookup_maps class.
2585 (Output_section:::add_script_input_section): Adjust code to use
2586 Output_section_lookup_maps class. Update lookup maps for merge
2588 (Output_section::discard_states): Use Output_section_lookup_maps.
2589 (Output_section::restore_states): Same.
2590 * output.h (Merge_section_properties): Move class defintion out of
2592 (Output_section_lookup_maps): New class.
2593 (Output_section::Input_section::is_merge_section): New method
2595 (Output_section::Input_section::relobj): Move defintion out of class
2596 defintion. Declare method only.
2597 (Output_section::Input_section::shndx): Ditto.
2598 (Output_section::Input_section::output_merge_base): New method defintion.
2599 (Output_section::Input_section::u2_.pomb): New union field.
2600 (Output_section::Merge_section_by_properties_map,
2601 Output_section::Output_section_data_by_input_section_map,
2602 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2604 (Output_section::add_merge_input_section): Add new parameter
2605 KEEPS_INPUT_SECTIONS.
2606 (Output_section::build_lookup_maps): New method declaration.
2607 (Output_section::merge_section_map_,
2608 Output_section::merge_section_by_properties_map_,
2609 Output_section::relaxed_input_section_map_,
2610 Output_section::is_relaxed_input_section_map_valid_): Remove data
2612 (Output_section::lookup_maps_): New data member.
2614 2010-05-21 Doug Kwan <dougkwan@google.com>
2617 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2618 avoid a compilation error.
2620 2010-05-19 Rafael Espindola <espindola@google.com>
2622 * script-sections.cc (Output_section_definition::allocate_to_segment):
2623 Update the phdrs_list even when the output section is NULL.
2624 * testsuite/Makefile.am: Add test.
2625 * testsuite/Makefile.in: Regenerate.
2626 * testsuite/script_test_9.cc: New.
2627 * testsuite/script_test_9.sh: New.
2628 * testsuite/script_test_9.t: New.
2630 2010-05-19 Doug Kwan <dougkwan@google.com>
2632 * arm.cc (Arm_input_section::original_size): New method.
2633 (Arm_input_section::do_addralign): Add a cast.
2634 (Arm_input_section::do_output_offset): Remove static cast.
2635 (Arm_input_section::original_addralign,
2636 Arm_input_section::original_size_): Change type to uint32_t.
2637 (Arm_input_section::init): Add safe casts for section alignment
2639 (Arm_input_section::set_final_data_size): Do not set address and
2640 offset of stub table.
2641 (Arm_output_section::fix_exidx_coverage): Change use of of
2642 Output_section::Simple_input_section to that of
2643 Output_section::Input_section.
2644 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2645 except for the first pass.
2646 * output.cc (Output_section::get_input_sections): Change type of
2647 input_sections to std::list<Input_section>.
2648 (Output_section::add_script_input_section): Rename from
2649 Output_section::add_simple_input_section. Change type of SIS
2650 parameter from Simple_input_section to Input_section.
2651 * output.h (Output_section::Simple_input_section): Remove class.
2652 (Output_section::Input_section): Change class visibility to public.
2653 (Output_section::Input_section::addralign): Use stored alignments
2654 for special input sections if set.
2655 (Output_section::Input_section::set_addralign): New method.
2656 (Output_section::get_input_sections): Change parameter type from
2657 list of Simple_input_section to list of Input_section.
2658 (Output_section::add_script_input_section): Rename from
2659 Output_section::add_simple_input_section. Change first parameter's
2660 type from Simple_input_section to Input_section and remove the
2661 second and third parameters.
2662 * script-sections.cc (Input_section::Input_section_list): Change
2663 type to list of Output_section::Input_section/
2664 (Input_section_info::Input_section_info): Change parameter type of
2665 INPUT_SECTION to Output_section::Input_section.
2666 (Input_section_info::input_section): Change return type.
2667 (Input_section_info::input_section_): Change type to
2668 Output_section::Input_section.
2669 (Output_section_element_input::set_section_addresses): Adjust code
2670 to use Output_section::Input_section instead of
2671 Output_section::Simple_input_section. Adjust code for renaming
2672 of Output_section::add_simple_input_section.
2673 (Orphan_output_section::set_section_addresses): Ditto.
2675 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2677 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2678 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2680 2010-05-18 Rafael Espindola <espindola@google.com>
2682 * options.cc (General_options::finalize): Handle -nostdlib.
2683 * options.h (nostdlib): New option.
2684 * script.cc (script_add_search_dir): Handle -nostdlib.
2686 2010-05-12 Doug Kwan <dougkwan@google.com>
2688 * arm.cc (Target_arm::do_finalize_sections): Create an empty
2689 attributes section only if there no attributes section after merging.
2690 (Target_arm::merge_object_attributes): Move value of
2691 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2692 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2693 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2694 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2695 and arm_attr_merge_7.stdout.
2696 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2697 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2698 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2699 arm_attr_merge_7b.o): New rules.
2700 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2702 * testsuite/Makefile.in: Regenerate.
2703 * testsuite/arm_attr_merge.sh: New file.
2704 * testsuite/arm_attr_merge_[67][ab].s: Same.
2706 2010-05-05 Nick Clifton <nickc@redhat.com>
2708 * po/es.po: Updated Spanish translation.
2710 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2712 * Makefile.am (install-exec-local): Properly install gold as
2713 default cross linker.
2714 * Makefile.in: Regenerated.
2716 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2717 Nick Clifton <nickc@redhat.com>
2719 * configure.ac (install_as_default): Define and set to false
2720 unless --enable-gold or --enable-gold=both/gold has been
2722 * configure: Regenerate.
2724 * Makefile.am (install-exec-local): Install the executable as
2725 'ld.gold'. If install_as_default is true then also install it as
2727 * Makefile.in: Regenerated.
2729 2010-04-24 Ian Lance Taylor <iant@google.com>
2731 * layout.cc (Layout::layout_reloc): In relocatable link don't
2732 combine reloc sections for grouped sections.
2734 2010-04-23 Sriraman Tallam <tmsriram@google.com>
2736 * gc.h (gc_process_relocs): Pass information on relocs pointing to
2737 sections that are not ordinary to icf.
2738 * icf.cc (get_section_contents): Handle relocation pointing to section
2739 with no object or shndx information.
2740 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2741 * testsuite/Makefile.in: Regenerate.
2742 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2743 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2745 2010-04-22 Ian Lance Taylor <iant@google.com>
2747 * expression.cc (Expression::Expression_eval_info): Add
2748 result_alignment_pointer field.
2749 (Expression::eval_with_dot): Add result_alignment_pointer
2750 parameter. Change all callers.
2751 (Expression::eval_maybe_dot): Likewise.
2752 (class Binary_expression): Add alignment_pointer parameter to
2753 left_value and right_value. Change all callers.
2754 (BINARY_EXPRESSION): Set result alignment.
2755 (class Trinary_expression): Add alignment_pointer parameter to
2756 arg2_value and arg3_value. Change all callers.
2757 (Trinary_cond::value): Set result alignment.
2758 (Max_expression::value, Min_expression::value): Likewise.
2759 (Align_expression::value): Likewise.
2760 * script-sections.cc (class Sections_element): Add dot_alignment
2761 parameter to set_section_addresses virtual function. Update
2763 (class Output_section_element): Likewise.
2764 (Script_sections::create_segments): Add dot_alignment parameter.
2766 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2767 (Script_sections::set_phdrs_clause_addresses): Likewise.
2768 * script-sections.h: Update declarations.
2769 * script.h: Update declarations.
2770 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2772 * testsuite/script_test_3.t: Set large alignment.
2773 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2774 segment has expected alignment.
2776 2010-04-22 Nick Clifton <nickc@redhat.com>
2778 * po/gold.pot: Updated by the Translation project.
2779 * po/vi.po: Updated Vietnamese translation.
2781 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
2783 * testsuite/Makefile.am (check_PROGRAMS): Add
2784 icf_virtual_function_folding_test.
2785 * testsuite/Makefile.in: Regenerated.
2787 2010-04-15 Andrew Haley <aph@redhat.com>
2789 * options.h (merge_exidx_entries): New option.
2790 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2791 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2792 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2793 (Target_arm::merge_exidx_entries): New function.
2794 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2795 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2796 to Arm_exidx_fixup constructor.
2797 Add new arg, merge_exidx_entries.
2798 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2799 Arm_output_section::fix_exidx_coverage.
2801 2010-04-18 Sriraman Tallam <tmsriram@google.com>
2803 * icf.cc (get_section_contents): Check for preemptible functions.
2804 Ignore addend when appropriate.
2805 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2807 (add_from_relobj): Check for section folded.
2808 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2809 * symtab.h (should_add_dynsym_entry): Add new parameter.
2810 * target-reloc.h (scan_relocs): Check for section folded.
2811 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2812 Check reloc types for function pointers in shared objects.
2813 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2815 (icf_preemptible_functions_test): New test case.
2816 (icf_string_merge_test): New test case.
2817 * testsuite.Makefile.in: Regenerate.
2818 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2819 bar_glob. Refactor code.
2820 * testsuite/icf_preemptible_functions_test.cc: New file.
2821 * testsuite/icf_preemptible_functions_test.sh: New file.
2822 * testsuite/icf_string_merge_test.cc: New file.
2823 * testsuite/icf_string_merge_test.sh: New file.
2824 * testsuite/icf_virtual_function_folding_test.cc: New file.
2825 * testsuite/icf_virtual_function_folding_test.sh: New file.
2827 2010-04-14 Doug Kwan <dougkwan@google.com>
2829 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2830 for local symbol recounting if we remove a section due to ICF.
2831 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2832 there are no regular objects in input.
2834 2010-04-13 Doug Kwan <dougkwan@google.com>
2836 * arm.cc (Arm_input_section::set_final_data_size): Compute
2837 accurate final data size instead of using current data size.
2839 2010-04-09 Doug Kwan <dougkwan@google.com>
2841 * layout.cc (Layout::choose_output_section): Handle script section
2843 (Layout::make_output_section_for_script): Add section type parameter.
2844 Handle script section types.
2845 * layout.h (Layout::make_output_section_for_script): Add section
2847 * output.cc (Output_section::Output_section): Initialize data member
2849 (Output_section::do_reset_address_and_file_offset): Do not set address
2850 to 0 if section is a NOLOAD section.
2851 * output.h (Output_section::is_noload): New method.
2852 (Output_section::set_is_noload): Ditto.
2853 (Output_section::is_noload_): New data member.
2854 * script-c.h (Script_section_type): New enum type.
2855 (struct Parser_output_section_header): Add new file section_type.
2856 * script-sections.cc (Sections_element::output_section_name): Add
2857 parameter for returning script section type.
2858 (Output_section_definition::output_section_name): Ditto.
2859 (Output_section_definition::section_type)P; New method.
2860 (Output_section_definiton::script_section_type_name): Ditto.
2861 (Output_section_definition::script_section_type_): New data member.
2862 (Output_section_definition::Output_section_definition): Initialize
2863 data member Output_section_definition::script_section_type_.
2864 (Output_section_definition::create_sections): Pass script section type
2865 to Layout::make_output_section_for_script.
2866 (Output_section_definition::output_section_name): Return script
2867 section type to caller.
2868 (Output_section_definition::set_section_address): Do not advance
2869 dot value and load address if section type is NOLOAD. Set address
2870 of NOLOAD sections regardless of section flags.
2871 (Output_section_definition::print): Print section type if it is
2872 not SCRIPT_SECTION_TYPE_NONE.
2873 (Output_section_definition::section_type): New method.
2874 (Output_section_definition::script_section_type_name): Ditto.
2875 (Script_sections::output_section_name): Add new parameter
2876 PSECTION_TYPE for returning script section type. Pass it to
2877 section elements. Handle discard sections.
2878 (Sort_output_sections::operator()): Handle NOLOAD sections.
2879 * script-sections.h (Script_sections::Section_type): New enum type.
2880 (Script_sections::output_section_name): Add a new parameter for
2881 returning script section type.
2882 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2884 * yyscript.y (union): Add new field SECTION_TYPE.
2885 (COPY, DSECT, INFO, NOLOAD): New tokens.
2886 (opt_address_and_section_type): Change type to output_section_header.
2887 (section_type): New non-terminal
2888 (section_header): Handle section type.
2889 (opt_address_and_section_type): Return section type value.
2891 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
2893 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2894 * testsuite/plugin_common_test_2.c (foo): Likewise.
2896 2010-04-08 Doug Kwan <dougkwan@google.com>
2898 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2900 * output.cc (Output_section::add_merge_input_section): Simplify
2901 code and return status of Output_merge_base::add_input_section.
2902 Update merge section map only if Output_merge_base::add_input_section
2905 2010-04-07 Doug Kwan <dougkwan@google.com>
2907 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2908 if section is marked as containing instructions but has no mapping
2910 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2911 correct section index.
2912 (Arm_relobj::find_linked_text_section): Ditto.
2914 2010-04-07 Cary Coutant <ccoutant@google.com>
2916 * archive.cc (include_member): Destroy Read_symbols_data object before
2918 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2919 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2920 (Read_symbols_data::~Read_symbols_data) New destructor.
2921 (Section_relocs::Section_relocs) New constructor.
2922 (Section_relocs::~Section_relocs) New destructor.
2923 (Read_relocs_data::Read_relocs_data) New constructor.
2924 (Read_relocs_data::~Read_relocs_data) New destructor.
2925 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2926 pointers to NULL after deleting.
2928 2010-04-07 Doug Kwan <dougkwan@google.com>
2930 * arm.cc: Replace "endianity" with "endianness" in comments.
2931 (Arm_exidx_cantunwind): Ditto.
2932 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2933 (Arm_relobj::merge_flags_and_attributes): New method.
2934 (Arm_relobj::merge_flags_and_attributes_): New data member.
2935 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2936 (Arm_relobj::scan_sections_for_stubs): Ditto.
2937 (Arm_relobj::do_read_symbols): Check to see if we really want to
2938 merge processor-specific flags and attributes. Exit early if
2939 an object is empty except for section names and the undefined symbol.
2940 (Target_arm::do_finalize_sections): Move check for ELF format to
2941 Arm_relobj::do_read_symbols. Merge processor specific flags and
2942 attributes from a regular object only when we have determined that
2943 it is aapropriate. Do not create an .ARM.attributes section in
2944 output if there is no regular input object.
2945 (Target_arm::merge_processor_specific_flags): Check
2946 --warn-mismatch before printing any error.
2947 (Target_arm::merge_object_attributes): Ditto.
2948 * gold.cc (queue_middle_tasks): Handle the case in which there is
2949 no regular object in input.
2950 * options.cc (General_options::parse_EB): New method.
2951 (General_options::parse_EL): Same.
2952 (General_options::General_options): Initialize endianness_.
2953 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2955 (General_options::Endianness): New enum.
2956 (General_options::endianness): New method.
2957 (General_options::endianness_): New data member.
2958 * parameters.cc (Parameters::set_options): Check target endianness.
2959 (Parameters::set_target_once): Ditto.
2960 (Parameters::check_target_endianness): New method.
2961 (parameters_force_valid_target): If either -EL or -EB is specified,
2962 use it to define endianness of default target.
2963 * parameters.h (Parameters::check_target_endianness): New method
2965 * target.h (class Target): Change "endianity" to "endianness"
2968 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2970 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2971 * configure: Regenerate.
2972 * Makefile.in: Regenerate.
2973 * testsuite/Makefile.in: Regenerate.
2975 2010-04-06 Cary Coutant <ccoutant@google.com>
2978 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2979 prevailing definitions of common symbols.
2980 * testsuite/plugin_test_6.sh: New test case.
2981 * testsuite/plugin_common_test_1.c: New test case.
2982 * testsuite/plugin_common_test_2.c: New test case.
2983 * testsuite/Makefile.am (plugin_test_6): New test case.
2984 * testsuite/Makefile.in: Regenerate.
2986 2010-04-06 Nick Clifton <nickc@redhat.com>
2988 * po/vi.po: New Vietnamese translation.
2990 2010-03-30 Doug Kwan <dougkwan@google.com>
2992 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2994 2010-03-25 Doug Kwan <dougkwan@google.com>
2996 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2997 to avoid a conversion warning on a 32-bit host.
2999 2010-03-24 Ian Lance Taylor <iant@google.com>
3001 * testsuite/script_test_3.t: Add a TLS segment.
3002 * testsuite/Makefile.am (check_PROGRAMS): Add
3003 tls_phdrs_script_test.
3004 (tls_phdrs_script_test_SOURCES): Define.
3005 (tls_phdrs_script_test_DEPENDENCIES): Define.
3006 (tls_phdrs_script_test_LDFLAGS): Define.
3007 (tls_phdrs_script_test_LDADD): Define.
3008 * testsuite/Makefile.in: Rebuild.
3010 2010-03-23 Cary Coutant <ccoutant@google.com>
3012 * fileread.cc (find_or_make_view): Fix comment.
3014 2010-03-23 Ian Lance Taylor <iant@google.com>
3016 * script-sections.cc (class Orphan_section_placement): Define
3017 PLACE_TLS and PLACE_TLS_BSS.
3018 (Orphan_section_placement::Orphan_section_placement): Initialize
3020 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3021 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3022 (tls_script_test_SOURCES): Define.
3023 (tls_script_test_DEPENDENCIES): Define.
3024 (tls_script_test_LDFLAGS): Define.
3025 (tls_script_test_LDADD): Define.
3026 * testsuite/Makefile.in: Rebuild.
3028 2010-03-22 Doug Kwan <dougkwan@google.com>
3030 * arm.cc (Arm_relocate_functions::abs8,
3031 Arm_relocate_functions::abs16): Use correct check for overflow
3032 specified in the ARM ELF specs.
3033 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3034 target of a BLX instruction specially.
3035 (Reloc_stub::stub_type_for_reloc): Ditto.
3036 (Relocate::relocate): Use symbolic names instead of numeric relocation
3037 codes to report error.
3038 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3040 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3041 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3042 thumb2_blx_out_of_range.stdout
3043 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3044 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3045 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3046 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3047 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3048 thumb2_blx_in_range, thumb2_blx_in_range.o,
3049 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3050 thumb2_blx_out_of_range.o): New rules.
3051 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3052 thumb2_blx_in_range and thumb2_blx_out_of_range.
3053 * testsuite/Makefile.in: Regenerate.
3054 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3055 * testsuite/thumb_blx_in_range.s: New file.
3056 * testsuite/thumb_blx_out_of_range.s: New file.
3058 2010-03-22 Rafael Espindola <espindola@google.com>
3060 * archive.cc (Should_include): Move to archive.h.
3061 (should_include_member): Make it a member of Archive.
3063 (Add_lib_group_symbols): New.
3064 * archive.h: Include options.h.
3065 (Archive_member): Moved from Archive.
3066 (Should_include): Moved from archive.cc.
3068 (Add_lib_group_symbols): New.
3069 * dynobj.cc (do_should_include_member): New.
3070 * dynobj.h (do_should_include_member): New.
3071 * gold.cc (queue_initial_tasks): Update call to queue.
3072 * main.cc (main): Print lib group stats.
3073 * object.cc (do_should_include_member): New.
3074 * object.h: Include archive.h.
3075 (Object::should_include_member): New.
3076 (Object::do_should_include_member): New.
3077 (Sized_relobj::do_should_include_member): New.
3078 * options.cc (General_options::parse_start_lib): New.
3079 (General_options::parse_end_lib): New.
3080 (Input_arguments::add_file): Handle lib groups.
3081 (Input_arguments::start_group): Check we are not in a lib.
3082 (Input_arguments::start_lib): New.
3083 (Input_arguments::end_lib): New.
3084 * options.h (General_options): Add start_lib and end_lib.
3085 (Input_argument::lib_): New.
3086 (Input_argument::lib): New.
3087 (Input_argument::is_lib): New.
3088 (Input_file_lib): New.
3089 (Input_arguments::in_lib_): New.
3090 (Input_arguments::in_lib): New.
3091 (Input_arguments::start_lib): New.
3092 (Input_arguments::end_lib_): New.
3093 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3094 in unused members as preempted.
3095 (Sized_pluginobj::do_should_include_member): New.
3096 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3097 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3099 (Read_symbols::do_whole_lib_group): New.
3100 (Read_symbols::do_lib_group): New.
3101 (Read_symbols::do_read_symbols): Handle lib groups.
3102 (Read_symbols::get_name): Handle lib groups.
3103 * readsyms.h (Read_symbols): Add an archive member pointer.
3104 (Read_symbols::do_whole_lib_group): New.
3105 (Read_symbols::do_lib_group): New.
3106 (Read_symbols::member_): New.
3107 * script.cc (read_input_script): Update call to queue_soon.
3109 2010-03-19 Doug Kwan <dougkwan@google.com>
3111 * arm.cc (Stub_table::Stub_table): Initialize new data members
3112 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3113 (Stub_table::add_reloc_stub): Assign stub offset and update
3114 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3115 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3117 (Stub_table::update_data_size_and_addralign): Use
3118 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3119 instead of going over all reloc stubs.
3120 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3121 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3122 Stringpool_template::offset_ to size of Stringpool_char.
3123 (Stringpool_template::new_key_offset): Remove code to initialize
3124 Stringpool_template::offset_.
3125 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3126 Stringpool_template::offset_ to zero.
3128 2010-03-15 Doug Kwan <dougkwan@google.com>
3130 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3132 (Stringpool_template::new_key_offset): New method.
3133 (Stringpool_template::add_string): Assign offsets when adding new
3135 (Stringpool_template::set_string_offsets): Do not set string offsets
3136 when not optimizing.
3137 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3139 (Chunked_vector::clear): Clear size_.
3140 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3141 (Chunked_vector::size): Return size_.
3142 (Chunked_vector::push_back): Use size_ to find insert position.
3143 (Chunked_vector::size_): New data member.
3144 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3145 (Stringpool_template::new_key_offset): New method declaration.
3146 (Stringpool_template::offset_): New data member.
3148 2010-03-15 Rafael Espindola <espindola@google.com>
3150 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3151 Add_symbols' constructor.
3152 * readsyms.h (Add_symbols): Remove the input_group member.
3154 2010-03-10 Ian Lance Taylor <iant@google.com>
3156 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3157 target to ask whether a reference to a symbol requires a stack
3159 * target.h (Target::is_call_to_non_split): New function.
3160 (Target::do_is_call_to_non_split): Declare virtual function.
3161 * target.cc: Include "symtab.h".
3162 (Target::do_is_call_to_non_split): New function.
3163 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3165 2010-03-10 Cary Coutant <ccoutant@google.com>
3167 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3168 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3169 (File_read::open[2]): Add whole_file_view_ to list of views.
3170 (File_read::make_view): Remove test of whole_file_view_.
3171 (File_read::find_or_make_view): Create whole_file_view_ if
3173 (File_read::clear_views): Replace bool parameter with enum;
3174 adjust all callers. Don't delete views with permanent data;
3175 do delete cached views and views from archives if
3176 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3177 if clearing the corresponding view.
3178 * fileread.h (File_read::Clear_views_mode): New enum.
3179 (File_read::View::is_permanent_view): New method.
3180 (File_read::clear_views): Replace bool parameter
3181 with enum; adjust all callers.
3182 * options.h (General_options): Change keep_files_mapped option;
3183 add map_whole_files.
3184 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3186 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3189 2010-03-10 David S. Miller <davem@davemloft.net>
3191 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3193 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3195 * icf.cc (get_section_contents): Add '@' marker after processing the
3198 2010-03-08 Doug Kwan <dougkwan@google.com>
3200 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3201 due to a conversion warning.
3202 (Arm_relobj::update_output_local_symbol_count): Check for local
3203 symbol with unset output index.
3205 2010-03-05 Ian Lance Taylor <iant@google.com>
3207 * options.h (class General_options): Add --spare-dynamic-tags.
3208 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3209 --spare-dynamic-tags.
3211 2010-03-05 Ian Lance Taylor <iant@google.com>
3213 * incremental.cc: Include "libiberty.h".
3215 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3217 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3218 function, is_info_ member.
3219 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3220 (Versions::Versions): Update caller.
3221 (Versions::define_base_version): Likewise.
3222 (Versions::add_def): Likewise.
3224 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3226 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3227 (Scan::possible_function_pointer_reloc): New function.
3228 (Scan::local_reloc_may_be_function_pointer): Change to call
3229 possible_function_pointer_reloc.
3230 (Scan::global_reloc_may_be_function_pointer): Ditto.
3231 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3232 relocations in ".data.rel.ro._ZTV" section.
3233 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3234 * testsuite/icf_safe_so_test.cc: Ditto.
3235 * testsuite/icf_safe_test.cc: Ditto.
3236 * testsuite/icf_safe_test.sh: Ditto.
3238 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3239 Ian Lance Taylor <iant@google.com>
3241 * target-reloc.h (relocate_section): Check the symbol table index
3242 for -1U before setting the local symbol index.
3243 (scan_relocatable_relocs): If copying the relocation, record that
3244 the local symbol is required.
3245 * object.h (Symbol_value::is_output_symtab_index_set): New
3247 (Symbol_value::may_be_discarded_from_output_symtab): New
3249 (Symbol_value::has_output_symtab_entry): New function.
3250 (Symbol_value::needs_output_symtab_entry): Remove.
3251 (Symbol_value::output_symtab_index): Make sure the symbol index is
3253 (Symbol_value::set_output_symtab_index): Make sure the symbol
3254 index is not set. Make sure the new index is valid.
3255 (Symbol_value::set_must_have_output_symtab_entry): New function.
3256 (Symbol_value::has_output_dynsym_entry): New function.
3257 (Symbol_value::set_output_dynsym_index): Make sure the new index
3259 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3260 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3261 local symbol if permitted.
3262 (Sized_relobj::do_finalize_local_symbols): Call
3263 is_output_symtab_index_set rather than needs_output_symtab_entry.
3264 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3265 rather than needs_output_symtab_entry. Call
3266 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3267 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3268 is_output_symtab_index_set rather than needs_output_symtab_entry.
3269 * testsuite/discard_locals_relocatable_test.c: New file.
3270 * testsuite/discard_locals_test.sh: Test -r.
3271 * testsuite/Makefile.am (check_DATA): Add
3272 discard_locals_relocatable_test1.syms,
3273 discard_local_relocatable_test2.syms.
3274 (MOSTLYCLEANFILES): Likewise. Also add
3275 discard_locals_relocatable_test1.lout and
3276 discard_locals_relocatable_test2.out.
3277 (discard_locals_relocatable_test1.syms): New target.
3278 (discard_locals_relocatable_test.o): New target.
3279 (discard_locals_relocatable_test1.out): New target.
3280 (discard_locals_relocatable_test2.syms): New target.
3281 (discard_locals_relocatable_test2.out): New target.
3282 (various): Add missing ../ld-new dependencies.
3283 * testsuite/Makefile.in: Rebuild.
3285 2010-03-03 Nick Clifton <nickc@redhat.com>
3287 * po/fi.po: New Finnish translation.
3289 2010-03-01 Doug Kwan <dougkwan@google.com>
3291 * layout.cc (Layout::Layout): Force section types of .init_array*,
3292 .preinit_array* and .fini_array* sections.
3293 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3294 Fix check of return value of std::string::find.().
3295 (Output_section::Input_section_sort_compare::operator()): Remove
3296 comment about .init_array.
3297 (Output_section::Input_section_sort_init_fini_compare::operator()):
3299 (Output_section::sort_attached_input_sections): Handle .init_array
3300 and .fini_array specially.
3301 * output.h (Output_section::Inut_section_sort_compare): Update
3303 (Output_section::Input_section_sort_init_fini_compare): New struct.
3305 2010-02-26 Doug Kwan <dougkwan@google.com>
3307 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3308 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3309 * testsuite/debug_msg.sh: Avoid matching source line number for
3310 use of global variable undef_int.
3312 2010-02-26 Doug Kwan <dougkwan@google.com>
3314 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3315 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3316 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3317 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3318 * options.cc (General_options::General_options): Initialize member
3320 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3321 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3322 and rm_no_fix_v4bx.stdout
3323 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3324 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3325 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3326 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3327 and arm_no_fix_v4bx.
3328 * Makefile.in: Regenerate.
3329 * testsuite/arm_fix_v4bx.s: New file.
3330 * testsuite/arm_fix_v4bx.sh: Ditto.
3332 2010-02-24 Doug Kwan <dougkwan@google.com>
3334 * arm.cc (Target_arm::got_section): Make the .got section the first
3335 non RELRO section in the data segment.
3336 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3337 suffixes of section names.
3339 2010-02-24 Doug Kwan <dougkwan@google.com>
3341 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3342 flags and attributes merging if an input file is a binary file.
3343 * fileread.cc (Input_file::open): Record format of original file.
3344 * fileread.h (Input_file::Format): New enum type.
3345 (Input_file::Input_file): Initialize data member format_.
3346 (Input_file::format): New method definition.
3347 (Input_file::format_):: New data member.
3349 2010-02-24 Doug Kwan <dougkwan@google.com>
3351 * arm.cc (Arm_output_data_got): New class.
3352 (ARM_TCB_SIZE): New constant
3353 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3354 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3355 If user uses a script with a SECTIONS clause, issue only a warning
3356 for a misplaced EXIDX input section. Otherwise, issue an error.
3357 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3359 (Target_arm::got_mode_index_entry): Handle static linking.
3360 (Target_arm::Scan::local): Ditto.
3361 (Target_arm::Scan::global): Ditto.
3362 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3363 all incorrectly implemented relocations.
3364 (Target_arm::fix_exidx_coverage): Pass layout to
3365 Arm_output_section::fix_exidx_coverage.
3366 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3367 from ".ARM.exidx." and ".ARM.extab.".
3369 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3371 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3372 section if it does not already exist.
3373 * attributes.cc (Attributes_section_data::Attributes_section_data):
3374 Don't crash if size is zero.
3376 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3377 Ian Lance Taylor <iant@google.com>
3379 * gold.cc (queue_middle_tasks): If no input files were opened,
3381 * workqueue.h (Task_function::Task_function): Assert that there is
3384 2010-02-22 Doug Kwan <dougkwan@google.com>
3386 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3387 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3388 types to avoid warnings due to different uint64_t implementations
3391 2010-02-21 Doug Kwan <dougkwan@google.com>
3393 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3394 handling of the maximum backward branch offset.
3395 (Arm_relocate_functions::thumb_branch_common): Ditto.
3396 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3397 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3398 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3399 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3400 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3401 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3402 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3403 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3404 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3405 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3406 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3407 thumb2_bl_out_of_range.o): New rules.
3408 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3409 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3410 thumb2_bl_out_of_range
3411 * testsuite/Makefile.in: Regenerate.
3412 * testsuite/arm_bl_in_range.s: New file.
3413 * testsuite/arm_bl_out_of_range.s: Ditto.
3414 * testsuite/arm_branch_in_range.sh: Ditto.
3415 * testsuite/arm_branch_range.t: Ditto.
3416 * testsuite/thumb2_branch_range.t: Ditto.
3417 * testsuite/thumb_bl_in_range.s: Ditto.
3418 * testsuite/thumb_bl_out_of_range.s: Ditto.
3419 * testsuite/thumb_branch_range.t: Ditto.
3421 2010-02-20 Sriraman Tallam <tmsriram@google.com>
3423 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3424 Add reloc offset information.
3425 * icf.cc (get_section_contents): Change iterators to point to the new
3426 vectors. Add reloc offset information to the contents.
3427 * icf.h (Icf::Sections_reachable_info): New typedef.
3428 (Icf::Sections_reachable_list): New typedef.
3429 (Icf::Offset_info): New typedef.
3430 (Icf::Reloc_info): New struct typedef.
3431 (Icf::Reloc_info_list): New typedef.
3432 (Icf::symbol_reloc_list): Delete method.
3433 (Icf::addend_reloc_list): Delete method.
3434 (Icf::section_reloc_list): Delete method.
3435 (Icf::reloc_info_list): New method.
3436 (Icf::reloc_info_list_): New member.
3438 2010-02-19 Doug Kwan <dougkwan@google.com>
3440 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3441 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3442 * arm.cc (Arm_relocation_functions): New forward declaration.
3443 (Target_arm::Target_arm): Initialize new data members
3444 got_mod_index_offset_ and tls_base_symbol_defined_.
3445 (Target_arm::Relocate::relocate_tls): New method.
3446 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3447 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3449 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3450 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3451 (Target_arm::got_mod_index_offset_,
3452 Target_arm::tls_base_symbol_defined_): New data members.
3453 (Target_arm::Scan::local, Target::Scan::global,
3454 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3457 2010-02-18 Doug Kwan <dougkwan@google.com>
3459 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3460 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3461 text section as a parameter becuase some broken tools may not set
3462 the link in section header.
3463 (Target_arm::has_got_section): New method.
3464 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3465 without any mapping symbol as data only. Remove warning.
3466 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3467 link in its section header, try to discover the link by inspecting the
3468 REL31 relocation at the beginning of the section.
3469 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3471 (Target_arm::Scan::global): Treat any reference to the symbol
3472 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3474 2010-02-12 Sriraman Tallam <tmsriram@google.com>
3476 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3477 (Scan::global_reloc_may_be_function_pointer): New function.
3478 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3479 (Scan::global_reloc_may_be_function_pointer): New function.
3480 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3481 (Scan::global_reloc_may_be_function_pointer): New function.
3482 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3483 (Scan::global_reloc_may_be_function_pointer): New function.
3484 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3485 (Scan::global_reloc_may_be_function_pointer): New function.
3486 (Scan::possible_function_pointer_reloc): New function.
3487 (Target_x86_64::can_check_for_function_pointers): New function.
3488 * gc.h (gc_process_relocs): Scan relocation types to determine if
3489 function pointers were taken for targets that support it.
3490 * icf.cc (Icf::find_identical_sections): Include functions for
3491 folding in safe ICF whose pointer is not taken.
3492 * icf.h (Secn_fptr_taken_set): New typedef.
3493 (fptr_section_id_): New member.
3494 (section_has_function_pointers): New function.
3495 (set_section_has_function_pointers): New function.
3496 (check_section_for_function_pointers): New function.
3497 * options.h: Fix comment for safe ICF option.
3498 * target.h (can_check_for_function_pointers): New function.
3499 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3500 Modify icf_safe_test for X86-64.
3501 * testsuite/Makefile.in: Regenerate.
3502 * testsuite/icf_safe_so_test.cc: New file.
3503 * testsuite/icf_safe_so_test.sh: New file.
3504 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3505 (main): Change to take pointer to function kept_func_3.
3506 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3507 folding is done correctly for X86-64.
3509 2010-02-12 David S. Miller <davem@davemloft.net>
3511 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3512 is_symbolless parameter.
3513 (Output_reloc<SHT_REL>::is_symbolless): New.
3514 (Output_reloc<SHT_REL>::is_symbolless_): New.
3515 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3516 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3517 (Output_reloc<SHT_RELA>::is_symbolless): New.
3518 (Output_data_reloc::add_global): Handle is_symbolless.
3519 (Output_data_reloc::add_global_relative): Likewise.
3520 (Output_data_reloc::add_local): Likewise.
3521 (Output_data_reloc::add_local_relative): Likewise.
3522 (Output_data_reloc::add_symbolless_global_addend): New.
3523 (Output_data_reloc::add_symbolless_local_addend): New.
3524 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3526 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3527 instead of ->is_relative_
3528 (Output_reloc::write): Likewise.
3529 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3530 (Output_reloc::write_rel): Simplify.
3532 * sparc.cc (Target_sparc::Scan::local): Use
3533 ->add_symbolless_local_addend as needed.
3534 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3535 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3536 based upon relocation offset.
3538 2010-02-11 Doug Kwan <dougkwan@google.com>
3540 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3541 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3542 beginning of function.
3543 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3544 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3545 parameter is_32bit in calls to should_apply_static_reloc.
3546 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3547 (check_DATA): Add arm_abs_global.stdout.
3548 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3549 arm_abs_global.stdout): New rules.
3550 (MOSTLLYCLEANFILES): Add arm_abs_global
3551 * Makefile.in: Regenerate.
3552 * testsuite/arm_abs_global.s: New file.
3553 * testsuite/arm_abs_global.sh: Ditto.
3554 * testsuite/arm_abs_lib.s: Ditto.
3556 2010-02-11 Ian Lance Taylor <iant@google.com>
3558 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3560 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3561 Allocate_commons_task first.
3562 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3563 task, rather than symtab_lock_.
3564 (Gc_process_relocs::~Gc_process_relocs): New function.
3565 (Gc_process_relocs::is_runnable): Check this_blocker_.
3566 (Gc_process_relocs::locks): Use next_blocker_ rather than
3568 (Scan_relocs::~Scan_relocs): New function.
3569 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3571 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3573 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3574 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3575 constructor accordingly.
3576 (class Gc_process_relocs): Likewise.
3577 (class Scan_relocs): Likewise.
3578 * common.h (class Allocate_commons_task): Remove symtab_lock_
3579 field, and corresponding constructor parameter.
3580 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3582 (Allocate_commons_task::locks): Likewise.
3584 2010-02-11 Ian Lance Taylor <iant@google.com>
3586 * gold-threads.h (class Once): Define.
3587 (class Initialize_lock): Rewrite as child of Once.
3588 * gold-threads.cc (class Once_initialize): Define.
3589 (once_pointer_control): New static variable.
3590 (once_pointer, once_arg): New static variables.
3591 (c_run_once): New static function.
3592 (Once::Once, Once::run_once, Once::internal_run): New functions.
3593 (class Initialize_lock_once): Remove.
3594 (initialize_lock_control): Remove.
3595 (initialize_lock_pointer): Remove.
3596 (initialize_lock_once): Remove.
3597 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3598 (Initialize_lock::initialize): Rewrite.
3599 (Initialize_lock::do_run_once): New function.
3600 * archive.cc (Archive::interpret_header): Only clear name if it is
3602 * fileread.cc: Include "gold-threads.h"
3603 (file_counts_lock): New static variable.
3604 (file_counts_initialize_lock): Likewise.
3605 (File_read::release): Only increment counts when using --stats.
3606 Use a lock around the increment.
3607 * parameters.cc (class Set_parameters_target_once): Define.
3608 (set_parameters_target_once): New static variable.
3609 (Parameters::Parameters): Move here from parameters.h.
3610 (Parameters::set_target): Rewrite.
3611 (Parameters::set_target_once): New function.
3612 (Parameters::clear_target): Move here and rewrite.
3613 * parameters.h (class Parameters): Update declarations. Add
3614 set_parameters_target_once_ field.
3615 (Parameters::Parameters): Move to parameters.cc.
3616 (Parameters::clear_target): Likewise.
3617 * readsyms.cc (Read_symbols::do_group): Create a Start_group
3619 (Start_group::~Start_group): New function.
3620 (Start_group::is_runnable): New function.
3621 (Start_group::locks, Start_group::run): New functions.
3622 (Finish_group::run): Change saw_undefined to size_t.
3623 * readsyms.h (class Start_group): Define.
3624 (class Finish_group): Change saw_undefined_ field to size_t.
3625 (Finish_group::Finish_group): Remove saw_undefined and
3626 this_blocker parameters. Change all callers.
3627 (Finish_group::set_saw_undefined): New function.
3628 (Finish_group::set_blocker): New function.
3629 * symtab.h (class Symbol_table): Change saw_undefined to return
3630 size_t. Change saw_undefined_ field to size_t.
3631 * target-select.cc (Set_target_once::do_run_once): New function.
3632 (Target_selector::Target_selector): Initialize set_target_once_
3633 field. Don't initialize lock_ and initialize_lock_ fields.
3634 (Target_selector::instantiate_target): Rewrite.
3635 (Target_selector::set_target): New function.
3636 * target-select.h (class Set_target_once): Define.
3637 (class Target_selector): Update declarations. Make
3638 Set_target_once a friend. Remove lock_ and initialize_lock_
3639 fields. Add set_target_once_ field.
3641 2010-02-10 Ian Lance Taylor <iant@google.com>
3643 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3645 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
3646 (queue_middle_tasks): Add all blockers before queueing any tasks.
3647 (queue_final_tasks): Likewise.
3648 * token.h (Task_token::add_blockers): New function.
3649 * object.h (Input_objects::number_of_relobjs): New function.
3651 2010-02-10 Ian Lance Taylor <iant@google.com>
3653 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3654 shared, not if not position independent.
3655 * x86_64.cc (Relocate::relocate_tls): Likewise.
3656 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3657 (tls_pie_pic_test): New target.
3658 * testsuite/Makefile.in: Rebuild.
3660 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3661 (tls_test_main_pie.o, tls_test_pie.o): New targets.
3662 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3663 * testsuite/Makefile.in: Rebuild.
3665 2010-02-09 David S. Miller <davem@davemloft.net>
3667 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3668 R_SPARC_RELATIVE using ->add_local_relative().
3669 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3671 * output.h (Output_data_dynamic::add_section_size): New method
3672 that takes two Output_data objects.
3673 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3674 entry param. Handle it in initializers.
3675 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3676 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3677 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3679 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3680 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3681 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3682 for dynrel_includes_plt.
3683 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3684 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3685 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3687 (Target_sparc::do_finalize_sections): Update to pass true for
3688 dynrel_includes_plt.
3689 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3690 output before .rela.plt
3691 (Target_powerpc::do_finalize_sections): Update to pass true for
3692 dynrel_includes_plt when 32-bit.
3694 2010-02-08 Doug Kwan <dougkwan@google.com>
3696 * arm.cc (Arm_relobj::simple_input_section_output_address): New
3698 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3699 Arm_relobj::scan_section_for_cortex_a8_stubs,
3700 Arm_relobj::do_relocation_section): Instead of calling
3701 Output_section::output_address, use faster
3702 Arm_relobj::simple_input_section_output_address.
3704 2010-02-08 David S. Miller <davem@davemloft.net>
3706 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3707 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3708 relocation helper function.
3710 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3711 just like R_SPARC_GOT{10,13,22}.
3712 (Target_sparc::Scan::local): Likewise.
3713 (Target_sparc::Relocate:relocate): Likewise.
3715 2010-02-06 Ian Lance Taylor <iant@google.com>
3717 * configure.ac: Rewrite targetobjs duplicate removal code to use
3718 only shell constructs.
3719 * configure: Rebuild.
3721 2010-02-05 Doug Kwan <dougkwan@google.com>
3724 * arm.cc (Arm_relobj::section_is_scannable): New method.
3725 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3726 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3728 2010-02-04 Doug Kwan <dougkwan@google.com>
3731 * arm-reloc-property.cc (cstdio): Include.
3732 * configure.ac (targetobjs): Remove duplicates.
3733 * configure: Regenerate.
3734 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3735 big and little endian version for a given address size.
3737 2010-02-03 Doug Kwan <dougkwan@google.com>
3739 * arm-reloc-property.cc
3740 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3742 * arm-reloc-property.h
3743 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3744 New method definition.
3745 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3747 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3749 (GOT_PREL): Change implemented to Y.
3750 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3751 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3752 (Arm_relocate_functions::movw_abs_nc): Remove method.
3753 (Arm_relocate_functions::movt_abs): Ditto.
3754 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3755 (Arm_relocate_functions::thm_movt_abs): Ditto.
3756 (Arm_relocate_functions::movw_rel_nc): Ditto.
3757 (Arm_relocate_functions::movw_rel): Ditto.
3758 (Arm_relocate_functions::movt_rel): Ditto.
3759 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3760 (Arm_relocate_functions:thm_movw_rel): Ditto.
3761 (Arm_relocate_functions:thm_movt_rel): Ditto.
3762 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3763 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3764 New method definitions.
3765 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3766 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3767 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3768 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3769 (Target_arm::Relocate::relocate): Check for non-static or
3770 unimplemented relocation code and exit early. Change calls to
3771 Target_arm::reloc_uses_thumb_bit and
3772 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3773 instead. Refactor code to handle similar relocations to increase
3774 code sharing. Remove check for unsupported relocation code in switch
3776 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3777 relocation property table to find out size. Change error message to
3778 print out the name of a relocation code instead of the numeric value.
3779 (Target_arm::scan_reloc_for_stub): Use relocation property table
3780 instead of calling Target_arm::reloc_uses_thumb_bit().
3782 2010-02-02 Doug Kwan <dougkwan@google.com>
3784 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3785 types of relaxed input section.
3787 2010-02-02 Doug Kwan <dougkwan@google.com>
3789 * Makefile.am (HFILES): Add arm-reloc-property.h.
3791 (TARGETSOURCES): Add arm-reloc-property.cc
3792 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3793 (libgold_a_SOURCES): $(DEFFILES)
3794 * Makefile.in: Regenerate.
3795 * arm-reloc-property.cc: New file.
3796 * arm-reloc-property.h: New file.
3797 * arm-reloc.def: New file.
3798 * arm.cc: Update comments.
3799 (arm-reloc-property.h): New included header.
3800 (arm_reloc_property_table): New global variable.
3801 (Target_arm::do_select_as_default_target): New method definition.
3802 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3803 arm-reloc-property to targ_extra_obj.
3804 * parameters.cc (set_parameters_target): Call
3805 Target::select_as_default_target().
3806 * target.h (Target::select_as_default_target): New method definition.
3807 (Target::do_select_as_default_target): Same.
3809 2010-02-01 Doug Kwan <dougkwan@google.com>
3811 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3812 first_output_text_section_.
3813 (Arm_exidx_fixup::first_output_text_section): New method definition.
3814 (Arm_exidx_fixup::first_output_text_section_): New data member.
3815 (Arm_exidx_fixup::process_exidx_section): Record the first text
3816 output section seen.
3817 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3818 and entsize in output section header.
3820 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3822 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3823 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3824 (Arm_relocate_functions::thm_alu11): New Method.
3825 (Arm_relocate_functions::thm_pc8): New Method.
3826 (Arm_relocate_functions::thm_pc12): New Method.
3827 (Target_arm::Scan::local): Handle the relocations.
3828 (Target_arm::Scan::global): Likewise.
3829 (Target_arm::Relocate::relocate): Likewise.
3830 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3832 2010-01-29 Doug Kwan <dougkwan@google.com>
3834 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3835 of relocation types as ld.
3837 2010-01-29 Doug Kwan <dougkwan@google.com>
3839 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3841 (Arm_relocate_functions::thumb_branch_common): Ditto.
3842 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3843 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3844 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3845 Arm_relocate_functions::jump24): Remove.
3846 (Target_arm::Relocate::relocate): Adjust code to call
3847 Arm_relocation_functions::arm_branch_common and
3848 Arm_relocation_functions::thumb_branch_common instead of their removed
3849 wrappers. Merge switch-cases together to reduce source code size.
3851 2010-01-29 Doug Kwan <dougkwan@google.com>
3853 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3854 output_local_symbol_count_needs_update_.
3855 (Arm_relobj::output_local_symbol_count_needs_update,
3856 Arm_relobj::set_output_local_symbol_count_needs_update,
3857 Arm_relobj::update_output_local_symbol_count): New methods.
3858 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3860 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3861 of pointed function as in a R_ARM_PREL31 relocation.
3862 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3863 for output local symbol count updating.
3864 (Target_arm::do_relax): Update output local symbol counts in objects
3866 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3868 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3870 * arm.cc: Added support for the ARM relocations:
3871 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3872 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3873 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3875 (Arm_relocate_functions::movw_rel): New method.
3876 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3877 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3879 (Arm_relocate_functions::thm_movw_rel): New method.
3880 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3882 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3884 (Target_arm::Scan::global): Likewise.
3885 (Target_arm::Relocate::relocate): Likewise.
3886 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3889 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3891 * arm.cc: Added support for ARM group relocations.
3892 (Target_arm::reloc_needs_sym_origin): New method.
3893 (Arm_relocate_functions::calc_grp_kn): New method.
3894 (Arm_relocate_functions::calc_grp_residual): New method.
3895 (Arm_relocate_functions::calc_grp_gn): New method.
3896 (Arm_relocate_functions::arm_grp_alu): New Method.
3897 (Arm_relocate_functions::arm_grp_ldr): New Method.
3898 (Arm_relocate_functions::arm_grp_ldrs): New Method.
3899 (Arm_relocate_functions::arm_grp_ldc): New Method.
3900 (Target_arm::Scan::local): Handle the ARM group relocations.
3901 (Target_arm::Scan::global): Likewise.
3902 (Target_arm::Relocate::relocate): Likewise.
3903 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3906 2010-01-26 Doug Kwan <dougkwan@google.com>
3908 * arm.cc (set): Include.
3909 (class Arm_exidx_fixup): Change type of last_input_section_ to const
3911 (Arm_output_section::Text_section_list): New type.
3912 (Arm_output_section::append_text_sections_to_list): New method.
3913 (Arm_output_section::fix_exidx_coverage): Ditto.
3914 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3915 (Arm_relobj::convert_input_section_to_relaxed_section): Use
3916 Relobj::set_section_offset() instead of
3917 Sized_relobj::invalidate_section_offset().
3918 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3919 parameter for section headers. Ignore relocation sections for
3920 unallocated sections and EXIDX sections.
3921 (Target_arm::fix_exidx_coverage): New method.
3922 (Target_arm::output_section_address_less_than): New type.
3923 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3924 linked text section instead of the EXIDX section.
3925 (Arm_output_section::create_stub_group): Add an assertion to check
3926 that this is not an EXIDX output section.
3927 (Arm_output_section::append_text_sections_to_list): New method.
3928 (Arm_output_section::fix_exidx_coverage): Ditto.
3929 (Arm_relobj::scan_sections_for_stubs): Adjust call to
3930 Arm_relobj::section_needs_reloc_stub_scanning.
3931 (Target_arm::do_relax): Fix EXIDX output section coverage in the
3933 (Target_arm::fix_exidx_coverage): New method.
3934 * object.h (Relobj::set_output_section): New method.
3935 (Sized_relobj::invalidate_section_offset): Remove method.
3936 (Sized_relobj::do_invalidate_section_offset): Remove method.
3937 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3939 2010-01-25 Doug Kwan <dougkwan@google.com>
3941 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3942 Fix warning due to signed and unsigned comparison on a 32-bit host.
3944 2010-01-22 Doug Kwan <dougkwan@google.com>
3946 * arm.cc (Target_arm::do_relax): Record an output section for section
3947 offset adjustment it contains any stub table that has changed.
3948 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3949 offsets in an output section if necessary.
3950 * output.cc (Output_section::Output_section): Initialize
3951 section_offsets_need_adjustments_.
3952 (Output_section::add_input_section_for_script): Renamed to
3953 Output_section::add_simple_input_section.
3954 (Output_section::save_states): Add a comment.
3955 (Output_section::discard_states): New method defintion.
3956 (Output_section::adjust_section_offsets): Same.
3957 * output.h (Output_section::add_input_section_for_script): Renamed to
3958 Output_section::add_simple_input_section.
3959 (Output_section::discard_states): New method declaration.
3960 (Output_section::adjust_section_offsets): Same.
3961 (Output_section::section_offsets_need_adjustment,
3962 Output_section::set_section_offsets_need_adjustment): New method
3964 (Output_section::section_offsets_need_adjustment_): New data member.
3965 * script-sections.cc
3966 (Output_section_element_input::set_section_address): Adjust code for
3967 renaming of Output_section::add_input_section_for_script.
3968 (Orphan_output_section::set_section_address): Same.
3970 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3972 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3973 Fix_v4bx enum values .
3974 * gold/options.h (General_options): New option definitions.
3975 (General_options::fix_v4bx): New method.
3976 (General_options::Fix_v4bx): New enum.
3977 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3978 (General_options::parse_fix_v4bx_interworking): New method.
3980 2010-01-22 Doug Kwan <dougkwan@google.com>
3982 * arm.cc (Arm_exidx_fixup): New class.
3984 2010-01-21 Doug Kwan <dougkwan@google.com>
3986 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3988 (Arm_exidx_section_offset_map): New type.
3990 2010-01-21 Doug Kwan <dougkwan@google.com>
3992 * arm.cc (Arm_exidx_input_section): New class.
3993 (Arm_relobj::exidx_input_section_by_link,
3994 Arm_relobj::exidx_input_section_by_shndx,
3995 Arm_relobj::make_exidx_input_section): New methods.
3996 (read_arm_attributes_section): Remove.
3997 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3998 information about them.
3999 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4002 2010-01-20 Doug Kwan <dougkwan@google.com>
4004 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4005 Input_section_specifier to Section_id.
4006 (Target_arm::new_arm_input_section: Adjust code for change of key
4008 (Target_arm::find_arm_input_section): Ditto.
4009 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4010 (Section_id): Remove.
4011 (Garbage_collection::Section_id_hash): Remove.
4012 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4013 (Section_id): Remove.
4014 (Icf::Section_id_hash): Remove.
4015 * object.h (Section_id, Const_section_id, Section_id_hash,
4016 Const_section_id_hash): New type definitions.
4017 * output.cc (Output_section::add_relaxed_input_section): Change to
4018 use Const_section_id instead of Input_section_specifier as key type.
4019 (Output_section::add_merge_input_section): Ditto.
4020 (Output_section::build_relaxation_map): Change to use Section_id
4021 instead of Input_section_specifier as key type.
4022 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4024 (Output_section::convert_input_sections_to_relaxed_sections): Change
4025 to use Const_section_id instead of Input_section_specifier as key type.
4026 (Output_section::find_merge_section): Ditto.
4027 (Output_section::find_relaxed_input_section): Ditto.
4028 * output.h (Input_section_specifier): Remove class.
4029 (Output_section::Output_section_data_by_input_section_map): Change
4030 key type to Const_section_id.
4031 (Output_section::Output_relaxed_input_section_by_input_section_map):
4033 (Output_section::Relaxation_map): Change key type to Section_id.
4035 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4037 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4038 (class Arm_v4bx_stub): New class.
4039 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4040 (Stub_factory::make_arm_v4bx_stub): New method.
4041 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4042 (Stub_table::empty): Handle v4bx stubs.
4043 (Stub_table::add_arm_v4bx_stub): New method.
4044 (Stub_table::find_arm_v4bx_stub): New method.
4045 (Arm_relocate_functions::v4bx): New method.
4046 (Target_arm::fix_v4bx): New method.
4047 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4048 (Stub_table::relocate_stubs): Likewise.
4049 (Stub_table::do_write): Likewise.
4050 (Stub_table::update_data_size_and_addralign): Likewise.
4051 (Stub_table::finalize_stubs): Likewise.
4052 (Target_arm::Scan::local): Likewise.
4053 (Target_arm::Scan::global): Likewise.
4054 (Target_arm::do_finalize_sections): Likewise.
4055 (Target_arm::Relocate::relocate): Likewise.
4056 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4058 (Target_arm::scan_reloc_for_stub): Likewise.
4059 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4061 2010-01-19 Ian Lance Taylor <iant@google.com>
4063 * output.cc (Output_section_headers::do_sized_write): Write large
4064 segment count to sh_info field.
4065 (Output_file_header::do_sized_write): For large segment count,
4066 write PN_XNUM to e_phnum field.
4068 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4070 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4071 (Arm_relocate_functions::thm_jump8): New function.
4072 (Arm_relocate_functions::thm_jump11): New function.
4073 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4075 (Target_arm::Scan::global): Likewise.
4076 (Target_arm::Relocate::relocate): Likewise.
4077 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4080 2010-01-14 Doug Kwan <dougkwan@google.com>
4082 * arm.cc (map, utility): Include headers.
4083 (Target_arm::apply_cortex_a8_workaround): New method.
4084 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4085 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4086 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4087 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4088 the --[no-]fix-cortex-a8 command line options.
4089 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4090 (Target_arm::relocate_stub): Use addend in instruction template.
4091 * options.h (DEFINE_bool): Set the user-set flag.
4092 (General_options): Add --[no-]-fix-cortex options.
4093 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4094 : Update fast look-up map after conversion.
4096 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4098 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4099 in the first pass of do_layout.
4101 2010-01-13 Doug Kwan <dougkwan@google.com>
4103 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4104 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4105 apparent compiler problem of not folding static constant integral
4106 data members of elfcpp::Elf_sizes<32>.
4108 2010-01-13 Doug Kwan <dougkwan@google.com>
4110 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4111 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4112 Arm_relobj::scan_section_for_cortex_a8_erratum,
4113 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4114 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4115 sections to scan for relocation stubs into a new method
4116 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4117 relocation and Cortex-A8 stub scanning.
4118 (Target_arm::do_relax): Force stubs to be after stubbed sections
4119 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4120 the beginning of a new relaxation pass. Update a comment.
4121 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4123 2010-01-12 Ian Lance Taylor <iant@google.com>
4125 * target-reloc.h (visibility_error): New inline function.
4126 (relocate_section): Call visibility_error.
4127 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4128 (MOSTLYCLEANFILES): Likewise.
4129 (protected_4_pic.o, protected_3.err): New targets.
4130 * testsuite/protected_4.cc: New file.
4132 2010-01-12 Doug Kwan <dougkwan@google.com>
4134 * arm.cc (Cortex_a8_reloc): New class.
4135 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4136 and cortex_a8_relocs_info_.
4137 (Target_arm::fix_cortex_a8): New method definition.
4138 (Target_arm::Cortex_a8_relocs_info): New type.
4139 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4140 New data member declarations.
4141 (Target_arm::scan_reloc_for_stub): Record information about
4142 relocations for THUMB branches that might be exempted from the
4143 Cortex-A8 workaround.
4144 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4145 at the beginning of a relaxation pass.
4147 2010-01-12 Doug Kwan <dougkwan@google.com>
4149 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4150 (Arm_relobj::Mapping_symbol_position,
4151 Arm_reloj::Mapping_symbol_position_less,
4152 Arm_relobj::Mapping_symbols_info): New types.
4153 (Target_arm::is_mapping_symbol_name): New method definition.
4154 (Arm_relobj::do_count_local_symbols): Save information about mapping
4157 2010-01-11 Doug Kwan <dougkwan@google.com>
4159 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4160 Arm_relocate_functions::thumb32_branch_upper,
4161 Arm_relocate_functions::thumb32_branch_lower,
4162 Arm_relocate_functions::thumb32_cond_branch_offset,
4163 Arm_relocate_functions::thumb32_cond_branch_upper,
4164 Arm_relocate_functions::thumb32_cond_branch_lower,
4165 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4166 branch offset encoding.
4167 (Arm_relocate_functions::thumb_branch_common): Use new branch
4168 offset encoding methods to avoid code duplication.
4169 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4170 (Stub_addend_reader::operator()): Use new branch encoding method
4171 to avoid code duplication.
4173 2010-01-11 Doug Kwan <dougkwan@google.com>
4175 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4176 (Target_arm::do_finalize_sections): Define special EXIDX section
4177 symbols only if referenced.
4178 * gc.h (Garbage_collection::add_reference): New method.
4179 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4182 2010-01-11 Ian Lance Taylor <iant@google.com>
4184 * script.cc (Version_script_info::build_expression_list_lookup):
4185 Change complaing about duplicate wildcard match from error to
4188 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4190 (Version_script_info::Version_script_info): Initialize globs_,
4191 default_version_, default_is_global_, and exact_. Don't
4192 initialize globals_ or locals_.
4193 (Version_script_info::build_lookup_tables): Build local symbols
4195 (Version_script_info::unquote): New function.
4196 (Version_script_info::add_exact_match): New function.
4197 (Version_script_info::build_expression_list_lookup): Remove lookup
4198 parameter. Add is_global parameter. Change all callers. Handle
4199 wildcard pattern specially. Unquote pattern. Call
4201 (Version_script_info::get_name_to_match): New function.
4202 (Version_script_info::get_symbol_version): New function.
4203 (Version_script_info::get_symbol_version_helper): Remove.
4204 (Version_script_info::check_unmatched_names): Call unquote.
4205 * script.h (class Version_script_info): Change get_symbol_version
4206 to be non-inline and add is_global parameter; change all callers.
4207 Rewrite symbol_is_local. Update declarations. Define struct
4208 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4209 Remove globals_ and locals_ members. Add exact_, globs_,
4210 default_version_, is_global_.
4211 (Version_script_info::Glob): Remove pattern, add expression and
4212 is_global. Update constructor. Change all callers.
4213 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4215 (Versions::symbol_section_contents): If a symbol is undefined, or
4216 defined in a dynamic object, set the version index to
4218 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4220 (Symbol_table::add_from_pluginobj): Likewise.
4221 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4223 2010-01-11 Doug Kwan <dougkwan@google.com>
4225 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4226 (incremental_dump_LDADD): Add linking option for libintl.
4227 * Makefile.in: Regenerate.
4229 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4232 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4234 * testsuite/Makefile.in: Regenerated.
4236 2010-01-10 Doug Kwan <dougkwan@google.com>
4238 * options.h (DEFINE_var): Use parentheses around argument varname__
4239 in macro body to avoid any unintended subsequent substitutions.
4241 2010-01-10 Ian Lance Taylor <iant@google.com>
4243 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4244 candidates before doing symbol resolution.
4246 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4247 ODR candidates if only one is weak.
4249 2010-01-08 Ian Lance Taylor <iant@google.com>
4251 * script.cc (Version_script_info::build_expression_list_lookup):
4252 Don't warn about ambiguous version, just record the ambiguity.
4253 (Version_script_info::get_symbol_version_helper): Give error if
4254 version is ambiguous.
4256 2010-01-08 Doug Kwan <dougkwan@google.com>
4258 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4259 prev_data_size_ and prev_addralign_. Remove initializer for
4260 deleted data member has_been_changed_.
4261 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4262 to determine if the table is empty.
4263 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4265 (Stub_table::add_reloc_stub): Define method in class definition
4266 instead of just declaring it there.
4267 (Stub_table::add_cortex_a8_stub): New method definition.
4268 (Stub_table::update_data_size_and_addralign): Ditto.
4269 (Stub_table::finalize_stubs): Ditto.
4270 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4271 (Stub_table::do_addralign_): Return address alignment in the
4272 (Stub_table::do_reset_address_and_file_offset): Define method in
4273 class definition instead of declaring it there. Set current data
4274 size to be the data size of the previous pass.
4275 (Stub_table::set_final_data_size): Use current data size as the
4277 (Stub_table::relocate_stub): Change parameter type of stub from
4278 Reloc_stub pointer to Stub pointer.
4279 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4280 (Stub_table::Cortex_a8_stub_list): New typedef.
4281 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4282 Stub_table::prev_addralign_): New data member.
4283 (Arm_relobj::Arm_relobj): Initialize data member
4284 section_has_cortex_a8_workaround_.
4285 (Arm_relobj::section_has_cortex_a8_workaround,
4286 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4288 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4290 (Target_arm::relocate_stub): Change parameter type of stub from
4291 Reloc_stub pointer to Stub pointer.
4292 (Insn_template::size, Insn_template::alignment): Handle
4293 THUMB16_SPECIAL_TYPE.
4294 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4295 Stub_table::update_data_size_and_addralign,
4296 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4298 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4299 (Stub_table::do_write): Ditto.
4300 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4302 2010-01-08 Ian Lance Taylor <iant@google.com>
4305 * symtab.h (class Symbol): Remove fields is_target_special_ and
4306 has_plt_offset_. Add field is_defined_in_discarded_section_.
4307 (Symbol::is_defined_in_discarded_section): New function.
4308 (Symbol::set_is_defined_in_discarded_section): New function.
4309 (Symbol::has_plt_offset): Rewrite.
4310 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4311 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4312 Don't initialize is_target_special_ or has_plt_offset_.
4313 Initialize is_defined_in_discarded_section_.
4314 (Symbol_table::add_from_relobj): If appropriate, set
4315 is_defined_in_discarded_section.
4316 * resolve.cc (Symbol::override_base_with_special): Don't test
4317 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4318 * target-reloc.h (relocate_section): Do special handling for
4319 symbols defined in discarded sections for global symbols as well
4322 2010-01-08 Ian Lance Taylor <iant@google.com>
4324 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4325 the SHT_SYMTAB case.
4327 2010-01-08 Ian Lance Taylor <iant@google.com>
4329 * object.cc (Sized_relobj::do_layout): Don't get confused if
4330 layout_eh_frame returns NULL.
4332 2010-01-08 Ian Lance Taylor <iant@google.com>
4335 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4336 dynamic symbol table, use the normal symbol table.
4337 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4340 2010-01-08 Ian Lance Taylor <iant@google.com>
4343 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4346 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4348 * version.cc (print_version): Change to "Copyright 2010".
4350 2010-01-08 Ian Lance Taylor <iant@google.com>
4354 * i386.cc (class Target_i386): Change return type of plt_section
4356 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4357 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4358 tls_desc_rel_ field.
4359 (Output_data_plt_i386::rel_tls_desc): New function.
4360 (Target_i386::rel_tls_desc_section): New function.
4361 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4362 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4363 R_386_TLS_DESC reloc in rel_tls_desc_section.
4364 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4365 Define struct Tlsdesc_info.
4366 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4367 (Target_x86_64::do_reloc_symbol_index): New function.
4368 (Target_x86_64::add_tlsdesc_info): New function.
4369 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4370 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4372 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4374 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4375 (Target_x86_64::rela_tlsdesc_section): New function.
4376 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4378 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4379 (Target_x86_64::do_reloc_addend): New function.
4380 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4381 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4382 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4383 (Output_reloc::type): New function.
4384 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4385 (Output_reloc::is_target_specific): New function.
4386 (Output_reloc::target_arg): New function.
4387 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4388 absolute relocs and target specific relocs.
4389 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4390 add_target_specific.
4391 (class Output_data_reloc) [SHT_RELA]: Likewise.
4392 * output.cc (Output_reloc::Output_reloc): Add four new versions
4393 for absolute relocs and target specific relocs.
4394 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4395 (Output_reloc::get_symbol_index): Likewise.
4396 (Output_reloc::local_section_offset): Check that local_sym_index_
4397 is not TARGET_CODE or 0.
4398 (Output_reloc::symbol_value): Likewise.
4399 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4401 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4402 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4404 * layout.cc (add_target_dynamic_tags): Use output section for
4405 DT_PLTRELSZ and DT_JMPREL.
4407 2010-01-07 Ian Lance Taylor <iant@google.com>
4410 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4412 (class Output_data_reloc_generic): Define.
4413 (class Output_data_reloc_base): Change base class to
4414 Output_data_reloc_generic. Change add() method to call
4415 bump_relative_reloc_count for a relative reloc. Remove
4417 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4419 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4420 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4422 * layout.h (class Layout): Update declaration.
4424 2010-01-07 Ian Lance Taylor <iant@google.com>
4426 * output.h (class Output_data): Add const version of
4427 output_section and do_output_section.
4428 (class Output_section_data): Add const version of
4430 (class Output_section): Likewise.
4431 * layout.cc (Layout::add_target_dynamic_tags): New function.
4432 * layout.h (class Layout): Update declarations.
4433 * arm.cc (Target_arm::do_finalize_sections): Use
4434 add_target_dynamic_tags.
4435 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4436 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4437 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4438 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4440 2010-01-07 Ian Lance Taylor <iant@google.com>
4443 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4446 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4447 Ian Lance Taylor <iant@google.com>
4450 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4451 Xindex::read_symtab_xindex.
4453 2010-01-07 Doug Kwan <dougkwan@google.com>
4455 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4456 (Insn_template::thumb16_bcond_insn): New method declaration.
4457 (Insn_template): Fix spelling.
4458 (Stub::thumb16_special): New method declaration.
4459 (Stub::do_write): Define virtual method which was previously pure
4461 (Stub::do_thumb16_special): New method declaration.
4462 (Stub::do_fixed_endian_write): New template member.
4463 (Reloc_stub::do_write): Remove.
4464 (Reloc_stub::do_fixed_endian_write): Remove.
4465 (Cortex_a8_stub): New class definition.
4466 (Stub_factory::make_cortex_a8_stub): New method definition.
4467 (Stub_factory::Stub_factory): Add missing static storage class
4468 qualifier for elf32_arm_stub_a8_veneer_blx.
4470 2010-01-07 Ian Lance Taylor <iant@google.com>
4473 * options.h (class General_options): Add --warn-unresolved-symbols
4474 and --error-unresolved-symbols.
4475 * errors.cc (Errors::undefined_symbol): Implement
4476 --warn-unresolved-symbols.
4478 * options.h (class General_options): Add -z text and -z textoff.
4479 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4481 2010-01-06 Sriraman Tallam <tmsriram@google.com>
4483 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4484 (Garbage_collection::cident_sections): New function.
4485 (Garbage_collection::add_cident_section): New function.
4486 (Garbage_collection::cident_sections_): New member.
4487 (gc_process_relocs): Add references to sections whose names are C
4489 * gold.h (cident_section_start_prefix): New constant.
4490 (cident_section_stop_prefix): New constant.
4491 (is_cident): New function.
4492 * layout.cc (Layout::define_section_symbols): Replace string constants
4493 with the newly defined constants.
4494 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4496 * testsuite/Makefile.am: Add gc_orphan_section_test.
4497 * testsuite/Makefile.in: Regenerate.
4498 * testsuite/gc_orphan_section_test.cc: New file.
4499 * testsuite/gc_orphan_section_test.sh: New file.
4501 2010-01-06 Ian Lance Taylor <iant@google.com>
4504 * options.h (class General_options): Add --warn-shared-textrel.
4505 * layout.cc (Layout::finish_dynamic_section): Implement
4506 --warn-shared-textrel.
4509 * options.h (class General_options): Add --warn-multiple-gp.
4511 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4513 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4514 $(THREADSLIB) and $(LIBDL).
4515 * Makefile.in: Rebuild.
4517 2010-01-06 Ian Lance Taylor <iant@google.com>
4520 * options.cc (General_options::parse_section_start): New function.
4521 (General_options::section_start): New function.
4522 (General_options::General_options): Initialize all members.
4523 * options.h: Include <map>
4524 (class General_options): Add --section-start. Add section_starts_
4526 * layout.cc (Layout::attach_allocated_section_to_segment): If
4527 --section-start was used, set the address of the segment. Remove
4528 local sort_sections.
4529 (Layout::relaxation_loop_body): If the address of the load segment
4530 has been set by --section-start, don't use it.
4531 * output.h (Output_segment::update_flags_for_output_section): New
4533 * output.cc (Output_segment::add_output_section): Call
4534 update_flags_for_output_section.
4536 2010-01-05 Ian Lance Taylor <iant@google.com>
4539 * options.h (class General_options): Add --undefined-version.
4540 * script.cc (struct Version_expression): Add was_matched_by_symbol
4542 (Version_script_info::matched_symbol): New function.
4543 (Version_script_info::get_symbol_version_helper): Call
4545 (Version_script_info::check_unmatched_names): New function.
4546 * script.h (class Version_script_info): Update declarations.
4547 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4549 * options.h (class General_options): Use DEFINE_bool_alias for
4550 allow_multiple_definition.
4551 * resolve.cc (Symbol_table::should_override): Don't test
4552 allow_multiple_definition.
4555 * options.h (class General_options): Add --cref.
4556 * main.cc (main): Print cref table if --cref. Don't close mapfile
4557 until after printing cref table.
4558 * cref.cc: Include "symtab.h".
4559 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4560 (Cref_table_compare::operator()): New function.
4561 (Cref_inputs::gather_cref): New function.
4562 (filecol): New static const.
4563 (Cref_inputs::print_cref): New function.
4564 (Cref::print_cref): New function.
4565 * cref.h: Include <cstdio>.
4566 (class Cref): Update declarations.
4567 * mapfile.h (Mapfile::file): New function.
4568 * object.h (class Object): Define Symbols. Declare virtual
4569 do_get_global_symbols.
4570 (Object::get_global_symbols): New function.
4571 * object.cc (Input_objects::add_object): Pass object to cref_ if
4573 (Input_objects::archive_start): Likewise.
4574 (Input_objects::archive_stop): Likewise.
4575 (Input_objects::print_cref): New function.
4576 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4577 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4579 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4581 * plugin.h (class Sized_pluginobj): Update declarations.
4583 2010-01-05 Ian Lance Taylor <iant@google.com>
4585 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4586 to is_default_version. Rename insdef to insdefault.
4587 (Symbol_table::add_from_relobj): Rename def to is_default_version
4588 and local to is_forced_local.
4589 (Symbol_table::add_from_pluginobj): Likewise.
4590 (Symbol_table::add_from_dynobj): Likewise.
4591 (Symbol_table::define_special_symbol): Rename insdef to
4594 2010-01-04 Ian Lance Taylor <iant@google.com>
4597 * options.h (class General_options): Add
4598 --allow-multiple-definition and -z muldefs.
4599 * resolve.cc (Symbol_table::should_override): Don't warn about a
4600 multiple symbol definition if --allow-multiple-definition or -z
4604 * options.h (class General_options): Add --add-needed and
4605 --copy-dt-needed-entries. Tweak --as-needed help entry.
4606 * object.cc (Input_objects::check_dynamic_dependencies): Give an
4607 error if --copy-dt-needed-entries aka --add-needed is used and
4608 would cause a change in behaviour.
4611 * options.h (class General_options): Add -G as a short version of
4612 --shared. Add no-op options -assert, -g, and -i.
4614 2010-01-04 Sriraman Tallam <tmsriram@google.com>
4616 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4617 check for .text or .gnu.linkonce.t sections.
4618 * icf.cc (Icf::find_identical_sections): Ditto.
4619 Change the detection for mangled function name within the section
4621 * icf.h (is_section_foldable_candidate): New function.
4623 2009-12-30 Ian Lance Taylor <iant@google.com>
4626 * options.h (class General_options): Permit two dashes with
4627 --retain-symbols-file.
4629 2009-12-30 Ian Lance Taylor <iant@google.com>
4632 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4633 don't put the file header and segment headers in the text
4637 * common.cc (Sort_commons::operator()): Stabilize sort when both
4639 (Symbol_table::do_allocate_commons_list): When allocating common
4640 symbols, skip a symbol which is no longer common.
4641 * symtab.h (Symbol::is_common): Test whether the symbol comes from
4642 an object before checking its type.
4643 * testsuite/common_test_2.c: New file.
4644 * testsuite/common_test_3.c: New file.
4645 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4646 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4647 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4648 (common_test_2_pic.o, common_test_2.so): New targets.
4649 (common_test_3_pic.o, common_test_3.so): New targets.
4650 * testsuite/Makefile.in: Rebuild.
4653 * script.cc (read_input_script): If we see a new SECTIONS clause,
4654 and we have added an input section, give an error.
4655 * layout.h (class Layout): Add have_added_input_section function.
4656 Add have_added_input_section_ field.
4657 * layout.cc (Layout::Layout): Initialize
4658 have_added_input_section_.
4659 (Layout::layout): Set have_added_input_section_.
4660 (Layout::layout_eh_frame): Likewise.
4662 2009-12-30 Ian Lance Taylor <iant@google.com>
4665 * options.h (class General_options): Add --sort-common option.
4666 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4667 * common.cc (Sort_common): Add sort_order parameter to
4668 constructor. Add sort_order_ field.
4669 (Sort_commons::operator): Check sort_order_.
4670 (Symbol_table::allocate_commons): Determine the sort order.
4671 (Symbol_table::do_allocate_commons): Add sort_order parameter.
4673 (Symbol_table::do_allocate_commons_list): Likewise.
4675 2009-12-30 Ian Lance Taylor <iant@google.com>
4678 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4679 symbols from this object, don't change the visibility of an
4681 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4683 2009-12-30 Ian Lance Taylor <iant@google.com>
4686 * script.h (class Version_script_info): Define Language enum.
4687 Update declarations. Define Glob, Exact, and Lookup types. Add
4688 new fields globals_, locals_, and is_finalized_.
4689 * script.cc: Various formatting fixes.
4690 (class Parser_closure): Change language_stack_ from a vector of
4691 std::string to one of Version_script_info::Language. Adjust all
4693 (class Lazy_demangler): Remove.
4694 (struct Version_expression): Change language from std::string to
4695 Version_script_info::Language.
4696 (Version_script_info::Version_script_info): New function.
4697 (Version_script_info::~Version_script_info): Don't call clear.
4698 (Version_script_info::finalize): New function.
4699 (Version_script_info::build_lookup_tables): New function.
4700 (Version_script_info::build_expression_list_lookup): New
4702 (Version_script_info::get_symbol_version_helper): Rewrite to use
4704 (Version_script_info::print_expression_list): Adjust to use
4705 Version_script_info::Language.
4706 (script_push_lex_into_version_mode): Check that the version script
4707 has not been finalized.
4708 (version_script_push_lang): Change language string to
4709 Version_script_info::Language.
4710 * options.cc (Command_line::version_script): New function.
4711 * options.h (class General_options): Add finalize_dynamic_list
4712 function. Change version_script from declaration to definition.
4713 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4714 * testsuite/version_script.map: Remove duplicate def of foo.
4715 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4717 * testsuite/Makefile.in: Rebuild.
4719 2009-12-30 Ian Lance Taylor <iant@google.com>
4722 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4723 if the input symbol index is 0, make the output symbol index 0.
4725 2009-12-30 Ian Lance Taylor <iant@google.com>
4728 * options.h (class General_options): Add -x/--discard-all.
4729 * object.cc (Sized_relobj::do_count_local_symbols): Handle
4730 --discard-all. If the local symbol needs a dynamic entry, check
4731 that before handling --discard-locals.
4733 2009-12-30 Ian Lance Taylor <iant@google.com>
4736 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4738 (Output_segment::add_output_section): Don't change the flags if
4742 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4743 GNU hash table if they need a dynamic value. Otherwise, don't add
4744 them if they are defined in a dynamic object or are forced local.
4746 2009-12-29 Ian Lance Taylor <iant@google.com>
4749 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4750 .gnu.hash table for a 32-bit target.
4753 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4754 regular and a dynamic object only needs a dynamic symbol table
4755 entry if it is externally visible.
4758 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4759 constructor. Add global_offset_table_ field.
4760 (Target_i386::got_section): Set global_offset_table_.
4761 (Target_i386::do_finalize_sections): Set global_offset_table_
4763 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4764 in constructor. Add global_offset_table_ field.
4765 (Target_x86_64::got_section): Set global_offset_table_.
4766 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4769 * layout.cc (Layout::Layout): Initialize increase_relro_.
4770 (Layout::get_output_section): Add is_relro, is_last_relro, and
4771 is_first_non_relro parameters. Change all callers.
4772 (Layout::choose_output_section): Likewise.
4773 (Layout::add_output_section_data): Likewise.
4774 (Layout::make_output_section): Likewise.
4775 (Layout::set_segment_offsets): Clear increase_relro when using a
4777 * layout.h (class Layout): Add increase_relro method. Add
4778 increase_relro_ field. Update declarations.
4779 * output.cc (Output_section::Output_section): Initialize
4780 is_last_relro_ and is_first_non_relro_.
4781 (Output_segment::add_output_section): Group relro sections is
4782 do_sort is true. Handle is_last_relro and is_first_non_relro.
4783 (Output_segment::maximum_alignment): Remove relro handling.
4784 (Output_segment::set_section_addresses): Add increase_relro
4785 parameter. Change all callers. Add initial alignment to align
4786 relro sections on separate page. Remove old relro handling.
4787 (Output_segment::set_section_list_addresses): Remove in_relro
4788 parameter. Change all callers.
4789 (Output_segment::set_offset): Add increase parameter. Change all
4790 callers. Remove old relro handling.
4791 * output.h (class Output_section): Add new methods: is_last_relro,
4792 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4793 Add is_last_relro_ and is_first_non_relro_ fields.
4794 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4795 Create separate .got.plt section. Call increase_relro.
4796 * x86_64.cc (Target_x86_64::got_section): Likewise.
4797 * testsuite/relro_script_test.t: Add .got.plt.
4800 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4801 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4802 (Layout::finalize): Call set_dynamic_symbol_size.
4803 (Layout::set_dynamic_symbol_size): New function.
4804 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4805 set_dynamic_symbol_size.
4808 * output.h (class Output_section): Add is_entsize_zero_ field.
4809 * output.cc (Output_section::Output_section): Initialize
4811 (Output_section::set_entsize): If two different entsizes are
4812 requested, force it to zero.
4813 (Output_section::add_input_section): Set flags for .debug_str
4814 before updating section flags. Set entsize.
4815 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4816 and SHF_STRING if all input sections have those flags.
4818 2009-12-29 Rafael Espindola <espindola@google.com>
4820 * main.cc (main): Fix the sys time reporting.
4821 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4824 2009-12-29 Sriraman Tallam <tmsriram@google.com>
4826 * options.cc (General_options::parse_version): Allow -v to exit
4827 without an error if there is nothing to link.
4829 2009-12-29 Ian Lance Taylor <iant@google.com>
4831 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4832 using a version of gcc before 4.1.
4833 * configure: Rebuild.
4835 2009-12-28 Chris Demetriou <cgd@google.com>
4837 * attributes.cc (Output_attributes_section_data::do_write): Use
4838 std::vector::front rather than std::vector::data.
4840 2009-12-28 Ian Lance Taylor <iant@google.com>
4842 * symtab.h (class Symbol_table): Add enum Defined.
4843 * resolve.cc (Symbol_table::should_override): Add defined
4844 parameter. Change all callers. Test whether object is NULL
4845 before calling a method on it.
4846 (Symbol_table::report_resolve_problem): Add defined parameter.
4848 (Symbol_table::should_override_with_special): Likewise.
4849 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4850 parameter. Change all callers.
4851 (Symbol_table::do_define_in_output_data): Likewise.
4852 (Symbol_table::define_in_output_segment): Likewise.
4853 (Symbol_table::do_define_in_output_segment): Likewise.
4854 (Symbol_table::define_as_constant): Likewise.
4855 (Symbol_table::do_define_as_constant): Likewise.
4856 * script.h (class Symbol_assignment): Add is_defsym parameter to
4857 constructor; change all callers.
4858 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4859 parameter. Change all callers. Add is_defsym_ field.
4860 (class Parser_closure): Add parsing_defsym parameter to
4861 constructor; change all callers. Add parsing_defsym accessor
4862 function. Add parsing_defsym_ field.
4864 2009-12-28 Ian Lance Taylor <iant@google.com>
4866 * gold.cc (queue_middle_tasks): Fix formatting.
4867 * object.cc (Relobj::is_section_name_included): Likewise.
4869 2009-12-23 Ian Lance Taylor <iant@google.com>
4871 * i386.cc (Target_i386::do_calls_non_split): Recognize
4872 -fsplit-stack prologue for a function with a static chain.
4873 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4874 -fsplit-stack prologue when using %r11.
4876 2009-12-21 Sriraman Tallam <tmsriram@google.com>
4878 * options.cc (General_options::parse_version): Make -v continue and do
4879 the link like GNU ld does.
4881 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
4883 * Makefile.am (CCFILES): Add timer.cc.
4884 (HFILES): Add timer.h.
4885 * configure.ac: Check for sysconf and times.
4886 * main.cc: include timer.h.
4887 (main): Use Timer instead of get_run_time.
4890 * workqueue.cc: include timer.h.
4891 (Workqueue::find_and_run_task):
4892 Report user, sys and wall time.
4893 * Makefile.in: Regenerate.
4894 * config.in: Regenerate.
4895 * configure: Regenerate.
4897 2009-12-16 Doug Kwan <dougkwan@google.com>
4899 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4901 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4902 relaxed input sections.
4903 * output.cc (Output_section::find_relaxed_input_section): Change
4904 return type to Output_relaxed_input_section pointer. Adjust code
4905 for new type of relaxed_input_section_map_.
4906 * output.h (Output_section::find_relaxed_input_section): Change
4907 return type to Output_relaxed_input_section pointer.
4908 (Output_section::Output_relaxed_input_section_by_input_section_map):
4910 (Output_section::relaxed_input_section_map_): Change type to
4911 Output_section::Output_relaxed_input_section_by_input_section_map.
4912 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4915 2009-12-15 Ian Lance Taylor <iant@google.com>
4917 * layout.cc (Layout::create_shstrtab): Only write out after input
4918 sections if we are compressing debug sections.
4920 2009-12-15 Ian Lance Taylor <iant@google.com>
4922 * archive.cc (Archive::add_symbols): Only look up a symbol without
4923 a version if there is, in fact, a version.
4925 2009-12-14 Ian Lance Taylor <iant@google.com>
4927 Revert -Wshadow changes, all changes from:
4928 2009-12-11 Doug Kwan <dougkwan@google.com>
4929 2009-12-11 Nick Clifton <nickc@redhat.com>
4930 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4932 2009-12-11 Doug Kwan <dougkwan@google.com>
4934 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4936 * attributes.cc (Object_attribute::size): Ditto.
4937 (Attributes_section_data::size): Ditto.
4938 (Attributes_section_data::Attributes_section_data): Ditto.
4939 (Output_attributes_section_data::do_write): Ditto.
4940 * attributes.h (Object_attribute::set_type): Ditto.
4941 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4943 2009-12-11 Nick Clifton <nickc@redhat.com>
4945 * archive.cc: Fix shadowed variable warnings.
4947 * compressed_output.cc: Likewise.
4948 * compressed_output.h: Likewise.
4949 * configure: Likewise.
4950 * dwarf_reader.cc: Likewise.
4951 * dynobj.cc: Likewise.
4952 * dynobj.h: Likewise.
4953 * ehframe.cc: Likewise.
4954 * ehframe.h: Likewise.
4955 * errors.cc: Likewise.
4956 * expression.cc: Likewise.
4957 * fileread.cc: Likewise.
4958 * fileread.h: Likewise.
4959 * freebsd.h: Likewise.
4960 * i386.cc: Likewise.
4962 * incremental.h: Likewise.
4963 * layout.cc: Likewise.
4964 * layout.h: Likewise.
4965 * mapfile.cc: Likewise.
4966 * merge.cc: Likewise.
4967 * merge.h: Likewise.
4968 * object.cc: Likewise.
4969 * object.h: Likewise.
4970 * options.h: Likewise.
4971 * output.cc: Likewise.
4972 * output.h: Likewise.
4973 * parameters.cc: Likewise.
4974 * plugin.cc: Likewise.
4975 * powerpc.cc: Likewise.
4976 * reduced_debug_output.cc: Likewise.
4977 * reduced_debug_output.h: Likewise.
4978 * reloc.cc: Likewise.
4979 * reloc.h: Likewise.
4980 * resolve.cc: Likewise.
4981 * script-sections.cc: Likewise.
4982 * script.cc: Likewise.
4983 * script.h: Likewise.
4984 * sparc.cc: Likewise.
4985 * symtab.cc: Likewise.
4986 * symtab.h: Likewise.
4987 * target-select.cc: Likewise.
4988 * target-select.h: Likewise.
4989 * token.h: Likewise.
4990 * workqueue.cc: Likewise.
4991 * workqueue.h: Likewise.
4992 * x86_64.cc: Likewise.
4994 2009-12-10 Doug Kwan <dougkwan@google.com>
4996 * arm.cc (attributes.h): New include.
4997 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4998 (Arm_relobj::~Arm_relobj): Delete object pointed by
4999 attributes_section_data_.
5000 (Arm_relobj::attributes_section_data): New method definition.
5001 (Arm_relobj::attributes_section_data_): New data member declaration.
5002 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5003 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5004 attributes_section_data_.
5005 (Arm_dynobj::attributes_section_data): New method definition.
5006 (Arm_dynobj::attributes_section_data_): New data member declaration.
5007 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5008 initialization value of may_use_blx_ to false.
5009 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5010 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5011 object attributes to compute results instead of hard-coding.
5012 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5013 Target_arm::get_secondary_compatible_arch,
5014 Target_arm::set_secondary_compatible_arch
5015 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5016 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5017 New method declarations.
5018 (Target_arm::get_aeabi_object_attribute): New method definition.
5019 (Target_arm::attributes_section_data_): New data member declaration.
5020 (read_arm_attributes_section): New template definition.
5021 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5022 (Arm_dynobj::do_read_symbols): Ditto.
5023 (Target_arm::do_finalize_sections): Merge attributes sections from
5024 input. Check for BLX use after attributes section merging.
5025 Fix __exidx_start and __exidx_end visibility. Create an
5026 .ARM.attributes section if necessary.
5027 (Target_arm::get_secondary_compatible_arch,
5028 Target_arm::set_secondary_compatible_arch,
5029 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5030 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5031 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5032 New method definitions.
5034 2009-12-09 Ian Lance Taylor <iant@google.com>
5036 * plugin.cc (Plugin::load): Don't cast from void* to a function
5039 2009-12-09 Ian Lance Taylor <iant@google.com>
5041 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5044 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5046 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5047 Replace two_file_shared_1.so with two_file_shared_2.so.
5048 * testsuite/Makefile.in: Regenerated.
5050 2009-12-08 Doug Kwan <dougkwan@google.com>
5052 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5053 (HFILES): Add attributes.h and int_encoding.h.
5054 * Makefile.in: Regenerate.
5055 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5056 function definitions to int_encoding.cc
5057 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5058 prototypes to int_encoding.h
5059 * reduced_debug_output.cc (int_encoding.h): New include.
5060 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5061 function definitions to int_encoding.cc
5062 (insert_into_vector, read_from_pointer): Move template definitions to
5064 * attributes.cc: New file.
5065 * attributes.h: New file.
5066 * int_encoding.cc: New file.
5067 * int_encoding.h: New file.
5069 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5072 * incremental-dump.cc (dump_incremental_inputs): New.
5073 (main): Use dump_incremental_inputs.
5075 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5078 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5079 checking elfcpp::STT_FUNC.
5080 (Target_i386::Relocate::relocate): Likewise.
5081 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5083 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5084 symbols from shared libraries into normal FUNC symbols.
5086 * symtab.h (Symbol): Add is_func and use it.
5088 2009-12-05 Doug Kwan <dougkwan@google.com>
5090 * arm.cc (Target_arm::arm_info): Initialize new fields
5091 attributes_section and attributes_vendor.
5092 * i386.cc (Target_i386::i386_info): Same.
5093 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5094 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5095 fields attributes_section and attributes_vendor.
5096 * sparc.cc (Target_sparc::sparc_info): Same.
5097 * target.h (Target::attributes_section, Target::attributes_vendor,
5098 Target::is_attributes_section, Target::attribute_arg_type,
5099 Target::attributes_order): New method definitions.
5100 (Target::Target_info::attributes_section,
5101 Target::Target_info::attributes_vendor): New fields.
5102 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5103 virtual method definitions.
5104 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5105 attributes_section and attributes_vendor.
5106 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5108 2009-12-05 Doug Kwan <dougkwan@google.com>
5110 * arm.cc: Update comments about interworking and stub generation.
5111 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5112 considered as non-PIC.
5113 (Arm_relocate_functions::base_abs): Fix formatting.
5114 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5115 of function to use GOT entry address instead of offset.
5116 (Target_arm::Scan::global): Issue an error if a symbol would need a
5117 PLT does not get one because it is untyped. Remove code to create
5118 dynamic symbols for relative branches.
5119 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5120 takes unsigned integer instead of boolean.
5122 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5124 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5125 (two_file_test_LDADD): Likewise.
5126 (common_test_1_LDADD): Likewise.
5127 (exception_test_LDADD) Likewise.
5128 (weak_test_LDADD): Likewise.
5129 (many_sections_test_LDADD): Likewise.
5130 (initpri1_LDADD): Likewise.
5131 (script_test_1_LDADD): Likewise.
5132 (script_test_2_LDADD): Likewise.
5133 (justsyms_LDADD): Likewise.
5134 (binary_test_LDADD): Likewise.
5135 (large_LDADD): Likewise.
5136 * testsuite/Makefile.in: Regenerated.
5138 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5140 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5141 (Symbol_table::override_with_special): Likewise.
5142 (Symbol_table::add_from_object): Likewise.
5144 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5146 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5147 Don't set the data_offset twice.
5149 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5151 * testsuite/Makefile.in: Regenerate.
5153 2009-12-03 Doug Kwan <dougkwan@google.com>
5155 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5156 (Target_arm::do_finalize_sections): Add parameter for symbol table
5157 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5158 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5159 parameter for symbol table pointer.
5160 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5161 an additional parameter for a pointer to symbol table.
5162 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5163 parameter for a symbol table pointer.
5164 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5165 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5167 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5168 parameter for a symbol table pointer.
5170 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5172 * incremental.cc (Incremental_inputs_header)
5173 (Incremental_inputs_header_write, Incremental_inputs_entry)
5174 (Incremental_inputs_entry_write): Move ...
5175 * incremental.h (Incremental_inputs_header)
5176 (Incremental_inputs_header_write, Incremental_inputs_entry)
5177 (Incremental_inputs_entry_write): here.
5179 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5181 * incremental.cc (make_sized_incremental_binary): Set the target.
5182 Error if it is incompatible.
5183 * output.h (Output_file): Add filename method.
5185 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5187 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5188 from the get_* methods.
5190 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5192 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5193 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5194 Write 0 for the data_offset of scripts.
5196 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5198 * testsuite/Makefile.am: Add the incremental_test.sh test.
5199 * testsuite/incremental_test.sh: New.
5200 * testsuite/incremental_test_1.c: New.
5201 * testsuite/incremental_test_2.c: New.
5203 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5205 * incremental-dump.cc (main): Fix typos.
5207 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5210 * incremental-dump.cc (main): Use llu to print 64 bit values.
5212 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5213 H.J. Lu <hongjiu.lu@intel.com>
5215 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5217 (incremental_dump_LDADD): Likewise.
5218 * Makefile.in: Regenerated.
5220 2009-11-25 Doug Kwan <dougkwan@google.com>
5224 2009-11-25 Doug Kwan <dougkwan@google.com>
5226 * arm.cc (Target_arm::Target_arm): Move method definition
5227 outside of class definition. Add code to handle
5228 --target1-rel, --target1-abs and --target2= options.
5229 (Target_arm::get_reloc_reloc_type): Change method to be
5230 non-static and const.
5231 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5232 New data member declaration.
5233 (Target_arm::Scan::local, Target_arm::Scan::global,
5234 Target_arm::Relocate::relocate,
5235 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5236 Adjust call to Target_arm::get_real_reloc_type.
5237 (Target_arm::get_real_reloc_type): Use command line options
5238 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5239 * options.h (--target1-rel, --target1-abs, --target2): New
5242 2009-11-25 Doug Kwan <dougkwan@google.com>
5244 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5245 class definition. Add code to handle --target1-rel, --target1-abs
5246 and --target2= options.
5247 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5249 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5251 (Target_arm::Scan::local, Target_arm::Scan::global,
5252 Target_arm::Relocate::relocate,
5253 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5254 call to Target_arm::get_real_reloc_type.
5255 (Target_arm::get_real_reloc_type): Use command line options to
5256 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5257 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5260 2009-11-25 Doug Kwan <dougkwan@google.com>
5262 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5263 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5264 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5266 (Arm_relocate_functions::thm_call): Replace body with a call to
5267 Arm_relocate_functions::thumb_branch_common.
5268 (Arm_relocate_functions::thm_jump24,
5269 Arm_relocate_functions::thm_xpc22): New method definitions.
5270 (Arm_relocate_functions::thumb_branch_common): New method definition.
5271 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5273 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5274 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5276 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5278 * Makefile.am: Build incremental-dump
5279 * Makefile.in: Regenerate.
5280 * incremental-dump.cc: New.
5281 * incremental.cc (Incremental_inputs_header_data,
5282 Incremental_inputs_entry_data): Move to incremental.h
5283 * incremental.h: (Incremental_inputs_header_data,
5284 Incremental_inputs_entry_data): Move from incremental.cc
5286 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5288 * incremental.cc (Incremental_inputs_header,
5289 Incremental_inputs_header_write, Incremental_inputs_entry,
5290 Incremental_inputs_entry_write): Add a typedef with the data type.
5292 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5294 * incremental.cc (Incremental_inputs_header,
5295 Incremental_inputs_header_write, Incremental_inputs_entry,
5296 Incremental_inputs_entry_write): Update comment about which
5297 type has the filed descriptions.
5299 2009-11-15 Doug Kwan <dougkwan@google.com>
5301 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5302 (Arm_relocate_functions::arm_branch_common): Change method defintion
5303 in class definition to a method declaration and update list of formal
5305 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5306 Arm_relocation_functions::jump24): Adjust call to
5307 Arm_relocate_functions::arm_branch_common. Update list of formal
5309 (Arm_relocate_functions::xpc25): New method definition.
5310 (Arm_relocate_functions::arm_branch_common): Move method defintion
5311 out from class definition. Use stubs for mode-switching and extending
5313 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5314 specially. Change code to enable use of stubs in ARM branches.
5316 2009-11-10 Doug Kwan <dougkwan@google.com>
5318 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5319 in method declaration.
5320 (Target_arm::relocate_stub): New method declaration.
5321 (Target_arm::default_target): Change to return a pointer instead of
5323 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5324 Target_arm::default_target.
5325 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5327 (Target_arm::relocate_section): Adjust view.
5328 (Target_arm::relocate_stub): New method definition.
5330 2009-11-10 Doug Kwan <dougkwan@google.com>
5332 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5334 * incremental.cc (open_incremental_binary): Initialized local
5335 variables to avoid warnings.
5336 * object.cc (make_elf_object): Ditto.
5337 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5340 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5343 * testsuite/plugin_test.c: Include "config.h".
5345 2009-11-09 Doug Kwan <dougkwan@google.com>
5347 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5348 (arm_symbol_value): Remove.
5349 (Arm_relocate_functions::arm_branch_common,
5350 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5351 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5352 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5353 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5354 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5355 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5356 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5357 Arm_relocate_functions::thm_mobw_abs_nc,
5358 Arm_relocate_functions::thm_mov_abs,
5359 Arm_relocate_functions::movw_prel_nc,
5360 Arm_relocate_functions::thm_movt_abs,
5361 Arm_relocate_functions::movt_prel,
5362 Arm_relocate_functions::thm_movw_prel_nc,
5363 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5364 (Target_arm::Relocate::relocate): Only decompose address into two
5365 parts if relocation type uses the thumb-bit and pass the actual
5366 bit instead of a flag indicating that the thumb-bit is used. Adjust
5367 calls to methods in Arm_relocate_functions for this change.
5369 2009-11-08 Ian Lance Taylor <iant@google.com>
5372 * reloc.cc: Instantiate
5373 Sized_relobj::initialize_input_to_output_maps and
5374 Sized_relobj:free_input_to_output_maps.
5376 2009-11-06 Ian Lance Taylor <iant@google.com>
5379 * defstd.cc (in_segment): Set only_if_ref true for "end".
5381 2009-11-06 Doug Kwan <dougkwan@google.com>
5383 * arm.cc (class Reloc_stub): Correct a comment.
5384 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5385 (Target_arm::scan_section_for_stubs): New method declaration.
5386 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5387 Change methods from private to protected.
5388 (Target_arm::do_may_relax): New method definition.
5389 (Target_arm::do_relax, Target_arm::group_sections,
5390 Target_arm::scan_reloc_for_stub,
5391 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5392 (Target_arm::arm_input_section_map_): New data member declaration.
5393 (Target_arm::scan_reloc_for_stub,
5394 Target_arm::scan_reloc_section_for_stubs,
5395 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5396 Target_arm::do_relax): New method definitions.
5398 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5400 * configure.ac: Check for (struct stat)::st_mtim
5401 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5402 * config.in: Regenerate.
5403 * configure: Regenerate.
5405 2009-11-05 Ian Lance Taylor <iant@google.com>
5408 * output.cc (Output_segment::add_output_section): Add missing
5411 2009-11-04 Ian Lance Taylor <iant@google.com>
5414 * object.h (class Object): Add is_needed and set_is_needed
5415 methods. Add is_needed_ field. Make bool fields into bitfields.
5416 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5417 defined in a dynamic object and referenced by a regular object,
5418 set is_needed for the dynamic object.
5419 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5420 if the file is marked with as_needed and it is not needed.
5422 2009-11-04 Ian Lance Taylor <iant@google.com>
5425 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5426 tags if data is discarded by linker script.
5427 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5428 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5429 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5430 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5432 2009-11-04 Ian Lance Taylor <iant@google.com>
5434 * layout.cc (Layout::get_output_section): Add is_interp and
5435 is_dynamic_linker_section parameters. Change all callers.
5436 (Layout::choose_output_section): Likewise.
5437 (Layout::make_output_section): Likewise.
5438 (Layout::add_output_section_data): Add is_dynamic_linker_section
5439 parameter. Change all callers.
5440 * layout.h (class Layout): Update declarations.
5441 * output.h (class Output_section): Add is_interp, set_is_interp,
5442 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5443 Add is_interp_, is_dynamic_linker_section_ fields. Change
5444 generate_code_fills_at_write_ to a bitfield.
5445 * output.cc (Output_section::Output_sections): Initialize new
5447 (Output_segment::add_output_section): Add do_sort parameter.
5450 2009-11-03 Ian Lance Taylor <iant@google.com>
5453 * options.h (class General_options): Add --warn-common.
5454 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5455 merging two common symbols.
5456 (Symbol_table::should_override): Handle --warn-common when merging
5457 a common symbol with a defined symbol. Use report_resolve_problem
5458 for multiple definitions.
5459 (Symbol_table::report_resolve_problem): New function.
5460 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5462 2009-11-03 Doug Kwan <dougkwan@google.com>
5464 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5466 (Target_arm::stub_factory): New method definition.
5467 (Target_arm::new_arm_input_section,
5468 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5469 Target_arm::reloc_uses_thumb_bit): New method declarations.
5470 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5471 New type definitions.
5472 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5473 member declarations.
5474 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5475 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5476 New method definitions.
5478 2009-11-03 Ian Lance Taylor <iant@google.com>
5480 * options.h (class General_options): Add --warn_constructors.
5482 2009-11-03 Ian Lance Taylor <iant@google.com>
5485 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5486 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5488 2009-11-03 Ian Lance Taylor <iant@google.com>
5491 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5492 --msgid-bugs-address.
5493 (install-pdf): New target.
5494 (install-data_yes): Look up one directory to find mkinstalldirs.
5496 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5498 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5501 2009-10-30 Doug Kwan <dougkwan@google.com>
5503 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5505 2009-10-30 Doug Kwan <dougkwan@google.com>
5507 * arm.cc (Stub_addend_reader): New struct template definition
5508 and partial specializations.
5509 (Stub_addend_reader::operator()): New method definition for a
5510 partially specialized template.
5512 2009-10-30 Doug Kwan <dougkwan@google.com>
5514 * arm.cc (Arm_relobj::processor_specific_flags): New method
5516 (Arm_relobj::do_read_symbols): New method declaration.
5517 (Arm_relobj::processor_specific_flags_): New data member declaration.
5518 (Arm_dynobj): New class definition.
5519 (Target_arm::do_finalize_sections): Add input_objects parameter.
5520 (Target_arm::do_adjust_elf_header): New method declaration.
5521 (Target_arm::are_eabi_versions_compatible,
5522 (Target_arm::merge_processor_specific_flags): New method declaration.
5523 (Target_arm::do_make_elf_object): New overloaded method definitions
5525 (Arm_relobj::do_read_symbols): New method definition.
5526 (Arm_dynobj::do_read_symbols): Ditto.
5527 (Target_arm::do_finalize_sections): Add input_objects parameters.
5528 Merge processor-specific flags from all input objects.
5529 (Target_arm::are_eabi_versions_compatible,
5530 Target_arm::merge_processor_specific_flags,
5531 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5532 New method definitions.
5533 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5534 Input_objects pointer type parameter.
5535 * layout.cc (Layout::finalize): Pass input objects to target's.
5536 finalize_sections function.
5537 * output.cc (Output_file_header::do_sized_write): Set ELF file
5538 header's processor-specific flags.
5539 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5540 Input_objects pointer type parameter.
5541 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5542 * target.h (Input_objects): New forward class declaration.
5543 (Target::processor_specific_flags,
5544 Target::are_processor_specific_flags_sect): New method definitions.
5545 (Target::finalize_sections): Add input_objects parameter.
5546 (Target::Target): Initialize processor_specific_flags_ and
5547 are_processor_specific_flags_set_.
5548 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5550 (Target::set_processor_specific_flags): New method definition.
5551 (Target::processor_specific_flags_,
5552 Target::are_processor_specific_flags_set_): New data member
5554 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5555 Input_objects pointer type parameter.
5557 2009-10-30 Doug Kwan <dougkwan@google.com>
5559 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5561 2009-10-28 Ian Lance Taylor <iant@google.com>
5563 * object.h (class Relobj): Drop options parameter from
5564 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5565 do_scan_relocs, do_relocate. Change all callers.
5566 (class Sized_relobj): Drop options parameters from
5567 do_gc_process_relocs, do_scan_relocs, do_relocate,
5568 do_relocate_sections, relocate_sections, emit_relocs_scan,
5569 emit_relocs_scan_reltype. Change all callers.
5570 (struct Relocate_info): Remove options field and all references to
5572 * reloc.h (class Read_relocs): Remove options constructor
5573 parameter and options_ field. Change all callers.
5574 (class Gc_process_relocs, class Scan_relocs): Likewise.
5575 (class Relocate_task): Likewise.
5576 * target-reloc.h (scan_relocs): Remove options parameter. Change
5578 (scan_relocatable_relocs): Likewise.
5579 * target.h (class Sized_target): Remove options parameter from
5580 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5582 * gc.h (gc_process_relocs): Remove options parameter. Change all
5584 * arm.cc: Update functions to remove options parameters.
5585 * i386.cc: Likewise.
5586 * powerpc.cc: Likewise.
5587 * sparc.cc: Likewise.
5588 * x86_64.cc: Likewise.
5589 * testsuite/testfile.cc: Likewise.
5591 2009-10-28 Doug Kwan <dougkwan@google.com>
5593 * arm.cc (Arm_relobj): New class definition.
5594 (Arm_relobj::scan_sections_for_stubs,
5595 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5596 New method definitions.
5598 2009-10-28 Cary Coutant <ccoutant@google.com>
5600 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5601 (Plugin::cleanup_done_): New member.
5602 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5603 (Plugin_manager::cleanup_done_): Remove.
5604 (Plugin_manager::add_input_file): Edit error message.
5605 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5606 (Plugin_manager::cleanup): Remove use of cleanup_done_.
5608 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
5610 * fileread.cc: (File_read::View::~View): Use the new
5611 data_ownership_ filed.
5612 (File_read::~File_read): Dispose the new whole_file_view_.
5613 (File_read::open): Mmap the whole file if needed.
5614 (File_read::open): Use whole_file_view_ instead of contents_.
5615 (File_read::find_view): Use whole_file_view_ if applicable.
5616 (File_read::do_read): Use whole_file_view_ instead of contents_.
5617 (File_read::make_view): Use whole_file_view_ instead of contents_,
5618 update File_read::View::View call.
5619 (File_read::find_or_make_view): Update File_read::View::View
5621 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5623 (File_read::View::Data_ownership): New enum.
5624 (File_read::View::View): Replace bool mapped_ with Data_ownership
5626 (File_read::View::mapped_): Remove (replaced by data_ownership_).
5627 (File_read::View::data_ownership_): New field.
5628 (File_read::contents_): Remove (replaced by whole_file_view_).
5629 (File_read::whole_file_view_): New field.
5630 * options.h (class General_options): Add --keep-files-mapped.
5632 2009-10-27 Cary Coutant <ccoutant@google.com>
5634 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5635 * testsuite/Makefile.am (plugin_test_5): New test case.
5636 * testsuite/Makefile.in: Regenerate.
5638 2009-10-25 Doug Kwan <dougkwan@google.com>
5640 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5641 from private to protected to allow access by child class.
5642 (Sized_relobj::do_relocate_sections): New method declaration.
5643 (Sized_relobj::relocate_sections): Virtualize.
5644 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5645 Sized_relobj::relocate_sections. Instantiate template explicitly
5646 for different target sizes and endianity.
5648 2009-10-24 Doug Kwan <dougkwan@google.com>
5650 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5651 (Arm_input_section::as_arm_input_section): New method.
5652 (Arm_output_section): New class definition.
5653 (Arm_output_section::create_stub_group,
5654 Arm_output_section::group_sections): New method definitions.
5656 2009-10-22 Doug Kwan <dougkwan@google.com>
5658 * arm.cc (Arm_input_section): New class definition.
5659 (Arm_input_section::init, Arm_input_section:do_write,
5660 Arm_input_section::set_final_data_size,
5661 Arm_input_section::do_reset_address_and_file_offset): New method
5664 2009-10-21 Doug Kwan <dougkwan@google.com>
5666 * arm.cc (Stub_table, Arm_input_section): New forward class
5668 (Stub_table): New class defintion.
5669 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5670 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5671 New method definition.
5673 2009-10-21 Doug Kwan <dougkwan@google.com>
5675 * arm.cc: Update copyright comments.
5676 (Target_arm): New forward class template declaration.
5677 (Arm_address): New type.
5678 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5679 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5680 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5682 (Insn_template): Same.
5683 (DEF_STUBS): New macro.
5684 (Stub_type): New enum type.
5685 (Stub_template): New class definition.
5688 (Stub_factory): Same.
5689 (Target_arm::Target_arm): Initialize may_use_blx_ and
5690 should_force_pic_veneer_.
5691 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5692 Target_arm::should_force_pic_veneer,
5693 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5694 Target_arm::using_thumb_only, Target_arm:;default_target): New
5696 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5697 New data member declarations.
5698 (Insn_template::size, Insn_template::alignment): New method defintions.
5699 (Stub_template::Stub_template): New method definition.
5700 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5701 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5702 (Stub_factory::Stub_factory): New method definition.
5703 * gold.h (string_hash): New template.
5704 * output.h (Input_section_specifier::hash_value): Use
5706 (Input_section_specifier::string_hash): Remove.
5707 * stringpool.cc (Stringpool_template::string_hash): Use
5710 2009-10-20 Doug Kwan <dougkwan@google.com>
5712 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5713 symbols of relaxed input sections.
5714 * output.h (Output_section::find_relaxed_input_section): Make
5717 2009-10-16 Doug Kwan <dougkwan@google.com>
5719 * dynobj.cc (Versions::Versions): Initialize version_script_.
5720 Only insert base version symbol definition for a shared object
5721 if version script defines any version versions.
5722 (Versions::define_base_version): New method definition.
5723 (Versions::add_def): Check that base version is not needed.
5724 (Versions::add_need): Define base version lazily.
5725 * dynobj.h (Versions::define_base_version): New method declaration.
5726 (Versions::needs_base_version_): New data member declaration.
5727 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5728 (check_DATA): Add no_version_test.stdout.
5729 (libno_version_test.so, no_version_test.o no_version_test.stdout):
5731 * testsuite/Makefile.in: Regenerate.
5732 * testsuite/no_version_test.c: New file.
5733 * testsuite/no_version_test.sh: Ditto.
5735 2009-10-16 Doug Kwan <dougkwan@google.com>
5737 * expression.cc (class Segment_start_expression): New class definition.
5738 (Segment_start_expression::value): New method definition.
5739 (script_exp_function_segment_start): Return a new
5740 Segment_start_expression.
5741 * gold/script-c.h (script_saw_segment_start_expression): New function
5743 * script-sections.cc (Script_sections::Script_sections): Initialize
5744 SAW_SEGMENT_START_EXPRESSION_ to false.
5745 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5746 and -Tbbs options to specify section addresses if given in
5747 command line and no SEGMENT_START expression is seen in a script.
5748 * script-sections.h (Script_sections::saw_segment_start_expression,
5749 Script_sections::set_saw_segment_start_expression): New method
5751 (Script_sections::saw_segment_start_expression_): New data member
5753 * script.cc (script_saw_segment_start_expression): New function.
5754 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5755 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5756 script_test_7.sh and script_test_8.sh.
5757 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5758 script_test_8.stdout.
5759 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5760 (script_test_6, script_test_6.stdout, script_test_7,
5761 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5762 * Makefile.in: Regenerate.
5763 * testsuite/script_test_6.sh: New file.
5764 * testsuite/script_test_6.t: Same.
5765 * testsuite/script_test_7.sh: Same.
5766 * testsuite/script_test_7.t: Same.
5767 * testsuite/script_test_8.sh: Same.
5769 2009-10-16 Doug Kwan <dougkwan@google.com>
5771 * output.cc (Output_segment::set_section_list_address): Cast
5772 expressions to unsigned long long type to avoid format warnings.
5774 2009-10-15 Ian Lance Taylor <iant@google.com>
5776 * script.cc (Script_options::add_symbol_assignment): Always add a
5777 dot assignment to script_sections_.
5778 * script-sections.cc (Script_sections::add_dot_assignment):
5779 Initialize if necessary.
5781 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5782 program headers with no load segment if there is a linker script.
5784 * layout.cc (Layout::set_segment_offsets): Align the file offset
5785 to the segment aligment for -N or -n with no load segment.
5786 * output.cc (Output_segment::add_output_section): Don't crash if
5787 the first section is a TLS section.
5788 (Output_segment::set_section_list_addresses): Print an error
5789 message if the address moves backward in a linker script.
5790 * script-sections.cc
5791 (Output_section_element_input::set_section_addresses): Don't
5792 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5793 (Orphan_output_section::set_section_addresses): Likewise.
5795 2009-10-15 Doug Kwan <dougkwan@google.com>
5797 * layout.cc (Layout::finish_dynamic_section): Generate tags
5798 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5799 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5800 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5802 2009-10-14 Ian Lance Taylor <iant@google.com>
5804 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5806 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5807 data_shdr fields of relinfo.
5808 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5809 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5810 R_386_TLS_LDO_32, adjust based on section flags.
5811 (Target_i386::Relocate::fix_up_ldo): Remove.
5813 2009-10-13 Ian Lance Taylor <iant@google.com>
5815 Add support for -pie.
5816 * options.h (class General_options): Add -pie and
5818 (General_options::output_is_position_independent): Test -pie.
5819 (General_options::output_is_executable): Return true if not shared
5820 and not relocatable.
5821 (General_options::output_is_pie): Remove.
5822 * options.cc (General_options::finalize): Reject incompatible uses
5824 * gold.cc (queue_middle_tasks): A -pie link is not static.
5825 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5826 * symtab.cc (Symbol::final_value_is_known): Return false if
5827 output_is_position_independent.
5828 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5829 output_is_position_independent.
5830 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5831 output_is_position_independent.
5832 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5833 output_is_position_independent.
5834 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5836 (basic_pie_test.o, basic_pie_test): New targets.
5837 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5838 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5839 (two_file_pie_test): New target.
5840 * testsuite/Makefile.in: Rebuild.
5841 * README: Remove note saying that -pie is not supported.
5843 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
5845 * options.h (class General_options): Add -init and -fini.
5846 * layout.cc (Layout::finish_dynamic_section): Emit
5847 given init and fini functions.
5849 2009-10-13 Sriraman Tallam <tmsriram@google.com>
5851 * gc.h (gc_process_relocs): Check if icf is enabled using new
5853 * gold.cc (queue_initial_tasks): Likewise.
5854 (queue_middle_tasks): Likewise.
5855 * object.cc (do_layout): Likewise.
5856 * symtab.cc (is_section_folded): Likewise.
5857 * main.cc (main): Likewise.
5858 * reloc.cc (Read_relocs::run): Likewise.
5859 (Sized_relobj::do_scan_relocs): Likewise.
5860 * icf.cc (is_function_ctor_or_dtor): New function.
5861 (Icf::find_identical_sections): Check if function is ctor or dtor when
5863 * options.h (General_options::icf): Change option to be an enum.
5864 (Icf_status): New enum.
5865 (icf_enabled): New method.
5866 (icf_safe_folding): New method.
5867 (set_icf_status): New method.
5868 (icf_status_): New variable.
5869 * (options.cc) (General_options::finalize): Set icf_status_.
5870 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5871 icf_test and icf_keep_unique_test to use the --icf enum flag.
5872 * testsuite/icf_safe_test.sh: New file.
5873 * testsuite/icf_safe_test.cc: New file.
5875 2009-10-12 Sriraman Tallam <tmsriram@google.com>
5877 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5878 includes to gc.h and icf.h.
5879 * arm.cc: Include gc.h.
5880 * gold.cc: Likewise.
5881 * i386.cc: Likewise.
5882 * powerpc.cc: Likewise.
5883 * sparc.cc: Likewise.
5884 * x86_64.cc: Likewise.
5885 * gc.h: Include icf.h.
5887 2009-10-11 Ian Lance Taylor <iant@google.com>
5889 * plugin.cc: Include "gold.h" before other header files.
5891 2009-10-10 Chris Demetriou <cgd@google.com>
5893 * options.h (Input_file_argument::Input_file_type): New enum.
5894 (Input_file_argument::is_lib_): Replace with...
5895 (Input_file_argument::type_): New member.
5896 (Input_file_argument::Input_file_argument): Take Input_file_type
5897 'type' rather than boolean 'is_lib' as second argument.
5898 (Input_file_argument::is_lib): Use type_.
5899 (Input_file_argument::is_searched_file): New function.
5900 (Input_file_argument::may_need_search): Handle is_searched_file.
5901 * options.cc (General_options::parse_library): Support -l:filename.
5902 (General_options::parse_just_symbols): Update for Input_file_argument
5904 (Command_line::process): Likewise.
5905 * archive.cc (Archive::get_file_and_offset): Likewise.
5906 * plugin.cc (Plugin_manager::release_input_file): Likewise.
5907 * script.cc (read_script_file, script_add_file): Likewise.
5908 * fileread.cc (Input_file::Input_file): Likewise.
5909 (Input_file::will_search_for): Handle is_searched_file.
5910 (Input_file::open): Likewise.
5911 * readsyms.cc (Read_symbols::get_name): Likewise.
5912 * testsuite/Makefile.am (searched_file_test): New test.
5913 * testsuite/Makefile.in: Regenerate.
5914 * testsuite/searched_file_test.cc: New file.
5915 * testsuite/searched_file_test_lib.cc: New file.
5917 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5918 Ian Lance Taylor <iant@google.com>
5920 * descriptor.cc: Include <cstdio> and "binary-io.h".
5921 (Descriptors::open): Open the files in binary mode always.
5922 * script.cc (Lex::get_token): Treat \r as whitespace.
5924 2009-10-09 Ian Lance Taylor <iant@google.com>
5926 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5928 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5929 Ian Lance Taylor <iant@google.com>
5931 * configure.ac: Check for readv function also.
5932 * fileread.cc (readv): Define if not HAVE_READV.
5933 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5935 * config.in: Regenerate.
5936 * configure: Regenerate.
5938 2009-10-09 Doug Kwan <dougkwan@google.com>
5940 * layout.cc (Layout::make_output_section): Call target hook to make
5941 ordinary output section.
5942 (Layout::finalize): Adjust parameter list of call the
5943 Target::may_relax().
5944 * layout.h (class Layout::section_list): New method.
5945 * merge.h (Output_merge_base::entsize): Change visibility to public.
5946 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5948 (Output_merge_string::do_is_string): New method.
5949 * object.cc (Sized_relobj::do_setup): renamed from
5950 Sized_relobj::set_up.
5951 * object.h (Sized_relobj::adjust_shndx,
5952 Sized_relobj::initializ_input_to_output_maps,
5953 Sized_relobj::free_input_to_output_maps): Change visibilities to
5955 (Sized_relobj::setup): Virtualize.
5956 (Sized_relobj::do_setup): New method declaration.
5957 (Sized_relobj::invalidate_section_offset,
5958 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5959 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5960 * options.cc (parse_int): New function.
5961 * options.h (parse_int): New declaration.
5962 (DEFINE_int): New macro.
5963 (stub_group_size): New option.
5964 * output.cc (Output_section::Output_section): Initialize memebers
5965 merge_section_map_, merge_section_by_properties_map_,
5966 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5967 (Output_section::add_input_section): Handled deferred code-fill
5968 generation and remove an old comment.
5969 (Output_section::add_relaxed_input_section): New method definition.
5970 (Output_section::add_merge_input_section): Use merge section by
5971 properties map to speed to search. Update merge section maps
5973 (Output_section::build_relaxation_map): New method definition.
5974 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5976 (Output_section::relax_input_section): Renamed to
5977 Output_section::convert_input_sections_to_relaxed_sections and change
5978 interface to take a vector of pointers to relaxed sections.
5979 (Output_section::find_merge_section,
5980 Output_section::find_relaxed_input_section): New method definitions.
5981 (Output_section::is_input_address_mapped,
5982 Output_section::output_offset, Output_section::output_address):
5983 Use output section data maps to speed up searching.
5984 (Output_section::find_starting_output_address): Add comments.
5985 (Output_section::do_write,
5986 Output_section::write_to_postprocessing_buffer): Do code-fill
5987 generation as appropriate.
5988 (Output_section::get_input_sections): Invalidate relaxed input section
5990 (Output_section::restore_states): Adjust type of checkpoint .
5991 Invalidate relaxed input section map.
5992 * output.h (Output_merge_base): New class declaration.
5993 (Input_section_specifier): New class defintion.
5994 (class Output_relaxed_input_section) Change base class to
5995 Output_section_data_build.
5996 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5997 base class initializer.
5998 (Output_section::add_relaxed_input_section): New method declaration.
5999 (Output_section::Input_section): Change visibility to protected.
6000 (Output_section::Input_section::relobj,
6001 Output_section::Input_section::shndx): Handle relaxed input sections.
6002 Output_section::input_sections) Change visibility to protected. Also
6003 define overload to return a non-const pointer.
6004 (Output_section::Merge_section_properties): New class defintion.
6005 (Output_section::Merge_section_by_properties_map,
6006 Output_section::Output_section_data_by_input_section_map,
6007 Output_section::Relaxation_map): New types.
6008 (Output_section::relax_input_section): Rename method to
6009 Output_section::convert_input_sections_to_relaxed_sections and change
6010 interface to take a vector of relaxed section pointers.
6011 (Output_section::find_merge_section,
6012 Output_section::find_relaxed_input_section,
6013 Output_section::build_relaxation_map,
6014 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6015 New method declarations.
6016 (Output_section::merge_section_map_
6017 Output_section::merge_section_by_properties_map_,
6018 Output_section::relaxed_input_section_map_,
6019 Output_section::is_relaxed_input_section_map_valid_,
6020 Output_section::generate_code_fills_at_write_): New data members.
6021 * script-sections.cc
6022 (Output_section_element_input::set_section_addresses): Call
6023 current_data_size and addralign methods of relaxed input sections.
6024 (Orphan_output_section::set_section_addresses): Call current_data_size
6025 and addralign methods of relaxed input sections.
6026 * symtab.cc (Symbol_table::compute_final_value): Extract template
6027 from the body of Symbol_table::sized_finalize_symbol.
6028 (Symbol_table::sized_finalized_symbol): Call
6029 Symbol_table::compute_final_value.
6030 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6031 (Symbol_table::compute_final_value): New templated method declaration.
6032 * target.cc (Target::do_make_output_section): New method defintion.
6033 * target.h (Target::make_output_section): New method declaration.
6034 (Target::relax): Add more parameters for input objects, symbol table
6035 and layout. Adjust call to do_relax.
6036 (Target::do_make_output_section): New method declaration.
6037 (Target::do_relax): Add parameters for input objects, symbol table
6040 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6042 * pread.c: Include stdio.h.
6044 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6046 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6049 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6051 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6052 Change read_shndx type to unsigned int.
6053 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6055 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6056 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6057 Change read_shndx type to unsigned int.
6058 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6060 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6061 * layout.cc (Layout::create_symtab_sections): Cast the result of
6062 local_symcount * symsize to off_t in the gold_assert.
6064 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6066 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6067 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6069 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6070 (Arm_relocate_functions::thm_abs5): New function.
6071 (Arm_relocate_functions::abs12): New function.
6072 (Arm_relocate_functions::abs16): New function.
6073 (Arm_relocate_functions::base_abs): New function.
6074 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6075 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6076 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6078 (Scan::global): Likewise.
6079 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6080 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6081 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6082 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6085 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6087 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6088 (Arm_relocate_functions::movt_prel): New function.
6089 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6090 (Arm_relocate_functions::thm_movt_prel): New function.
6091 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6092 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6093 (Scan::global, Relocate::relocate): Likewise.
6094 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6096 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6098 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6099 Incremental_checker.
6100 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6102 (class Incremental_inputs_header): New class.
6103 (Incremental_inputs_header_writer): Edit comment.
6104 (Incremental_inputs_entry): New class.
6105 (Incremental_inputs_entry_writer): Edit comment.
6106 (Sized_incremental_binary::do_find_incremental_inputs_section):
6107 Add *strtab_shndx parameter, fill it.
6108 (Sized_incremental_binary::do_check_inputs): New method.
6109 (Incremental_checker::can_incrementally_link_output_file): Use
6110 Sized_incremental_binary::check_inputs.
6111 (Incremental_inputs::report_command_line): Save command line in
6114 (Incremental_binary::find_incremental_inputs_section): New
6116 (Incremental_binary::do_find_incremental_inputs_section): Add
6117 strtab_shndx parameter.
6118 (Incremental_binary::do_check_inputs): New pure virtual method.
6119 (Sized_incremental_binary::do_check_inputs): Declare.
6120 (Incremental_checker::Incremental_checker): Add incremental_inputs
6121 parameter, use it to initialize incremental_inputs_.
6122 (Incremental_checker::incremental_inputs_): New field.
6123 (Incremental_checker::command_line): New method.
6124 (Incremental_checker::inputs): New method.
6125 (Incremental_checker::command_line_): New field.
6127 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6129 * incremental.cc: Include <cstdarg> and "target-select.h".
6130 (vexplain_no_incremental): New function.
6131 (explain_no_incremental): New function.
6132 (Incremental_binary::error): New method.
6133 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6135 (make_sized_incremental_binary): New function.
6136 (open_incremental_binary): New function.
6137 (can_incrementally_link_file): Add checks if output is ELF and has
6139 * incremental.h: Include "elfcpp_file.h" and "output.h".
6140 (Incremental_binary): New class.
6141 (Sized_incremental_binary): New class.
6142 (open_incremental_binary): Declare.
6143 * object.cc (is_elf_object): Use
6144 elfcpp::Elf_recognizer::is_elf_file.
6145 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6146 * output.h (Output_file::filesize): New method.
6148 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6150 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6152 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6153 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6155 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6157 (Arm_relocate_functions::movw_abs_nc): New function.
6158 (Arm_relocate_functions::movt_abs): New function.
6159 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6160 (Arm_relocate_functions::thm_movt_abs): New function.
6161 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6162 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6163 (Scan::global): Likewise.
6164 (Relocate::relocate): Likewise.
6165 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6167 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6169 * arm.cc (Arm_relocate_functions::got_prel) New function.
6170 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6171 (Relocate::relocate): Likewise.
6172 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6174 2009-10-06 Ian Lance Taylor <iant@google.com>
6176 * options.h (class General_options): Define
6177 split_stack_adjust_size parameter.
6178 * object.h (class Object): Add uses_split_stack_ and
6179 has_no_split_stack_ fields. Add uses_split_stack and
6180 has_no_split_stack accessor functions. Declare
6181 handle_split_stack_section.
6182 (class Reloc_symbol_changes): Define.
6183 (class Sized_relobj): Define Function_offsets. Declare
6184 split_stack_adjust, split_stack_adjust_reltype, and
6186 * object.cc (Object::handle_split_stack_section): New function.
6187 (Sized_relobj::do_layout): Call handle_split_stack_section.
6188 * dynobj.cc (Sized_dynobj::do_layout): Call
6189 handle_split_stack_section.
6190 * reloc.cc (Sized_relobj::relocate_sections): Call
6191 split_stack_adjust for executable sections in split_stack
6192 objects. Pass reloc_map to relocate_section.
6193 (Sized_relobj::split_stack_adjust): New function.
6194 (Sized_relobj::split_stack_adjust_reltype): New function.
6195 (Sized_relobj::find_functions): New function.
6196 * target-reloc.h: Include "object.h".
6197 (relocate_section): Add reloc_symbol_changes parameter. Change
6199 * target.h (class Target): Add calls_non_split method. Declare
6200 do_calls_non_split virtual method. Declare match_view and
6202 * target.cc: Include "elfcpp.h".
6203 (Target::do_calls_non_split): New function.
6204 (Target::match_view): New function.
6205 (Target::set_view_to_nop): New function.
6206 * gold.cc (queue_middle_tasks): Give an error if mixing
6207 split-stack and non-split-stack objects with -r.
6208 * i386.cc (Target_i386::relocate_section): Add
6209 reloc_symbol_changes parameter.
6210 (Target_i386::do_calls_non_split): New function.
6211 * x86_64.cc (Target_x86_64::relocate_section): Add
6212 reloc_symbol_changes parameter.
6213 (Target_x86_64::do_calls_non_split): New function.
6214 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6216 * powerpc.cc (Target_powerpc::relocate_section): Add
6217 reloc_symbol_changes parameter.
6218 * sparc.cc (Target_sparc::relocate_section): Add
6219 reloc_symbol_changes parameter.
6220 * configure.ac: Call AM_CONDITIONAL for the default target.
6221 * configure: Rebuild.
6222 * testsuite/Makefile.am (TEST_AS): New variable.
6223 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6224 (check_DATA): Add split_i386 and split_x86_64 files.
6225 (SPLIT_DEFSYMS): Define.
6226 (split_i386_[1234n].o): New targets.
6227 (split_i386_[124]): New targets.
6228 (split_i386_[1234r].stdout): New targets.
6229 (split_x86_64_[1234n].o): New targets.
6230 (split_x86_64_[124]): New targets.
6231 (split_x86_64_[1234r].stdout): New targets.
6232 (MOSTLYCLEANFILES): Add new executables.
6233 * testsuite/split_i386.sh: New file.
6234 * testsuite/split_x86_64.sh: New file.
6235 * testsuite/split_i386_1.s: New file.
6236 * testsuite/split_i386_2.s: New file.
6237 * testsuite/split_i386_3.s: New file.
6238 * testsuite/split_i386_4.s: New file.
6239 * testsuite/split_i386_n.s: New file.
6240 * testsuite/split_x86_64_1.s: New file.
6241 * testsuite/split_x86_64_2.s: New file.
6242 * testsuite/split_x86_64_3.s: New file.
6243 * testsuite/split_x86_64_4.s: New file.
6244 * testsuite/split_x86_64_n.s: New file.
6245 * testsuite/testfile.cc (Target_test): Update relocation_section
6247 * testsuite/Makefile.in: Rebuild.
6249 2009-10-06 Ian Lance Taylor <iant@google.com>
6251 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6252 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6253 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6254 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6255 the address on ldo_addrs_.
6256 (Target_i386::Relocate::fix_up_ldo): New function.
6258 2009-10-06 Rafael Espindola <espindola@google.com>
6260 * plugin.cc (add_input_library): New.
6261 (Plugin::load): Add add_input_library to tv.
6262 (Plugin_manager::add_input_file): Add the is_lib argument.
6263 (add_input_file): Update call to Plugin_manager::add_input_file.
6264 (add_input_library): New.
6265 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6267 2009-09-30 Doug Kwan <dougkwan@google.com>
6269 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6270 symbol and call Symbol::may_need_copy_reloc to determine if
6271 a copy reloc is needed.
6272 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6273 nocopyreloc is given in command line.
6274 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6275 given in command line.
6276 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6277 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6278 of the removed Target_i386::may_need_copy_reloc.
6279 * options.h (copyreloc): New option with default value false.
6280 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6281 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6282 instead of the removed Target_powerpc::may_need_copy_reloc.
6283 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6284 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6285 instead of the removed Target_sparc::may_need_copy_reloc.
6286 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6287 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6288 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6289 instead of the removed Target_x86_64::may_need_copy_reloc.
6291 2009-09-30 Ian Lance Taylor <iant@google.com>
6293 * object.h (class Object): Remove target_ field, and target,
6294 sized_target, and set_target methods.
6295 (Object::sized_target): Remove.
6296 (class Sized_relobj): Update declarations. Remove sized_target.
6297 * object.cc (Sized_relobj::setup): Remove target parameter.
6299 (Input_objects::add_object): Don't do anything with the target.
6300 (make_elf_sized_object): Add punconfigured parameter. Change all
6301 callers. Set or test parameter target.
6302 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6304 * parameters.cc (Parameters::set_target): Change parameter type to
6306 (Parameters::default_target): Remove.
6307 (set_parameters_target): Change parameter type to be non-const.
6308 (parameters_force_valid_target): New function.
6309 (parameters_clear_target): New function.
6310 * parameters.h (class Parameters): Update declarations. Remove
6311 default_target method. Add sized_target and clear_target
6312 methods. Change target_ to be non-const.
6313 (set_parameters_target): Update declaration.
6314 (parameters_force_valid_target): Declare.
6315 (parameters_clear_target): Declare.
6316 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6317 as NULL if we aren't searching.
6318 (Add_symbols::run): Don't check for compatible target.
6319 * fileread.cc (Input_file::open_binary): Call
6320 parameters_force_valid_target.
6321 * gold.cc (queue_middle_tasks): Likewise.
6322 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6323 set_target on object.
6324 * dynobj.h (class Sized_dynobj): Update declarations.
6325 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6326 make_elf_object returns NULL.
6327 (Archive::include_member): Don't check whether object target is
6329 * output.cc (Output_section::add_input_section): Get target from
6331 (Output_section::relax_input_section): Likewise.
6332 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6334 (Sized_relobj::do_scan_relocs): Likewise.
6335 (Sized_relobj::relocate_sections): Likewise.
6336 * resolve.cc (Symbol_table::resolve): Likewise.
6337 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6338 parameter. Change all callers.
6339 (Symbol_table::add_from_object): Get target from parameters.
6340 (Symbol_table::add_from_relobj): Don't check object target.
6341 (Symbol_table::add_from_dynobj): Likewise.
6342 (Symbol_table::define_special_symbol): Get target from
6344 * symtab.h (class Symbol_table): Update declaration.
6345 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6346 parameter. Change all callers. Clear parameter target.
6347 (Binary_test): Test target here.
6348 * testsuite/object_unittest.cc (gold_testsuite): Remove
6349 target_test_pointer parameter. Change all callers.
6350 (Object_test): Test target here.
6352 2009-09-26 Ian Lance Taylor <iant@google.com>
6354 * testsuite/initpri1.c: Don't try to use constructor priorities if
6355 compiling with gcc before 4.3.
6357 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6359 * testsuite/retain_symbols_file_test.sh (check_present): Change
6360 output file name to retain_symbols_file_test.stdout.
6361 (check_absent): Likewise.
6363 2009-09-18 Craig Silverstein <csilvers@google.com>
6365 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6366 * options.cc: Include <cerrno> and <fstream>.
6367 (General_options::finalize): Parse -retain-symbols-file tag.
6368 * options.h: New flag.
6369 (General_options): New method should_retain_symbol, new
6370 variable symbols_to_retain.
6371 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6372 should_retain_symbol map.
6373 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6374 * testsuite/Makefile.in: Regenerate.
6375 * testsuite/retain_symbols_file_test.sh: New file.
6377 2009-09-18 Nick Clifton <nickc@redhat.com>
6379 * po/es.po: Updated Spanish translation.
6381 2009-09-17 Doug Kwan <dougkwan@google.com>
6383 * debug.h (DEBUG_RELAXATION): New constant.
6384 (DEBUG_ALL): Add DEBUG_RELAXATION.
6385 (debug_string_to_enum): Add relaxation debug option.
6387 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6388 Layout::Relaxation_debug_check::read_sections,
6389 Layout::Relaxation_debug_check::read_sections): New method definitions.
6390 (Layout::Layout): Initialize data members
6391 record_output_section_data_from_scrips_,
6392 script_output_section_data_list_ and relaxation_debug_check_.
6393 (Layout::save_segments, Layout::restore_segments,
6394 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6395 Layout::relaxation_loop_body): New method definitions.
6396 (Layout::finalize): Support relaxation. Move section layout code to
6397 Layout::relaxation_loop_body.
6398 (Layout::set_asection_address_from_script): Move code for orphan
6399 section placement out.
6400 (Layout::place_orphan_sections_in_script): New method definition.
6401 * layout.h (Output_segment_headers, Output_file_header):
6402 New forward class declarations.
6403 (Layout::~Layout): Define.
6404 (Layout::new_output_section_data_from_script): New method definition.
6405 (Layout::place_orphan_sections_in_script): New method declaration.
6406 (Layout::Segment_states): New type declaration.
6407 (Layout::save_segments, Layout::restore_segments,
6408 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6409 Layout::relaxation_loop_body): New method declarations.
6410 (Layout::Output_section_data_list): New type declaration.
6411 (Layout::Relaxation_debug_check): New class definition.
6412 (Layout::record_output_section_data_from_script_,
6413 Layout::script_output_section_data_list_, Layout::segment_states_,
6414 Layout::relaxation_debug_check_): New data members.
6415 * output.cc: (Output_section_headers::do_size): New method definition.
6416 (Output_section_headers::Output_section_headers): Move size
6417 computation to Output_section_headers::do_size.
6418 (Output_segment_headers::do_size): New method definition.
6419 (Output_file_header::Output_file_header): Move size computation to
6420 Output_file_header::do_size and call it.
6421 (Output_file_header::do_size): New method definition.
6422 (Output_data_group::Output_data_group): Adjust call to
6423 Output_section_data.
6424 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6425 (Output_symtab_xindex::do_write): Add array bound check.
6426 (Output_section::Input_section::print_to_mapfile): Handle
6427 RELAXED_INPUT_SECTION_CODE.
6428 (Output_section::Output_section): Initialize data member checkpoint_.
6429 (Output_section::~Output_section): Delete checkpoint object pointed
6431 (Output_section::add_input_section): Always add an Input_section if
6433 (Output_section::add_merge_input_section): Add assert.
6434 (Output_section::relax_input_section): New method definition.
6435 (Output_section::set_final_data_size): Set load address to zero for
6436 an unallocated section.
6437 (Output_section::do_address_and_file_offset_have_reset_values):
6438 New method definition.
6439 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6440 Handle relaxed input section.
6441 (Output_section::sort_attached_input_sections): Checkpoint input
6442 section list lazily.
6443 (Output_section::get_input_sections): Change type of input_sections to
6444 list of Simple_input_section pointers. Checkpoint input section list
6445 lazily. Also handle relaxed input sections.
6446 (Output_section::add_input_section_for_script): Take a reference to
6447 a Simple_input_section object instead of Relobj pointer and section
6448 index as parameter. Handle relaxed input sections.
6449 (Output_section::save_states, Output_section::restore_states): New
6451 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6452 (Output_data::is_data_size_fixed): New method definition.
6453 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6455 (Output_data::address_and_file_offset_have_reset_values): New method
6457 (Output_data::do_address_and_file_offset_have_reset_values): New method
6459 (Output_data::set_data_size): Check that data size is not fixed.
6460 (Output_data::fix_data_size): New method definition.
6461 (Output_data::is_data_size_fixed_): New data member.
6462 (Output_section_headers::set_final_data_size): New method definition.
6463 (Output_section_headers::do_size): New method declaration.
6464 (Output_segment_headers::set_final_data_size): New method definition.
6465 (Output_segment_headers::do_size): New method declaration.
6466 (Output_file_header::set_final_data_size)::New method definition.
6467 (Output_file_header::do_size)::New method declaration.
6468 (Output_section_data::Output_section_data): Add new parameter
6469 is_data_size_fixed and use it to fix data size.
6470 (Output_data_const::Output_data_const): Adjust call to base class
6471 constructor and fix data size.
6472 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6473 base class constructor and fix data size.
6474 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6475 base class constructor and fix data size.
6476 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6477 class constructor and fix data size.
6478 (Output_data_group::set_final_data_size): New method definition.
6479 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6480 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6481 class constructor and fix data size.
6482 (Output_relaxed_input_section): New class definition.
6483 (Output_section::Simple_input_section): New class definition.
6484 (Output_section::get_input_sections): Adjust parameter list.
6485 (Output_section::add_input_section_for_script): Same.
6486 (Output_section::save_states, Output_section::restore_states,
6487 Output_section::do_address_and_file_offset_have_reset_values,
6488 (Output_section::Input_section::Input_section): Handle
6489 RELAXED_INPUT_SECTION_CODE. Add new overload for
6490 Output_relaxed_input_section.
6491 (Output_section::Input_section::is_input_section,
6492 Output_section::Input_section::set_output_section): Handle relaxed
6494 (Output_section::Input_section::is_relaxed_input_section,
6495 Output_section::Input_section::output_section_data,
6496 Output_section::Input_section::relaxed_input_section): New method
6498 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6500 (Output_section::Input_section::u1_): Update comments.
6501 (Output_section::Input_section::u2_): Add new union member poris.
6502 (Output_section::Checkpoint_output_section): New classs definition.
6503 (Output_section::relax_input_section): New method declaration.
6504 (Output_section::checkpoint_): New data member.
6505 (Output_segment): Update comments.
6506 (Output_segment::Output_segment): Un-privatize copy constructor.
6507 (Output_segment::operator=): Un-privatize.
6508 * script-sections.cc (Output_section_element::Input_section_list):
6509 Change element type to Output_section::Simple_input_section.
6510 (Output_section_element_dot_assignment::set_section_addresses):
6511 Register output section data for relaxation clean up.
6512 (Output_data_exression::Output_data_expression): Adjust call to base
6513 constructor to fix data size.
6514 (Output_section_element_data::set_section_addresses): Register
6515 Output_data_expression object for relaxation clean up.
6516 (struct Input_section_info): Replace Relobj pointer and section index
6517 pair with Output_section::Simple_input_section and Convert struct to a
6519 (Input_section_sorter::operator()): Adjust access to
6520 Input_section_info data member to use accessors.
6521 (Output_section_element_input::set_section_addresses): Use layout
6522 parameter. Adjust code to use Output_section::Simple_input_section
6523 and Input_secction_info classes. Register filler for relaxation
6525 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6526 and section index pair with Output_section::Simple_input_section
6527 class. Adjust code accordingly.
6528 (Phdrs_element::release_segment): New method definition.
6529 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6531 (Script_sections::release_segments): New method definition.
6532 * gold/script-sections.h (Script_sections::release_segments): New
6534 * gold/target.h (Target::may_relax, Target::relax,
6535 Target::do_may_relax, Target::do_relax): New method definitions.
6537 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6539 * arm.cc (has_signed_unsigned_overflow): New function.
6540 (Arm_relocate_functions::abs8): New function.
6541 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6542 (Target_arm::Scan::global): Likewise.
6543 (Target_arm::relocate::relocate): Likewise.
6544 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6547 2009-09-16 Cary Coutant <ccoutant@google.com>
6549 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6550 * testsuite/Makefile.in: Regenerate.
6552 2009-09-11 Nick Clifton <nickc@redhat.com>
6554 * po/gold.pot: Updated by the Translation project.
6556 2009-09-08 Cary Coutant <ccoutant@google.com>
6558 * output.cc (Output_file::open): Add execute permission to empty file.
6559 * testsuite/Makefile.am (permission_test): New test.
6560 * testsuite/Makefile.in: Regenerate.
6562 2009-09-02 Ian Lance Taylor <iant@google.com>
6564 * output.cc (Output_file::resize): Call map_no_anonymous rather
6567 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
6569 * gold.cc: Include "incremental.h".
6570 (queue_initial_tasks): Call Incremental_checker methods.
6571 * incremental.cc: Include "output.h".
6572 (Incremental_checker::can_incrementally_link_output_file): New
6574 * incremental.h (Incremental_checker): New class.
6576 * output.cc (Output_file::open_for_modification): New method.
6577 (Output_file::map_anonymous): Changed return type to bool. Record
6579 (Output_file::map_no_anonymous): New method, broken out of map.
6580 (Output_file::map): Use map_no_anonymous and map_anonymous.
6581 * output.h (class Output_file): Update declarations.
6583 2009-08-24 Cary Coutant <ccoutant@google.com>
6585 * options.h (Command_line::Pre_options): New class.
6586 (Command_line::pre_options): New member.
6587 * options.cc (gold::options::ready_to_register): New variable.
6588 (One_option::register_option): Do nothing if not registering options.
6589 Assert if same short option registered twice.
6590 (General_options::General_options): Turn off option registration when
6592 (Command_line::Pre_options::Pre_options): New constructor.
6594 2009-08-24 Cary Coutant <ccoutant@google.com>
6596 * options.h (General_options::no_keep_memory): Remove incorrect
6599 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6601 * Makefile.am (am__skiplex, am__skipyacc): New.
6602 * Makefile.in: Regenerate.
6604 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6606 * Makefile.am (AM_CPPFLAGS): Renamed from ...
6607 (INCLUDES): ... this.
6608 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6609 (AM_CPPFLAGS): Renamed from ...
6610 (INCLUDE): ... this.
6611 * Makefile.in, testsuite/Makefile.in: Regenerate.
6613 * Makefile.in: Regenerate.
6614 * aclocal.m4: Likewise.
6615 * config.in: Likewise.
6616 * configure: Likewise.
6617 * testsuite/Makefile.in: Likewise.
6619 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6620 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6621 * Makefile.in: Regenerate.
6622 * testsuite/Makefile.in: Regenerate.
6624 2009-08-19 Cary Coutant <ccoutant@google.com>
6626 * resolve.cc (Symbol_table::resolve): Don't complain about defined
6627 symbols in shared libraries overridden by hidden or internal symbols
6628 in the main program.
6630 2009-08-19 Chris Demetriou <cgd@google.com>
6632 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6633 checking source file names in error messages.
6635 2009-08-18 Doug Kwan <dougkwan@google.com>
6637 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6638 an elcpp::Ehdr as parameter. Adjust call to set_target.
6639 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6640 an elfcpp::Ehdr as parameter.
6641 * object.cc (Object::set_target): Remove the version that looks up
6642 a target and sets it.
6643 (Sized_relobj::setup): Take a Target object instead of
6644 an elfcpp::Ehdr as parameter. Adjust call to set_target.
6645 (make_elf_sized_object): Find target and ask target to
6647 * object.h: (Object::set_target): Remove the version that looks up
6648 a target and sets it.
6649 (Sized_relobj::setup): Take a Target object instead of
6650 an elfcpp:Ehdr as parameter.
6651 * target.cc: Include dynobj.h.
6652 (Target::do_make_elf_object_implementation): New.
6653 (Target::do_make_elf_object): New.
6654 * target.h (Target::make_elf_object): New template declaration.
6655 (Target::do_make_elf_object): New method declarations.
6656 (Target::do_make_elf_object_implementation): New template declaration.
6658 2009-08-14 Ian Lance Taylor <iant@google.com>
6660 * gold.h (FUNCTION_NAME): Define.
6661 (gold_unreachable): Use FUNCTION_NAME.
6663 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6665 * icf.cc (Icf::find_identical_sections): Issue a warning when a
6666 symbol in the --keep-unique list is not found.
6668 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6670 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6671 been maked as --keep-unique.
6672 (Icf::unfold_section): New function.
6673 * icf.h (Icf::unfold_section): New function.
6674 * options.h (General_options::keep_unique): New option.
6675 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6676 * testsuite/Makefile.in: Regenerate.
6677 * testsuite/icf_keep_unique_test.sh: New file.
6678 * testsuite/icf_keep_unique_test.cc: New file.
6680 2009-08-12 Cary Coutant <ccoutant@google.com>
6683 * resolve.cc (Symbol_table::resolve): Check for references from
6684 dynamic objects to hidden and internal symbols.
6685 * testsuite/Makefile.am (hidden_test.sh): New test.
6686 * testsuite/Makefile.in: Regenerate.
6687 * testsuite/hidden_test.sh: New script.
6688 * testsuite/hidden_test_1.c: New test source.
6689 * testsuite/hidden_test_main.c: New test source.
6691 2009-08-11 Doug Kwan <dougkwan@google.com>
6693 * arm.cc: Update comments.
6694 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6695 segment to locate the .ARM.exidx section if present.
6697 2009-08-09 Doug Kwan <dougkwan@google.com>
6699 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6702 2009-08-07 Sriraman Tallam <tmsriram@google.com>
6703 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6706 2009-08-06 Sriraman Tallam <tmsriram@google.com>
6708 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6709 valid tls_segment only for non-debug-section relocations.
6710 * testsuite/Makefile.am: Add gc_tls_test.
6711 * testsuite/Makefile.in: Regenerate.
6712 * testsuite/gc_tls_test.cc: New file.
6713 * testsuite/gc_tls_test.sh: New file.
6715 2009-08-05 Sriraman Tallam <tmsriram@google.com>
6719 * Makefile.am (CCFILES): Add icf.cc.
6721 * Makefile.in: Regenerate.
6722 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6723 * gc.h (gc_process_relocs): Populate lists used by icf to contain
6724 section, symbol and addend information for the relocs.
6725 * gold.cc (queue_middle_tasks): Call identical code folding.
6726 * gold.h: Add defines for multimap.
6727 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6728 to the call of finalize_local_symbols.
6729 * main.cc (main): Create object of class Icf.
6730 * object.cc (Sized_relobj::do_layout): Allow this function to be
6731 called twice during icf.
6732 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6733 to sections marked as identical by icf.
6734 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6736 (Sized_relobj::do_section_entsize): New function.
6737 * object.h (Object::section_entsize): New function.
6738 (Object::do_section_entsize): New pure virtual function.
6739 (Relobj::finalize_local_symbols): Add new parameter.
6740 (Relobj::do_section_entsize): New function.
6741 * options.h (General_options::icf): New option.
6742 (General_options::icf_iterations): New option.
6743 (General_options::print_icf_sections): New option.
6744 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6745 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6746 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6748 * symtab.cc (Symbol_table::is_section_folded): New function.
6749 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6750 to sections marked as identical by icf.
6751 * symtab.h (Symbol_table::set_icf): New function.
6752 (Symbol_table::icf): New function.
6753 (Symbol_table::is_section_folded): New function.
6754 (Symbol_table::icf_): New data member.
6755 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6756 * testsuite/Makefile.am: Add commands to build icf_test.
6757 * testsuite/Makefile.in: Regenerate.
6758 * testsuite/icf_test.sh: New file.
6759 * testsuite/icf_test.cc: New file.
6761 2009-07-24 Chris Demetriou <cgd@google.com>
6763 * layout.cc (is_compressible_debug_section): Fix incorrect
6764 comment about compressed section names.
6766 2009-07-20 Ian Lance Taylor <ian@airs.com>
6769 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6771 2009-07-16 Ian Lance Taylor <iant@google.com>
6774 * layout.h: #include <map>.
6775 (class Kept_section): Change from struct to class. Add accessors
6776 and setters. Add section size to Comdat_group mapping. Change
6777 Comdat_group to std::map. Add is_comdat_ field. Add
6778 linkonce_size field in union.
6779 (class Layout): Update declaration of find_or_add_kept_section.
6780 Don't declare find_kept_object.
6781 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6782 parameter. Add object, shndx, is_comdat, and is_group_name
6783 parameters. Change all callers. Adjust for new Kept_section.
6784 (Layout::find_kept_object): Remove.
6785 * object.cc (Sized_relobj::include_section_group): Update use of
6786 Kept_section. Rename secnum to shndx. Only record
6787 Kept_comdat_section if sections are the same size.
6788 (Sized_relobj::include_linkonce_section): Update use of
6789 Kept_section. Only record Kept_comdat_section if sections are the
6790 same size. Set size of linkonce section.
6791 (Sized_relobj::map_to_kept_section): Update call to
6792 get_kept_comdat_section.
6793 * object.h (class Sized_relobj): Rename fields in
6794 Kept_comdat_section to drop trailing underscores; change object
6795 field to Relobj*. Change Kept_comdat_section_table to store
6796 struct rather than pointer.
6797 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6798 Add kept_object and kept_shndx parameters. Change all callers.
6799 (Sized_relobj::get_kept_comdat_section): Change return type to
6800 bool. Add kept_object and kept_shndx parameters. Change all
6802 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6803 Layout::find_or_add_kept_section.
6805 2009-07-09 Ian Lance Taylor <iant@google.com>
6807 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6808 Reserve space in the hash table.
6810 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
6812 * fileread.cc (File_read::get_mtime): New method.
6813 * fileread.h (Timespec): New structure.
6814 (File_read::get_mtime): New method.
6815 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6816 Renamed from timestamp_nsec.
6817 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6819 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6821 (Incremental_inputs::report_archive): Save mtime; style fix.
6822 (Incremental_inputs::report_obejct): Save mtime; style fix.
6823 (Incremental_inputs::report_script): Save mtime; style fix.
6824 (Incremental_inputs::finalize_inputs): Style fix.
6825 (Incremental_inputs::finalize): Style fix.
6826 (Incremental_inputs::create_input_section_data): Store inputs
6828 * incremental.h (Incremental_inputs::report_script): Add mtime
6830 (Incremental_inputs::Input_info::Input_info): Intialize only one
6832 (Incremental_inputs::Input_info::archive): Move to nameless
6834 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6835 (Incremental_inputs::Input_info::script): Move to nameless union.
6836 (Incremental_inputs::mtime): New field.
6837 * script.cc (read_input_script): Pass file mtime to
6839 * script.h (Script_info::inputs): Style fix.
6841 2009-07-01 Ian Lance Taylor <ian@airs.com>
6843 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6846 2009-06-24 Ian Lance Taylor <iant@google.com>
6849 * layout.cc (Layout::choose_output_section): If we find an
6850 existing section, update the flags.
6851 (Layout::create_notes): New function, broken out of
6853 (Layout::finalize): Don't create note sections.
6854 (Layout::create_note): Don't crash if linker script discards
6856 (Layout::create_gold_note): Likewise.
6857 (Layout::create_build_id): Likewise. Don't set
6858 after_input_sections on the section.
6859 (Layout::create_executable_stack_info): Remove target parameter.
6861 * layout.h (class Layout): Declare create_notes. Update
6862 declaration of create_executable_stack_info.
6863 * gold.cc (queue_middle_tasks): Call create_notes.
6864 * output.cc (Output_section::update_flags_for_input_section): Move
6865 here from output.h. If SHF_ALLOC flag is newly set, mark address
6867 * output.h (Output_data::mark_address_invalid): New function.
6868 (class Output_section): Only declare, not define,
6869 update_flags_for_input_section. Remove set_flags.
6871 2009-06-24 Ian Lance Taylor <iant@google.com>
6873 * script-sections.cc (Output_section_definition::
6874 set_section_addresses): Rename shadowing local load_address to
6877 2009-06-24 Ian Lance Taylor <iant@google.com>
6880 * reloc.cc (relocate_sections): Skip empty relocation sections.
6882 2009-06-23 Ian Lance Taylor <iant@google.com>
6885 * layout.cc (Layout::create_note): Use choose_output_section
6886 rather than make_output_section.
6888 2009-06-23 Ian Lance Taylor <iant@google.com>
6891 * options.cc (General_options::parse_V): Set printed_version_.
6892 (General_options::General_options): Initialize printed_version_.
6893 * options.h (class General_options): Add printed_version_ field.
6894 * gold.cc (queue_initial_tasks): If there are no input files,
6895 don't give a fatal error if we printed the version information.
6896 (queue_middle_tasks): If using -r with a shared object, give a
6897 fatal error rather than an ordinary error.
6899 2009-06-23 Ian Lance Taylor <iant@google.com>
6902 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6903 (Layout::make_output_section): Set have_stabstr_section_ if we see
6904 a .stab*str section.
6905 (Layout::finalize): Call link_stabs_sections.
6906 (Layout::link_stabs_sections): New file.
6907 * layout.h (class Layout): Add have_stabstr_section_ field.
6908 Declare link_stabs_sections.
6910 2009-06-23 Doug Kwan <dougkwan@google.com>
6912 * Makefile.am (libgold_a_LIBADD): New.
6913 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6914 * Makefile.in: Regenerate.
6915 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6916 * configure: Regenerate.
6917 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6918 * fileread.cc: Include sys/state.h
6919 * gold.h: Declare memmem and strndup if found missing.
6920 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6922 2009-06-23 Ian Lance Taylor <iant@google.com>
6924 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6925 * configure: Rebuild.
6927 2009-06-23 Ian Lance Taylor <iant@google.com>
6930 * object.cc (Object::section_contents): Don't try to get a view if
6931 the section has length zero.
6932 (Object::handle_gnu_warning_section): If the section is empty, use
6933 the name of the section as the warning.
6935 2009-06-23 Ian Lance Taylor <iant@google.com>
6938 * stringpool.h (class Stringpool_template): Add optimize_ field.
6939 (Stringpool_template::set_optimize): New function.
6940 * stringpool.cc (Stringpool_template::Stringpool_template):
6941 Initialize optimize_ field.
6942 (Stringpool_template::set_string_offsets): Test local optimize
6943 fild rather than parameter.
6944 * layout.cc (Layout::Layout): Call set_optimize on the section
6947 2009-06-22 Ian Lance Taylor <iant@google.com>
6950 * yyscript.y: Parse TARGET.
6951 * script.cc (script_set_target): New function.
6952 * script-c.h (script_set_target): Declare.
6953 * options.cc (General_options::string_to_object_format): Rename
6954 from string_to_object_format in anonymous namespace. Change
6956 * options.h (class General_options): Declare
6957 string_to_object_format.
6959 2009-06-22 Ian Lance Taylor <iant@google.com>
6961 * script-sections.cc (Script_sections::create_segments): Don't put
6962 program headers in a PT_LOAD segment if -n or -N.
6964 2009-06-22 Ian Lance Taylor <iant@google.com>
6967 * options.h (class General_options): Add -z lazy and -z now. Sort
6968 -z options into alphabetical order.
6969 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6971 2009-06-21 Ian Lance Taylor <iant@google.com>
6973 * layout.cc (Layout::make_output_section): Call
6974 Target::new_output_section.
6975 (Layout::attach_allocated_section_to_segment): Put large section
6976 sections in a separate load segment with the large segment flag
6978 (Layout::segment_precedes): Sort large data segments after other
6980 (align_file_offset): New static function.
6981 (Layout::set_segment_offsets): Use align_file_offset.
6982 * output.h (class Output_section): Add is_small_section_ and
6983 is_large_section_ fields.
6984 (Output_section::is_small_section): New function.
6985 (Output_section::set_is_small_section): New function.
6986 (Output_section::is_large_section): New function.
6987 (Output_section::set_is_large_section): New function.
6988 (Output_section::is_large_data_section): New function.
6989 (class Output_segment): Add is_large_data_segment_ field.
6990 (Output_segment::is_large_data_segment): New function.
6991 (Output_segment::set_is_large_data_segment): New function.
6992 * output.cc (Output_section::Output_section): Initialize new
6994 (Output_segment::Output_segment): Likewise.
6995 (Output_segment::add_output_section): Add assertion that large
6996 data sections always go in large data segments. Force small data
6997 sections to the end of the list of data sections. Force small BSS
6998 sections to the start of the list of BSS sections. For large BSS
6999 sections to the end of the list of BSS sections.
7000 * symtab.h (class Symbol): Declare is_common_shndx.
7001 (Symbol::is_defined): Check Symbol::is_common_shndx.
7002 (Symbol::is_common): Likewise.
7003 (class Symbol_table): Define enum Commons_section_type. Update
7004 declarations. Add small_commons_ and large_commons_ fields.
7005 * symtab.cc (Symbol::is_common_shndx): New function.
7006 (Symbol_table::Symbol_table): Initialize new fields.
7007 (Symbol_table::add_from_object): Put small and large common
7008 symbols in the right list.
7009 (Symbol_table::sized_finalized_symbol): Check
7010 Symbol::is_common_shndx.
7011 (Symbol_table::sized_write_globals): Likewise.
7012 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7013 common symbol lists. Don't call do_allocate_commons_list if the
7015 (Symbol_table::do_allocate_commons_list): Remove is_tls
7016 parameter. Add comons_section_type parameter. Change all
7017 callers. Handle small and large common symbols.
7018 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7019 Symbol::is_common_shndx.
7020 * resolve.cc (symbol_to_bits): Likewise.
7021 * target.h (Target::small_common_shndx): New function.
7022 (Target::small_common_section_flags): New function.
7023 (Target::large_common_shndx): New function.
7024 (Target::large_common_section_flags): New function.
7025 (Target::new_output_section): New function.
7026 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7027 small_common_section_flags, and large_common_section_flags
7029 (Target::do_new_output_section): New virtual function.
7030 * arm.cc (Target_arm::arm_info): Initialize new fields.
7031 * i386.cc (Target_i386::i386_info): Likewise.
7032 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7034 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7035 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7036 (Target_x86_64::do_new_output_section): New function.
7037 * configure.ac: Define conditional MCMODEL_MEDIUM.
7038 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7039 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7040 (large_LDFLAGS): Define.
7041 * testsuite/large.c: New file.
7042 * testsuite/testfile.cc (Target_test::test_target_info):
7043 Initialize new fields.
7044 * configure, testsuite/Makefile.in: Rebuild.
7046 2009-06-05 Doug Kwan <dougkwan@google.com>
7048 * Makefile.am (CCFILES): Add target.cc.
7049 * Makefile.in: Regenerate.
7050 * i386.cc (class Target_i386): Define new virtual method to
7051 override do_is_local_label_name in parent.
7052 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7053 local symbols if --discard-locals or -X is given.
7054 * options.h (class General_options): Declare new options
7055 '--discard-locals' and '-X' for discarding locals.
7056 * target.h (class Target): Define new methods is_local_label_name.
7057 Declare new virtual method do_is_local_label_name.
7058 * target.cc: New file.
7059 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7060 (check_SCRIPTS): Add discard_locals_test.sh.
7061 (check_DATA): Add discard_local_tests.syms.
7062 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7063 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7064 * testsuite/Makefile.in: Regenerate.
7065 * testsuite/discard_locals_test.c: New file.
7066 * testsuite/discard_locals_test.sh: Same.
7068 2009-06-05 Doug Kwan <dougkwan@google.com>
7070 * object.cc (Sized_relobj::Sized_relobj): Initialize
7071 discarded_eh_frame_shndx_ to -1U.
7072 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7074 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7075 a discarded .eh_frame section.
7076 (Sized_relobj::do_finalize_local_symbols): Ditto.
7077 * object.h (class Sized_relobj): Declare new member
7078 discarded_eh_frame_shndx_.
7079 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7080 (local_labels_test.o, local_labels_test): New rules.
7081 * testsuite/Makefile.in: Regenerate.
7083 2009-06-04 Doug Kwan <dougkwan@google.com>
7085 * layout.cc (Layout::section_name_mapping): Add mapping for
7086 special ARM sections.
7088 2009-06-03 Doug Kwan <dougkwan@google.com>
7090 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7091 (utils::has_overflow): Same.
7093 2009-06-03 Ian Lance Taylor <iant@google.com>
7095 * layout.cc (Layout::section_name_mapping): New array, replacing
7096 Layout::linkonce_mapping.
7097 (Layout::section_name_mapping_count): New variable, replacing
7098 Layout::linkonce_mapping_count.
7099 (Layout::linkonce_output_name): Remove.
7100 (Layout::output_section_name): Rewrite.
7101 * layout.h (class Layout): Rename Linkonce_mapping to
7102 Section_name_mapping, linkonce_mapping to section_name_mapping,
7103 linkonce_mapping_count to section_name_mapping_count. Don't
7104 declare linkonce_output_name.
7106 2009-06-03 Doug Kwan <dougkwan@google.com>
7108 * gold/arm.cc (namespace utils): New.
7109 (Target_arm::reloc_is_non_pic): Define new method.
7110 (class Arm_relocate_functions): New.
7111 (Target_arm::Relocate::relocate): Handle relocation types used by
7114 2009-06-03 Ian Lance Taylor <iant@google.com>
7116 * arm.cc (Target_arm::scan::global): Use || instead of |.
7118 2009-06-02 Doug Kwan <dougkwan@google.com>
7120 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7121 issued_non_pic_error_.
7122 (class Target_arm::Scan): Declare new method check_non_pic.
7123 Define new method symbol_needs_plt_entry.
7124 Declare new data member issued_non_pic_error_.
7125 (class Target_arm::Relocate): Declare new method
7126 should_apply_static_reloc.
7127 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7128 (Target_arm::Scan::check_non_pic): Define new method.
7129 (Target_arm::Scan::local): Handle a small subset of reloc types used
7131 (Target_arm::Scan::local): Same.
7132 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7134 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7136 * incremental.cc (Incremental_inputs::report_command_line): Filter
7137 out --incremental-* options.
7139 2009-05-29 Doug Kwan <dougkwan@google.com>
7141 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7143 (class Target_arm): Update comment.
7144 (Target_arm::Target_arm): Initialize new data members GOT_,
7145 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7146 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7147 and Target_arm::rel_dyn_section.
7148 Declare new_enum Target_arm::Got_type.
7149 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7151 Update commments for member do_dynsym_value.
7152 (Target_arm::got_size, Target_arm::plt_section,
7153 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7154 new methods inside class defintion.
7155 (Target_arm::got_section): Define new method.
7156 (Target_arm::rel_dyn_section): Same.
7157 (Output_data_plt_arm): New template class.
7158 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7159 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7160 (Output_data_plt_arm::add_entry): Same.
7161 (Output_data_plt_arm::first_plt_entry): Define new
7162 static data member for PLT instruction template.
7163 (Output_data_plt_arm::plt_entry): Same.
7164 (Output_data_plt_arm::do_write): Define new method.
7165 (Target_arm::make_plt_entry): Same.
7166 (Target_arm::do_finalize_sections): Same.
7167 (Target_arm::do_dynsym_value): Same.
7169 2009-05-28 Doug Kwan <dougkwan@google.com>
7171 * Makefile.am (TARGETSOURCES): Add arm.cc.
7172 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7173 * Makefile.in: Regenerate.
7175 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7177 2009-05-26 Doug Kwan <dougkwan@google.com>
7179 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7180 (General_options::check_excluded_libs): Strip off directories in
7181 archive name before matching like GNU ld does.
7182 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7183 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7184 (exclude_libs_test_LDFLAGS): Add linker option
7185 -Wl,--exclude-libs,libexclude_libs_test_3
7186 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7187 an explicit archive without using -l.
7188 (alt/libexclude_libs_test_3.a): New make rule.
7189 * testsuite/Makefile.in: Regenerate.
7190 * testsuite/exclude_libs_test.c : Declare lib3_default().
7192 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7193 * exclude_libs_test_3.c: New file.
7195 2009-05-26 Nick Clifton <nickc@redhat.com>
7197 * po/id.po: New Indonesian translation.
7198 * po/gold.pot: Updated template file.
7200 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7202 * testsuite/Makefile.am: Add -ffunction-sections to compile
7203 gc_comdat_test files. Add -Wl,--gc-sections to build
7205 * testsuite/Makefile.in: Regenerate.
7206 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7208 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7210 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7211 kept comdat section was garbage collected.
7212 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7213 * testsuite/Makefile.in: Regenerate.
7214 * testsuite/gc_comdat_test.sh: New file.
7215 * testsuite/gc_comdat_test_1.cc: New file.
7216 * testsuite/gc_comdat_test_2.cc: New file.
7218 2009-05-19 Doug Kwan <dougkwan@google.com>
7220 * archive.cc (Archive::Archive): Move constructor from archive.h
7221 to here. Initialize no_export_.
7222 (Archive::get_elf_object_for_member): Set no_export flag of object.
7223 * archive.h (Archive::Archive): Move constructor body to
7225 (Archive::no_export): New method.
7226 (Archive::no_export_): New field.
7227 * object.h (Object::Object): Initialize no_export_ to false.
7228 (Object::no_export, Object::set_no_export): New methods.
7229 (Object::no_export_): New field.
7230 * options.cc (General_options::parse_exclude_libs): New method.
7231 (General_options::check_excluded_libs) Same.
7232 * options.h (exclude_libs): New option.
7233 (General_options::check_excluded_libs): New method declaration.
7234 (General_options::excluded_libs_): New field.
7235 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7236 default or protected visibility if an object has no-export flag set.
7237 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7238 (check_SCRIPTS): Add exclude_libs_test.sh.
7239 (check_DATA): Add exclude_libs_test.syms.
7240 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7241 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7242 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7243 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7244 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7245 libexclude_libs_test_2.a): New rules.
7246 * testsuite/Makefile.in: Regenerate.
7247 * testsuite/exclude_libs_test.c: New file.
7248 * testsuite/exclude_libs_test.sh: Ditto.
7249 * testsuite/exclude_libs_test_1.c: Ditto.
7250 * testsuite/exclude_libs_test_2.c: Ditto.
7252 2009-05-15 Ian Lance Taylor <iant@google.com>
7254 * configure.ac: Check for declarations for cases where libiberty.h
7255 checks HAVE_DECL_xxx.
7256 * configure, config.in: Rebuild.
7258 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7260 * gold.h (Incremental_argument_list): Remove (invalid) forward
7262 * incremental.cc (Incremental_inputs::report_achive): New method.
7263 (Incremental_inputs::report_object): New method.
7264 (Incremental_inputs::report_script): New method.
7265 (Incremental_inputs::finalize_inputs): New method.
7266 (Incremental_inputs::finalize): Call finalize_inputs().
7267 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7268 Create inputs entries.
7269 * incremental.h (Incremental_input_type): New enum.
7270 (Incremental_inputs::Incremental_input): Initialize new fields.
7271 (Incremental_inputs::report_inputs): New method.
7272 (Incremental_inputs::report_achive): New method.
7273 (Incremental_inputs::report_object): New method.
7274 (Incremental_inputs::report_script): New method.
7275 (Incremental_inputs::finalize_inputs): New method.
7276 (Incremental_inputs::Input_info): New struct.
7277 (Incremental_inputs::Input_info_map): New typedef.
7278 (Incremental_inputs::lock_): New field.
7279 (Incremental_inputs::Inputs_): New field.
7280 (Incremental_inputs::Inputs_map): New field.
7281 * main.cc (main): Call Incremental_input::report_inputs.
7282 * options.h (Input_argument_list): Typedef moved from
7284 (Input_file_group::Files): Remove, use ::Input_argument_list.
7285 (Input_file_group::Input_argument_list): Remove, use
7286 ::Input_argument_list.
7287 * plugin.cc (Plugin_manager::add_input_file): Add error in
7289 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7291 * script.cc (read_input_script): Call
7292 Incremental_input::report_script.
7293 * script.h (Script_info): New class.
7295 2009-04-27 Ian Lance Taylor <iant@google.com>
7297 * x86_64.cc (do_adjust_output_section): Set entsize to
7300 2009-04-23 Elliott Hughes <enh@google.com>
7302 * output.cc (Output_file::close): After short writes, continue
7303 writing from the correct offset in the buffer being written.
7305 2009-04-23 Chris Demetriou <cgd@google.com>
7307 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7308 * configure: Regenerate.
7309 * config.in: Regenerate.
7310 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7311 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7313 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7315 * incremental.cc (Incremental_inputs_header_data): Renamed from
7316 Incremental_input_header_data.
7317 (Incremental_inputs_header_data::data_size): New field.
7318 (Incremental_inputs_header_data::put_input_file_count): Renamed
7319 from input_file_count.
7320 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7321 from command_line_offset.
7322 (Incremental_inputs_header_data::put_reserved): Renamed from
7324 (Incremental_inputs_entry_data): Renamed from
7325 Incremental_input_entry_data.
7326 (Incremental_inputs_entry_data::data_size): New field.
7327 (Incremental_inputs::report_command_line): New method.
7328 (Incremental_inputs::finalize): New method.
7329 (Incremental_inputs::create_incremental_inputs_data): New method.
7330 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7331 * incremental.h: New file.
7332 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7333 (Layout::finalize): Create incremental inputs section in
7335 (Layout::create_incremental_info_sections): New method.
7336 * layout.h (Layout::incremental_inputs): New method.
7337 (Layout::create_incremental_info_sections): New method.
7338 (Layout::incremental_inputs_): New field.
7339 * main.cc (main): Notify Incremental_input of the command line.
7341 2009-04-01 Ian Lance Taylor <iant@google.com>
7342 Mikolaj Zalewski <mikolajz@google.com>
7344 * gold.h (reserve_unordered_map): Define, three versions, one for
7345 each version of Unordered_map.
7346 * layout.cc (Layout::Layout): Remove options parameter. Add
7347 number_of_input_files parameter. Don't initialize options_.
7348 Initialize number_of_input_files_ and resized_signatures_. Move
7349 sections_are_attached_.
7350 (Layout::layout_group): Reserve space for group_signatures_.
7351 (Layout::find_or_add_kept_section): Change name parameter to be a
7352 reference. Resize signatures_ map when it gets large enough.
7353 (Layout::layout_eh_frame): Use parameters->options() instead of
7355 (Layout::make_output_section): Likewise.
7356 (Layout::attach_allocated_section_to_segment): Likewise.
7357 (Layout::finalize, Layout::create_executable_stack): Likewise.
7358 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7359 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7360 * layout.h (class Layout): Update declarations. Remove options_
7361 field. Add number_of_input_files_ and resized_signatures_
7362 fields. Move sections_are_attached_ field.
7363 * main.cc (main): Pass number of input files to Layout
7364 constructor. Don't pass options.
7366 2009-03-30 Ian Lance Taylor <iant@google.com>
7368 * ffsll.c (ffsll): Correct implementation.
7370 2009-03-27 Ian Lance Taylor <iant@google.com>
7372 * ffsll.c: New file.
7373 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7374 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7375 * ftruncate.c (ftruncate): Declare before definition.
7376 * mremap.c (mremap): Likewise.
7377 * pread.c (pread): Likewise.
7378 * configure, Makefile.in, config.in: Rebuild.
7380 * mremap.c: New file.
7381 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7382 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7383 (mremap): Declare if HAVE_MREMAP is not defined.
7384 * configure, Makefile.in, config.in: Rebuild.
7386 2009-03-27 Cary Coutant <ccoutant@google.com>
7388 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7389 position independent.
7390 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7391 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7393 2009-03-24 Cary Coutant <ccoutant@google.com>
7395 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7397 (needs_dynamic_reloc): Likewise.
7399 2009-03-24 Ian Lance Taylor <iant@google.com>
7401 * yyscript.y (file_cmd): Recognize EXTERN.
7402 (extern_name_list, extern_name_list_body): New nonterminals.
7403 * script.cc (script_add_extern): Define.
7404 * script-c.h (script_add_extern): Declare.
7406 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
7408 * object.cc (is_elf_object): Define.
7409 * object.h (is_elf_object): Declare.
7410 * archive.cc (Archive::get_elf_object_for_member): Call
7412 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7414 2009-03-24 Elliott Hughes <enh@google.com>
7416 * output.cc (Output_file::map_anonymous): Define.
7417 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7418 try an anonymous one. Report the size if the mmap fails.
7419 * output.h (class Output_file): Declare map_anonymous.
7421 2009-03-24 Ian Lance Taylor <iant@google.com>
7423 * target-select.cc (instantiate_target): Don't acquire the lock if
7424 the instantiated_target_ field has already been set.
7426 2009-03-23 Ian Lance Taylor <iant@google.com>
7428 * gold-threads.h (class Initialize_lock): Define.
7429 * gold-threads.cc (class Initialize_lock_once): Define.
7430 (initialize_lock_control): New static variable.
7431 (initialize_lock_pointer): New static variable.
7432 (initialize_lock_once): New static function.
7433 (Initialize_lock::Initialize_lock): Define.
7434 (Initialize_lock::initialize): Define.
7435 * target-select.h: Include "gold-threads.h".
7436 (class Target_selector): Add lock_ and initialize_lock_ fields.
7437 Don't define instantiate_target, just declare it.
7438 * target-select.cc (Target_selector::Target_selector): Initialize
7440 (Target_selector::instantiate_target): Define.
7441 * descriptors.h: Include "gold-threads.h".
7442 (class Descriptors): Add initialize_lock_ field.
7443 * descriptors.cc (Descriptors::Descriptors): Initialize new
7445 (Descriptors::open): Use initialize_lock_ field
7446 * errors.h (class Errors): Add initialize_lock_ field.
7447 * errors.cc (Errors::Errors): Initialize new field.
7448 (Errors::initialize_lock): Use initialize_lock_ field.
7449 * powerpc.cc (class Target_selector_powerpc): Remove
7450 instantiated_target_ field. In do_recognize call
7451 instantiate_target rather than do_instantiate_target. In
7452 do_instantiate_target just allocate a new target.
7453 * sparc.cc (class Target_selector_sparc): Likewise.
7455 * freebsd.h: New file.
7456 * i386.cc: Include "freebsd.h".
7457 (Target_i386): Derive from Target_freebsd rather than
7459 (Target_selector_i386): Derive from Target_selector_freebsd rather
7460 than Target_selector.
7461 * x86_64.cc: Include "freebsd.h".
7462 (Target_x86_64): Derive from Target_freebsd rather than
7464 (Target_selector_x86_64): Derive from Target_selector_freebsd
7465 rather than Target_selector.
7466 * target.h (class Target): Add adjust_elf_header and
7467 do_adjust_elf_header.
7468 * output.cc (Output_file_header:: do_sized_write): Call target
7469 adjust_elf_header routine.
7470 * configure.tgt: Set targ_osabi.
7471 * configure.ac: Define GOLD_DEFAULT_OSABI.
7472 * parameters.cc (Parameters::default_target): Pass
7473 GOLD_DEFAULT_OSABI to select_target.
7474 * target-select.h (class Target_selector): Make instantiate_target
7475 protected rather than private.
7476 * Makefile.am (HFILES): Add freebsd.h.
7477 * configure, Makefile.in, config.in: Rebuild.
7479 * merge.cc (do_add_input_section): Correct pend value. Change
7480 message about last entry not being null terminated from error to
7483 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7485 * incremental.cc: New file.
7486 * Makefile.am (CCFILES): Add incremental.cc.
7487 * Makefile.in: Rebuild.
7489 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7491 * layout.cc (Layout::output_section_name): Preserve names
7492 of '.note.' sections.
7494 2009-03-19 Ian Lance Taylor <iant@google.com>
7496 * descriptors.cc (Descriptors::open): Check that the options are
7497 valid before using them.
7499 2009-03-18 Ian Lance Taylor <iant@google.com>
7501 * script-sections.h: Include <list>.
7502 (class Script_sections): Change Sections_elements from std::vector
7503 to std::list. Typedef public Elements_iterator. Add
7504 orphan_section_placement_, data_segment_align_start_, and
7505 saw_data_segment_align_ fields. Remove data_segment_align_index_
7507 * script-sections.cc (class Orphan_section_placement): New class.
7508 (class Sections_element): Add virtual functions is_relro and
7509 orphan_section_init. Remove virtual function place_orphan_here.
7510 (class Output_section_definition): Add is_relro and
7511 orphan_section_init. Remove place_orphan_here.
7512 (class Orphan_output_section): Likewise.
7513 (Script_sections::Script_sections): Update for field changes.
7514 (Script_sections::data_segment_align): Set saw_data_segment_align_
7515 and data_segment_align_start_, not data_segment_align_index.
7516 (Script_sections::data_segment_relro_end): Check
7517 saw_data_segment_align_. Use data_segment_align_start_ rather
7518 than data_segment_align_index_.
7519 (Script_sections::place_orphan): Rewrite to use
7520 Orphan_section_placement.
7522 2009-03-17 Ian Lance Taylor <iant@google.com>
7524 * archive.cc (Archive::add_symbols): Check for a version attached
7525 to the symbol name in the archive map.
7526 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7527 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7528 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7529 (ver_test_11.a): New target.
7530 * testsuite/Makefile.in: Rebuild.
7532 * configure.ac: Check for chsize and posix_fallocate. Replace
7534 * ftruncate.c: New file, from gnulib.
7535 * output.cc (posix_fallocate): Define dummy version if not
7536 HAVE_POSIX_FALLOCATE.
7537 (Output_file::map): Call posix_fallocate rather than lseek and
7539 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7540 * configure, Makefile.in, config.in: Rebuild.
7542 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
7544 * layout.h (Layout::create_note): Add section_name parameter.
7545 * layout.cc (Layout::create_note): Likewise.
7546 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7548 2009-03-17 Ian Lance Taylor <iant@google.com>
7550 * descriptors.cc: Include "options.h".
7551 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7552 (Descriptors::open): Always use O_CLOEXEC when opening a new
7553 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7554 then set FD_CLOEXEC.
7556 * sparc.cc (class Target_sparc): Add has_got_section.
7557 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7558 make sure we have a GOT section.
7560 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7561 (Target_sparc::Scan::local): Likewise.
7562 (Target_sparc::Scan::global): Likewise.
7563 (Target_sparc::Relocate::relocate): Likewise.
7564 (Target_sparc::Relocate::relocate_tls): Likewise.
7566 * symtab.cc (Symbol_table::define_default_version): New function,
7567 broken out of add_from_object.
7568 (Symbol_table::add_from_object): Call define_default_version.
7569 (Symbol_table::define_special_symbol): Add resolve_oldsym
7570 parameter. Change all callers. If the version for a symbol comes
7571 from a version script, resolve it with the symbol with the same
7572 name with no version. Also add the symbol without a version if
7574 (do_define_in_output_data): If resolving with oldsym, don't delete
7576 (do_define_in_output_segment): Likewise.
7577 (do_define_as_constant): Likewise.
7578 * symtab.h (class Symbol_table): Update declarations.
7580 2009-03-13 Ian Lance Taylor <iant@google.com>
7582 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7583 (Read_symbols::requeue): New function.
7584 (Read_symbols::do_read_symbols): If make_elf_object fails because
7585 the target type is not configured, and the file was searched for,
7586 issue a warning and retry with the next directory.
7587 (Add_symbols::run): If the file has an incompatible format, and
7588 it was searched for, requeue the Read_symbols task. On error,
7590 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
7591 dirindex parameter to constructor. Change all callers. Declare
7592 incompatible_warning and requeue.
7593 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7594 input_argument_ and input_group_ fields. Add them to
7595 constructor. Change all callers.
7596 (class Read_script): Add dirindex_ field. Add it to constructor.
7598 * archive.cc (Archive::setup): Remove input_objects parameter.
7600 (Archive::get_file_and_offset): Likewise.
7601 (Archive::read_all_symbols): Likewise.
7602 (Archive::read_symbols): Likewise.
7603 (Archive::get_elf_object_for_member): Remove input_objects
7604 parameter. Add punconfigured parameter. Change all callers.
7605 (Archive::add_symbols): Change return type to bool. Check return
7606 value of include_member.
7607 (Archive::include_all_members): Likewise.
7608 (Archive::include_member): Change return type to bool. Return
7609 false if first included object has incompatible target. Set
7610 included_member_ field.
7611 (Add_archive_symbols::run): If add_symbols returns false, requeue
7613 * archive.h (class Archive): Add included_member_ field.
7614 Initialize it in constructor. Add input_file and searched_for
7615 methods. Update declarations.
7616 (class Add_archive_symbols): Add dirpath_, dirindex_, and
7617 input_argument_ fields. Add them to constructor. Change all
7619 * script.cc: Include "target-select.h".
7620 (class Parser_closure): Add skip_on_incompatible_target_ and
7621 found_incompatible_target_ fields. Add
7622 skip_on_incompatible_target parameter to constructor. Change all
7623 callers. Add methods skip_on_incompatible_target,
7624 clear_skip_on_incompatible_target, found_incompatible_target, and
7625 set_found_incompatible_target.
7626 (read_input_script): Add dirindex parameter. Change all callers.
7627 If parser finds an incompatible target, requeue Read_symbols
7629 (script_set_symbol): Clear skip_on_incompatible_target in
7631 (script_add_assertion, script_parse_option): Likewise.
7632 (script_start_sections, script_add_phdr): Likewise.
7633 (script_check_output_format): New function.
7634 * script.h (read_input_script): Update declaration.
7635 * script-c.h (script_check_output_format): Declare.
7636 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7637 (ignore_cmd): Remove OUTPUT_FORMAT.
7638 * fileread.cc (Input_file::Input_file): Add explicit this.
7639 (Input_file::will_search_for): New function.
7640 (Input_file::open): Add pindex parameter. Change all callers.
7641 * fileread.h (class Input_file): Add input_file_argument method.
7642 Declare will_search_for. Update declarations.
7643 * object.cc (make_elf_object): Add punconfigured parameter.
7645 * object.h (class Object): Make input_file public. Add
7646 searched_for method.
7647 (make_elf_object): Update declaration.
7648 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
7650 * dirsearch.h (class Dirsearch): Update declaration.
7651 * options.h (class General_options): Add --warn-search-mismatch.
7652 * parameters.cc (Parameters::is_compatible_target): New function.
7653 * parameters.h (class Parameters): Declare is_compatible_target.
7654 * workqueue.cc (Workqueue::add_blocker): New function.
7655 * workqueue.h (class Workqueue): Declare add_blocker.
7657 * fileread.cc (Input_file::open): Remove options parameter.
7659 (Input_file::open_binary): Likewise.
7660 * script.cc (read_input_script): Likewise.
7661 * readsyms.h (class Read_symbols): Remove options_ field. Remove
7662 options parameter from constructor. Change all callers.
7663 (class Read_script): Likewise.
7664 * fileread.h (class Input_file): Update declarations.
7665 * script.h (read_input_script): Update declaration.
7667 2009-03-10 Nick Clifton <nickc@redhat.com>
7669 * po/es.po: New Spanish translation.
7671 2009-03-06 Cary Coutant <ccoutant@google.com>
7673 * options.cc (parse_short_option): Keep dash_z from registering itself.
7675 2009-03-03 Ian Lance Taylor <iant@google.com>
7678 * target-reloc.h (relocate_section): Pass output_section to
7680 * i386.cc (Target_i386::should_apply_static_reloc): Add
7681 output_section parameter. Change all callers.
7682 (Target_i386::Relocate::relocate): Add output_section parameter.
7683 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7684 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7685 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7686 * testsuite/two_file_shared.sh: New script.
7687 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7688 (check_DATA): Add two_file_shared.dbg.
7689 (two_file_shared.dbg): New target.
7690 * testsuite/Makefile.in: Rebuild.
7692 2009-03-01 Ian Lance Taylor <iant@google.com>
7694 * configure.ac: Check for byteswap.h.
7695 * configure: Rebuild.
7696 * config.in: Rebuild.
7698 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
7700 * layout.cc (Layout::find_or_add_kept_section): New function.
7701 (Layout::add_comdat): Removed.
7702 * layout.h (struct Kept_section): Move out of class Layout.
7703 Remove trailing underscores from field names. Add group_sections
7704 field. Rename group_ field to is_group. Change all uses.
7705 (class Layout): Declare find_or_add_kept_section, not add_comdat.
7706 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7707 comdat_groups_ field.
7708 (Sized_relobj::include_section_group): Use
7709 find_or_add_kept_section and Kept_section::group_sections.
7710 (Sized_relobj::include_linkonce_section): Likewise.
7711 * object.cc (class Sized_relobj): Don't define Comdat_group or
7712 Comdat_group_table. Remove find_comdat_group and
7713 add_comdat_group. Remove comdat_groups_ field.
7714 * plugin.cc (include_comdat_group): Use
7715 Layout::find_or_add_kept_section.
7717 2009-02-28 Ian Lance Taylor <iant@google.com>
7719 * README: --gc-sections and map files are now supported. Document
7720 some build requirements.
7723 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7724 relocatable link set the value of the section symbol to zero.
7725 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7726 relocatable link don't include the section address in the local
7729 2009-02-27 Ian Lance Taylor <iant@google.com>
7732 * options.h (class Search_directory): Add is_system_directory.
7733 (class General_options): Declare is_in_system_directory.
7734 * options.cc (get_relative_sysroot): Make static.
7735 (get_default_sysroot): Make static.
7736 (General_optoins::is_in_system_directory): New function.
7737 * fileread.cc (Input_file::is_in_system_directory): New function.
7738 * fileread.h (class Input_file): Declare is_in_system_directory.
7739 * object.h (class Object): Add is_in_system_directory.
7740 (class Input_objects): Remove system_library_directory_ field.
7741 * object.cc (Input_objects::add_object): Don't set
7742 system_library_directory_.
7743 (input_objects::found_in_system_library_directory): Remove.
7744 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7745 parameter. Change all callers.
7746 (Symbol_table::sized_write_globals): Likewise.
7747 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7748 Call Object::is_in_system_directory.
7749 * symtab.h (class Symbol_table): Update declarations.
7752 * descriptors.h (Open_descriptor): Add is_on_stack field.
7753 * descriptors.cc (Descriptors::open): If the descriptor is on the
7754 top of the stack, remove it. Initialize is_on_stack field.
7755 (Descriptors::release): Only add pod to stack if it is not on the
7757 (Descriptors::close_some_descriptor): Clear stack_next and
7761 * output.cc (Output_section::find_starting_output_address): Rename
7762 from starting_output_address; add PADDR parameter; change return
7764 * output.h (class Output_section): Declare
7765 find_starting_output_address instead of starting_output_address.
7766 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7767 section symbol for which we can't find a merge section.
7770 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7771 hidden or internal, force the symbol to be local.
7772 * resolve.cc (Symbol::override_visibility): Define.
7773 (Symbol::override_base): Use override_visibility.
7774 (Symbol_table::resolve): Likewise.
7775 (Symbol::override_base_with_special): Likewise.
7776 (Symbol_table::override_with_special): If the visibility is hidden
7777 or internal, force the symbol to be local.
7778 * symtab.h (class Symbol): Add set_visibility and
7779 override_visibility.
7780 * testsuite/ver_test_1.sh: New file.
7781 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7782 (check_DATA): Add ver_test_1.syms.
7783 (ver_test_1.syms): New target.
7784 * testsuite/Makefile.in: Rebuild.
7786 2009-02-25 Cary Coutant <ccoutant@google.com>
7788 * layout.cc (Layout::choose_output_section): Don't rename sections
7789 when using a linker script that has a SECTIONS clause.
7790 * Makefile.in: Regenerate.
7792 * testsuite/Makefile.am (script_test_5.sh): New test case.
7793 * testsuite/Makefile.in: Regenerate.
7794 * testsuite/script_test_5.cc: New file.
7795 * testsuite/script_test_5.sh: New file.
7796 * testsuite/script_test_5.t: New file.
7798 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
7800 * archive.cc (Archive::include_member): Update calls to add_symbols.
7801 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7802 the Layout argument.
7803 * dynobj.h (do_add_symbols): Add the Layout argument.
7804 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7806 * object.h (Object::add_symbols): Add the Layout argument.
7807 (Object::do_add_symbols): Add the Layout argument.
7808 (Sized_relobj::do_add_symbols): Add the Layout argument.
7809 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7810 Unify the two versions.
7811 (Add_plugin_symbols): Remove.
7812 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7813 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7814 (Add_plugin_symbols): Remove.
7815 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7816 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7817 (Add_symbols::run): Make it work with Pulginobj.
7819 2009-02-06 Ian Lance Taylor <iant@google.com>
7821 * object.cc (Sized_relobj::do_layout): Make info message start
7822 with lower case letter.
7824 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
7826 * binary.cc: Fix file comment.
7828 * options.h (enum Incremental_disposition): Define.
7829 (class General_options): Add new options: --incremental,
7830 --incremental_changed, --incremental_unchanged,
7831 --incremental_unknown. Add incremental_disposition_ and
7832 implicit_incremental_ fields.
7833 (General_options::incremental_disposition): New function.
7834 (class Position_dependent_options): Add incremental_disposition
7836 (Position_dependent_options::copy_from_options): Set incremental
7838 * options.cc (General_options::parse_incremental_changed): New
7840 (General_options::parse_incremental_unchanged): New function.
7841 (General_options::parse_incremental_unknown): New function.
7842 (General_options::General_options): Initialize new fields
7843 incremental_disposition_ and implicit_incremental_.
7844 (General_options::finalize): Check for uasge of --incremental-*
7845 without --incremental.
7847 2009-02-06 Chris Demetriou <cgd@google.com>
7849 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7850 pointer and to report location as the file name associated with
7852 (gold_undefined_symbol_at_location): New function to replace the
7853 old gold_undefined_symbol functionality.
7854 * target-reloc.h (relocate_section): Update to use
7855 gold_undefined_symbol_at_location.
7856 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7857 Call gold_undefined_symbol function rather than gold_error.
7858 * errors.h (Errors::undefined_symbol): Take location as a
7859 string, rather than calculating it from a relocation.
7860 * errors.cc (Errors::fatal): Print "fatal error:" before the
7862 (Errors::error, Errors::error_at_location): Print "error: "
7863 before the formatted message.
7864 (Errors::undefined_symbol): Take location as a string, rather
7865 than calculating it from a relocation.
7866 (gold_undefined_symbol_at_location): New function akin to
7867 old gold_undefined_symbol, calculates location from relocation.
7868 (gold_undefined_symbol): Change to take only a Symbol pointer
7869 and to report location as the file name associated with the symbol.
7870 * testsuite/debug_msg.sh: Update for changed error messages.
7871 * testsuite/undef_symbol.sh: Likewise.
7873 2009-02-04 Duncan Sands <baldrick@free.fr>
7876 * reduced_debug_output.h
7877 (Output_reduced_debug_abbrev_section::failed): Use format for
7879 (Output_reduced_debug_info_section::faild): Likewise.
7881 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
7883 * script.cc (Lazy_demangler): New class.
7884 (Version_script_info::get_symbol_version_helper): Demangle a
7887 2009-01-29 Cary Coutant <ccoutant@google.com>
7889 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7891 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7893 2009-01-28 Ian Lance Taylor <iant@google.com>
7895 * version.cc (version_string): Bump to 1.9.
7897 * gold.h: Include <cstring> and <stdint.h>.
7898 * version.cc: Include <cstdio>.
7899 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7901 * reduced_debug_output.cc (insert_into_vector): Rename from
7902 Insert_into_vector; change all callers. Use Swap_unaligned to
7903 avoid aliasing issue; remove union since it is unnecessary.
7905 2009-01-27 Sriraman Tallam <tmsriram@google.com>
7907 * Makefile.am (CCFILES): Add gc.cc.
7909 * Makefile.in: Regenerate.
7910 * gold.cc (Gc_runner): New class.
7911 (queue_initial_tasks): Call garbage collection related tasks
7912 when corresponding options are invoked.
7913 (queue_middle_gc_tasks): New function.
7914 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7915 processed early before laying out sections during garbage collection.
7916 * gold.h (queue_middle_gc_tasks): New function.
7917 (is_prefix_of): Move from "layout.cc".
7918 * i386.cc (Target_i386::gc_process_relocs): New function.
7919 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7920 * main.cc (main): Create object of class "Garbage_collection".
7921 * object.cc (Relobj::copy_symbols_data): New function.
7922 (Relobj::is_section_name_included): New function.
7923 (Sized_relobj::do_layout): Allow this function to be called twice
7924 during garbage collection and defer layout of section during the
7926 * object.h (Relobj::get_symbols_data): New function.
7927 (Relobj::is_section_name_included): New function.
7928 (Relobj::copy_symbols_data): New function.
7929 (Relobj::set_symbols_data): New function.
7930 (Relobj::get_relocs_data): New function.
7931 (Relobj::set_relocs_data): New function.
7932 (Relobj::is_output_section_offset_invalid): New pure virtual function.
7933 (Relobj::gc_process_relocs): New function.
7934 (Relobj::do_gc_process_relocs): New pure virtual function.
7935 (Relobj::sd_): New data member.
7936 (Sized_relobj::is_output_section_offset_invalid): New function.
7937 (Sized_relobj::do_gc_process_relocs): New function.
7938 * options.h (General_options::gc_sections): Modify to not be a no-op.
7939 (General_options::print_gc_sections): New option.
7940 * plugin.cc (Plugin_finish::run): Remove function call to
7941 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7942 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7943 * reloc.cc (Read_relocs::run): Add task to process relocs and
7944 determine unreferenced sections when doing garbage collection.
7945 (Gc_process_relocs): New class.
7946 (Sized_relobj::do_gc_process_relocs): New function.
7947 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7948 sections that are garbage collected.
7949 * reloc.h (Gc_process_relocs): New class.
7950 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7951 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7952 symbols whose corresponding sections are garbage collected.
7953 (Symbol_table::Symbol_table): Add new parameter for the garbage
7955 (Symbol_table::gc_mark_undef_symbols): New function.
7956 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7957 (Symbol_table::gc_mark_dyn_syms): New function.
7958 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7960 (Symbol_table::add_from_object): Likewise.
7961 (Symbol_table::add_from_relobj): When building shared objects, do not
7962 treat externally visible symbols as garbage.
7963 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7964 table information for static and relocatable links.
7965 * symtab.h (Symbol_table::set_gc): New function.
7966 (Symbol_table::gc): New function.
7967 (Symbol_table::gc_mark_undef_symbols): New function.
7968 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7969 (Symbol_table::gc_mark_dyn_syms): New function.
7970 (Symbol_table::gc_): New data member.
7971 * target.h (Sized_target::gc_process_relocs): New pure virtual
7973 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7974 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7976 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7978 * options.h (General_options::gc_sections): Define as a no-op for now.
7979 (General_options::no_keep_memory): Ditto.
7980 (General_options::Bshareable): Define.
7981 * options.cc (General_options::finalize): Honor -Bshareable.
7983 2009-01-20 Andreas Schwab <schwab@suse.de>
7985 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7986 read the value in the contents, since we don't use it. Use the
7987 template endianness when writing.
7988 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7990 2009-01-19 Andreas Schwab <schwab@suse.de>
7992 * configure.tgt (powerpc64-*): Fix targ_obj.
7994 2009-01-15 Ian Lance Taylor <iant@google.com>
7996 * object.cc (Sized_relobj::write_local_symbols): Don't write out
7997 local symbols when stripping all symbols.
7999 2009-01-14 Cary Coutant <ccoutant@google.com>
8001 * output.cc (Output_reloc): Add explicit instantiations.
8003 2009-01-14 Cary Coutant <ccoutant@google.com>
8005 * archive.cc (Archive::get_elf_object_for_member): Remove call
8006 to File_read::claim_for_plugin.
8007 * descriptors.cc (Descriptors::open): Remove reference to
8009 (Descriptors::claim_for_plugin): Remove.
8010 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8011 (Descriptors::is_claimed): Remove.
8012 (claim_descriptor_for_plugin): Remove.
8013 * fileread.cc (File_read::claim_for_plugin): Remove.
8014 * fileread.h (File_read::claim_for_plugin): Remove.
8015 (File_read::descriptor): Reopen descriptor if necessary.
8016 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8017 (Plugin_manager::all_symbols_read): Add task parameter. Change
8019 (Plugin_manager::get_input_file): New function.
8020 (Plugin_manager::release_input_file): New function.
8021 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8022 corresponding data member.
8023 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8024 and pass to base constructor. Change all callers.
8025 (get_input_file, release_input_file): New functions.
8026 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8027 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8028 (Plugin_manager::all_symbols_read): Add task parameter.
8029 (Plugin_manager::get_input_file): New function.
8030 (Plugin_manager::release_input_file): New function.
8031 (Plugin_manager::task_): New data member.
8032 (Pluginobj::Pluginobj): Add filesize parameter.
8033 (Pluginobj::filename): New function.
8034 (Pluginobj::descriptor): New function.
8035 (Pluginobj::filesize): New function.
8036 (Pluginobj::filesize_): New data member.
8037 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8038 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8039 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8041 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8042 with archive libraries.
8043 * testsuite/Makefile.in: Regenerate.
8044 * testsuite/plugin_test.c (struct sym_info): New type.
8045 (get_input_file, release_input_file): New static variables.
8046 (onload): Capture new transfer vector entries.
8047 (claim_file_hook): Stop reading at end of file according to filesize.
8048 Factor out parsing of readelf output into separate function.
8049 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8050 APIs and get the source file name from the symbol table. Convert
8051 source file name to corresponding object file name. Print info
8052 message when adding new input files.
8053 (parse_readelf_line): New function.
8054 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8055 * testsuite/plugin_test_2.sh: Likewise.
8056 * testsuite/plugin_test_3.sh: Likewise.
8057 * testsuite/plugin_test_4.sh: New test case.
8059 2009-01-07 Ian Lance Taylor <iant@google.com>
8061 * version.cc (version_string): Bump to 1.8.
8063 2008-12-23 Cary Coutant <ccoutant@google.com>
8065 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8066 * plugin.cc (Plugin_manager::finish): Rename as
8067 layout_deferred_objects. Move cleanup to separate function.
8068 (Plugin_manager::cleanup): New function.
8069 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8071 * plugin.h (Plugin_manager::finish): Rename as
8072 layout_deferred_objects.
8073 (Plugin_manager::cleanup): New function.
8074 (Plugin_manager::cleanup_done): New field.
8076 2008-12-23 Cary Coutant <ccoutant@google.com>
8078 * plugin.cc (is_visible_from_outside): New function.
8079 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8080 so we don't return "IR only" status for exported symbols or -r links.
8082 * testsuite/Makefile.am (plugin_test_3): New test case.
8083 * testsuite/Makefile.in: Regenerate.
8084 * testsuite/plugin_test_3.sh: New file.
8086 2008-12-22 Cary Coutant <ccoutant@google.com>
8088 * object.cc (Sized_relobj::layout_section): New function.
8089 (Sized_relobj::do_layout): Defer layout of input sections until after
8090 plugin has provided replacement files.
8091 (Sized_relobj::do_layout_deferred_sections): New function.
8092 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8093 (Relobj::layout_deferred_sections): New function.
8094 (Relobj::do_layout_deferred_sections): New function.
8095 (Sized_relobj::do_layout_deferred_sections): New function.
8096 (Sized_relobj::layout_section): New function.
8097 (Sized_relobj::Deferred_layout): New structure.
8098 (Sized_relobj::deferred_layout_): New field.
8099 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8100 Change all callers. Layout deferred sections.
8101 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8103 (Plugin_hook::run): Move code from do_plugin_hook inline.
8104 (Plugin_hook::do_plugin_hook): Remove.
8105 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8106 (Plugin_manager::finish): Renamed, was cleanup.
8107 (Plugin_manager::should_defer_layout): New function.
8108 (Plugin_manager::add_deferred_layout_object): New function.
8109 (Plugin_manager::Deferred_layout_list): New type.
8110 (Plugin_manager::deferred_layout_objects_): New field.
8111 (Plugin_hook::do_plugin_hook): Remove.
8113 2008-12-17 Ian Lance Taylor <iant@google.com>
8115 * options.h (class General_options): Add --no case for
8118 2008-12-16 Cary Coutant <ccoutant@google.com>
8120 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8122 (Plugin_manager::claim_file): Create plugin object even if
8123 plugin did not call the add_symbols callback.
8124 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8125 asking for more symbols than were added.
8126 * testsuite/Makefile.am (plugin_test_1): Add test case with
8128 (empty.syms): New target.
8129 * testsuite/Makefile.in: Regenerate.
8130 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8131 message. Don't call add_symbols if no globals.
8132 (all_symbols_read_hook): Don't provide replacement for empty
8135 2008-12-12 Ian Lance Taylor <iant@google.com>
8137 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8138 r_type == 0 for a local symbol with r_sym == 0.
8139 (scan_relocatable_relocs): Pass r_sym to
8140 local_non_section_strategy.
8141 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8144 * configure.ac: Update test for TLS descriptors: they are
8145 supported as of glibc 2.9.
8146 * configure: Rebuild.
8148 2008-12-11 Ian Lance Taylor <iant@google.com>
8151 * target-reloc.h (Default_scan_relocatable_relocs): For each
8152 function, map r_type == 0 to RELOC_DISCARD.
8154 2008-12-10 Cary Coutant <ccoutant@google.com>
8156 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8157 object to override a kept COMDAT group from a plugin object.
8159 2008-12-09 Ian Lance Taylor <iant@google.com>
8162 * yyscript.y (file_cmd): Handle INPUT.
8164 * testsuite/initpri1.c: Change all declarations to be full
8165 prototypes by adding void, to avoid compiler warnings.
8167 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8169 * options.cc (General_options::parse_plugin_opt): New.
8170 (General_options::add_plugin): The argument now is just the filename.
8171 (General_options::add_plugin_option): New.
8172 * options.h (plugin_opt): New.
8173 (add_plugin): Change argument name.
8174 (add_plugin_option): New.
8175 * plugin.cc (Plugin::load): Don't parse the plugin option.
8176 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8177 (Plugin::add_option): New.
8178 (Plugin::args_): Change type.
8179 (Plugin::filename_): New.
8180 (Plugin_manager::add_plugin_option): New.
8181 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8182 * testsuite/Makefile.in: Regenerate.
8184 2008-12-05 Cary Coutant <ccoutant@google.com>
8186 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8187 Handle --strip-lto-sections option.
8188 * options.h (strip_lto_sections): New option.
8190 2008-12-01 Cary Coutant <ccoutant@google.com>
8192 * plugin.cc (ld_plugin_message): Change format parameter to const.
8193 Fix mismatch between new[] and delete.
8195 2008-11-14 Cary Coutant <ccoutant@google.com>
8197 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8200 2008-11-05 Craig Silverstein <csilvers@google.com>
8202 * options.cc (General_options::parse_dynamic_list): New function.
8203 * options.h (General_options): New flags dynamic_list,
8204 dynamic_list_data, dynamic_list_cpp_new, and
8205 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8206 (General_options::in_dynamic_list): New function.
8207 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8208 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8209 (Lex::can_continue_name): Likewise.
8211 (read_script_file): New parameter script_options.
8212 (read_dynamic_list): New function.
8213 (Script_options::define_dynamic_list): New function.
8214 (dynamic_list_keyword_parsecodes): New variable.
8215 (dynamic_list_keywords): New variable.
8216 * script.h (Script_options::define_dynamic_list): New function
8218 (read_dynamic_list): New function prototype.
8219 * symtab.cc (strprefix): New macro.
8220 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8221 dynamic_list_data, dynamic_list_cpp_new, and
8222 dynamic_list_cpp_typeinfo.
8223 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8224 (dynamic_list_expr): New rule.
8225 (dynamic_list_nodes): Likewise.
8226 (dynamic_list_node): Likewise.
8227 * testsuite/Makefile.am (dynamic_list): New test.
8228 * testsuite/Makefile.in: Regenerated.
8229 * testsuite/dynamic_list.t: New file.
8230 * testsuite/dynamic_list.sh: New file.
8232 2008-11-05 Craig Silverstein <csilvers@google.com>
8234 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8235 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8236 (t11_last): Likewise.
8237 * testsuite/ver_test_6.c (main): Likewise.
8239 2008-10-07 Cary Coutant <ccoutant@google.com>
8241 * options.c (General_options::finalize): Add check for -static and
8243 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8246 2008-10-02 Cary Coutant <ccoutant@google.com>
8248 * plugin.cc (make_sized_plugin_object): Fix conditional
8249 compilation to work when not all targets are enabled.
8251 2008-09-29 Cary Coutant <ccoutant@google.com>
8253 * archive.cc (Archive::get_file_and_offset): Use filename instead
8254 of name to get library path.
8255 (Archive::include_member): Unlock external member of a thin archive.
8257 * testsuite/Makefile.am (TEST_AR): New variable.
8258 (thin_archive_test_1): New test.
8259 (thin_archive_test_2): New test.
8260 * testsuite/Makefile.in: Regenerate.
8261 * testsuite/thin_archive_main.cc: New file.
8262 * testsuite/thin_archive_test_1.cc: New file.
8263 * testsuite/thin_archive_test_2.cc: New file.
8264 * testsuite/thin_archive_test_3.cc: New file.
8265 * testsuite/thin_archive_test_4.cc: New file.
8267 2008-09-29 Cary Coutant <ccoutant@google.com>
8269 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8270 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8272 (Sized_relobj::do_finalize_local_symbols): Likewise.
8273 (Sized_relobj::map_to_kept_section): Likewise.
8274 * object.h (Sized_relobj::invalid_address): New constant.
8275 (Sized_relobj::do_output_section_offset): Check for invalid_address
8277 * output.cc (Output_reloc::local_section_offset): Use constant
8278 invalid_address instead of -1U.
8279 (Output_reloc::get_address): Likewise.
8280 (Output_section::output_address): Change -1U to -1ULL.
8281 * output.h (Output_reloc::invalid_address): New constant.
8282 * reloc.cc (Sized_relobj::write_sections): Use constant
8283 invalid_address instead of -1U.
8284 (Sized_relobj::relocate_sections): Likewise.
8285 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8286 values for merge sections.
8287 * target-reloc.h (relocate_for_relocatable): Use constant
8288 invalid_address instead of -1U.
8290 2008-09-19 Cary Coutant <ccoutant@google.com>
8292 Add plugin functionality for link-time optimization (LTO).
8293 * configure.ac (plugins): Add --enable-plugins option.
8294 * configure: Regenerate.
8295 * config.in: Regenerate.
8296 * Makefile.am (LIBDL): New variable.
8297 (CCFILES): Add plugin.cc.
8298 (HFILES): Add plugin.h.
8299 (ldadd_var): Add LIBDL.
8300 * Makefile.in: Regenerate.
8302 * archive.cc: Include "plugin.h".
8303 (Archive::setup): Don't preread archive symbols when using a plugin.
8304 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8305 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8307 (Archive::include_member): Add symbols from plugin objects.
8308 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8309 * descriptors.cc (Descriptors::open): Check for file descriptors
8310 abandoned by plugins.
8311 (Descriptors::claim_for_plugin): New function.
8312 * descriptors.h (Descriptors::claim_for_plugin): New function.
8313 (Open_descriptor::is_claimed): New field.
8314 (claim_descriptor_for_plugin): New function.
8315 * fileread.cc (File_read::claim_for_plugin): New function.
8316 * fileread.h (File_read::claim_for_plugin): New function.
8317 (File_read::descriptor): New function.
8318 * gold.cc: Include "plugin.h".
8319 (queue_initial_tasks): Add task to call plugin hooks for generating
8321 * main.cc: Include "plugin.h".
8322 (main): Load plugin libraries.
8323 * object.h (Pluginobj): Declare.
8324 (Object::pluginobj): New function.
8325 (Object::do_pluginobj): New function.
8326 (Object::set_target): New function.
8327 * options.cc: Include "plugin.h".
8328 (General_options::parse_plugin): New function.
8329 (General_options::General_options): Initialize plugins_ field.
8330 (General_options::add_plugin): New function.
8331 * options.h (Plugin_manager): Declare.
8332 (General_options): Add --plugin option.
8333 (General_options::has_plugins): New function.
8334 (General_options::plugins): New function.
8335 (General_options::add_plugin): New function.
8336 (General_options::plugins_): New field.
8337 * plugin.cc: New file.
8338 * plugin.h: New file.
8339 * readsyms.cc: Include "plugin.h".
8340 (Read_symbols::do_read_symbols): Check for archive before checking
8341 for ELF file. Call plugin hooks to claim files.
8342 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8343 from a real object file; force override when processing replacement
8345 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8346 (Symbol::init_base_object): Likewise.
8347 (Symbol::init_base_output_data): Likewise.
8348 (Symbol::init_base_output_segment): Likewise.
8349 (Symbol::init_base_constant): Likewise.
8350 (Symbol::init_base_undefined): Likewise.
8351 (Symbol::output_section): Assert that object is not a plugin.
8352 (Symbol_table::add_from_pluginobj): New function.
8353 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8355 (Symbol_table::sized_write_globals): Likewise.
8356 (Symbol_table::add_from_pluginobj): Instantiate template.
8357 * symtab.h (Sized_pluginobj): Declare.
8358 (Symbol::in_real_elf): New function.
8359 (Symbol::set_in_real_elf): New function.
8360 (Symbol::in_real_elf_): New field.
8361 (Symbol_table::add_from_pluginobj): New function.
8363 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8364 (LIBDL): New variable.
8366 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8367 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8368 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8369 (MOSTLYCLEANFILES): Likewise.
8370 * testsuite/Makefile.in: Regenerate.
8371 * testsuite/plugin_test.c: New file.
8372 * testsuite/plugin_test_1.sh: New file.
8373 * testsuite/plugin_test_2.sh: New file.
8375 2008-09-16 Ian Lance Taylor <iant@google.com>
8377 * target-reloc.h (relocate_section): Check whether a symbol is
8378 defined by the ABI before reporting an undefined symbol error.
8379 * target.h (Target::is_defined_by_abi): Make parameter const.
8380 (Target::do_is_defined_by_abi): Likewise.
8381 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8382 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8383 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8384 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8385 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8386 * testsuite/Makefile.in: Rebuild.
8388 * fileread.cc (make_view): Add casts to avoid warning.
8390 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8392 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8393 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8395 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8397 * options.h (General_options::output_is_executable): New.
8398 (General_options::output_is_pie): New.
8399 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8400 for shared libraries.
8401 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8403 2008-09-11 Chris Demetriou <cgd@google.com>
8405 * options.h (origin): New -z option.
8406 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8407 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8410 2008-09-05 Cary Coutant <ccoutant@google.com>
8412 * fileread.cc (File_read::make_view): Add check for attempt to map
8415 2008-09-05 Cary Coutant <ccoutant@google.com>
8417 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8418 explicit instantiations.
8420 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8423 * options.cc (General_options::finalize): Allow undefined symbols
8424 in shlibs if linking -shared.
8427 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8428 symbols as not needing a dynsym entry.
8430 2008-08-20 Craig Silverstein <csilvers@google.com>
8432 * fileread.cc (File_read::open): Do not lock the file unless it
8433 was successfully opened.
8435 2008-08-14 Cary Coutant <ccoutant@google.com>
8437 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8438 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8439 * testsuite/tls_test.cc (struct int128): 128-bit struct
8440 for testing TLS relocs with non-zero addend.
8441 (v12): New TLS variable.
8443 (t_last): Add check for v12.
8444 * testsuite/tls_test.h (t12): New function.
8445 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8447 2008-08-13 Ian Lance Taylor <iant@google.com>
8449 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8450 set tls_segment_ or relro_segment_.
8451 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8453 * output.h (Output_section::clear_is_relro): New function.
8454 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8455 sections specially even when output_data_ is empty.
8456 (Output_segment::maximum_alignment): When first section is relro,
8457 only force alignment for PT_LOAD segments.
8458 * script.cc (script_data_segment_align): New function.
8459 (script_data_segment_relro_end): New function.
8460 * script-c.h (script_data_segment_align): Declare.
8461 (script_data_segment_relro_end): Declare.
8462 * script-sections.h (class Script_sections): Declare
8463 data_segment_align and data_segment_relro_end. Add fields
8464 segment_align_index_ and saw_relro_end_.
8465 * script-sections.cc (class Sections_element): Add set_is_relro
8466 virtual function. Add new bool* parameter to place_orphan_here.
8467 Add get_output_section virtual function.
8468 (class Output_section_definition): Add set_is_relro. Add new
8469 bool* parameter to place_orphan_here. Add get_output_section.
8470 Add is_relro_ field.
8471 (Output_section_definition::Output_section_definition): Initialize
8472 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8473 and is_relro_ fields.
8474 (Output_section_definition::place_orphan_here): Add is_relro
8476 (Output_section_definition::set_section_addresses): Set relro for
8478 (Output_section_definition::alternate_constraint): Likewise.
8479 (class Orphan_output_section): Add new bool* parameter to
8480 place_orphan_here. Add get_output_section.
8481 (Orphan_output_section::place_orphan_here): Add is_relro
8483 (Script_sections::Script_sections): Initialize
8484 data_segment_align_index_ and saw_relro_end_.
8485 (Script_sections::data_segment_align): New function.
8486 (Script_sections::data_segment_relro_end): New function.
8487 (Script_sections::place_orphan): Set or clear is_relro.
8488 (Script_sections::set_section_addresses): Force alignment of first
8490 * yyscript.y (exp): Call script_data_segment_align and
8491 script_data_segment_relro_end.
8492 * testsuite/relro_script_test.t: New file.
8493 * testsuite/relro_test.cc (using_script): Declare.
8494 (t1, t2): Test using_script.
8495 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8496 (relro_script_test_SOURCES): Define.
8497 (relro_script_test_DEPENDENCIES): Define.
8498 (relro_script_test_LDFLAGS): Define.
8499 (relro_script_test_LDADD): Define.
8500 (relro_script_test.so): New target.
8501 * testsuite/Makefile.in: Rebuild.
8503 2008-08-06 Cary Coutant <ccoutant@google.com>
8505 * archive.cc (Archive::total_archives, Archive::total_members)
8506 (Archive::total_members_loaded): New variables.
8507 (Archive::setup): Add parameter. Add option to preread
8509 (Archive::read_armap): Add counter.
8510 (Archive::get_file_and_offset): New function.
8511 (Archive::get_elf_object_for_member): New function.
8512 (Archive::read_all_symbols): New function.
8513 (Archive::read_symbols): New function.
8514 (Archive::add_symbols): Add counters.
8515 (Archive::include_all_members): Use armap to find members if it's
8517 (Archive::include_member): Skip reading symbols if already read.
8518 Factored code into Archive::get_file_and_offset and
8519 Archive::get_elf_object_for_member. Changed call to
8520 Mapfile::report_include_archive_member.
8521 (Archive::print_stats): New function.
8522 * archive.h: Declare Object and Read_symbols_data classes.
8523 (Archive::Archive): Add initializers for new members.
8524 (Archive::setup): Add parameter.
8525 (Archive::print_stats): New function.
8526 (Archive::total_archives, Archive::total_members)
8527 (Archive::total_members_loaded): New variables.
8528 (Archive::get_file_and_offset): New function.
8529 (Archive::get_elf_object_for_member): New function.
8530 (Archive::read_all_symbols): New function.
8531 (Archive::read_symbols): New function.
8532 (Archive::Archive_member): New class.
8533 (Archive::members_): New member.
8534 (Archive::num_members_): New member.
8535 * main.cc: Include archive.h.
8536 (main): Call Archive::print_stats.
8537 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8538 archive parameter; member_name is now the fully-decorated name.
8539 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8540 * options.h: (General_options): Add --preread-archive-symbols option.
8541 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8544 2008-08-04 Ian Lance Taylor <iant@google.com>
8546 * symtab.h (Symbol::use_plt_offset): New function.
8547 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8548 * powerpc.cc (Relocate::relocate): Likewise.
8549 * sparc.cc (Relocate::relocate): Likewise.
8550 * x86_64.cc (Relocate::relocate): Likewise.
8551 * testsuite/weak_plt.sh: New test.
8552 * testsuite/weak_plt_main.cc: New test.
8553 * testsuite/weak_plt_shared.cc: New test.
8554 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8555 (check_PROGRAMS): Add weak_plt.
8556 (check_DATA): Add weak_plt_shared.so.
8557 (weak_plt_main_pic.o, weak_plt): New targets.
8558 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8559 * testsuite/Makefile.in: Rebuild.
8561 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8563 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8564 * testsuite/Makefile.in: Rebuild.
8566 2008-08-04 Alan Modra <amodra@bigpond.net.au>
8568 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8569 * Makefile.in: Regenerate.
8570 * po/POTFILES.in: Regenerate.
8572 2008-07-29 Ian Lance Taylor <iant@google.com>
8574 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8575 symbols before other symbols.
8576 * testsuite/script_test_2.cc (test_addr): Declare.
8577 (test_addr_alias): Declare.
8578 (main): Check that test_addr and test_addr_alias have the right
8580 * testsuite/script_test_2.t: Define test_addr_alias and
8583 2008-07-24 Ian Lance Taylor <iant@google.com>
8586 * descriptors.cc: New file.
8587 * descriptors.h: New file.
8588 * gold-threads.h (class Hold_optional_lock): New class.
8589 * fileread.cc: Include "descriptors.h".
8590 (File_read::~File_read): Release descriptor rather than closing
8592 (File_read::open) [file]: Call open_descriptor rather than open.
8593 Set is_descriptor_opened_.
8594 (File_read::open) [memory]: Assert that descriptor is not open.
8595 (File_read::reopen_descriptor): New function.
8596 (File_read::release): Release descriptor.
8597 (File_read::do_read): Make non-const. Reopen descriptor.
8598 (File_read::read): Make non-const.
8599 (File_read::make_view): Reopen descriptor.
8600 (File_read::do_readv): Likewise.
8601 * fileread.h (class File_read): Add is_descriptor_opened_ field.
8602 Update declarations.
8603 * layout.cc: Include "descriptors.h".
8604 (Layout::create_build_id): Use open_descriptor rather than open.
8605 * output.cc: Include "descriptors.h".
8606 (Output_file::open): Use open_descriptor rather than open.
8607 * archive.cc (Archive::const_iterator): Change Archive to be
8609 (Archive::begin, Archive::end): Make non-const.
8610 (Archive::count_members): Likewise.
8611 * archive.h (class Archive): Update declarations.
8612 * object.h (Object::read): Make non-const.
8613 * Makefile.am (CCFILES): Add descriptors.cc.
8614 (HFILES): Add descriptors.h.
8615 * Makefile.in: Rebuild.
8618 * gold.h: Always include <clocale>. Add Solaris workarounds
8619 following code in binutils/sysdep.h.
8622 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8623 this->eh_frame_hdr_ is NULL before using it.
8625 * dynobj.cc (Versions::Versions): Update comment.
8627 * dynobj.cc (Versions::Versions): If there is an soname, use it as
8628 the base version name.
8630 * stringpool.cc (Stringpool_template::add_with_length): Set key to
8631 array size plus one.
8632 (Stringpool_template::set_string_offsets): Subtract one from key
8633 before using it as an array index.
8634 (Stringpool_template::get_offset_with_length): Likewise.
8635 (Stringpool_template::write_to_buffer): Likewise.
8636 * stringpool.h (Stringpool_template::get_offset_from_key):
8639 2008-07-23 Ian Lance Taylor <iant@google.com>
8642 * object.h (Merged_symbol_value::value): Do our best to handle a
8646 * script.cc (Version_script_info::get_versions): Don't add empty
8647 version tag to return value.
8648 (Version_script_info::get_symbol_version_helper): Change return
8649 type to bool. Add pversion parameter. Change all callers.
8650 (script_register_vers_node): Don't require a non-NULL tag.
8651 * script.h (class Version_script_info): Update declarations.
8652 (Version_script_info::get_symbol_version): Change return type to
8653 bool. Add version parameter. Change all callers.
8654 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8655 handling. Handle an empty version from a version script.
8656 (Symbol_table::define_special_symbol): Likewise.
8657 * testsuite/ver_test_10.script: New file.
8658 * testsuite/ver_test_10.sh: New file.
8659 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8660 (check_DATA): Add ver_test_10.syms.
8661 (ver_test_10.syms, ver_test_10.so): New target.
8662 * testsuite/Makefile.in: Rebuild.
8664 2008-07-23 Simon Baldwin <simonb@google.com>
8666 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8667 to zero for undefined symbols from dynamic libraries.
8669 2008-07-23 Ian Lance Taylor <iant@google.com>
8671 * symtab.cc (Symbol_table::resolve): Remove version parameter.
8673 * symtab.h (class Symbol_table): Update declaration.
8674 * testsuite/ver_test_9.cc: New file.
8675 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8676 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8677 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8678 (ver_test_9.so, ver_test_9.o): New targets.
8679 * testsuite/Makefile.in: Rebuild.
8681 2008-07-22 Ian Lance Taylor <iant@google.com>
8683 * options.h (class General_options): Define --check-sections.
8684 * layout.cc (Layout::set_segment_offsets): Handle
8687 * options.h (class General_options): Define -n/--nmagic and
8689 * options.cc (General_options::finalize): For -n/--nmagic or
8690 -N/--omagic, set -static.
8691 * layout.cc (Layout::attach_allocated_section_to_segment): If
8692 -N/--omagic, don't put read-only and read-write sections in
8694 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8695 finding a read-only segment.
8696 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8697 don't set the minimum segment alignment to the common page size,
8698 and don't set the file offset to the address modulo the page size.
8699 * script-sections.cc (Script_sections::create_segments): If
8700 -n/--omagic, don't put read-only and read-write sections in
8703 * cref.cc: New file.
8705 * options.h (class General_options): Add --print-symbol-counts.
8706 * main.cc (main): Issue defined symbol report if requested.
8707 * archive.cc (Archive::interpret_header): Make into a const member
8709 (Archive::add_symbols): Call Input_objects::archive_start and
8711 (Archive::const_iterator): Define new class.
8712 (Archive::begin, Archive::end): New functions.
8713 (Archive::include_all_members): Rewrite to use iterator.
8714 (Archive::count_members): New function.
8715 * archive.h (class Archive): Update declarations.
8716 (Archive::filename): New function.
8717 * object.cc: Include "cref.h".
8718 (Sized_relobj::Sized_relobj): Initialize defined_count_.
8719 (Sized_relobj::do_get_global_symbol_counts): New function.
8720 (Input_objects::add_object): Add object to cross-referencer.
8721 (Input_objects::archive_start): New function.
8722 (Input_objects::archive_stop): New function.
8723 (Input_objects::print_symbol_counts): New function.
8724 * object.h: Declare Cref and Archive.
8725 (Object::get_global_symbol_counts): New function.
8726 (Object::do_get_global_symbol_counts): New pure virtual function.
8727 (class Sized_relobj): Add defined_count_ field. Update
8729 (class Input_objects): Add cref_ field. Update constructor.
8730 Update declarations.
8731 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8733 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8735 (Sized_dynobj::do_get_global_symbol_counts): New function.
8736 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8737 defined_count_. Update declarations. Define Symbols typedef.
8738 * symtab.cc (Symbol_table::add_from_relobj): Add defined
8739 parameter. Change all callers.
8740 (Symbol_table::add_from_dynobj): Add sympointers and defined
8741 parameters. Change all callers.
8742 * symtab.h (class Symbol_table): Update declarations.
8743 * Makefile.am (CCFILES): Add cref.cc.
8744 (HFILES): Add cref.h.
8745 * Makefile.in: Rebuild.
8747 2008-07-22 Simon Baldwin <simonb@google.com>
8749 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8750 to zero when writing undefined symbols.
8752 2008-07-22 Ian Lance Taylor <iant@google.com>
8754 * output.cc (Output_section::add_input_section): Don't try to
8755 merge empty merge sections.
8757 2008-07-21 Craig Silverstein <csilvers@google.com>
8759 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8760 Include symbol version in error message.
8762 2008-07-20 Chris Demetriou <cgd@google.com>
8764 * configure.ac (gold_cv_c_random_seed): New configured variable.
8765 (RANDOM_SEED_CFLAGS): New substituted variable.
8766 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8767 * configure: Rebuild.
8768 * Makefile.in: Likewise.
8769 * testsuite/Makefile.in: Likewise.
8771 2008-07-18 Ian Lance Taylor <iant@google.com>
8773 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8774 where we see NAME/NULL and NAME/VERSION as separate symbols.
8775 * testsuite/ver_test_main.cc (main): Call t4.
8776 (t4, t4_2a): Define.
8777 * testsuite/ver_test_2.cc (t4_2): Define.
8778 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8779 * testsuite/ver_test_4.cc (t4_2a): Define.
8780 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8781 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8783 2008-07-17 Ian Lance Taylor <iant@google.com>
8785 * dynobj.cc (Versions::add_def): If we give an error about a
8786 missing version, go ahead and create the version anyhow.
8788 2008-07-10 Ian Lance Taylor <iant@google.com>
8790 Handle output sections with more than 0x7fffffff bytes.
8791 * object.h (class Relobj): Change map_to_output_ to
8792 output_sections_, and just keep a section pointer. Change all
8793 uses. Move comdat group support to Sized_relobj.
8794 (Relobj::is_section_specially_mapped): Remove.
8795 (Relobj::output_section): Remove poff parameter. Change all
8797 (Relobj::output_section_offset): New function.
8798 (Relobj::set_section_offset): Rewrite.
8799 (Relobj::map_to_output): Remove.
8800 (Relobj::output_sections): New function.
8801 (Relobj::do_output_section_offset): New pure virtual function.
8802 (Relobj::do_set_section_offset): Likewise.
8803 (class Sized_relobj): Add section_offsets_ field. Add comdat
8804 group support from Relobj. Update declarations.
8805 (Sized_relobj::get_output_section_offset): New function.
8806 (Sized_relobj::do_output_section_offset): New function.
8807 (Sized_relobj::do_set_section_offset): New function.
8808 * object.cc (Relobj::output_section_address): Remove.
8809 (Sized_relobj::Sized_relobj): Initialize new fields.
8810 (Sized_relobj::include_section_group): Cast find_kept_object to
8812 (Sized_relobj::include_linkonce_section): Likewise.
8813 (Sized_relobj::do_layout): Use separate arrays for output section
8815 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8817 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8818 output_sections and section_offsets.
8819 (Sized_relobj::write_local_symbols): Likewise.
8820 (map_to_kept_section): Compute output address directly.
8821 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8822 output_sections and section_offsets.
8823 (Sized_relobj::write_sections): Likewise.
8824 (Sized_relobj::relocate_sections): Likewise.
8825 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8826 * output.h (class Output_reloc): Update declarations. Change
8827 u2_.relobj to Sized_relobj*.
8828 (class Output_data_reloc): Change add functions to use
8830 * output.cc (Output_reloc::Output_reloc): Change relobj to
8832 (Output_reloc::local_section_offset): Change return type to
8833 Elf_Addr. Use get_output_section_offset.
8834 (Output_reloc::get_address): Likewise.
8835 (Output_section::is_input_address_mapped): Don't call
8836 is_section_specially_mapped.
8837 (Output_section::output_offset): Likewise.
8838 (Output_section::output_address): Likewise.
8839 (Output_section::starting_output_address): Likewise.
8840 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8841 parameter to Sized_relobj*.
8842 (Copy_relocs::need_copy_reloc): Likewise.
8843 (Copy_relocs::save): Likewise.
8844 * copy-relocs.h (class Copy_relocs): Update declarations.
8845 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8846 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8847 * target-reloc.h (relocate_for_relocatable): Change
8848 offset_in_output_section type to Elf_Addr. Change code that uses
8850 * layout.cc (Layout::layout): Always set *off.
8851 * mapfile.cc (Mapfile::print_input_section): Use
8852 output_section_offset.
8853 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8855 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8856 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8857 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8859 2008-07-03 Ian Lance Taylor <iant@google.com>
8861 * layout.cc (Layout::include_section): Do not discard unrecognized
8862 SHT_STRTAB sections.
8864 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
8866 * script.cc (Lex::can_continue_name): Make '?' allowable in
8867 version-script names.
8868 * testsuite/version_script.map: Change glob pattern to use '?'
8870 2008-06-30 Manish Singh <yosh@gimp.org>
8873 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8876 2008-06-30 Ian Lance Taylor <iant@google.com>
8880 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8881 versions]: Don't try to read the value in the contents, since we
8882 don't use it. Use the template endianness when writing.
8884 2008-06-25 Cary Coutant <ccoutant@google.com>
8886 * fileread.cc (File_read::make_view): Assert on zero-length view.
8887 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8888 symbol table when there are no symbols to read.
8890 2008-06-23 Craig Silverstein <csilvers@google.com>
8892 * version.cc (version_string): Bump to 1.7
8894 2008-06-18 Craig Silverstein <csilvers@google.com>
8896 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8897 constant 0xFFFF to type Valtype.
8898 (Powerpc_relocate_functions::rel16_ha): Likewise.
8900 2008-06-17 Ian Lance Taylor <iant@google.com>
8902 * output.h (Output_section::Input_section): Initialize p2align_ to
8903 zero for Output_section_data constructors.
8904 (Output_section::Input_section::addralign): If not an input
8905 section, return the alignment of the Output_section_data.
8906 * testsuite/copy_test.cc: New file.
8907 * testsuite/copy_test_1.cc: New file.
8908 * testsuite/copy_test_2.cc: New file.
8909 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8910 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8911 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8912 (copy_test_1_pic.o, copy_test_1.so): New targets.
8913 (copy_test_2_pic.o, copy_test_2.so): New targets.
8914 * testsuite/Makefile.in: Rebuild.
8916 * script-sections.cc (Script_sections::place_orphan): Initialize
8917 local variable exact.
8919 2008-06-13 David Edelsohn <edelsohn@gnu.org>
8921 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8923 2008-06-12 David Edelsohn <edelsohn@gnu.org>
8924 David S. Miller <davem@davemloft.net>
8926 * powerpc.cc: New file.
8927 * Makefile.am (TARGETSOURCES): Add powerpc.cc
8928 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8929 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8930 * Makefile.in: Rebuild.
8932 2008-06-09 Ian Lance Taylor <iant@google.com>
8934 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8936 (throwing, orig_terminate): New static variables.
8937 (terminate_handler): New static function.
8938 (t2): Set terminate handler.
8940 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
8943 * binary.cc (Binary_to_elf::sized_convert): Fix .data
8946 2008-05-30 Cary Coutant <ccoutant@google.com>
8948 * archive.cc (Archive::include_all_members) Correct to step
8949 over symbol table and extended name table in thin archives.
8951 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8954 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8957 2008-05-28 Caleb Howe <cshowe@google.com>
8959 * reduced_debug_output.cc: New file.
8960 * reduced_debug_output.h: New file.
8961 * options.h (class General_options): Add --strip-debug-non-line.
8962 * options.cc (General_options::finalize): Add strip_debug_non_line
8963 to the strip heirarchy.
8964 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8966 * layout.cc: Include "reduced_debug_output.h".
8967 (Layout::Layout): Initialize new fields.
8968 (line_only_debug_sections): New static array.
8969 (is_lines_only_debug_sections): New static inline function.
8970 (Layout::include_section): Handle --strip-debug-non-line.
8971 (Layout::make_output_section): If --strip-debug-non-line, build
8972 new output sections for .debug_abbrev and .debug_info.
8973 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8974 gold. Warn about possible overflow.
8975 (read_signed_LEB_128): Likewise.
8976 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8977 (read_signed_LEB_128): Declare.
8978 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8979 (HFILES): Add reduced_debug_output.h.
8980 * Makefile.in: Rebuild.
8982 2008-05-21 Ian Lance Taylor <iant@google.com>
8984 * mapfile.cc: New file.
8985 * mapfile.h: New file.
8986 * options.h (class General_options): Add -M/--print-map and -Map.
8987 * options.cc (General_options::finalize): Make -M equivalent to
8989 * main.cc: Include <cstdio> and "mapfile.h".
8990 (main): Open mapfile if requested.
8991 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8992 constructor. Change caller.
8993 (queue_initial_tasks): Add mapfile parameter. Change caller.
8994 (queue_middle_tasks): Likewise.
8995 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8997 * archive.cc: Include "mapfile.h".
8998 (Archive::add_symbols): Add mapfile parameter. Change all
8999 callers. Pass mapfile, symbol, and reason to include_member.
9000 (Archive::include_all_members): Add mapfile parameter. Change all
9002 (Archive::include_member): Add mapfile, sym, and why parameters.
9003 Change all callers. Report inclusion to map file.
9004 * archive.h: Include "fileread.h".
9005 (class Archive): Update declarations.
9006 (Archive::file): New const method.
9007 (class Add_archive_symbols): Add mapfile_ field. Update
9008 constructor. Change all callers.
9009 * readsyms.h (class Read_symbols): Likewise.
9010 (class Finish_group): Likewise.
9011 (class Read_script): Likewise.
9012 * common.cc: Include "mapfile.h".
9013 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9015 (Symbol_table::do_allocate_commons): Likewise.
9016 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9017 symbol allocation to mapfile.
9018 * common.h (class Allocate_commons_task): Add mapfile_ field.
9019 Update constructor. Change all callers.
9020 * symtab.h (class Symbol_table): Update declarations.
9021 * layout.cc: Include "mapfile.h".
9022 (Layout_task_runner::run): Print information to mapfile.
9023 (Layout::create_gold_note): Change Output_data_fixed_space to
9024 Output_data_zero_fill.
9025 (Layout::create_build_id): Likewise.
9026 (Layout::print_to_mapfile): New function.
9027 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9028 constructor. Change caller.
9029 (class Layout): Declare print_to_mapfile.
9030 * output.cc (Output_section::Input_section::print_to_mapfile): New
9032 (Output_section::add_input_section): If producing a map, always
9033 add to input_sections_ list.
9034 (Output_section::do_print_to_mapfile): New function.
9035 (Output_segment::print_sections_to_mapfile): New function.
9036 (Output_segment::print_section_list_to_mapfile): New function.
9037 * output.h: Include "mapfile.h".
9038 (Output_data::print_to_mapfile): New function.
9039 (Output_data::do_print_to_mapfile): New virtual function.
9040 (Output_segment_headers::do_print_to_mapfile): New function.
9041 (Output_file_header::do_print_to_mapfile): New function.
9042 (Output_data_const::do_print_to_mapfile): New function.
9043 (class Output_data_const_buffer): Add map_name_ field. Update
9044 constructor. Change all callers. Add do_print_to_mapfile
9046 (class Output_data_fixed_space): Likewise.
9047 (class Output_data_space): Likewise.
9048 (class Output_data_zero_fill): New class.
9049 (Output_data_strtab::do_print_to_mapfile): New function.
9050 (Output_data_reloc_base::do_print_to_mapfile): New function.
9051 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9052 (Output_data_group::do_print_to_mapfile): New function.
9053 (Output_data_got::do_print_to_mapfile): New function.
9054 (Output_data_dynamic::do_print_to_mapfile): New function.
9055 (Output_symtab_xindex::do_print_to_mapfile): New function.
9056 (class Output_section): Declare do_print_to_mapflie. Declare
9057 print_to_mapfile in Input_section.
9058 (class Output_segment): Declare new functions.
9059 * object.h (Sized_relobj::symbol_count): New function.
9060 * script-sections.cc
9061 (Output_section_element_dot_assignment::set_section_addresses):
9062 Change Output_data_fixed_space to Output_data_zero_fill.
9063 (Output_data_expression::do_print_to_mapfile): New function.
9064 * script.cc (read_input_script): Add mapfile parameter. Change
9066 * script.h (read_input_script): Update declaration.
9067 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9068 (Eh_frame::do_print_to_mapfile): New function.
9069 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9070 (Output_merge_string::do_print_to_mapfile): New function.
9071 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9073 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9075 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9077 * Makefile.am (CCFILES): Add mapfile.cc.
9078 (HFILES): Add mapfile.h.
9079 * Makefile.in: Rebuild.
9081 2008-05-19 Ian Lance Taylor <iant@google.com>
9083 * options.h (class General_options): Add -z relro.
9084 * layout.cc (Layout::Layout): Initialize relro_segment_.
9085 (Layout::add_output_section_data): Return the output section.
9086 (Layout::make_output_section): Rcognize relro sections and mark
9088 (Layout::attach_allocated_section_to_segment): Put relro sections
9089 in a PT_GNU_RELRO segment.
9090 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9092 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9094 (Layout::linkonce_mapping): Map d.rel.ro.local to
9096 (Layout::output_section_name): Us .data.rel.ro.local for any
9097 section which begins with that.
9098 * layout.h (class Layout): Update add_output_section_data
9099 declaration. Add relro_segment_ field.
9100 * output.cc (Output_section::Output_section): Initialize is_relro_
9101 and is_relro_local_ fields.
9102 (Output_segment::add_output_section): Group relro sections.
9103 (Output_segment::is_first_section_relro): New function.
9104 (Output_segment::maximum_alignment): If there is a relro section,
9105 align the segment to the common page size.
9106 (Output_segment::set_section_addresses): Track whether we are
9107 looking at relro sections. If the last section is a relro
9108 section, align to the common page size.
9109 (Output_segment::set_section_list_addresses): Add in_relro
9110 parameter. Change all callers. Align to the page size when
9111 moving from relro to non-relro section.
9112 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9114 * output.h (class Output_section): Add is_relro_ and
9115 is_relro_local_ fields.
9116 (Output_section::is_relro): New function.
9117 (Output_section::set_is_relro): New function.
9118 (Output_section::is_relro_local): New function.
9119 (Output_section::set_is_relro_local): New function.
9120 (class Output_segment): Update declarations.
9121 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9122 * sparc.cc (Target_sparc::got_section): Likewise.
9123 * x86_64.cc (Target_x86_64::got_section): Likewise.
9124 * testsuite/relro_test_main.cc: New file.
9125 * testsuite/relro_test.cc: New file.
9126 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9127 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9128 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9129 (relro_test.so, relro_test_pic.o): New targets.
9130 * testsuite/Makefile.in: Rebuild.
9132 2008-05-16 Ian Lance Taylor <iant@google.com>
9134 * output.cc (Output_segment::add_output_section): Remove front
9136 * output.h (class Output_segment): Remove
9137 add_initial_output_section and overloaded add_output_section.
9138 Update declaration of remaining add_output_section.
9139 * layout.cc (Layout::create_interp): Call add_output_section
9140 rather than add_initial_output_section.
9141 (Layout::finish_dynamic_section): Likewise.
9143 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9144 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9145 know the dynamic type.
9146 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9147 field. Initialize it in constructor.
9148 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9149 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9150 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9153 * output.cc (Output_reloc::get_address): Change return type to
9155 * output.h (class Output_reloc): Update get_address declaration.
9156 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9157 for section addresses.
9159 2008-05-09 Ian Lance Taylor <iant@google.com>
9162 * gold.cc (gold_nomem): Use return value of write.
9164 2008-05-08 Ian Lance Taylor <iant@google.com>
9166 * symtab.c (Symbol::init_base_output_data): Add version
9167 parameter. Change all callers.
9168 (Symbol::init_base_output_segment): Likewise.
9169 (Symbol::init_base_constant): Likewise.
9170 (Symbol::init_base_undefined): Likewise.
9171 (Sized_symbol::init_output_data): Likewise.
9172 (Sized_symbol::init_output_segment): Likewise.
9173 (Sized_symbol::init_constant): Likewise.
9174 (Sized_symbol::init_undefined): Likewise.
9175 (Symbol_table::do_define_in_output_data): If the new symbol has a
9176 version, mark it as the default.
9177 (Symbol_table::do_define_in_output_segment): Likewise.
9178 (Symbol_table::do_define_as_constant): Likewise.
9179 * symtab.h (class Symbol): Update declarations.
9180 (class Sized_symbol): Likewise.
9181 * resolve.cc (Symbol::override_version): New function.
9182 (Symbol::override_base): Call override_version.
9183 (Symbol::override_base_with_special): Likewise.
9184 * testsuite/ver_script_8.script: New file.
9185 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9186 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9187 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9188 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9190 2008-05-06 Ian Lance Taylor <iant@google.com>
9193 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9195 (class General_options): Remove existing --undefined, and add
9196 --no-undefined instead. Add new --undefined as synonym for -u.
9197 * archive.cc (Archive::add_symbols): Check whether symbol was
9199 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9200 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9201 all uses. Add IS_UNDEFINED. Update declarations to split
9202 different versions of init_base. Declare init_base_undefined.
9203 (Symbol::is_defined): Handle IS_UNDEFINED.
9204 (Symbol::is_undefined): Likewise.
9205 (Symbol::is_weak_undefined): Call is_undefined.
9206 (Symbol::is_absolute): Handle IS_CONSTANT.
9207 (class Sized_symbol): Update declarations to split different
9208 versions of init. Declare init_undefined.
9209 (class Symbol_table): Declare new functions.
9210 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9212 (Symbol::init_base_output_data): Likewise.
9213 (Symbol::init_base_output_segment): Likewise.
9214 (Symbol::init_base_constant): Likewise.
9215 (Symbol::init_base_undefined): New function.
9216 (Sized_symbol::init_object): Rename from init. Change all
9218 (Sized_symbol::init_output_data): Likewise.
9219 (Sized_symbol::init_output_segment): Likewise.
9220 (Sized_symbol::init_constant): Likewise.
9221 (Sized_symbol::init_undefined): New function.
9222 (Symbol_table::add_undefined_symbols_from_command_line): New
9224 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9226 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9227 (Symbol::output_section): Likewise.
9228 (Symbol::set_output_section): Likewise.
9229 (Symbol_table::sized_finalize_symbol): Likewise.
9230 (Symbol_table::sized_write_globals): Likewise.
9231 * resolve.cc (Symbol_table::should_override): Likewise.
9232 (Symbol::override_base_with_special): Likewise.
9234 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9235 symbol, change it to have default visibility.
9236 * testsuite/protected_1.cc: New file.
9237 * testsuite/protected_2.cc: New file.
9238 * testsuite/protected_3.cc: New file.
9239 * testsuite/protected_main_1.cc: New file.
9240 * testsuite/protected_main_2.cc: New file.
9241 * testsuite/protected_main_3.cc: New file.
9242 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9243 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9244 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9245 (protected_1.so): New target.
9246 (protected_1_pic.o, protected_2_pic.o): New targets.
9247 (protected_3_pic.o): New target.
9248 (check_PROGRAMS): Add protected_2.
9249 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9250 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9251 * testsuite/Makefile.in: Rebuild.
9253 * options.h (DEFINE_var): Add set_user_set_##varname__.
9254 (DEFINE_bool_alias): New macro.
9255 (class General_options): Define -Bstatic using DEFINE_bool_alias
9256 rather than DEFINE_special. Add --undefined as an alias for -z
9258 * options.cc (General_options::parse_Bstatic): Remove.
9260 * options.h (class General_options): Add --fatal-warnings.
9261 * main.cc (main): Implement --fatal-warnings.
9262 * errors.h (Errors::warning_count): New function.
9264 * options.h (class General_options): Add -Bsymbolic-functions.
9265 * symtab.h (Symbol::is_preemptible): Check for
9266 -Bsymbolic-functions.
9268 2008-05-05 Ian Lance Taylor <iant@google.com>
9270 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9271 as noVARNAME rather than no-VARNAME.
9272 (class General_options): Add option -z combreloc.
9273 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9275 (Output_reloc::sort_before) [SHT_REL]: New function.
9276 (Output_reloc::sort_before) [SHT_RELA]: New function.
9277 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9278 Sort_relocs_comparison.
9279 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9280 parameter. Change all callers.
9281 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9282 sort_relocs parameter. Change all callers.
9283 * output.cc (Output_reloc::get_address): New function, broken out
9285 (Output_reloc::write_rel): Call it.
9286 (Output_reloc::compare): New function.
9287 (Output_data_reloc_base::do_write): Optionally sort relocs.
9289 * configure.ac: If targ_extra_obj is set, link it in.
9290 * configure.tgt: Initialize all variables.
9291 (x86_64*): Set targ_extra_obj and targ_extra_size.
9292 * configure: Rebuild.
9294 * object.cc (Sized_relobj::include_section_group): Adjust section
9295 indexes read from group data. Build vector to pass to
9297 * layout.cc (Layout::layout_group): Add flags and shndxes
9298 parameters. Remove contents parameter. Change caller. Update
9299 explicit instantiations.
9300 * layout.h (class Layout): Update layout_group declaration.
9301 * output.cc (Output_data_group::Output_data_group): Add flags and
9302 input_shndxes parameters. Remove contents parameter. Change
9304 (Output_data_group::do_write): Change input_sections_ to
9306 * output.h (class Output_data_group): Update constructor
9307 declaration. Rename input_sections_ to input_shndxes_.
9308 * testsuite/many_sections_test.cc: Add template.
9310 2008-04-30 Cary Coutant <ccoutant@google.com>
9312 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9314 * layout.cc (Layout::include_section): Refactored check for debug
9316 (Layout::add_comdat): Add new parameters. Change type
9317 of signature parameter. Add object and shndx to signatures table.
9318 (Layout::find_kept_object): New function.
9319 * layout.h: Include <cstring>.
9320 (Layout::is_debug_info_section): New function.
9321 (Layout::add_comdat): Add new parameters.
9322 (Layout::find_kept_object): New function.
9323 (Layout::Kept_section): New struct.
9324 (Layout::Signatures): Change type of map range.
9325 * object.cc (Relobj::output_section_address): New function.
9326 (Sized_relobj::include_section_group): Add new parameters. Change
9327 calls to Layout::add_comdat. Change to build table of kept comdat
9328 groups and table mapping discarded sections to kept sections.
9329 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9330 (Sized_relobj::do_layout): Change calls to include_section_group and
9331 include_linkonce_section.
9332 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9333 value to zero when section is discarded.
9334 (Sized_relobj::map_to_kept_section): New function.
9335 * object.h (Relobj::output_section_address): New function.
9336 (Relobj::Comdat_group): New type.
9337 (Relobj::find_comdat_group): New function.
9338 (Relobj::Comdat_group_table): New type.
9339 (Relobj::Kept_comdat_section): New type.
9340 (Relobj::Kept_comdat_section_table): New type.
9341 (Relobj::add_comdat_group): New function.
9342 (Relobj::set_kept_comdat_section): New function.
9343 (Relobj::get_kept_comdat_section): New function.
9344 (Relobj::comdat_groups_): New field.
9345 (Relobj::kept_comdat_sections_): New field.
9346 (Symbol_value::input_value): Update comment.
9347 (Sized_relobj::map_to_kept_section) New function.
9348 (Sized_relobj::include_linkonce_section): Add new parameter.
9349 * target-reloc.h (Comdat_behavior): New type.
9350 (get_comdat_behavior): New function.
9351 (relocate_section): Add code to map a discarded section to the
9352 corresponding kept section when applying a relocation.
9354 2008-04-30 Craig Silverstein <csilvers@google.com>
9356 * dwarf_reader.cc (next_generation_count): New static var.
9357 (Addr2line_cache_entry): New struct.
9358 (addr2line_cache): New static var.
9359 (Dwarf_line_info::one_addr2line): Added caching.
9360 (Dwarf_line_info::clear_addr2line_cache): New function.
9361 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9362 cache-size parameter.
9363 (Dwarf_line_info::one_addr2line_cache): New function.
9364 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9365 new cache-size argument to one_addr2line(), and clear cache.
9367 2008-04-28 Cary Coutant <ccoutant@google.com>
9369 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9370 R_386_PC8 relocations.
9372 2008-04-23 Ian Lance Taylor <iant@google.com>
9374 * object.cc (Sized_relobj::include_section_group): Check for
9375 invalid section group.
9377 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9380 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9381 than read for file header.
9382 * archive.cc (Archive::include_member): Likewise.
9384 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
9386 * aclocal.m4: Regenerate.
9387 * configure: Regenerate.
9389 2008-04-19 Ian Lance Taylor <iant@google.com>
9391 * version.cc (version_string): Bump to 1.6.
9393 * testsuite/Makefile.am (many_sections_r_test): New target.
9394 (many_sections_r_test_SOURCES): Remove.
9395 (many_sections_r_test_DEPENDENCIES): Remove.
9396 (many_sections_r_test_LDFLAGS): Remove.
9397 (many_sections_r_test_LDADD): Remove.
9399 * object.cc (Sized_relobj::do_add_symbols): Always pass
9400 local_symbol_count_ to add_from_relobj.
9402 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9403 every thousand variables.
9404 * testsuite/Makefile.in: Rebuild.
9406 * object.cc (Xindex::initialize_symtab_xindex): New function.
9407 (Xindex::read_symtab_xindex): New function.
9408 (Xindex::sym_xindex_to_shndx): New function.
9409 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9411 (Sized_relobj::do_initialize_xindex): New function.
9412 (Sized_relobj::do_read_symbols): Adjust section links.
9413 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9414 parameter. Change all callers.
9415 (Sized_relobj::include_section_group): Adjust section links and
9416 symbol section indexes.
9417 (Sized_relobj::do_layout): Adjust section links.
9418 (Sized_relobj::do_count_local_symbols): Adjust section links and
9419 symbol section indexes.
9420 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9421 ordinary and special symbols.
9422 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9423 dynsym_xindex parameters. Change all callers. Adjust section
9424 links. Use SHN_XINDEX when needed.
9425 (Sized_relobj::get_symbol_location_info): Adjust section links.
9426 Don't get fooled by special symbols.
9427 * object.h (class Xindex): Define.
9428 (class Object): Add xindex_ parameter. Declare virtual functoin
9429 do_initialize_xindex.
9430 (Object::adjust_sym_shndx): New function.
9431 (Object::set_xindex): New protected function.
9432 (class Symbol_value): Add is_ordinary_shndx_ field.
9433 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9434 (Symbol_value::value): Assert ordinary section.
9435 (Symbol_value::initialize_input_to_output_map): Likewise.
9436 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9438 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9440 (class Sized_relobj): Update declarations.
9441 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9442 parameter. Change all callers.
9443 (Sized_relobj::adjust_shndx): New function.
9444 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9446 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9447 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9448 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9449 (Sized_dynobj::read_dynsym_section): Adjust section links.
9450 (Sized_dynobj::read_dynamic): Likewise.
9451 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9453 (Sized_dynobj::do_initialize_xindex): New function.
9454 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9455 do_initialize_xindex.
9456 (Sized_dynobj::adjust_shndx): New function.
9457 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9458 dynsym_xindex_ fields.
9459 (Layout::finalize): Add a call to set_section_indexes before
9460 creating the symtab sections.
9461 (Layout::set_section_indexes): Don't do anything if the section
9462 already has a section index.
9463 (Layout::create_symtab_sections): Add shnum parameter. Change
9464 caller. Create .symtab_shndx section if needed.
9465 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9467 (Layout::allocated_output_section_count): New function.
9468 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9470 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9471 fields. Update declarations.
9472 (Layout::symtab_xindex): New function.
9473 (Layout::dynsym_xindex): New function.
9474 (class Write_symbols_task): Add layout_ field.
9475 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9477 * output.cc (Output_section_headers::Output_section_headers): Add
9478 shstrtab_section parameter. Change all callers.
9479 (Output_section_headers::do_sized_write): Store overflow values
9480 for section count and section string table section index in
9481 section header zero.
9482 (Output_file_header::do_sized_write): Check for overflow of
9483 section count and section string table section index.
9484 (Output_symtab_xindex::do_write): New function.
9485 (Output_symtab_xindex::endian_do_write): New function.
9486 * output.h (class Output_section_headers): Add shstrtab_section_.
9487 Update declarations.
9488 (class Output_symtab_xindex): Define.
9489 (Output_section::has_out_shndx): New function.
9490 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9492 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9494 (Sized_symbol::init): Likewise.
9495 (Symbol::output_section): Check for ordinary symbol.
9496 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9497 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9499 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9500 Change all callers. Simplify handling of symbols from sections
9501 not included in the link.
9502 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9504 (Weak_alias_sorter::operator()): Assert that symbols are
9506 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9508 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9509 parameters. Change all callers.
9510 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9511 symbol distinction. Use SHN_XINDEX when needed.
9512 (Symbol_table::write_section_symbol): Add symtab_xindex
9513 parameter. Change all callers.
9514 (Symbol_table::sized_write_section_symbol): Likewise. Use
9515 SHN_XINDEX when needed.
9516 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9518 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9519 (Symbol::is_defined): Check is_ordinary.
9520 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9521 (Symbol::is_absolute, Symbol::is_common): Likewise.
9522 (class Sized_symbol): Update declarations.
9523 (class Symbol_table): Update declarations.
9524 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9525 parameters. Change all callers.
9526 (Sized_symbol::override): Likewise.
9527 (Symbol_table::override): Likewise.
9528 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9529 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9530 is_ordinary, and orig_st_shndx parameters. Change all callers.
9531 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9532 to be in an ordinary section.
9533 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9534 object and is_ordinary parameters. Change all callers.
9535 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9536 Change all callers. Don't add undefined or non-ordinary symbols
9538 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9540 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9542 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9543 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9544 (Sized_relobj::relocate_sections): Likewise.
9545 * target-reloc.h (scan_relocs): Adjust section symbol index.
9546 (scan_relocatable_relocs): Likewise.
9547 * i386.cc (Scan::local): Check for ordinary symbols.
9548 * sparc.cc (Scan::local): Likewise.
9549 * x86_64.cc (Scan::local): Likewise.
9550 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9551 to symbol_section_and_value.
9552 * testsuite/many_sections_test.cc: New file.
9553 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9554 (check_PROGRAMS): Add many_sections_test.
9555 (many_sections_test_SOURCES): Define.
9556 (many_sections_test_DEPENDENCIES): Define.
9557 (many_sections_test_LDFLAGS): Define.
9558 (BUILT_SOURCES): Add many_sections_define.h.
9559 (many_sections_define.h): New target.
9560 (BUILT_SOURCES): Add many_sections_check.h.
9561 (many_sections_check.h): New target.
9562 (check_PROGRAMS): Add many_sections_r_test.
9563 (many_sections_r_test_SOURCES): Define.
9564 (many_sections_r_test_DEPENDENCIES): Define.
9565 (many_sections_r_test_LDFLAGS): Define.
9566 (many_sections_r_test_LDADD): Define.
9567 (many_sections_r_test.o): New target.
9568 * testsuite/Makefile.in: Rebuild.
9570 2008-04-17 Cary Coutant <ccoutant@google.com>
9572 * errors.cc (Errors::info): New function.
9573 (gold_info): New function.
9574 * errors.h (Errors::info): New function.
9575 * gold.h (gold_info): New function.
9576 * object.cc (Input_objects::add_object): Print trace output.
9577 * options.cc (options::parse_set): New function.
9578 (General_options::parse_wrap): Deleted.
9579 (General_options::General_options): Deleted initializer.
9580 * options.h (options::String_set): New typedef.
9581 (options::parse_set): New function.
9582 (DEFINE_set): New macro.
9583 (General_options::wrap): Changed to use DEFINE_set. Changed
9584 callers of any_wrap_symbols and is_wrap_symbol.
9585 (General_options::trace, General_options::trace_symbol):
9587 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9588 (General_options::wrap_symbols_): Deleted.
9589 * symtab.cc (Symbol_table::add_from_object): Print trace output.
9591 2008-04-17 David S. Miller <davem@davemloft.net>
9593 * options.cc (General_options::parse_V): New function.
9594 * options.h: Add entries for -V and -Qy.
9596 2008-04-17 Ian Lance Taylor <iant@google.com>
9598 * common.cc (Symbol_table::allocate_commons): Remove options
9599 parameter. Change caller.
9600 (Symbol_table::do_allocate_commons): Remove options parameter.
9601 Change caller. Just call do_allocate_commons_list twice.
9602 (Symbol_table::do_allocate_commons_list): New function, broken out
9603 of do_allocate_commons.
9604 * common.h (class Allocate_commons_task): Remove options_ field.
9606 * symtab.cc (Symbol_table::Symbol_table): Initialize
9608 (Symbol_table::add_from_object): Put TLS common symbols on
9610 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9611 which are IN_OUTPUT_DATA.
9612 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
9613 allocate_commons and do_allocate_commons declarations. Declare
9614 do_allocate_commons_list.
9615 * gold.cc (queue_middle_tasks): Update creation of
9616 Allocate_commons_task to not pass options.
9617 * testsuite/Makefile.am (INCLUDES): Add -I.. .
9618 (TLS_TEST_C_FLAGS): New variable.
9619 (tls_test_c_pic.o): New target.
9620 (tls_test_shared.so): Link in tls_test_c_pic.o.
9621 (tls_test_c_pic_ie.o): New target.
9622 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9623 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9624 (tls_test_c.o): New target.
9625 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9626 (tls_pic_test_LDADD): Likewise.
9627 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9628 (tls_shared_gd_to_ie_test_LDADD): Likewise.
9629 (tls_test_c_gnu2.o): New target.
9630 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9632 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9633 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9634 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9635 * testsuite/tls_test.cc: Include "config.h".
9636 (t_last): Call t11_last.
9637 * testsuite/tls_test.h (t11, t11_last): Declare.
9638 * testsuite/tls_test_c.c: New file.
9639 * testsuite/tls_test_main.cc (thread_routine): Call t11.
9640 * configure.ac: Check for OpenMP support.
9641 * configure, config.in, Makefile.in: Rebuild.
9642 * testsuite/Makefile.in: Rebuild.
9644 2008-04-16 Cary Coutant <ccoutant@google.com>
9646 * i386.cc (Target_i386::define_tls_base_symbol): New function.
9647 (Target_i386::tls_base_symbol_defined_): New field.
9648 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9649 (Target_i386::Scan::global): Likewise.
9650 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9651 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9652 (Target_x86_64::tls_base_symbol_defined_): New field.
9653 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9654 (Target_x86_64::Scan::global): Likewise.
9656 2008-04-16 Cary Coutant <ccoutant@google.com>
9658 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9659 (Symbol::needs_plt_entry): Allow weak undefined symbols.
9660 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9661 building shared libraries.
9662 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9663 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9664 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9665 * testsuite/Makefile.in: Rebuild.
9666 * testsuite/weak_undef.h: New file.
9667 * testsuite/weak_undef_file1.cc: Add extra test cases.
9668 * testsuite/weak_undef_file2.cc: Likewise.
9669 * testsuite/weak_undef_test.cc: Likewise.
9671 2008-04-16 David S. Miller <davem@davemloft.net>
9673 * sparc.cc (Target_sparc::Scan): Change from struct to class.
9674 Add issued_non_pic_error_ field. Declare check_non_pic.
9675 (Target_sparc::Scan::check_non_pic): New function.
9676 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9677 (Target_sparc::Scan::global): Likewise.
9679 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9680 * configure: Rebuild.
9682 * options.h (DEFINE_enable): New macro.
9683 (new_dtags): New enable option.
9684 (initfirst, interpose, loadfltr, nodefaultlib,
9685 nodelete, nodlopen, nodump): New -z options.
9686 * layout.cc (Layout:finish_dynamic_section): If new
9687 dtags enabled, emit DT_RUNPATH. Also, emit a
9688 DT_FLAGS_1 containing any specified -z flags.
9690 2008-04-16 Ian Lance Taylor <iant@google.com>
9692 * copy-relocs.cc: New file.
9693 * copy-relocs.h: New file.
9694 * reloc.cc: Remove Copy_relocs code.
9695 * reloc.h: Likewise.
9696 * reloc-types.h (struct Reloc_types) [both versions]: Add
9697 get_reloc_addend_noerror.
9698 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9699 variants of add_global which take an addend which must be zero.
9700 * i386.cc: Include "copy-relocs.h".
9701 (class Target_i386): Change type of copy_relocs_ to variable,
9703 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9705 (Target_i386::do_finalize_sections): Change handling of
9707 * sparc.cc: Include "copy-relocs.h".
9708 (class Target_sparc): Change type of copy_relocs_ to variable,
9710 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9712 (Target_sparc::do_finalize_sections): Change handling of
9714 * x86_64.cc: Include "copy-relocs.h".
9715 (class Target_x86_64): Change type of copy_relocs_ to variable,
9717 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9718 class. Change all callers.
9719 (Target_x86_64::do_finalize_sections): Change handling of
9721 * Makefile.am (CCFILES): Add copy-relocs.cc.
9722 (HFILES): Add copy-relocs.h.
9724 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9726 * testsuite/script_test_4.sh: Permit leading zeroes.
9728 2008-04-15 Ian Lance Taylor <iant@google.com>
9730 * script-sections.cc (Script_sections::create_segments): Use
9731 header_size_adjustment even when there is enough room for the
9733 * testsuite/script_test_4.sh: New file.
9734 * testsuite/script_test_4.t: New file.
9735 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9736 (check_DATA): Add script_test_4.stdout.
9737 (MOSTLYCLEANFILES): Likewise.
9738 (script_test_4): New target.
9739 (script_test_4.stdout): New target.
9740 * testsuite/Makefile.in: Rebuild.
9742 * sparc.cc: Add definitions for Output_data_plt_sparc class
9745 2008-04-14 David S. Miller <davem@davemloft.net>
9747 * sparc.cc: New file.
9748 * Makefile.am (TARGETSOURCES): Add sparc.cc
9749 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9750 * configure.tgt: Document targ_extra_size and
9751 targ_extra_big_endian. Add entries for sparc-* and
9753 * configure.ac: Handle targ_extra_size and
9754 targ_extra_big_endian.
9755 * Makefile.in: Rebuild.
9756 * configure: Likewise.
9757 * po/POTFILES.in: Likewise.
9758 * po/gold.pot: Likewise.
9760 2008-04-14 Ian Lance Taylor <iant@google.com>
9762 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9763 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9764 in the name/type/flags to section mapping. Don't call
9765 allocate_output_section.
9766 (Layout::choose_output_section): Change parameter from adjust_name
9767 to is_input_section. Don't permit input sections after sections
9768 are attached to segments. Don't call allocate_output_section.
9769 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9770 not write_enable_output_section.
9771 (Layout::make_output_section): Don't push to
9772 unattached_section_list_ nor call attach_to_segment. Call
9773 attach_section_to_segment if sections are attached.
9774 (Layout::attach_sections_to_segments): New function.
9775 (Layout::attach_section_to_segment): New function.
9776 (Layout::attach_allocated_section_to_segment): Rename from
9777 attach_to_segment. Remove flags parameter.
9778 (Layout::allocate_output_section): Remove function.
9779 (Layout::write_enable_output_section): Remove function.
9780 * layout.h (class Layout): Update for above changes. Add new
9781 field sections_are_attached_.
9782 * output.h (Output_section::update_flags_for_input_section): New
9784 * output.cc (Output_section::add_input_section): Call
9785 update_flags_for_input_section.
9786 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9788 2008-04-11 Cary Coutant <ccoutant@google.com>
9790 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9791 thought unnecessary.
9792 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9794 2008-04-11 Ian Lance Taylor <iant@google.com>
9796 * output.h (class Output_section_data): Remove inline definition
9798 * output.cc (Output_section_data::set_addralign): New function.
9800 2008-04-11 Cary Coutant <ccoutant@google.com>
9802 Add support for TLS descriptors for i386 and x86_64.
9803 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9804 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9805 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9807 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9808 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9809 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9811 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9812 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9813 Fix problem with initial-exec relocations.
9814 (Target_i386::Relocate::relocate_tls): Likewise.
9815 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9817 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9818 support for section-plus-offset dynamic table entries.
9819 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9820 (Output_data_dynamic::Dynamic_entry): Add support for
9821 section-plus-offset dynamic table entries.
9822 (Output_data_dynamic::Classification): Likewise.
9823 (Output_data_dynamic::classification_): Renamed offset_.
9824 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9825 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9826 (Target_x86_64::make_plt_section): New function.
9827 (Target_x86_64::reserve_tlsdesc_entries): New function.
9828 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9829 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9830 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9831 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9832 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9833 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9834 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9835 add extra PLT entry for TLS descriptors.
9836 (Output_data_plt_x86_64::got_): New field.
9837 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9838 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9840 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9842 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9843 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9844 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9845 R_386_TLS_DESC_CALL relocations.
9846 (Target_x86_64::Scan::global): Likewise.
9847 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9848 for TLS descriptors.
9849 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9850 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9851 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9852 GD-to-IE relaxation.
9853 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9854 and TLS_DESCRIPTORS.
9855 * Makefile.in: Rebuild.
9856 * configure: Rebuild.
9857 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9858 (tls_test_shared2.so): New target.
9859 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9860 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9861 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9862 (tls_shared_gd_to_ie_test_LDADD): New variable.
9863 (tls_shared_gnu2_gd_to_ie_test): New target.
9864 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9866 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9867 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9868 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9869 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9870 (tls_shared_gnu2_test): New target.
9871 (tls_test_gnu2_shared.so): New target.
9872 (tls_shared_gnu2_test_SOURCES): New variable.
9873 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9874 (tls_shared_gnu2_test_LDFLAGS): New variable.
9875 (tls_shared_gnu2_test_LDADD): New variable.
9876 * testsuite/Makefile.in: Rebuild.
9877 * testsuite/Makefile.
9879 2008-04-11 Ian Lance Taylor <iant@google.com>
9881 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9883 * testsuite/Makefile.in: Rebuild.
9885 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9887 * testsuite/script_test_2.cc (main): Adjust test.
9889 2008-04-11 David S. Miller <davem@davemloft.net>
9890 Ian Lance Taylor <iant@google.com>
9892 * options.h (General_options): Add entries for '-Y' and
9894 * options.cc (General_options:finalize): If -Y was used, add those
9895 entries to the library path instead of the default "/lib" and
9898 2008-04-11 David S. Miller <davem@davemloft.net>
9900 * testsuite/justsyms.t: Start at 0x100.
9901 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9902 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9904 * testsuite/script_test_2.cc: Adjust string and section length
9907 2008-04-09 Ian Lance Taylor <iant@google.com>
9910 * script-sections.cc (Sections_element::allocate_to_segment): Add
9912 (Output_section_definition::allocate_to_segment): Likewise.
9913 (Orphan_output_section::allocate_to_segment): Likewise.
9914 (Script_sections::attach_sections_using_phdrs_clause): Don't
9915 propagate non-PT_LOAD segments to orphan sections.
9916 * testsuite/Makefile.am (script_test_3.stdout): Generate using
9917 readelf rather than objdump.
9918 * testsuite/script_test_3.sh: Adjust accordingly. Test that
9919 .interp section and PT_INTERP segment are the same size.
9920 * testsuite/Makefile.in: Rebuild.
9922 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9923 aliases for symbols defined in the same object.
9924 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9925 (weak_alias_test_SOURCES): New variable.
9926 (weak_alias_test_DEPENDENCIES): New variable.
9927 (weak_alias_test_LDFLAGS): New variable.
9928 (weak_alias_test_LDADD): New variable.
9929 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9930 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9931 (weak_alias_test_3.o): New target.
9932 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9933 * testsuite/weak_alias_test_main.cc: New file.
9934 * testsuite/weak_alias_test_1.cc: New file.
9935 * testsuite/weak_alias_test_2.cc: New file.
9936 * testsuite/weak_alias_test_3.cc: New file.
9938 2008-04-08 Ian Lance Taylor <iant@google.com>
9940 * options.h (class General_options): Add --noinhibit-exec option.
9941 * main.cc (main): Check --noinhibit-exec.
9943 * options.h (class General_options): Define --wrap as a special
9944 option. Add wrap_symbols_ field.
9945 (General_options::any_wrap_symbols): New function.
9946 (General_options::is_wrap_symbol): New function.
9947 * options.cc (General_options::parse_wrap): New function.
9948 (General_options::General_options): Initialize wrap_symbols_.
9949 * symtab.cc (Symbol_table::wrap_symbol): New function.
9950 (Symbol_table::add_from_object): Handle --wrap.
9951 * symtab.h (class Symbol_table): Declare wrap_symbol.
9952 * target.h (Target::wrap_char): New function.
9953 (Target::Target_info): Add wrap_char field.
9954 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9955 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9956 * testsuite/testfile.cc (Target_test::test_target_info):
9959 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9962 * layout.h (class Layout): Add added_eh_frame_data_ field.
9963 * layout.cc (Layout::Layout): Initialize new field.
9964 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9965 output section until we find a section we merged successfully.
9966 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9967 that the size be non-zero.
9969 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9972 2008-04-08 Craig Silverstein <csilvers@google.com>
9974 * configure.ac: Export new conditional variable HAVE_ZLIB.
9975 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9977 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9978 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9980 2008-04-07 Ian Lance Taylor <iant@google.com>
9982 * version.cc (version_string): Set to "1.5".
9984 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9985 Add issued_non_pic_error_ field. Declare check_non_pic.
9986 (Target_x86_64::Scan::check_non_pic): New function.
9987 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9988 (Target_x86_64::Scan::global): Likewise.
9990 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9991 addend parameter. Change caller. Handle merge sections.
9992 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9993 Address to Addend. Don't add in the result of
9994 local_section_offset, pass down the addend and use the returned
9996 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9997 Update declarations of local_section_offset and symbol_value.
9998 * testsuite/two_file_test_1.cc (t18): New function.
9999 * testsuite/two_file_test_2.cc (f18): New function.
10000 * testsuite/two_file_test_main.cc (main): Call t18.
10001 * testsuite/two_file_test.h (t18, f18): Declare.
10003 * configure.ac: Don't test for objdump, c++filt, or readelf.
10004 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10006 (TEST_READELF): New variable.
10007 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10008 (check_PROGRAMS): Add two_file_strip_test.
10009 (two_file_strip_test): New target.
10010 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10011 (two_file_same_shared_strip_test_SOURCES): New variable.
10012 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10013 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10014 (two_file_same_shared_strip_test_LDADD): New variable.
10015 (two_file_shared_strip.so): New target.
10016 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10017 (ver_test_5.syms, ver_test_7.syms): Likewise.
10018 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10019 (strip_test_3.stdout): Use TEST_OBJDUMP.
10020 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10022 2008-04-04 Cary Coutant <ccoutant@google.com>
10024 * symtab.h (Symbol::is_weak_undefined): New function.
10025 (Symbol::is_strong_undefined): New function.
10026 (Symbol::is_absolute): New function.
10027 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10028 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10030 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10031 (weak_undef_test): New target.
10032 * testsuite/Makefile.in: Rebuild.
10033 * testsuite/weak_undef_file1.cc: New file.
10034 * testsuite/weak_undef_file2.cc: New file.
10035 * testsuite/weak_undef_test.cc: New file.
10037 2008-04-03 Craig Silverstein <csilvers@google.com>
10039 * compressed_output.h (class Output_compressed_section): Use
10041 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10043 (zlib_compressed_suffix): Removed.
10044 (Output_compressed_section::set_final_data_size): Use unsigned
10046 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10047 Fix linker invocation.
10048 (flagstest_o_specialfile_and_compress_debug_sections):
10050 * testsuite/Makefile.in: Regenerated.
10052 2008-04-02 David S. Miller <davem@davemloft.net>
10054 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10055 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10057 2008-04-02 Craig Silverstein <csilvers@google.com>
10061 2008-04-02 Ian Lance Taylor <iant@google.com>
10063 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10064 parameters. Update for new key type to views_. Change all
10066 (File_read::read): Adjust for byteshift in returned view.
10067 (File_read::add_view): New function, broken out of
10068 find_and_make_view.
10069 (File_read::make_view): New function, broken out of
10070 find_and_make_view.
10071 (File_read::find_or_make_view): Add offset and aligned
10072 parameters. Rewrite accordingly. Change all callers.
10073 (File_read::get_view): Add offset and aligned parameters. Adjust
10074 for byteshift in return value.
10075 (File_read::get_lasting_view): Likewise.
10076 * fileread.h (class File_read): Update declarations.
10077 (class File_read::View): Add byteshift_ field. Add byteshift to
10078 constructor. Add byteshift method.
10079 * archive.h (Archive::clear_uncached_views): New function.
10080 (Archive::get_view): Add aligned parameter. Change all callers.
10081 * object.h (Object::get_view): Add aligned parameter. Change all
10083 (Object::get_lasting_view): Likewise.
10085 * fileread.cc (File_read::release): Don't call clear_views if
10086 there are multiple objects.
10087 * fileread.h (File_read::clear_uncached_views): New function.
10088 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10091 2008-03-31 Cary Coutant <ccoutant@google.com>
10093 Add thin archive support.
10094 * archive.cc (Archive::armagt): New const.
10095 (Archive::setup): Remove task parameter and calls to unlock.
10096 (Archive::unlock_nested_archives): New function.
10097 (Archive::read_header): Add nested_off parameter. Change
10099 (Archive::interpret_header): Likewise.
10100 (Archive::include_all_members): Change to handle thin
10102 (Archive::include_member): Likewise.
10103 * archive.h (Archive::Archive): Add new parameters and
10105 (Archive::armagt): New const.
10106 (Archive::setup): Remove task parameter.
10107 (Archive::unlock_nested_archives): New function.
10108 (Archive::read_header): Add nested_off parameter.
10109 (Archive::interpret_header): Likewise.
10110 (Archive::Nested_archive_table): New typedef.
10111 (Archive::is_thin_archive_): New field.
10112 (Archive::nested_archives_): New field.
10113 (Archive::options_): New field.
10114 (Archive::dirpath_): New field.
10115 (Archive::task_): New field.
10116 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10117 for thin archives. Pass additional parameters to
10118 Archive::Archive. Unlock the archive file after calling
10121 2008-03-29 Ian Lance Taylor <iant@google.com>
10123 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10124 version symbol to be local.
10125 * testsuite/ver_test_4.sh: New file.
10126 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10127 (check_DATA): Add ver_test_4.syms.
10128 (ver_test_4.syms): New target.
10129 * testsuite/Makefile.in: Rebuild.
10132 (Output_section::Input_section_sort_entry::has_priority): New
10134 (Output_section::Input_section_sort_entry::match_file_name): New
10136 (Output_section::Input_section_sort_entry::match_section_name):
10138 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10140 (Output_section::Input_section_sort_entry::match_section_file):
10142 (Output_section::Input_section_sort_compare::operator()): Rewrite
10143 using new Input_section_sort_entry functions. Sort crtbegin and
10144 crtend first. Sort sections with no priority before sections with
10146 * testsuite/initpri1.c (d3): Check j != 4.
10147 (cd5): New constructor/destructor function.
10148 (main): Check j != 2.
10150 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10151 new symbol when resolving, don't call set_is_default.
10152 * testsuite/ver_test_7.cc: New file.
10153 * testsuite/ver_test_7.sh: New file.
10154 * testsuite/Makefile.am (ver_test_7.so): New target.
10155 (ver_test_7.o): New target.
10156 (check_SCRIPTS): Add ver_test_7.sh.
10157 (check_DATA): Add ver_test_7.syms.
10158 (ver_test_7.syms): New target.
10160 2008-03-28 Ian Lance Taylor <iant@google.com>
10162 * layout.cc (Layout::layout): If we see an input section with a
10163 name that needs sorting, set the must_sort flag for the output
10165 (Layout::make_output_section): If the name of the output section
10166 indicates that it might require sorting, set the may_sort flag.
10167 * output.h (Output_section::may_sort_attached_input_sections): New
10169 (Output_section::set_may_sort_attached_input_sections): New
10171 (Output_section::must_sort_attached_input_sections): New
10173 (Output_section::set_must_sort_attached_input_sections): New
10175 (class Output_section): Declare Input_section_sort_entry. Define
10176 Input_section_sort_compare. Declare
10177 sort_attached_input_sections. Add new fields:
10178 may_sort_attached_input_sections_,
10179 must_sort_attached_input_sections_,
10180 attached_input_sections_are_sorted_.
10181 * output.cc (Output_section::Output_section): Initialize new
10183 (Output_section::add_input_section): Add an entry to
10184 input_sections_ if may_sort or must_sort are true.
10185 (Output_section::set_final_data_size): Call
10186 sort_attached_input_sections if necessary.
10187 (Output_section::Input_section_sort_entry): Define new class.
10188 (Output_section::Input_section_sort_compare::operator()): New
10190 (Output_section::sort_attached_input_sections): New function.
10191 * configure.ac: Check whether the compiler supports constructor
10192 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10193 * testsuite/initpri1.c: New file.
10194 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10195 CONSTRUCTOR_PRIORITY.
10196 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10197 (initpri1_LDFLAGS): New variable.
10198 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10200 2008-03-27 Ian Lance Taylor <iant@google.com>
10202 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10203 * testsuite/common_test_1.c: New file.
10204 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10205 (common_test_1_SOURCES): New variable.
10206 (common_test_1_DEPENDENCIES): New variable.
10207 (common_test_1_LDFLAGS): New variable.
10209 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10210 and commons_ correctly when NAME/VERSION does not override
10212 * testsuite/ver_test_6.c: New file.
10213 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10214 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10215 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10217 2008-03-26 Ian Lance Taylor <iant@google.com>
10219 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10220 of an undefined symbol from a version script.
10221 * testsuite/Makefile.am (ver_test_5.so): New target.
10222 (ver_test_5.o): New target.
10223 (check_SCRIPTS): Add ver_test_5.sh.
10224 (check_DATA): Add ver_test_5.syms.
10225 (ver_test_5.syms): New target.
10226 * testsuite/ver_test_5.cc: New file.
10227 * testsuite/ver_test_5.script: New file.
10228 * testsuite/ver_test_5.sh: New file.
10229 * Makefile.in, testsuite/Makefile.in: Rebuild.
10232 Fix problems building gold with gcc 4.3.0.
10233 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10234 (gold_error_at_location, gold_warning_at_location): Use it.
10235 * configure.ac: Check whether we can compile and use a template
10236 function with a printf attribute.
10237 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10238 when jumping over bytes.
10239 * object.cc: Instantiate Object::read_section_data.
10240 * debug.h: Include <cstring>
10241 * dwarf_reader.cc: Include <algorithm>
10242 * main.cc: Include <cstring>.
10243 * options.cc: Include <cstring>.
10244 * output.cc: Include <cstring>.
10245 * script.cc: Include <cstring>.
10246 * script.h: Include <string>.
10247 * symtab.cc: Include <cstring> and <algorithm>.
10248 * target-select.cc: Include <cstring>.
10249 * version.cc: Include <string>.
10250 * testsuite/testmain.cc: Include <cstdlib>.
10251 * configure, config.in: Rebuild.
10253 2008-03-25 Ian Lance Taylor <iant@google.com>
10255 * options.cc: Include "../bfd/bfdver.h".
10256 (options::help): Print bug reporting address.
10258 * version.cc (print_version): Adjust output for current value of
10259 BFD_VERSION_STRING.
10263 * options.cc (options::help): Print list of supported targets.
10264 * target-select.h: Include <vector>.
10265 (class Target_selector): Make machine_, size_, and is_big_endian_
10266 fields const. Add bfd_name_ and instantiated_target_ fields.
10267 (Target_selector::Target_selector): Add bfd_name parameter.
10268 (Target_selector::recognize): Make non-virtual, call
10270 (Target_selector::recognize_by_name): Make non-virtual, call
10271 do_recognize_by_name.
10272 (Target_selector::supported_names): New function.
10273 (Target_selector::bfd_name): New function.
10274 (Target_selector::do_instantiate_target): New pure virtual
10276 (Target_selector::do_recognize): New virtual function.
10277 (Target_selector::do_recognize_by_name): New virtual function.
10278 (Target_selector::instantiate_target): New private function.
10279 (supported_target_names): Declare.
10280 * target-select.cc (Target_selector::Target_selector): Update for
10281 new parameter and fields.
10282 (select_target_by_name): Check that the name matches before
10283 calling recognize_by_name.
10284 (supported_target_names): New function.
10285 * i386.cc (class Target_selector_i386): Update Target_selector
10286 constructor call. Remove recognize and recognize_by_name. Add
10287 do_instantiate_target.
10288 * x86_64.cc (class Target_selector_x86_64): Likewise.
10289 * testsuite/testfile.cc (class Target_selector_test): Update for
10290 changes to Target_selector.
10292 * README: Rewrite, with some notes on unsupported features.
10294 2008-03-24 Cary Coutant <ccoutant@google.com>
10296 * i386.cc (Target_i386::Got_type): New enum declaration.
10297 (Target_i386::Scan::local): Updated callers of Output_data_got
10299 (Target_i386::Scan::global): Likewise.
10300 (Target_i386::Relocate::relocate): Likewise.
10301 (Target_i386::Relocate::relocate_tls): Likewise.
10302 * object.h (Got_offset_list): New class.
10303 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10304 (Sized_relobj::local_got_offset): Likewise.
10305 (Sized_relobj::set_local_got_offset): Likewise.
10306 (Sized_relobj::local_has_tls_got_offset): Removed.
10307 (Sized_relobj::local_tls_got_offset): Removed.
10308 (Sized_relobj::set_local_tls_got_offset): Removed.
10309 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10310 * output.cc (Output_data_got::add_global): Added got_type parameter.
10311 (Output_data_got::add_global_with_rel): Likewise.
10312 (Output_data_got::add_global_with_rela): Likewise.
10313 (Output_data_got::add_global_pair_with_rel): New function.
10314 (Output_data_got::add_global_pair_with_rela): New function.
10315 (Output_data_got::add_local): Added got_type parameter.
10316 (Output_data_got::add_local_with_rel): Likewise.
10317 (Output_data_got::add_local_with_rela): Likewise.
10318 (Output_data_got::add_local_pair_with_rel): New function.
10319 (Output_data_got::add_local_pair_with_rela): New function.
10320 (Output_data_got::add_global_tls): Removed.
10321 (Output_data_got::add_global_tls_with_rel): Removed.
10322 (Output_data_got::add_global_tls_with_rela): Removed.
10323 (Output_data_got::add_local_tls): Removed.
10324 (Output_data_got::add_local_tls_with_rel): Removed.
10325 (Output_data_got::add_local_tls_with_rela): Removed.
10326 * output.h (Output_data_got::add_global): Added got_type parameter.
10327 (Output_data_got::add_global_with_rel): Likewise.
10328 (Output_data_got::add_global_with_rela): Likewise.
10329 (Output_data_got::add_global_pair_with_rel): New function.
10330 (Output_data_got::add_global_pair_with_rela): New function.
10331 (Output_data_got::add_local): Added got_type parameter.
10332 (Output_data_got::add_local_with_rel): Likewise.
10333 (Output_data_got::add_local_with_rela): Likewise.
10334 (Output_data_got::add_local_pair_with_rel): New function.
10335 (Output_data_got::add_local_pair_with_rela): New function.
10336 (Output_data_got::add_global_tls): Removed.
10337 (Output_data_got::add_global_tls_with_rel): Removed.
10338 (Output_data_got::add_global_tls_with_rela): Removed.
10339 (Output_data_got::add_local_tls): Removed.
10340 (Output_data_got::add_local_tls_with_rel): Removed.
10341 (Output_data_got::add_local_tls_with_rela): Removed.
10342 * resolve.cc (Symbol::override_base_with_special): Removed
10343 reference to has_got_offset_ field.
10344 * symtab.cc (Symbol::init_fields): Replaced initialization
10345 of got_offset_ with got_offsets_. Removed initialization
10347 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10348 (Symbol::got_offset): Likewise.
10349 (Symbol::set_got_offset): Likewise.
10350 (Symbol::has_tls_got_offset): Removed.
10351 (Symbol::tls_got_offset): Removed.
10352 (Symbol::set_tls_got_offset): Removed.
10353 (Symbol::got_offset_): Removed.
10354 (Symbol::tls_mod_got_offset_): Removed.
10355 (Symbol::tls_pair_got_offset_): Removed.
10356 (Symbol::got_offsets_): New field.
10357 (Symbol::has_got_offset): Removed.
10358 (Symbol::has_tls_mod_got_offset): Removed.
10359 (Symbol::has_tls_pair_got_offset): Removed.
10360 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10361 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10363 (Target_x86_64::Scan::global): Likewise.
10364 (Target_x86_64::Relocate::relocate): Likewise.
10365 (Target_x86_64::Relocate::relocate_tls): Likewise.
10367 2008-03-25 Ben Elliston <bje@au.ibm.com>
10369 * yyscript.y: Fix spelling error in comment.
10371 2008-03-24 Ian Lance Taylor <iant@google.com>
10373 * options.h (class General_options): Define build_id option.
10374 * layout.h (class Layout): Declare write_build_id, create_note,
10375 create_build_id. Add build_id_note_ member.
10376 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10377 "libiberty.h", "md5.h", "sha1.h".
10378 (Layout::Layout): Initialize eh_frame_data_,
10379 eh_frame_hdr_section_, and build_id_note_.
10380 (Layout::finalize): Call create_build_id.
10381 (Layout::create_note): New function, broken out of
10382 Layout::create_gold_note.
10383 (Layout::create_gold_note): Call create_note.
10384 (Layout::create_build_id): New function.
10385 (Layout::write_build_id): New function.
10386 (Close_task_runner::run): Call write_build_id.
10388 * x86_64.cc: Correct license to GPLv3.
10390 2008-03-23 Ian Lance Taylor <iant@google.com>
10392 * options.cc: Include "demangle.h".
10393 (parse_optional_string): New function.
10394 (parse_long_option): Handle takes_optional_argument.
10395 (parse_short_option): Update dash_z initializer. Handle
10396 takes_optional_argument.
10397 (General_options::General_options): Initialize do_demangle_.
10398 (General_options::finalize): Set do_demangle_. Handle demangling
10400 * options.h (parse_optional_string): Declare.
10401 (struct One_option): Add optional_arg field. Update constructor.
10402 Update call constructor calls. Add takes_optional_argument
10404 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10405 (DEFINE_optional_string): Define.
10406 (General_options::demangle): Change from DEFINE_bool to
10407 DEFINE_optional_string.
10408 (General_options::no_demangle): New function.
10409 (General_options::do_demangle): New function.
10410 (General_options::set_do_demangle): New function.
10411 (General_options::execstack_status_): Move definition to end of
10413 (General_options::static_): Likewise.
10414 (General_options::do_demangle_): New field.
10415 * object.cc (big_endian>::get_symbol_location_info): Call
10416 Options::do_demangle, not Options::demangle.
10417 * symtab.cc (demangle): Likewise.
10419 2008-03-22 Ian Lance Taylor <iant@google.com>
10421 * gold.h: Include <cstddef> and <sys/types.h>
10422 * options.h: Include <cstring>.
10424 2008-03-21 Ian Lance Taylor <iant@google.com>
10426 * Added source code to GNU binutils.