1 2011-04-20 Cary Coutant <ccoutant@google.com>
4 * archive.h (Incremental_archive_entry::Archive_member):
5 Initialize arg_serial_ (second constructor).
7 2011-04-17 Ian Lance Taylor <iant@google.com>
9 * object.cc (Relocate_info::location): Simplify location string.
10 * errors.cc (Errors::error_at_location): Don't print program
12 (Errors::warning_at_location): Likewise.
13 (Errors::undefined_symbol): Likewise.
14 * testsuite/debug_msg.sh: Update accordingly.
16 2011-04-14 Cary Coutant <ccoutant@google.com>
18 * gold/layout.cc (Layout::symtab_section_offset): New function.
19 * gold/layout.h (Layout::symtab_section_offset): New function.
20 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
22 2011-04-12 Ian Lance Taylor <iant@google.com>
24 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
26 * output.h (class Output_file): Add map_is_allocated_ field.
27 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
28 not available, provide stubs. If mremap is not available, #define
30 (MREMAP_MAYMOVE): Define if not defined.
31 (Output_file::Output_file): Initialize map_is_allocated_.
32 (Output_file::resize): Check map_is_allocated_.
33 (Output_file::map_anonymous): If mmap fails, use malloc.
34 (Output_file::unmap): Don't do anything for an anonymous map.
35 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
36 is not available, provide stubs.
37 (File_read::View::~View): Use free rather than delete[].
38 (File_read::make_view): Use malloc rather than new[]. If mmap
40 (File_read::find_or_make_view): Use malloc rather than new[].
41 * gold.h: Remove HAVE_REMAP code.
42 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
43 exists. Rename mremap to gold_mremap. If mmap is not available
45 * configure, config.in: Rebuild.
47 2011-04-11 Ian Lance Taylor <iant@google.com>
49 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
50 initialize local variable v.
52 2011-04-11 Cary Coutant <ccoutant@google.com>
54 * archive.cc (Archive::include_member): Adjust call to
56 (Add_archive_symbols::run): Track argument serial numbers.
57 (Lib_group::include_member): Likewise.
58 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
59 * archive.h (Incremental_archive_entry::Archive_member):
60 Initialize arg_serial_.
61 (Archive_member::arg_serial_): New data member.
62 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
63 (Sized_dynobj::do_add_symbols): Track symbols when doing an
65 (Sized_dynobj::do_for_all_local_got_entries): New function.
66 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
68 * fileread.cc (get_mtime): New function.
69 * fileread.h (get_mtime): New function.
70 * gold.cc (queue_initial_tasks): Check for incremental update.
71 (process_incremental_input): New function.
72 (queue_middle_tasks): Don't force valid target for incremental
74 * incremental-dump.cc (find_input_containing_global): Adjust
75 size of symbol info entry.
76 (dump_incremental_inputs): Dump argument serial number and
77 in_system_directory flag; bias shndx by 1; print symbol names
78 when dumping per-file symbol lists; use new symbol info readers.
80 (Output_section_incremental_inputs:update_data_size): New function.
81 (Sized_incremental_binary::setup_readers): Setup input readers
82 for each input file; build maps for files added from libraries
84 (Sized_incremental_binary::check_input_args): New function.
85 (Sized_incremental_binary::do_check_inputs): Build map of argument
86 serial numbers to input arguments.
87 (Sized_incremental_binary::do_file_has_changed): Rename
88 do_file_is_unchanged to this; compare file modification times.
89 (Sized_incremental_binary::do_init_layout): New function.
90 (Sized_incremental_binary::do_reserve_layout): New function.
91 (Sized_incremental_binary::do_get_input_reader): Remove.
92 (Sized_incremental_binary::get_symtab_view): New function.
93 (Incremental_checker::can_incrementally_link_output_file): Remove.
94 (Incremental_inputs::report_command_line): Exclude --debug options.
95 (Incremental_inputs::report_archive_begin): Add parameter; track
96 argument serial numbers; don't put input file entry for archive
97 before archive members.
98 (Incremental_inputs::report_archive_end): Put input file entry
99 for archive after archive members.
100 (Incremental_inputs::report_object): Add parameter; track argument
101 serial numbers and in_system_directory flag.
102 (Incremental_inputs::report_script): Add parameter; track argument
104 (Output_section_incremental_inputs::set_final_data_size): Adjust
105 size of symbol info entry; check for forwarding symbols.
106 (Output_section_incremental_inputs::write_input_files): Write
107 in_system_directory flag and argument serial number.
108 (Output_section_incremental_inputs::write_info_blocks): Map section
109 indices between incremental info and original input file; store
110 input section index for each symbol.
111 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
112 change operator() to visit().
113 (class Global_got_offset_visitor): Likewise.
114 (class Global_symbol_visitor_got_plt):
115 (Output_section_incremental_inputs::write_got_plt): Use new visitor
117 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
118 (Sized_incr_relobj::do_read_symbols): New function.
119 (Sized_incr_relobj::do_layout): New function.
120 (Sized_incr_relobj::do_layout_deferred_sections): New function.
121 (Sized_incr_relobj::do_add_symbols): New function.
122 (Sized_incr_relobj::do_should_include_member): New function.
123 (Sized_incr_relobj::do_for_all_global_symbols): New function.
124 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
125 (Sized_incr_relobj::do_section_size): New function.
126 (Sized_incr_relobj::do_section_name): New function.
127 (Sized_incr_relobj::do_section_contents): New function.
128 (Sized_incr_relobj::do_section_flags): New function.
129 (Sized_incr_relobj::do_section_entsize): New function.
130 (Sized_incr_relobj::do_section_address): New function.
131 (Sized_incr_relobj::do_section_type): New function.
132 (Sized_incr_relobj::do_section_link): New function.
133 (Sized_incr_relobj::do_section_info): New function.
134 (Sized_incr_relobj::do_section_addralign): New function.
135 (Sized_incr_relobj::do_initialize_xindex): New function.
136 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
137 (Sized_incr_relobj::do_read_relocs): New function.
138 (Sized_incr_relobj::do_gc_process_relocs): New function.
139 (Sized_incr_relobj::do_scan_relocs): New function.
140 (Sized_incr_relobj::do_count_local_symbols): New function.
141 (Sized_incr_relobj::do_finalize_local_symbols): New function.
142 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
143 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
144 (Sized_incr_relobj::do_relocate): New function.
145 (Sized_incr_relobj::do_set_section_offset): New function.
146 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
147 (Sized_incr_dynobj::do_read_symbols): New function.
148 (Sized_incr_dynobj::do_layout): New function.
149 (Sized_incr_dynobj::do_add_symbols): New function.
150 (Sized_incr_dynobj::do_should_include_member): New function.
151 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
152 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
153 (Sized_incr_dynobj::do_section_size): New function.
154 (Sized_incr_dynobj::do_section_name): New function.
155 (Sized_incr_dynobj::do_section_contents): New function.
156 (Sized_incr_dynobj::do_section_flags): New function.
157 (Sized_incr_dynobj::do_section_entsize): New function.
158 (Sized_incr_dynobj::do_section_address): New function.
159 (Sized_incr_dynobj::do_section_type): New function.
160 (Sized_incr_dynobj::do_section_link): New function.
161 (Sized_incr_dynobj::do_section_info): New function.
162 (Sized_incr_dynobj::do_section_addralign): New function.
163 (Sized_incr_dynobj::do_initialize_xindex): New function.
164 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
165 (make_sized_incremental_object): New function.
166 (Incremental_library::copy_unused_symbols): New function.
167 (Incremental_library::do_for_all_unused_symbols): New function.
168 * incremental.h (enum Incremental_input_flags): New type.
169 (class Incremental_checker): Remove.
170 (Incremental_input_entry::Incremental_input_entry): Add argument
172 (Incremental_input_entry::arg_serial): New function.
173 (Incremental_input_entry::set_is_in_system_directory): New function.
174 (Incremental_input_entry::is_in_system_directory): New function.
175 (Incremental_input_entry::arg_serial_): New data member.
176 (Incremental_input_entry::is_in_system_directory_): New data member.
177 (class Script_info): Move here from script.h.
178 (Script_info::Script_info): Add filename parameter.
179 (Script_info::filename): New function.
180 (Script_info::filename_): New data member.
181 (Incremental_script_entry::Incremental_script_entry): Add argument
183 (Incremental_object_entry::Incremental_object_entry): Likewise.
184 (Incremental_object_entry::add_input_section): Build list of input
185 sections with map to original shndx.
186 (Incremental_object_entry::get_input_section_index): New function.
187 (Incremental_object_entry::shndx_): New data member.
188 (Incremental_object_entry::name_key_): Rename; adjust all refs.
189 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
190 (Incremental_archive_entry::Incremental_archive_entry): Add argument
192 (Incremental_inputs::report_archive_begin): Likewise.
193 (Incremental_inputs::report_object): Likewise.
194 (Incremental_inputs::report_script): Likewise.
195 (class Incremental_global_symbol_reader): New class.
196 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
197 and store flags and input file type.
198 (Incremental_input_entry_reader::arg_serial): New function.
199 (Incremental_input_entry_reader::type): Extract type from flags.
200 (Incremental_input_entry_reader::is_in_system_directory): New function.
201 (Incremental_input_entry_reader::get_input_section_count): Call
202 accessor function for type.
203 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
204 function for type; adjust size of global symbol entry.
205 (Incremental_input_entry_reader::get_global_symbol_count): Call
206 accessor function for type.
207 (Incremental_input_entry_reader::get_object_count): Likewise.
208 (Incremental_input_entry_reader::get_object_offset): Likewise.
209 (Incremental_input_entry_reader::get_member_count): Likewise.
210 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
211 (Incremental_input_entry_reader::get_member_offset): Likewise.
212 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
213 (Incremental_input_entry_reader::Global_symbol_info): Remove.
214 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
215 (Incremental_input_entry_reader::get_global_symbol_reader): New
217 (Incremental_input_entry_reader::get_output_symbol_index): New
219 (Incremental_input_entry_reader::type_): Remove.
220 (Incremental_input_entry_reader::flags_): New data member.
221 (Incremental_inputs_reader::input_file_offset): New function.
222 (Incremental_inputs_reader::input_file_index): New function.
223 (Incremental_inputs_reader::input_file): Call input_file_offset.
224 (Incremental_inputs_reader::input_file_at_offset): New function.
225 (Incremental_relocs_reader::get_r_type): Reformat.
226 (Incremental_relocs_reader::get_r_shndx): Reformat.
227 (Incremental_relocs_reader::get_r_offset): Reformat.
228 (Incremental_relocs_reader::data): New function.
229 (Incremental_binary::Incremental_binary): Initialize new data members.
230 (Incremental_binary::check_inputs): Add cmdline parameter.
231 (Incremental_binary::file_is_unchanged): Remove.
232 (Input_reader::arg_serial): New function.
233 (Input_reader::get_unused_symbol_count): New function.
234 (Input_reader::get_unused_symbol): New function.
235 (Input_reader::do_arg_serial): New function.
236 (Input_reader::do_get_unused_symbol_count): New function.
237 (Input_reader::do_get_unused_symbol): New function.
238 (Incremental_binary::input_file_count): New function.
239 (Incremental_binary::get_input_reader): Change signature to use
240 index instead of filename.
241 (Incremental_binary::file_has_changed): New function.
242 (Incremental_binary::get_input_argument): New function.
243 (Incremental_binary::get_library): New function.
244 (Incremental_binary::get_script_info): New function.
245 (Incremental_binary::init_layout): New function.
246 (Incremental_binary::reserve_layout): New function.
247 (Incremental_binary::output_file): New function.
248 (Incremental_binary::do_check_inputs): New function.
249 (Incremental_binary::do_file_is_unchanged): Remove.
250 (Incremental_binary::do_file_has_changed): New function.
251 (Incremental_binary::do_init_layout): New function.
252 (Incremental_binary::do_reserve_layout): New function.
253 (Incremental_binary::do_input_file_count): New function.
254 (Incremental_binary::do_get_input_reader): Change signature.
255 (Incremental_binary::input_args_map_): New data member.
256 (Incremental_binary::library_map_): New data member.
257 (Incremental_binary::script_map_): New data member.
258 (Sized_incremental_binary::Sized_incremental_binary): Initialize
260 (Sized_incremental_binary::output_section): New function.
261 (Sized_incremental_binary::inputs_reader): Add const.
262 (Sized_incremental_binary::symtab_reader): Add const.
263 (Sized_incremental_binary::relocs_reader): Add const.
264 (Sized_incremental_binary::got_plt_reader): Add const.
265 (Sized_incremental_binary::get_symtab_view): New function.
266 (Sized_incremental_binary::Inputs_reader): New typedef.
267 (Sized_incremental_binary::Input_entry_reader): New typedef.
268 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
269 (Sized_incremental_binary::do_file_is_unchanged): Remove.
270 (Sized_incremental_binary::do_file_has_changed): New function.
271 (Sized_incremental_binary::do_init_layout): New function.
272 (Sized_incremental_binary::do_reserve_layout): New function.
273 (Sized_input_reader::Inputs_reader): Remove.
274 (Sized_input_reader::Input_entry_reader): Remove.
275 (Sized_input_reader::do_arg_serial): New function.
276 (Sized_input_reader::do_get_unused_symbol_count): New function.
277 (Sized_input_reader::do_get_unused_symbol): New function.
278 (Sized_incremental_binary::do_input_file_count): New function.
279 (Sized_incremental_binary::do_get_input_reader): Change signature;
280 use index instead of filename.
281 (Sized_incremental_binary::section_map_): New data member.
282 (Sized_incremental_binary::input_entry_readers_): New data member.
283 (class Sized_incr_relobj): New class.
284 (class Sized_incr_dynobj): New class.
285 (make_sized_incremental_object): New function.
286 (class Incremental_library): New class.
287 * layout.cc (Free_list::num_lists): New static data member.
288 (Free_list::num_nodes): New static data member.
289 (Free_list::num_removes): New static data member.
290 (Free_list::num_remove_visits): New static data member.
291 (Free_list::num_allocates): New static data member.
292 (Free_list::num_allocate_visits): New static data member.
293 (Free_list::init): New function.
294 (Free_list::remove): New function.
295 (Free_list::allocate): New function.
296 (Free_list::dump): New function.
297 (Free_list::print_stats): New function.
298 (Layout_task_runner::run): Resize output file for incremental updates.
299 (Layout::Layout): Initialize new data members.
300 (Layout::set_incremental_base): New function.
301 (Layout::init_fixed_output_section): New function.
302 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
304 (Layout::create_gold_note): Do not create gold note section for
306 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
307 for incremental updates.
308 (Layout::set_section_offsets): For incremental updates, allocate space
310 (Layout::create_symtab_sections): Layout with offsets relative to
311 start of section; for incremental updates, allocate space from free
313 (Layout::create_shdrs): For incremental updates, allocate space from
315 (Layout::finish_dynamic_section): For incremental updates, do not
316 check --as-needed (fixed in subsequent patch).
317 * layout.h (class Free_list): New class.
318 (Layout::set_incremental_base): New function.
319 (Layout::incremental_base): New function.
320 (Layout::init_fixed_output_section): New function.
321 (Layout::allocate): New function.
322 (Layout::incremental_base_): New data member.
323 (Layout::free_list_): New data member.
324 * main.cc (main): Print Free_list statistics.
325 * object.cc (Relobj::finalize_incremental_relocs): Add
326 clear_counts parameter; clear counts only when clear_counts is set.
327 (Sized_relobj::Sized_relobj): Initialize new base class.
328 (Sized_relobj::do_layout): Don't report special sections.
329 (Sized_relobj::do_for_all_local_got_entries): New function.
330 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
331 symtab_off to all symbol table offsets.
332 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
333 * object.h (class Got_offset_list): Move to top of file.
334 (Object::Object): Allow case where input_file == NULL.
335 (Object::~Object): Likewise.
336 (Object::input_file): Assert that input_file != NULL.
337 (Object::lock): Allow case where input_file == NULL.
338 (Object::unlock): Likewise.
339 (Object::is_locked): Likewise.
340 (Object::token): Likewise.
341 (Object::release): Likewise.
342 (Object::is_incremental): New function.
343 (Object::get_mtime): New function.
344 (Object::for_all_local_got_entries): New function.
345 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
346 (Object::set_is_in_system_directory): New function.
347 (Object::is_in_system_directory): New function.
348 (Object::do_is_incremental): New function.
349 (Object::do_get_mtime): New function.
350 (Object::do_for_all_local_got_entries): New function.
351 (Object::is_in_system_directory_): New data member.
352 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
353 (class Sized_relobj_base): New class.
354 (class Sized_relobj): Derive from Sized_relobj_base.
355 (class Sized_relobj::Symbols): Redeclare from base class.
356 (class Sized_relobj::local_got_offset_list): Remove.
357 (class Sized_relobj::Output_sections): Redeclare from base class.
358 (class Sized_relobj::do_for_all_local_got_entries): New function.
359 (class Sized_relobj::write_local_symbols): Add offset parameter.
360 (class Sized_relobj::local_symbol_offset_): Update comment.
361 (class Sized_relobj::local_dynsym_offset_): Update comment.
362 * options.cc (Input_arguments::add_file): Remove const.
363 * options.h (Input_file_argument::Input_file_argument):
364 Initialize arg_serial_ (all constructors).
365 (Input_file_argument::set_arg_serial): New function.
366 (Input_file_argument::arg_serial): New function.
367 (Input_file_argument::arg_serial_): New data member.
368 (Input_arguments::Input_arguments): Initialize file_count_.
369 (Input_arguments::add_file): Remove const.
370 (Input_arguments::number_of_input_files): New function.
371 (Input_arguments::file_count_): New data member.
372 (Command_line::number_of_input_files): Call
373 Input_arguments::number_of_input_files.
374 * output.cc (Output_segment_headers::Output_segment_headers):
376 (Output_section::Input_section::current_data_size): New function.
377 (Output_section::Output_section): Initialize new data members.
378 (Output_section::add_input_section): Don't do merge sections for
379 an incremental link; allocate space from free list for an
381 (Output_section::add_output_section_data): Allocate space from
382 free list for an incremental update.
383 (Output_section::update_data_size): New function.
384 (Output_section::set_fixed_layout): New function.
385 (Output_section::reserve): New function.
386 (Output_segment::set_section_addresses): Remove const.
387 (Output_segment::set_section_list_addresses): Remove const; allocate
388 space from free list for an incremental update.
389 (Output_segment::set_offset): Adjust size of RELRO segment for an
391 * output.h (Output_data::current_data_size): Move here from
393 (Output_data::pre_finalize_data_size): New function.
394 (Output_data::update_data_size): New function.
395 (Output_section_headers::update_data_size): new function.
396 (Output_section_data_build::current_data_size): Move to Output_data.
397 (Output_data_strtab::update_data_size): New function.
398 (Output_section::current_data_size): Move to Output_data.
399 (Output_section::set_fixed_layout): New function.
400 (Output_section::has_fixed_layout): New function.
401 (Output_section::reserve): New function.
402 (Output_section::update_data_size): New function.
403 (Output_section::has_fixed_layout_): New data member.
404 (Output_section::free_list_): New data member.
405 (Output_segment::set_section_addresses): Remove const.
406 (Output_segment::set_section_list_addresses): Remove const.
407 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
409 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
411 * readsyms.cc (Read_symbols::do_read_symbols): Add library
412 parameter when calling Add_symbols constructor; store argument
413 serial number for members of a lib group.
414 (Add_symbols::locks): Allow case where token == NULL.
415 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
416 (Read_member::~Read_member): New function.
417 (Read_member::is_runnable): New function.
418 (Read_member::locks): New function.
419 (Read_member::run): New function.
420 (Check_script::~Check_script): New function.
421 (Check_script::is_runnable): New function.
422 (Check_script::locks): New function.
423 (Check_script::run): New function.
424 (Check_library::~Check_library): New function.
425 (Check_library::is_runnable): New function.
426 (Check_library::locks): New function.
427 (Check_library::run): New function.
428 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
429 (Add_symbols::library_): New data member.
430 (class Read_member): New class.
431 (class Check_script): New class.
432 (class Check_library): New class.
433 * reloc.cc (Read_relocs::is_runnable): Allow case where
435 (Read_relocs::locks): Likewise.
436 (Scan_relocs::locks): Likewise.
437 (Relocate_task::locks): Likewise.
438 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
440 (Sized_relobj::incremental_relocs_scan): Fix comment.
441 (Sized_relobj::do_relocate): Pass output file offset to
443 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
444 from class declaration.
445 * script.cc (read_input_script): Allocate Script_info; pass
446 argument serial number to report_script.
447 * script.h (class Script_info): Move to incremental.h.
448 * symtab.cc (Symbol_table::add_from_incrobj): New function.
449 * symtab.h (Symbol_table::add_from_incrobj): New function.
450 (Symbol_table::set_file_offset): New function.
452 2011-04-05 Cary Coutant <ccoutant@google.com>
454 * incremental-dump.cc (dump_incremental_inputs): Change signature
455 to take a Sized_incremental_binary; change caller. Use readers
456 in Sized_incremental_binary.
458 (Sized_incremental_binary::find_incremental_inputs_sections):
459 Rename do_find_incremental_inputs_sections to this.
460 (Sized_incremental_binary::setup_readers): New function.
461 (Sized_incremental_binary::do_check_inputs): Check
462 has_incremental_info_ flag; move setup code to setup_readers;
464 (Sized_incremental_binary::do_file_is_unchanged): New function.
465 (Sized_incremental_binary::do_get_input_reader): New function.
466 * incremental.h (class Incremental_binary): Move to end of file.
467 (Incremental_binary::file_is_unchanged): New function.
468 (Incremental_binary::do_file_is_unchanged): New function.
469 (Incremental_binary::Input_reader): New class.
470 (Incremental_binary::get_input_reader): New function.
471 (class Sized_incremental_binary): Move to end of file.
472 (Sized_incremental_binary::Sized_incremental_binary): Setup the
473 input section reader classes.
474 (Sized_incremental_binary::has_incremental_info): New function.
475 (Sized_incremental_binary::inputs_reader): New function.
476 (Sized_incremental_binary::symtab_reader): New function.
477 (Sized_incremental_binary::relocs_reader): New function.
478 (Sized_incremental_binary::got_plt_reader): New function.
479 (Sized_incremental_binary::do_file_is_unchanged): New function.
480 (Sized_incremental_binary::Sized_input_reader): New class.
481 (Sized_incremental_binary::get_input_reader): New function.
482 (Sized_incremental_binary::find_incremental_inputs_sections):
483 Rename do_find_incremental_inputs_sections to this.
484 (Sized_incremental_binary::setup_readers): New function.
485 (Sized_incremental_binary::has_incremental_info_): New data member.
486 (Sized_incremental_binary::inputs_reader_): New data member.
487 (Sized_incremental_binary::symtab_reader_): New data member.
488 (Sized_incremental_binary::relocs_reader_): New data member.
489 (Sized_incremental_binary::got_plt_reader_): New data member.
490 (Sized_incremental_binary::current_input_file_): New data member.
492 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
495 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
498 2011-03-30 Cary Coutant <ccoutant@google.com>
500 * archive.cc (Archive::include_member): Adjust call to report_object.
501 (Add_archive_symbols::run): Add script_info to call to
502 report_archive_begin.
503 (Lib_group::include_member): Adjust call to report_object.
504 (Add_lib_group_symbols::run): Adjust call to report_object.
505 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
506 blocks. Add object count for script input files.
507 * incremental.cc (Incremental_inputs::report_archive_begin): Add
508 script_info parameter; change all callers.
509 (Incremental_inputs::report_object): Add script_info parameter;
511 (Incremental_inputs::report_script): Store backpointer to
512 incremental info entry.
513 (Output_section_incremental_inputs::set_final_data_size): Record
514 additional information for scripts.
515 (Output_section_incremental_inputs::write_info_blocks): Likewise.
516 * incremental.h (Incremental_script_entry::add_object): New function.
517 (Incremental_script_entry::get_object_count): New function.
518 (Incremental_script_entry::get_object): New function.
519 (Incremental_script_entry::objects_): New data member; adjust
521 (Incremental_inputs::report_archive_begin): Add script_info parameter.
522 (Incremental_inputs::report_object): Add script_info parameter.
523 (Incremental_inputs_reader::get_object_count): New function.
524 (Incremental_inputs_reader::get_object_offset): New function.
525 * options.cc (Input_arguments::add_file): Return reference to
527 * options.h (Input_argument::set_script_info): New function.
528 (Input_argument::script_info): New function.
529 (Input_argument::script_info_): New data member; adjust all
531 (Input_file_group::add_file): Return reference to new input argument.
532 (Input_file_lib::add_file): Likewise.
533 (Input_arguments::add_file): Likewise.
534 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
535 * script.cc (Parser_closure::Parser_closure): Add script_info
536 parameter; adjust all callers.
537 (Parser_closure::script_info): New function.
538 (Parser_closure::script_info_): New data member.
539 (read_input_script): Report scripts earlier to incremental info.
540 (script_add_file): Set script_info in Input_argument.
541 (script_add_library): Likewise.
542 * script.h (Script_options::Script_info): Rewrite class.
544 2011-03-29 Cary Coutant <ccoutant@google.com>
546 * archive.cc (Library_base::should_include_member): Move
547 method here from class Archive.
548 (Archive::Archive): Initialize base class.
549 (Archive::should_include_member): Move to base class.
550 (Archive::do_for_all_unused_symbols): New function.
551 (Add_archive_symbols::run): Remove redundant access to
553 (Lib_group::Lib_group): Initialize base class.
554 (Lib_group::do_filename): New function.
555 (Lib_group::include_member): Pass pointer to Lib_group to
557 (Lib_group::do_for_all_unused_symbols): New function.
558 (Add_lib_group_symbols::run): Report archive information for
560 * archive.h (class Library_base): New base class.
561 (class Archive): Derive from Library_base.
562 (Archive::filename): Move to base class.
563 (Archive::set_incremental_info): Likewise.
564 (Archive::incremental_info): Likewise.
565 (Archive::Should_include): Likewise.
566 (Archive::should_include_member): Likewise.
567 (Archive::Armap_entry): Remove.
568 (Archive::Unused_symbol_iterator): Remove.
569 (Archive::unused_symbols_begin): Remove.
570 (Archive::unused_symbols_end): Remove.
571 (Archive::do_filename): New function.
572 (Archive::do_get_mtime): New function.
573 (Archive::do_for_all_unused_symbols): New function.
574 (Archive::task_): Move to base class.
575 (Archive::incremental_info_): Likewise.
576 (class Lib_group): Derive from Library_base.
577 (Lib_group::do_filename): New function.
578 (Lib_group::do_get_mtime): New function.
579 (Lib_group::do_for_all_unused_symbols): New function.
580 (Lib_group::task_): Move to base class.
581 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
583 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
585 * incremental.cc (Incremental_inputs::report_archive_begin):
586 Use Library_base; call library's get_mtime; add incremental inputs
587 entry before members.
588 (class Unused_symbol_visitor): New class.
589 (Incremental_inputs::report_archive_end): Use Library_base; use
590 visitor class to record unused symbols; don't add incremental inputs
592 (Incremental_inputs::report_object): Use Library_base.
594 (Incremental_archive_entry::Incremental_archive_entry): Remove
595 unused Archive parameter.
596 (Incremental_inputs::report_archive_begin): Use Library_base.
597 (Incremental_inputs::report_archive_end): Likewise.
598 (Incremental_inputs::report_object): Likewise.
599 * object.cc (Sized_relobj::do_for_all_global_symbols): New
601 * object.h (Object::for_all_global_symbols): New function.
602 (Object::do_for_all_global_symbols): New function.
603 (Sized_relobj::do_for_all_global_symbols): New function.
604 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
606 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
609 2011-03-27 Ian Lance Taylor <iant@google.com>
611 * archive.cc (Archive::interpret_header): Return -1 if something
612 goes wrong. Change callers accordingly.
614 2011-03-25 Cary Coutant <ccoutant@google.com>
616 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
617 * testsuite/Makefile.in: Regenerate.
619 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
621 * plugin.cc (get_view): New.
622 (Plugin::load): Pass get_view to the plugin.
623 (Plugin_manager::get_view): New.
625 2011-03-21 Ian Lance Taylor <iant@google.com>
627 * testsuite/final_layout.sh: Rewrite to not use dc.
628 * testsuite/relro_test.sh: Fail if dc is not present.
630 2011-03-21 Sriraman Tallam <tmsriram@google.com>
632 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
634 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
635 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
637 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
638 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
640 2011-03-14 Ian Lance Taylor <iant@google.com>
642 * script-sections.cc (Sort_output_sections::script_compare):
643 Rename from is_before, change return type.
644 (Sort_output_sections::operator()): Adjust accordingly.
646 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
649 * testsuite/odr_violation2.cc: Add comment to make all error line
650 numbers double digits.
651 * testsuite/debug_msg.sh: Adjust expected errors.
653 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
655 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
656 but mark earlier ones as non-canonical
657 (offset_to_iterator): Update search target and example
658 (do_addr2line): Return extra lines in a vector*
659 (format_file_lineno): Extract from do_addr2line
660 (one_addr2line): Add vector* out-param
661 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
662 when a lineno entry appeared last for its instruction
663 (Dwarf_line_info): Add vector* out-param
664 * object.cc (Relocate_info): Pass NULL for the vector* out-param
665 * symtab.cc (Odr_violation_compare): Include the lineno in the
667 (linenos_from_loc): New. Combine the canonical line for an
668 address with its other lines.
669 (True_if_intersect): New. Helper functor to make
670 std::set_intersection a query.
671 (detect_odr_violations): Compare sets of lines instead of just
672 one line for each function. This became less deterministic, but
673 has fewer false positives.
674 * symtab.h: Declarations.
675 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
676 mix an optimized and non-optimized object in the same binary
677 (odr_violation2.so): Same.
678 * testsuite/Makefile.in: Regenerate from Makefile.am.
679 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
680 * testsuite/debug_msg.sh: Update line numbers and add
682 * testsuite/odr_violation1.cc: Use OdrDerived, in a
683 non-optimized context.
684 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
685 isn't inlined, and use OdrDerived in an optimized context.
686 * testsuite/odr_header1.h: Defines OdrDerived, where
687 optimization will change the
688 first-instruction-in-the-destructor's file and line number.
689 * testsuite/odr_header2.h: Defines OdrBase.
691 2011-03-09 Ian Lance Taylor <iant@google.com>
693 * fileread.cc (File_read::clear_views): Don't delete the whole
696 2011-03-08 Ian Lance Taylor <iant@google.com>
699 * fileread.cc: #include <climits>.
700 (GOLD_IOV_MAX): Define.
701 (File_read::read_multiple): Limit number of entries by iov_max.
702 * fileread.h (class File_read): Always set max_readv_entries to
705 2011-03-07 Ian Lance Taylor <iant@google.com>
708 * options.h (class General_options): Add -dy and -dn.
710 2011-03-02 Cary Coutant <ccoutant@google.com>
712 * testsuite/script_test_9.t: Add TLS segment.
714 2011-03-02 Simon Baldwin <simonb@google.com>
716 * configure.ac: Add check for gnu_indirect_function support in
717 the toolchain building binutils.
718 * configure: Rebuild.
720 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
722 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
724 (Symbol_table::sized_finalize_symbol) Mark symbol only present
725 in plugin files as not needed in the symbol table.
727 2011-02-11 Sriraman Tallam <tmsriram@google.com>
729 * output.cc (Output_section::add_input_section): Delay fill
730 generation for section ordering.
732 2011-02-09 Ian Lance Taylor <iant@google.com>
735 * object.h (class Sized_relobj): Remove clear_local_symbols.
736 * reloc.cc (Sized_relobj::do_relocate): Don't call
739 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
741 * plugin.cc (is_visible_from_outside): Return true for symbols
744 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
746 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
749 2011-02-02 Sriraman Tallam <tmsriram@google.com>
751 * icf.h (is_section_foldable_candidate): Change type of parameter
753 * icf.cc (Icf::find_identical_sections): Change type of local variable
754 section_name to be std::string.
755 (is_function_ctor_or_dtor): Change type of parameter to std::string.
757 2011-01-25 Ian Lance Taylor <iant@google.com>
759 * script.cc (script_add_extern): Rewrite to use
760 add_symbol_reference.
762 2011-01-25 Doug Kwan <dougkwan@google.com>
764 * icf.cc (get_section_contents): Always lock section's object.
766 2011-01-24 Ian Lance Taylor <iant@google.com>
768 * options.h (class General_options): Accept
769 --no-detect-odr-violations.
771 2011-01-24 Ian Lance Taylor <iant@google.com>
773 * version.cc (version_string): Bump to 1.11.
775 2011-01-24 Ian Lance Taylor <iant@google.com>
777 * plugin.cc (class Plugin_rescan): Define new class.
778 (Plugin_manager::claim_file): Set any_claimed_.
779 (Plugin_manager::save_archive): New function.
780 (Plugin_manager::save_input_group): New function.
781 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
783 (Plugin_manager::new_undefined_symbol): New function.
784 (Plugin_manager::rescan): New function.
785 (Plugin_manager::rescannable_defines): New function.
786 (Plugin_manager::add_input_file): Set any_added_.
787 * plugin.h (class Plugin_manager): define new fields rescannable_,
788 undefined_symbols_, any_claimed_, and any_added_. Declare
789 Plugin_rescan as friend. Declare new functions.
790 (Plugin_manager::Rescannable): Define type.
791 (Plugin_manager::Rescannable_list): Define type.
792 (Plugin_manager::Undefined_symbol_list): Define type.
793 (Plugin_manager::Plugin_manager): Initialize new fields.
794 * archive.cc (Archive::defines_symbol): New function.
795 (Add_archive_symbols::run): Pass archive to plugins if any.
796 * archive.h (class Archive): Declare defines_symbol.
797 * readsyms.cc (Input_group::~Input_group): New function.
798 (Finish_group::run): Pass input_group to plugins if any.
799 * readsyms.h (class Input_group): Declare destructor.
800 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
803 2011-01-10 Ian Lance Taylor <iant@google.com>
805 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
807 (Layout::set_segment_offsets): Reset increase_relro before calling
808 set_section_addresses a second time.
810 2011-01-04 Cary Coutant <ccoutant@google.com>
812 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
813 sections before NOBITS sections.
815 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
817 * version.cc (print_version): Update copyright to 2011.
819 2010-12-23 Cary Coutant <ccoutant@google.com>
821 * output.h (Output_data_reloc::add_output_section): Pass OD instead
822 of OS to this->add. Add OD parameter to second form of the function.
824 2010-12-20 Ian Lance Taylor <iant@google.com>
826 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
827 second of two consecutive entries with same offset.
829 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
831 * testsuite/Makefile.am (ifuncmain2static_LDADD)
832 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
833 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
834 to avoid unneeded links against $(LDADD).
835 * testsuite/Makefile.in: Regenerate.
837 2010-12-15 Ian Lance Taylor <iant@google.com>
840 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
841 for R_X86_64_32 and R_X86_64_PC32.
842 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
843 ver_matching_def_pic.o.
844 (ver_matching_def_pic.o): New target.
846 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
848 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
849 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
850 Move definition before File_read::View member definitions.
851 (File_read::View::~View): Initialize and hold lock before
852 updating current_mapped_bytes.
854 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
856 * dwarf_reader.cc: Remove outdated comment.
857 * gold-threads.cc: Fix typo in error message.
858 * archive.cc: Fix typos in comments.
859 * archive.h: Likewise.
860 * arm-reloc-property.cc: Likewise.
861 * arm-reloc-property.h: Likewise.
862 * arm-reloc.def: Likewise.
864 * attributes.h: Likewise.
866 * ehframe.cc: Likewise.
867 * fileread.h: Likewise.
871 * incremental.h: Likewise.
872 * int_encoding.cc: Likewise.
873 * layout.h: Likewise.
876 * object.cc: Likewise.
877 * object.h: Likewise.
878 * options.cc: Likewise.
879 * readsyms.cc: Likewise.
880 * reduced_debug_output.cc: Likewise.
881 * reloc.cc: Likewise.
882 * script-sections.cc: Likewise.
883 * sparc.cc: Likewise.
884 * symtab.h: Likewise.
885 * target-reloc.h: Likewise.
886 * target.cc: Likewise.
887 * target.h: Likewise.
888 * timer.cc: Likewise.
890 * x86_64.cc: Likewise.
892 2010-12-09 Cary Coutant <ccoutant@google.com>
894 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
896 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
897 parameter; change all callers.
898 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
899 * options.h (warn_execstack): New option.
901 2010-12-07 Doug Kwan <dougkwan@google.com>
903 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
904 like function call relocations.
906 2010-12-07 Ian Lance Taylor <iant@google.com>
908 * archive.cc (Archive::get_elf_object_for_member): Permit
909 punconfigured to be NULL.
910 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
911 (Archive::include_member): Pass NULL to get_elf_object_for_member
912 if we searched for the archive and this is the first included
915 2010-12-01 Ian Lance Taylor <iant@google.com>
917 * dwarf_reader.h (class Sized_dwarf_line_info): Add
918 track_relocs_type_ field.
919 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
920 Set track_relocs_type_.
921 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
922 contents when using RELA relocs.
923 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
925 * reloc.cc (Track_relocs::next_addend): New function.
926 * reloc.h (class Track_relocs): Declare next_addend.
928 2010-12-01 Ian Lance Taylor <iant@google.com>
930 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
933 2010-12-01 Ian Lance Taylor <iant@google.com>
935 * README: Update compilers known to work and fail.
937 2010-11-23 Matthias Klose <doko@ubuntu.com>
939 * configure.in: For --enable-gold, handle value `default' instead of
940 `both*'. Always install ld as ld.bfd, install as ld if gold is
942 * configure: Regenerate.
944 2010-11-18 Doug Kwan <dougkwan@google.com>
946 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
947 and right_alignment to be zero. Store result alignment only if it is
948 greater than existing alignment.
950 2010-11-16 Cary Coutant <ccoutant@google.com>
953 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
954 Check for ".zdebug_line".
956 2010-11-16 Doug Kwan <dougkwan@google.com>
957 Cary Coutant <ccoutant@google.com>
959 * output.h (Output_segment::set_section_addresses): Pass increase_relro
960 by reference; adjust all callers.
961 * output.cc (Output_segment::set_section_addresses): Adjust references
962 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
964 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
965 end at page boundary.
967 2010-11-16 Cary Coutant <ccoutant@google.com>
970 * layout.cc (Layout::choose_output_section): Transform names of
971 compressed sections even when using a script with a SECTIONS clause.
972 (Layout::output_section_name): Remove code to transform
973 compressed debug section names.
974 * output.cc (Output_section::add_input_section): Use uncompressed
975 section size when tracking input sections.
977 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
979 * symtab.h (Symbol::NON_PIC_REF): Remove.
980 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
981 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
982 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
983 (Symbol::use_plt_offset): Take a flags argument and pass it
984 directly to needs_dynamic_reloc. Restrict check for undefined
985 weak symbols to function calls.
986 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
987 (Target_arm::Scan::global): Use it.
988 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
989 (Target_arm::Relocate::relocate): Likewise.
990 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
991 parameter with an r_type parameter. Use get_reference_flags
993 (Target_arm::Relocate::relocate): Update accordingly.
994 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
995 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
996 (Target_i386::Scan::global): Likewise.
997 (Target_i386::Relocate::relocate): Likewise.
998 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
999 parameter with an r_type parameter. Use get_reference_flags
1001 (Target_i386::Relocate::relocate): Update accordingly.
1002 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1003 (Target_powerpc::Scan::global): Use it.
1004 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1005 (Target_powerpc::Relocate::relocate): Likewise.
1006 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1007 (Target_sparc::Scan::global): Use it.
1008 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1009 (Target_sparc::Relocate::relocate): Likewise.
1010 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1011 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1012 (Target_x86_64::Scan::global): Likewise.
1013 (Target_x86_64::Relocate::relocate): Likewise.
1015 2010-11-08 Doug Kwan <dougkwan@google.com>
1016 Cary Coutant <ccoutant@google.com>
1018 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1019 (Arm_exidx_merge_section::section_contents_): New data member.
1020 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1021 (Arm_input_section::~Arm_input_section): De-allocate memory.
1022 (Arm_input_section::original_contents_): New data member.
1023 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1024 in parameters instead of calling Object::section_contents without
1026 (Arm_output_section::group_section): New parameter TASK. Pass it
1027 to callees that need locking objects.
1028 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1029 to lock EXIDX input sections. Fix a formatting issue. Call
1030 Arm_exidx_merged_section::build_contents to create merged section
1032 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1033 to lock object of stub table owner.
1034 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1035 TEXT_SIZE to initialize data member TEXT_SIZE_.
1036 (Arm_exidx_input_section::addralign): Fix typo in comment.
1037 (Arm_exidx_input_section::text_size): New method.
1038 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1039 that require locking objects. Lock objects before scanning for stubs
1040 and updating local symbols.
1041 (Arm_input_section<big_endian>::init): Copy contents of original
1043 (Arm_input_section<big_endian>::do_write): Use saved contents of
1044 original input section instead of calling Object::section_contents
1046 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1047 size without calling Object::section_size().
1048 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1049 for size. Allocate a buffer for merged EXIDX entries.
1050 (Arm_exidx_merged_section::build_contents): New method.
1051 (Arm_exidx_merged_section::do_write): Move merge section contents
1052 building code to Arm_exidx_merged_section::build_contetns. Write
1053 out contetns in buffer instead of building it on the fly.
1054 (Arm_relobj::make_exidx_input_section): Also pass text section size
1055 to Arm_exidx_input_section constructor.
1056 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1057 (Arm_dynobj::do_read_symbols): Fix memory leak.
1058 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1059 * target.h: (class Task): Add forward declaration.
1060 (Target::relax): Add new parameter TASK and pass it to
1062 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1064 2010-11-05 Cary Coutant <ccoutant@google.com>
1067 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1068 object when reading from the file.
1069 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1071 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1072 when reading section contents.
1073 (get_section_contents): Likewise.
1074 (icf::find_identical_sections): Likewise.
1075 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1076 object when reading from the file.
1077 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1078 the object when doing deferred section layout.
1080 2010-11-03 Nick Clifton <nickc@redhat.com>
1083 * script.h (class Symbol_assignment: name): New member. Returns
1084 the name of the symbol.
1085 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1086 Returns true if the given symbol name is on the list of
1087 assignments wating to be processed.
1088 * archive.cc (should_incldue_member): If the symbol is undefined,
1089 check to see if it is on the list of symbols pending assignment.
1091 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1093 * script-sections.cc (Script_sections::find_memory_region): Check
1094 for a NULL output section pointer.
1096 2010-10-29 Doug Kwan <dougkwan@google.com>
1098 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1099 Output_section::add_relaxed_input_section.
1100 * output.cc (Output_section::add_relaxed_input_section): Add new
1101 arguments LAYOUT and NAME. Set section order index.
1102 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1103 Copy section order index.
1104 * output.h (Output_section::add_relaxed_input_section): Add new
1105 arguments LAYOUT and NAME.
1107 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1109 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1110 NATIVE_OR_CROSS_LINKER.
1111 * testsuite/Makefile.in: Regenerate.
1113 2010-10-20 Doug Kwan <dougkwan@google.com>
1115 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1116 without SHF_LINK_ORDER flags.
1117 * layout.cc (Layout::choose_output_section): Do not filter
1118 SHF_LINK_ORDER flag in a relocatable link.
1120 2010-10-17 Cary Coutant <ccoutant@google.com>
1122 * output.h (Output_segment::set_section_addresses): Change function
1123 signature. Update all callers.
1124 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1126 (Output_segment::set_section_addresses): Align after last TLS
1127 section. Add padding before last relro section instead of after.
1129 2010-10-17 Doug Kwan <dougkwan@google.com>
1131 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1132 GOT output section to be writable.
1134 2010-10-14 Cary Coutant <ccoutant@google.com>
1136 * debug.h (DEBUG_INCREMENTAL): New flag.
1137 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1138 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1140 * incremental.cc (report_command_line): Ignore all forms of
1142 * layout.cc (Layout::Layout): Check parameters for incremental link
1144 * options.cc (General_options::parse_incremental): New function.
1145 (General_options::parse_no_incremental): New function.
1146 (General_options::parse_incremental_full): New function.
1147 (General_options::parse_incremental_update): New function.
1148 (General_options::incremental_mode_): New data member.
1149 (General_options::finalize): Check incremental_mode_.
1150 * options.h (General_options): Update help text for --incremental.
1151 Add --no-incremental, --incremental-full, --incremental-update.
1152 (General_options::Incremental_mode): New enum type.
1153 (General_options::incremental_mode): New function.
1154 (General_options::incremental_mode_): New data member.
1155 * parameters.cc (Parameters::incremental_mode_): New data member.
1156 (Parameters::set_options): Set incremental_mode_.
1157 (Parameters::set_incremental_full): New function.
1158 (Parameters::incremental): New function.
1159 (Parameters::incremental_update): New function.
1160 (set_parameters_incremental_full): New function.
1161 * parameters.h (Parameters::set_incremental_full): New function.
1162 (Parameters::incremental): New function.
1163 (Parameters::incremental_update): New function.
1164 (Parameters::incremental_mode_): New data member.
1165 (set_parameters_incremental_full): New function.
1166 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1167 incremental link mode.
1168 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1169 (Sized_relobj::do_relocate_sections): Likewise.
1170 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1172 * testsuite/Makefile.in: Regenerate.
1173 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1175 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1177 * script-sections.h (class Script_sections): Make
1178 Sections_elements typedef public.
1179 * script-sections.cc (class Sort_output_sections): Add elements_
1180 field. Add constructor which sets it; change all callers.
1181 (Sort_output_sections::is_before): New function.
1182 (Sort_output_sections::operator()): Call is_before.
1183 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1185 * testsuite/script_test_10.sh: New test. Test script section
1187 * testsuite/script_test_10.t: Likewise.
1188 * testsuite/script_test_10.s: Likewise.
1189 * testsuite/Makefile.am: Wrap the cross linker tests and the
1190 common tests into NATIVE_OR_CROSS_LINKER.
1191 (check_SCRIPTS): Add script_test_10.sh.
1192 (check_DATA): Add script_test_10.stdout.
1193 (script_test_10.o, script_test_10): New targets.
1194 (script_test_10.stdout): New target.
1195 * configure, testsuite/Makefile.in: Regenerate.
1197 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1199 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1200 error for the deprecated relocations.
1201 (Target_arm::Scan::global): Likewise.
1202 (Target_arm::Relocate::relocate): Likewise.
1204 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1206 * fileread.cc (Input_file::find_file): Initialize *found_name
1207 and *namep when using the fallback search for case 4.
1209 2010-10-11 Cary Coutant <ccoutant@google.com>
1211 * options.h (class General_options): Redefine -z lazy as an alias for
1212 the negation of -z now.
1214 2010-10-11 Ian Lance Taylor <iant@google.com>
1216 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1219 2010-10-06 Nick Clifton <nickc@redhat.com>
1221 * script-sections.cc(class Memory_region): Remove
1222 current_lma_offset_ field. Rename current_vma_offset_ to
1223 current_offset_. Add last_section_ field.
1224 (Memory_region::get_current_vma_address): Rename to
1225 get_current_address.
1226 (Memory_region::get_current_lma_address): Delete.
1227 (Memory_region::increment_vma_offset): Rename to
1229 (Memory_region::increment_lma_offset): Delete.
1230 (Memory_region::attributes_compatible): New method. Returns
1231 true if the provided section is compatible with the region.
1232 (Memory_region::get_last_section): New method. Returns the last
1233 section to use the region.
1234 (Memory_region::set_last_section): New method. Stores the last
1235 section to use the region.
1236 (Script_sections::block_in_region): New method. Returns true if
1237 a block of memory is contained within a region.
1238 (Script_sections::find_memory_region): New method. Locates a
1239 memory region to be used to set a VMA or LMA address.
1240 (Output_section_definition::set_section_addresses): Add code to
1241 check for addresses set by memory regions.
1242 (Output_segment::set_section_addresses): Remove memory region
1244 (Script_sections::create_segment): Add a warning if a header
1245 segment is created outside of any region.
1246 * script-sections.h (class Script_sections): Add prototypes for
1247 find_memory_region and block_in_region methods.
1248 * testsuite/memory_test.s: Use .long instead of .word.
1249 * testsuite/memory_test.t: Add some more output sections.
1250 * testsuite/memory_test.sh: Update expected output.
1252 2010-10-02 Doug Kwan <dougkwan@google.com>
1254 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1255 defintion to symtab.h
1256 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1257 declaration to defintion.
1259 2010-10-01 Nick Clifton <nickc@redhat.com>
1261 * expression.cc (eval): Replace dummy argument with NULL.
1262 (eval_maybe_dot): Check for a NULL result section pointer.
1263 (Symbol_expression::value): Likewise.
1264 (Dot_expression::value): Likewise.
1265 (BINARY_EXPRESSION): Likewise.
1266 (Max_expression::value): Likewise.
1267 (Min_expression::value): Likewise.
1268 (Absolute_expression::value): Likewise.
1269 (Addr_expression::value_from_output_section): Likewise.
1270 (Loaddddr_expression::value_from_output_section): Likewise.
1271 (Segment_start_expression::value): Likewise.
1272 * script-sections.cc
1273 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1275 (Sections_elememt_dot_assignment::set_section_addresses):
1277 (Output_data_expression::do_write_to_buffer): Likewise.
1278 (Output_section_definition::finalize_symbols): Likewise.
1279 (Output_section_definition::set_section_addresses): Likewise.
1281 2010-09-30 Doug Kwan <dougkwan@google.com>
1283 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1285 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1287 * target.h (Target::can_icf_inline_merge_sections): New virtual
1289 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1291 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1293 * icf.cc (get_section_contents): Inline merge sections only when
1296 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1298 * configure: Regenerate.
1300 2010-09-17 Ian Lance Taylor <iant@google.com>
1302 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1303 * testsuite/Makefile.am (memory_test.o): New target.
1304 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1306 * testsuite/Makefile.in: Rebuild.
1308 2010-09-17 Doug Kwan <dougkwan@google.com>
1310 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1311 defintion if relocation uses GOT entries of the symbol.
1312 * testsuite/icf_safe_test.sh: Fix test.
1313 * testsuite/icf_safe_so_test.sh: Fix test.
1315 2010-09-16 Cary Coutant <ccoutant@google.com>
1317 * script_sections.cc (class Memory_region): Remove "NULL" from
1318 vector initializations.
1320 2010-09-15 Cary Coutant <ccoutant@google.com>
1322 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1323 Resolve forwarding symbols.
1325 2010-09-15 Doug Kwan <dougkwan@google.com>
1327 * gold/testsuite/script_test_3.t: Add ARM special sections.
1328 * gold/testsuite/script_test_4.t: Same.
1329 * gold/testsuite/script_test_5.t: Same.
1330 * gold/testsuite/script_test_6.t: Same.
1331 * gold/testsuite/script_test_7.t: Same.
1332 * gold/testsuite/script_test_7.t: Same.
1333 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1335 2010-09-14 Cary Coutant <ccoutant@google.com>
1337 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1338 (Target_x86_64::Relocate::relocate_tls): Replace check for
1339 saw_tls_block_reloc_ with test for executable section.
1341 2010-09-12 Cary Coutant <ccoutant@google.com>
1343 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1344 position-independent executables to shared libraries need dynamic
1346 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1347 position-independent executables.
1348 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1349 * testsuite/Makefile.in: Regenerate.
1351 2010-09-10 Nick Clifton <nickc@redhat.com>
1354 * testsuite/memory_test.t: Discard any sections that are not
1357 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1360 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1361 "This::" to work around a bug in gcc 4.2.
1363 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1365 2010-09-09 Rafael Espindola <espindola@google.com>
1367 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1368 sections with different PF_X flags in the same segment.
1369 (Layout::find_first_load_seg): Search all segments to find the first
1371 * options.h (rosegment): New.
1373 2010-09-08 Rafael Espindola <espindola@google.com>
1375 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1377 2010-09-08 Doug Kwan <dougkwan@google.com>
1379 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1380 (Arm_relobj::do_relocate_sections): Add new parameter for output
1381 file to match the parent.
1382 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1383 of local symbols instead of input values. Update code to track
1384 changes in gold::relocate_section.
1385 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1386 (Sized_relobj::compute_final_local_value_internal): New methods.
1387 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1388 body into private version of Sized_relobj::compute_final_local_value.
1389 Call the inline method.
1390 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1391 merged symbol value if there is one.
1392 (Symbol_value::has_output_value): New method defintiion.
1393 (Sized_relobj::Compute_final_local_value_status): New enum type.
1394 (Sized_relobj::compute_final_local_value): New methods.
1395 (Sized_relobj::compute_final_local_value_internal): New methods.
1396 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1397 and arm_cortex_a8.sh.
1398 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1399 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1401 * Makefile.in: Regenerate.
1402 * testsuite/arm_bl_out_of_range.s: Update test.
1403 * testsuite/thumb_bl_out_of_range.s: Ditto.
1404 * testsuite/thumb_blx_out_of_range.s: Ditto.
1405 * testsuite/arm_branch_out_of_range.sh: New file.
1406 * testsuite/arm_cortex_a8.sh: Ditto.
1407 * testsuite/arm_cortex_a8_b.s: Ditto.
1408 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1409 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1410 * testsuite/arm_cortex_a8_bl.s: Ditto.
1411 * testsuite/arm_cortex_a8_blx.s: Ditto.
1412 * testsuite/arm_cortex_a8_local.s: Ditto.
1413 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1414 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1416 2010-09-08 Rafael Espindola <espindola@google.com>
1418 * Makefile.am (memory_test.stdout): Run readelf with -W.
1419 * Makefile.in: Regenerate.
1420 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1423 2010-09-08 Rafael Espindola <espindola@google.com>
1425 * script-sections.cc (Script_sections::add_memory_region): Convert
1426 field precision to int.
1427 * script.cc (script_set_section_region, script_set_section_region):
1428 Convert field precision to int.
1430 2010-09-08 Rafael Espindola <espindola@google.com>
1432 * arm.cc (do_finalize_sections): Create the __exidx_start and
1433 __exdix_end symbols even when the section is missing.
1435 2010-09-08 Nick Clifton <nickc@redhat.com>
1437 * README: Remove claim that MEMORY is not supported.
1438 * expression.cc (script_exp_function_origin)
1439 (script_exp_function_length): Move from here to ...
1440 * script.cc: ... here.
1441 (script_set_section_region, script_add_memory)
1442 (script_parse_memory_attr, script_include_directive): New
1444 * script-sections.cc
1445 (class Memory_region): New class.
1446 (class Output_section_definition): Add set_memory_region,
1447 set_section_vma, set_section_lma and get_section_name methods.
1448 (class Script_Sections): Add add_memory_region,
1449 find_memory_region, find_memory_region_origin,
1450 find_memory_region_length and set_memory_region methods.
1451 Have set_section_addresses method walk the list of set memory
1453 Extend the print methos to display memory regions.
1454 * script-sections.h: Add prototypes for new methods.
1455 Add enum for MEMORY region attributes.
1456 * yyscript.y: Add support for parsing MEMORY regions.
1457 * script-c.h: Add prototypes for new functions.
1458 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1459 * testsuite/Makefile.in: Regenerate.
1460 * testsuite/memory_test.sh: New script.
1461 * testsuite/memory_test.s: New assembler source file.
1462 * testsuite/memory_test.t: New linker script.
1464 2010-08-27 Doug Kwan <dougkwan@google.com>
1466 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1467 reference override an existing dynamic weak reference.
1468 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1469 * testsuite/Makefile.in: Regenerate.
1470 * testsuite/dyn_weak_ref.sh: New file.
1471 * testsuite/dyn_weak_ref_1.c: Ditto.
1472 * testsuite/dyn_weak_ref_2.c: Ditto.
1474 2010-08-27 Ian Lance Taylor <iant@google.com>
1476 * incremental.h (class Incremental_input_entry): Add virtual
1479 2010-08-27 Ian Lance Taylor <iant@google.com>
1481 * testsuite/start_lib_test_3.c: Mark t3 as used.
1483 2010-08-27 Nick Clifton <nickc@redhat.com>
1485 * options.cc (version_script): Fix small typo in previous
1488 2010-08-25 Nick Clifton <nickc@redhat.com>
1490 * archive.cc: Formatting fixes: Remove whitespace between
1491 typename and following asterisk. Remove whitespace between
1492 function name and opening parenthesis.
1493 * archive.h: Likewise.
1495 * attributes.cc: Likewise.
1496 * attributes.h: Likewise.
1497 * common.cc: Likewise.
1498 * copy-relocs.cc: Likewise.
1499 * dirsearch.h: Likewise.
1500 * dynobj.cc: Likewise.
1501 * ehframe.cc: Likewise.
1502 * ehframe.h: Likewise.
1503 * expression.cc: Likewise.
1504 * fileread.cc: Likewise.
1505 * fileread.h: Likewise.
1507 * gold-threads.cc: Likewise.
1508 * gold.cc: Likewise.
1509 * i386.cc: Likewise.
1511 * incremental-dump.cc: Likewise.
1512 * incremental.cc: Likewise.
1513 * layout.cc: Likewise.
1514 * layout.h: Likewise.
1515 * main.cc: Likewise.
1516 * merge.cc: Likewise.
1517 * merge.h: Likewise.
1518 * object.cc: Likewise.
1519 * object.h: Likewise.
1520 * options.cc: Likewise.
1521 * options.h: Likewise.
1522 * output.cc: Likewise.
1523 * output.h: Likewise.
1524 * plugin.cc: Likewise.
1525 * plugin.h: Likewise.
1526 * powerpc.cc: Likewise.
1527 * reloc.cc: Likewise.
1528 * script-c.h: Likewise.
1529 * script-sections.cc: Likewise.
1530 * script.cc: Likewise.
1531 * stringpool.cc: Likewise.
1532 * symtab.cc: Likewise.
1533 * symtab.h: Likewise.
1534 * target.cc: Likewise.
1535 * timer.cc: Likewise.
1536 * timer.h: Likewise.
1537 * version.cc: Likewise.
1538 * x86_64.cc: Likewise.
1540 2010-08-24 Nick Clifton <nickc@redhat.com>
1543 * layout.cc (segment_precedes): Sort segments by their physical
1544 addresses, if they have been set.
1546 2010-08-23 Cary Coutant <ccoutant@google.com>
1548 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1550 (Lib_group::include_member): Unlock object after deleting its
1552 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1555 2010-08-19 Neil Vachharajani <nvachhar@google.com>
1556 Cary Coutant <ccoutant@google.com>
1558 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1559 constructor, and set_blocker.
1560 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1562 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1563 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1564 * testsuite/Makefile.am (start_lib_test): New test case.
1565 * testsuite/Makefile.in: Regenerate.
1566 * testsuite/start_lib_test_main.c: New file.
1567 * testsuite/start_lib_test_1.c: New file.
1568 * testsuite/start_lib_test_2.c: New file.
1569 * testsuite/start_lib_test_3.c: New file.
1571 2010-08-19 Ian Lance Taylor <iant@google.com>
1573 * Makefile.in: Rebuild with automake 1.11.1.
1574 * aclocal.m4: Likewise.
1575 * testsuite/Makefile.in: Likewise.
1577 2010-08-19 Ian Lance Taylor <iant@google.com>
1580 * i386.cc (class Output_data_plt_i386): Update declarations.
1581 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1582 local_ifuncs_ fields.
1583 (Target_i386::do_plt_section_for_global): New function.
1584 (Target_i386::do_plt_section_for_local): New function.
1585 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1586 parameter; change all callers. Initialize global_ifuncs_ and
1587 local_ifuncs_. If doing a static link define __rel_iplt_start and
1589 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1590 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1591 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1593 (Target_i386::make_plt_section): New function, broken out of
1594 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1595 (Target_i386::make_plt_entry): Call make_plt_section.
1596 (Target_i386::make_local_ifunc_plt_entry): New function.
1597 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1598 (Target_i386::Scan::local): Handle IFUNC symbols. Add
1599 R_386_IRELATIVE to switch.
1600 (Target_i386::Scan::global): Likewise.
1601 (Target_i386::Relocate::relocate): Likewise.
1602 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1604 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1605 (Target_x86_64::do_plt_section_for_global): New function.
1606 (Target_x86_64::do_plt_section_for_local): New function.
1607 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1608 parameter; change all callers. If doing a static link define
1609 __rela_iplt_start and __rela_iplt_end.
1610 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1611 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1612 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1614 (Target_x86_64::make_local_ifunc_plt_entry): New function.
1615 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1617 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1618 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
1619 R_X86_64_IRELATIVE to switch.
1620 (Target_x86_64::Scan::global): Likewise.
1621 (Target_x86_64::Relocate::relocate): Likewise.
1622 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1624 * target.h (class Target): Add plt_section_for_global and
1625 plt_section_for_local functions. Add do_plt_section_for_global
1626 and do_plt_section_for_local virtual functions.
1627 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
1628 clarifying comments.
1629 (Symbol::use_plt_offset): Handle IFUNC symbol.
1630 * object.cc (Sized_relobj::Sized_relobj): Initialize
1632 (Sized_relobj::local_has_plt_offset): New function.
1633 (Sized_relobj::local_plt_offset): New function.
1634 (Sized_relobj::set_local_plt_offset): New function.
1635 (Sized_relobj::do_count): Handle IFUNC symbol.
1636 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
1637 a bit away from input_shndx_ field. Add set_is_func_symbol and
1638 is_ifunc_symbol functions.
1639 (class Sized_relobj): Update declarations. Remove Tls_got_entry
1640 and Local_tls_got_offsets. Define Local_plt_offsets. Add
1641 local_plt_offsets_ field.
1642 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1643 * output.h (class Output_section_data): Add non-const
1644 output_section function.
1645 (class Output_data_got): Update declarations.
1646 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1647 Add use_plt_offset parameter to global and local constructors.
1648 Change all callers. Change local_sym_index_ field to 31 bits.
1649 Change GSYM_CODE and CONSTANT_CODE accordingly.
1650 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1651 doing a static link don't set sh_link field.
1652 (Output_data_got::Got_entry::write): Use PLT offset if
1654 (Output_data_got::add_global_plt): New function.
1655 (Output_data_got::add_local_plt): New function.
1656 * target-reloc.h (relocate_section): Handle IFUNC symbol.
1657 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1658 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1659 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1660 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1662 * testsuite/ifunc-sel.h: New file.
1663 * testsuite/ifuncmain1.c: New file.
1664 * testsuite/ifuncmain1vis.c: New file.
1665 * testsuite/ifuncmod1.c: New file.
1666 * testsuite/ifuncdep2.c: New file.
1667 * testsuite/ifuncmain2.c: New file.
1668 * testsuite/ifuncmain3.c: New file.
1669 * testsuite/ifuncmod3.c: New file.
1670 * testsuite/ifuncmain4.c: New file.
1671 * testsuite/ifuncmain5.c: New file.
1672 * testsuite/ifuncmod5.c: New file.
1673 * testsuite/ifuncmain6pie.c: New file.
1674 * testsuite/ifuncmod6.c: New file.
1675 * testsuite/ifuncmain7.c: New file.
1676 * configure, testsuite/Makefile.in: Rebuild.
1678 2010-08-18 Ian Lance Taylor <iant@google.com>
1681 (Output_section_incremental_inputs::write_input_files): Add cast
1682 to avoid signed/unsigned comparison warning.
1683 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1685 2010-08-12 Cary Coutant <ccoutant@google.com>
1687 * common.cc (Sort_commons::operator()): Remove unnecessary code.
1689 2010-08-13 Ian Lance Taylor <iant@google.com>
1691 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1693 2010-08-12 Cary Coutant <ccoutant@google.com>
1694 Doug Kwan <dougkwan@google.com>
1696 * resolve.cc (Symbol_table::should_override): When a weak dynamic
1697 defintion overrides non-weak undef, remember that the original undef
1699 * symtab.cc (Symbol_table::sized_write_global): For undef without
1700 an original weak binding, set binding to global in output.
1701 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1702 * testsuite/Makefile.in: Regenerate.
1703 * testsuite/strong_ref_weak_def.sh: New file.
1704 * testsuite/strong_ref_weak_def_1.c: Ditto.
1705 * testsuite/strong_ref_weak_def_2.c: Ditto.
1707 2010-08-12 Cary Coutant <ccoutant@google.com>
1709 * testsuite/incremental_test.sh: Rewrite.
1710 * testsuite/incremental_test_1.c: Rewrite.
1711 * testsuite/incremental_test_2.c: Rewrite.
1713 2010-08-12 Cary Coutant <ccoutant@google.com>
1715 * arm.cc (Target_arm::got_size): Add const.
1716 (Target_arm::got_entry_count): New function.
1717 (Target_arm::plt_entry_count): New function.
1718 (Target_arm::first_plt_entry_offset): New function.
1719 (Target_arm::plt_entry_size): New function.
1720 (Output_data_plt_arm::entry_count): New function.
1721 (Output_data_plt_arm::first_plt_entry_offset): New function.
1722 (Output_data_plt_arm::get_plt_entry_size): New function.
1723 * i386.cc (Target_i386::got_size): Add const.
1724 (Target_i386::got_entry_count): New function.
1725 (Target_i386::plt_entry_count): New function.
1726 (Target_i386::first_plt_entry_offset): New function.
1727 (Target_i386::plt_entry_size): New function.
1728 (Output_data_plt_i386::entry_count): New function.
1729 (Output_data_plt_i386::first_plt_entry_offset): New function.
1730 (Output_data_plt_i386::get_plt_entry_size): New function.
1731 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1732 find_incremental_inputs_sections. Dump incremental_got_plt section.
1733 * incremental.cc: Include target.h.
1734 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1735 parameter. Adjust all callers. Find incremental_got_plt section.
1736 (Incremental_inputs::create_data_sections): Create incremental_got_plt
1738 (Output_section_incremental_inputs::set_final_data_size): Calculate
1739 size of incremental_got_plt section.
1740 (Output_section_incremental_inputs::do_write): Write the
1741 incremental_got_plt section.
1742 (Got_plt_view_info): New struct.
1743 (Local_got_offset_visitor): New class.
1744 (Global_got_offset_visitor): New class.
1745 (Global_symbol_visitor_got_plt): New class.
1746 (Output_section_incremental_inputs::write_got_plt): New function.
1747 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1748 Add parameter. Adjust all callers.
1749 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1750 (Incremental_inputs::got_plt_section): New function.
1751 (Incremental_inputs::got_plt_section_): New data member.
1752 (Incremental_got_plt_reader): New class.
1753 * layout.cc (Layout::create_incremental_info_sections): Add the
1754 incremental_got_plt section.
1755 * object.h (Got_offset_list::get_list): New function.
1756 (Got offset_list::for_all_got_offsets): New function.
1757 (Sized_relobj::local_got_offset_list): New function.
1758 * powerpc.cc (Target_powerpc::got_size): Add const.
1759 (Target_powerpc::got_entry_count): New function.
1760 (Target_powerpc::plt_entry_count): New function.
1761 (Target_powerpc::first_plt_entry_offset): New function.
1762 (Target_powerpc::plt_entry_size): New function.
1763 (Output_data_plt_powerpc::entry_count): New function.
1764 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1765 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1766 * sparc.cc (Target_sparc::got_size): Add const.
1767 (Target_sparc::got_entry_count): New function.
1768 (Target_sparc::plt_entry_count): New function.
1769 (Target_sparc::first_plt_entry_offset): New function.
1770 (Target_sparc::plt_entry_size): New function.
1771 (Output_data_plt_sparc::entry_count): New function.
1772 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1773 (Output_data_plt_sparc::get_plt_entry_size): New function.
1774 * symtab.h (Symbol::got_offset_list): New function.
1775 (Symbol_table::for_all_symbols): New function.
1776 * target.h (Sized_target::got_entry_count): New function.
1777 (Sized_target::plt_entry_count): New function.
1778 (Sized_target::plt_entry_size): New function.
1779 * x86_64.cc (Target_x86_64::got_size): Add const.
1780 (Target_x86_64::got_entry_count): New function.
1781 (Target_x86_64::plt_entry_count): New function.
1782 (Target_x86_64::first_plt_entry_offset): New function.
1783 (Target_x86_64::plt_entry_size): New function.
1784 (Output_data_plt_x86_64::entry_count): New function.
1785 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1786 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1788 2010-08-12 Cary Coutant <ccoutant@google.com>
1790 * archive.cc: Include incremental.h.
1791 (Archive::Archive): Initialize incremental_info_.
1792 (Archive::include_member): Record archive members in incremental info.
1793 (Add_archive_symbols::run): Record begin and end of an archive in
1795 (Lib_group::include_member): Record objects in incremental info.
1796 * archive.h (Incremental_archive_entry): Forward declaration.
1797 (Archive::set_incremental_info): New member function.
1798 (Archive::incremental_info): New member function.
1799 (Archive::Unused_symbol_iterator): New class.
1800 (Archive::unused_symbols_begin): New member function.
1801 (Archive::unused_symbols_end): New member function.
1802 (Archive::incremental_info_): New data member.
1803 * incremental-dump.cc (find_input_containing_global): New function.
1804 (dump_incremental_inputs): Dump new incremental info sections.
1805 * incremental.cc: Include symtab.h.
1806 (Output_section_incremental_inputs): New class.
1807 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1808 new incremental info sections.
1809 (Sized_incremental_binary::do_check_inputs): Likewise.
1810 (Incremental_inputs::report_archive): Remove.
1811 (Incremental_inputs::report_archive_begin): New function.
1812 (Incremental_inputs::report_archive_end): New function.
1813 (Incremental_inputs::report_object): New function.
1814 (Incremental_inputs::finalize_inputs): Remove.
1815 (Incremental_inputs::report_input_section): New function.
1816 (Incremental_inputs::report_script): Rewrite.
1817 (Incremental_inputs::finalize): Do nothing but finalize string table.
1818 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1819 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1820 (Incremental_inputs::create_data_sections): New function.
1821 (Incremental_inputs::relocs_entsize): New function.
1822 (Output_section_incremental_inputs::set_final_data_size): New function.
1823 (Output_section_incremental_inputs::do_write): New function.
1824 (Output_section_incremental_inputs::write_header): New function.
1825 (Output_section_incremental_inputs::write_input_files): New function.
1826 (Output_section_incremental_inputs::write_info_blocks): New function.
1827 (Output_section_incremental_inputs::write_symtab): New function.
1828 * incremental.h (Incremental_script_entry): Forward declaration.
1829 (Incremental_object_entry): Forward declaration.
1830 (Incremental_archive_entry): Forward declaration.
1831 (Incremental_inputs): Forward declaration.
1832 (Incremental_inputs_header_data): Remove.
1833 (Incremental_inputs_header): Remove.
1834 (Incremental_inputs_header_write): Remove.
1835 (Incremental_inputs_entry_data): Remove.
1836 (Incremental_inputs_entry): Remove.
1837 (Incremental_inputs_entry_write): Remove.
1838 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1839 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1840 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1841 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1843 (Incremental_input_entry): New class.
1844 (Incremental_script_entry): New class.
1845 (Incremental_object_entry): New class.
1846 (Incremental_archive_entry): New class.
1847 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1848 (Incremental_inputs::report_inputs): Remove.
1849 (Incremental_inputs::report_archive): Remove.
1850 (Incremental_inputs::report_archive_begin): New function.
1851 (Incremental_inputs::report_archive_end): New function.
1852 (Incremental_inputs::report_object): Change prototype.
1853 (Incremental_inputs::report_input_section): New function.
1854 (Incremental_inputs::report_script): Change prototype.
1855 (Incremental_inputs::get_reloc_count): New function.
1856 (Incremental_inputs::set_reloc_count): New function.
1857 (Incremental_inputs::create_data_sections): New function.
1858 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1859 (Incremental_inputs::inputs_section): New function.
1860 (Incremental_inputs::symtab_section): New function.
1861 (Incremental_inputs::relocs_section): New function.
1862 (Incremental_inputs::get_stringpool): Add const.
1863 (Incremental_inputs::command_line): Add const.
1864 (Incremental_inputs::inputs): Remove.
1865 (Incremental_inputs::command_line_key): New function.
1866 (Incremental_inputs::input_file_count): New function.
1867 (Incremental_inputs::input_files): New function.
1868 (Incremental_inputs::relocs_entsize): New function.
1869 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1870 (Incremental_inputs::finalize_inputs): Remove.
1871 (Incremental_inputs::Input_info): Remove.
1872 (Incremental_inputs::lock_): Remove.
1873 (Incremental_inputs::inputs_): Change type.
1874 (Incremental_inputs::inputs_map_): Remove.
1875 (Incremental_inputs::current_object_entry_): New data member.
1876 (Incremental_inputs::inputs_section_): New data member.
1877 (Incremental_inputs::symtab_section_): New data member.
1878 (Incremental_inputs::relocs_section_): New data member.
1879 (Incremental_inputs::reloc_count_): New data member.
1880 (Incremental_inputs_reader): New class.
1881 (Incremental_symtab_reader): New class.
1882 (Incremental_relocs_reader): New class.
1883 * layout.cc (Layout::finalize): Move finalization of incremental info
1884 and creation of incremental info sections to follow finalization of
1885 symbol table. Set offsets for postprocessing sections.
1886 (Layout::create_incremental_info_sections): Call
1887 Incremental_inputs::create_data_sections. Add incremental symtab
1888 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1889 sections to layout after input sections.
1890 * layout.h (struct Timespec): Forward declaration.
1891 (Layout::incremental_inputs): Add const.
1892 (Layout::create_incremental_info_sections): Add parameter.
1893 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1894 * object.cc: Include incremental.h.
1895 (Relobj::finalize_incremental_relocs): New function.
1896 (Sized_relobj::do_layout): Record input sections in incremental info.
1897 * object.h (Object::output_section): New function.
1898 (Object::output_section_offset): Moved from Relobj.
1899 (Object::get_incremental_reloc_base): New function.
1900 (Object::get_incremental_reloc_count): New function.
1901 (Object::do_output_section): New function.
1902 (Object::do_output_section_offset): Moved from Relobj.
1903 (Object::do_get_incremental_reloc_base): New function.
1904 (Object::do_get_incremental_reloc_count): New function.
1905 (Object::Object): Initialize new data members.
1906 (Relobj::output_section): Renamed do_output_section and moved to
1908 (Relobj::output_section_offset): Moved to Object.
1909 (Relobj::do_get_incremental_reloc_base): New function.
1910 (Relobj::do_get_incremental_reloc_count): New function.
1911 (Relobj::allocate_incremental_reloc_counts): New function.
1912 (Relobj::count_incremental_reloc): New function.
1913 (Relobj::finalize_incremental_relocs): New function.
1914 (Relobj::next_incremental_reloc_index): New function.
1915 (Relobj::reloc_counts_): New data member.
1916 (Relobj::reloc_bases_): New data member.
1917 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
1918 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
1919 (Sized_relobj::incremental_relocs_scan): New function.
1920 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1921 (Sized_relobj::incremental_relocs_write): New function.
1922 (Sized_relobj::incremental_relocs_write_reltype): New function.
1923 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1925 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1926 archives and object files elsewhere.
1927 (Add_symbols::run): Report object files here.
1928 (Finish_group::run): Report end of archive at end of group.
1929 * reloc.cc: Include layout.h, incremental.h.
1930 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1931 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1932 (Sized_relobj::incremental_relocs_scan): New function.
1933 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1934 (Sized_relobj::do_relocate_sections): Write incremental relocations.
1935 (Sized_relobj::incremental_relocs_write): New function.
1936 (Sized_relobj::incremental_relocs_write_reltype): New function.
1937 * script.cc (read_input_script): Rewrite test for incremental link.
1938 Change call to Incremental_inputs::report_script.
1939 * symtab.h (Symbol_table::first_global_index): New function.
1940 (Symbol_table::output_count): New function.
1942 2010-08-12 Doug Kwan <dougkwan@google.com>
1944 * arm.cc (Target_arm::merge_object_attributes): Check command line
1945 options --no-wchar-size-warning and --no-enum-size-warning.
1946 * options.h (General_options): Add ld-compatible options
1947 --no-enum-size-warning and --no-wchar-size-warning.
1949 2010-08-04 Ian Lance Taylor <iant@google.com>
1951 * x86_64.cc (Target_x86_64::Scan::local): Use
1952 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1953 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1954 (Target_x86_64::Scan::global): Likewise.
1955 (Target_x86_64::Relocate::relocate): Likewise.
1956 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1959 2010-08-03 Cary Coutant <ccoutant@google.com>
1961 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1962 to reserve space in merged_strings vector. Keep total input size
1964 (Output_merge_string::do_print_merge_stats): Print total input size.
1965 * merge.h (Output_merge_string): Add input_size_ field.
1966 * stringpool.cc (Stringpool_template::string_length): Move
1967 implementations out of Stringpool_template class and place in
1969 * stringpool.h (string_length): Move out of Stringpool_template.
1971 2010-08-03 Ian Lance Taylor <iant@google.com>
1974 * layout.cc (relaxation_loop_body): If address of load segment is
1975 set, adjust address to include headers if possible.
1977 2010-08-03 Ian Lance Taylor <iant@google.com>
1979 * version.cc (version_string): Bump to 1.10.
1981 2010-08-03 Ian Lance Taylor <iant@google.com>
1984 * layout.h (enum Output_section_order): Define.
1985 (class Layout): Update declarations.
1986 * layout.cc (Layout::get_output_section): Add order parameter.
1987 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1988 is_first_non_relro parameters. Change all callers.
1989 (Layout::choose_output_section): Likewise.
1990 (Layout::add_output_section_data): Likewise.
1991 (Layout::make_output_section): Likewise. Set order.
1992 (Layout::default_section_order): New function.
1993 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1994 * output.cc (Output_section::Output_section): Initialize order_.
1995 Don't initialize deleted fields.
1996 (Output_segment::Output_segment): Don't initialize deleted
1998 (Output_segment::add_output_section_to_load): New function
1999 replacing add_output_section. Change all callers to call this or
2000 add_output_section_to_nonload.
2001 (Output_segment::add_output_section_to_nonload): New function.
2002 (Output_segment::remove_output_section): Rewrite.
2003 (Output_segment::add_initial_output_data): Likewise.
2004 (Output_segment::has_any_data_sections): Likewise.
2005 (Output_segment::is_first_section_relro): Likewise.
2006 (Output_segment::maximum_alignment): Likewise.
2007 (Output_segment::has_dynamic_reloc): New function replacing
2008 dynamic_reloc_count. Change all callers.
2009 (Output_segment::has_dynamic_reloc_list): New function replacing
2010 dynamic_reloc_count_list. Change all callers.
2011 (Output_segment::set_section_addresses): Rewrite.
2012 (Output_segment::set_offset): Rewrite.
2013 (Output_segment::find_first_and_last_list): Remove.
2014 (Output_segment::set_tls_offsets): Rewrite.
2015 (Output_segment::first_section_load_address): Likewise.
2016 (Output_segment::output_section_count): Likewise.
2017 (Output_segment::section_with_lowest_load_address): Likewise.
2018 (Output_segment::write_section_headers): Likewise.
2019 (Output_segment::print_sections_to_map): Likewise.
2020 * output.h (class Output_data): Remove dynamic_reloc_count_
2021 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2022 (Output_data::add_dynamic_reloc): Rewrite.
2023 (Output_data::has_dynamic_reloc): New function.
2024 (Output_data::dynamic_reloc_count): Remove.
2025 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2026 is_last_relro_, is_first_non_relro_, is_interp_,
2027 is_dynamic_linker_section_ fields. Add order and set_order
2028 functions. Remove is_relro_local, set_is_relro_local,
2029 is_last_relro, set_is_last_relro, is_first_non_relro,
2030 set_is_first_non_relro functions, is_interp, set_is_interp,
2031 is_dynamic_linker_section, and set_is_dynamic_linker_section
2033 (class Output_segment): Change Output_data_list from std::list to
2034 std:;vector. Add output_lists_ field. Remove output_data_ and
2035 output_bss_ fields. Update declarations.
2037 2010-08-02 Ian Lance Taylor <iant@google.com>
2039 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2040 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2041 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2043 2010-08-02 Ian Lance Taylor <iant@google.com>
2046 * script.cc (Script_options::Script_options): Initialize
2047 symbol_definitions_ and symbol_references_.
2048 (Script_options::add_symbol_assignment): Update
2049 symbol_definitions_ and symbol_references_.
2050 (Script_options::add_symbol_reference): New function.
2051 (script_symbol): New function.
2052 * script.h (class Script_options): Add symbol_definitions_ and
2053 symbol_references_ fields.
2054 (Script_options::referenced_const_iterator): New type.
2055 (Script_options::referenced_begin): New function.
2056 (Script_options::referenced_end): New function.
2057 (Script_options::is_referenced): New function.
2058 (Script_options::any_unreferenced): New function.
2059 * script-c.h (script_symbol): Declare.
2060 * yyscript.y (exp): Call script_symbol.
2061 * symtab.cc: Include "script.h".
2062 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2063 Change all callers. Check symbols referenced by scripts.
2064 (Symbol_table::add_undefined_symbols_from_command_line): Add
2065 layout parameter. Change all callers.
2066 (Symbol_table::do_add_undefined_symbols_from_command_line):
2067 Likewise. Break out loop body. Check symbols referenced by
2069 (Symbol_table::add_undefined_symbol_from_command_line): New
2070 function broken out of
2071 do_add_undefined_symbols_from_command_line.
2072 * symtab.h (class Symbol_table): Update declarations.
2073 * archive.cc: Include "layout.h".
2074 (Archive::should_include_member): Add layout parameter. Change
2075 all callers. Check for symbol mentioned in expression.
2076 * archive.h (class Archive): Update declaration.
2077 * object.cc (Sized_relobj::do_should_include_member): Add layout
2079 * object.h (Object::should_include_member): Add layout parameter.
2081 (Object::do_should_include_member): Add layout parameter.
2082 (class Sized_relobj): Update declaration.
2083 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2085 * dynobj.h (class Sized_dynobj): Update declaration.
2086 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2088 * plugin.h (class Sized_pluginobj): Update declaration.
2090 2010-08-02 Ian Lance Taylor <iant@google.com>
2093 * output.cc (Output_segment::set_offset): Search for the first and
2094 last sections rather than assuming that the list is in order.
2095 (Output_segment::find_first_and_last_list): New function.
2096 * output.h (class Output_segment): Update declarations.
2097 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2098 (relro_strip_test_SOURCES): New variable.
2099 (relro_strip_test_DEPENDENCIES): New variable.
2100 (relro_strip_test_LDFLAGS): New variable.
2101 (relro_strip_test_LDADD): New variable.
2102 (relro_strip_test.so): New target.
2104 2010-08-02 Ian Lance Taylor <iant@google.com>
2106 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2107 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2108 (Target_i386::got_tlsdesc_section): New function.
2109 (Target_i386::got_section): Create space for GOT entries for
2110 TLSDESC relocations.
2111 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2113 (Target_i386::Scan::global): Likewise.
2114 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2116 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2117 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2118 (Target_x86_64::got_tlsdesc_section): New function.
2119 (Target_x86_64::got_section): Create space for GOT entries for
2120 TLSDESC relocations.
2121 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2123 (Target_x86_64::Scan::global): Likewise.
2124 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2127 2010-08-02 Ian Lance Taylor <iant@google.com>
2129 * testsuite/final_layout.sh: Use dc to convert from hex to
2132 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2134 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2135 paramter to the call to gold::gc_process_relocs.
2136 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2137 paramter to the call to gold::gc_process_relocs.
2138 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2139 parameter to the call to gold::gc_process_relocs.
2140 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2141 template parameter to the call to gold::gc_process_relocs.
2142 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2143 paramter to the call to gold::gc_process_relocs.
2144 * gc.h (get_embedded_addend_size): New function.
2145 (gc_process_relocs): Save the size of the reloc for use by ICF.
2146 * icf.cc (get_section_contents): Get the addend from the text section
2147 for SHT_REL relocation sections.
2148 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2149 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2150 * int_encoding.h (read_from_pointer): New overloaded function.
2151 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2152 * testsuite/icf_sht_rel_addend_test.sh: New file.
2153 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2154 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2156 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2158 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2159 * Makefile.in: Regenerate.
2160 * testsuite/Makefile.in: Regenerate.
2162 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2164 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2165 * gold/testsuite/debug_msg.cc: Likewise.
2166 * gold/testsuite/odr_violation1.cc
2167 * gold/testsuite/odr_violation2.cc
2169 2010-07-21 Cary Coutant <ccoutant@google.com>
2171 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2172 string, and length fields.
2173 (Output_merge_string::Merged_strings_list): New type.
2174 (Output_merge_string::Merged_strings_lists): New typedef.
2175 (Output_merge_string): Replace merged_strings_ with
2176 merged_strings_lists_.
2177 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2178 Merged_strings_list per input object and section. Don't store pointer
2179 to the string. Don't store length with each merged string entry.
2180 (Output_merge_string::finalize_merged_data): Loop over list of merged
2181 strings lists. Recompute length of each merged string.
2183 2010-07-15 Cary Coutant <ccoutant@google.com>
2185 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2188 2010-07-14 Ian Lance Taylor <iant@google.com>
2190 * descriptors.cc (Descriptors::open): Report correct name in error
2193 2010-07-13 Doug Kwan <dougkwan@google.com>
2195 * arm.cc (Arm_input_section::Arm_input_section): For a
2196 SHT_ARM_EXIDX section, always keeps the input sections.
2197 (Arm_input_section::set_exidx_section_link): New method.
2198 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2199 has_errors_ to false.
2200 (Arm_exidx_input_section::has_errors,
2201 Arm_exidx_input_section::set_has_errors): New methods.
2202 (Arm_exidx_input_section::has_errors_): New data member.
2203 (Arm_relobj::get_exidx_shndx_list): New method.
2204 (Arm_output_section::append_text_sections_to_list): Do not skip
2205 section without SHF_EXECINSTR.
2206 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2208 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2209 section header. Make error messages more verbose. Check for
2210 a non-executable section linked to an EXIDX section.
2211 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2212 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2213 check that there is no deferred EXIDX section if we exit early.
2214 Instead of not making an EXIDX section in case of an error, make one
2215 and set the has_errors flag of it.
2216 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2217 in a relocatable link.
2218 (Target_arm::do_relax): Look for the EXIDX output section instead of
2219 assuming that it is called .ARM.exidx.
2220 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2221 section list. Do not check for SHF_EXECINSTR section flags but
2222 skip any input section with errors.
2223 * output.cc (Output_section::Output_section): Initialize
2224 always_keeps_input_sections_ to false.
2225 (Output_section::add_input_section): Check for
2226 always_keeps_input_sections_.
2227 * output.h (Output_section::always_keeps_input_sections,
2228 Output_section::set_always_keeps_input_sections): New methods.
2229 (Output_section::always_keeps_input_sections): New data member.
2231 2010-07-13 Rafael Espindola <espindola@google.com>
2233 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2234 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2236 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2237 Ian Lance Taylor <iant@google.com>
2239 * output.h (Output_section_lookup_maps::add_merge_section):
2240 Correct check of whether value was inserted.
2241 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2242 (Output_section_lookup_maps::add_relaxed_input_section):
2244 * arm.cc (Target_arm::got_section): Remove used local os.
2245 * i386.cc (Target_i386::got_section): Likewise.
2246 * x86_64.cc (Target_x86_64::got_section): Likewise.
2247 * sparc.cc (Target_sparc::got_section): Likewise.
2248 (Target_sparc::relocate): Remove unused local have_got_offset.
2249 * powerpc.cc (Target_powerpc::relocate): Likewise.
2251 2010-07-13 Ian Lance Taylor <iant@google.com>
2253 * compressed_output.cc (zlib_decompress): Fix signature in
2256 * archive.cc (Archive::include_member): Unlock an external member
2257 of a thin archive. Don't bother to delete an object we know is
2260 2010-07-12 Cary Coutant <ccoutant@google.com>
2262 * compressed_output.cc (zlib_decompress): New function.
2263 (get_uncompressed_size): New function.
2264 (decompress_input_section): New function.
2265 * compressed_output.h (get_uncompressed_size): New function.
2266 (decompress_input_section): New function.
2267 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2268 Handle compressed debug sections.
2269 * layout.cc (is_compressed_debug_section): New function.
2270 (Layout::output_section_name): Map compressed section names to
2272 * layout.h (is_compressed_debug_section): New function.
2273 (is_debug_info_section): Recognize compressed debug sections.
2274 * merge.cc: Include compressed_output.h.
2275 (Output_merge_data::do_add_input_section): Handle compressed
2277 (Output_merge_string::do_add_input_section): Handle compressed
2279 * object.cc: Include compressed_output.h.
2280 (Sized_relobj::Sized_relobj): Initialize new data members.
2281 (build_compressed_section_map): New function.
2282 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2283 * object.h (Object::section_is_compressed): New method.
2284 (Object::do_section_is_compressed): New method.
2285 (Sized_relobj::Compressed_section_map): New type.
2286 (Sized_relobj::do_section_is_compressed): New method.
2287 (Sized_relobj::compressed_sections_): New data member.
2288 * output.cc (Output_section::add_input_section): Handle compressed
2290 * reloc.cc: Include compressed_output.h.
2291 (Sized_relobj::write_sections): Handle compressed debug sections.
2293 2010-07-08 Cary Coutant <ccoutant@google.com>
2295 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2296 weak when resolving to a dynamic def.
2297 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2298 for weak undef/dynamic def cases. Adjust callers.
2299 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2300 undef_binding_weak_.
2301 (Symbol_table::sized_write_globals): Adjust symbol binding.
2302 (Symbol_table::sized_write_symbol): Add binding parameter.
2303 * symtab.h (Symbol::set_undef_binding): New method.
2304 (Symbol::is_undef_binding_weak): New method.
2305 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2306 (Symbol_table::should_override): Add new parameter.
2307 (Symbol_table::sized_write_symbol): Add new parameter.
2309 * testsuite/weak_undef_file1.cc: Add new test case.
2310 * testsuite/weak_undef_file2.cc: Fix header comment.
2311 * testsuite/weak_undef_test.cc: Add new test case.
2313 2010-06-29 Doug Kwan <dougkwan@google.com>
2315 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2316 Initialize USE_SYMBOL_.
2317 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2319 (Arm_reloc_property::uses_symbol_): New data member declaration.
2320 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2321 uses symbol value and symbol is undefined but not weakly undefined.
2323 2010-06-28 Rafael Espindola <espindola@google.com>
2325 * plugin.cc (Plugin::load): Use dlerror.
2327 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2329 * symtab.cc (detect_odr_violations): When reporting an ODR
2330 violation, report an object where the symbol is defined.
2332 2010-06-25 Doug Kwan <dougkwan@google.com>
2334 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2335 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2337 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2338 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2339 target hook to detect function points.
2340 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2341 * icf.h (Icf::check_section_for_function_pointers): Change type of
2342 parameter SECTION_NAME to const reference to std::string. Use
2343 target hook to determine if section may have unsafe pointers.
2344 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2347 2010-06-21 Rafael Espindola <espindola@google.com>
2349 * fileread.cc (Input_file::find_fie): New
2350 (Input_file::open): Use Input_file::find_fie.
2351 * fileread.h (Input_file::find_fie): New
2352 * plugin.cc (set_extra_library_path): New.
2353 (Plugin::load): Add set_extra_library_path to the transfer vector.
2354 (Plugin_manager::set_extra_library_path): New.
2355 (Plugin_manager::add_input_file): Use the extra search path if set.
2356 (set_extra_library_path(): New.
2357 * plugin.h (Plugin_manager): Add set_extra_library_path and
2360 2010-06-19 Cary Coutant <ccoutant@google.com>
2362 * layout.cc (gdb_sections): Add .debug_types.
2363 (lines_only_debug_sections): Likewise.
2365 2010-06-18 Rafael Espindola <espindola@google.com>
2367 * plugin.cc (add_input_file,add_input_library)
2368 (Plugin_manager::add_input_file): Make filename arguments const.
2369 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2372 2010-06-16 Doug Kwan <dougkwan@google.com>
2374 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2375 .ARM.attributes section if we have not merged any input
2376 attributes sections.
2378 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2380 * arm.cc: Allow combining objects with no EABI version
2383 2010-06-15 Rafael Espindola <espindola@google.com>
2385 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2387 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2389 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2390 (struct iovec): Correct !HAVE_READV definition.
2392 2010-06-10 Cary Coutant <ccoutant@google.com>
2394 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2395 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2397 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2400 * symtab.h (Symbol::is_placeholder): New member function.
2401 * target-reloc.h (relocate_section): Check for placeholder symbols.
2403 * testsuite/Makefile.am (plugin_test_8): New test.
2404 (plugin_test_9): New test.
2405 * testsuite/Makefile.in: Regenerate.
2407 2010-06-09 Nick Clifton <nickc@redhat.com>
2409 * yyscript.y (input_list_element): Allow strings prefixed with
2410 the '-' character. Treat these as libraries.
2411 * script.cc (script_add_library): New function. Adds a library
2412 specified by "-l<name>" found in an input script.
2413 * script-c.h: Add prototype for script_add_library.
2415 2010-06-07 Doug Kwan <dougkwan@google.com>
2417 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2418 Restrict stub-group size to be within long conditional branch
2419 range when working around cortex-A8 erratum.
2421 2010-06-07 Damien Diederen <dd@crosstwine.com>
2423 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2426 2010-06-03 Sriraman Tallam <tmsriram@google.com>
2430 (Output_section::Input_section_sort_entry::compare_section_ordering):
2431 Change to return non-zero correctly.
2432 (Output_section::Input_section_sort_section_order_index_compare
2433 ::operator()): Change to fix ambiguity in comparisons.
2435 2010-06-01 Sriraman Tallam <tmsriram@google.com>
2437 * gold.h (is_wildcard_string): New function.
2438 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2439 (Layout::layout_eh_frame): Ditto.
2440 (Layout::find_section_order_index): New method.
2441 (Layout::read_layout_from_file): New method.
2442 * layout.h (Layout::find_section_order_index): New method.
2443 (Layout::read_layout_from_file): New method.
2444 (Layout::input_section_position_): New private member.
2445 (Layout::input_section_glob_): New private member.
2446 * main.cc (main): Call read_layout_from_file here.
2447 * options.h (--section-ordering-file): New option.
2448 * output.cc (Output_section::input_section_order_specified_): New
2450 (Output_section::Output_section): Initialize new member.
2451 (Output_section::add_input_section): Add new parameter.
2452 Keep input sections when --section-ordering-file is used.
2453 (Output_section::set_final_data_size): Sort input sections when
2454 section ordering file is specified.
2455 (Output_section::Input_section_sort_entry): Add new parameter.
2457 (Output_section::Input_section_sort_entry::compare_section_ordering):
2459 (Output_section::Input_section_sort_compare::operator()): Change to
2460 consider section_order_index.
2461 (Output_section::Input_section_sort_init_fini_compare::operator()):
2462 Change to consider section_order_index.
2463 (Output_section::Input_section_sort_section_order_index_compare
2464 ::operator()): New method.
2465 (Output_section::sort_attached_input_sections): Change to sort
2466 according to section order when specified.
2467 (Output_section::add_input_section<32, true>): Add new parameter.
2468 (Output_section::add_input_section<64, true>): Add new parameter.
2469 (Output_section::add_input_section<32, false>): Add new parameter.
2470 (Output_section::add_input_section<64, false>): Add new parameter.
2471 * output.h (Output_section::add_input_section): Add new parameter.
2472 (Output_section::input_section_order_specified): New
2474 (Output_section::set_input_section_order_specified): New method.
2475 (Input_section::Input_section): Initialize section_order_index_.
2476 (Input_section::section_order_index): New method.
2477 (Input_section::set_section_order_index): New method.
2478 (Input_section::section_order_index_): New member.
2479 (Input_section::Input_section_sort_section_order_index_compare): New
2481 (Output_section::input_section_order_specified_): New member.
2482 * script-sections.cc (is_wildcard_string): Delete and move modified
2484 (Output_section_element_input::Output_section_element_input): Modify
2485 call to is_wildcard_string.
2486 (Output_section_element_input::Input_section_pattern
2487 ::Input_section_pattern): Ditto.
2488 (Output_section_element_input::Output_section_element_input): Ditto.
2489 * testsuite/Makefile.am (final_layout): New test case.
2490 * testsuite/Makefile.in: Regenerate.
2491 * testsuite/final_layout.cc: New file.
2492 * testsuite/final_layout.sh: New file.
2494 2010-06-01 Rafael Espindola <espindola@google.com>
2496 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2498 2010-06-01 Rafael Espindola <espindola@google.com>
2500 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2501 visibility of symbols.
2503 2010-05-27 Doug Kwan <dougkwan@google.com>
2505 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2506 from start of output section instead of address for a local symbol
2507 in a merged or relaxed section when doing a relocatable link.
2509 2010-05-26 Rafael Espindola <espindola@google.com>
2512 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2513 adding sections the garbage collector removed.
2514 * gold/testsuite/Makefile.am: Add test.
2515 * gold/testsuite/Makefile.in: Regenerate.
2516 * gold/testsuite/plugin_test_7.sh: New.
2517 * gold/testsuite/plugin_test_7_1.c: New.
2518 * gold/testsuite/plugin_test_7_2.c: New.
2520 2010-05-26 Rafael Espindola <espindola@google.com>
2522 * script-sections.cc (Output_section_definition::set_section_addresses):
2523 Check for --section-start.
2525 2010-05-26 Doug Kwan <dougkwan@google.com>
2527 * arm.cc (Arm_scan_relocatable_relocs): New class.
2528 (Target_arm::relocate_special_relocatable): New method.
2529 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2530 (Arm_relocate_functions::thumb_branch_common): Same.
2531 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2532 instead of Default_scan_relocatable_relocs.
2533 * target-reloc.h (relocate_for_relocatable): Let target handle
2534 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2535 * target.h (Sized_target::relocate_special_relocatable): New method.
2537 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2539 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2541 2010-05-23 Doug Kwan <dougkwan@google.com>
2543 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2545 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2546 with a direct branch, not a conditional branch, to a stub.
2547 * merge.cc (Output_merge_base::record_input_section): New method
2549 (Output_merge_data::do_add_input_section): Record input section if
2550 keeps-input-sections flag is set.
2551 (Output_merge_string::do_add_input_section): Ditto.
2552 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2553 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2555 (Output_merge_base::keeps_input_sections,
2556 Output_merge_base::set_keeps_input_sections,
2557 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2559 (Output_merge_base::Input_sections): New type declaration.
2560 (Output_merge_base::input_sections_begin,
2561 Output_merge_base::input_sections_end,
2562 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2563 (Output_merge_base::bool keeps_input_sections_,
2564 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2565 Output_merge_base::input_sections_): New data members.
2566 (Output_merge_data::do_set_keeps_input_sections): New method
2568 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2569 * output.cc (Output_section::Input_section::relobj): Move method
2570 defintion from class declaration to here and handle merge sections.
2571 (Output_section::Input_section::shndx): Ditto.
2572 (Output_section::Output_section): Remove initializations of removed
2573 data members and initialize new data member LOOKUP_MAPS_.
2574 (Output_section::add_input_section): Set keeps-input-sections flag
2575 for a newly created merge output section as appropriate. Adjust code
2576 to use Output_section_lookup_maps class.
2577 (Output_section::add_relaxed_input_section): Adjst code for lookup
2578 maps code refactoring.
2579 (Output_section::add_merge_input_section): Add a new parameter
2580 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2581 class. If adding input section to a newly created merge output
2582 section fails, remove the new merge section.
2583 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2584 Adjust code for use of the Output_section_lookup_maps class.
2585 (Output_section::find_merge_section): Ditto.
2586 (Output_section::build_lookup_maps): New method defintion.
2587 (Output_section::find_relaxed_input_section): Adjust code to use
2588 Output_section_lookup_maps class.
2589 (Output_section::get_input_sections): Export merge sections. Adjust
2590 code to use Output_section_lookup_maps class.
2591 (Output_section:::add_script_input_section): Adjust code to use
2592 Output_section_lookup_maps class. Update lookup maps for merge
2594 (Output_section::discard_states): Use Output_section_lookup_maps.
2595 (Output_section::restore_states): Same.
2596 * output.h (Merge_section_properties): Move class defintion out of
2598 (Output_section_lookup_maps): New class.
2599 (Output_section::Input_section::is_merge_section): New method
2601 (Output_section::Input_section::relobj): Move defintion out of class
2602 defintion. Declare method only.
2603 (Output_section::Input_section::shndx): Ditto.
2604 (Output_section::Input_section::output_merge_base): New method defintion.
2605 (Output_section::Input_section::u2_.pomb): New union field.
2606 (Output_section::Merge_section_by_properties_map,
2607 Output_section::Output_section_data_by_input_section_map,
2608 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2610 (Output_section::add_merge_input_section): Add new parameter
2611 KEEPS_INPUT_SECTIONS.
2612 (Output_section::build_lookup_maps): New method declaration.
2613 (Output_section::merge_section_map_,
2614 Output_section::merge_section_by_properties_map_,
2615 Output_section::relaxed_input_section_map_,
2616 Output_section::is_relaxed_input_section_map_valid_): Remove data
2618 (Output_section::lookup_maps_): New data member.
2620 2010-05-21 Doug Kwan <dougkwan@google.com>
2623 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2624 avoid a compilation error.
2626 2010-05-19 Rafael Espindola <espindola@google.com>
2628 * script-sections.cc (Output_section_definition::allocate_to_segment):
2629 Update the phdrs_list even when the output section is NULL.
2630 * testsuite/Makefile.am: Add test.
2631 * testsuite/Makefile.in: Regenerate.
2632 * testsuite/script_test_9.cc: New.
2633 * testsuite/script_test_9.sh: New.
2634 * testsuite/script_test_9.t: New.
2636 2010-05-19 Doug Kwan <dougkwan@google.com>
2638 * arm.cc (Arm_input_section::original_size): New method.
2639 (Arm_input_section::do_addralign): Add a cast.
2640 (Arm_input_section::do_output_offset): Remove static cast.
2641 (Arm_input_section::original_addralign,
2642 Arm_input_section::original_size_): Change type to uint32_t.
2643 (Arm_input_section::init): Add safe casts for section alignment
2645 (Arm_input_section::set_final_data_size): Do not set address and
2646 offset of stub table.
2647 (Arm_output_section::fix_exidx_coverage): Change use of of
2648 Output_section::Simple_input_section to that of
2649 Output_section::Input_section.
2650 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2651 except for the first pass.
2652 * output.cc (Output_section::get_input_sections): Change type of
2653 input_sections to std::list<Input_section>.
2654 (Output_section::add_script_input_section): Rename from
2655 Output_section::add_simple_input_section. Change type of SIS
2656 parameter from Simple_input_section to Input_section.
2657 * output.h (Output_section::Simple_input_section): Remove class.
2658 (Output_section::Input_section): Change class visibility to public.
2659 (Output_section::Input_section::addralign): Use stored alignments
2660 for special input sections if set.
2661 (Output_section::Input_section::set_addralign): New method.
2662 (Output_section::get_input_sections): Change parameter type from
2663 list of Simple_input_section to list of Input_section.
2664 (Output_section::add_script_input_section): Rename from
2665 Output_section::add_simple_input_section. Change first parameter's
2666 type from Simple_input_section to Input_section and remove the
2667 second and third parameters.
2668 * script-sections.cc (Input_section::Input_section_list): Change
2669 type to list of Output_section::Input_section/
2670 (Input_section_info::Input_section_info): Change parameter type of
2671 INPUT_SECTION to Output_section::Input_section.
2672 (Input_section_info::input_section): Change return type.
2673 (Input_section_info::input_section_): Change type to
2674 Output_section::Input_section.
2675 (Output_section_element_input::set_section_addresses): Adjust code
2676 to use Output_section::Input_section instead of
2677 Output_section::Simple_input_section. Adjust code for renaming
2678 of Output_section::add_simple_input_section.
2679 (Orphan_output_section::set_section_addresses): Ditto.
2681 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2683 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2684 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2686 2010-05-18 Rafael Espindola <espindola@google.com>
2688 * options.cc (General_options::finalize): Handle -nostdlib.
2689 * options.h (nostdlib): New option.
2690 * script.cc (script_add_search_dir): Handle -nostdlib.
2692 2010-05-12 Doug Kwan <dougkwan@google.com>
2694 * arm.cc (Target_arm::do_finalize_sections): Create an empty
2695 attributes section only if there no attributes section after merging.
2696 (Target_arm::merge_object_attributes): Move value of
2697 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2698 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2699 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2700 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2701 and arm_attr_merge_7.stdout.
2702 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2703 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2704 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2705 arm_attr_merge_7b.o): New rules.
2706 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2708 * testsuite/Makefile.in: Regenerate.
2709 * testsuite/arm_attr_merge.sh: New file.
2710 * testsuite/arm_attr_merge_[67][ab].s: Same.
2712 2010-05-05 Nick Clifton <nickc@redhat.com>
2714 * po/es.po: Updated Spanish translation.
2716 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2718 * Makefile.am (install-exec-local): Properly install gold as
2719 default cross linker.
2720 * Makefile.in: Regenerated.
2722 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2723 Nick Clifton <nickc@redhat.com>
2725 * configure.ac (install_as_default): Define and set to false
2726 unless --enable-gold or --enable-gold=both/gold has been
2728 * configure: Regenerate.
2730 * Makefile.am (install-exec-local): Install the executable as
2731 'ld.gold'. If install_as_default is true then also install it as
2733 * Makefile.in: Regenerated.
2735 2010-04-24 Ian Lance Taylor <iant@google.com>
2737 * layout.cc (Layout::layout_reloc): In relocatable link don't
2738 combine reloc sections for grouped sections.
2740 2010-04-23 Sriraman Tallam <tmsriram@google.com>
2742 * gc.h (gc_process_relocs): Pass information on relocs pointing to
2743 sections that are not ordinary to icf.
2744 * icf.cc (get_section_contents): Handle relocation pointing to section
2745 with no object or shndx information.
2746 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2747 * testsuite/Makefile.in: Regenerate.
2748 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2749 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2751 2010-04-22 Ian Lance Taylor <iant@google.com>
2753 * expression.cc (Expression::Expression_eval_info): Add
2754 result_alignment_pointer field.
2755 (Expression::eval_with_dot): Add result_alignment_pointer
2756 parameter. Change all callers.
2757 (Expression::eval_maybe_dot): Likewise.
2758 (class Binary_expression): Add alignment_pointer parameter to
2759 left_value and right_value. Change all callers.
2760 (BINARY_EXPRESSION): Set result alignment.
2761 (class Trinary_expression): Add alignment_pointer parameter to
2762 arg2_value and arg3_value. Change all callers.
2763 (Trinary_cond::value): Set result alignment.
2764 (Max_expression::value, Min_expression::value): Likewise.
2765 (Align_expression::value): Likewise.
2766 * script-sections.cc (class Sections_element): Add dot_alignment
2767 parameter to set_section_addresses virtual function. Update
2769 (class Output_section_element): Likewise.
2770 (Script_sections::create_segments): Add dot_alignment parameter.
2772 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2773 (Script_sections::set_phdrs_clause_addresses): Likewise.
2774 * script-sections.h: Update declarations.
2775 * script.h: Update declarations.
2776 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2778 * testsuite/script_test_3.t: Set large alignment.
2779 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2780 segment has expected alignment.
2782 2010-04-22 Nick Clifton <nickc@redhat.com>
2784 * po/gold.pot: Updated by the Translation project.
2785 * po/vi.po: Updated Vietnamese translation.
2787 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
2789 * testsuite/Makefile.am (check_PROGRAMS): Add
2790 icf_virtual_function_folding_test.
2791 * testsuite/Makefile.in: Regenerated.
2793 2010-04-15 Andrew Haley <aph@redhat.com>
2795 * options.h (merge_exidx_entries): New option.
2796 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2797 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2798 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2799 (Target_arm::merge_exidx_entries): New function.
2800 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2801 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2802 to Arm_exidx_fixup constructor.
2803 Add new arg, merge_exidx_entries.
2804 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2805 Arm_output_section::fix_exidx_coverage.
2807 2010-04-18 Sriraman Tallam <tmsriram@google.com>
2809 * icf.cc (get_section_contents): Check for preemptible functions.
2810 Ignore addend when appropriate.
2811 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2813 (add_from_relobj): Check for section folded.
2814 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2815 * symtab.h (should_add_dynsym_entry): Add new parameter.
2816 * target-reloc.h (scan_relocs): Check for section folded.
2817 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2818 Check reloc types for function pointers in shared objects.
2819 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2821 (icf_preemptible_functions_test): New test case.
2822 (icf_string_merge_test): New test case.
2823 * testsuite.Makefile.in: Regenerate.
2824 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2825 bar_glob. Refactor code.
2826 * testsuite/icf_preemptible_functions_test.cc: New file.
2827 * testsuite/icf_preemptible_functions_test.sh: New file.
2828 * testsuite/icf_string_merge_test.cc: New file.
2829 * testsuite/icf_string_merge_test.sh: New file.
2830 * testsuite/icf_virtual_function_folding_test.cc: New file.
2831 * testsuite/icf_virtual_function_folding_test.sh: New file.
2833 2010-04-14 Doug Kwan <dougkwan@google.com>
2835 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2836 for local symbol recounting if we remove a section due to ICF.
2837 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2838 there are no regular objects in input.
2840 2010-04-13 Doug Kwan <dougkwan@google.com>
2842 * arm.cc (Arm_input_section::set_final_data_size): Compute
2843 accurate final data size instead of using current data size.
2845 2010-04-09 Doug Kwan <dougkwan@google.com>
2847 * layout.cc (Layout::choose_output_section): Handle script section
2849 (Layout::make_output_section_for_script): Add section type parameter.
2850 Handle script section types.
2851 * layout.h (Layout::make_output_section_for_script): Add section
2853 * output.cc (Output_section::Output_section): Initialize data member
2855 (Output_section::do_reset_address_and_file_offset): Do not set address
2856 to 0 if section is a NOLOAD section.
2857 * output.h (Output_section::is_noload): New method.
2858 (Output_section::set_is_noload): Ditto.
2859 (Output_section::is_noload_): New data member.
2860 * script-c.h (Script_section_type): New enum type.
2861 (struct Parser_output_section_header): Add new file section_type.
2862 * script-sections.cc (Sections_element::output_section_name): Add
2863 parameter for returning script section type.
2864 (Output_section_definition::output_section_name): Ditto.
2865 (Output_section_definition::section_type)P; New method.
2866 (Output_section_definiton::script_section_type_name): Ditto.
2867 (Output_section_definition::script_section_type_): New data member.
2868 (Output_section_definition::Output_section_definition): Initialize
2869 data member Output_section_definition::script_section_type_.
2870 (Output_section_definition::create_sections): Pass script section type
2871 to Layout::make_output_section_for_script.
2872 (Output_section_definition::output_section_name): Return script
2873 section type to caller.
2874 (Output_section_definition::set_section_address): Do not advance
2875 dot value and load address if section type is NOLOAD. Set address
2876 of NOLOAD sections regardless of section flags.
2877 (Output_section_definition::print): Print section type if it is
2878 not SCRIPT_SECTION_TYPE_NONE.
2879 (Output_section_definition::section_type): New method.
2880 (Output_section_definition::script_section_type_name): Ditto.
2881 (Script_sections::output_section_name): Add new parameter
2882 PSECTION_TYPE for returning script section type. Pass it to
2883 section elements. Handle discard sections.
2884 (Sort_output_sections::operator()): Handle NOLOAD sections.
2885 * script-sections.h (Script_sections::Section_type): New enum type.
2886 (Script_sections::output_section_name): Add a new parameter for
2887 returning script section type.
2888 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2890 * yyscript.y (union): Add new field SECTION_TYPE.
2891 (COPY, DSECT, INFO, NOLOAD): New tokens.
2892 (opt_address_and_section_type): Change type to output_section_header.
2893 (section_type): New non-terminal
2894 (section_header): Handle section type.
2895 (opt_address_and_section_type): Return section type value.
2897 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
2899 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2900 * testsuite/plugin_common_test_2.c (foo): Likewise.
2902 2010-04-08 Doug Kwan <dougkwan@google.com>
2904 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2906 * output.cc (Output_section::add_merge_input_section): Simplify
2907 code and return status of Output_merge_base::add_input_section.
2908 Update merge section map only if Output_merge_base::add_input_section
2911 2010-04-07 Doug Kwan <dougkwan@google.com>
2913 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2914 if section is marked as containing instructions but has no mapping
2916 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2917 correct section index.
2918 (Arm_relobj::find_linked_text_section): Ditto.
2920 2010-04-07 Cary Coutant <ccoutant@google.com>
2922 * archive.cc (include_member): Destroy Read_symbols_data object before
2924 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2925 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2926 (Read_symbols_data::~Read_symbols_data) New destructor.
2927 (Section_relocs::Section_relocs) New constructor.
2928 (Section_relocs::~Section_relocs) New destructor.
2929 (Read_relocs_data::Read_relocs_data) New constructor.
2930 (Read_relocs_data::~Read_relocs_data) New destructor.
2931 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2932 pointers to NULL after deleting.
2934 2010-04-07 Doug Kwan <dougkwan@google.com>
2936 * arm.cc: Replace "endianity" with "endianness" in comments.
2937 (Arm_exidx_cantunwind): Ditto.
2938 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2939 (Arm_relobj::merge_flags_and_attributes): New method.
2940 (Arm_relobj::merge_flags_and_attributes_): New data member.
2941 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2942 (Arm_relobj::scan_sections_for_stubs): Ditto.
2943 (Arm_relobj::do_read_symbols): Check to see if we really want to
2944 merge processor-specific flags and attributes. Exit early if
2945 an object is empty except for section names and the undefined symbol.
2946 (Target_arm::do_finalize_sections): Move check for ELF format to
2947 Arm_relobj::do_read_symbols. Merge processor specific flags and
2948 attributes from a regular object only when we have determined that
2949 it is aapropriate. Do not create an .ARM.attributes section in
2950 output if there is no regular input object.
2951 (Target_arm::merge_processor_specific_flags): Check
2952 --warn-mismatch before printing any error.
2953 (Target_arm::merge_object_attributes): Ditto.
2954 * gold.cc (queue_middle_tasks): Handle the case in which there is
2955 no regular object in input.
2956 * options.cc (General_options::parse_EB): New method.
2957 (General_options::parse_EL): Same.
2958 (General_options::General_options): Initialize endianness_.
2959 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2961 (General_options::Endianness): New enum.
2962 (General_options::endianness): New method.
2963 (General_options::endianness_): New data member.
2964 * parameters.cc (Parameters::set_options): Check target endianness.
2965 (Parameters::set_target_once): Ditto.
2966 (Parameters::check_target_endianness): New method.
2967 (parameters_force_valid_target): If either -EL or -EB is specified,
2968 use it to define endianness of default target.
2969 * parameters.h (Parameters::check_target_endianness): New method
2971 * target.h (class Target): Change "endianity" to "endianness"
2974 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2976 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2977 * configure: Regenerate.
2978 * Makefile.in: Regenerate.
2979 * testsuite/Makefile.in: Regenerate.
2981 2010-04-06 Cary Coutant <ccoutant@google.com>
2984 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2985 prevailing definitions of common symbols.
2986 * testsuite/plugin_test_6.sh: New test case.
2987 * testsuite/plugin_common_test_1.c: New test case.
2988 * testsuite/plugin_common_test_2.c: New test case.
2989 * testsuite/Makefile.am (plugin_test_6): New test case.
2990 * testsuite/Makefile.in: Regenerate.
2992 2010-04-06 Nick Clifton <nickc@redhat.com>
2994 * po/vi.po: New Vietnamese translation.
2996 2010-03-30 Doug Kwan <dougkwan@google.com>
2998 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3000 2010-03-25 Doug Kwan <dougkwan@google.com>
3002 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3003 to avoid a conversion warning on a 32-bit host.
3005 2010-03-24 Ian Lance Taylor <iant@google.com>
3007 * testsuite/script_test_3.t: Add a TLS segment.
3008 * testsuite/Makefile.am (check_PROGRAMS): Add
3009 tls_phdrs_script_test.
3010 (tls_phdrs_script_test_SOURCES): Define.
3011 (tls_phdrs_script_test_DEPENDENCIES): Define.
3012 (tls_phdrs_script_test_LDFLAGS): Define.
3013 (tls_phdrs_script_test_LDADD): Define.
3014 * testsuite/Makefile.in: Rebuild.
3016 2010-03-23 Cary Coutant <ccoutant@google.com>
3018 * fileread.cc (find_or_make_view): Fix comment.
3020 2010-03-23 Ian Lance Taylor <iant@google.com>
3022 * script-sections.cc (class Orphan_section_placement): Define
3023 PLACE_TLS and PLACE_TLS_BSS.
3024 (Orphan_section_placement::Orphan_section_placement): Initialize
3026 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3027 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3028 (tls_script_test_SOURCES): Define.
3029 (tls_script_test_DEPENDENCIES): Define.
3030 (tls_script_test_LDFLAGS): Define.
3031 (tls_script_test_LDADD): Define.
3032 * testsuite/Makefile.in: Rebuild.
3034 2010-03-22 Doug Kwan <dougkwan@google.com>
3036 * arm.cc (Arm_relocate_functions::abs8,
3037 Arm_relocate_functions::abs16): Use correct check for overflow
3038 specified in the ARM ELF specs.
3039 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3040 target of a BLX instruction specially.
3041 (Reloc_stub::stub_type_for_reloc): Ditto.
3042 (Relocate::relocate): Use symbolic names instead of numeric relocation
3043 codes to report error.
3044 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3046 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3047 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3048 thumb2_blx_out_of_range.stdout
3049 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3050 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3051 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3052 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3053 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3054 thumb2_blx_in_range, thumb2_blx_in_range.o,
3055 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3056 thumb2_blx_out_of_range.o): New rules.
3057 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3058 thumb2_blx_in_range and thumb2_blx_out_of_range.
3059 * testsuite/Makefile.in: Regenerate.
3060 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3061 * testsuite/thumb_blx_in_range.s: New file.
3062 * testsuite/thumb_blx_out_of_range.s: New file.
3064 2010-03-22 Rafael Espindola <espindola@google.com>
3066 * archive.cc (Should_include): Move to archive.h.
3067 (should_include_member): Make it a member of Archive.
3069 (Add_lib_group_symbols): New.
3070 * archive.h: Include options.h.
3071 (Archive_member): Moved from Archive.
3072 (Should_include): Moved from archive.cc.
3074 (Add_lib_group_symbols): New.
3075 * dynobj.cc (do_should_include_member): New.
3076 * dynobj.h (do_should_include_member): New.
3077 * gold.cc (queue_initial_tasks): Update call to queue.
3078 * main.cc (main): Print lib group stats.
3079 * object.cc (do_should_include_member): New.
3080 * object.h: Include archive.h.
3081 (Object::should_include_member): New.
3082 (Object::do_should_include_member): New.
3083 (Sized_relobj::do_should_include_member): New.
3084 * options.cc (General_options::parse_start_lib): New.
3085 (General_options::parse_end_lib): New.
3086 (Input_arguments::add_file): Handle lib groups.
3087 (Input_arguments::start_group): Check we are not in a lib.
3088 (Input_arguments::start_lib): New.
3089 (Input_arguments::end_lib): New.
3090 * options.h (General_options): Add start_lib and end_lib.
3091 (Input_argument::lib_): New.
3092 (Input_argument::lib): New.
3093 (Input_argument::is_lib): New.
3094 (Input_file_lib): New.
3095 (Input_arguments::in_lib_): New.
3096 (Input_arguments::in_lib): New.
3097 (Input_arguments::start_lib): New.
3098 (Input_arguments::end_lib_): New.
3099 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3100 in unused members as preempted.
3101 (Sized_pluginobj::do_should_include_member): New.
3102 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3103 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3105 (Read_symbols::do_whole_lib_group): New.
3106 (Read_symbols::do_lib_group): New.
3107 (Read_symbols::do_read_symbols): Handle lib groups.
3108 (Read_symbols::get_name): Handle lib groups.
3109 * readsyms.h (Read_symbols): Add an archive member pointer.
3110 (Read_symbols::do_whole_lib_group): New.
3111 (Read_symbols::do_lib_group): New.
3112 (Read_symbols::member_): New.
3113 * script.cc (read_input_script): Update call to queue_soon.
3115 2010-03-19 Doug Kwan <dougkwan@google.com>
3117 * arm.cc (Stub_table::Stub_table): Initialize new data members
3118 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3119 (Stub_table::add_reloc_stub): Assign stub offset and update
3120 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3121 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3123 (Stub_table::update_data_size_and_addralign): Use
3124 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3125 instead of going over all reloc stubs.
3126 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3127 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3128 Stringpool_template::offset_ to size of Stringpool_char.
3129 (Stringpool_template::new_key_offset): Remove code to initialize
3130 Stringpool_template::offset_.
3131 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3132 Stringpool_template::offset_ to zero.
3134 2010-03-15 Doug Kwan <dougkwan@google.com>
3136 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3138 (Stringpool_template::new_key_offset): New method.
3139 (Stringpool_template::add_string): Assign offsets when adding new
3141 (Stringpool_template::set_string_offsets): Do not set string offsets
3142 when not optimizing.
3143 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3145 (Chunked_vector::clear): Clear size_.
3146 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3147 (Chunked_vector::size): Return size_.
3148 (Chunked_vector::push_back): Use size_ to find insert position.
3149 (Chunked_vector::size_): New data member.
3150 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3151 (Stringpool_template::new_key_offset): New method declaration.
3152 (Stringpool_template::offset_): New data member.
3154 2010-03-15 Rafael Espindola <espindola@google.com>
3156 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3157 Add_symbols' constructor.
3158 * readsyms.h (Add_symbols): Remove the input_group member.
3160 2010-03-10 Ian Lance Taylor <iant@google.com>
3162 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3163 target to ask whether a reference to a symbol requires a stack
3165 * target.h (Target::is_call_to_non_split): New function.
3166 (Target::do_is_call_to_non_split): Declare virtual function.
3167 * target.cc: Include "symtab.h".
3168 (Target::do_is_call_to_non_split): New function.
3169 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3171 2010-03-10 Cary Coutant <ccoutant@google.com>
3173 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3174 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3175 (File_read::open[2]): Add whole_file_view_ to list of views.
3176 (File_read::make_view): Remove test of whole_file_view_.
3177 (File_read::find_or_make_view): Create whole_file_view_ if
3179 (File_read::clear_views): Replace bool parameter with enum;
3180 adjust all callers. Don't delete views with permanent data;
3181 do delete cached views and views from archives if
3182 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3183 if clearing the corresponding view.
3184 * fileread.h (File_read::Clear_views_mode): New enum.
3185 (File_read::View::is_permanent_view): New method.
3186 (File_read::clear_views): Replace bool parameter
3187 with enum; adjust all callers.
3188 * options.h (General_options): Change keep_files_mapped option;
3189 add map_whole_files.
3190 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3192 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3195 2010-03-10 David S. Miller <davem@davemloft.net>
3197 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3199 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3201 * icf.cc (get_section_contents): Add '@' marker after processing the
3204 2010-03-08 Doug Kwan <dougkwan@google.com>
3206 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3207 due to a conversion warning.
3208 (Arm_relobj::update_output_local_symbol_count): Check for local
3209 symbol with unset output index.
3211 2010-03-05 Ian Lance Taylor <iant@google.com>
3213 * options.h (class General_options): Add --spare-dynamic-tags.
3214 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3215 --spare-dynamic-tags.
3217 2010-03-05 Ian Lance Taylor <iant@google.com>
3219 * incremental.cc: Include "libiberty.h".
3221 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3223 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3224 function, is_info_ member.
3225 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3226 (Versions::Versions): Update caller.
3227 (Versions::define_base_version): Likewise.
3228 (Versions::add_def): Likewise.
3230 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3232 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3233 (Scan::possible_function_pointer_reloc): New function.
3234 (Scan::local_reloc_may_be_function_pointer): Change to call
3235 possible_function_pointer_reloc.
3236 (Scan::global_reloc_may_be_function_pointer): Ditto.
3237 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3238 relocations in ".data.rel.ro._ZTV" section.
3239 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3240 * testsuite/icf_safe_so_test.cc: Ditto.
3241 * testsuite/icf_safe_test.cc: Ditto.
3242 * testsuite/icf_safe_test.sh: Ditto.
3244 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3245 Ian Lance Taylor <iant@google.com>
3247 * target-reloc.h (relocate_section): Check the symbol table index
3248 for -1U before setting the local symbol index.
3249 (scan_relocatable_relocs): If copying the relocation, record that
3250 the local symbol is required.
3251 * object.h (Symbol_value::is_output_symtab_index_set): New
3253 (Symbol_value::may_be_discarded_from_output_symtab): New
3255 (Symbol_value::has_output_symtab_entry): New function.
3256 (Symbol_value::needs_output_symtab_entry): Remove.
3257 (Symbol_value::output_symtab_index): Make sure the symbol index is
3259 (Symbol_value::set_output_symtab_index): Make sure the symbol
3260 index is not set. Make sure the new index is valid.
3261 (Symbol_value::set_must_have_output_symtab_entry): New function.
3262 (Symbol_value::has_output_dynsym_entry): New function.
3263 (Symbol_value::set_output_dynsym_index): Make sure the new index
3265 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3266 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3267 local symbol if permitted.
3268 (Sized_relobj::do_finalize_local_symbols): Call
3269 is_output_symtab_index_set rather than needs_output_symtab_entry.
3270 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3271 rather than needs_output_symtab_entry. Call
3272 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3273 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3274 is_output_symtab_index_set rather than needs_output_symtab_entry.
3275 * testsuite/discard_locals_relocatable_test.c: New file.
3276 * testsuite/discard_locals_test.sh: Test -r.
3277 * testsuite/Makefile.am (check_DATA): Add
3278 discard_locals_relocatable_test1.syms,
3279 discard_local_relocatable_test2.syms.
3280 (MOSTLYCLEANFILES): Likewise. Also add
3281 discard_locals_relocatable_test1.lout and
3282 discard_locals_relocatable_test2.out.
3283 (discard_locals_relocatable_test1.syms): New target.
3284 (discard_locals_relocatable_test.o): New target.
3285 (discard_locals_relocatable_test1.out): New target.
3286 (discard_locals_relocatable_test2.syms): New target.
3287 (discard_locals_relocatable_test2.out): New target.
3288 (various): Add missing ../ld-new dependencies.
3289 * testsuite/Makefile.in: Rebuild.
3291 2010-03-03 Nick Clifton <nickc@redhat.com>
3293 * po/fi.po: New Finnish translation.
3295 2010-03-01 Doug Kwan <dougkwan@google.com>
3297 * layout.cc (Layout::Layout): Force section types of .init_array*,
3298 .preinit_array* and .fini_array* sections.
3299 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3300 Fix check of return value of std::string::find.().
3301 (Output_section::Input_section_sort_compare::operator()): Remove
3302 comment about .init_array.
3303 (Output_section::Input_section_sort_init_fini_compare::operator()):
3305 (Output_section::sort_attached_input_sections): Handle .init_array
3306 and .fini_array specially.
3307 * output.h (Output_section::Inut_section_sort_compare): Update
3309 (Output_section::Input_section_sort_init_fini_compare): New struct.
3311 2010-02-26 Doug Kwan <dougkwan@google.com>
3313 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3314 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3315 * testsuite/debug_msg.sh: Avoid matching source line number for
3316 use of global variable undef_int.
3318 2010-02-26 Doug Kwan <dougkwan@google.com>
3320 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3321 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3322 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3323 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3324 * options.cc (General_options::General_options): Initialize member
3326 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3327 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3328 and rm_no_fix_v4bx.stdout
3329 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3330 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3331 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3332 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3333 and arm_no_fix_v4bx.
3334 * Makefile.in: Regenerate.
3335 * testsuite/arm_fix_v4bx.s: New file.
3336 * testsuite/arm_fix_v4bx.sh: Ditto.
3338 2010-02-24 Doug Kwan <dougkwan@google.com>
3340 * arm.cc (Target_arm::got_section): Make the .got section the first
3341 non RELRO section in the data segment.
3342 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3343 suffixes of section names.
3345 2010-02-24 Doug Kwan <dougkwan@google.com>
3347 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3348 flags and attributes merging if an input file is a binary file.
3349 * fileread.cc (Input_file::open): Record format of original file.
3350 * fileread.h (Input_file::Format): New enum type.
3351 (Input_file::Input_file): Initialize data member format_.
3352 (Input_file::format): New method definition.
3353 (Input_file::format_):: New data member.
3355 2010-02-24 Doug Kwan <dougkwan@google.com>
3357 * arm.cc (Arm_output_data_got): New class.
3358 (ARM_TCB_SIZE): New constant
3359 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3360 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3361 If user uses a script with a SECTIONS clause, issue only a warning
3362 for a misplaced EXIDX input section. Otherwise, issue an error.
3363 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3365 (Target_arm::got_mode_index_entry): Handle static linking.
3366 (Target_arm::Scan::local): Ditto.
3367 (Target_arm::Scan::global): Ditto.
3368 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3369 all incorrectly implemented relocations.
3370 (Target_arm::fix_exidx_coverage): Pass layout to
3371 Arm_output_section::fix_exidx_coverage.
3372 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3373 from ".ARM.exidx." and ".ARM.extab.".
3375 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3377 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3378 section if it does not already exist.
3379 * attributes.cc (Attributes_section_data::Attributes_section_data):
3380 Don't crash if size is zero.
3382 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3383 Ian Lance Taylor <iant@google.com>
3385 * gold.cc (queue_middle_tasks): If no input files were opened,
3387 * workqueue.h (Task_function::Task_function): Assert that there is
3390 2010-02-22 Doug Kwan <dougkwan@google.com>
3392 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3393 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3394 types to avoid warnings due to different uint64_t implementations
3397 2010-02-21 Doug Kwan <dougkwan@google.com>
3399 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3400 handling of the maximum backward branch offset.
3401 (Arm_relocate_functions::thumb_branch_common): Ditto.
3402 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3403 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3404 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3405 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3406 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3407 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3408 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3409 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3410 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3411 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3412 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3413 thumb2_bl_out_of_range.o): New rules.
3414 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3415 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3416 thumb2_bl_out_of_range
3417 * testsuite/Makefile.in: Regenerate.
3418 * testsuite/arm_bl_in_range.s: New file.
3419 * testsuite/arm_bl_out_of_range.s: Ditto.
3420 * testsuite/arm_branch_in_range.sh: Ditto.
3421 * testsuite/arm_branch_range.t: Ditto.
3422 * testsuite/thumb2_branch_range.t: Ditto.
3423 * testsuite/thumb_bl_in_range.s: Ditto.
3424 * testsuite/thumb_bl_out_of_range.s: Ditto.
3425 * testsuite/thumb_branch_range.t: Ditto.
3427 2010-02-20 Sriraman Tallam <tmsriram@google.com>
3429 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3430 Add reloc offset information.
3431 * icf.cc (get_section_contents): Change iterators to point to the new
3432 vectors. Add reloc offset information to the contents.
3433 * icf.h (Icf::Sections_reachable_info): New typedef.
3434 (Icf::Sections_reachable_list): New typedef.
3435 (Icf::Offset_info): New typedef.
3436 (Icf::Reloc_info): New struct typedef.
3437 (Icf::Reloc_info_list): New typedef.
3438 (Icf::symbol_reloc_list): Delete method.
3439 (Icf::addend_reloc_list): Delete method.
3440 (Icf::section_reloc_list): Delete method.
3441 (Icf::reloc_info_list): New method.
3442 (Icf::reloc_info_list_): New member.
3444 2010-02-19 Doug Kwan <dougkwan@google.com>
3446 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3447 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3448 * arm.cc (Arm_relocation_functions): New forward declaration.
3449 (Target_arm::Target_arm): Initialize new data members
3450 got_mod_index_offset_ and tls_base_symbol_defined_.
3451 (Target_arm::Relocate::relocate_tls): New method.
3452 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3453 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3455 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3456 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3457 (Target_arm::got_mod_index_offset_,
3458 Target_arm::tls_base_symbol_defined_): New data members.
3459 (Target_arm::Scan::local, Target::Scan::global,
3460 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3463 2010-02-18 Doug Kwan <dougkwan@google.com>
3465 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3466 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3467 text section as a parameter becuase some broken tools may not set
3468 the link in section header.
3469 (Target_arm::has_got_section): New method.
3470 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3471 without any mapping symbol as data only. Remove warning.
3472 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3473 link in its section header, try to discover the link by inspecting the
3474 REL31 relocation at the beginning of the section.
3475 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3477 (Target_arm::Scan::global): Treat any reference to the symbol
3478 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3480 2010-02-12 Sriraman Tallam <tmsriram@google.com>
3482 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3483 (Scan::global_reloc_may_be_function_pointer): New function.
3484 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3485 (Scan::global_reloc_may_be_function_pointer): New function.
3486 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3487 (Scan::global_reloc_may_be_function_pointer): New function.
3488 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3489 (Scan::global_reloc_may_be_function_pointer): New function.
3490 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3491 (Scan::global_reloc_may_be_function_pointer): New function.
3492 (Scan::possible_function_pointer_reloc): New function.
3493 (Target_x86_64::can_check_for_function_pointers): New function.
3494 * gc.h (gc_process_relocs): Scan relocation types to determine if
3495 function pointers were taken for targets that support it.
3496 * icf.cc (Icf::find_identical_sections): Include functions for
3497 folding in safe ICF whose pointer is not taken.
3498 * icf.h (Secn_fptr_taken_set): New typedef.
3499 (fptr_section_id_): New member.
3500 (section_has_function_pointers): New function.
3501 (set_section_has_function_pointers): New function.
3502 (check_section_for_function_pointers): New function.
3503 * options.h: Fix comment for safe ICF option.
3504 * target.h (can_check_for_function_pointers): New function.
3505 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3506 Modify icf_safe_test for X86-64.
3507 * testsuite/Makefile.in: Regenerate.
3508 * testsuite/icf_safe_so_test.cc: New file.
3509 * testsuite/icf_safe_so_test.sh: New file.
3510 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3511 (main): Change to take pointer to function kept_func_3.
3512 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3513 folding is done correctly for X86-64.
3515 2010-02-12 David S. Miller <davem@davemloft.net>
3517 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3518 is_symbolless parameter.
3519 (Output_reloc<SHT_REL>::is_symbolless): New.
3520 (Output_reloc<SHT_REL>::is_symbolless_): New.
3521 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3522 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3523 (Output_reloc<SHT_RELA>::is_symbolless): New.
3524 (Output_data_reloc::add_global): Handle is_symbolless.
3525 (Output_data_reloc::add_global_relative): Likewise.
3526 (Output_data_reloc::add_local): Likewise.
3527 (Output_data_reloc::add_local_relative): Likewise.
3528 (Output_data_reloc::add_symbolless_global_addend): New.
3529 (Output_data_reloc::add_symbolless_local_addend): New.
3530 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3532 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3533 instead of ->is_relative_
3534 (Output_reloc::write): Likewise.
3535 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3536 (Output_reloc::write_rel): Simplify.
3538 * sparc.cc (Target_sparc::Scan::local): Use
3539 ->add_symbolless_local_addend as needed.
3540 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3541 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3542 based upon relocation offset.
3544 2010-02-11 Doug Kwan <dougkwan@google.com>
3546 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3547 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3548 beginning of function.
3549 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3550 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3551 parameter is_32bit in calls to should_apply_static_reloc.
3552 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3553 (check_DATA): Add arm_abs_global.stdout.
3554 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3555 arm_abs_global.stdout): New rules.
3556 (MOSTLLYCLEANFILES): Add arm_abs_global
3557 * Makefile.in: Regenerate.
3558 * testsuite/arm_abs_global.s: New file.
3559 * testsuite/arm_abs_global.sh: Ditto.
3560 * testsuite/arm_abs_lib.s: Ditto.
3562 2010-02-11 Ian Lance Taylor <iant@google.com>
3564 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3566 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3567 Allocate_commons_task first.
3568 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3569 task, rather than symtab_lock_.
3570 (Gc_process_relocs::~Gc_process_relocs): New function.
3571 (Gc_process_relocs::is_runnable): Check this_blocker_.
3572 (Gc_process_relocs::locks): Use next_blocker_ rather than
3574 (Scan_relocs::~Scan_relocs): New function.
3575 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3577 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3579 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3580 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3581 constructor accordingly.
3582 (class Gc_process_relocs): Likewise.
3583 (class Scan_relocs): Likewise.
3584 * common.h (class Allocate_commons_task): Remove symtab_lock_
3585 field, and corresponding constructor parameter.
3586 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3588 (Allocate_commons_task::locks): Likewise.
3590 2010-02-11 Ian Lance Taylor <iant@google.com>
3592 * gold-threads.h (class Once): Define.
3593 (class Initialize_lock): Rewrite as child of Once.
3594 * gold-threads.cc (class Once_initialize): Define.
3595 (once_pointer_control): New static variable.
3596 (once_pointer, once_arg): New static variables.
3597 (c_run_once): New static function.
3598 (Once::Once, Once::run_once, Once::internal_run): New functions.
3599 (class Initialize_lock_once): Remove.
3600 (initialize_lock_control): Remove.
3601 (initialize_lock_pointer): Remove.
3602 (initialize_lock_once): Remove.
3603 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3604 (Initialize_lock::initialize): Rewrite.
3605 (Initialize_lock::do_run_once): New function.
3606 * archive.cc (Archive::interpret_header): Only clear name if it is
3608 * fileread.cc: Include "gold-threads.h"
3609 (file_counts_lock): New static variable.
3610 (file_counts_initialize_lock): Likewise.
3611 (File_read::release): Only increment counts when using --stats.
3612 Use a lock around the increment.
3613 * parameters.cc (class Set_parameters_target_once): Define.
3614 (set_parameters_target_once): New static variable.
3615 (Parameters::Parameters): Move here from parameters.h.
3616 (Parameters::set_target): Rewrite.
3617 (Parameters::set_target_once): New function.
3618 (Parameters::clear_target): Move here and rewrite.
3619 * parameters.h (class Parameters): Update declarations. Add
3620 set_parameters_target_once_ field.
3621 (Parameters::Parameters): Move to parameters.cc.
3622 (Parameters::clear_target): Likewise.
3623 * readsyms.cc (Read_symbols::do_group): Create a Start_group
3625 (Start_group::~Start_group): New function.
3626 (Start_group::is_runnable): New function.
3627 (Start_group::locks, Start_group::run): New functions.
3628 (Finish_group::run): Change saw_undefined to size_t.
3629 * readsyms.h (class Start_group): Define.
3630 (class Finish_group): Change saw_undefined_ field to size_t.
3631 (Finish_group::Finish_group): Remove saw_undefined and
3632 this_blocker parameters. Change all callers.
3633 (Finish_group::set_saw_undefined): New function.
3634 (Finish_group::set_blocker): New function.
3635 * symtab.h (class Symbol_table): Change saw_undefined to return
3636 size_t. Change saw_undefined_ field to size_t.
3637 * target-select.cc (Set_target_once::do_run_once): New function.
3638 (Target_selector::Target_selector): Initialize set_target_once_
3639 field. Don't initialize lock_ and initialize_lock_ fields.
3640 (Target_selector::instantiate_target): Rewrite.
3641 (Target_selector::set_target): New function.
3642 * target-select.h (class Set_target_once): Define.
3643 (class Target_selector): Update declarations. Make
3644 Set_target_once a friend. Remove lock_ and initialize_lock_
3645 fields. Add set_target_once_ field.
3647 2010-02-10 Ian Lance Taylor <iant@google.com>
3649 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3651 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
3652 (queue_middle_tasks): Add all blockers before queueing any tasks.
3653 (queue_final_tasks): Likewise.
3654 * token.h (Task_token::add_blockers): New function.
3655 * object.h (Input_objects::number_of_relobjs): New function.
3657 2010-02-10 Ian Lance Taylor <iant@google.com>
3659 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3660 shared, not if not position independent.
3661 * x86_64.cc (Relocate::relocate_tls): Likewise.
3662 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3663 (tls_pie_pic_test): New target.
3664 * testsuite/Makefile.in: Rebuild.
3666 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3667 (tls_test_main_pie.o, tls_test_pie.o): New targets.
3668 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3669 * testsuite/Makefile.in: Rebuild.
3671 2010-02-09 David S. Miller <davem@davemloft.net>
3673 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3674 R_SPARC_RELATIVE using ->add_local_relative().
3675 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3677 * output.h (Output_data_dynamic::add_section_size): New method
3678 that takes two Output_data objects.
3679 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3680 entry param. Handle it in initializers.
3681 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3682 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3683 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3685 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3686 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3687 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3688 for dynrel_includes_plt.
3689 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3690 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3691 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3693 (Target_sparc::do_finalize_sections): Update to pass true for
3694 dynrel_includes_plt.
3695 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3696 output before .rela.plt
3697 (Target_powerpc::do_finalize_sections): Update to pass true for
3698 dynrel_includes_plt when 32-bit.
3700 2010-02-08 Doug Kwan <dougkwan@google.com>
3702 * arm.cc (Arm_relobj::simple_input_section_output_address): New
3704 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3705 Arm_relobj::scan_section_for_cortex_a8_stubs,
3706 Arm_relobj::do_relocation_section): Instead of calling
3707 Output_section::output_address, use faster
3708 Arm_relobj::simple_input_section_output_address.
3710 2010-02-08 David S. Miller <davem@davemloft.net>
3712 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3713 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3714 relocation helper function.
3716 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3717 just like R_SPARC_GOT{10,13,22}.
3718 (Target_sparc::Scan::local): Likewise.
3719 (Target_sparc::Relocate:relocate): Likewise.
3721 2010-02-06 Ian Lance Taylor <iant@google.com>
3723 * configure.ac: Rewrite targetobjs duplicate removal code to use
3724 only shell constructs.
3725 * configure: Rebuild.
3727 2010-02-05 Doug Kwan <dougkwan@google.com>
3730 * arm.cc (Arm_relobj::section_is_scannable): New method.
3731 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3732 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3734 2010-02-04 Doug Kwan <dougkwan@google.com>
3737 * arm-reloc-property.cc (cstdio): Include.
3738 * configure.ac (targetobjs): Remove duplicates.
3739 * configure: Regenerate.
3740 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3741 big and little endian version for a given address size.
3743 2010-02-03 Doug Kwan <dougkwan@google.com>
3745 * arm-reloc-property.cc
3746 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3748 * arm-reloc-property.h
3749 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3750 New method definition.
3751 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3753 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3755 (GOT_PREL): Change implemented to Y.
3756 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3757 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3758 (Arm_relocate_functions::movw_abs_nc): Remove method.
3759 (Arm_relocate_functions::movt_abs): Ditto.
3760 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3761 (Arm_relocate_functions::thm_movt_abs): Ditto.
3762 (Arm_relocate_functions::movw_rel_nc): Ditto.
3763 (Arm_relocate_functions::movw_rel): Ditto.
3764 (Arm_relocate_functions::movt_rel): Ditto.
3765 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3766 (Arm_relocate_functions:thm_movw_rel): Ditto.
3767 (Arm_relocate_functions:thm_movt_rel): Ditto.
3768 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3769 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3770 New method definitions.
3771 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3772 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3773 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3774 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3775 (Target_arm::Relocate::relocate): Check for non-static or
3776 unimplemented relocation code and exit early. Change calls to
3777 Target_arm::reloc_uses_thumb_bit and
3778 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3779 instead. Refactor code to handle similar relocations to increase
3780 code sharing. Remove check for unsupported relocation code in switch
3782 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3783 relocation property table to find out size. Change error message to
3784 print out the name of a relocation code instead of the numeric value.
3785 (Target_arm::scan_reloc_for_stub): Use relocation property table
3786 instead of calling Target_arm::reloc_uses_thumb_bit().
3788 2010-02-02 Doug Kwan <dougkwan@google.com>
3790 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3791 types of relaxed input section.
3793 2010-02-02 Doug Kwan <dougkwan@google.com>
3795 * Makefile.am (HFILES): Add arm-reloc-property.h.
3797 (TARGETSOURCES): Add arm-reloc-property.cc
3798 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3799 (libgold_a_SOURCES): $(DEFFILES)
3800 * Makefile.in: Regenerate.
3801 * arm-reloc-property.cc: New file.
3802 * arm-reloc-property.h: New file.
3803 * arm-reloc.def: New file.
3804 * arm.cc: Update comments.
3805 (arm-reloc-property.h): New included header.
3806 (arm_reloc_property_table): New global variable.
3807 (Target_arm::do_select_as_default_target): New method definition.
3808 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3809 arm-reloc-property to targ_extra_obj.
3810 * parameters.cc (set_parameters_target): Call
3811 Target::select_as_default_target().
3812 * target.h (Target::select_as_default_target): New method definition.
3813 (Target::do_select_as_default_target): Same.
3815 2010-02-01 Doug Kwan <dougkwan@google.com>
3817 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3818 first_output_text_section_.
3819 (Arm_exidx_fixup::first_output_text_section): New method definition.
3820 (Arm_exidx_fixup::first_output_text_section_): New data member.
3821 (Arm_exidx_fixup::process_exidx_section): Record the first text
3822 output section seen.
3823 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3824 and entsize in output section header.
3826 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3828 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3829 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3830 (Arm_relocate_functions::thm_alu11): New Method.
3831 (Arm_relocate_functions::thm_pc8): New Method.
3832 (Arm_relocate_functions::thm_pc12): New Method.
3833 (Target_arm::Scan::local): Handle the relocations.
3834 (Target_arm::Scan::global): Likewise.
3835 (Target_arm::Relocate::relocate): Likewise.
3836 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3838 2010-01-29 Doug Kwan <dougkwan@google.com>
3840 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3841 of relocation types as ld.
3843 2010-01-29 Doug Kwan <dougkwan@google.com>
3845 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3847 (Arm_relocate_functions::thumb_branch_common): Ditto.
3848 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3849 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3850 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3851 Arm_relocate_functions::jump24): Remove.
3852 (Target_arm::Relocate::relocate): Adjust code to call
3853 Arm_relocation_functions::arm_branch_common and
3854 Arm_relocation_functions::thumb_branch_common instead of their removed
3855 wrappers. Merge switch-cases together to reduce source code size.
3857 2010-01-29 Doug Kwan <dougkwan@google.com>
3859 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3860 output_local_symbol_count_needs_update_.
3861 (Arm_relobj::output_local_symbol_count_needs_update,
3862 Arm_relobj::set_output_local_symbol_count_needs_update,
3863 Arm_relobj::update_output_local_symbol_count): New methods.
3864 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3866 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3867 of pointed function as in a R_ARM_PREL31 relocation.
3868 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3869 for output local symbol count updating.
3870 (Target_arm::do_relax): Update output local symbol counts in objects
3872 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3874 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3876 * arm.cc: Added support for the ARM relocations:
3877 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3878 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3879 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3881 (Arm_relocate_functions::movw_rel): New method.
3882 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3883 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3885 (Arm_relocate_functions::thm_movw_rel): New method.
3886 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3888 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3890 (Target_arm::Scan::global): Likewise.
3891 (Target_arm::Relocate::relocate): Likewise.
3892 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3895 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3897 * arm.cc: Added support for ARM group relocations.
3898 (Target_arm::reloc_needs_sym_origin): New method.
3899 (Arm_relocate_functions::calc_grp_kn): New method.
3900 (Arm_relocate_functions::calc_grp_residual): New method.
3901 (Arm_relocate_functions::calc_grp_gn): New method.
3902 (Arm_relocate_functions::arm_grp_alu): New Method.
3903 (Arm_relocate_functions::arm_grp_ldr): New Method.
3904 (Arm_relocate_functions::arm_grp_ldrs): New Method.
3905 (Arm_relocate_functions::arm_grp_ldc): New Method.
3906 (Target_arm::Scan::local): Handle the ARM group relocations.
3907 (Target_arm::Scan::global): Likewise.
3908 (Target_arm::Relocate::relocate): Likewise.
3909 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3912 2010-01-26 Doug Kwan <dougkwan@google.com>
3914 * arm.cc (set): Include.
3915 (class Arm_exidx_fixup): Change type of last_input_section_ to const
3917 (Arm_output_section::Text_section_list): New type.
3918 (Arm_output_section::append_text_sections_to_list): New method.
3919 (Arm_output_section::fix_exidx_coverage): Ditto.
3920 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3921 (Arm_relobj::convert_input_section_to_relaxed_section): Use
3922 Relobj::set_section_offset() instead of
3923 Sized_relobj::invalidate_section_offset().
3924 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3925 parameter for section headers. Ignore relocation sections for
3926 unallocated sections and EXIDX sections.
3927 (Target_arm::fix_exidx_coverage): New method.
3928 (Target_arm::output_section_address_less_than): New type.
3929 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3930 linked text section instead of the EXIDX section.
3931 (Arm_output_section::create_stub_group): Add an assertion to check
3932 that this is not an EXIDX output section.
3933 (Arm_output_section::append_text_sections_to_list): New method.
3934 (Arm_output_section::fix_exidx_coverage): Ditto.
3935 (Arm_relobj::scan_sections_for_stubs): Adjust call to
3936 Arm_relobj::section_needs_reloc_stub_scanning.
3937 (Target_arm::do_relax): Fix EXIDX output section coverage in the
3939 (Target_arm::fix_exidx_coverage): New method.
3940 * object.h (Relobj::set_output_section): New method.
3941 (Sized_relobj::invalidate_section_offset): Remove method.
3942 (Sized_relobj::do_invalidate_section_offset): Remove method.
3943 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3945 2010-01-25 Doug Kwan <dougkwan@google.com>
3947 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3948 Fix warning due to signed and unsigned comparison on a 32-bit host.
3950 2010-01-22 Doug Kwan <dougkwan@google.com>
3952 * arm.cc (Target_arm::do_relax): Record an output section for section
3953 offset adjustment it contains any stub table that has changed.
3954 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3955 offsets in an output section if necessary.
3956 * output.cc (Output_section::Output_section): Initialize
3957 section_offsets_need_adjustments_.
3958 (Output_section::add_input_section_for_script): Renamed to
3959 Output_section::add_simple_input_section.
3960 (Output_section::save_states): Add a comment.
3961 (Output_section::discard_states): New method defintion.
3962 (Output_section::adjust_section_offsets): Same.
3963 * output.h (Output_section::add_input_section_for_script): Renamed to
3964 Output_section::add_simple_input_section.
3965 (Output_section::discard_states): New method declaration.
3966 (Output_section::adjust_section_offsets): Same.
3967 (Output_section::section_offsets_need_adjustment,
3968 Output_section::set_section_offsets_need_adjustment): New method
3970 (Output_section::section_offsets_need_adjustment_): New data member.
3971 * script-sections.cc
3972 (Output_section_element_input::set_section_address): Adjust code for
3973 renaming of Output_section::add_input_section_for_script.
3974 (Orphan_output_section::set_section_address): Same.
3976 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3978 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3979 Fix_v4bx enum values .
3980 * gold/options.h (General_options): New option definitions.
3981 (General_options::fix_v4bx): New method.
3982 (General_options::Fix_v4bx): New enum.
3983 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3984 (General_options::parse_fix_v4bx_interworking): New method.
3986 2010-01-22 Doug Kwan <dougkwan@google.com>
3988 * arm.cc (Arm_exidx_fixup): New class.
3990 2010-01-21 Doug Kwan <dougkwan@google.com>
3992 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3994 (Arm_exidx_section_offset_map): New type.
3996 2010-01-21 Doug Kwan <dougkwan@google.com>
3998 * arm.cc (Arm_exidx_input_section): New class.
3999 (Arm_relobj::exidx_input_section_by_link,
4000 Arm_relobj::exidx_input_section_by_shndx,
4001 Arm_relobj::make_exidx_input_section): New methods.
4002 (read_arm_attributes_section): Remove.
4003 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4004 information about them.
4005 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4008 2010-01-20 Doug Kwan <dougkwan@google.com>
4010 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4011 Input_section_specifier to Section_id.
4012 (Target_arm::new_arm_input_section: Adjust code for change of key
4014 (Target_arm::find_arm_input_section): Ditto.
4015 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4016 (Section_id): Remove.
4017 (Garbage_collection::Section_id_hash): Remove.
4018 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4019 (Section_id): Remove.
4020 (Icf::Section_id_hash): Remove.
4021 * object.h (Section_id, Const_section_id, Section_id_hash,
4022 Const_section_id_hash): New type definitions.
4023 * output.cc (Output_section::add_relaxed_input_section): Change to
4024 use Const_section_id instead of Input_section_specifier as key type.
4025 (Output_section::add_merge_input_section): Ditto.
4026 (Output_section::build_relaxation_map): Change to use Section_id
4027 instead of Input_section_specifier as key type.
4028 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4030 (Output_section::convert_input_sections_to_relaxed_sections): Change
4031 to use Const_section_id instead of Input_section_specifier as key type.
4032 (Output_section::find_merge_section): Ditto.
4033 (Output_section::find_relaxed_input_section): Ditto.
4034 * output.h (Input_section_specifier): Remove class.
4035 (Output_section::Output_section_data_by_input_section_map): Change
4036 key type to Const_section_id.
4037 (Output_section::Output_relaxed_input_section_by_input_section_map):
4039 (Output_section::Relaxation_map): Change key type to Section_id.
4041 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4043 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4044 (class Arm_v4bx_stub): New class.
4045 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4046 (Stub_factory::make_arm_v4bx_stub): New method.
4047 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4048 (Stub_table::empty): Handle v4bx stubs.
4049 (Stub_table::add_arm_v4bx_stub): New method.
4050 (Stub_table::find_arm_v4bx_stub): New method.
4051 (Arm_relocate_functions::v4bx): New method.
4052 (Target_arm::fix_v4bx): New method.
4053 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4054 (Stub_table::relocate_stubs): Likewise.
4055 (Stub_table::do_write): Likewise.
4056 (Stub_table::update_data_size_and_addralign): Likewise.
4057 (Stub_table::finalize_stubs): Likewise.
4058 (Target_arm::Scan::local): Likewise.
4059 (Target_arm::Scan::global): Likewise.
4060 (Target_arm::do_finalize_sections): Likewise.
4061 (Target_arm::Relocate::relocate): Likewise.
4062 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4064 (Target_arm::scan_reloc_for_stub): Likewise.
4065 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4067 2010-01-19 Ian Lance Taylor <iant@google.com>
4069 * output.cc (Output_section_headers::do_sized_write): Write large
4070 segment count to sh_info field.
4071 (Output_file_header::do_sized_write): For large segment count,
4072 write PN_XNUM to e_phnum field.
4074 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4076 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4077 (Arm_relocate_functions::thm_jump8): New function.
4078 (Arm_relocate_functions::thm_jump11): New function.
4079 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4081 (Target_arm::Scan::global): Likewise.
4082 (Target_arm::Relocate::relocate): Likewise.
4083 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4086 2010-01-14 Doug Kwan <dougkwan@google.com>
4088 * arm.cc (map, utility): Include headers.
4089 (Target_arm::apply_cortex_a8_workaround): New method.
4090 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4091 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4092 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4093 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4094 the --[no-]fix-cortex-a8 command line options.
4095 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4096 (Target_arm::relocate_stub): Use addend in instruction template.
4097 * options.h (DEFINE_bool): Set the user-set flag.
4098 (General_options): Add --[no-]-fix-cortex options.
4099 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4100 : Update fast look-up map after conversion.
4102 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4104 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4105 in the first pass of do_layout.
4107 2010-01-13 Doug Kwan <dougkwan@google.com>
4109 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4110 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4111 apparent compiler problem of not folding static constant integral
4112 data members of elfcpp::Elf_sizes<32>.
4114 2010-01-13 Doug Kwan <dougkwan@google.com>
4116 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4117 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4118 Arm_relobj::scan_section_for_cortex_a8_erratum,
4119 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4120 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4121 sections to scan for relocation stubs into a new method
4122 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4123 relocation and Cortex-A8 stub scanning.
4124 (Target_arm::do_relax): Force stubs to be after stubbed sections
4125 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4126 the beginning of a new relaxation pass. Update a comment.
4127 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4129 2010-01-12 Ian Lance Taylor <iant@google.com>
4131 * target-reloc.h (visibility_error): New inline function.
4132 (relocate_section): Call visibility_error.
4133 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4134 (MOSTLYCLEANFILES): Likewise.
4135 (protected_4_pic.o, protected_3.err): New targets.
4136 * testsuite/protected_4.cc: New file.
4138 2010-01-12 Doug Kwan <dougkwan@google.com>
4140 * arm.cc (Cortex_a8_reloc): New class.
4141 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4142 and cortex_a8_relocs_info_.
4143 (Target_arm::fix_cortex_a8): New method definition.
4144 (Target_arm::Cortex_a8_relocs_info): New type.
4145 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4146 New data member declarations.
4147 (Target_arm::scan_reloc_for_stub): Record information about
4148 relocations for THUMB branches that might be exempted from the
4149 Cortex-A8 workaround.
4150 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4151 at the beginning of a relaxation pass.
4153 2010-01-12 Doug Kwan <dougkwan@google.com>
4155 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4156 (Arm_relobj::Mapping_symbol_position,
4157 Arm_reloj::Mapping_symbol_position_less,
4158 Arm_relobj::Mapping_symbols_info): New types.
4159 (Target_arm::is_mapping_symbol_name): New method definition.
4160 (Arm_relobj::do_count_local_symbols): Save information about mapping
4163 2010-01-11 Doug Kwan <dougkwan@google.com>
4165 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4166 Arm_relocate_functions::thumb32_branch_upper,
4167 Arm_relocate_functions::thumb32_branch_lower,
4168 Arm_relocate_functions::thumb32_cond_branch_offset,
4169 Arm_relocate_functions::thumb32_cond_branch_upper,
4170 Arm_relocate_functions::thumb32_cond_branch_lower,
4171 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4172 branch offset encoding.
4173 (Arm_relocate_functions::thumb_branch_common): Use new branch
4174 offset encoding methods to avoid code duplication.
4175 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4176 (Stub_addend_reader::operator()): Use new branch encoding method
4177 to avoid code duplication.
4179 2010-01-11 Doug Kwan <dougkwan@google.com>
4181 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4182 (Target_arm::do_finalize_sections): Define special EXIDX section
4183 symbols only if referenced.
4184 * gc.h (Garbage_collection::add_reference): New method.
4185 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4188 2010-01-11 Ian Lance Taylor <iant@google.com>
4190 * script.cc (Version_script_info::build_expression_list_lookup):
4191 Change complaing about duplicate wildcard match from error to
4194 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4196 (Version_script_info::Version_script_info): Initialize globs_,
4197 default_version_, default_is_global_, and exact_. Don't
4198 initialize globals_ or locals_.
4199 (Version_script_info::build_lookup_tables): Build local symbols
4201 (Version_script_info::unquote): New function.
4202 (Version_script_info::add_exact_match): New function.
4203 (Version_script_info::build_expression_list_lookup): Remove lookup
4204 parameter. Add is_global parameter. Change all callers. Handle
4205 wildcard pattern specially. Unquote pattern. Call
4207 (Version_script_info::get_name_to_match): New function.
4208 (Version_script_info::get_symbol_version): New function.
4209 (Version_script_info::get_symbol_version_helper): Remove.
4210 (Version_script_info::check_unmatched_names): Call unquote.
4211 * script.h (class Version_script_info): Change get_symbol_version
4212 to be non-inline and add is_global parameter; change all callers.
4213 Rewrite symbol_is_local. Update declarations. Define struct
4214 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4215 Remove globals_ and locals_ members. Add exact_, globs_,
4216 default_version_, is_global_.
4217 (Version_script_info::Glob): Remove pattern, add expression and
4218 is_global. Update constructor. Change all callers.
4219 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4221 (Versions::symbol_section_contents): If a symbol is undefined, or
4222 defined in a dynamic object, set the version index to
4224 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4226 (Symbol_table::add_from_pluginobj): Likewise.
4227 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4229 2010-01-11 Doug Kwan <dougkwan@google.com>
4231 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4232 (incremental_dump_LDADD): Add linking option for libintl.
4233 * Makefile.in: Regenerate.
4235 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4238 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4240 * testsuite/Makefile.in: Regenerated.
4242 2010-01-10 Doug Kwan <dougkwan@google.com>
4244 * options.h (DEFINE_var): Use parentheses around argument varname__
4245 in macro body to avoid any unintended subsequent substitutions.
4247 2010-01-10 Ian Lance Taylor <iant@google.com>
4249 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4250 candidates before doing symbol resolution.
4252 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4253 ODR candidates if only one is weak.
4255 2010-01-08 Ian Lance Taylor <iant@google.com>
4257 * script.cc (Version_script_info::build_expression_list_lookup):
4258 Don't warn about ambiguous version, just record the ambiguity.
4259 (Version_script_info::get_symbol_version_helper): Give error if
4260 version is ambiguous.
4262 2010-01-08 Doug Kwan <dougkwan@google.com>
4264 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4265 prev_data_size_ and prev_addralign_. Remove initializer for
4266 deleted data member has_been_changed_.
4267 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4268 to determine if the table is empty.
4269 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4271 (Stub_table::add_reloc_stub): Define method in class definition
4272 instead of just declaring it there.
4273 (Stub_table::add_cortex_a8_stub): New method definition.
4274 (Stub_table::update_data_size_and_addralign): Ditto.
4275 (Stub_table::finalize_stubs): Ditto.
4276 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4277 (Stub_table::do_addralign_): Return address alignment in the
4278 (Stub_table::do_reset_address_and_file_offset): Define method in
4279 class definition instead of declaring it there. Set current data
4280 size to be the data size of the previous pass.
4281 (Stub_table::set_final_data_size): Use current data size as the
4283 (Stub_table::relocate_stub): Change parameter type of stub from
4284 Reloc_stub pointer to Stub pointer.
4285 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4286 (Stub_table::Cortex_a8_stub_list): New typedef.
4287 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4288 Stub_table::prev_addralign_): New data member.
4289 (Arm_relobj::Arm_relobj): Initialize data member
4290 section_has_cortex_a8_workaround_.
4291 (Arm_relobj::section_has_cortex_a8_workaround,
4292 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4294 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4296 (Target_arm::relocate_stub): Change parameter type of stub from
4297 Reloc_stub pointer to Stub pointer.
4298 (Insn_template::size, Insn_template::alignment): Handle
4299 THUMB16_SPECIAL_TYPE.
4300 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4301 Stub_table::update_data_size_and_addralign,
4302 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4304 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4305 (Stub_table::do_write): Ditto.
4306 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4308 2010-01-08 Ian Lance Taylor <iant@google.com>
4311 * symtab.h (class Symbol): Remove fields is_target_special_ and
4312 has_plt_offset_. Add field is_defined_in_discarded_section_.
4313 (Symbol::is_defined_in_discarded_section): New function.
4314 (Symbol::set_is_defined_in_discarded_section): New function.
4315 (Symbol::has_plt_offset): Rewrite.
4316 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4317 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4318 Don't initialize is_target_special_ or has_plt_offset_.
4319 Initialize is_defined_in_discarded_section_.
4320 (Symbol_table::add_from_relobj): If appropriate, set
4321 is_defined_in_discarded_section.
4322 * resolve.cc (Symbol::override_base_with_special): Don't test
4323 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4324 * target-reloc.h (relocate_section): Do special handling for
4325 symbols defined in discarded sections for global symbols as well
4328 2010-01-08 Ian Lance Taylor <iant@google.com>
4330 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4331 the SHT_SYMTAB case.
4333 2010-01-08 Ian Lance Taylor <iant@google.com>
4335 * object.cc (Sized_relobj::do_layout): Don't get confused if
4336 layout_eh_frame returns NULL.
4338 2010-01-08 Ian Lance Taylor <iant@google.com>
4341 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4342 dynamic symbol table, use the normal symbol table.
4343 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4346 2010-01-08 Ian Lance Taylor <iant@google.com>
4349 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4352 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4354 * version.cc (print_version): Change to "Copyright 2010".
4356 2010-01-08 Ian Lance Taylor <iant@google.com>
4360 * i386.cc (class Target_i386): Change return type of plt_section
4362 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4363 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4364 tls_desc_rel_ field.
4365 (Output_data_plt_i386::rel_tls_desc): New function.
4366 (Target_i386::rel_tls_desc_section): New function.
4367 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4368 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4369 R_386_TLS_DESC reloc in rel_tls_desc_section.
4370 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4371 Define struct Tlsdesc_info.
4372 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4373 (Target_x86_64::do_reloc_symbol_index): New function.
4374 (Target_x86_64::add_tlsdesc_info): New function.
4375 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4376 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4378 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4380 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4381 (Target_x86_64::rela_tlsdesc_section): New function.
4382 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4384 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4385 (Target_x86_64::do_reloc_addend): New function.
4386 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4387 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4388 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4389 (Output_reloc::type): New function.
4390 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4391 (Output_reloc::is_target_specific): New function.
4392 (Output_reloc::target_arg): New function.
4393 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4394 absolute relocs and target specific relocs.
4395 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4396 add_target_specific.
4397 (class Output_data_reloc) [SHT_RELA]: Likewise.
4398 * output.cc (Output_reloc::Output_reloc): Add four new versions
4399 for absolute relocs and target specific relocs.
4400 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4401 (Output_reloc::get_symbol_index): Likewise.
4402 (Output_reloc::local_section_offset): Check that local_sym_index_
4403 is not TARGET_CODE or 0.
4404 (Output_reloc::symbol_value): Likewise.
4405 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4407 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4408 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4410 * layout.cc (add_target_dynamic_tags): Use output section for
4411 DT_PLTRELSZ and DT_JMPREL.
4413 2010-01-07 Ian Lance Taylor <iant@google.com>
4416 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4418 (class Output_data_reloc_generic): Define.
4419 (class Output_data_reloc_base): Change base class to
4420 Output_data_reloc_generic. Change add() method to call
4421 bump_relative_reloc_count for a relative reloc. Remove
4423 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4425 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4426 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4428 * layout.h (class Layout): Update declaration.
4430 2010-01-07 Ian Lance Taylor <iant@google.com>
4432 * output.h (class Output_data): Add const version of
4433 output_section and do_output_section.
4434 (class Output_section_data): Add const version of
4436 (class Output_section): Likewise.
4437 * layout.cc (Layout::add_target_dynamic_tags): New function.
4438 * layout.h (class Layout): Update declarations.
4439 * arm.cc (Target_arm::do_finalize_sections): Use
4440 add_target_dynamic_tags.
4441 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4442 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4443 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4444 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4446 2010-01-07 Ian Lance Taylor <iant@google.com>
4449 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4452 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4453 Ian Lance Taylor <iant@google.com>
4456 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4457 Xindex::read_symtab_xindex.
4459 2010-01-07 Doug Kwan <dougkwan@google.com>
4461 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4462 (Insn_template::thumb16_bcond_insn): New method declaration.
4463 (Insn_template): Fix spelling.
4464 (Stub::thumb16_special): New method declaration.
4465 (Stub::do_write): Define virtual method which was previously pure
4467 (Stub::do_thumb16_special): New method declaration.
4468 (Stub::do_fixed_endian_write): New template member.
4469 (Reloc_stub::do_write): Remove.
4470 (Reloc_stub::do_fixed_endian_write): Remove.
4471 (Cortex_a8_stub): New class definition.
4472 (Stub_factory::make_cortex_a8_stub): New method definition.
4473 (Stub_factory::Stub_factory): Add missing static storage class
4474 qualifier for elf32_arm_stub_a8_veneer_blx.
4476 2010-01-07 Ian Lance Taylor <iant@google.com>
4479 * options.h (class General_options): Add --warn-unresolved-symbols
4480 and --error-unresolved-symbols.
4481 * errors.cc (Errors::undefined_symbol): Implement
4482 --warn-unresolved-symbols.
4484 * options.h (class General_options): Add -z text and -z textoff.
4485 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4487 2010-01-06 Sriraman Tallam <tmsriram@google.com>
4489 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4490 (Garbage_collection::cident_sections): New function.
4491 (Garbage_collection::add_cident_section): New function.
4492 (Garbage_collection::cident_sections_): New member.
4493 (gc_process_relocs): Add references to sections whose names are C
4495 * gold.h (cident_section_start_prefix): New constant.
4496 (cident_section_stop_prefix): New constant.
4497 (is_cident): New function.
4498 * layout.cc (Layout::define_section_symbols): Replace string constants
4499 with the newly defined constants.
4500 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4502 * testsuite/Makefile.am: Add gc_orphan_section_test.
4503 * testsuite/Makefile.in: Regenerate.
4504 * testsuite/gc_orphan_section_test.cc: New file.
4505 * testsuite/gc_orphan_section_test.sh: New file.
4507 2010-01-06 Ian Lance Taylor <iant@google.com>
4510 * options.h (class General_options): Add --warn-shared-textrel.
4511 * layout.cc (Layout::finish_dynamic_section): Implement
4512 --warn-shared-textrel.
4515 * options.h (class General_options): Add --warn-multiple-gp.
4517 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4519 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4520 $(THREADSLIB) and $(LIBDL).
4521 * Makefile.in: Rebuild.
4523 2010-01-06 Ian Lance Taylor <iant@google.com>
4526 * options.cc (General_options::parse_section_start): New function.
4527 (General_options::section_start): New function.
4528 (General_options::General_options): Initialize all members.
4529 * options.h: Include <map>
4530 (class General_options): Add --section-start. Add section_starts_
4532 * layout.cc (Layout::attach_allocated_section_to_segment): If
4533 --section-start was used, set the address of the segment. Remove
4534 local sort_sections.
4535 (Layout::relaxation_loop_body): If the address of the load segment
4536 has been set by --section-start, don't use it.
4537 * output.h (Output_segment::update_flags_for_output_section): New
4539 * output.cc (Output_segment::add_output_section): Call
4540 update_flags_for_output_section.
4542 2010-01-05 Ian Lance Taylor <iant@google.com>
4545 * options.h (class General_options): Add --undefined-version.
4546 * script.cc (struct Version_expression): Add was_matched_by_symbol
4548 (Version_script_info::matched_symbol): New function.
4549 (Version_script_info::get_symbol_version_helper): Call
4551 (Version_script_info::check_unmatched_names): New function.
4552 * script.h (class Version_script_info): Update declarations.
4553 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4555 * options.h (class General_options): Use DEFINE_bool_alias for
4556 allow_multiple_definition.
4557 * resolve.cc (Symbol_table::should_override): Don't test
4558 allow_multiple_definition.
4561 * options.h (class General_options): Add --cref.
4562 * main.cc (main): Print cref table if --cref. Don't close mapfile
4563 until after printing cref table.
4564 * cref.cc: Include "symtab.h".
4565 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4566 (Cref_table_compare::operator()): New function.
4567 (Cref_inputs::gather_cref): New function.
4568 (filecol): New static const.
4569 (Cref_inputs::print_cref): New function.
4570 (Cref::print_cref): New function.
4571 * cref.h: Include <cstdio>.
4572 (class Cref): Update declarations.
4573 * mapfile.h (Mapfile::file): New function.
4574 * object.h (class Object): Define Symbols. Declare virtual
4575 do_get_global_symbols.
4576 (Object::get_global_symbols): New function.
4577 * object.cc (Input_objects::add_object): Pass object to cref_ if
4579 (Input_objects::archive_start): Likewise.
4580 (Input_objects::archive_stop): Likewise.
4581 (Input_objects::print_cref): New function.
4582 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4583 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4585 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4587 * plugin.h (class Sized_pluginobj): Update declarations.
4589 2010-01-05 Ian Lance Taylor <iant@google.com>
4591 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4592 to is_default_version. Rename insdef to insdefault.
4593 (Symbol_table::add_from_relobj): Rename def to is_default_version
4594 and local to is_forced_local.
4595 (Symbol_table::add_from_pluginobj): Likewise.
4596 (Symbol_table::add_from_dynobj): Likewise.
4597 (Symbol_table::define_special_symbol): Rename insdef to
4600 2010-01-04 Ian Lance Taylor <iant@google.com>
4603 * options.h (class General_options): Add
4604 --allow-multiple-definition and -z muldefs.
4605 * resolve.cc (Symbol_table::should_override): Don't warn about a
4606 multiple symbol definition if --allow-multiple-definition or -z
4610 * options.h (class General_options): Add --add-needed and
4611 --copy-dt-needed-entries. Tweak --as-needed help entry.
4612 * object.cc (Input_objects::check_dynamic_dependencies): Give an
4613 error if --copy-dt-needed-entries aka --add-needed is used and
4614 would cause a change in behaviour.
4617 * options.h (class General_options): Add -G as a short version of
4618 --shared. Add no-op options -assert, -g, and -i.
4620 2010-01-04 Sriraman Tallam <tmsriram@google.com>
4622 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4623 check for .text or .gnu.linkonce.t sections.
4624 * icf.cc (Icf::find_identical_sections): Ditto.
4625 Change the detection for mangled function name within the section
4627 * icf.h (is_section_foldable_candidate): New function.
4629 2009-12-30 Ian Lance Taylor <iant@google.com>
4632 * options.h (class General_options): Permit two dashes with
4633 --retain-symbols-file.
4635 2009-12-30 Ian Lance Taylor <iant@google.com>
4638 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4639 don't put the file header and segment headers in the text
4643 * common.cc (Sort_commons::operator()): Stabilize sort when both
4645 (Symbol_table::do_allocate_commons_list): When allocating common
4646 symbols, skip a symbol which is no longer common.
4647 * symtab.h (Symbol::is_common): Test whether the symbol comes from
4648 an object before checking its type.
4649 * testsuite/common_test_2.c: New file.
4650 * testsuite/common_test_3.c: New file.
4651 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4652 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4653 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4654 (common_test_2_pic.o, common_test_2.so): New targets.
4655 (common_test_3_pic.o, common_test_3.so): New targets.
4656 * testsuite/Makefile.in: Rebuild.
4659 * script.cc (read_input_script): If we see a new SECTIONS clause,
4660 and we have added an input section, give an error.
4661 * layout.h (class Layout): Add have_added_input_section function.
4662 Add have_added_input_section_ field.
4663 * layout.cc (Layout::Layout): Initialize
4664 have_added_input_section_.
4665 (Layout::layout): Set have_added_input_section_.
4666 (Layout::layout_eh_frame): Likewise.
4668 2009-12-30 Ian Lance Taylor <iant@google.com>
4671 * options.h (class General_options): Add --sort-common option.
4672 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4673 * common.cc (Sort_common): Add sort_order parameter to
4674 constructor. Add sort_order_ field.
4675 (Sort_commons::operator): Check sort_order_.
4676 (Symbol_table::allocate_commons): Determine the sort order.
4677 (Symbol_table::do_allocate_commons): Add sort_order parameter.
4679 (Symbol_table::do_allocate_commons_list): Likewise.
4681 2009-12-30 Ian Lance Taylor <iant@google.com>
4684 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4685 symbols from this object, don't change the visibility of an
4687 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4689 2009-12-30 Ian Lance Taylor <iant@google.com>
4692 * script.h (class Version_script_info): Define Language enum.
4693 Update declarations. Define Glob, Exact, and Lookup types. Add
4694 new fields globals_, locals_, and is_finalized_.
4695 * script.cc: Various formatting fixes.
4696 (class Parser_closure): Change language_stack_ from a vector of
4697 std::string to one of Version_script_info::Language. Adjust all
4699 (class Lazy_demangler): Remove.
4700 (struct Version_expression): Change language from std::string to
4701 Version_script_info::Language.
4702 (Version_script_info::Version_script_info): New function.
4703 (Version_script_info::~Version_script_info): Don't call clear.
4704 (Version_script_info::finalize): New function.
4705 (Version_script_info::build_lookup_tables): New function.
4706 (Version_script_info::build_expression_list_lookup): New
4708 (Version_script_info::get_symbol_version_helper): Rewrite to use
4710 (Version_script_info::print_expression_list): Adjust to use
4711 Version_script_info::Language.
4712 (script_push_lex_into_version_mode): Check that the version script
4713 has not been finalized.
4714 (version_script_push_lang): Change language string to
4715 Version_script_info::Language.
4716 * options.cc (Command_line::version_script): New function.
4717 * options.h (class General_options): Add finalize_dynamic_list
4718 function. Change version_script from declaration to definition.
4719 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4720 * testsuite/version_script.map: Remove duplicate def of foo.
4721 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4723 * testsuite/Makefile.in: Rebuild.
4725 2009-12-30 Ian Lance Taylor <iant@google.com>
4728 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4729 if the input symbol index is 0, make the output symbol index 0.
4731 2009-12-30 Ian Lance Taylor <iant@google.com>
4734 * options.h (class General_options): Add -x/--discard-all.
4735 * object.cc (Sized_relobj::do_count_local_symbols): Handle
4736 --discard-all. If the local symbol needs a dynamic entry, check
4737 that before handling --discard-locals.
4739 2009-12-30 Ian Lance Taylor <iant@google.com>
4742 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4744 (Output_segment::add_output_section): Don't change the flags if
4748 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4749 GNU hash table if they need a dynamic value. Otherwise, don't add
4750 them if they are defined in a dynamic object or are forced local.
4752 2009-12-29 Ian Lance Taylor <iant@google.com>
4755 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4756 .gnu.hash table for a 32-bit target.
4759 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4760 regular and a dynamic object only needs a dynamic symbol table
4761 entry if it is externally visible.
4764 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4765 constructor. Add global_offset_table_ field.
4766 (Target_i386::got_section): Set global_offset_table_.
4767 (Target_i386::do_finalize_sections): Set global_offset_table_
4769 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4770 in constructor. Add global_offset_table_ field.
4771 (Target_x86_64::got_section): Set global_offset_table_.
4772 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4775 * layout.cc (Layout::Layout): Initialize increase_relro_.
4776 (Layout::get_output_section): Add is_relro, is_last_relro, and
4777 is_first_non_relro parameters. Change all callers.
4778 (Layout::choose_output_section): Likewise.
4779 (Layout::add_output_section_data): Likewise.
4780 (Layout::make_output_section): Likewise.
4781 (Layout::set_segment_offsets): Clear increase_relro when using a
4783 * layout.h (class Layout): Add increase_relro method. Add
4784 increase_relro_ field. Update declarations.
4785 * output.cc (Output_section::Output_section): Initialize
4786 is_last_relro_ and is_first_non_relro_.
4787 (Output_segment::add_output_section): Group relro sections is
4788 do_sort is true. Handle is_last_relro and is_first_non_relro.
4789 (Output_segment::maximum_alignment): Remove relro handling.
4790 (Output_segment::set_section_addresses): Add increase_relro
4791 parameter. Change all callers. Add initial alignment to align
4792 relro sections on separate page. Remove old relro handling.
4793 (Output_segment::set_section_list_addresses): Remove in_relro
4794 parameter. Change all callers.
4795 (Output_segment::set_offset): Add increase parameter. Change all
4796 callers. Remove old relro handling.
4797 * output.h (class Output_section): Add new methods: is_last_relro,
4798 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4799 Add is_last_relro_ and is_first_non_relro_ fields.
4800 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4801 Create separate .got.plt section. Call increase_relro.
4802 * x86_64.cc (Target_x86_64::got_section): Likewise.
4803 * testsuite/relro_script_test.t: Add .got.plt.
4806 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4807 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4808 (Layout::finalize): Call set_dynamic_symbol_size.
4809 (Layout::set_dynamic_symbol_size): New function.
4810 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4811 set_dynamic_symbol_size.
4814 * output.h (class Output_section): Add is_entsize_zero_ field.
4815 * output.cc (Output_section::Output_section): Initialize
4817 (Output_section::set_entsize): If two different entsizes are
4818 requested, force it to zero.
4819 (Output_section::add_input_section): Set flags for .debug_str
4820 before updating section flags. Set entsize.
4821 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4822 and SHF_STRING if all input sections have those flags.
4824 2009-12-29 Rafael Espindola <espindola@google.com>
4826 * main.cc (main): Fix the sys time reporting.
4827 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4830 2009-12-29 Sriraman Tallam <tmsriram@google.com>
4832 * options.cc (General_options::parse_version): Allow -v to exit
4833 without an error if there is nothing to link.
4835 2009-12-29 Ian Lance Taylor <iant@google.com>
4837 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4838 using a version of gcc before 4.1.
4839 * configure: Rebuild.
4841 2009-12-28 Chris Demetriou <cgd@google.com>
4843 * attributes.cc (Output_attributes_section_data::do_write): Use
4844 std::vector::front rather than std::vector::data.
4846 2009-12-28 Ian Lance Taylor <iant@google.com>
4848 * symtab.h (class Symbol_table): Add enum Defined.
4849 * resolve.cc (Symbol_table::should_override): Add defined
4850 parameter. Change all callers. Test whether object is NULL
4851 before calling a method on it.
4852 (Symbol_table::report_resolve_problem): Add defined parameter.
4854 (Symbol_table::should_override_with_special): Likewise.
4855 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4856 parameter. Change all callers.
4857 (Symbol_table::do_define_in_output_data): Likewise.
4858 (Symbol_table::define_in_output_segment): Likewise.
4859 (Symbol_table::do_define_in_output_segment): Likewise.
4860 (Symbol_table::define_as_constant): Likewise.
4861 (Symbol_table::do_define_as_constant): Likewise.
4862 * script.h (class Symbol_assignment): Add is_defsym parameter to
4863 constructor; change all callers.
4864 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4865 parameter. Change all callers. Add is_defsym_ field.
4866 (class Parser_closure): Add parsing_defsym parameter to
4867 constructor; change all callers. Add parsing_defsym accessor
4868 function. Add parsing_defsym_ field.
4870 2009-12-28 Ian Lance Taylor <iant@google.com>
4872 * gold.cc (queue_middle_tasks): Fix formatting.
4873 * object.cc (Relobj::is_section_name_included): Likewise.
4875 2009-12-23 Ian Lance Taylor <iant@google.com>
4877 * i386.cc (Target_i386::do_calls_non_split): Recognize
4878 -fsplit-stack prologue for a function with a static chain.
4879 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4880 -fsplit-stack prologue when using %r11.
4882 2009-12-21 Sriraman Tallam <tmsriram@google.com>
4884 * options.cc (General_options::parse_version): Make -v continue and do
4885 the link like GNU ld does.
4887 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
4889 * Makefile.am (CCFILES): Add timer.cc.
4890 (HFILES): Add timer.h.
4891 * configure.ac: Check for sysconf and times.
4892 * main.cc: include timer.h.
4893 (main): Use Timer instead of get_run_time.
4896 * workqueue.cc: include timer.h.
4897 (Workqueue::find_and_run_task):
4898 Report user, sys and wall time.
4899 * Makefile.in: Regenerate.
4900 * config.in: Regenerate.
4901 * configure: Regenerate.
4903 2009-12-16 Doug Kwan <dougkwan@google.com>
4905 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4907 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4908 relaxed input sections.
4909 * output.cc (Output_section::find_relaxed_input_section): Change
4910 return type to Output_relaxed_input_section pointer. Adjust code
4911 for new type of relaxed_input_section_map_.
4912 * output.h (Output_section::find_relaxed_input_section): Change
4913 return type to Output_relaxed_input_section pointer.
4914 (Output_section::Output_relaxed_input_section_by_input_section_map):
4916 (Output_section::relaxed_input_section_map_): Change type to
4917 Output_section::Output_relaxed_input_section_by_input_section_map.
4918 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4921 2009-12-15 Ian Lance Taylor <iant@google.com>
4923 * layout.cc (Layout::create_shstrtab): Only write out after input
4924 sections if we are compressing debug sections.
4926 2009-12-15 Ian Lance Taylor <iant@google.com>
4928 * archive.cc (Archive::add_symbols): Only look up a symbol without
4929 a version if there is, in fact, a version.
4931 2009-12-14 Ian Lance Taylor <iant@google.com>
4933 Revert -Wshadow changes, all changes from:
4934 2009-12-11 Doug Kwan <dougkwan@google.com>
4935 2009-12-11 Nick Clifton <nickc@redhat.com>
4936 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4938 2009-12-11 Doug Kwan <dougkwan@google.com>
4940 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4942 * attributes.cc (Object_attribute::size): Ditto.
4943 (Attributes_section_data::size): Ditto.
4944 (Attributes_section_data::Attributes_section_data): Ditto.
4945 (Output_attributes_section_data::do_write): Ditto.
4946 * attributes.h (Object_attribute::set_type): Ditto.
4947 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4949 2009-12-11 Nick Clifton <nickc@redhat.com>
4951 * archive.cc: Fix shadowed variable warnings.
4953 * compressed_output.cc: Likewise.
4954 * compressed_output.h: Likewise.
4955 * configure: Likewise.
4956 * dwarf_reader.cc: Likewise.
4957 * dynobj.cc: Likewise.
4958 * dynobj.h: Likewise.
4959 * ehframe.cc: Likewise.
4960 * ehframe.h: Likewise.
4961 * errors.cc: Likewise.
4962 * expression.cc: Likewise.
4963 * fileread.cc: Likewise.
4964 * fileread.h: Likewise.
4965 * freebsd.h: Likewise.
4966 * i386.cc: Likewise.
4968 * incremental.h: Likewise.
4969 * layout.cc: Likewise.
4970 * layout.h: Likewise.
4971 * mapfile.cc: Likewise.
4972 * merge.cc: Likewise.
4973 * merge.h: Likewise.
4974 * object.cc: Likewise.
4975 * object.h: Likewise.
4976 * options.h: Likewise.
4977 * output.cc: Likewise.
4978 * output.h: Likewise.
4979 * parameters.cc: Likewise.
4980 * plugin.cc: Likewise.
4981 * powerpc.cc: Likewise.
4982 * reduced_debug_output.cc: Likewise.
4983 * reduced_debug_output.h: Likewise.
4984 * reloc.cc: Likewise.
4985 * reloc.h: Likewise.
4986 * resolve.cc: Likewise.
4987 * script-sections.cc: Likewise.
4988 * script.cc: Likewise.
4989 * script.h: Likewise.
4990 * sparc.cc: Likewise.
4991 * symtab.cc: Likewise.
4992 * symtab.h: Likewise.
4993 * target-select.cc: Likewise.
4994 * target-select.h: Likewise.
4995 * token.h: Likewise.
4996 * workqueue.cc: Likewise.
4997 * workqueue.h: Likewise.
4998 * x86_64.cc: Likewise.
5000 2009-12-10 Doug Kwan <dougkwan@google.com>
5002 * arm.cc (attributes.h): New include.
5003 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5004 (Arm_relobj::~Arm_relobj): Delete object pointed by
5005 attributes_section_data_.
5006 (Arm_relobj::attributes_section_data): New method definition.
5007 (Arm_relobj::attributes_section_data_): New data member declaration.
5008 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5009 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5010 attributes_section_data_.
5011 (Arm_dynobj::attributes_section_data): New method definition.
5012 (Arm_dynobj::attributes_section_data_): New data member declaration.
5013 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5014 initialization value of may_use_blx_ to false.
5015 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5016 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5017 object attributes to compute results instead of hard-coding.
5018 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5019 Target_arm::get_secondary_compatible_arch,
5020 Target_arm::set_secondary_compatible_arch
5021 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5022 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5023 New method declarations.
5024 (Target_arm::get_aeabi_object_attribute): New method definition.
5025 (Target_arm::attributes_section_data_): New data member declaration.
5026 (read_arm_attributes_section): New template definition.
5027 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5028 (Arm_dynobj::do_read_symbols): Ditto.
5029 (Target_arm::do_finalize_sections): Merge attributes sections from
5030 input. Check for BLX use after attributes section merging.
5031 Fix __exidx_start and __exidx_end visibility. Create an
5032 .ARM.attributes section if necessary.
5033 (Target_arm::get_secondary_compatible_arch,
5034 Target_arm::set_secondary_compatible_arch,
5035 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5036 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5037 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5038 New method definitions.
5040 2009-12-09 Ian Lance Taylor <iant@google.com>
5042 * plugin.cc (Plugin::load): Don't cast from void* to a function
5045 2009-12-09 Ian Lance Taylor <iant@google.com>
5047 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5050 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5052 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5053 Replace two_file_shared_1.so with two_file_shared_2.so.
5054 * testsuite/Makefile.in: Regenerated.
5056 2009-12-08 Doug Kwan <dougkwan@google.com>
5058 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5059 (HFILES): Add attributes.h and int_encoding.h.
5060 * Makefile.in: Regenerate.
5061 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5062 function definitions to int_encoding.cc
5063 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5064 prototypes to int_encoding.h
5065 * reduced_debug_output.cc (int_encoding.h): New include.
5066 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5067 function definitions to int_encoding.cc
5068 (insert_into_vector, read_from_pointer): Move template definitions to
5070 * attributes.cc: New file.
5071 * attributes.h: New file.
5072 * int_encoding.cc: New file.
5073 * int_encoding.h: New file.
5075 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5078 * incremental-dump.cc (dump_incremental_inputs): New.
5079 (main): Use dump_incremental_inputs.
5081 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5084 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5085 checking elfcpp::STT_FUNC.
5086 (Target_i386::Relocate::relocate): Likewise.
5087 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5089 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5090 symbols from shared libraries into normal FUNC symbols.
5092 * symtab.h (Symbol): Add is_func and use it.
5094 2009-12-05 Doug Kwan <dougkwan@google.com>
5096 * arm.cc (Target_arm::arm_info): Initialize new fields
5097 attributes_section and attributes_vendor.
5098 * i386.cc (Target_i386::i386_info): Same.
5099 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5100 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5101 fields attributes_section and attributes_vendor.
5102 * sparc.cc (Target_sparc::sparc_info): Same.
5103 * target.h (Target::attributes_section, Target::attributes_vendor,
5104 Target::is_attributes_section, Target::attribute_arg_type,
5105 Target::attributes_order): New method definitions.
5106 (Target::Target_info::attributes_section,
5107 Target::Target_info::attributes_vendor): New fields.
5108 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5109 virtual method definitions.
5110 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5111 attributes_section and attributes_vendor.
5112 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5114 2009-12-05 Doug Kwan <dougkwan@google.com>
5116 * arm.cc: Update comments about interworking and stub generation.
5117 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5118 considered as non-PIC.
5119 (Arm_relocate_functions::base_abs): Fix formatting.
5120 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5121 of function to use GOT entry address instead of offset.
5122 (Target_arm::Scan::global): Issue an error if a symbol would need a
5123 PLT does not get one because it is untyped. Remove code to create
5124 dynamic symbols for relative branches.
5125 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5126 takes unsigned integer instead of boolean.
5128 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5130 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5131 (two_file_test_LDADD): Likewise.
5132 (common_test_1_LDADD): Likewise.
5133 (exception_test_LDADD) Likewise.
5134 (weak_test_LDADD): Likewise.
5135 (many_sections_test_LDADD): Likewise.
5136 (initpri1_LDADD): Likewise.
5137 (script_test_1_LDADD): Likewise.
5138 (script_test_2_LDADD): Likewise.
5139 (justsyms_LDADD): Likewise.
5140 (binary_test_LDADD): Likewise.
5141 (large_LDADD): Likewise.
5142 * testsuite/Makefile.in: Regenerated.
5144 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5146 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5147 (Symbol_table::override_with_special): Likewise.
5148 (Symbol_table::add_from_object): Likewise.
5150 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5152 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5153 Don't set the data_offset twice.
5155 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5157 * testsuite/Makefile.in: Regenerate.
5159 2009-12-03 Doug Kwan <dougkwan@google.com>
5161 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5162 (Target_arm::do_finalize_sections): Add parameter for symbol table
5163 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5164 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5165 parameter for symbol table pointer.
5166 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5167 an additional parameter for a pointer to symbol table.
5168 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5169 parameter for a symbol table pointer.
5170 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5171 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5173 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5174 parameter for a symbol table pointer.
5176 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5178 * incremental.cc (Incremental_inputs_header)
5179 (Incremental_inputs_header_write, Incremental_inputs_entry)
5180 (Incremental_inputs_entry_write): Move ...
5181 * incremental.h (Incremental_inputs_header)
5182 (Incremental_inputs_header_write, Incremental_inputs_entry)
5183 (Incremental_inputs_entry_write): here.
5185 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5187 * incremental.cc (make_sized_incremental_binary): Set the target.
5188 Error if it is incompatible.
5189 * output.h (Output_file): Add filename method.
5191 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5193 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5194 from the get_* methods.
5196 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5198 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5199 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5200 Write 0 for the data_offset of scripts.
5202 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5204 * testsuite/Makefile.am: Add the incremental_test.sh test.
5205 * testsuite/incremental_test.sh: New.
5206 * testsuite/incremental_test_1.c: New.
5207 * testsuite/incremental_test_2.c: New.
5209 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5211 * incremental-dump.cc (main): Fix typos.
5213 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5216 * incremental-dump.cc (main): Use llu to print 64 bit values.
5218 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5219 H.J. Lu <hongjiu.lu@intel.com>
5221 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5223 (incremental_dump_LDADD): Likewise.
5224 * Makefile.in: Regenerated.
5226 2009-11-25 Doug Kwan <dougkwan@google.com>
5230 2009-11-25 Doug Kwan <dougkwan@google.com>
5232 * arm.cc (Target_arm::Target_arm): Move method definition
5233 outside of class definition. Add code to handle
5234 --target1-rel, --target1-abs and --target2= options.
5235 (Target_arm::get_reloc_reloc_type): Change method to be
5236 non-static and const.
5237 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5238 New data member declaration.
5239 (Target_arm::Scan::local, Target_arm::Scan::global,
5240 Target_arm::Relocate::relocate,
5241 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5242 Adjust call to Target_arm::get_real_reloc_type.
5243 (Target_arm::get_real_reloc_type): Use command line options
5244 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5245 * options.h (--target1-rel, --target1-abs, --target2): New
5248 2009-11-25 Doug Kwan <dougkwan@google.com>
5250 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5251 class definition. Add code to handle --target1-rel, --target1-abs
5252 and --target2= options.
5253 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5255 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5257 (Target_arm::Scan::local, Target_arm::Scan::global,
5258 Target_arm::Relocate::relocate,
5259 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5260 call to Target_arm::get_real_reloc_type.
5261 (Target_arm::get_real_reloc_type): Use command line options to
5262 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5263 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5266 2009-11-25 Doug Kwan <dougkwan@google.com>
5268 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5269 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5270 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5272 (Arm_relocate_functions::thm_call): Replace body with a call to
5273 Arm_relocate_functions::thumb_branch_common.
5274 (Arm_relocate_functions::thm_jump24,
5275 Arm_relocate_functions::thm_xpc22): New method definitions.
5276 (Arm_relocate_functions::thumb_branch_common): New method definition.
5277 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5279 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5280 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5282 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5284 * Makefile.am: Build incremental-dump
5285 * Makefile.in: Regenerate.
5286 * incremental-dump.cc: New.
5287 * incremental.cc (Incremental_inputs_header_data,
5288 Incremental_inputs_entry_data): Move to incremental.h
5289 * incremental.h: (Incremental_inputs_header_data,
5290 Incremental_inputs_entry_data): Move from incremental.cc
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): Add a typedef with the data type.
5298 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5300 * incremental.cc (Incremental_inputs_header,
5301 Incremental_inputs_header_write, Incremental_inputs_entry,
5302 Incremental_inputs_entry_write): Update comment about which
5303 type has the filed descriptions.
5305 2009-11-15 Doug Kwan <dougkwan@google.com>
5307 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5308 (Arm_relocate_functions::arm_branch_common): Change method defintion
5309 in class definition to a method declaration and update list of formal
5311 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5312 Arm_relocation_functions::jump24): Adjust call to
5313 Arm_relocate_functions::arm_branch_common. Update list of formal
5315 (Arm_relocate_functions::xpc25): New method definition.
5316 (Arm_relocate_functions::arm_branch_common): Move method defintion
5317 out from class definition. Use stubs for mode-switching and extending
5319 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5320 specially. Change code to enable use of stubs in ARM branches.
5322 2009-11-10 Doug Kwan <dougkwan@google.com>
5324 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5325 in method declaration.
5326 (Target_arm::relocate_stub): New method declaration.
5327 (Target_arm::default_target): Change to return a pointer instead of
5329 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5330 Target_arm::default_target.
5331 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5333 (Target_arm::relocate_section): Adjust view.
5334 (Target_arm::relocate_stub): New method definition.
5336 2009-11-10 Doug Kwan <dougkwan@google.com>
5338 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5340 * incremental.cc (open_incremental_binary): Initialized local
5341 variables to avoid warnings.
5342 * object.cc (make_elf_object): Ditto.
5343 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5346 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5349 * testsuite/plugin_test.c: Include "config.h".
5351 2009-11-09 Doug Kwan <dougkwan@google.com>
5353 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5354 (arm_symbol_value): Remove.
5355 (Arm_relocate_functions::arm_branch_common,
5356 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5357 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5358 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5359 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5360 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5361 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5362 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5363 Arm_relocate_functions::thm_mobw_abs_nc,
5364 Arm_relocate_functions::thm_mov_abs,
5365 Arm_relocate_functions::movw_prel_nc,
5366 Arm_relocate_functions::thm_movt_abs,
5367 Arm_relocate_functions::movt_prel,
5368 Arm_relocate_functions::thm_movw_prel_nc,
5369 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5370 (Target_arm::Relocate::relocate): Only decompose address into two
5371 parts if relocation type uses the thumb-bit and pass the actual
5372 bit instead of a flag indicating that the thumb-bit is used. Adjust
5373 calls to methods in Arm_relocate_functions for this change.
5375 2009-11-08 Ian Lance Taylor <iant@google.com>
5378 * reloc.cc: Instantiate
5379 Sized_relobj::initialize_input_to_output_maps and
5380 Sized_relobj:free_input_to_output_maps.
5382 2009-11-06 Ian Lance Taylor <iant@google.com>
5385 * defstd.cc (in_segment): Set only_if_ref true for "end".
5387 2009-11-06 Doug Kwan <dougkwan@google.com>
5389 * arm.cc (class Reloc_stub): Correct a comment.
5390 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5391 (Target_arm::scan_section_for_stubs): New method declaration.
5392 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5393 Change methods from private to protected.
5394 (Target_arm::do_may_relax): New method definition.
5395 (Target_arm::do_relax, Target_arm::group_sections,
5396 Target_arm::scan_reloc_for_stub,
5397 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5398 (Target_arm::arm_input_section_map_): New data member declaration.
5399 (Target_arm::scan_reloc_for_stub,
5400 Target_arm::scan_reloc_section_for_stubs,
5401 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5402 Target_arm::do_relax): New method definitions.
5404 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5406 * configure.ac: Check for (struct stat)::st_mtim
5407 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5408 * config.in: Regenerate.
5409 * configure: Regenerate.
5411 2009-11-05 Ian Lance Taylor <iant@google.com>
5414 * output.cc (Output_segment::add_output_section): Add missing
5417 2009-11-04 Ian Lance Taylor <iant@google.com>
5420 * object.h (class Object): Add is_needed and set_is_needed
5421 methods. Add is_needed_ field. Make bool fields into bitfields.
5422 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5423 defined in a dynamic object and referenced by a regular object,
5424 set is_needed for the dynamic object.
5425 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5426 if the file is marked with as_needed and it is not needed.
5428 2009-11-04 Ian Lance Taylor <iant@google.com>
5431 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5432 tags if data is discarded by linker script.
5433 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5434 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5435 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5436 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5438 2009-11-04 Ian Lance Taylor <iant@google.com>
5440 * layout.cc (Layout::get_output_section): Add is_interp and
5441 is_dynamic_linker_section parameters. Change all callers.
5442 (Layout::choose_output_section): Likewise.
5443 (Layout::make_output_section): Likewise.
5444 (Layout::add_output_section_data): Add is_dynamic_linker_section
5445 parameter. Change all callers.
5446 * layout.h (class Layout): Update declarations.
5447 * output.h (class Output_section): Add is_interp, set_is_interp,
5448 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5449 Add is_interp_, is_dynamic_linker_section_ fields. Change
5450 generate_code_fills_at_write_ to a bitfield.
5451 * output.cc (Output_section::Output_sections): Initialize new
5453 (Output_segment::add_output_section): Add do_sort parameter.
5456 2009-11-03 Ian Lance Taylor <iant@google.com>
5459 * options.h (class General_options): Add --warn-common.
5460 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5461 merging two common symbols.
5462 (Symbol_table::should_override): Handle --warn-common when merging
5463 a common symbol with a defined symbol. Use report_resolve_problem
5464 for multiple definitions.
5465 (Symbol_table::report_resolve_problem): New function.
5466 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5468 2009-11-03 Doug Kwan <dougkwan@google.com>
5470 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5472 (Target_arm::stub_factory): New method definition.
5473 (Target_arm::new_arm_input_section,
5474 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5475 Target_arm::reloc_uses_thumb_bit): New method declarations.
5476 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5477 New type definitions.
5478 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5479 member declarations.
5480 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5481 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5482 New method definitions.
5484 2009-11-03 Ian Lance Taylor <iant@google.com>
5486 * options.h (class General_options): Add --warn_constructors.
5488 2009-11-03 Ian Lance Taylor <iant@google.com>
5491 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5492 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5494 2009-11-03 Ian Lance Taylor <iant@google.com>
5497 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5498 --msgid-bugs-address.
5499 (install-pdf): New target.
5500 (install-data_yes): Look up one directory to find mkinstalldirs.
5502 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5504 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5507 2009-10-30 Doug Kwan <dougkwan@google.com>
5509 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5511 2009-10-30 Doug Kwan <dougkwan@google.com>
5513 * arm.cc (Stub_addend_reader): New struct template definition
5514 and partial specializations.
5515 (Stub_addend_reader::operator()): New method definition for a
5516 partially specialized template.
5518 2009-10-30 Doug Kwan <dougkwan@google.com>
5520 * arm.cc (Arm_relobj::processor_specific_flags): New method
5522 (Arm_relobj::do_read_symbols): New method declaration.
5523 (Arm_relobj::processor_specific_flags_): New data member declaration.
5524 (Arm_dynobj): New class definition.
5525 (Target_arm::do_finalize_sections): Add input_objects parameter.
5526 (Target_arm::do_adjust_elf_header): New method declaration.
5527 (Target_arm::are_eabi_versions_compatible,
5528 (Target_arm::merge_processor_specific_flags): New method declaration.
5529 (Target_arm::do_make_elf_object): New overloaded method definitions
5531 (Arm_relobj::do_read_symbols): New method definition.
5532 (Arm_dynobj::do_read_symbols): Ditto.
5533 (Target_arm::do_finalize_sections): Add input_objects parameters.
5534 Merge processor-specific flags from all input objects.
5535 (Target_arm::are_eabi_versions_compatible,
5536 Target_arm::merge_processor_specific_flags,
5537 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5538 New method definitions.
5539 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5540 Input_objects pointer type parameter.
5541 * layout.cc (Layout::finalize): Pass input objects to target's.
5542 finalize_sections function.
5543 * output.cc (Output_file_header::do_sized_write): Set ELF file
5544 header's processor-specific flags.
5545 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5546 Input_objects pointer type parameter.
5547 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5548 * target.h (Input_objects): New forward class declaration.
5549 (Target::processor_specific_flags,
5550 Target::are_processor_specific_flags_sect): New method definitions.
5551 (Target::finalize_sections): Add input_objects parameter.
5552 (Target::Target): Initialize processor_specific_flags_ and
5553 are_processor_specific_flags_set_.
5554 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5556 (Target::set_processor_specific_flags): New method definition.
5557 (Target::processor_specific_flags_,
5558 Target::are_processor_specific_flags_set_): New data member
5560 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5561 Input_objects pointer type parameter.
5563 2009-10-30 Doug Kwan <dougkwan@google.com>
5565 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5567 2009-10-28 Ian Lance Taylor <iant@google.com>
5569 * object.h (class Relobj): Drop options parameter from
5570 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5571 do_scan_relocs, do_relocate. Change all callers.
5572 (class Sized_relobj): Drop options parameters from
5573 do_gc_process_relocs, do_scan_relocs, do_relocate,
5574 do_relocate_sections, relocate_sections, emit_relocs_scan,
5575 emit_relocs_scan_reltype. Change all callers.
5576 (struct Relocate_info): Remove options field and all references to
5578 * reloc.h (class Read_relocs): Remove options constructor
5579 parameter and options_ field. Change all callers.
5580 (class Gc_process_relocs, class Scan_relocs): Likewise.
5581 (class Relocate_task): Likewise.
5582 * target-reloc.h (scan_relocs): Remove options parameter. Change
5584 (scan_relocatable_relocs): Likewise.
5585 * target.h (class Sized_target): Remove options parameter from
5586 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5588 * gc.h (gc_process_relocs): Remove options parameter. Change all
5590 * arm.cc: Update functions to remove options parameters.
5591 * i386.cc: Likewise.
5592 * powerpc.cc: Likewise.
5593 * sparc.cc: Likewise.
5594 * x86_64.cc: Likewise.
5595 * testsuite/testfile.cc: Likewise.
5597 2009-10-28 Doug Kwan <dougkwan@google.com>
5599 * arm.cc (Arm_relobj): New class definition.
5600 (Arm_relobj::scan_sections_for_stubs,
5601 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5602 New method definitions.
5604 2009-10-28 Cary Coutant <ccoutant@google.com>
5606 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5607 (Plugin::cleanup_done_): New member.
5608 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5609 (Plugin_manager::cleanup_done_): Remove.
5610 (Plugin_manager::add_input_file): Edit error message.
5611 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5612 (Plugin_manager::cleanup): Remove use of cleanup_done_.
5614 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
5616 * fileread.cc: (File_read::View::~View): Use the new
5617 data_ownership_ filed.
5618 (File_read::~File_read): Dispose the new whole_file_view_.
5619 (File_read::open): Mmap the whole file if needed.
5620 (File_read::open): Use whole_file_view_ instead of contents_.
5621 (File_read::find_view): Use whole_file_view_ if applicable.
5622 (File_read::do_read): Use whole_file_view_ instead of contents_.
5623 (File_read::make_view): Use whole_file_view_ instead of contents_,
5624 update File_read::View::View call.
5625 (File_read::find_or_make_view): Update File_read::View::View
5627 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5629 (File_read::View::Data_ownership): New enum.
5630 (File_read::View::View): Replace bool mapped_ with Data_ownership
5632 (File_read::View::mapped_): Remove (replaced by data_ownership_).
5633 (File_read::View::data_ownership_): New field.
5634 (File_read::contents_): Remove (replaced by whole_file_view_).
5635 (File_read::whole_file_view_): New field.
5636 * options.h (class General_options): Add --keep-files-mapped.
5638 2009-10-27 Cary Coutant <ccoutant@google.com>
5640 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5641 * testsuite/Makefile.am (plugin_test_5): New test case.
5642 * testsuite/Makefile.in: Regenerate.
5644 2009-10-25 Doug Kwan <dougkwan@google.com>
5646 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5647 from private to protected to allow access by child class.
5648 (Sized_relobj::do_relocate_sections): New method declaration.
5649 (Sized_relobj::relocate_sections): Virtualize.
5650 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5651 Sized_relobj::relocate_sections. Instantiate template explicitly
5652 for different target sizes and endianity.
5654 2009-10-24 Doug Kwan <dougkwan@google.com>
5656 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5657 (Arm_input_section::as_arm_input_section): New method.
5658 (Arm_output_section): New class definition.
5659 (Arm_output_section::create_stub_group,
5660 Arm_output_section::group_sections): New method definitions.
5662 2009-10-22 Doug Kwan <dougkwan@google.com>
5664 * arm.cc (Arm_input_section): New class definition.
5665 (Arm_input_section::init, Arm_input_section:do_write,
5666 Arm_input_section::set_final_data_size,
5667 Arm_input_section::do_reset_address_and_file_offset): New method
5670 2009-10-21 Doug Kwan <dougkwan@google.com>
5672 * arm.cc (Stub_table, Arm_input_section): New forward class
5674 (Stub_table): New class defintion.
5675 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5676 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5677 New method definition.
5679 2009-10-21 Doug Kwan <dougkwan@google.com>
5681 * arm.cc: Update copyright comments.
5682 (Target_arm): New forward class template declaration.
5683 (Arm_address): New type.
5684 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5685 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5686 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5688 (Insn_template): Same.
5689 (DEF_STUBS): New macro.
5690 (Stub_type): New enum type.
5691 (Stub_template): New class definition.
5694 (Stub_factory): Same.
5695 (Target_arm::Target_arm): Initialize may_use_blx_ and
5696 should_force_pic_veneer_.
5697 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5698 Target_arm::should_force_pic_veneer,
5699 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5700 Target_arm::using_thumb_only, Target_arm:;default_target): New
5702 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5703 New data member declarations.
5704 (Insn_template::size, Insn_template::alignment): New method defintions.
5705 (Stub_template::Stub_template): New method definition.
5706 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5707 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5708 (Stub_factory::Stub_factory): New method definition.
5709 * gold.h (string_hash): New template.
5710 * output.h (Input_section_specifier::hash_value): Use
5712 (Input_section_specifier::string_hash): Remove.
5713 * stringpool.cc (Stringpool_template::string_hash): Use
5716 2009-10-20 Doug Kwan <dougkwan@google.com>
5718 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5719 symbols of relaxed input sections.
5720 * output.h (Output_section::find_relaxed_input_section): Make
5723 2009-10-16 Doug Kwan <dougkwan@google.com>
5725 * dynobj.cc (Versions::Versions): Initialize version_script_.
5726 Only insert base version symbol definition for a shared object
5727 if version script defines any version versions.
5728 (Versions::define_base_version): New method definition.
5729 (Versions::add_def): Check that base version is not needed.
5730 (Versions::add_need): Define base version lazily.
5731 * dynobj.h (Versions::define_base_version): New method declaration.
5732 (Versions::needs_base_version_): New data member declaration.
5733 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5734 (check_DATA): Add no_version_test.stdout.
5735 (libno_version_test.so, no_version_test.o no_version_test.stdout):
5737 * testsuite/Makefile.in: Regenerate.
5738 * testsuite/no_version_test.c: New file.
5739 * testsuite/no_version_test.sh: Ditto.
5741 2009-10-16 Doug Kwan <dougkwan@google.com>
5743 * expression.cc (class Segment_start_expression): New class definition.
5744 (Segment_start_expression::value): New method definition.
5745 (script_exp_function_segment_start): Return a new
5746 Segment_start_expression.
5747 * gold/script-c.h (script_saw_segment_start_expression): New function
5749 * script-sections.cc (Script_sections::Script_sections): Initialize
5750 SAW_SEGMENT_START_EXPRESSION_ to false.
5751 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5752 and -Tbbs options to specify section addresses if given in
5753 command line and no SEGMENT_START expression is seen in a script.
5754 * script-sections.h (Script_sections::saw_segment_start_expression,
5755 Script_sections::set_saw_segment_start_expression): New method
5757 (Script_sections::saw_segment_start_expression_): New data member
5759 * script.cc (script_saw_segment_start_expression): New function.
5760 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5761 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5762 script_test_7.sh and script_test_8.sh.
5763 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5764 script_test_8.stdout.
5765 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5766 (script_test_6, script_test_6.stdout, script_test_7,
5767 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5768 * Makefile.in: Regenerate.
5769 * testsuite/script_test_6.sh: New file.
5770 * testsuite/script_test_6.t: Same.
5771 * testsuite/script_test_7.sh: Same.
5772 * testsuite/script_test_7.t: Same.
5773 * testsuite/script_test_8.sh: Same.
5775 2009-10-16 Doug Kwan <dougkwan@google.com>
5777 * output.cc (Output_segment::set_section_list_address): Cast
5778 expressions to unsigned long long type to avoid format warnings.
5780 2009-10-15 Ian Lance Taylor <iant@google.com>
5782 * script.cc (Script_options::add_symbol_assignment): Always add a
5783 dot assignment to script_sections_.
5784 * script-sections.cc (Script_sections::add_dot_assignment):
5785 Initialize if necessary.
5787 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5788 program headers with no load segment if there is a linker script.
5790 * layout.cc (Layout::set_segment_offsets): Align the file offset
5791 to the segment aligment for -N or -n with no load segment.
5792 * output.cc (Output_segment::add_output_section): Don't crash if
5793 the first section is a TLS section.
5794 (Output_segment::set_section_list_addresses): Print an error
5795 message if the address moves backward in a linker script.
5796 * script-sections.cc
5797 (Output_section_element_input::set_section_addresses): Don't
5798 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5799 (Orphan_output_section::set_section_addresses): Likewise.
5801 2009-10-15 Doug Kwan <dougkwan@google.com>
5803 * layout.cc (Layout::finish_dynamic_section): Generate tags
5804 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5805 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5806 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5808 2009-10-14 Ian Lance Taylor <iant@google.com>
5810 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5812 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5813 data_shdr fields of relinfo.
5814 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5815 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5816 R_386_TLS_LDO_32, adjust based on section flags.
5817 (Target_i386::Relocate::fix_up_ldo): Remove.
5819 2009-10-13 Ian Lance Taylor <iant@google.com>
5821 Add support for -pie.
5822 * options.h (class General_options): Add -pie and
5824 (General_options::output_is_position_independent): Test -pie.
5825 (General_options::output_is_executable): Return true if not shared
5826 and not relocatable.
5827 (General_options::output_is_pie): Remove.
5828 * options.cc (General_options::finalize): Reject incompatible uses
5830 * gold.cc (queue_middle_tasks): A -pie link is not static.
5831 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5832 * symtab.cc (Symbol::final_value_is_known): Return false if
5833 output_is_position_independent.
5834 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5835 output_is_position_independent.
5836 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5837 output_is_position_independent.
5838 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5839 output_is_position_independent.
5840 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5842 (basic_pie_test.o, basic_pie_test): New targets.
5843 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5844 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5845 (two_file_pie_test): New target.
5846 * testsuite/Makefile.in: Rebuild.
5847 * README: Remove note saying that -pie is not supported.
5849 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
5851 * options.h (class General_options): Add -init and -fini.
5852 * layout.cc (Layout::finish_dynamic_section): Emit
5853 given init and fini functions.
5855 2009-10-13 Sriraman Tallam <tmsriram@google.com>
5857 * gc.h (gc_process_relocs): Check if icf is enabled using new
5859 * gold.cc (queue_initial_tasks): Likewise.
5860 (queue_middle_tasks): Likewise.
5861 * object.cc (do_layout): Likewise.
5862 * symtab.cc (is_section_folded): Likewise.
5863 * main.cc (main): Likewise.
5864 * reloc.cc (Read_relocs::run): Likewise.
5865 (Sized_relobj::do_scan_relocs): Likewise.
5866 * icf.cc (is_function_ctor_or_dtor): New function.
5867 (Icf::find_identical_sections): Check if function is ctor or dtor when
5869 * options.h (General_options::icf): Change option to be an enum.
5870 (Icf_status): New enum.
5871 (icf_enabled): New method.
5872 (icf_safe_folding): New method.
5873 (set_icf_status): New method.
5874 (icf_status_): New variable.
5875 * (options.cc) (General_options::finalize): Set icf_status_.
5876 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5877 icf_test and icf_keep_unique_test to use the --icf enum flag.
5878 * testsuite/icf_safe_test.sh: New file.
5879 * testsuite/icf_safe_test.cc: New file.
5881 2009-10-12 Sriraman Tallam <tmsriram@google.com>
5883 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5884 includes to gc.h and icf.h.
5885 * arm.cc: Include gc.h.
5886 * gold.cc: Likewise.
5887 * i386.cc: Likewise.
5888 * powerpc.cc: Likewise.
5889 * sparc.cc: Likewise.
5890 * x86_64.cc: Likewise.
5891 * gc.h: Include icf.h.
5893 2009-10-11 Ian Lance Taylor <iant@google.com>
5895 * plugin.cc: Include "gold.h" before other header files.
5897 2009-10-10 Chris Demetriou <cgd@google.com>
5899 * options.h (Input_file_argument::Input_file_type): New enum.
5900 (Input_file_argument::is_lib_): Replace with...
5901 (Input_file_argument::type_): New member.
5902 (Input_file_argument::Input_file_argument): Take Input_file_type
5903 'type' rather than boolean 'is_lib' as second argument.
5904 (Input_file_argument::is_lib): Use type_.
5905 (Input_file_argument::is_searched_file): New function.
5906 (Input_file_argument::may_need_search): Handle is_searched_file.
5907 * options.cc (General_options::parse_library): Support -l:filename.
5908 (General_options::parse_just_symbols): Update for Input_file_argument
5910 (Command_line::process): Likewise.
5911 * archive.cc (Archive::get_file_and_offset): Likewise.
5912 * plugin.cc (Plugin_manager::release_input_file): Likewise.
5913 * script.cc (read_script_file, script_add_file): Likewise.
5914 * fileread.cc (Input_file::Input_file): Likewise.
5915 (Input_file::will_search_for): Handle is_searched_file.
5916 (Input_file::open): Likewise.
5917 * readsyms.cc (Read_symbols::get_name): Likewise.
5918 * testsuite/Makefile.am (searched_file_test): New test.
5919 * testsuite/Makefile.in: Regenerate.
5920 * testsuite/searched_file_test.cc: New file.
5921 * testsuite/searched_file_test_lib.cc: New file.
5923 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5924 Ian Lance Taylor <iant@google.com>
5926 * descriptor.cc: Include <cstdio> and "binary-io.h".
5927 (Descriptors::open): Open the files in binary mode always.
5928 * script.cc (Lex::get_token): Treat \r as whitespace.
5930 2009-10-09 Ian Lance Taylor <iant@google.com>
5932 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5934 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5935 Ian Lance Taylor <iant@google.com>
5937 * configure.ac: Check for readv function also.
5938 * fileread.cc (readv): Define if not HAVE_READV.
5939 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5941 * config.in: Regenerate.
5942 * configure: Regenerate.
5944 2009-10-09 Doug Kwan <dougkwan@google.com>
5946 * layout.cc (Layout::make_output_section): Call target hook to make
5947 ordinary output section.
5948 (Layout::finalize): Adjust parameter list of call the
5949 Target::may_relax().
5950 * layout.h (class Layout::section_list): New method.
5951 * merge.h (Output_merge_base::entsize): Change visibility to public.
5952 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5954 (Output_merge_string::do_is_string): New method.
5955 * object.cc (Sized_relobj::do_setup): renamed from
5956 Sized_relobj::set_up.
5957 * object.h (Sized_relobj::adjust_shndx,
5958 Sized_relobj::initializ_input_to_output_maps,
5959 Sized_relobj::free_input_to_output_maps): Change visibilities to
5961 (Sized_relobj::setup): Virtualize.
5962 (Sized_relobj::do_setup): New method declaration.
5963 (Sized_relobj::invalidate_section_offset,
5964 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5965 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5966 * options.cc (parse_int): New function.
5967 * options.h (parse_int): New declaration.
5968 (DEFINE_int): New macro.
5969 (stub_group_size): New option.
5970 * output.cc (Output_section::Output_section): Initialize memebers
5971 merge_section_map_, merge_section_by_properties_map_,
5972 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5973 (Output_section::add_input_section): Handled deferred code-fill
5974 generation and remove an old comment.
5975 (Output_section::add_relaxed_input_section): New method definition.
5976 (Output_section::add_merge_input_section): Use merge section by
5977 properties map to speed to search. Update merge section maps
5979 (Output_section::build_relaxation_map): New method definition.
5980 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5982 (Output_section::relax_input_section): Renamed to
5983 Output_section::convert_input_sections_to_relaxed_sections and change
5984 interface to take a vector of pointers to relaxed sections.
5985 (Output_section::find_merge_section,
5986 Output_section::find_relaxed_input_section): New method definitions.
5987 (Output_section::is_input_address_mapped,
5988 Output_section::output_offset, Output_section::output_address):
5989 Use output section data maps to speed up searching.
5990 (Output_section::find_starting_output_address): Add comments.
5991 (Output_section::do_write,
5992 Output_section::write_to_postprocessing_buffer): Do code-fill
5993 generation as appropriate.
5994 (Output_section::get_input_sections): Invalidate relaxed input section
5996 (Output_section::restore_states): Adjust type of checkpoint .
5997 Invalidate relaxed input section map.
5998 * output.h (Output_merge_base): New class declaration.
5999 (Input_section_specifier): New class defintion.
6000 (class Output_relaxed_input_section) Change base class to
6001 Output_section_data_build.
6002 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6003 base class initializer.
6004 (Output_section::add_relaxed_input_section): New method declaration.
6005 (Output_section::Input_section): Change visibility to protected.
6006 (Output_section::Input_section::relobj,
6007 Output_section::Input_section::shndx): Handle relaxed input sections.
6008 Output_section::input_sections) Change visibility to protected. Also
6009 define overload to return a non-const pointer.
6010 (Output_section::Merge_section_properties): New class defintion.
6011 (Output_section::Merge_section_by_properties_map,
6012 Output_section::Output_section_data_by_input_section_map,
6013 Output_section::Relaxation_map): New types.
6014 (Output_section::relax_input_section): Rename method to
6015 Output_section::convert_input_sections_to_relaxed_sections and change
6016 interface to take a vector of relaxed section pointers.
6017 (Output_section::find_merge_section,
6018 Output_section::find_relaxed_input_section,
6019 Output_section::build_relaxation_map,
6020 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6021 New method declarations.
6022 (Output_section::merge_section_map_
6023 Output_section::merge_section_by_properties_map_,
6024 Output_section::relaxed_input_section_map_,
6025 Output_section::is_relaxed_input_section_map_valid_,
6026 Output_section::generate_code_fills_at_write_): New data members.
6027 * script-sections.cc
6028 (Output_section_element_input::set_section_addresses): Call
6029 current_data_size and addralign methods of relaxed input sections.
6030 (Orphan_output_section::set_section_addresses): Call current_data_size
6031 and addralign methods of relaxed input sections.
6032 * symtab.cc (Symbol_table::compute_final_value): Extract template
6033 from the body of Symbol_table::sized_finalize_symbol.
6034 (Symbol_table::sized_finalized_symbol): Call
6035 Symbol_table::compute_final_value.
6036 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6037 (Symbol_table::compute_final_value): New templated method declaration.
6038 * target.cc (Target::do_make_output_section): New method defintion.
6039 * target.h (Target::make_output_section): New method declaration.
6040 (Target::relax): Add more parameters for input objects, symbol table
6041 and layout. Adjust call to do_relax.
6042 (Target::do_make_output_section): New method declaration.
6043 (Target::do_relax): Add parameters for input objects, symbol table
6046 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6048 * pread.c: Include stdio.h.
6050 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6052 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6055 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6057 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6058 Change read_shndx type to unsigned int.
6059 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6061 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6062 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6063 Change read_shndx type to unsigned int.
6064 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6066 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6067 * layout.cc (Layout::create_symtab_sections): Cast the result of
6068 local_symcount * symsize to off_t in the gold_assert.
6070 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6072 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6073 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6075 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6076 (Arm_relocate_functions::thm_abs5): New function.
6077 (Arm_relocate_functions::abs12): New function.
6078 (Arm_relocate_functions::abs16): New function.
6079 (Arm_relocate_functions::base_abs): New function.
6080 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6081 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6082 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6084 (Scan::global): Likewise.
6085 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6086 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6087 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6088 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6091 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6093 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6094 (Arm_relocate_functions::movt_prel): New function.
6095 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6096 (Arm_relocate_functions::thm_movt_prel): New function.
6097 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6098 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6099 (Scan::global, Relocate::relocate): Likewise.
6100 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6102 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6104 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6105 Incremental_checker.
6106 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6108 (class Incremental_inputs_header): New class.
6109 (Incremental_inputs_header_writer): Edit comment.
6110 (Incremental_inputs_entry): New class.
6111 (Incremental_inputs_entry_writer): Edit comment.
6112 (Sized_incremental_binary::do_find_incremental_inputs_section):
6113 Add *strtab_shndx parameter, fill it.
6114 (Sized_incremental_binary::do_check_inputs): New method.
6115 (Incremental_checker::can_incrementally_link_output_file): Use
6116 Sized_incremental_binary::check_inputs.
6117 (Incremental_inputs::report_command_line): Save command line in
6120 (Incremental_binary::find_incremental_inputs_section): New
6122 (Incremental_binary::do_find_incremental_inputs_section): Add
6123 strtab_shndx parameter.
6124 (Incremental_binary::do_check_inputs): New pure virtual method.
6125 (Sized_incremental_binary::do_check_inputs): Declare.
6126 (Incremental_checker::Incremental_checker): Add incremental_inputs
6127 parameter, use it to initialize incremental_inputs_.
6128 (Incremental_checker::incremental_inputs_): New field.
6129 (Incremental_checker::command_line): New method.
6130 (Incremental_checker::inputs): New method.
6131 (Incremental_checker::command_line_): New field.
6133 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6135 * incremental.cc: Include <cstdarg> and "target-select.h".
6136 (vexplain_no_incremental): New function.
6137 (explain_no_incremental): New function.
6138 (Incremental_binary::error): New method.
6139 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6141 (make_sized_incremental_binary): New function.
6142 (open_incremental_binary): New function.
6143 (can_incrementally_link_file): Add checks if output is ELF and has
6145 * incremental.h: Include "elfcpp_file.h" and "output.h".
6146 (Incremental_binary): New class.
6147 (Sized_incremental_binary): New class.
6148 (open_incremental_binary): Declare.
6149 * object.cc (is_elf_object): Use
6150 elfcpp::Elf_recognizer::is_elf_file.
6151 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6152 * output.h (Output_file::filesize): New method.
6154 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6156 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6158 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6159 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6161 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6163 (Arm_relocate_functions::movw_abs_nc): New function.
6164 (Arm_relocate_functions::movt_abs): New function.
6165 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6166 (Arm_relocate_functions::thm_movt_abs): New function.
6167 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6168 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6169 (Scan::global): Likewise.
6170 (Relocate::relocate): Likewise.
6171 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6173 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6175 * arm.cc (Arm_relocate_functions::got_prel) New function.
6176 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6177 (Relocate::relocate): Likewise.
6178 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6180 2009-10-06 Ian Lance Taylor <iant@google.com>
6182 * options.h (class General_options): Define
6183 split_stack_adjust_size parameter.
6184 * object.h (class Object): Add uses_split_stack_ and
6185 has_no_split_stack_ fields. Add uses_split_stack and
6186 has_no_split_stack accessor functions. Declare
6187 handle_split_stack_section.
6188 (class Reloc_symbol_changes): Define.
6189 (class Sized_relobj): Define Function_offsets. Declare
6190 split_stack_adjust, split_stack_adjust_reltype, and
6192 * object.cc (Object::handle_split_stack_section): New function.
6193 (Sized_relobj::do_layout): Call handle_split_stack_section.
6194 * dynobj.cc (Sized_dynobj::do_layout): Call
6195 handle_split_stack_section.
6196 * reloc.cc (Sized_relobj::relocate_sections): Call
6197 split_stack_adjust for executable sections in split_stack
6198 objects. Pass reloc_map to relocate_section.
6199 (Sized_relobj::split_stack_adjust): New function.
6200 (Sized_relobj::split_stack_adjust_reltype): New function.
6201 (Sized_relobj::find_functions): New function.
6202 * target-reloc.h: Include "object.h".
6203 (relocate_section): Add reloc_symbol_changes parameter. Change
6205 * target.h (class Target): Add calls_non_split method. Declare
6206 do_calls_non_split virtual method. Declare match_view and
6208 * target.cc: Include "elfcpp.h".
6209 (Target::do_calls_non_split): New function.
6210 (Target::match_view): New function.
6211 (Target::set_view_to_nop): New function.
6212 * gold.cc (queue_middle_tasks): Give an error if mixing
6213 split-stack and non-split-stack objects with -r.
6214 * i386.cc (Target_i386::relocate_section): Add
6215 reloc_symbol_changes parameter.
6216 (Target_i386::do_calls_non_split): New function.
6217 * x86_64.cc (Target_x86_64::relocate_section): Add
6218 reloc_symbol_changes parameter.
6219 (Target_x86_64::do_calls_non_split): New function.
6220 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6222 * powerpc.cc (Target_powerpc::relocate_section): Add
6223 reloc_symbol_changes parameter.
6224 * sparc.cc (Target_sparc::relocate_section): Add
6225 reloc_symbol_changes parameter.
6226 * configure.ac: Call AM_CONDITIONAL for the default target.
6227 * configure: Rebuild.
6228 * testsuite/Makefile.am (TEST_AS): New variable.
6229 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6230 (check_DATA): Add split_i386 and split_x86_64 files.
6231 (SPLIT_DEFSYMS): Define.
6232 (split_i386_[1234n].o): New targets.
6233 (split_i386_[124]): New targets.
6234 (split_i386_[1234r].stdout): New targets.
6235 (split_x86_64_[1234n].o): New targets.
6236 (split_x86_64_[124]): New targets.
6237 (split_x86_64_[1234r].stdout): New targets.
6238 (MOSTLYCLEANFILES): Add new executables.
6239 * testsuite/split_i386.sh: New file.
6240 * testsuite/split_x86_64.sh: New file.
6241 * testsuite/split_i386_1.s: New file.
6242 * testsuite/split_i386_2.s: New file.
6243 * testsuite/split_i386_3.s: New file.
6244 * testsuite/split_i386_4.s: New file.
6245 * testsuite/split_i386_n.s: New file.
6246 * testsuite/split_x86_64_1.s: New file.
6247 * testsuite/split_x86_64_2.s: New file.
6248 * testsuite/split_x86_64_3.s: New file.
6249 * testsuite/split_x86_64_4.s: New file.
6250 * testsuite/split_x86_64_n.s: New file.
6251 * testsuite/testfile.cc (Target_test): Update relocation_section
6253 * testsuite/Makefile.in: Rebuild.
6255 2009-10-06 Ian Lance Taylor <iant@google.com>
6257 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6258 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6259 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6260 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6261 the address on ldo_addrs_.
6262 (Target_i386::Relocate::fix_up_ldo): New function.
6264 2009-10-06 Rafael Espindola <espindola@google.com>
6266 * plugin.cc (add_input_library): New.
6267 (Plugin::load): Add add_input_library to tv.
6268 (Plugin_manager::add_input_file): Add the is_lib argument.
6269 (add_input_file): Update call to Plugin_manager::add_input_file.
6270 (add_input_library): New.
6271 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6273 2009-09-30 Doug Kwan <dougkwan@google.com>
6275 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6276 symbol and call Symbol::may_need_copy_reloc to determine if
6277 a copy reloc is needed.
6278 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6279 nocopyreloc is given in command line.
6280 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6281 given in command line.
6282 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6283 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6284 of the removed Target_i386::may_need_copy_reloc.
6285 * options.h (copyreloc): New option with default value false.
6286 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6287 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6288 instead of the removed Target_powerpc::may_need_copy_reloc.
6289 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6290 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6291 instead of the removed Target_sparc::may_need_copy_reloc.
6292 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6293 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6294 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6295 instead of the removed Target_x86_64::may_need_copy_reloc.
6297 2009-09-30 Ian Lance Taylor <iant@google.com>
6299 * object.h (class Object): Remove target_ field, and target,
6300 sized_target, and set_target methods.
6301 (Object::sized_target): Remove.
6302 (class Sized_relobj): Update declarations. Remove sized_target.
6303 * object.cc (Sized_relobj::setup): Remove target parameter.
6305 (Input_objects::add_object): Don't do anything with the target.
6306 (make_elf_sized_object): Add punconfigured parameter. Change all
6307 callers. Set or test parameter target.
6308 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6310 * parameters.cc (Parameters::set_target): Change parameter type to
6312 (Parameters::default_target): Remove.
6313 (set_parameters_target): Change parameter type to be non-const.
6314 (parameters_force_valid_target): New function.
6315 (parameters_clear_target): New function.
6316 * parameters.h (class Parameters): Update declarations. Remove
6317 default_target method. Add sized_target and clear_target
6318 methods. Change target_ to be non-const.
6319 (set_parameters_target): Update declaration.
6320 (parameters_force_valid_target): Declare.
6321 (parameters_clear_target): Declare.
6322 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6323 as NULL if we aren't searching.
6324 (Add_symbols::run): Don't check for compatible target.
6325 * fileread.cc (Input_file::open_binary): Call
6326 parameters_force_valid_target.
6327 * gold.cc (queue_middle_tasks): Likewise.
6328 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6329 set_target on object.
6330 * dynobj.h (class Sized_dynobj): Update declarations.
6331 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6332 make_elf_object returns NULL.
6333 (Archive::include_member): Don't check whether object target is
6335 * output.cc (Output_section::add_input_section): Get target from
6337 (Output_section::relax_input_section): Likewise.
6338 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6340 (Sized_relobj::do_scan_relocs): Likewise.
6341 (Sized_relobj::relocate_sections): Likewise.
6342 * resolve.cc (Symbol_table::resolve): Likewise.
6343 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6344 parameter. Change all callers.
6345 (Symbol_table::add_from_object): Get target from parameters.
6346 (Symbol_table::add_from_relobj): Don't check object target.
6347 (Symbol_table::add_from_dynobj): Likewise.
6348 (Symbol_table::define_special_symbol): Get target from
6350 * symtab.h (class Symbol_table): Update declaration.
6351 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6352 parameter. Change all callers. Clear parameter target.
6353 (Binary_test): Test target here.
6354 * testsuite/object_unittest.cc (gold_testsuite): Remove
6355 target_test_pointer parameter. Change all callers.
6356 (Object_test): Test target here.
6358 2009-09-26 Ian Lance Taylor <iant@google.com>
6360 * testsuite/initpri1.c: Don't try to use constructor priorities if
6361 compiling with gcc before 4.3.
6363 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6365 * testsuite/retain_symbols_file_test.sh (check_present): Change
6366 output file name to retain_symbols_file_test.stdout.
6367 (check_absent): Likewise.
6369 2009-09-18 Craig Silverstein <csilvers@google.com>
6371 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6372 * options.cc: Include <cerrno> and <fstream>.
6373 (General_options::finalize): Parse -retain-symbols-file tag.
6374 * options.h: New flag.
6375 (General_options): New method should_retain_symbol, new
6376 variable symbols_to_retain.
6377 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6378 should_retain_symbol map.
6379 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6380 * testsuite/Makefile.in: Regenerate.
6381 * testsuite/retain_symbols_file_test.sh: New file.
6383 2009-09-18 Nick Clifton <nickc@redhat.com>
6385 * po/es.po: Updated Spanish translation.
6387 2009-09-17 Doug Kwan <dougkwan@google.com>
6389 * debug.h (DEBUG_RELAXATION): New constant.
6390 (DEBUG_ALL): Add DEBUG_RELAXATION.
6391 (debug_string_to_enum): Add relaxation debug option.
6393 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6394 Layout::Relaxation_debug_check::read_sections,
6395 Layout::Relaxation_debug_check::read_sections): New method definitions.
6396 (Layout::Layout): Initialize data members
6397 record_output_section_data_from_scrips_,
6398 script_output_section_data_list_ and relaxation_debug_check_.
6399 (Layout::save_segments, Layout::restore_segments,
6400 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6401 Layout::relaxation_loop_body): New method definitions.
6402 (Layout::finalize): Support relaxation. Move section layout code to
6403 Layout::relaxation_loop_body.
6404 (Layout::set_asection_address_from_script): Move code for orphan
6405 section placement out.
6406 (Layout::place_orphan_sections_in_script): New method definition.
6407 * layout.h (Output_segment_headers, Output_file_header):
6408 New forward class declarations.
6409 (Layout::~Layout): Define.
6410 (Layout::new_output_section_data_from_script): New method definition.
6411 (Layout::place_orphan_sections_in_script): New method declaration.
6412 (Layout::Segment_states): New type declaration.
6413 (Layout::save_segments, Layout::restore_segments,
6414 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6415 Layout::relaxation_loop_body): New method declarations.
6416 (Layout::Output_section_data_list): New type declaration.
6417 (Layout::Relaxation_debug_check): New class definition.
6418 (Layout::record_output_section_data_from_script_,
6419 Layout::script_output_section_data_list_, Layout::segment_states_,
6420 Layout::relaxation_debug_check_): New data members.
6421 * output.cc: (Output_section_headers::do_size): New method definition.
6422 (Output_section_headers::Output_section_headers): Move size
6423 computation to Output_section_headers::do_size.
6424 (Output_segment_headers::do_size): New method definition.
6425 (Output_file_header::Output_file_header): Move size computation to
6426 Output_file_header::do_size and call it.
6427 (Output_file_header::do_size): New method definition.
6428 (Output_data_group::Output_data_group): Adjust call to
6429 Output_section_data.
6430 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6431 (Output_symtab_xindex::do_write): Add array bound check.
6432 (Output_section::Input_section::print_to_mapfile): Handle
6433 RELAXED_INPUT_SECTION_CODE.
6434 (Output_section::Output_section): Initialize data member checkpoint_.
6435 (Output_section::~Output_section): Delete checkpoint object pointed
6437 (Output_section::add_input_section): Always add an Input_section if
6439 (Output_section::add_merge_input_section): Add assert.
6440 (Output_section::relax_input_section): New method definition.
6441 (Output_section::set_final_data_size): Set load address to zero for
6442 an unallocated section.
6443 (Output_section::do_address_and_file_offset_have_reset_values):
6444 New method definition.
6445 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6446 Handle relaxed input section.
6447 (Output_section::sort_attached_input_sections): Checkpoint input
6448 section list lazily.
6449 (Output_section::get_input_sections): Change type of input_sections to
6450 list of Simple_input_section pointers. Checkpoint input section list
6451 lazily. Also handle relaxed input sections.
6452 (Output_section::add_input_section_for_script): Take a reference to
6453 a Simple_input_section object instead of Relobj pointer and section
6454 index as parameter. Handle relaxed input sections.
6455 (Output_section::save_states, Output_section::restore_states): New
6457 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6458 (Output_data::is_data_size_fixed): New method definition.
6459 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6461 (Output_data::address_and_file_offset_have_reset_values): New method
6463 (Output_data::do_address_and_file_offset_have_reset_values): New method
6465 (Output_data::set_data_size): Check that data size is not fixed.
6466 (Output_data::fix_data_size): New method definition.
6467 (Output_data::is_data_size_fixed_): New data member.
6468 (Output_section_headers::set_final_data_size): New method definition.
6469 (Output_section_headers::do_size): New method declaration.
6470 (Output_segment_headers::set_final_data_size): New method definition.
6471 (Output_segment_headers::do_size): New method declaration.
6472 (Output_file_header::set_final_data_size)::New method definition.
6473 (Output_file_header::do_size)::New method declaration.
6474 (Output_section_data::Output_section_data): Add new parameter
6475 is_data_size_fixed and use it to fix data size.
6476 (Output_data_const::Output_data_const): Adjust call to base class
6477 constructor and fix data size.
6478 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6479 base class constructor and fix data size.
6480 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6481 base class constructor and fix data size.
6482 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6483 class constructor and fix data size.
6484 (Output_data_group::set_final_data_size): New method definition.
6485 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6486 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6487 class constructor and fix data size.
6488 (Output_relaxed_input_section): New class definition.
6489 (Output_section::Simple_input_section): New class definition.
6490 (Output_section::get_input_sections): Adjust parameter list.
6491 (Output_section::add_input_section_for_script): Same.
6492 (Output_section::save_states, Output_section::restore_states,
6493 Output_section::do_address_and_file_offset_have_reset_values,
6494 (Output_section::Input_section::Input_section): Handle
6495 RELAXED_INPUT_SECTION_CODE. Add new overload for
6496 Output_relaxed_input_section.
6497 (Output_section::Input_section::is_input_section,
6498 Output_section::Input_section::set_output_section): Handle relaxed
6500 (Output_section::Input_section::is_relaxed_input_section,
6501 Output_section::Input_section::output_section_data,
6502 Output_section::Input_section::relaxed_input_section): New method
6504 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6506 (Output_section::Input_section::u1_): Update comments.
6507 (Output_section::Input_section::u2_): Add new union member poris.
6508 (Output_section::Checkpoint_output_section): New classs definition.
6509 (Output_section::relax_input_section): New method declaration.
6510 (Output_section::checkpoint_): New data member.
6511 (Output_segment): Update comments.
6512 (Output_segment::Output_segment): Un-privatize copy constructor.
6513 (Output_segment::operator=): Un-privatize.
6514 * script-sections.cc (Output_section_element::Input_section_list):
6515 Change element type to Output_section::Simple_input_section.
6516 (Output_section_element_dot_assignment::set_section_addresses):
6517 Register output section data for relaxation clean up.
6518 (Output_data_exression::Output_data_expression): Adjust call to base
6519 constructor to fix data size.
6520 (Output_section_element_data::set_section_addresses): Register
6521 Output_data_expression object for relaxation clean up.
6522 (struct Input_section_info): Replace Relobj pointer and section index
6523 pair with Output_section::Simple_input_section and Convert struct to a
6525 (Input_section_sorter::operator()): Adjust access to
6526 Input_section_info data member to use accessors.
6527 (Output_section_element_input::set_section_addresses): Use layout
6528 parameter. Adjust code to use Output_section::Simple_input_section
6529 and Input_secction_info classes. Register filler for relaxation
6531 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6532 and section index pair with Output_section::Simple_input_section
6533 class. Adjust code accordingly.
6534 (Phdrs_element::release_segment): New method definition.
6535 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6537 (Script_sections::release_segments): New method definition.
6538 * gold/script-sections.h (Script_sections::release_segments): New
6540 * gold/target.h (Target::may_relax, Target::relax,
6541 Target::do_may_relax, Target::do_relax): New method definitions.
6543 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6545 * arm.cc (has_signed_unsigned_overflow): New function.
6546 (Arm_relocate_functions::abs8): New function.
6547 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6548 (Target_arm::Scan::global): Likewise.
6549 (Target_arm::relocate::relocate): Likewise.
6550 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6553 2009-09-16 Cary Coutant <ccoutant@google.com>
6555 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6556 * testsuite/Makefile.in: Regenerate.
6558 2009-09-11 Nick Clifton <nickc@redhat.com>
6560 * po/gold.pot: Updated by the Translation project.
6562 2009-09-08 Cary Coutant <ccoutant@google.com>
6564 * output.cc (Output_file::open): Add execute permission to empty file.
6565 * testsuite/Makefile.am (permission_test): New test.
6566 * testsuite/Makefile.in: Regenerate.
6568 2009-09-02 Ian Lance Taylor <iant@google.com>
6570 * output.cc (Output_file::resize): Call map_no_anonymous rather
6573 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
6575 * gold.cc: Include "incremental.h".
6576 (queue_initial_tasks): Call Incremental_checker methods.
6577 * incremental.cc: Include "output.h".
6578 (Incremental_checker::can_incrementally_link_output_file): New
6580 * incremental.h (Incremental_checker): New class.
6582 * output.cc (Output_file::open_for_modification): New method.
6583 (Output_file::map_anonymous): Changed return type to bool. Record
6585 (Output_file::map_no_anonymous): New method, broken out of map.
6586 (Output_file::map): Use map_no_anonymous and map_anonymous.
6587 * output.h (class Output_file): Update declarations.
6589 2009-08-24 Cary Coutant <ccoutant@google.com>
6591 * options.h (Command_line::Pre_options): New class.
6592 (Command_line::pre_options): New member.
6593 * options.cc (gold::options::ready_to_register): New variable.
6594 (One_option::register_option): Do nothing if not registering options.
6595 Assert if same short option registered twice.
6596 (General_options::General_options): Turn off option registration when
6598 (Command_line::Pre_options::Pre_options): New constructor.
6600 2009-08-24 Cary Coutant <ccoutant@google.com>
6602 * options.h (General_options::no_keep_memory): Remove incorrect
6605 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6607 * Makefile.am (am__skiplex, am__skipyacc): New.
6608 * Makefile.in: Regenerate.
6610 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6612 * Makefile.am (AM_CPPFLAGS): Renamed from ...
6613 (INCLUDES): ... this.
6614 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6615 (AM_CPPFLAGS): Renamed from ...
6616 (INCLUDE): ... this.
6617 * Makefile.in, testsuite/Makefile.in: Regenerate.
6619 * Makefile.in: Regenerate.
6620 * aclocal.m4: Likewise.
6621 * config.in: Likewise.
6622 * configure: Likewise.
6623 * testsuite/Makefile.in: Likewise.
6625 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6626 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6627 * Makefile.in: Regenerate.
6628 * testsuite/Makefile.in: Regenerate.
6630 2009-08-19 Cary Coutant <ccoutant@google.com>
6632 * resolve.cc (Symbol_table::resolve): Don't complain about defined
6633 symbols in shared libraries overridden by hidden or internal symbols
6634 in the main program.
6636 2009-08-19 Chris Demetriou <cgd@google.com>
6638 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6639 checking source file names in error messages.
6641 2009-08-18 Doug Kwan <dougkwan@google.com>
6643 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6644 an elcpp::Ehdr as parameter. Adjust call to set_target.
6645 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6646 an elfcpp::Ehdr as parameter.
6647 * object.cc (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. Adjust call to set_target.
6651 (make_elf_sized_object): Find target and ask target to
6653 * object.h: (Object::set_target): Remove the version that looks up
6654 a target and sets it.
6655 (Sized_relobj::setup): Take a Target object instead of
6656 an elfcpp:Ehdr as parameter.
6657 * target.cc: Include dynobj.h.
6658 (Target::do_make_elf_object_implementation): New.
6659 (Target::do_make_elf_object): New.
6660 * target.h (Target::make_elf_object): New template declaration.
6661 (Target::do_make_elf_object): New method declarations.
6662 (Target::do_make_elf_object_implementation): New template declaration.
6664 2009-08-14 Ian Lance Taylor <iant@google.com>
6666 * gold.h (FUNCTION_NAME): Define.
6667 (gold_unreachable): Use FUNCTION_NAME.
6669 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6671 * icf.cc (Icf::find_identical_sections): Issue a warning when a
6672 symbol in the --keep-unique list is not found.
6674 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6676 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6677 been maked as --keep-unique.
6678 (Icf::unfold_section): New function.
6679 * icf.h (Icf::unfold_section): New function.
6680 * options.h (General_options::keep_unique): New option.
6681 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6682 * testsuite/Makefile.in: Regenerate.
6683 * testsuite/icf_keep_unique_test.sh: New file.
6684 * testsuite/icf_keep_unique_test.cc: New file.
6686 2009-08-12 Cary Coutant <ccoutant@google.com>
6689 * resolve.cc (Symbol_table::resolve): Check for references from
6690 dynamic objects to hidden and internal symbols.
6691 * testsuite/Makefile.am (hidden_test.sh): New test.
6692 * testsuite/Makefile.in: Regenerate.
6693 * testsuite/hidden_test.sh: New script.
6694 * testsuite/hidden_test_1.c: New test source.
6695 * testsuite/hidden_test_main.c: New test source.
6697 2009-08-11 Doug Kwan <dougkwan@google.com>
6699 * arm.cc: Update comments.
6700 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6701 segment to locate the .ARM.exidx section if present.
6703 2009-08-09 Doug Kwan <dougkwan@google.com>
6705 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6708 2009-08-07 Sriraman Tallam <tmsriram@google.com>
6709 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6712 2009-08-06 Sriraman Tallam <tmsriram@google.com>
6714 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6715 valid tls_segment only for non-debug-section relocations.
6716 * testsuite/Makefile.am: Add gc_tls_test.
6717 * testsuite/Makefile.in: Regenerate.
6718 * testsuite/gc_tls_test.cc: New file.
6719 * testsuite/gc_tls_test.sh: New file.
6721 2009-08-05 Sriraman Tallam <tmsriram@google.com>
6725 * Makefile.am (CCFILES): Add icf.cc.
6727 * Makefile.in: Regenerate.
6728 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6729 * gc.h (gc_process_relocs): Populate lists used by icf to contain
6730 section, symbol and addend information for the relocs.
6731 * gold.cc (queue_middle_tasks): Call identical code folding.
6732 * gold.h: Add defines for multimap.
6733 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6734 to the call of finalize_local_symbols.
6735 * main.cc (main): Create object of class Icf.
6736 * object.cc (Sized_relobj::do_layout): Allow this function to be
6737 called twice during icf.
6738 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6739 to sections marked as identical by icf.
6740 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6742 (Sized_relobj::do_section_entsize): New function.
6743 * object.h (Object::section_entsize): New function.
6744 (Object::do_section_entsize): New pure virtual function.
6745 (Relobj::finalize_local_symbols): Add new parameter.
6746 (Relobj::do_section_entsize): New function.
6747 * options.h (General_options::icf): New option.
6748 (General_options::icf_iterations): New option.
6749 (General_options::print_icf_sections): New option.
6750 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6751 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6752 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6754 * symtab.cc (Symbol_table::is_section_folded): New function.
6755 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6756 to sections marked as identical by icf.
6757 * symtab.h (Symbol_table::set_icf): New function.
6758 (Symbol_table::icf): New function.
6759 (Symbol_table::is_section_folded): New function.
6760 (Symbol_table::icf_): New data member.
6761 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6762 * testsuite/Makefile.am: Add commands to build icf_test.
6763 * testsuite/Makefile.in: Regenerate.
6764 * testsuite/icf_test.sh: New file.
6765 * testsuite/icf_test.cc: New file.
6767 2009-07-24 Chris Demetriou <cgd@google.com>
6769 * layout.cc (is_compressible_debug_section): Fix incorrect
6770 comment about compressed section names.
6772 2009-07-20 Ian Lance Taylor <ian@airs.com>
6775 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6777 2009-07-16 Ian Lance Taylor <iant@google.com>
6780 * layout.h: #include <map>.
6781 (class Kept_section): Change from struct to class. Add accessors
6782 and setters. Add section size to Comdat_group mapping. Change
6783 Comdat_group to std::map. Add is_comdat_ field. Add
6784 linkonce_size field in union.
6785 (class Layout): Update declaration of find_or_add_kept_section.
6786 Don't declare find_kept_object.
6787 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6788 parameter. Add object, shndx, is_comdat, and is_group_name
6789 parameters. Change all callers. Adjust for new Kept_section.
6790 (Layout::find_kept_object): Remove.
6791 * object.cc (Sized_relobj::include_section_group): Update use of
6792 Kept_section. Rename secnum to shndx. Only record
6793 Kept_comdat_section if sections are the same size.
6794 (Sized_relobj::include_linkonce_section): Update use of
6795 Kept_section. Only record Kept_comdat_section if sections are the
6796 same size. Set size of linkonce section.
6797 (Sized_relobj::map_to_kept_section): Update call to
6798 get_kept_comdat_section.
6799 * object.h (class Sized_relobj): Rename fields in
6800 Kept_comdat_section to drop trailing underscores; change object
6801 field to Relobj*. Change Kept_comdat_section_table to store
6802 struct rather than pointer.
6803 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6804 Add kept_object and kept_shndx parameters. Change all callers.
6805 (Sized_relobj::get_kept_comdat_section): Change return type to
6806 bool. Add kept_object and kept_shndx parameters. Change all
6808 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6809 Layout::find_or_add_kept_section.
6811 2009-07-09 Ian Lance Taylor <iant@google.com>
6813 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6814 Reserve space in the hash table.
6816 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
6818 * fileread.cc (File_read::get_mtime): New method.
6819 * fileread.h (Timespec): New structure.
6820 (File_read::get_mtime): New method.
6821 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6822 Renamed from timestamp_nsec.
6823 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6825 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6827 (Incremental_inputs::report_archive): Save mtime; style fix.
6828 (Incremental_inputs::report_obejct): Save mtime; style fix.
6829 (Incremental_inputs::report_script): Save mtime; style fix.
6830 (Incremental_inputs::finalize_inputs): Style fix.
6831 (Incremental_inputs::finalize): Style fix.
6832 (Incremental_inputs::create_input_section_data): Store inputs
6834 * incremental.h (Incremental_inputs::report_script): Add mtime
6836 (Incremental_inputs::Input_info::Input_info): Intialize only one
6838 (Incremental_inputs::Input_info::archive): Move to nameless
6840 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6841 (Incremental_inputs::Input_info::script): Move to nameless union.
6842 (Incremental_inputs::mtime): New field.
6843 * script.cc (read_input_script): Pass file mtime to
6845 * script.h (Script_info::inputs): Style fix.
6847 2009-07-01 Ian Lance Taylor <ian@airs.com>
6849 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6852 2009-06-24 Ian Lance Taylor <iant@google.com>
6855 * layout.cc (Layout::choose_output_section): If we find an
6856 existing section, update the flags.
6857 (Layout::create_notes): New function, broken out of
6859 (Layout::finalize): Don't create note sections.
6860 (Layout::create_note): Don't crash if linker script discards
6862 (Layout::create_gold_note): Likewise.
6863 (Layout::create_build_id): Likewise. Don't set
6864 after_input_sections on the section.
6865 (Layout::create_executable_stack_info): Remove target parameter.
6867 * layout.h (class Layout): Declare create_notes. Update
6868 declaration of create_executable_stack_info.
6869 * gold.cc (queue_middle_tasks): Call create_notes.
6870 * output.cc (Output_section::update_flags_for_input_section): Move
6871 here from output.h. If SHF_ALLOC flag is newly set, mark address
6873 * output.h (Output_data::mark_address_invalid): New function.
6874 (class Output_section): Only declare, not define,
6875 update_flags_for_input_section. Remove set_flags.
6877 2009-06-24 Ian Lance Taylor <iant@google.com>
6879 * script-sections.cc (Output_section_definition::
6880 set_section_addresses): Rename shadowing local load_address to
6883 2009-06-24 Ian Lance Taylor <iant@google.com>
6886 * reloc.cc (relocate_sections): Skip empty relocation sections.
6888 2009-06-23 Ian Lance Taylor <iant@google.com>
6891 * layout.cc (Layout::create_note): Use choose_output_section
6892 rather than make_output_section.
6894 2009-06-23 Ian Lance Taylor <iant@google.com>
6897 * options.cc (General_options::parse_V): Set printed_version_.
6898 (General_options::General_options): Initialize printed_version_.
6899 * options.h (class General_options): Add printed_version_ field.
6900 * gold.cc (queue_initial_tasks): If there are no input files,
6901 don't give a fatal error if we printed the version information.
6902 (queue_middle_tasks): If using -r with a shared object, give a
6903 fatal error rather than an ordinary error.
6905 2009-06-23 Ian Lance Taylor <iant@google.com>
6908 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6909 (Layout::make_output_section): Set have_stabstr_section_ if we see
6910 a .stab*str section.
6911 (Layout::finalize): Call link_stabs_sections.
6912 (Layout::link_stabs_sections): New file.
6913 * layout.h (class Layout): Add have_stabstr_section_ field.
6914 Declare link_stabs_sections.
6916 2009-06-23 Doug Kwan <dougkwan@google.com>
6918 * Makefile.am (libgold_a_LIBADD): New.
6919 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6920 * Makefile.in: Regenerate.
6921 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6922 * configure: Regenerate.
6923 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6924 * fileread.cc: Include sys/state.h
6925 * gold.h: Declare memmem and strndup if found missing.
6926 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6928 2009-06-23 Ian Lance Taylor <iant@google.com>
6930 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6931 * configure: Rebuild.
6933 2009-06-23 Ian Lance Taylor <iant@google.com>
6936 * object.cc (Object::section_contents): Don't try to get a view if
6937 the section has length zero.
6938 (Object::handle_gnu_warning_section): If the section is empty, use
6939 the name of the section as the warning.
6941 2009-06-23 Ian Lance Taylor <iant@google.com>
6944 * stringpool.h (class Stringpool_template): Add optimize_ field.
6945 (Stringpool_template::set_optimize): New function.
6946 * stringpool.cc (Stringpool_template::Stringpool_template):
6947 Initialize optimize_ field.
6948 (Stringpool_template::set_string_offsets): Test local optimize
6949 fild rather than parameter.
6950 * layout.cc (Layout::Layout): Call set_optimize on the section
6953 2009-06-22 Ian Lance Taylor <iant@google.com>
6956 * yyscript.y: Parse TARGET.
6957 * script.cc (script_set_target): New function.
6958 * script-c.h (script_set_target): Declare.
6959 * options.cc (General_options::string_to_object_format): Rename
6960 from string_to_object_format in anonymous namespace. Change
6962 * options.h (class General_options): Declare
6963 string_to_object_format.
6965 2009-06-22 Ian Lance Taylor <iant@google.com>
6967 * script-sections.cc (Script_sections::create_segments): Don't put
6968 program headers in a PT_LOAD segment if -n or -N.
6970 2009-06-22 Ian Lance Taylor <iant@google.com>
6973 * options.h (class General_options): Add -z lazy and -z now. Sort
6974 -z options into alphabetical order.
6975 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6977 2009-06-21 Ian Lance Taylor <iant@google.com>
6979 * layout.cc (Layout::make_output_section): Call
6980 Target::new_output_section.
6981 (Layout::attach_allocated_section_to_segment): Put large section
6982 sections in a separate load segment with the large segment flag
6984 (Layout::segment_precedes): Sort large data segments after other
6986 (align_file_offset): New static function.
6987 (Layout::set_segment_offsets): Use align_file_offset.
6988 * output.h (class Output_section): Add is_small_section_ and
6989 is_large_section_ fields.
6990 (Output_section::is_small_section): New function.
6991 (Output_section::set_is_small_section): New function.
6992 (Output_section::is_large_section): New function.
6993 (Output_section::set_is_large_section): New function.
6994 (Output_section::is_large_data_section): New function.
6995 (class Output_segment): Add is_large_data_segment_ field.
6996 (Output_segment::is_large_data_segment): New function.
6997 (Output_segment::set_is_large_data_segment): New function.
6998 * output.cc (Output_section::Output_section): Initialize new
7000 (Output_segment::Output_segment): Likewise.
7001 (Output_segment::add_output_section): Add assertion that large
7002 data sections always go in large data segments. Force small data
7003 sections to the end of the list of data sections. Force small BSS
7004 sections to the start of the list of BSS sections. For large BSS
7005 sections to the end of the list of BSS sections.
7006 * symtab.h (class Symbol): Declare is_common_shndx.
7007 (Symbol::is_defined): Check Symbol::is_common_shndx.
7008 (Symbol::is_common): Likewise.
7009 (class Symbol_table): Define enum Commons_section_type. Update
7010 declarations. Add small_commons_ and large_commons_ fields.
7011 * symtab.cc (Symbol::is_common_shndx): New function.
7012 (Symbol_table::Symbol_table): Initialize new fields.
7013 (Symbol_table::add_from_object): Put small and large common
7014 symbols in the right list.
7015 (Symbol_table::sized_finalized_symbol): Check
7016 Symbol::is_common_shndx.
7017 (Symbol_table::sized_write_globals): Likewise.
7018 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7019 common symbol lists. Don't call do_allocate_commons_list if the
7021 (Symbol_table::do_allocate_commons_list): Remove is_tls
7022 parameter. Add comons_section_type parameter. Change all
7023 callers. Handle small and large common symbols.
7024 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7025 Symbol::is_common_shndx.
7026 * resolve.cc (symbol_to_bits): Likewise.
7027 * target.h (Target::small_common_shndx): New function.
7028 (Target::small_common_section_flags): New function.
7029 (Target::large_common_shndx): New function.
7030 (Target::large_common_section_flags): New function.
7031 (Target::new_output_section): New function.
7032 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7033 small_common_section_flags, and large_common_section_flags
7035 (Target::do_new_output_section): New virtual function.
7036 * arm.cc (Target_arm::arm_info): Initialize new fields.
7037 * i386.cc (Target_i386::i386_info): Likewise.
7038 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7040 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7041 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7042 (Target_x86_64::do_new_output_section): New function.
7043 * configure.ac: Define conditional MCMODEL_MEDIUM.
7044 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7045 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7046 (large_LDFLAGS): Define.
7047 * testsuite/large.c: New file.
7048 * testsuite/testfile.cc (Target_test::test_target_info):
7049 Initialize new fields.
7050 * configure, testsuite/Makefile.in: Rebuild.
7052 2009-06-05 Doug Kwan <dougkwan@google.com>
7054 * Makefile.am (CCFILES): Add target.cc.
7055 * Makefile.in: Regenerate.
7056 * i386.cc (class Target_i386): Define new virtual method to
7057 override do_is_local_label_name in parent.
7058 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7059 local symbols if --discard-locals or -X is given.
7060 * options.h (class General_options): Declare new options
7061 '--discard-locals' and '-X' for discarding locals.
7062 * target.h (class Target): Define new methods is_local_label_name.
7063 Declare new virtual method do_is_local_label_name.
7064 * target.cc: New file.
7065 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7066 (check_SCRIPTS): Add discard_locals_test.sh.
7067 (check_DATA): Add discard_local_tests.syms.
7068 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7069 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7070 * testsuite/Makefile.in: Regenerate.
7071 * testsuite/discard_locals_test.c: New file.
7072 * testsuite/discard_locals_test.sh: Same.
7074 2009-06-05 Doug Kwan <dougkwan@google.com>
7076 * object.cc (Sized_relobj::Sized_relobj): Initialize
7077 discarded_eh_frame_shndx_ to -1U.
7078 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7080 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7081 a discarded .eh_frame section.
7082 (Sized_relobj::do_finalize_local_symbols): Ditto.
7083 * object.h (class Sized_relobj): Declare new member
7084 discarded_eh_frame_shndx_.
7085 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7086 (local_labels_test.o, local_labels_test): New rules.
7087 * testsuite/Makefile.in: Regenerate.
7089 2009-06-04 Doug Kwan <dougkwan@google.com>
7091 * layout.cc (Layout::section_name_mapping): Add mapping for
7092 special ARM sections.
7094 2009-06-03 Doug Kwan <dougkwan@google.com>
7096 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7097 (utils::has_overflow): Same.
7099 2009-06-03 Ian Lance Taylor <iant@google.com>
7101 * layout.cc (Layout::section_name_mapping): New array, replacing
7102 Layout::linkonce_mapping.
7103 (Layout::section_name_mapping_count): New variable, replacing
7104 Layout::linkonce_mapping_count.
7105 (Layout::linkonce_output_name): Remove.
7106 (Layout::output_section_name): Rewrite.
7107 * layout.h (class Layout): Rename Linkonce_mapping to
7108 Section_name_mapping, linkonce_mapping to section_name_mapping,
7109 linkonce_mapping_count to section_name_mapping_count. Don't
7110 declare linkonce_output_name.
7112 2009-06-03 Doug Kwan <dougkwan@google.com>
7114 * gold/arm.cc (namespace utils): New.
7115 (Target_arm::reloc_is_non_pic): Define new method.
7116 (class Arm_relocate_functions): New.
7117 (Target_arm::Relocate::relocate): Handle relocation types used by
7120 2009-06-03 Ian Lance Taylor <iant@google.com>
7122 * arm.cc (Target_arm::scan::global): Use || instead of |.
7124 2009-06-02 Doug Kwan <dougkwan@google.com>
7126 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7127 issued_non_pic_error_.
7128 (class Target_arm::Scan): Declare new method check_non_pic.
7129 Define new method symbol_needs_plt_entry.
7130 Declare new data member issued_non_pic_error_.
7131 (class Target_arm::Relocate): Declare new method
7132 should_apply_static_reloc.
7133 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7134 (Target_arm::Scan::check_non_pic): Define new method.
7135 (Target_arm::Scan::local): Handle a small subset of reloc types used
7137 (Target_arm::Scan::local): Same.
7138 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7140 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7142 * incremental.cc (Incremental_inputs::report_command_line): Filter
7143 out --incremental-* options.
7145 2009-05-29 Doug Kwan <dougkwan@google.com>
7147 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7149 (class Target_arm): Update comment.
7150 (Target_arm::Target_arm): Initialize new data members GOT_,
7151 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7152 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7153 and Target_arm::rel_dyn_section.
7154 Declare new_enum Target_arm::Got_type.
7155 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7157 Update commments for member do_dynsym_value.
7158 (Target_arm::got_size, Target_arm::plt_section,
7159 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7160 new methods inside class defintion.
7161 (Target_arm::got_section): Define new method.
7162 (Target_arm::rel_dyn_section): Same.
7163 (Output_data_plt_arm): New template class.
7164 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7165 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7166 (Output_data_plt_arm::add_entry): Same.
7167 (Output_data_plt_arm::first_plt_entry): Define new
7168 static data member for PLT instruction template.
7169 (Output_data_plt_arm::plt_entry): Same.
7170 (Output_data_plt_arm::do_write): Define new method.
7171 (Target_arm::make_plt_entry): Same.
7172 (Target_arm::do_finalize_sections): Same.
7173 (Target_arm::do_dynsym_value): Same.
7175 2009-05-28 Doug Kwan <dougkwan@google.com>
7177 * Makefile.am (TARGETSOURCES): Add arm.cc.
7178 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7179 * Makefile.in: Regenerate.
7181 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7183 2009-05-26 Doug Kwan <dougkwan@google.com>
7185 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7186 (General_options::check_excluded_libs): Strip off directories in
7187 archive name before matching like GNU ld does.
7188 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7189 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7190 (exclude_libs_test_LDFLAGS): Add linker option
7191 -Wl,--exclude-libs,libexclude_libs_test_3
7192 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7193 an explicit archive without using -l.
7194 (alt/libexclude_libs_test_3.a): New make rule.
7195 * testsuite/Makefile.in: Regenerate.
7196 * testsuite/exclude_libs_test.c : Declare lib3_default().
7198 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7199 * exclude_libs_test_3.c: New file.
7201 2009-05-26 Nick Clifton <nickc@redhat.com>
7203 * po/id.po: New Indonesian translation.
7204 * po/gold.pot: Updated template file.
7206 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7208 * testsuite/Makefile.am: Add -ffunction-sections to compile
7209 gc_comdat_test files. Add -Wl,--gc-sections to build
7211 * testsuite/Makefile.in: Regenerate.
7212 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7214 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7216 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7217 kept comdat section was garbage collected.
7218 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7219 * testsuite/Makefile.in: Regenerate.
7220 * testsuite/gc_comdat_test.sh: New file.
7221 * testsuite/gc_comdat_test_1.cc: New file.
7222 * testsuite/gc_comdat_test_2.cc: New file.
7224 2009-05-19 Doug Kwan <dougkwan@google.com>
7226 * archive.cc (Archive::Archive): Move constructor from archive.h
7227 to here. Initialize no_export_.
7228 (Archive::get_elf_object_for_member): Set no_export flag of object.
7229 * archive.h (Archive::Archive): Move constructor body to
7231 (Archive::no_export): New method.
7232 (Archive::no_export_): New field.
7233 * object.h (Object::Object): Initialize no_export_ to false.
7234 (Object::no_export, Object::set_no_export): New methods.
7235 (Object::no_export_): New field.
7236 * options.cc (General_options::parse_exclude_libs): New method.
7237 (General_options::check_excluded_libs) Same.
7238 * options.h (exclude_libs): New option.
7239 (General_options::check_excluded_libs): New method declaration.
7240 (General_options::excluded_libs_): New field.
7241 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7242 default or protected visibility if an object has no-export flag set.
7243 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7244 (check_SCRIPTS): Add exclude_libs_test.sh.
7245 (check_DATA): Add exclude_libs_test.syms.
7246 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7247 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7248 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7249 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7250 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7251 libexclude_libs_test_2.a): New rules.
7252 * testsuite/Makefile.in: Regenerate.
7253 * testsuite/exclude_libs_test.c: New file.
7254 * testsuite/exclude_libs_test.sh: Ditto.
7255 * testsuite/exclude_libs_test_1.c: Ditto.
7256 * testsuite/exclude_libs_test_2.c: Ditto.
7258 2009-05-15 Ian Lance Taylor <iant@google.com>
7260 * configure.ac: Check for declarations for cases where libiberty.h
7261 checks HAVE_DECL_xxx.
7262 * configure, config.in: Rebuild.
7264 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7266 * gold.h (Incremental_argument_list): Remove (invalid) forward
7268 * incremental.cc (Incremental_inputs::report_achive): New method.
7269 (Incremental_inputs::report_object): New method.
7270 (Incremental_inputs::report_script): New method.
7271 (Incremental_inputs::finalize_inputs): New method.
7272 (Incremental_inputs::finalize): Call finalize_inputs().
7273 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7274 Create inputs entries.
7275 * incremental.h (Incremental_input_type): New enum.
7276 (Incremental_inputs::Incremental_input): Initialize new fields.
7277 (Incremental_inputs::report_inputs): New method.
7278 (Incremental_inputs::report_achive): New method.
7279 (Incremental_inputs::report_object): New method.
7280 (Incremental_inputs::report_script): New method.
7281 (Incremental_inputs::finalize_inputs): New method.
7282 (Incremental_inputs::Input_info): New struct.
7283 (Incremental_inputs::Input_info_map): New typedef.
7284 (Incremental_inputs::lock_): New field.
7285 (Incremental_inputs::Inputs_): New field.
7286 (Incremental_inputs::Inputs_map): New field.
7287 * main.cc (main): Call Incremental_input::report_inputs.
7288 * options.h (Input_argument_list): Typedef moved from
7290 (Input_file_group::Files): Remove, use ::Input_argument_list.
7291 (Input_file_group::Input_argument_list): Remove, use
7292 ::Input_argument_list.
7293 * plugin.cc (Plugin_manager::add_input_file): Add error in
7295 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7297 * script.cc (read_input_script): Call
7298 Incremental_input::report_script.
7299 * script.h (Script_info): New class.
7301 2009-04-27 Ian Lance Taylor <iant@google.com>
7303 * x86_64.cc (do_adjust_output_section): Set entsize to
7306 2009-04-23 Elliott Hughes <enh@google.com>
7308 * output.cc (Output_file::close): After short writes, continue
7309 writing from the correct offset in the buffer being written.
7311 2009-04-23 Chris Demetriou <cgd@google.com>
7313 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7314 * configure: Regenerate.
7315 * config.in: Regenerate.
7316 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7317 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7319 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7321 * incremental.cc (Incremental_inputs_header_data): Renamed from
7322 Incremental_input_header_data.
7323 (Incremental_inputs_header_data::data_size): New field.
7324 (Incremental_inputs_header_data::put_input_file_count): Renamed
7325 from input_file_count.
7326 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7327 from command_line_offset.
7328 (Incremental_inputs_header_data::put_reserved): Renamed from
7330 (Incremental_inputs_entry_data): Renamed from
7331 Incremental_input_entry_data.
7332 (Incremental_inputs_entry_data::data_size): New field.
7333 (Incremental_inputs::report_command_line): New method.
7334 (Incremental_inputs::finalize): New method.
7335 (Incremental_inputs::create_incremental_inputs_data): New method.
7336 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7337 * incremental.h: New file.
7338 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7339 (Layout::finalize): Create incremental inputs section in
7341 (Layout::create_incremental_info_sections): New method.
7342 * layout.h (Layout::incremental_inputs): New method.
7343 (Layout::create_incremental_info_sections): New method.
7344 (Layout::incremental_inputs_): New field.
7345 * main.cc (main): Notify Incremental_input of the command line.
7347 2009-04-01 Ian Lance Taylor <iant@google.com>
7348 Mikolaj Zalewski <mikolajz@google.com>
7350 * gold.h (reserve_unordered_map): Define, three versions, one for
7351 each version of Unordered_map.
7352 * layout.cc (Layout::Layout): Remove options parameter. Add
7353 number_of_input_files parameter. Don't initialize options_.
7354 Initialize number_of_input_files_ and resized_signatures_. Move
7355 sections_are_attached_.
7356 (Layout::layout_group): Reserve space for group_signatures_.
7357 (Layout::find_or_add_kept_section): Change name parameter to be a
7358 reference. Resize signatures_ map when it gets large enough.
7359 (Layout::layout_eh_frame): Use parameters->options() instead of
7361 (Layout::make_output_section): Likewise.
7362 (Layout::attach_allocated_section_to_segment): Likewise.
7363 (Layout::finalize, Layout::create_executable_stack): Likewise.
7364 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7365 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7366 * layout.h (class Layout): Update declarations. Remove options_
7367 field. Add number_of_input_files_ and resized_signatures_
7368 fields. Move sections_are_attached_ field.
7369 * main.cc (main): Pass number of input files to Layout
7370 constructor. Don't pass options.
7372 2009-03-30 Ian Lance Taylor <iant@google.com>
7374 * ffsll.c (ffsll): Correct implementation.
7376 2009-03-27 Ian Lance Taylor <iant@google.com>
7378 * ffsll.c: New file.
7379 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7380 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7381 * ftruncate.c (ftruncate): Declare before definition.
7382 * mremap.c (mremap): Likewise.
7383 * pread.c (pread): Likewise.
7384 * configure, Makefile.in, config.in: Rebuild.
7386 * mremap.c: New file.
7387 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7388 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7389 (mremap): Declare if HAVE_MREMAP is not defined.
7390 * configure, Makefile.in, config.in: Rebuild.
7392 2009-03-27 Cary Coutant <ccoutant@google.com>
7394 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7395 position independent.
7396 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7397 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7399 2009-03-24 Cary Coutant <ccoutant@google.com>
7401 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7403 (needs_dynamic_reloc): Likewise.
7405 2009-03-24 Ian Lance Taylor <iant@google.com>
7407 * yyscript.y (file_cmd): Recognize EXTERN.
7408 (extern_name_list, extern_name_list_body): New nonterminals.
7409 * script.cc (script_add_extern): Define.
7410 * script-c.h (script_add_extern): Declare.
7412 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
7414 * object.cc (is_elf_object): Define.
7415 * object.h (is_elf_object): Declare.
7416 * archive.cc (Archive::get_elf_object_for_member): Call
7418 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7420 2009-03-24 Elliott Hughes <enh@google.com>
7422 * output.cc (Output_file::map_anonymous): Define.
7423 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7424 try an anonymous one. Report the size if the mmap fails.
7425 * output.h (class Output_file): Declare map_anonymous.
7427 2009-03-24 Ian Lance Taylor <iant@google.com>
7429 * target-select.cc (instantiate_target): Don't acquire the lock if
7430 the instantiated_target_ field has already been set.
7432 2009-03-23 Ian Lance Taylor <iant@google.com>
7434 * gold-threads.h (class Initialize_lock): Define.
7435 * gold-threads.cc (class Initialize_lock_once): Define.
7436 (initialize_lock_control): New static variable.
7437 (initialize_lock_pointer): New static variable.
7438 (initialize_lock_once): New static function.
7439 (Initialize_lock::Initialize_lock): Define.
7440 (Initialize_lock::initialize): Define.
7441 * target-select.h: Include "gold-threads.h".
7442 (class Target_selector): Add lock_ and initialize_lock_ fields.
7443 Don't define instantiate_target, just declare it.
7444 * target-select.cc (Target_selector::Target_selector): Initialize
7446 (Target_selector::instantiate_target): Define.
7447 * descriptors.h: Include "gold-threads.h".
7448 (class Descriptors): Add initialize_lock_ field.
7449 * descriptors.cc (Descriptors::Descriptors): Initialize new
7451 (Descriptors::open): Use initialize_lock_ field
7452 * errors.h (class Errors): Add initialize_lock_ field.
7453 * errors.cc (Errors::Errors): Initialize new field.
7454 (Errors::initialize_lock): Use initialize_lock_ field.
7455 * powerpc.cc (class Target_selector_powerpc): Remove
7456 instantiated_target_ field. In do_recognize call
7457 instantiate_target rather than do_instantiate_target. In
7458 do_instantiate_target just allocate a new target.
7459 * sparc.cc (class Target_selector_sparc): Likewise.
7461 * freebsd.h: New file.
7462 * i386.cc: Include "freebsd.h".
7463 (Target_i386): Derive from Target_freebsd rather than
7465 (Target_selector_i386): Derive from Target_selector_freebsd rather
7466 than Target_selector.
7467 * x86_64.cc: Include "freebsd.h".
7468 (Target_x86_64): Derive from Target_freebsd rather than
7470 (Target_selector_x86_64): Derive from Target_selector_freebsd
7471 rather than Target_selector.
7472 * target.h (class Target): Add adjust_elf_header and
7473 do_adjust_elf_header.
7474 * output.cc (Output_file_header:: do_sized_write): Call target
7475 adjust_elf_header routine.
7476 * configure.tgt: Set targ_osabi.
7477 * configure.ac: Define GOLD_DEFAULT_OSABI.
7478 * parameters.cc (Parameters::default_target): Pass
7479 GOLD_DEFAULT_OSABI to select_target.
7480 * target-select.h (class Target_selector): Make instantiate_target
7481 protected rather than private.
7482 * Makefile.am (HFILES): Add freebsd.h.
7483 * configure, Makefile.in, config.in: Rebuild.
7485 * merge.cc (do_add_input_section): Correct pend value. Change
7486 message about last entry not being null terminated from error to
7489 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7491 * incremental.cc: New file.
7492 * Makefile.am (CCFILES): Add incremental.cc.
7493 * Makefile.in: Rebuild.
7495 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7497 * layout.cc (Layout::output_section_name): Preserve names
7498 of '.note.' sections.
7500 2009-03-19 Ian Lance Taylor <iant@google.com>
7502 * descriptors.cc (Descriptors::open): Check that the options are
7503 valid before using them.
7505 2009-03-18 Ian Lance Taylor <iant@google.com>
7507 * script-sections.h: Include <list>.
7508 (class Script_sections): Change Sections_elements from std::vector
7509 to std::list. Typedef public Elements_iterator. Add
7510 orphan_section_placement_, data_segment_align_start_, and
7511 saw_data_segment_align_ fields. Remove data_segment_align_index_
7513 * script-sections.cc (class Orphan_section_placement): New class.
7514 (class Sections_element): Add virtual functions is_relro and
7515 orphan_section_init. Remove virtual function place_orphan_here.
7516 (class Output_section_definition): Add is_relro and
7517 orphan_section_init. Remove place_orphan_here.
7518 (class Orphan_output_section): Likewise.
7519 (Script_sections::Script_sections): Update for field changes.
7520 (Script_sections::data_segment_align): Set saw_data_segment_align_
7521 and data_segment_align_start_, not data_segment_align_index.
7522 (Script_sections::data_segment_relro_end): Check
7523 saw_data_segment_align_. Use data_segment_align_start_ rather
7524 than data_segment_align_index_.
7525 (Script_sections::place_orphan): Rewrite to use
7526 Orphan_section_placement.
7528 2009-03-17 Ian Lance Taylor <iant@google.com>
7530 * archive.cc (Archive::add_symbols): Check for a version attached
7531 to the symbol name in the archive map.
7532 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7533 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7534 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7535 (ver_test_11.a): New target.
7536 * testsuite/Makefile.in: Rebuild.
7538 * configure.ac: Check for chsize and posix_fallocate. Replace
7540 * ftruncate.c: New file, from gnulib.
7541 * output.cc (posix_fallocate): Define dummy version if not
7542 HAVE_POSIX_FALLOCATE.
7543 (Output_file::map): Call posix_fallocate rather than lseek and
7545 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7546 * configure, Makefile.in, config.in: Rebuild.
7548 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
7550 * layout.h (Layout::create_note): Add section_name parameter.
7551 * layout.cc (Layout::create_note): Likewise.
7552 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7554 2009-03-17 Ian Lance Taylor <iant@google.com>
7556 * descriptors.cc: Include "options.h".
7557 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7558 (Descriptors::open): Always use O_CLOEXEC when opening a new
7559 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7560 then set FD_CLOEXEC.
7562 * sparc.cc (class Target_sparc): Add has_got_section.
7563 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7564 make sure we have a GOT section.
7566 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7567 (Target_sparc::Scan::local): Likewise.
7568 (Target_sparc::Scan::global): Likewise.
7569 (Target_sparc::Relocate::relocate): Likewise.
7570 (Target_sparc::Relocate::relocate_tls): Likewise.
7572 * symtab.cc (Symbol_table::define_default_version): New function,
7573 broken out of add_from_object.
7574 (Symbol_table::add_from_object): Call define_default_version.
7575 (Symbol_table::define_special_symbol): Add resolve_oldsym
7576 parameter. Change all callers. If the version for a symbol comes
7577 from a version script, resolve it with the symbol with the same
7578 name with no version. Also add the symbol without a version if
7580 (do_define_in_output_data): If resolving with oldsym, don't delete
7582 (do_define_in_output_segment): Likewise.
7583 (do_define_as_constant): Likewise.
7584 * symtab.h (class Symbol_table): Update declarations.
7586 2009-03-13 Ian Lance Taylor <iant@google.com>
7588 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7589 (Read_symbols::requeue): New function.
7590 (Read_symbols::do_read_symbols): If make_elf_object fails because
7591 the target type is not configured, and the file was searched for,
7592 issue a warning and retry with the next directory.
7593 (Add_symbols::run): If the file has an incompatible format, and
7594 it was searched for, requeue the Read_symbols task. On error,
7596 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
7597 dirindex parameter to constructor. Change all callers. Declare
7598 incompatible_warning and requeue.
7599 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7600 input_argument_ and input_group_ fields. Add them to
7601 constructor. Change all callers.
7602 (class Read_script): Add dirindex_ field. Add it to constructor.
7604 * archive.cc (Archive::setup): Remove input_objects parameter.
7606 (Archive::get_file_and_offset): Likewise.
7607 (Archive::read_all_symbols): Likewise.
7608 (Archive::read_symbols): Likewise.
7609 (Archive::get_elf_object_for_member): Remove input_objects
7610 parameter. Add punconfigured parameter. Change all callers.
7611 (Archive::add_symbols): Change return type to bool. Check return
7612 value of include_member.
7613 (Archive::include_all_members): Likewise.
7614 (Archive::include_member): Change return type to bool. Return
7615 false if first included object has incompatible target. Set
7616 included_member_ field.
7617 (Add_archive_symbols::run): If add_symbols returns false, requeue
7619 * archive.h (class Archive): Add included_member_ field.
7620 Initialize it in constructor. Add input_file and searched_for
7621 methods. Update declarations.
7622 (class Add_archive_symbols): Add dirpath_, dirindex_, and
7623 input_argument_ fields. Add them to constructor. Change all
7625 * script.cc: Include "target-select.h".
7626 (class Parser_closure): Add skip_on_incompatible_target_ and
7627 found_incompatible_target_ fields. Add
7628 skip_on_incompatible_target parameter to constructor. Change all
7629 callers. Add methods skip_on_incompatible_target,
7630 clear_skip_on_incompatible_target, found_incompatible_target, and
7631 set_found_incompatible_target.
7632 (read_input_script): Add dirindex parameter. Change all callers.
7633 If parser finds an incompatible target, requeue Read_symbols
7635 (script_set_symbol): Clear skip_on_incompatible_target in
7637 (script_add_assertion, script_parse_option): Likewise.
7638 (script_start_sections, script_add_phdr): Likewise.
7639 (script_check_output_format): New function.
7640 * script.h (read_input_script): Update declaration.
7641 * script-c.h (script_check_output_format): Declare.
7642 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7643 (ignore_cmd): Remove OUTPUT_FORMAT.
7644 * fileread.cc (Input_file::Input_file): Add explicit this.
7645 (Input_file::will_search_for): New function.
7646 (Input_file::open): Add pindex parameter. Change all callers.
7647 * fileread.h (class Input_file): Add input_file_argument method.
7648 Declare will_search_for. Update declarations.
7649 * object.cc (make_elf_object): Add punconfigured parameter.
7651 * object.h (class Object): Make input_file public. Add
7652 searched_for method.
7653 (make_elf_object): Update declaration.
7654 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
7656 * dirsearch.h (class Dirsearch): Update declaration.
7657 * options.h (class General_options): Add --warn-search-mismatch.
7658 * parameters.cc (Parameters::is_compatible_target): New function.
7659 * parameters.h (class Parameters): Declare is_compatible_target.
7660 * workqueue.cc (Workqueue::add_blocker): New function.
7661 * workqueue.h (class Workqueue): Declare add_blocker.
7663 * fileread.cc (Input_file::open): Remove options parameter.
7665 (Input_file::open_binary): Likewise.
7666 * script.cc (read_input_script): Likewise.
7667 * readsyms.h (class Read_symbols): Remove options_ field. Remove
7668 options parameter from constructor. Change all callers.
7669 (class Read_script): Likewise.
7670 * fileread.h (class Input_file): Update declarations.
7671 * script.h (read_input_script): Update declaration.
7673 2009-03-10 Nick Clifton <nickc@redhat.com>
7675 * po/es.po: New Spanish translation.
7677 2009-03-06 Cary Coutant <ccoutant@google.com>
7679 * options.cc (parse_short_option): Keep dash_z from registering itself.
7681 2009-03-03 Ian Lance Taylor <iant@google.com>
7684 * target-reloc.h (relocate_section): Pass output_section to
7686 * i386.cc (Target_i386::should_apply_static_reloc): Add
7687 output_section parameter. Change all callers.
7688 (Target_i386::Relocate::relocate): Add output_section parameter.
7689 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7690 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7691 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7692 * testsuite/two_file_shared.sh: New script.
7693 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7694 (check_DATA): Add two_file_shared.dbg.
7695 (two_file_shared.dbg): New target.
7696 * testsuite/Makefile.in: Rebuild.
7698 2009-03-01 Ian Lance Taylor <iant@google.com>
7700 * configure.ac: Check for byteswap.h.
7701 * configure: Rebuild.
7702 * config.in: Rebuild.
7704 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
7706 * layout.cc (Layout::find_or_add_kept_section): New function.
7707 (Layout::add_comdat): Removed.
7708 * layout.h (struct Kept_section): Move out of class Layout.
7709 Remove trailing underscores from field names. Add group_sections
7710 field. Rename group_ field to is_group. Change all uses.
7711 (class Layout): Declare find_or_add_kept_section, not add_comdat.
7712 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7713 comdat_groups_ field.
7714 (Sized_relobj::include_section_group): Use
7715 find_or_add_kept_section and Kept_section::group_sections.
7716 (Sized_relobj::include_linkonce_section): Likewise.
7717 * object.cc (class Sized_relobj): Don't define Comdat_group or
7718 Comdat_group_table. Remove find_comdat_group and
7719 add_comdat_group. Remove comdat_groups_ field.
7720 * plugin.cc (include_comdat_group): Use
7721 Layout::find_or_add_kept_section.
7723 2009-02-28 Ian Lance Taylor <iant@google.com>
7725 * README: --gc-sections and map files are now supported. Document
7726 some build requirements.
7729 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7730 relocatable link set the value of the section symbol to zero.
7731 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7732 relocatable link don't include the section address in the local
7735 2009-02-27 Ian Lance Taylor <iant@google.com>
7738 * options.h (class Search_directory): Add is_system_directory.
7739 (class General_options): Declare is_in_system_directory.
7740 * options.cc (get_relative_sysroot): Make static.
7741 (get_default_sysroot): Make static.
7742 (General_optoins::is_in_system_directory): New function.
7743 * fileread.cc (Input_file::is_in_system_directory): New function.
7744 * fileread.h (class Input_file): Declare is_in_system_directory.
7745 * object.h (class Object): Add is_in_system_directory.
7746 (class Input_objects): Remove system_library_directory_ field.
7747 * object.cc (Input_objects::add_object): Don't set
7748 system_library_directory_.
7749 (input_objects::found_in_system_library_directory): Remove.
7750 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7751 parameter. Change all callers.
7752 (Symbol_table::sized_write_globals): Likewise.
7753 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7754 Call Object::is_in_system_directory.
7755 * symtab.h (class Symbol_table): Update declarations.
7758 * descriptors.h (Open_descriptor): Add is_on_stack field.
7759 * descriptors.cc (Descriptors::open): If the descriptor is on the
7760 top of the stack, remove it. Initialize is_on_stack field.
7761 (Descriptors::release): Only add pod to stack if it is not on the
7763 (Descriptors::close_some_descriptor): Clear stack_next and
7767 * output.cc (Output_section::find_starting_output_address): Rename
7768 from starting_output_address; add PADDR parameter; change return
7770 * output.h (class Output_section): Declare
7771 find_starting_output_address instead of starting_output_address.
7772 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7773 section symbol for which we can't find a merge section.
7776 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7777 hidden or internal, force the symbol to be local.
7778 * resolve.cc (Symbol::override_visibility): Define.
7779 (Symbol::override_base): Use override_visibility.
7780 (Symbol_table::resolve): Likewise.
7781 (Symbol::override_base_with_special): Likewise.
7782 (Symbol_table::override_with_special): If the visibility is hidden
7783 or internal, force the symbol to be local.
7784 * symtab.h (class Symbol): Add set_visibility and
7785 override_visibility.
7786 * testsuite/ver_test_1.sh: New file.
7787 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7788 (check_DATA): Add ver_test_1.syms.
7789 (ver_test_1.syms): New target.
7790 * testsuite/Makefile.in: Rebuild.
7792 2009-02-25 Cary Coutant <ccoutant@google.com>
7794 * layout.cc (Layout::choose_output_section): Don't rename sections
7795 when using a linker script that has a SECTIONS clause.
7796 * Makefile.in: Regenerate.
7798 * testsuite/Makefile.am (script_test_5.sh): New test case.
7799 * testsuite/Makefile.in: Regenerate.
7800 * testsuite/script_test_5.cc: New file.
7801 * testsuite/script_test_5.sh: New file.
7802 * testsuite/script_test_5.t: New file.
7804 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
7806 * archive.cc (Archive::include_member): Update calls to add_symbols.
7807 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7808 the Layout argument.
7809 * dynobj.h (do_add_symbols): Add the Layout argument.
7810 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7812 * object.h (Object::add_symbols): Add the Layout argument.
7813 (Object::do_add_symbols): Add the Layout argument.
7814 (Sized_relobj::do_add_symbols): Add the Layout argument.
7815 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7816 Unify the two versions.
7817 (Add_plugin_symbols): Remove.
7818 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7819 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7820 (Add_plugin_symbols): Remove.
7821 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7822 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7823 (Add_symbols::run): Make it work with Pulginobj.
7825 2009-02-06 Ian Lance Taylor <iant@google.com>
7827 * object.cc (Sized_relobj::do_layout): Make info message start
7828 with lower case letter.
7830 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
7832 * binary.cc: Fix file comment.
7834 * options.h (enum Incremental_disposition): Define.
7835 (class General_options): Add new options: --incremental,
7836 --incremental_changed, --incremental_unchanged,
7837 --incremental_unknown. Add incremental_disposition_ and
7838 implicit_incremental_ fields.
7839 (General_options::incremental_disposition): New function.
7840 (class Position_dependent_options): Add incremental_disposition
7842 (Position_dependent_options::copy_from_options): Set incremental
7844 * options.cc (General_options::parse_incremental_changed): New
7846 (General_options::parse_incremental_unchanged): New function.
7847 (General_options::parse_incremental_unknown): New function.
7848 (General_options::General_options): Initialize new fields
7849 incremental_disposition_ and implicit_incremental_.
7850 (General_options::finalize): Check for uasge of --incremental-*
7851 without --incremental.
7853 2009-02-06 Chris Demetriou <cgd@google.com>
7855 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7856 pointer and to report location as the file name associated with
7858 (gold_undefined_symbol_at_location): New function to replace the
7859 old gold_undefined_symbol functionality.
7860 * target-reloc.h (relocate_section): Update to use
7861 gold_undefined_symbol_at_location.
7862 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7863 Call gold_undefined_symbol function rather than gold_error.
7864 * errors.h (Errors::undefined_symbol): Take location as a
7865 string, rather than calculating it from a relocation.
7866 * errors.cc (Errors::fatal): Print "fatal error:" before the
7868 (Errors::error, Errors::error_at_location): Print "error: "
7869 before the formatted message.
7870 (Errors::undefined_symbol): Take location as a string, rather
7871 than calculating it from a relocation.
7872 (gold_undefined_symbol_at_location): New function akin to
7873 old gold_undefined_symbol, calculates location from relocation.
7874 (gold_undefined_symbol): Change to take only a Symbol pointer
7875 and to report location as the file name associated with the symbol.
7876 * testsuite/debug_msg.sh: Update for changed error messages.
7877 * testsuite/undef_symbol.sh: Likewise.
7879 2009-02-04 Duncan Sands <baldrick@free.fr>
7882 * reduced_debug_output.h
7883 (Output_reduced_debug_abbrev_section::failed): Use format for
7885 (Output_reduced_debug_info_section::faild): Likewise.
7887 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
7889 * script.cc (Lazy_demangler): New class.
7890 (Version_script_info::get_symbol_version_helper): Demangle a
7893 2009-01-29 Cary Coutant <ccoutant@google.com>
7895 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7897 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7899 2009-01-28 Ian Lance Taylor <iant@google.com>
7901 * version.cc (version_string): Bump to 1.9.
7903 * gold.h: Include <cstring> and <stdint.h>.
7904 * version.cc: Include <cstdio>.
7905 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7907 * reduced_debug_output.cc (insert_into_vector): Rename from
7908 Insert_into_vector; change all callers. Use Swap_unaligned to
7909 avoid aliasing issue; remove union since it is unnecessary.
7911 2009-01-27 Sriraman Tallam <tmsriram@google.com>
7913 * Makefile.am (CCFILES): Add gc.cc.
7915 * Makefile.in: Regenerate.
7916 * gold.cc (Gc_runner): New class.
7917 (queue_initial_tasks): Call garbage collection related tasks
7918 when corresponding options are invoked.
7919 (queue_middle_gc_tasks): New function.
7920 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7921 processed early before laying out sections during garbage collection.
7922 * gold.h (queue_middle_gc_tasks): New function.
7923 (is_prefix_of): Move from "layout.cc".
7924 * i386.cc (Target_i386::gc_process_relocs): New function.
7925 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7926 * main.cc (main): Create object of class "Garbage_collection".
7927 * object.cc (Relobj::copy_symbols_data): New function.
7928 (Relobj::is_section_name_included): New function.
7929 (Sized_relobj::do_layout): Allow this function to be called twice
7930 during garbage collection and defer layout of section during the
7932 * object.h (Relobj::get_symbols_data): New function.
7933 (Relobj::is_section_name_included): New function.
7934 (Relobj::copy_symbols_data): New function.
7935 (Relobj::set_symbols_data): New function.
7936 (Relobj::get_relocs_data): New function.
7937 (Relobj::set_relocs_data): New function.
7938 (Relobj::is_output_section_offset_invalid): New pure virtual function.
7939 (Relobj::gc_process_relocs): New function.
7940 (Relobj::do_gc_process_relocs): New pure virtual function.
7941 (Relobj::sd_): New data member.
7942 (Sized_relobj::is_output_section_offset_invalid): New function.
7943 (Sized_relobj::do_gc_process_relocs): New function.
7944 * options.h (General_options::gc_sections): Modify to not be a no-op.
7945 (General_options::print_gc_sections): New option.
7946 * plugin.cc (Plugin_finish::run): Remove function call to
7947 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7948 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7949 * reloc.cc (Read_relocs::run): Add task to process relocs and
7950 determine unreferenced sections when doing garbage collection.
7951 (Gc_process_relocs): New class.
7952 (Sized_relobj::do_gc_process_relocs): New function.
7953 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7954 sections that are garbage collected.
7955 * reloc.h (Gc_process_relocs): New class.
7956 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7957 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7958 symbols whose corresponding sections are garbage collected.
7959 (Symbol_table::Symbol_table): Add new parameter for the garbage
7961 (Symbol_table::gc_mark_undef_symbols): New function.
7962 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7963 (Symbol_table::gc_mark_dyn_syms): New function.
7964 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7966 (Symbol_table::add_from_object): Likewise.
7967 (Symbol_table::add_from_relobj): When building shared objects, do not
7968 treat externally visible symbols as garbage.
7969 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7970 table information for static and relocatable links.
7971 * symtab.h (Symbol_table::set_gc): New function.
7972 (Symbol_table::gc): New function.
7973 (Symbol_table::gc_mark_undef_symbols): New function.
7974 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7975 (Symbol_table::gc_mark_dyn_syms): New function.
7976 (Symbol_table::gc_): New data member.
7977 * target.h (Sized_target::gc_process_relocs): New pure virtual
7979 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7980 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7982 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7984 * options.h (General_options::gc_sections): Define as a no-op for now.
7985 (General_options::no_keep_memory): Ditto.
7986 (General_options::Bshareable): Define.
7987 * options.cc (General_options::finalize): Honor -Bshareable.
7989 2009-01-20 Andreas Schwab <schwab@suse.de>
7991 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7992 read the value in the contents, since we don't use it. Use the
7993 template endianness when writing.
7994 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7996 2009-01-19 Andreas Schwab <schwab@suse.de>
7998 * configure.tgt (powerpc64-*): Fix targ_obj.
8000 2009-01-15 Ian Lance Taylor <iant@google.com>
8002 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8003 local symbols when stripping all symbols.
8005 2009-01-14 Cary Coutant <ccoutant@google.com>
8007 * output.cc (Output_reloc): Add explicit instantiations.
8009 2009-01-14 Cary Coutant <ccoutant@google.com>
8011 * archive.cc (Archive::get_elf_object_for_member): Remove call
8012 to File_read::claim_for_plugin.
8013 * descriptors.cc (Descriptors::open): Remove reference to
8015 (Descriptors::claim_for_plugin): Remove.
8016 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8017 (Descriptors::is_claimed): Remove.
8018 (claim_descriptor_for_plugin): Remove.
8019 * fileread.cc (File_read::claim_for_plugin): Remove.
8020 * fileread.h (File_read::claim_for_plugin): Remove.
8021 (File_read::descriptor): Reopen descriptor if necessary.
8022 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8023 (Plugin_manager::all_symbols_read): Add task parameter. Change
8025 (Plugin_manager::get_input_file): New function.
8026 (Plugin_manager::release_input_file): New function.
8027 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8028 corresponding data member.
8029 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8030 and pass to base constructor. Change all callers.
8031 (get_input_file, release_input_file): New functions.
8032 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8033 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8034 (Plugin_manager::all_symbols_read): Add task parameter.
8035 (Plugin_manager::get_input_file): New function.
8036 (Plugin_manager::release_input_file): New function.
8037 (Plugin_manager::task_): New data member.
8038 (Pluginobj::Pluginobj): Add filesize parameter.
8039 (Pluginobj::filename): New function.
8040 (Pluginobj::descriptor): New function.
8041 (Pluginobj::filesize): New function.
8042 (Pluginobj::filesize_): New data member.
8043 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8044 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8045 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8047 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8048 with archive libraries.
8049 * testsuite/Makefile.in: Regenerate.
8050 * testsuite/plugin_test.c (struct sym_info): New type.
8051 (get_input_file, release_input_file): New static variables.
8052 (onload): Capture new transfer vector entries.
8053 (claim_file_hook): Stop reading at end of file according to filesize.
8054 Factor out parsing of readelf output into separate function.
8055 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8056 APIs and get the source file name from the symbol table. Convert
8057 source file name to corresponding object file name. Print info
8058 message when adding new input files.
8059 (parse_readelf_line): New function.
8060 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8061 * testsuite/plugin_test_2.sh: Likewise.
8062 * testsuite/plugin_test_3.sh: Likewise.
8063 * testsuite/plugin_test_4.sh: New test case.
8065 2009-01-07 Ian Lance Taylor <iant@google.com>
8067 * version.cc (version_string): Bump to 1.8.
8069 2008-12-23 Cary Coutant <ccoutant@google.com>
8071 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8072 * plugin.cc (Plugin_manager::finish): Rename as
8073 layout_deferred_objects. Move cleanup to separate function.
8074 (Plugin_manager::cleanup): New function.
8075 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8077 * plugin.h (Plugin_manager::finish): Rename as
8078 layout_deferred_objects.
8079 (Plugin_manager::cleanup): New function.
8080 (Plugin_manager::cleanup_done): New field.
8082 2008-12-23 Cary Coutant <ccoutant@google.com>
8084 * plugin.cc (is_visible_from_outside): New function.
8085 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8086 so we don't return "IR only" status for exported symbols or -r links.
8088 * testsuite/Makefile.am (plugin_test_3): New test case.
8089 * testsuite/Makefile.in: Regenerate.
8090 * testsuite/plugin_test_3.sh: New file.
8092 2008-12-22 Cary Coutant <ccoutant@google.com>
8094 * object.cc (Sized_relobj::layout_section): New function.
8095 (Sized_relobj::do_layout): Defer layout of input sections until after
8096 plugin has provided replacement files.
8097 (Sized_relobj::do_layout_deferred_sections): New function.
8098 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8099 (Relobj::layout_deferred_sections): New function.
8100 (Relobj::do_layout_deferred_sections): New function.
8101 (Sized_relobj::do_layout_deferred_sections): New function.
8102 (Sized_relobj::layout_section): New function.
8103 (Sized_relobj::Deferred_layout): New structure.
8104 (Sized_relobj::deferred_layout_): New field.
8105 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8106 Change all callers. Layout deferred sections.
8107 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8109 (Plugin_hook::run): Move code from do_plugin_hook inline.
8110 (Plugin_hook::do_plugin_hook): Remove.
8111 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8112 (Plugin_manager::finish): Renamed, was cleanup.
8113 (Plugin_manager::should_defer_layout): New function.
8114 (Plugin_manager::add_deferred_layout_object): New function.
8115 (Plugin_manager::Deferred_layout_list): New type.
8116 (Plugin_manager::deferred_layout_objects_): New field.
8117 (Plugin_hook::do_plugin_hook): Remove.
8119 2008-12-17 Ian Lance Taylor <iant@google.com>
8121 * options.h (class General_options): Add --no case for
8124 2008-12-16 Cary Coutant <ccoutant@google.com>
8126 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8128 (Plugin_manager::claim_file): Create plugin object even if
8129 plugin did not call the add_symbols callback.
8130 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8131 asking for more symbols than were added.
8132 * testsuite/Makefile.am (plugin_test_1): Add test case with
8134 (empty.syms): New target.
8135 * testsuite/Makefile.in: Regenerate.
8136 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8137 message. Don't call add_symbols if no globals.
8138 (all_symbols_read_hook): Don't provide replacement for empty
8141 2008-12-12 Ian Lance Taylor <iant@google.com>
8143 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8144 r_type == 0 for a local symbol with r_sym == 0.
8145 (scan_relocatable_relocs): Pass r_sym to
8146 local_non_section_strategy.
8147 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8150 * configure.ac: Update test for TLS descriptors: they are
8151 supported as of glibc 2.9.
8152 * configure: Rebuild.
8154 2008-12-11 Ian Lance Taylor <iant@google.com>
8157 * target-reloc.h (Default_scan_relocatable_relocs): For each
8158 function, map r_type == 0 to RELOC_DISCARD.
8160 2008-12-10 Cary Coutant <ccoutant@google.com>
8162 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8163 object to override a kept COMDAT group from a plugin object.
8165 2008-12-09 Ian Lance Taylor <iant@google.com>
8168 * yyscript.y (file_cmd): Handle INPUT.
8170 * testsuite/initpri1.c: Change all declarations to be full
8171 prototypes by adding void, to avoid compiler warnings.
8173 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8175 * options.cc (General_options::parse_plugin_opt): New.
8176 (General_options::add_plugin): The argument now is just the filename.
8177 (General_options::add_plugin_option): New.
8178 * options.h (plugin_opt): New.
8179 (add_plugin): Change argument name.
8180 (add_plugin_option): New.
8181 * plugin.cc (Plugin::load): Don't parse the plugin option.
8182 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8183 (Plugin::add_option): New.
8184 (Plugin::args_): Change type.
8185 (Plugin::filename_): New.
8186 (Plugin_manager::add_plugin_option): New.
8187 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8188 * testsuite/Makefile.in: Regenerate.
8190 2008-12-05 Cary Coutant <ccoutant@google.com>
8192 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8193 Handle --strip-lto-sections option.
8194 * options.h (strip_lto_sections): New option.
8196 2008-12-01 Cary Coutant <ccoutant@google.com>
8198 * plugin.cc (ld_plugin_message): Change format parameter to const.
8199 Fix mismatch between new[] and delete.
8201 2008-11-14 Cary Coutant <ccoutant@google.com>
8203 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8206 2008-11-05 Craig Silverstein <csilvers@google.com>
8208 * options.cc (General_options::parse_dynamic_list): New function.
8209 * options.h (General_options): New flags dynamic_list,
8210 dynamic_list_data, dynamic_list_cpp_new, and
8211 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8212 (General_options::in_dynamic_list): New function.
8213 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8214 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8215 (Lex::can_continue_name): Likewise.
8217 (read_script_file): New parameter script_options.
8218 (read_dynamic_list): New function.
8219 (Script_options::define_dynamic_list): New function.
8220 (dynamic_list_keyword_parsecodes): New variable.
8221 (dynamic_list_keywords): New variable.
8222 * script.h (Script_options::define_dynamic_list): New function
8224 (read_dynamic_list): New function prototype.
8225 * symtab.cc (strprefix): New macro.
8226 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8227 dynamic_list_data, dynamic_list_cpp_new, and
8228 dynamic_list_cpp_typeinfo.
8229 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8230 (dynamic_list_expr): New rule.
8231 (dynamic_list_nodes): Likewise.
8232 (dynamic_list_node): Likewise.
8233 * testsuite/Makefile.am (dynamic_list): New test.
8234 * testsuite/Makefile.in: Regenerated.
8235 * testsuite/dynamic_list.t: New file.
8236 * testsuite/dynamic_list.sh: New file.
8238 2008-11-05 Craig Silverstein <csilvers@google.com>
8240 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8241 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8242 (t11_last): Likewise.
8243 * testsuite/ver_test_6.c (main): Likewise.
8245 2008-10-07 Cary Coutant <ccoutant@google.com>
8247 * options.c (General_options::finalize): Add check for -static and
8249 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8252 2008-10-02 Cary Coutant <ccoutant@google.com>
8254 * plugin.cc (make_sized_plugin_object): Fix conditional
8255 compilation to work when not all targets are enabled.
8257 2008-09-29 Cary Coutant <ccoutant@google.com>
8259 * archive.cc (Archive::get_file_and_offset): Use filename instead
8260 of name to get library path.
8261 (Archive::include_member): Unlock external member of a thin archive.
8263 * testsuite/Makefile.am (TEST_AR): New variable.
8264 (thin_archive_test_1): New test.
8265 (thin_archive_test_2): New test.
8266 * testsuite/Makefile.in: Regenerate.
8267 * testsuite/thin_archive_main.cc: New file.
8268 * testsuite/thin_archive_test_1.cc: New file.
8269 * testsuite/thin_archive_test_2.cc: New file.
8270 * testsuite/thin_archive_test_3.cc: New file.
8271 * testsuite/thin_archive_test_4.cc: New file.
8273 2008-09-29 Cary Coutant <ccoutant@google.com>
8275 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8276 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8278 (Sized_relobj::do_finalize_local_symbols): Likewise.
8279 (Sized_relobj::map_to_kept_section): Likewise.
8280 * object.h (Sized_relobj::invalid_address): New constant.
8281 (Sized_relobj::do_output_section_offset): Check for invalid_address
8283 * output.cc (Output_reloc::local_section_offset): Use constant
8284 invalid_address instead of -1U.
8285 (Output_reloc::get_address): Likewise.
8286 (Output_section::output_address): Change -1U to -1ULL.
8287 * output.h (Output_reloc::invalid_address): New constant.
8288 * reloc.cc (Sized_relobj::write_sections): Use constant
8289 invalid_address instead of -1U.
8290 (Sized_relobj::relocate_sections): Likewise.
8291 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8292 values for merge sections.
8293 * target-reloc.h (relocate_for_relocatable): Use constant
8294 invalid_address instead of -1U.
8296 2008-09-19 Cary Coutant <ccoutant@google.com>
8298 Add plugin functionality for link-time optimization (LTO).
8299 * configure.ac (plugins): Add --enable-plugins option.
8300 * configure: Regenerate.
8301 * config.in: Regenerate.
8302 * Makefile.am (LIBDL): New variable.
8303 (CCFILES): Add plugin.cc.
8304 (HFILES): Add plugin.h.
8305 (ldadd_var): Add LIBDL.
8306 * Makefile.in: Regenerate.
8308 * archive.cc: Include "plugin.h".
8309 (Archive::setup): Don't preread archive symbols when using a plugin.
8310 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8311 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8313 (Archive::include_member): Add symbols from plugin objects.
8314 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8315 * descriptors.cc (Descriptors::open): Check for file descriptors
8316 abandoned by plugins.
8317 (Descriptors::claim_for_plugin): New function.
8318 * descriptors.h (Descriptors::claim_for_plugin): New function.
8319 (Open_descriptor::is_claimed): New field.
8320 (claim_descriptor_for_plugin): New function.
8321 * fileread.cc (File_read::claim_for_plugin): New function.
8322 * fileread.h (File_read::claim_for_plugin): New function.
8323 (File_read::descriptor): New function.
8324 * gold.cc: Include "plugin.h".
8325 (queue_initial_tasks): Add task to call plugin hooks for generating
8327 * main.cc: Include "plugin.h".
8328 (main): Load plugin libraries.
8329 * object.h (Pluginobj): Declare.
8330 (Object::pluginobj): New function.
8331 (Object::do_pluginobj): New function.
8332 (Object::set_target): New function.
8333 * options.cc: Include "plugin.h".
8334 (General_options::parse_plugin): New function.
8335 (General_options::General_options): Initialize plugins_ field.
8336 (General_options::add_plugin): New function.
8337 * options.h (Plugin_manager): Declare.
8338 (General_options): Add --plugin option.
8339 (General_options::has_plugins): New function.
8340 (General_options::plugins): New function.
8341 (General_options::add_plugin): New function.
8342 (General_options::plugins_): New field.
8343 * plugin.cc: New file.
8344 * plugin.h: New file.
8345 * readsyms.cc: Include "plugin.h".
8346 (Read_symbols::do_read_symbols): Check for archive before checking
8347 for ELF file. Call plugin hooks to claim files.
8348 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8349 from a real object file; force override when processing replacement
8351 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8352 (Symbol::init_base_object): Likewise.
8353 (Symbol::init_base_output_data): Likewise.
8354 (Symbol::init_base_output_segment): Likewise.
8355 (Symbol::init_base_constant): Likewise.
8356 (Symbol::init_base_undefined): Likewise.
8357 (Symbol::output_section): Assert that object is not a plugin.
8358 (Symbol_table::add_from_pluginobj): New function.
8359 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8361 (Symbol_table::sized_write_globals): Likewise.
8362 (Symbol_table::add_from_pluginobj): Instantiate template.
8363 * symtab.h (Sized_pluginobj): Declare.
8364 (Symbol::in_real_elf): New function.
8365 (Symbol::set_in_real_elf): New function.
8366 (Symbol::in_real_elf_): New field.
8367 (Symbol_table::add_from_pluginobj): New function.
8369 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8370 (LIBDL): New variable.
8372 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8373 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8374 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8375 (MOSTLYCLEANFILES): Likewise.
8376 * testsuite/Makefile.in: Regenerate.
8377 * testsuite/plugin_test.c: New file.
8378 * testsuite/plugin_test_1.sh: New file.
8379 * testsuite/plugin_test_2.sh: New file.
8381 2008-09-16 Ian Lance Taylor <iant@google.com>
8383 * target-reloc.h (relocate_section): Check whether a symbol is
8384 defined by the ABI before reporting an undefined symbol error.
8385 * target.h (Target::is_defined_by_abi): Make parameter const.
8386 (Target::do_is_defined_by_abi): Likewise.
8387 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8388 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8389 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8390 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8391 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8392 * testsuite/Makefile.in: Rebuild.
8394 * fileread.cc (make_view): Add casts to avoid warning.
8396 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8398 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8399 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8401 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8403 * options.h (General_options::output_is_executable): New.
8404 (General_options::output_is_pie): New.
8405 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8406 for shared libraries.
8407 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8409 2008-09-11 Chris Demetriou <cgd@google.com>
8411 * options.h (origin): New -z option.
8412 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8413 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8416 2008-09-05 Cary Coutant <ccoutant@google.com>
8418 * fileread.cc (File_read::make_view): Add check for attempt to map
8421 2008-09-05 Cary Coutant <ccoutant@google.com>
8423 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8424 explicit instantiations.
8426 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8429 * options.cc (General_options::finalize): Allow undefined symbols
8430 in shlibs if linking -shared.
8433 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8434 symbols as not needing a dynsym entry.
8436 2008-08-20 Craig Silverstein <csilvers@google.com>
8438 * fileread.cc (File_read::open): Do not lock the file unless it
8439 was successfully opened.
8441 2008-08-14 Cary Coutant <ccoutant@google.com>
8443 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8444 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8445 * testsuite/tls_test.cc (struct int128): 128-bit struct
8446 for testing TLS relocs with non-zero addend.
8447 (v12): New TLS variable.
8449 (t_last): Add check for v12.
8450 * testsuite/tls_test.h (t12): New function.
8451 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8453 2008-08-13 Ian Lance Taylor <iant@google.com>
8455 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8456 set tls_segment_ or relro_segment_.
8457 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8459 * output.h (Output_section::clear_is_relro): New function.
8460 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8461 sections specially even when output_data_ is empty.
8462 (Output_segment::maximum_alignment): When first section is relro,
8463 only force alignment for PT_LOAD segments.
8464 * script.cc (script_data_segment_align): New function.
8465 (script_data_segment_relro_end): New function.
8466 * script-c.h (script_data_segment_align): Declare.
8467 (script_data_segment_relro_end): Declare.
8468 * script-sections.h (class Script_sections): Declare
8469 data_segment_align and data_segment_relro_end. Add fields
8470 segment_align_index_ and saw_relro_end_.
8471 * script-sections.cc (class Sections_element): Add set_is_relro
8472 virtual function. Add new bool* parameter to place_orphan_here.
8473 Add get_output_section virtual function.
8474 (class Output_section_definition): Add set_is_relro. Add new
8475 bool* parameter to place_orphan_here. Add get_output_section.
8476 Add is_relro_ field.
8477 (Output_section_definition::Output_section_definition): Initialize
8478 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8479 and is_relro_ fields.
8480 (Output_section_definition::place_orphan_here): Add is_relro
8482 (Output_section_definition::set_section_addresses): Set relro for
8484 (Output_section_definition::alternate_constraint): Likewise.
8485 (class Orphan_output_section): Add new bool* parameter to
8486 place_orphan_here. Add get_output_section.
8487 (Orphan_output_section::place_orphan_here): Add is_relro
8489 (Script_sections::Script_sections): Initialize
8490 data_segment_align_index_ and saw_relro_end_.
8491 (Script_sections::data_segment_align): New function.
8492 (Script_sections::data_segment_relro_end): New function.
8493 (Script_sections::place_orphan): Set or clear is_relro.
8494 (Script_sections::set_section_addresses): Force alignment of first
8496 * yyscript.y (exp): Call script_data_segment_align and
8497 script_data_segment_relro_end.
8498 * testsuite/relro_script_test.t: New file.
8499 * testsuite/relro_test.cc (using_script): Declare.
8500 (t1, t2): Test using_script.
8501 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8502 (relro_script_test_SOURCES): Define.
8503 (relro_script_test_DEPENDENCIES): Define.
8504 (relro_script_test_LDFLAGS): Define.
8505 (relro_script_test_LDADD): Define.
8506 (relro_script_test.so): New target.
8507 * testsuite/Makefile.in: Rebuild.
8509 2008-08-06 Cary Coutant <ccoutant@google.com>
8511 * archive.cc (Archive::total_archives, Archive::total_members)
8512 (Archive::total_members_loaded): New variables.
8513 (Archive::setup): Add parameter. Add option to preread
8515 (Archive::read_armap): Add counter.
8516 (Archive::get_file_and_offset): New function.
8517 (Archive::get_elf_object_for_member): New function.
8518 (Archive::read_all_symbols): New function.
8519 (Archive::read_symbols): New function.
8520 (Archive::add_symbols): Add counters.
8521 (Archive::include_all_members): Use armap to find members if it's
8523 (Archive::include_member): Skip reading symbols if already read.
8524 Factored code into Archive::get_file_and_offset and
8525 Archive::get_elf_object_for_member. Changed call to
8526 Mapfile::report_include_archive_member.
8527 (Archive::print_stats): New function.
8528 * archive.h: Declare Object and Read_symbols_data classes.
8529 (Archive::Archive): Add initializers for new members.
8530 (Archive::setup): Add parameter.
8531 (Archive::print_stats): New function.
8532 (Archive::total_archives, Archive::total_members)
8533 (Archive::total_members_loaded): New variables.
8534 (Archive::get_file_and_offset): New function.
8535 (Archive::get_elf_object_for_member): New function.
8536 (Archive::read_all_symbols): New function.
8537 (Archive::read_symbols): New function.
8538 (Archive::Archive_member): New class.
8539 (Archive::members_): New member.
8540 (Archive::num_members_): New member.
8541 * main.cc: Include archive.h.
8542 (main): Call Archive::print_stats.
8543 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8544 archive parameter; member_name is now the fully-decorated name.
8545 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8546 * options.h: (General_options): Add --preread-archive-symbols option.
8547 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8550 2008-08-04 Ian Lance Taylor <iant@google.com>
8552 * symtab.h (Symbol::use_plt_offset): New function.
8553 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8554 * powerpc.cc (Relocate::relocate): Likewise.
8555 * sparc.cc (Relocate::relocate): Likewise.
8556 * x86_64.cc (Relocate::relocate): Likewise.
8557 * testsuite/weak_plt.sh: New test.
8558 * testsuite/weak_plt_main.cc: New test.
8559 * testsuite/weak_plt_shared.cc: New test.
8560 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8561 (check_PROGRAMS): Add weak_plt.
8562 (check_DATA): Add weak_plt_shared.so.
8563 (weak_plt_main_pic.o, weak_plt): New targets.
8564 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8565 * testsuite/Makefile.in: Rebuild.
8567 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8569 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8570 * testsuite/Makefile.in: Rebuild.
8572 2008-08-04 Alan Modra <amodra@bigpond.net.au>
8574 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8575 * Makefile.in: Regenerate.
8576 * po/POTFILES.in: Regenerate.
8578 2008-07-29 Ian Lance Taylor <iant@google.com>
8580 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8581 symbols before other symbols.
8582 * testsuite/script_test_2.cc (test_addr): Declare.
8583 (test_addr_alias): Declare.
8584 (main): Check that test_addr and test_addr_alias have the right
8586 * testsuite/script_test_2.t: Define test_addr_alias and
8589 2008-07-24 Ian Lance Taylor <iant@google.com>
8592 * descriptors.cc: New file.
8593 * descriptors.h: New file.
8594 * gold-threads.h (class Hold_optional_lock): New class.
8595 * fileread.cc: Include "descriptors.h".
8596 (File_read::~File_read): Release descriptor rather than closing
8598 (File_read::open) [file]: Call open_descriptor rather than open.
8599 Set is_descriptor_opened_.
8600 (File_read::open) [memory]: Assert that descriptor is not open.
8601 (File_read::reopen_descriptor): New function.
8602 (File_read::release): Release descriptor.
8603 (File_read::do_read): Make non-const. Reopen descriptor.
8604 (File_read::read): Make non-const.
8605 (File_read::make_view): Reopen descriptor.
8606 (File_read::do_readv): Likewise.
8607 * fileread.h (class File_read): Add is_descriptor_opened_ field.
8608 Update declarations.
8609 * layout.cc: Include "descriptors.h".
8610 (Layout::create_build_id): Use open_descriptor rather than open.
8611 * output.cc: Include "descriptors.h".
8612 (Output_file::open): Use open_descriptor rather than open.
8613 * archive.cc (Archive::const_iterator): Change Archive to be
8615 (Archive::begin, Archive::end): Make non-const.
8616 (Archive::count_members): Likewise.
8617 * archive.h (class Archive): Update declarations.
8618 * object.h (Object::read): Make non-const.
8619 * Makefile.am (CCFILES): Add descriptors.cc.
8620 (HFILES): Add descriptors.h.
8621 * Makefile.in: Rebuild.
8624 * gold.h: Always include <clocale>. Add Solaris workarounds
8625 following code in binutils/sysdep.h.
8628 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8629 this->eh_frame_hdr_ is NULL before using it.
8631 * dynobj.cc (Versions::Versions): Update comment.
8633 * dynobj.cc (Versions::Versions): If there is an soname, use it as
8634 the base version name.
8636 * stringpool.cc (Stringpool_template::add_with_length): Set key to
8637 array size plus one.
8638 (Stringpool_template::set_string_offsets): Subtract one from key
8639 before using it as an array index.
8640 (Stringpool_template::get_offset_with_length): Likewise.
8641 (Stringpool_template::write_to_buffer): Likewise.
8642 * stringpool.h (Stringpool_template::get_offset_from_key):
8645 2008-07-23 Ian Lance Taylor <iant@google.com>
8648 * object.h (Merged_symbol_value::value): Do our best to handle a
8652 * script.cc (Version_script_info::get_versions): Don't add empty
8653 version tag to return value.
8654 (Version_script_info::get_symbol_version_helper): Change return
8655 type to bool. Add pversion parameter. Change all callers.
8656 (script_register_vers_node): Don't require a non-NULL tag.
8657 * script.h (class Version_script_info): Update declarations.
8658 (Version_script_info::get_symbol_version): Change return type to
8659 bool. Add version parameter. Change all callers.
8660 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8661 handling. Handle an empty version from a version script.
8662 (Symbol_table::define_special_symbol): Likewise.
8663 * testsuite/ver_test_10.script: New file.
8664 * testsuite/ver_test_10.sh: New file.
8665 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8666 (check_DATA): Add ver_test_10.syms.
8667 (ver_test_10.syms, ver_test_10.so): New target.
8668 * testsuite/Makefile.in: Rebuild.
8670 2008-07-23 Simon Baldwin <simonb@google.com>
8672 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8673 to zero for undefined symbols from dynamic libraries.
8675 2008-07-23 Ian Lance Taylor <iant@google.com>
8677 * symtab.cc (Symbol_table::resolve): Remove version parameter.
8679 * symtab.h (class Symbol_table): Update declaration.
8680 * testsuite/ver_test_9.cc: New file.
8681 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8682 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8683 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8684 (ver_test_9.so, ver_test_9.o): New targets.
8685 * testsuite/Makefile.in: Rebuild.
8687 2008-07-22 Ian Lance Taylor <iant@google.com>
8689 * options.h (class General_options): Define --check-sections.
8690 * layout.cc (Layout::set_segment_offsets): Handle
8693 * options.h (class General_options): Define -n/--nmagic and
8695 * options.cc (General_options::finalize): For -n/--nmagic or
8696 -N/--omagic, set -static.
8697 * layout.cc (Layout::attach_allocated_section_to_segment): If
8698 -N/--omagic, don't put read-only and read-write sections in
8700 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8701 finding a read-only segment.
8702 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8703 don't set the minimum segment alignment to the common page size,
8704 and don't set the file offset to the address modulo the page size.
8705 * script-sections.cc (Script_sections::create_segments): If
8706 -n/--omagic, don't put read-only and read-write sections in
8709 * cref.cc: New file.
8711 * options.h (class General_options): Add --print-symbol-counts.
8712 * main.cc (main): Issue defined symbol report if requested.
8713 * archive.cc (Archive::interpret_header): Make into a const member
8715 (Archive::add_symbols): Call Input_objects::archive_start and
8717 (Archive::const_iterator): Define new class.
8718 (Archive::begin, Archive::end): New functions.
8719 (Archive::include_all_members): Rewrite to use iterator.
8720 (Archive::count_members): New function.
8721 * archive.h (class Archive): Update declarations.
8722 (Archive::filename): New function.
8723 * object.cc: Include "cref.h".
8724 (Sized_relobj::Sized_relobj): Initialize defined_count_.
8725 (Sized_relobj::do_get_global_symbol_counts): New function.
8726 (Input_objects::add_object): Add object to cross-referencer.
8727 (Input_objects::archive_start): New function.
8728 (Input_objects::archive_stop): New function.
8729 (Input_objects::print_symbol_counts): New function.
8730 * object.h: Declare Cref and Archive.
8731 (Object::get_global_symbol_counts): New function.
8732 (Object::do_get_global_symbol_counts): New pure virtual function.
8733 (class Sized_relobj): Add defined_count_ field. Update
8735 (class Input_objects): Add cref_ field. Update constructor.
8736 Update declarations.
8737 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8739 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8741 (Sized_dynobj::do_get_global_symbol_counts): New function.
8742 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8743 defined_count_. Update declarations. Define Symbols typedef.
8744 * symtab.cc (Symbol_table::add_from_relobj): Add defined
8745 parameter. Change all callers.
8746 (Symbol_table::add_from_dynobj): Add sympointers and defined
8747 parameters. Change all callers.
8748 * symtab.h (class Symbol_table): Update declarations.
8749 * Makefile.am (CCFILES): Add cref.cc.
8750 (HFILES): Add cref.h.
8751 * Makefile.in: Rebuild.
8753 2008-07-22 Simon Baldwin <simonb@google.com>
8755 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8756 to zero when writing undefined symbols.
8758 2008-07-22 Ian Lance Taylor <iant@google.com>
8760 * output.cc (Output_section::add_input_section): Don't try to
8761 merge empty merge sections.
8763 2008-07-21 Craig Silverstein <csilvers@google.com>
8765 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8766 Include symbol version in error message.
8768 2008-07-20 Chris Demetriou <cgd@google.com>
8770 * configure.ac (gold_cv_c_random_seed): New configured variable.
8771 (RANDOM_SEED_CFLAGS): New substituted variable.
8772 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8773 * configure: Rebuild.
8774 * Makefile.in: Likewise.
8775 * testsuite/Makefile.in: Likewise.
8777 2008-07-18 Ian Lance Taylor <iant@google.com>
8779 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8780 where we see NAME/NULL and NAME/VERSION as separate symbols.
8781 * testsuite/ver_test_main.cc (main): Call t4.
8782 (t4, t4_2a): Define.
8783 * testsuite/ver_test_2.cc (t4_2): Define.
8784 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8785 * testsuite/ver_test_4.cc (t4_2a): Define.
8786 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8787 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8789 2008-07-17 Ian Lance Taylor <iant@google.com>
8791 * dynobj.cc (Versions::add_def): If we give an error about a
8792 missing version, go ahead and create the version anyhow.
8794 2008-07-10 Ian Lance Taylor <iant@google.com>
8796 Handle output sections with more than 0x7fffffff bytes.
8797 * object.h (class Relobj): Change map_to_output_ to
8798 output_sections_, and just keep a section pointer. Change all
8799 uses. Move comdat group support to Sized_relobj.
8800 (Relobj::is_section_specially_mapped): Remove.
8801 (Relobj::output_section): Remove poff parameter. Change all
8803 (Relobj::output_section_offset): New function.
8804 (Relobj::set_section_offset): Rewrite.
8805 (Relobj::map_to_output): Remove.
8806 (Relobj::output_sections): New function.
8807 (Relobj::do_output_section_offset): New pure virtual function.
8808 (Relobj::do_set_section_offset): Likewise.
8809 (class Sized_relobj): Add section_offsets_ field. Add comdat
8810 group support from Relobj. Update declarations.
8811 (Sized_relobj::get_output_section_offset): New function.
8812 (Sized_relobj::do_output_section_offset): New function.
8813 (Sized_relobj::do_set_section_offset): New function.
8814 * object.cc (Relobj::output_section_address): Remove.
8815 (Sized_relobj::Sized_relobj): Initialize new fields.
8816 (Sized_relobj::include_section_group): Cast find_kept_object to
8818 (Sized_relobj::include_linkonce_section): Likewise.
8819 (Sized_relobj::do_layout): Use separate arrays for output section
8821 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8823 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8824 output_sections and section_offsets.
8825 (Sized_relobj::write_local_symbols): Likewise.
8826 (map_to_kept_section): Compute output address directly.
8827 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8828 output_sections and section_offsets.
8829 (Sized_relobj::write_sections): Likewise.
8830 (Sized_relobj::relocate_sections): Likewise.
8831 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8832 * output.h (class Output_reloc): Update declarations. Change
8833 u2_.relobj to Sized_relobj*.
8834 (class Output_data_reloc): Change add functions to use
8836 * output.cc (Output_reloc::Output_reloc): Change relobj to
8838 (Output_reloc::local_section_offset): Change return type to
8839 Elf_Addr. Use get_output_section_offset.
8840 (Output_reloc::get_address): Likewise.
8841 (Output_section::is_input_address_mapped): Don't call
8842 is_section_specially_mapped.
8843 (Output_section::output_offset): Likewise.
8844 (Output_section::output_address): Likewise.
8845 (Output_section::starting_output_address): Likewise.
8846 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8847 parameter to Sized_relobj*.
8848 (Copy_relocs::need_copy_reloc): Likewise.
8849 (Copy_relocs::save): Likewise.
8850 * copy-relocs.h (class Copy_relocs): Update declarations.
8851 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8852 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8853 * target-reloc.h (relocate_for_relocatable): Change
8854 offset_in_output_section type to Elf_Addr. Change code that uses
8856 * layout.cc (Layout::layout): Always set *off.
8857 * mapfile.cc (Mapfile::print_input_section): Use
8858 output_section_offset.
8859 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8861 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8862 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8863 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8865 2008-07-03 Ian Lance Taylor <iant@google.com>
8867 * layout.cc (Layout::include_section): Do not discard unrecognized
8868 SHT_STRTAB sections.
8870 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
8872 * script.cc (Lex::can_continue_name): Make '?' allowable in
8873 version-script names.
8874 * testsuite/version_script.map: Change glob pattern to use '?'
8876 2008-06-30 Manish Singh <yosh@gimp.org>
8879 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8882 2008-06-30 Ian Lance Taylor <iant@google.com>
8886 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8887 versions]: Don't try to read the value in the contents, since we
8888 don't use it. Use the template endianness when writing.
8890 2008-06-25 Cary Coutant <ccoutant@google.com>
8892 * fileread.cc (File_read::make_view): Assert on zero-length view.
8893 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8894 symbol table when there are no symbols to read.
8896 2008-06-23 Craig Silverstein <csilvers@google.com>
8898 * version.cc (version_string): Bump to 1.7
8900 2008-06-18 Craig Silverstein <csilvers@google.com>
8902 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8903 constant 0xFFFF to type Valtype.
8904 (Powerpc_relocate_functions::rel16_ha): Likewise.
8906 2008-06-17 Ian Lance Taylor <iant@google.com>
8908 * output.h (Output_section::Input_section): Initialize p2align_ to
8909 zero for Output_section_data constructors.
8910 (Output_section::Input_section::addralign): If not an input
8911 section, return the alignment of the Output_section_data.
8912 * testsuite/copy_test.cc: New file.
8913 * testsuite/copy_test_1.cc: New file.
8914 * testsuite/copy_test_2.cc: New file.
8915 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8916 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8917 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8918 (copy_test_1_pic.o, copy_test_1.so): New targets.
8919 (copy_test_2_pic.o, copy_test_2.so): New targets.
8920 * testsuite/Makefile.in: Rebuild.
8922 * script-sections.cc (Script_sections::place_orphan): Initialize
8923 local variable exact.
8925 2008-06-13 David Edelsohn <edelsohn@gnu.org>
8927 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8929 2008-06-12 David Edelsohn <edelsohn@gnu.org>
8930 David S. Miller <davem@davemloft.net>
8932 * powerpc.cc: New file.
8933 * Makefile.am (TARGETSOURCES): Add powerpc.cc
8934 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8935 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8936 * Makefile.in: Rebuild.
8938 2008-06-09 Ian Lance Taylor <iant@google.com>
8940 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8942 (throwing, orig_terminate): New static variables.
8943 (terminate_handler): New static function.
8944 (t2): Set terminate handler.
8946 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
8949 * binary.cc (Binary_to_elf::sized_convert): Fix .data
8952 2008-05-30 Cary Coutant <ccoutant@google.com>
8954 * archive.cc (Archive::include_all_members) Correct to step
8955 over symbol table and extended name table in thin archives.
8957 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8960 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8963 2008-05-28 Caleb Howe <cshowe@google.com>
8965 * reduced_debug_output.cc: New file.
8966 * reduced_debug_output.h: New file.
8967 * options.h (class General_options): Add --strip-debug-non-line.
8968 * options.cc (General_options::finalize): Add strip_debug_non_line
8969 to the strip heirarchy.
8970 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8972 * layout.cc: Include "reduced_debug_output.h".
8973 (Layout::Layout): Initialize new fields.
8974 (line_only_debug_sections): New static array.
8975 (is_lines_only_debug_sections): New static inline function.
8976 (Layout::include_section): Handle --strip-debug-non-line.
8977 (Layout::make_output_section): If --strip-debug-non-line, build
8978 new output sections for .debug_abbrev and .debug_info.
8979 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8980 gold. Warn about possible overflow.
8981 (read_signed_LEB_128): Likewise.
8982 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8983 (read_signed_LEB_128): Declare.
8984 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8985 (HFILES): Add reduced_debug_output.h.
8986 * Makefile.in: Rebuild.
8988 2008-05-21 Ian Lance Taylor <iant@google.com>
8990 * mapfile.cc: New file.
8991 * mapfile.h: New file.
8992 * options.h (class General_options): Add -M/--print-map and -Map.
8993 * options.cc (General_options::finalize): Make -M equivalent to
8995 * main.cc: Include <cstdio> and "mapfile.h".
8996 (main): Open mapfile if requested.
8997 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8998 constructor. Change caller.
8999 (queue_initial_tasks): Add mapfile parameter. Change caller.
9000 (queue_middle_tasks): Likewise.
9001 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9003 * archive.cc: Include "mapfile.h".
9004 (Archive::add_symbols): Add mapfile parameter. Change all
9005 callers. Pass mapfile, symbol, and reason to include_member.
9006 (Archive::include_all_members): Add mapfile parameter. Change all
9008 (Archive::include_member): Add mapfile, sym, and why parameters.
9009 Change all callers. Report inclusion to map file.
9010 * archive.h: Include "fileread.h".
9011 (class Archive): Update declarations.
9012 (Archive::file): New const method.
9013 (class Add_archive_symbols): Add mapfile_ field. Update
9014 constructor. Change all callers.
9015 * readsyms.h (class Read_symbols): Likewise.
9016 (class Finish_group): Likewise.
9017 (class Read_script): Likewise.
9018 * common.cc: Include "mapfile.h".
9019 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9021 (Symbol_table::do_allocate_commons): Likewise.
9022 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9023 symbol allocation to mapfile.
9024 * common.h (class Allocate_commons_task): Add mapfile_ field.
9025 Update constructor. Change all callers.
9026 * symtab.h (class Symbol_table): Update declarations.
9027 * layout.cc: Include "mapfile.h".
9028 (Layout_task_runner::run): Print information to mapfile.
9029 (Layout::create_gold_note): Change Output_data_fixed_space to
9030 Output_data_zero_fill.
9031 (Layout::create_build_id): Likewise.
9032 (Layout::print_to_mapfile): New function.
9033 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9034 constructor. Change caller.
9035 (class Layout): Declare print_to_mapfile.
9036 * output.cc (Output_section::Input_section::print_to_mapfile): New
9038 (Output_section::add_input_section): If producing a map, always
9039 add to input_sections_ list.
9040 (Output_section::do_print_to_mapfile): New function.
9041 (Output_segment::print_sections_to_mapfile): New function.
9042 (Output_segment::print_section_list_to_mapfile): New function.
9043 * output.h: Include "mapfile.h".
9044 (Output_data::print_to_mapfile): New function.
9045 (Output_data::do_print_to_mapfile): New virtual function.
9046 (Output_segment_headers::do_print_to_mapfile): New function.
9047 (Output_file_header::do_print_to_mapfile): New function.
9048 (Output_data_const::do_print_to_mapfile): New function.
9049 (class Output_data_const_buffer): Add map_name_ field. Update
9050 constructor. Change all callers. Add do_print_to_mapfile
9052 (class Output_data_fixed_space): Likewise.
9053 (class Output_data_space): Likewise.
9054 (class Output_data_zero_fill): New class.
9055 (Output_data_strtab::do_print_to_mapfile): New function.
9056 (Output_data_reloc_base::do_print_to_mapfile): New function.
9057 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9058 (Output_data_group::do_print_to_mapfile): New function.
9059 (Output_data_got::do_print_to_mapfile): New function.
9060 (Output_data_dynamic::do_print_to_mapfile): New function.
9061 (Output_symtab_xindex::do_print_to_mapfile): New function.
9062 (class Output_section): Declare do_print_to_mapflie. Declare
9063 print_to_mapfile in Input_section.
9064 (class Output_segment): Declare new functions.
9065 * object.h (Sized_relobj::symbol_count): New function.
9066 * script-sections.cc
9067 (Output_section_element_dot_assignment::set_section_addresses):
9068 Change Output_data_fixed_space to Output_data_zero_fill.
9069 (Output_data_expression::do_print_to_mapfile): New function.
9070 * script.cc (read_input_script): Add mapfile parameter. Change
9072 * script.h (read_input_script): Update declaration.
9073 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9074 (Eh_frame::do_print_to_mapfile): New function.
9075 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9076 (Output_merge_string::do_print_to_mapfile): New function.
9077 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9079 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9081 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9083 * Makefile.am (CCFILES): Add mapfile.cc.
9084 (HFILES): Add mapfile.h.
9085 * Makefile.in: Rebuild.
9087 2008-05-19 Ian Lance Taylor <iant@google.com>
9089 * options.h (class General_options): Add -z relro.
9090 * layout.cc (Layout::Layout): Initialize relro_segment_.
9091 (Layout::add_output_section_data): Return the output section.
9092 (Layout::make_output_section): Rcognize relro sections and mark
9094 (Layout::attach_allocated_section_to_segment): Put relro sections
9095 in a PT_GNU_RELRO segment.
9096 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9098 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9100 (Layout::linkonce_mapping): Map d.rel.ro.local to
9102 (Layout::output_section_name): Us .data.rel.ro.local for any
9103 section which begins with that.
9104 * layout.h (class Layout): Update add_output_section_data
9105 declaration. Add relro_segment_ field.
9106 * output.cc (Output_section::Output_section): Initialize is_relro_
9107 and is_relro_local_ fields.
9108 (Output_segment::add_output_section): Group relro sections.
9109 (Output_segment::is_first_section_relro): New function.
9110 (Output_segment::maximum_alignment): If there is a relro section,
9111 align the segment to the common page size.
9112 (Output_segment::set_section_addresses): Track whether we are
9113 looking at relro sections. If the last section is a relro
9114 section, align to the common page size.
9115 (Output_segment::set_section_list_addresses): Add in_relro
9116 parameter. Change all callers. Align to the page size when
9117 moving from relro to non-relro section.
9118 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9120 * output.h (class Output_section): Add is_relro_ and
9121 is_relro_local_ fields.
9122 (Output_section::is_relro): New function.
9123 (Output_section::set_is_relro): New function.
9124 (Output_section::is_relro_local): New function.
9125 (Output_section::set_is_relro_local): New function.
9126 (class Output_segment): Update declarations.
9127 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9128 * sparc.cc (Target_sparc::got_section): Likewise.
9129 * x86_64.cc (Target_x86_64::got_section): Likewise.
9130 * testsuite/relro_test_main.cc: New file.
9131 * testsuite/relro_test.cc: New file.
9132 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9133 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9134 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9135 (relro_test.so, relro_test_pic.o): New targets.
9136 * testsuite/Makefile.in: Rebuild.
9138 2008-05-16 Ian Lance Taylor <iant@google.com>
9140 * output.cc (Output_segment::add_output_section): Remove front
9142 * output.h (class Output_segment): Remove
9143 add_initial_output_section and overloaded add_output_section.
9144 Update declaration of remaining add_output_section.
9145 * layout.cc (Layout::create_interp): Call add_output_section
9146 rather than add_initial_output_section.
9147 (Layout::finish_dynamic_section): Likewise.
9149 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9150 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9151 know the dynamic type.
9152 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9153 field. Initialize it in constructor.
9154 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9155 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9156 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9159 * output.cc (Output_reloc::get_address): Change return type to
9161 * output.h (class Output_reloc): Update get_address declaration.
9162 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9163 for section addresses.
9165 2008-05-09 Ian Lance Taylor <iant@google.com>
9168 * gold.cc (gold_nomem): Use return value of write.
9170 2008-05-08 Ian Lance Taylor <iant@google.com>
9172 * symtab.c (Symbol::init_base_output_data): Add version
9173 parameter. Change all callers.
9174 (Symbol::init_base_output_segment): Likewise.
9175 (Symbol::init_base_constant): Likewise.
9176 (Symbol::init_base_undefined): Likewise.
9177 (Sized_symbol::init_output_data): Likewise.
9178 (Sized_symbol::init_output_segment): Likewise.
9179 (Sized_symbol::init_constant): Likewise.
9180 (Sized_symbol::init_undefined): Likewise.
9181 (Symbol_table::do_define_in_output_data): If the new symbol has a
9182 version, mark it as the default.
9183 (Symbol_table::do_define_in_output_segment): Likewise.
9184 (Symbol_table::do_define_as_constant): Likewise.
9185 * symtab.h (class Symbol): Update declarations.
9186 (class Sized_symbol): Likewise.
9187 * resolve.cc (Symbol::override_version): New function.
9188 (Symbol::override_base): Call override_version.
9189 (Symbol::override_base_with_special): Likewise.
9190 * testsuite/ver_script_8.script: New file.
9191 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9192 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9193 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9194 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9196 2008-05-06 Ian Lance Taylor <iant@google.com>
9199 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9201 (class General_options): Remove existing --undefined, and add
9202 --no-undefined instead. Add new --undefined as synonym for -u.
9203 * archive.cc (Archive::add_symbols): Check whether symbol was
9205 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9206 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9207 all uses. Add IS_UNDEFINED. Update declarations to split
9208 different versions of init_base. Declare init_base_undefined.
9209 (Symbol::is_defined): Handle IS_UNDEFINED.
9210 (Symbol::is_undefined): Likewise.
9211 (Symbol::is_weak_undefined): Call is_undefined.
9212 (Symbol::is_absolute): Handle IS_CONSTANT.
9213 (class Sized_symbol): Update declarations to split different
9214 versions of init. Declare init_undefined.
9215 (class Symbol_table): Declare new functions.
9216 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9218 (Symbol::init_base_output_data): Likewise.
9219 (Symbol::init_base_output_segment): Likewise.
9220 (Symbol::init_base_constant): Likewise.
9221 (Symbol::init_base_undefined): New function.
9222 (Sized_symbol::init_object): Rename from init. Change all
9224 (Sized_symbol::init_output_data): Likewise.
9225 (Sized_symbol::init_output_segment): Likewise.
9226 (Sized_symbol::init_constant): Likewise.
9227 (Sized_symbol::init_undefined): New function.
9228 (Symbol_table::add_undefined_symbols_from_command_line): New
9230 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9232 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9233 (Symbol::output_section): Likewise.
9234 (Symbol::set_output_section): Likewise.
9235 (Symbol_table::sized_finalize_symbol): Likewise.
9236 (Symbol_table::sized_write_globals): Likewise.
9237 * resolve.cc (Symbol_table::should_override): Likewise.
9238 (Symbol::override_base_with_special): Likewise.
9240 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9241 symbol, change it to have default visibility.
9242 * testsuite/protected_1.cc: New file.
9243 * testsuite/protected_2.cc: New file.
9244 * testsuite/protected_3.cc: New file.
9245 * testsuite/protected_main_1.cc: New file.
9246 * testsuite/protected_main_2.cc: New file.
9247 * testsuite/protected_main_3.cc: New file.
9248 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9249 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9250 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9251 (protected_1.so): New target.
9252 (protected_1_pic.o, protected_2_pic.o): New targets.
9253 (protected_3_pic.o): New target.
9254 (check_PROGRAMS): Add protected_2.
9255 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9256 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9257 * testsuite/Makefile.in: Rebuild.
9259 * options.h (DEFINE_var): Add set_user_set_##varname__.
9260 (DEFINE_bool_alias): New macro.
9261 (class General_options): Define -Bstatic using DEFINE_bool_alias
9262 rather than DEFINE_special. Add --undefined as an alias for -z
9264 * options.cc (General_options::parse_Bstatic): Remove.
9266 * options.h (class General_options): Add --fatal-warnings.
9267 * main.cc (main): Implement --fatal-warnings.
9268 * errors.h (Errors::warning_count): New function.
9270 * options.h (class General_options): Add -Bsymbolic-functions.
9271 * symtab.h (Symbol::is_preemptible): Check for
9272 -Bsymbolic-functions.
9274 2008-05-05 Ian Lance Taylor <iant@google.com>
9276 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9277 as noVARNAME rather than no-VARNAME.
9278 (class General_options): Add option -z combreloc.
9279 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9281 (Output_reloc::sort_before) [SHT_REL]: New function.
9282 (Output_reloc::sort_before) [SHT_RELA]: New function.
9283 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9284 Sort_relocs_comparison.
9285 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9286 parameter. Change all callers.
9287 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9288 sort_relocs parameter. Change all callers.
9289 * output.cc (Output_reloc::get_address): New function, broken out
9291 (Output_reloc::write_rel): Call it.
9292 (Output_reloc::compare): New function.
9293 (Output_data_reloc_base::do_write): Optionally sort relocs.
9295 * configure.ac: If targ_extra_obj is set, link it in.
9296 * configure.tgt: Initialize all variables.
9297 (x86_64*): Set targ_extra_obj and targ_extra_size.
9298 * configure: Rebuild.
9300 * object.cc (Sized_relobj::include_section_group): Adjust section
9301 indexes read from group data. Build vector to pass to
9303 * layout.cc (Layout::layout_group): Add flags and shndxes
9304 parameters. Remove contents parameter. Change caller. Update
9305 explicit instantiations.
9306 * layout.h (class Layout): Update layout_group declaration.
9307 * output.cc (Output_data_group::Output_data_group): Add flags and
9308 input_shndxes parameters. Remove contents parameter. Change
9310 (Output_data_group::do_write): Change input_sections_ to
9312 * output.h (class Output_data_group): Update constructor
9313 declaration. Rename input_sections_ to input_shndxes_.
9314 * testsuite/many_sections_test.cc: Add template.
9316 2008-04-30 Cary Coutant <ccoutant@google.com>
9318 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9320 * layout.cc (Layout::include_section): Refactored check for debug
9322 (Layout::add_comdat): Add new parameters. Change type
9323 of signature parameter. Add object and shndx to signatures table.
9324 (Layout::find_kept_object): New function.
9325 * layout.h: Include <cstring>.
9326 (Layout::is_debug_info_section): New function.
9327 (Layout::add_comdat): Add new parameters.
9328 (Layout::find_kept_object): New function.
9329 (Layout::Kept_section): New struct.
9330 (Layout::Signatures): Change type of map range.
9331 * object.cc (Relobj::output_section_address): New function.
9332 (Sized_relobj::include_section_group): Add new parameters. Change
9333 calls to Layout::add_comdat. Change to build table of kept comdat
9334 groups and table mapping discarded sections to kept sections.
9335 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9336 (Sized_relobj::do_layout): Change calls to include_section_group and
9337 include_linkonce_section.
9338 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9339 value to zero when section is discarded.
9340 (Sized_relobj::map_to_kept_section): New function.
9341 * object.h (Relobj::output_section_address): New function.
9342 (Relobj::Comdat_group): New type.
9343 (Relobj::find_comdat_group): New function.
9344 (Relobj::Comdat_group_table): New type.
9345 (Relobj::Kept_comdat_section): New type.
9346 (Relobj::Kept_comdat_section_table): New type.
9347 (Relobj::add_comdat_group): New function.
9348 (Relobj::set_kept_comdat_section): New function.
9349 (Relobj::get_kept_comdat_section): New function.
9350 (Relobj::comdat_groups_): New field.
9351 (Relobj::kept_comdat_sections_): New field.
9352 (Symbol_value::input_value): Update comment.
9353 (Sized_relobj::map_to_kept_section) New function.
9354 (Sized_relobj::include_linkonce_section): Add new parameter.
9355 * target-reloc.h (Comdat_behavior): New type.
9356 (get_comdat_behavior): New function.
9357 (relocate_section): Add code to map a discarded section to the
9358 corresponding kept section when applying a relocation.
9360 2008-04-30 Craig Silverstein <csilvers@google.com>
9362 * dwarf_reader.cc (next_generation_count): New static var.
9363 (Addr2line_cache_entry): New struct.
9364 (addr2line_cache): New static var.
9365 (Dwarf_line_info::one_addr2line): Added caching.
9366 (Dwarf_line_info::clear_addr2line_cache): New function.
9367 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9368 cache-size parameter.
9369 (Dwarf_line_info::one_addr2line_cache): New function.
9370 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9371 new cache-size argument to one_addr2line(), and clear cache.
9373 2008-04-28 Cary Coutant <ccoutant@google.com>
9375 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9376 R_386_PC8 relocations.
9378 2008-04-23 Ian Lance Taylor <iant@google.com>
9380 * object.cc (Sized_relobj::include_section_group): Check for
9381 invalid section group.
9383 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9386 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9387 than read for file header.
9388 * archive.cc (Archive::include_member): Likewise.
9390 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
9392 * aclocal.m4: Regenerate.
9393 * configure: Regenerate.
9395 2008-04-19 Ian Lance Taylor <iant@google.com>
9397 * version.cc (version_string): Bump to 1.6.
9399 * testsuite/Makefile.am (many_sections_r_test): New target.
9400 (many_sections_r_test_SOURCES): Remove.
9401 (many_sections_r_test_DEPENDENCIES): Remove.
9402 (many_sections_r_test_LDFLAGS): Remove.
9403 (many_sections_r_test_LDADD): Remove.
9405 * object.cc (Sized_relobj::do_add_symbols): Always pass
9406 local_symbol_count_ to add_from_relobj.
9408 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9409 every thousand variables.
9410 * testsuite/Makefile.in: Rebuild.
9412 * object.cc (Xindex::initialize_symtab_xindex): New function.
9413 (Xindex::read_symtab_xindex): New function.
9414 (Xindex::sym_xindex_to_shndx): New function.
9415 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9417 (Sized_relobj::do_initialize_xindex): New function.
9418 (Sized_relobj::do_read_symbols): Adjust section links.
9419 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9420 parameter. Change all callers.
9421 (Sized_relobj::include_section_group): Adjust section links and
9422 symbol section indexes.
9423 (Sized_relobj::do_layout): Adjust section links.
9424 (Sized_relobj::do_count_local_symbols): Adjust section links and
9425 symbol section indexes.
9426 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9427 ordinary and special symbols.
9428 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9429 dynsym_xindex parameters. Change all callers. Adjust section
9430 links. Use SHN_XINDEX when needed.
9431 (Sized_relobj::get_symbol_location_info): Adjust section links.
9432 Don't get fooled by special symbols.
9433 * object.h (class Xindex): Define.
9434 (class Object): Add xindex_ parameter. Declare virtual functoin
9435 do_initialize_xindex.
9436 (Object::adjust_sym_shndx): New function.
9437 (Object::set_xindex): New protected function.
9438 (class Symbol_value): Add is_ordinary_shndx_ field.
9439 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9440 (Symbol_value::value): Assert ordinary section.
9441 (Symbol_value::initialize_input_to_output_map): Likewise.
9442 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9444 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9446 (class Sized_relobj): Update declarations.
9447 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9448 parameter. Change all callers.
9449 (Sized_relobj::adjust_shndx): New function.
9450 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9452 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9453 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9454 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9455 (Sized_dynobj::read_dynsym_section): Adjust section links.
9456 (Sized_dynobj::read_dynamic): Likewise.
9457 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9459 (Sized_dynobj::do_initialize_xindex): New function.
9460 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9461 do_initialize_xindex.
9462 (Sized_dynobj::adjust_shndx): New function.
9463 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9464 dynsym_xindex_ fields.
9465 (Layout::finalize): Add a call to set_section_indexes before
9466 creating the symtab sections.
9467 (Layout::set_section_indexes): Don't do anything if the section
9468 already has a section index.
9469 (Layout::create_symtab_sections): Add shnum parameter. Change
9470 caller. Create .symtab_shndx section if needed.
9471 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9473 (Layout::allocated_output_section_count): New function.
9474 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9476 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9477 fields. Update declarations.
9478 (Layout::symtab_xindex): New function.
9479 (Layout::dynsym_xindex): New function.
9480 (class Write_symbols_task): Add layout_ field.
9481 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9483 * output.cc (Output_section_headers::Output_section_headers): Add
9484 shstrtab_section parameter. Change all callers.
9485 (Output_section_headers::do_sized_write): Store overflow values
9486 for section count and section string table section index in
9487 section header zero.
9488 (Output_file_header::do_sized_write): Check for overflow of
9489 section count and section string table section index.
9490 (Output_symtab_xindex::do_write): New function.
9491 (Output_symtab_xindex::endian_do_write): New function.
9492 * output.h (class Output_section_headers): Add shstrtab_section_.
9493 Update declarations.
9494 (class Output_symtab_xindex): Define.
9495 (Output_section::has_out_shndx): New function.
9496 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9498 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9500 (Sized_symbol::init): Likewise.
9501 (Symbol::output_section): Check for ordinary symbol.
9502 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9503 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9505 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9506 Change all callers. Simplify handling of symbols from sections
9507 not included in the link.
9508 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9510 (Weak_alias_sorter::operator()): Assert that symbols are
9512 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9514 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9515 parameters. Change all callers.
9516 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9517 symbol distinction. Use SHN_XINDEX when needed.
9518 (Symbol_table::write_section_symbol): Add symtab_xindex
9519 parameter. Change all callers.
9520 (Symbol_table::sized_write_section_symbol): Likewise. Use
9521 SHN_XINDEX when needed.
9522 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9524 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9525 (Symbol::is_defined): Check is_ordinary.
9526 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9527 (Symbol::is_absolute, Symbol::is_common): Likewise.
9528 (class Sized_symbol): Update declarations.
9529 (class Symbol_table): Update declarations.
9530 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9531 parameters. Change all callers.
9532 (Sized_symbol::override): Likewise.
9533 (Symbol_table::override): Likewise.
9534 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9535 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9536 is_ordinary, and orig_st_shndx parameters. Change all callers.
9537 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9538 to be in an ordinary section.
9539 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9540 object and is_ordinary parameters. Change all callers.
9541 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9542 Change all callers. Don't add undefined or non-ordinary symbols
9544 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9546 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9548 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9549 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9550 (Sized_relobj::relocate_sections): Likewise.
9551 * target-reloc.h (scan_relocs): Adjust section symbol index.
9552 (scan_relocatable_relocs): Likewise.
9553 * i386.cc (Scan::local): Check for ordinary symbols.
9554 * sparc.cc (Scan::local): Likewise.
9555 * x86_64.cc (Scan::local): Likewise.
9556 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9557 to symbol_section_and_value.
9558 * testsuite/many_sections_test.cc: New file.
9559 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9560 (check_PROGRAMS): Add many_sections_test.
9561 (many_sections_test_SOURCES): Define.
9562 (many_sections_test_DEPENDENCIES): Define.
9563 (many_sections_test_LDFLAGS): Define.
9564 (BUILT_SOURCES): Add many_sections_define.h.
9565 (many_sections_define.h): New target.
9566 (BUILT_SOURCES): Add many_sections_check.h.
9567 (many_sections_check.h): New target.
9568 (check_PROGRAMS): Add many_sections_r_test.
9569 (many_sections_r_test_SOURCES): Define.
9570 (many_sections_r_test_DEPENDENCIES): Define.
9571 (many_sections_r_test_LDFLAGS): Define.
9572 (many_sections_r_test_LDADD): Define.
9573 (many_sections_r_test.o): New target.
9574 * testsuite/Makefile.in: Rebuild.
9576 2008-04-17 Cary Coutant <ccoutant@google.com>
9578 * errors.cc (Errors::info): New function.
9579 (gold_info): New function.
9580 * errors.h (Errors::info): New function.
9581 * gold.h (gold_info): New function.
9582 * object.cc (Input_objects::add_object): Print trace output.
9583 * options.cc (options::parse_set): New function.
9584 (General_options::parse_wrap): Deleted.
9585 (General_options::General_options): Deleted initializer.
9586 * options.h (options::String_set): New typedef.
9587 (options::parse_set): New function.
9588 (DEFINE_set): New macro.
9589 (General_options::wrap): Changed to use DEFINE_set. Changed
9590 callers of any_wrap_symbols and is_wrap_symbol.
9591 (General_options::trace, General_options::trace_symbol):
9593 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9594 (General_options::wrap_symbols_): Deleted.
9595 * symtab.cc (Symbol_table::add_from_object): Print trace output.
9597 2008-04-17 David S. Miller <davem@davemloft.net>
9599 * options.cc (General_options::parse_V): New function.
9600 * options.h: Add entries for -V and -Qy.
9602 2008-04-17 Ian Lance Taylor <iant@google.com>
9604 * common.cc (Symbol_table::allocate_commons): Remove options
9605 parameter. Change caller.
9606 (Symbol_table::do_allocate_commons): Remove options parameter.
9607 Change caller. Just call do_allocate_commons_list twice.
9608 (Symbol_table::do_allocate_commons_list): New function, broken out
9609 of do_allocate_commons.
9610 * common.h (class Allocate_commons_task): Remove options_ field.
9612 * symtab.cc (Symbol_table::Symbol_table): Initialize
9614 (Symbol_table::add_from_object): Put TLS common symbols on
9616 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9617 which are IN_OUTPUT_DATA.
9618 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
9619 allocate_commons and do_allocate_commons declarations. Declare
9620 do_allocate_commons_list.
9621 * gold.cc (queue_middle_tasks): Update creation of
9622 Allocate_commons_task to not pass options.
9623 * testsuite/Makefile.am (INCLUDES): Add -I.. .
9624 (TLS_TEST_C_FLAGS): New variable.
9625 (tls_test_c_pic.o): New target.
9626 (tls_test_shared.so): Link in tls_test_c_pic.o.
9627 (tls_test_c_pic_ie.o): New target.
9628 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9629 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9630 (tls_test_c.o): New target.
9631 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9632 (tls_pic_test_LDADD): Likewise.
9633 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9634 (tls_shared_gd_to_ie_test_LDADD): Likewise.
9635 (tls_test_c_gnu2.o): New target.
9636 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9638 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9639 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9640 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9641 * testsuite/tls_test.cc: Include "config.h".
9642 (t_last): Call t11_last.
9643 * testsuite/tls_test.h (t11, t11_last): Declare.
9644 * testsuite/tls_test_c.c: New file.
9645 * testsuite/tls_test_main.cc (thread_routine): Call t11.
9646 * configure.ac: Check for OpenMP support.
9647 * configure, config.in, Makefile.in: Rebuild.
9648 * testsuite/Makefile.in: Rebuild.
9650 2008-04-16 Cary Coutant <ccoutant@google.com>
9652 * i386.cc (Target_i386::define_tls_base_symbol): New function.
9653 (Target_i386::tls_base_symbol_defined_): New field.
9654 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9655 (Target_i386::Scan::global): Likewise.
9656 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9657 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9658 (Target_x86_64::tls_base_symbol_defined_): New field.
9659 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9660 (Target_x86_64::Scan::global): Likewise.
9662 2008-04-16 Cary Coutant <ccoutant@google.com>
9664 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9665 (Symbol::needs_plt_entry): Allow weak undefined symbols.
9666 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9667 building shared libraries.
9668 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9669 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9670 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9671 * testsuite/Makefile.in: Rebuild.
9672 * testsuite/weak_undef.h: New file.
9673 * testsuite/weak_undef_file1.cc: Add extra test cases.
9674 * testsuite/weak_undef_file2.cc: Likewise.
9675 * testsuite/weak_undef_test.cc: Likewise.
9677 2008-04-16 David S. Miller <davem@davemloft.net>
9679 * sparc.cc (Target_sparc::Scan): Change from struct to class.
9680 Add issued_non_pic_error_ field. Declare check_non_pic.
9681 (Target_sparc::Scan::check_non_pic): New function.
9682 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9683 (Target_sparc::Scan::global): Likewise.
9685 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9686 * configure: Rebuild.
9688 * options.h (DEFINE_enable): New macro.
9689 (new_dtags): New enable option.
9690 (initfirst, interpose, loadfltr, nodefaultlib,
9691 nodelete, nodlopen, nodump): New -z options.
9692 * layout.cc (Layout:finish_dynamic_section): If new
9693 dtags enabled, emit DT_RUNPATH. Also, emit a
9694 DT_FLAGS_1 containing any specified -z flags.
9696 2008-04-16 Ian Lance Taylor <iant@google.com>
9698 * copy-relocs.cc: New file.
9699 * copy-relocs.h: New file.
9700 * reloc.cc: Remove Copy_relocs code.
9701 * reloc.h: Likewise.
9702 * reloc-types.h (struct Reloc_types) [both versions]: Add
9703 get_reloc_addend_noerror.
9704 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9705 variants of add_global which take an addend which must be zero.
9706 * i386.cc: Include "copy-relocs.h".
9707 (class Target_i386): Change type of copy_relocs_ to variable,
9709 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9711 (Target_i386::do_finalize_sections): Change handling of
9713 * sparc.cc: Include "copy-relocs.h".
9714 (class Target_sparc): Change type of copy_relocs_ to variable,
9716 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9718 (Target_sparc::do_finalize_sections): Change handling of
9720 * x86_64.cc: Include "copy-relocs.h".
9721 (class Target_x86_64): Change type of copy_relocs_ to variable,
9723 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9724 class. Change all callers.
9725 (Target_x86_64::do_finalize_sections): Change handling of
9727 * Makefile.am (CCFILES): Add copy-relocs.cc.
9728 (HFILES): Add copy-relocs.h.
9730 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9732 * testsuite/script_test_4.sh: Permit leading zeroes.
9734 2008-04-15 Ian Lance Taylor <iant@google.com>
9736 * script-sections.cc (Script_sections::create_segments): Use
9737 header_size_adjustment even when there is enough room for the
9739 * testsuite/script_test_4.sh: New file.
9740 * testsuite/script_test_4.t: New file.
9741 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9742 (check_DATA): Add script_test_4.stdout.
9743 (MOSTLYCLEANFILES): Likewise.
9744 (script_test_4): New target.
9745 (script_test_4.stdout): New target.
9746 * testsuite/Makefile.in: Rebuild.
9748 * sparc.cc: Add definitions for Output_data_plt_sparc class
9751 2008-04-14 David S. Miller <davem@davemloft.net>
9753 * sparc.cc: New file.
9754 * Makefile.am (TARGETSOURCES): Add sparc.cc
9755 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9756 * configure.tgt: Document targ_extra_size and
9757 targ_extra_big_endian. Add entries for sparc-* and
9759 * configure.ac: Handle targ_extra_size and
9760 targ_extra_big_endian.
9761 * Makefile.in: Rebuild.
9762 * configure: Likewise.
9763 * po/POTFILES.in: Likewise.
9764 * po/gold.pot: Likewise.
9766 2008-04-14 Ian Lance Taylor <iant@google.com>
9768 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9769 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9770 in the name/type/flags to section mapping. Don't call
9771 allocate_output_section.
9772 (Layout::choose_output_section): Change parameter from adjust_name
9773 to is_input_section. Don't permit input sections after sections
9774 are attached to segments. Don't call allocate_output_section.
9775 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9776 not write_enable_output_section.
9777 (Layout::make_output_section): Don't push to
9778 unattached_section_list_ nor call attach_to_segment. Call
9779 attach_section_to_segment if sections are attached.
9780 (Layout::attach_sections_to_segments): New function.
9781 (Layout::attach_section_to_segment): New function.
9782 (Layout::attach_allocated_section_to_segment): Rename from
9783 attach_to_segment. Remove flags parameter.
9784 (Layout::allocate_output_section): Remove function.
9785 (Layout::write_enable_output_section): Remove function.
9786 * layout.h (class Layout): Update for above changes. Add new
9787 field sections_are_attached_.
9788 * output.h (Output_section::update_flags_for_input_section): New
9790 * output.cc (Output_section::add_input_section): Call
9791 update_flags_for_input_section.
9792 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9794 2008-04-11 Cary Coutant <ccoutant@google.com>
9796 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9797 thought unnecessary.
9798 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9800 2008-04-11 Ian Lance Taylor <iant@google.com>
9802 * output.h (class Output_section_data): Remove inline definition
9804 * output.cc (Output_section_data::set_addralign): New function.
9806 2008-04-11 Cary Coutant <ccoutant@google.com>
9808 Add support for TLS descriptors for i386 and x86_64.
9809 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9810 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9811 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9813 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9814 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9815 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9817 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9818 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9819 Fix problem with initial-exec relocations.
9820 (Target_i386::Relocate::relocate_tls): Likewise.
9821 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9823 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9824 support for section-plus-offset dynamic table entries.
9825 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9826 (Output_data_dynamic::Dynamic_entry): Add support for
9827 section-plus-offset dynamic table entries.
9828 (Output_data_dynamic::Classification): Likewise.
9829 (Output_data_dynamic::classification_): Renamed offset_.
9830 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9831 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9832 (Target_x86_64::make_plt_section): New function.
9833 (Target_x86_64::reserve_tlsdesc_entries): New function.
9834 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9835 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9836 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9837 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9838 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9839 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9840 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9841 add extra PLT entry for TLS descriptors.
9842 (Output_data_plt_x86_64::got_): New field.
9843 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9844 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9846 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9848 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9849 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9850 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9851 R_386_TLS_DESC_CALL relocations.
9852 (Target_x86_64::Scan::global): Likewise.
9853 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9854 for TLS descriptors.
9855 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9856 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9857 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9858 GD-to-IE relaxation.
9859 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9860 and TLS_DESCRIPTORS.
9861 * Makefile.in: Rebuild.
9862 * configure: Rebuild.
9863 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9864 (tls_test_shared2.so): New target.
9865 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9866 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9867 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9868 (tls_shared_gd_to_ie_test_LDADD): New variable.
9869 (tls_shared_gnu2_gd_to_ie_test): New target.
9870 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9872 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9873 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9874 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9875 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9876 (tls_shared_gnu2_test): New target.
9877 (tls_test_gnu2_shared.so): New target.
9878 (tls_shared_gnu2_test_SOURCES): New variable.
9879 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9880 (tls_shared_gnu2_test_LDFLAGS): New variable.
9881 (tls_shared_gnu2_test_LDADD): New variable.
9882 * testsuite/Makefile.in: Rebuild.
9883 * testsuite/Makefile.
9885 2008-04-11 Ian Lance Taylor <iant@google.com>
9887 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9889 * testsuite/Makefile.in: Rebuild.
9891 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9893 * testsuite/script_test_2.cc (main): Adjust test.
9895 2008-04-11 David S. Miller <davem@davemloft.net>
9896 Ian Lance Taylor <iant@google.com>
9898 * options.h (General_options): Add entries for '-Y' and
9900 * options.cc (General_options:finalize): If -Y was used, add those
9901 entries to the library path instead of the default "/lib" and
9904 2008-04-11 David S. Miller <davem@davemloft.net>
9906 * testsuite/justsyms.t: Start at 0x100.
9907 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9908 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9910 * testsuite/script_test_2.cc: Adjust string and section length
9913 2008-04-09 Ian Lance Taylor <iant@google.com>
9916 * script-sections.cc (Sections_element::allocate_to_segment): Add
9918 (Output_section_definition::allocate_to_segment): Likewise.
9919 (Orphan_output_section::allocate_to_segment): Likewise.
9920 (Script_sections::attach_sections_using_phdrs_clause): Don't
9921 propagate non-PT_LOAD segments to orphan sections.
9922 * testsuite/Makefile.am (script_test_3.stdout): Generate using
9923 readelf rather than objdump.
9924 * testsuite/script_test_3.sh: Adjust accordingly. Test that
9925 .interp section and PT_INTERP segment are the same size.
9926 * testsuite/Makefile.in: Rebuild.
9928 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9929 aliases for symbols defined in the same object.
9930 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9931 (weak_alias_test_SOURCES): New variable.
9932 (weak_alias_test_DEPENDENCIES): New variable.
9933 (weak_alias_test_LDFLAGS): New variable.
9934 (weak_alias_test_LDADD): New variable.
9935 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9936 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9937 (weak_alias_test_3.o): New target.
9938 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9939 * testsuite/weak_alias_test_main.cc: New file.
9940 * testsuite/weak_alias_test_1.cc: New file.
9941 * testsuite/weak_alias_test_2.cc: New file.
9942 * testsuite/weak_alias_test_3.cc: New file.
9944 2008-04-08 Ian Lance Taylor <iant@google.com>
9946 * options.h (class General_options): Add --noinhibit-exec option.
9947 * main.cc (main): Check --noinhibit-exec.
9949 * options.h (class General_options): Define --wrap as a special
9950 option. Add wrap_symbols_ field.
9951 (General_options::any_wrap_symbols): New function.
9952 (General_options::is_wrap_symbol): New function.
9953 * options.cc (General_options::parse_wrap): New function.
9954 (General_options::General_options): Initialize wrap_symbols_.
9955 * symtab.cc (Symbol_table::wrap_symbol): New function.
9956 (Symbol_table::add_from_object): Handle --wrap.
9957 * symtab.h (class Symbol_table): Declare wrap_symbol.
9958 * target.h (Target::wrap_char): New function.
9959 (Target::Target_info): Add wrap_char field.
9960 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9961 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9962 * testsuite/testfile.cc (Target_test::test_target_info):
9965 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9968 * layout.h (class Layout): Add added_eh_frame_data_ field.
9969 * layout.cc (Layout::Layout): Initialize new field.
9970 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9971 output section until we find a section we merged successfully.
9972 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9973 that the size be non-zero.
9975 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9978 2008-04-08 Craig Silverstein <csilvers@google.com>
9980 * configure.ac: Export new conditional variable HAVE_ZLIB.
9981 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9983 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9984 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9986 2008-04-07 Ian Lance Taylor <iant@google.com>
9988 * version.cc (version_string): Set to "1.5".
9990 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9991 Add issued_non_pic_error_ field. Declare check_non_pic.
9992 (Target_x86_64::Scan::check_non_pic): New function.
9993 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9994 (Target_x86_64::Scan::global): Likewise.
9996 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9997 addend parameter. Change caller. Handle merge sections.
9998 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9999 Address to Addend. Don't add in the result of
10000 local_section_offset, pass down the addend and use the returned
10002 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10003 Update declarations of local_section_offset and symbol_value.
10004 * testsuite/two_file_test_1.cc (t18): New function.
10005 * testsuite/two_file_test_2.cc (f18): New function.
10006 * testsuite/two_file_test_main.cc (main): Call t18.
10007 * testsuite/two_file_test.h (t18, f18): Declare.
10009 * configure.ac: Don't test for objdump, c++filt, or readelf.
10010 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10012 (TEST_READELF): New variable.
10013 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10014 (check_PROGRAMS): Add two_file_strip_test.
10015 (two_file_strip_test): New target.
10016 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10017 (two_file_same_shared_strip_test_SOURCES): New variable.
10018 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10019 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10020 (two_file_same_shared_strip_test_LDADD): New variable.
10021 (two_file_shared_strip.so): New target.
10022 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10023 (ver_test_5.syms, ver_test_7.syms): Likewise.
10024 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10025 (strip_test_3.stdout): Use TEST_OBJDUMP.
10026 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10028 2008-04-04 Cary Coutant <ccoutant@google.com>
10030 * symtab.h (Symbol::is_weak_undefined): New function.
10031 (Symbol::is_strong_undefined): New function.
10032 (Symbol::is_absolute): New function.
10033 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10034 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10036 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10037 (weak_undef_test): New target.
10038 * testsuite/Makefile.in: Rebuild.
10039 * testsuite/weak_undef_file1.cc: New file.
10040 * testsuite/weak_undef_file2.cc: New file.
10041 * testsuite/weak_undef_test.cc: New file.
10043 2008-04-03 Craig Silverstein <csilvers@google.com>
10045 * compressed_output.h (class Output_compressed_section): Use
10047 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10049 (zlib_compressed_suffix): Removed.
10050 (Output_compressed_section::set_final_data_size): Use unsigned
10052 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10053 Fix linker invocation.
10054 (flagstest_o_specialfile_and_compress_debug_sections):
10056 * testsuite/Makefile.in: Regenerated.
10058 2008-04-02 David S. Miller <davem@davemloft.net>
10060 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10061 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10063 2008-04-02 Craig Silverstein <csilvers@google.com>
10067 2008-04-02 Ian Lance Taylor <iant@google.com>
10069 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10070 parameters. Update for new key type to views_. Change all
10072 (File_read::read): Adjust for byteshift in returned view.
10073 (File_read::add_view): New function, broken out of
10074 find_and_make_view.
10075 (File_read::make_view): New function, broken out of
10076 find_and_make_view.
10077 (File_read::find_or_make_view): Add offset and aligned
10078 parameters. Rewrite accordingly. Change all callers.
10079 (File_read::get_view): Add offset and aligned parameters. Adjust
10080 for byteshift in return value.
10081 (File_read::get_lasting_view): Likewise.
10082 * fileread.h (class File_read): Update declarations.
10083 (class File_read::View): Add byteshift_ field. Add byteshift to
10084 constructor. Add byteshift method.
10085 * archive.h (Archive::clear_uncached_views): New function.
10086 (Archive::get_view): Add aligned parameter. Change all callers.
10087 * object.h (Object::get_view): Add aligned parameter. Change all
10089 (Object::get_lasting_view): Likewise.
10091 * fileread.cc (File_read::release): Don't call clear_views if
10092 there are multiple objects.
10093 * fileread.h (File_read::clear_uncached_views): New function.
10094 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10097 2008-03-31 Cary Coutant <ccoutant@google.com>
10099 Add thin archive support.
10100 * archive.cc (Archive::armagt): New const.
10101 (Archive::setup): Remove task parameter and calls to unlock.
10102 (Archive::unlock_nested_archives): New function.
10103 (Archive::read_header): Add nested_off parameter. Change
10105 (Archive::interpret_header): Likewise.
10106 (Archive::include_all_members): Change to handle thin
10108 (Archive::include_member): Likewise.
10109 * archive.h (Archive::Archive): Add new parameters and
10111 (Archive::armagt): New const.
10112 (Archive::setup): Remove task parameter.
10113 (Archive::unlock_nested_archives): New function.
10114 (Archive::read_header): Add nested_off parameter.
10115 (Archive::interpret_header): Likewise.
10116 (Archive::Nested_archive_table): New typedef.
10117 (Archive::is_thin_archive_): New field.
10118 (Archive::nested_archives_): New field.
10119 (Archive::options_): New field.
10120 (Archive::dirpath_): New field.
10121 (Archive::task_): New field.
10122 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10123 for thin archives. Pass additional parameters to
10124 Archive::Archive. Unlock the archive file after calling
10127 2008-03-29 Ian Lance Taylor <iant@google.com>
10129 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10130 version symbol to be local.
10131 * testsuite/ver_test_4.sh: New file.
10132 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10133 (check_DATA): Add ver_test_4.syms.
10134 (ver_test_4.syms): New target.
10135 * testsuite/Makefile.in: Rebuild.
10138 (Output_section::Input_section_sort_entry::has_priority): New
10140 (Output_section::Input_section_sort_entry::match_file_name): New
10142 (Output_section::Input_section_sort_entry::match_section_name):
10144 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10146 (Output_section::Input_section_sort_entry::match_section_file):
10148 (Output_section::Input_section_sort_compare::operator()): Rewrite
10149 using new Input_section_sort_entry functions. Sort crtbegin and
10150 crtend first. Sort sections with no priority before sections with
10152 * testsuite/initpri1.c (d3): Check j != 4.
10153 (cd5): New constructor/destructor function.
10154 (main): Check j != 2.
10156 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10157 new symbol when resolving, don't call set_is_default.
10158 * testsuite/ver_test_7.cc: New file.
10159 * testsuite/ver_test_7.sh: New file.
10160 * testsuite/Makefile.am (ver_test_7.so): New target.
10161 (ver_test_7.o): New target.
10162 (check_SCRIPTS): Add ver_test_7.sh.
10163 (check_DATA): Add ver_test_7.syms.
10164 (ver_test_7.syms): New target.
10166 2008-03-28 Ian Lance Taylor <iant@google.com>
10168 * layout.cc (Layout::layout): If we see an input section with a
10169 name that needs sorting, set the must_sort flag for the output
10171 (Layout::make_output_section): If the name of the output section
10172 indicates that it might require sorting, set the may_sort flag.
10173 * output.h (Output_section::may_sort_attached_input_sections): New
10175 (Output_section::set_may_sort_attached_input_sections): New
10177 (Output_section::must_sort_attached_input_sections): New
10179 (Output_section::set_must_sort_attached_input_sections): New
10181 (class Output_section): Declare Input_section_sort_entry. Define
10182 Input_section_sort_compare. Declare
10183 sort_attached_input_sections. Add new fields:
10184 may_sort_attached_input_sections_,
10185 must_sort_attached_input_sections_,
10186 attached_input_sections_are_sorted_.
10187 * output.cc (Output_section::Output_section): Initialize new
10189 (Output_section::add_input_section): Add an entry to
10190 input_sections_ if may_sort or must_sort are true.
10191 (Output_section::set_final_data_size): Call
10192 sort_attached_input_sections if necessary.
10193 (Output_section::Input_section_sort_entry): Define new class.
10194 (Output_section::Input_section_sort_compare::operator()): New
10196 (Output_section::sort_attached_input_sections): New function.
10197 * configure.ac: Check whether the compiler supports constructor
10198 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10199 * testsuite/initpri1.c: New file.
10200 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10201 CONSTRUCTOR_PRIORITY.
10202 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10203 (initpri1_LDFLAGS): New variable.
10204 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10206 2008-03-27 Ian Lance Taylor <iant@google.com>
10208 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10209 * testsuite/common_test_1.c: New file.
10210 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10211 (common_test_1_SOURCES): New variable.
10212 (common_test_1_DEPENDENCIES): New variable.
10213 (common_test_1_LDFLAGS): New variable.
10215 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10216 and commons_ correctly when NAME/VERSION does not override
10218 * testsuite/ver_test_6.c: New file.
10219 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10220 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10221 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10223 2008-03-26 Ian Lance Taylor <iant@google.com>
10225 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10226 of an undefined symbol from a version script.
10227 * testsuite/Makefile.am (ver_test_5.so): New target.
10228 (ver_test_5.o): New target.
10229 (check_SCRIPTS): Add ver_test_5.sh.
10230 (check_DATA): Add ver_test_5.syms.
10231 (ver_test_5.syms): New target.
10232 * testsuite/ver_test_5.cc: New file.
10233 * testsuite/ver_test_5.script: New file.
10234 * testsuite/ver_test_5.sh: New file.
10235 * Makefile.in, testsuite/Makefile.in: Rebuild.
10238 Fix problems building gold with gcc 4.3.0.
10239 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10240 (gold_error_at_location, gold_warning_at_location): Use it.
10241 * configure.ac: Check whether we can compile and use a template
10242 function with a printf attribute.
10243 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10244 when jumping over bytes.
10245 * object.cc: Instantiate Object::read_section_data.
10246 * debug.h: Include <cstring>
10247 * dwarf_reader.cc: Include <algorithm>
10248 * main.cc: Include <cstring>.
10249 * options.cc: Include <cstring>.
10250 * output.cc: Include <cstring>.
10251 * script.cc: Include <cstring>.
10252 * script.h: Include <string>.
10253 * symtab.cc: Include <cstring> and <algorithm>.
10254 * target-select.cc: Include <cstring>.
10255 * version.cc: Include <string>.
10256 * testsuite/testmain.cc: Include <cstdlib>.
10257 * configure, config.in: Rebuild.
10259 2008-03-25 Ian Lance Taylor <iant@google.com>
10261 * options.cc: Include "../bfd/bfdver.h".
10262 (options::help): Print bug reporting address.
10264 * version.cc (print_version): Adjust output for current value of
10265 BFD_VERSION_STRING.
10269 * options.cc (options::help): Print list of supported targets.
10270 * target-select.h: Include <vector>.
10271 (class Target_selector): Make machine_, size_, and is_big_endian_
10272 fields const. Add bfd_name_ and instantiated_target_ fields.
10273 (Target_selector::Target_selector): Add bfd_name parameter.
10274 (Target_selector::recognize): Make non-virtual, call
10276 (Target_selector::recognize_by_name): Make non-virtual, call
10277 do_recognize_by_name.
10278 (Target_selector::supported_names): New function.
10279 (Target_selector::bfd_name): New function.
10280 (Target_selector::do_instantiate_target): New pure virtual
10282 (Target_selector::do_recognize): New virtual function.
10283 (Target_selector::do_recognize_by_name): New virtual function.
10284 (Target_selector::instantiate_target): New private function.
10285 (supported_target_names): Declare.
10286 * target-select.cc (Target_selector::Target_selector): Update for
10287 new parameter and fields.
10288 (select_target_by_name): Check that the name matches before
10289 calling recognize_by_name.
10290 (supported_target_names): New function.
10291 * i386.cc (class Target_selector_i386): Update Target_selector
10292 constructor call. Remove recognize and recognize_by_name. Add
10293 do_instantiate_target.
10294 * x86_64.cc (class Target_selector_x86_64): Likewise.
10295 * testsuite/testfile.cc (class Target_selector_test): Update for
10296 changes to Target_selector.
10298 * README: Rewrite, with some notes on unsupported features.
10300 2008-03-24 Cary Coutant <ccoutant@google.com>
10302 * i386.cc (Target_i386::Got_type): New enum declaration.
10303 (Target_i386::Scan::local): Updated callers of Output_data_got
10305 (Target_i386::Scan::global): Likewise.
10306 (Target_i386::Relocate::relocate): Likewise.
10307 (Target_i386::Relocate::relocate_tls): Likewise.
10308 * object.h (Got_offset_list): New class.
10309 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10310 (Sized_relobj::local_got_offset): Likewise.
10311 (Sized_relobj::set_local_got_offset): Likewise.
10312 (Sized_relobj::local_has_tls_got_offset): Removed.
10313 (Sized_relobj::local_tls_got_offset): Removed.
10314 (Sized_relobj::set_local_tls_got_offset): Removed.
10315 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10316 * output.cc (Output_data_got::add_global): Added got_type parameter.
10317 (Output_data_got::add_global_with_rel): Likewise.
10318 (Output_data_got::add_global_with_rela): Likewise.
10319 (Output_data_got::add_global_pair_with_rel): New function.
10320 (Output_data_got::add_global_pair_with_rela): New function.
10321 (Output_data_got::add_local): Added got_type parameter.
10322 (Output_data_got::add_local_with_rel): Likewise.
10323 (Output_data_got::add_local_with_rela): Likewise.
10324 (Output_data_got::add_local_pair_with_rel): New function.
10325 (Output_data_got::add_local_pair_with_rela): New function.
10326 (Output_data_got::add_global_tls): Removed.
10327 (Output_data_got::add_global_tls_with_rel): Removed.
10328 (Output_data_got::add_global_tls_with_rela): Removed.
10329 (Output_data_got::add_local_tls): Removed.
10330 (Output_data_got::add_local_tls_with_rel): Removed.
10331 (Output_data_got::add_local_tls_with_rela): Removed.
10332 * output.h (Output_data_got::add_global): Added got_type parameter.
10333 (Output_data_got::add_global_with_rel): Likewise.
10334 (Output_data_got::add_global_with_rela): Likewise.
10335 (Output_data_got::add_global_pair_with_rel): New function.
10336 (Output_data_got::add_global_pair_with_rela): New function.
10337 (Output_data_got::add_local): Added got_type parameter.
10338 (Output_data_got::add_local_with_rel): Likewise.
10339 (Output_data_got::add_local_with_rela): Likewise.
10340 (Output_data_got::add_local_pair_with_rel): New function.
10341 (Output_data_got::add_local_pair_with_rela): New function.
10342 (Output_data_got::add_global_tls): Removed.
10343 (Output_data_got::add_global_tls_with_rel): Removed.
10344 (Output_data_got::add_global_tls_with_rela): Removed.
10345 (Output_data_got::add_local_tls): Removed.
10346 (Output_data_got::add_local_tls_with_rel): Removed.
10347 (Output_data_got::add_local_tls_with_rela): Removed.
10348 * resolve.cc (Symbol::override_base_with_special): Removed
10349 reference to has_got_offset_ field.
10350 * symtab.cc (Symbol::init_fields): Replaced initialization
10351 of got_offset_ with got_offsets_. Removed initialization
10353 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10354 (Symbol::got_offset): Likewise.
10355 (Symbol::set_got_offset): Likewise.
10356 (Symbol::has_tls_got_offset): Removed.
10357 (Symbol::tls_got_offset): Removed.
10358 (Symbol::set_tls_got_offset): Removed.
10359 (Symbol::got_offset_): Removed.
10360 (Symbol::tls_mod_got_offset_): Removed.
10361 (Symbol::tls_pair_got_offset_): Removed.
10362 (Symbol::got_offsets_): New field.
10363 (Symbol::has_got_offset): Removed.
10364 (Symbol::has_tls_mod_got_offset): Removed.
10365 (Symbol::has_tls_pair_got_offset): Removed.
10366 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10367 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10369 (Target_x86_64::Scan::global): Likewise.
10370 (Target_x86_64::Relocate::relocate): Likewise.
10371 (Target_x86_64::Relocate::relocate_tls): Likewise.
10373 2008-03-25 Ben Elliston <bje@au.ibm.com>
10375 * yyscript.y: Fix spelling error in comment.
10377 2008-03-24 Ian Lance Taylor <iant@google.com>
10379 * options.h (class General_options): Define build_id option.
10380 * layout.h (class Layout): Declare write_build_id, create_note,
10381 create_build_id. Add build_id_note_ member.
10382 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10383 "libiberty.h", "md5.h", "sha1.h".
10384 (Layout::Layout): Initialize eh_frame_data_,
10385 eh_frame_hdr_section_, and build_id_note_.
10386 (Layout::finalize): Call create_build_id.
10387 (Layout::create_note): New function, broken out of
10388 Layout::create_gold_note.
10389 (Layout::create_gold_note): Call create_note.
10390 (Layout::create_build_id): New function.
10391 (Layout::write_build_id): New function.
10392 (Close_task_runner::run): Call write_build_id.
10394 * x86_64.cc: Correct license to GPLv3.
10396 2008-03-23 Ian Lance Taylor <iant@google.com>
10398 * options.cc: Include "demangle.h".
10399 (parse_optional_string): New function.
10400 (parse_long_option): Handle takes_optional_argument.
10401 (parse_short_option): Update dash_z initializer. Handle
10402 takes_optional_argument.
10403 (General_options::General_options): Initialize do_demangle_.
10404 (General_options::finalize): Set do_demangle_. Handle demangling
10406 * options.h (parse_optional_string): Declare.
10407 (struct One_option): Add optional_arg field. Update constructor.
10408 Update call constructor calls. Add takes_optional_argument
10410 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10411 (DEFINE_optional_string): Define.
10412 (General_options::demangle): Change from DEFINE_bool to
10413 DEFINE_optional_string.
10414 (General_options::no_demangle): New function.
10415 (General_options::do_demangle): New function.
10416 (General_options::set_do_demangle): New function.
10417 (General_options::execstack_status_): Move definition to end of
10419 (General_options::static_): Likewise.
10420 (General_options::do_demangle_): New field.
10421 * object.cc (big_endian>::get_symbol_location_info): Call
10422 Options::do_demangle, not Options::demangle.
10423 * symtab.cc (demangle): Likewise.
10425 2008-03-22 Ian Lance Taylor <iant@google.com>
10427 * gold.h: Include <cstddef> and <sys/types.h>
10428 * options.h: Include <cstring>.
10430 2008-03-21 Ian Lance Taylor <iant@google.com>
10432 * Added source code to GNU binutils.