3 * archive.cc (Archive::include_member): Adjust call to
5 (Add_archive_symbols::run): Track argument serial numbers.
6 (Lib_group::include_member): Likewise.
7 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
8 * archive.h (Incremental_archive_entry::Archive_member):
9 Initialize arg_serial_.
10 (Archive_member::arg_serial_): New data member.
11 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
12 (Sized_dynobj::do_add_symbols): Track symbols when doing an
14 (Sized_dynobj::do_for_all_local_got_entries): New function.
15 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
17 * fileread.cc (get_mtime): New function.
18 * fileread.h (get_mtime): New function.
19 * gold.cc (queue_initial_tasks): Check for incremental update.
20 (process_incremental_input): New function.
21 (queue_middle_tasks): Don't force valid target for incremental
23 * incremental-dump.cc (find_input_containing_global): Adjust
24 size of symbol info entry.
25 (dump_incremental_inputs): Dump argument serial number and
26 in_system_directory flag; bias shndx by 1; print symbol names
27 when dumping per-file symbol lists; use new symbol info readers.
29 (Output_section_incremental_inputs:update_data_size): New function.
30 (Sized_incremental_binary::setup_readers): Setup input readers
31 for each input file; build maps for files added from libraries
33 (Sized_incremental_binary::check_input_args): New function.
34 (Sized_incremental_binary::do_check_inputs): Build map of argument
35 serial numbers to input arguments.
36 (Sized_incremental_binary::do_file_has_changed): Rename
37 do_file_is_unchanged to this; compare file modification times.
38 (Sized_incremental_binary::do_init_layout): New function.
39 (Sized_incremental_binary::do_reserve_layout): New function.
40 (Sized_incremental_binary::do_get_input_reader): Remove.
41 (Sized_incremental_binary::get_symtab_view): New function.
42 (Incremental_checker::can_incrementally_link_output_file): Remove.
43 (Incremental_inputs::report_command_line): Exclude --debug options.
44 (Incremental_inputs::report_archive_begin): Add parameter; track
45 argument serial numbers; don't put input file entry for archive
46 before archive members.
47 (Incremental_inputs::report_archive_end): Put input file entry
48 for archive after archive members.
49 (Incremental_inputs::report_object): Add parameter; track argument
50 serial numbers and in_system_directory flag.
51 (Incremental_inputs::report_script): Add parameter; track argument
53 (Output_section_incremental_inputs::set_final_data_size): Adjust
54 size of symbol info entry; check for forwarding symbols.
55 (Output_section_incremental_inputs::write_input_files): Write
56 in_system_directory flag and argument serial number.
57 (Output_section_incremental_inputs::write_info_blocks): Map section
58 indices between incremental info and original input file; store
59 input section index for each symbol.
60 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
61 change operator() to visit().
62 (class Global_got_offset_visitor): Likewise.
63 (class Global_symbol_visitor_got_plt):
64 (Output_section_incremental_inputs::write_got_plt): Use new visitor
66 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
67 (Sized_incr_relobj::do_read_symbols): New function.
68 (Sized_incr_relobj::do_layout): New function.
69 (Sized_incr_relobj::do_layout_deferred_sections): New function.
70 (Sized_incr_relobj::do_add_symbols): New function.
71 (Sized_incr_relobj::do_should_include_member): New function.
72 (Sized_incr_relobj::do_for_all_global_symbols): New function.
73 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
74 (Sized_incr_relobj::do_section_size): New function.
75 (Sized_incr_relobj::do_section_name): New function.
76 (Sized_incr_relobj::do_section_contents): New function.
77 (Sized_incr_relobj::do_section_flags): New function.
78 (Sized_incr_relobj::do_section_entsize): New function.
79 (Sized_incr_relobj::do_section_address): New function.
80 (Sized_incr_relobj::do_section_type): New function.
81 (Sized_incr_relobj::do_section_link): New function.
82 (Sized_incr_relobj::do_section_info): New function.
83 (Sized_incr_relobj::do_section_addralign): New function.
84 (Sized_incr_relobj::do_initialize_xindex): New function.
85 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
86 (Sized_incr_relobj::do_read_relocs): New function.
87 (Sized_incr_relobj::do_gc_process_relocs): New function.
88 (Sized_incr_relobj::do_scan_relocs): New function.
89 (Sized_incr_relobj::do_count_local_symbols): New function.
90 (Sized_incr_relobj::do_finalize_local_symbols): New function.
91 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
92 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
93 (Sized_incr_relobj::do_relocate): New function.
94 (Sized_incr_relobj::do_set_section_offset): New function.
95 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
96 (Sized_incr_dynobj::do_read_symbols): New function.
97 (Sized_incr_dynobj::do_layout): New function.
98 (Sized_incr_dynobj::do_add_symbols): New function.
99 (Sized_incr_dynobj::do_should_include_member): New function.
100 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
101 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
102 (Sized_incr_dynobj::do_section_size): New function.
103 (Sized_incr_dynobj::do_section_name): New function.
104 (Sized_incr_dynobj::do_section_contents): New function.
105 (Sized_incr_dynobj::do_section_flags): New function.
106 (Sized_incr_dynobj::do_section_entsize): New function.
107 (Sized_incr_dynobj::do_section_address): New function.
108 (Sized_incr_dynobj::do_section_type): New function.
109 (Sized_incr_dynobj::do_section_link): New function.
110 (Sized_incr_dynobj::do_section_info): New function.
111 (Sized_incr_dynobj::do_section_addralign): New function.
112 (Sized_incr_dynobj::do_initialize_xindex): New function.
113 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
114 (make_sized_incremental_object): New function.
115 (Incremental_library::copy_unused_symbols): New function.
116 (Incremental_library::do_for_all_unused_symbols): New function.
117 * incremental.h (enum Incremental_input_flags): New type.
118 (class Incremental_checker): Remove.
119 (Incremental_input_entry::Incremental_input_entry): Add argument
121 (Incremental_input_entry::arg_serial): New function.
122 (Incremental_input_entry::set_is_in_system_directory): New function.
123 (Incremental_input_entry::is_in_system_directory): New function.
124 (Incremental_input_entry::arg_serial_): New data member.
125 (Incremental_input_entry::is_in_system_directory_): New data member.
126 (class Script_info): Move here from script.h.
127 (Script_info::Script_info): Add filename parameter.
128 (Script_info::filename): New function.
129 (Script_info::filename_): New data member.
130 (Incremental_script_entry::Incremental_script_entry): Add argument
132 (Incremental_object_entry::Incremental_object_entry): Likewise.
133 (Incremental_object_entry::add_input_section): Build list of input
134 sections with map to original shndx.
135 (Incremental_object_entry::get_input_section_index): New function.
136 (Incremental_object_entry::shndx_): New data member.
137 (Incremental_object_entry::name_key_): Rename; adjust all refs.
138 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
139 (Incremental_archive_entry::Incremental_archive_entry): Add argument
141 (Incremental_inputs::report_archive_begin): Likewise.
142 (Incremental_inputs::report_object): Likewise.
143 (Incremental_inputs::report_script): Likewise.
144 (class Incremental_global_symbol_reader): New class.
145 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
146 and store flags and input file type.
147 (Incremental_input_entry_reader::arg_serial): New function.
148 (Incremental_input_entry_reader::type): Extract type from flags.
149 (Incremental_input_entry_reader::is_in_system_directory): New function.
150 (Incremental_input_entry_reader::get_input_section_count): Call
151 accessor function for type.
152 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
153 function for type; adjust size of global symbol entry.
154 (Incremental_input_entry_reader::get_global_symbol_count): Call
155 accessor function for type.
156 (Incremental_input_entry_reader::get_object_count): Likewise.
157 (Incremental_input_entry_reader::get_object_offset): Likewise.
158 (Incremental_input_entry_reader::get_member_count): Likewise.
159 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
160 (Incremental_input_entry_reader::get_member_offset): Likewise.
161 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
162 (Incremental_input_entry_reader::Global_symbol_info): Remove.
163 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
164 (Incremental_input_entry_reader::get_global_symbol_reader): New
166 (Incremental_input_entry_reader::get_output_symbol_index): New
168 (Incremental_input_entry_reader::type_): Remove.
169 (Incremental_input_entry_reader::flags_): New data member.
170 (Incremental_inputs_reader::input_file_offset): New function.
171 (Incremental_inputs_reader::input_file_index): New function.
172 (Incremental_inputs_reader::input_file): Call input_file_offset.
173 (Incremental_inputs_reader::input_file_at_offset): New function.
174 (Incremental_relocs_reader::get_r_type): Reformat.
175 (Incremental_relocs_reader::get_r_shndx): Reformat.
176 (Incremental_relocs_reader::get_r_offset): Reformat.
177 (Incremental_relocs_reader::data): New function.
178 (Incremental_binary::Incremental_binary): Initialize new data members.
179 (Incremental_binary::check_inputs): Add cmdline parameter.
180 (Incremental_binary::file_is_unchanged): Remove.
181 (Input_reader::arg_serial): New function.
182 (Input_reader::get_unused_symbol_count): New function.
183 (Input_reader::get_unused_symbol): New function.
184 (Input_reader::do_arg_serial): New function.
185 (Input_reader::do_get_unused_symbol_count): New function.
186 (Input_reader::do_get_unused_symbol): New function.
187 (Incremental_binary::input_file_count): New function.
188 (Incremental_binary::get_input_reader): Change signature to use
189 index instead of filename.
190 (Incremental_binary::file_has_changed): New function.
191 (Incremental_binary::get_input_argument): New function.
192 (Incremental_binary::get_library): New function.
193 (Incremental_binary::get_script_info): New function.
194 (Incremental_binary::init_layout): New function.
195 (Incremental_binary::reserve_layout): New function.
196 (Incremental_binary::output_file): New function.
197 (Incremental_binary::do_check_inputs): New function.
198 (Incremental_binary::do_file_is_unchanged): Remove.
199 (Incremental_binary::do_file_has_changed): New function.
200 (Incremental_binary::do_init_layout): New function.
201 (Incremental_binary::do_reserve_layout): New function.
202 (Incremental_binary::do_input_file_count): New function.
203 (Incremental_binary::do_get_input_reader): Change signature.
204 (Incremental_binary::input_args_map_): New data member.
205 (Incremental_binary::library_map_): New data member.
206 (Incremental_binary::script_map_): New data member.
207 (Sized_incremental_binary::Sized_incremental_binary): Initialize
209 (Sized_incremental_binary::output_section): New function.
210 (Sized_incremental_binary::inputs_reader): Add const.
211 (Sized_incremental_binary::symtab_reader): Add const.
212 (Sized_incremental_binary::relocs_reader): Add const.
213 (Sized_incremental_binary::got_plt_reader): Add const.
214 (Sized_incremental_binary::get_symtab_view): New function.
215 (Sized_incremental_binary::Inputs_reader): New typedef.
216 (Sized_incremental_binary::Input_entry_reader): New typedef.
217 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
218 (Sized_incremental_binary::do_file_is_unchanged): Remove.
219 (Sized_incremental_binary::do_file_has_changed): New function.
220 (Sized_incremental_binary::do_init_layout): New function.
221 (Sized_incremental_binary::do_reserve_layout): New function.
222 (Sized_input_reader::Inputs_reader): Remove.
223 (Sized_input_reader::Input_entry_reader): Remove.
224 (Sized_input_reader::do_arg_serial): New function.
225 (Sized_input_reader::do_get_unused_symbol_count): New function.
226 (Sized_input_reader::do_get_unused_symbol): New function.
227 (Sized_incremental_binary::do_input_file_count): New function.
228 (Sized_incremental_binary::do_get_input_reader): Change signature;
229 use index instead of filename.
230 (Sized_incremental_binary::section_map_): New data member.
231 (Sized_incremental_binary::input_entry_readers_): New data member.
232 (class Sized_incr_relobj): New class.
233 (class Sized_incr_dynobj): New class.
234 (make_sized_incremental_object): New function.
235 (class Incremental_library): New class.
236 * layout.cc (Free_list::num_lists): New static data member.
237 (Free_list::num_nodes): New static data member.
238 (Free_list::num_removes): New static data member.
239 (Free_list::num_remove_visits): New static data member.
240 (Free_list::num_allocates): New static data member.
241 (Free_list::num_allocate_visits): New static data member.
242 (Free_list::init): New function.
243 (Free_list::remove): New function.
244 (Free_list::allocate): New function.
245 (Free_list::dump): New function.
246 (Free_list::print_stats): New function.
247 (Layout_task_runner::run): Resize output file for incremental updates.
248 (Layout::Layout): Initialize new data members.
249 (Layout::set_incremental_base): New function.
250 (Layout::init_fixed_output_section): New function.
251 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
253 (Layout::create_gold_note): Do not create gold note section for
255 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
256 for incremental updates.
257 (Layout::set_section_offsets): For incremental updates, allocate space
259 (Layout::create_symtab_sections): Layout with offsets relative to
260 start of section; for incremental updates, allocate space from free
262 (Layout::create_shdrs): For incremental updates, allocate space from
264 (Layout::finish_dynamic_section): For incremental updates, do not
265 check --as-needed (fixed in subsequent patch).
266 * layout.h (class Free_list): New class.
267 (Layout::set_incremental_base): New function.
268 (Layout::incremental_base): New function.
269 (Layout::init_fixed_output_section): New function.
270 (Layout::allocate): New function.
271 (Layout::incremental_base_): New data member.
272 (Layout::free_list_): New data member.
273 * main.cc (main): Print Free_list statistics.
274 * object.cc (Relobj::finalize_incremental_relocs): Add
275 clear_counts parameter; clear counts only when clear_counts is set.
276 (Sized_relobj::Sized_relobj): Initialize new base class.
277 (Sized_relobj::do_layout): Don't report special sections.
278 (Sized_relobj::do_for_all_local_got_entries): New function.
279 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
280 symtab_off to all symbol table offsets.
281 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
282 * object.h (class Got_offset_list): Move to top of file.
283 (Object::Object): Allow case where input_file == NULL.
284 (Object::~Object): Likewise.
285 (Object::input_file): Assert that input_file != NULL.
286 (Object::lock): Allow case where input_file == NULL.
287 (Object::unlock): Likewise.
288 (Object::is_locked): Likewise.
289 (Object::token): Likewise.
290 (Object::release): Likewise.
291 (Object::is_incremental): New function.
292 (Object::get_mtime): New function.
293 (Object::for_all_local_got_entries): New function.
294 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
295 (Object::set_is_in_system_directory): New function.
296 (Object::is_in_system_directory): New function.
297 (Object::do_is_incremental): New function.
298 (Object::do_get_mtime): New function.
299 (Object::do_for_all_local_got_entries): New function.
300 (Object::is_in_system_directory_): New data member.
301 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
302 (class Sized_relobj_base): New class.
303 (class Sized_relobj): Derive from Sized_relobj_base.
304 (class Sized_relobj::Symbols): Redeclare from base class.
305 (class Sized_relobj::local_got_offset_list): Remove.
306 (class Sized_relobj::Output_sections): Redeclare from base class.
307 (class Sized_relobj::do_for_all_local_got_entries): New function.
308 (class Sized_relobj::write_local_symbols): Add offset parameter.
309 (class Sized_relobj::local_symbol_offset_): Update comment.
310 (class Sized_relobj::local_dynsym_offset_): Update comment.
311 * options.cc (Input_arguments::add_file): Remove const.
312 * options.h (Input_file_argument::Input_file_argument):
313 Initialize arg_serial_ (all constructors).
314 (Input_file_argument::set_arg_serial): New function.
315 (Input_file_argument::arg_serial): New function.
316 (Input_file_argument::arg_serial_): New data member.
317 (Input_arguments::Input_arguments): Initialize file_count_.
318 (Input_arguments::add_file): Remove const.
319 (Input_arguments::number_of_input_files): New function.
320 (Input_arguments::file_count_): New data member.
321 (Command_line::number_of_input_files): Call
322 Input_arguments::number_of_input_files.
323 * output.cc (Output_segment_headers::Output_segment_headers):
325 (Output_section::Input_section::current_data_size): New function.
326 (Output_section::Output_section): Initialize new data members.
327 (Output_section::add_input_section): Don't do merge sections for
328 an incremental link; allocate space from free list for an
330 (Output_section::add_output_section_data): Allocate space from
331 free list for an incremental update.
332 (Output_section::update_data_size): New function.
333 (Output_section::set_fixed_layout): New function.
334 (Output_section::reserve): New function.
335 (Output_segment::set_section_addresses): Remove const.
336 (Output_segment::set_section_list_addresses): Remove const; allocate
337 space from free list for an incremental update.
338 (Output_segment::set_offset): Adjust size of RELRO segment for an
340 * output.h (Output_data::current_data_size): Move here from
342 (Output_data::pre_finalize_data_size): New function.
343 (Output_data::update_data_size): New function.
344 (Output_section_headers::update_data_size): new function.
345 (Output_section_data_build::current_data_size): Move to Output_data.
346 (Output_data_strtab::update_data_size): New function.
347 (Output_section::current_data_size): Move to Output_data.
348 (Output_section::set_fixed_layout): New function.
349 (Output_section::has_fixed_layout): New function.
350 (Output_section::reserve): New function.
351 (Output_section::update_data_size): New function.
352 (Output_section::has_fixed_layout_): New data member.
353 (Output_section::free_list_): New data member.
354 (Output_segment::set_section_addresses): Remove const.
355 (Output_segment::set_section_list_addresses): Remove const.
356 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
358 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
360 * readsyms.cc (Read_symbols::do_read_symbols): Add library
361 parameter when calling Add_symbols constructor; store argument
362 serial number for members of a lib group.
363 (Add_symbols::locks): Allow case where token == NULL.
364 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
365 (Read_member::~Read_member): New function.
366 (Read_member::is_runnable): New function.
367 (Read_member::locks): New function.
368 (Read_member::run): New function.
369 (Check_script::~Check_script): New function.
370 (Check_script::is_runnable): New function.
371 (Check_script::locks): New function.
372 (Check_script::run): New function.
373 (Check_library::~Check_library): New function.
374 (Check_library::is_runnable): New function.
375 (Check_library::locks): New function.
376 (Check_library::run): New function.
377 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
378 (Add_symbols::library_): New data member.
379 (class Read_member): New class.
380 (class Check_script): New class.
381 (class Check_library): New class.
382 * reloc.cc (Read_relocs::is_runnable): Allow case where
384 (Read_relocs::locks): Likewise.
385 (Scan_relocs::locks): Likewise.
386 (Relocate_task::locks): Likewise.
387 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
389 (Sized_relobj::incremental_relocs_scan): Fix comment.
390 (Sized_relobj::do_relocate): Pass output file offset to
392 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
393 from class declaration.
394 * script.cc (read_input_script): Allocate Script_info; pass
395 argument serial number to report_script.
396 * script.h (class Script_info): Move to incremental.h.
397 * symtab.cc (Symbol_table::add_from_incrobj): New function.
398 * symtab.h (Symbol_table::add_from_incrobj): New function.
399 (Symbol_table::set_file_offset): New function.
403 * incremental-dump.cc (dump_incremental_inputs): Change signature
404 to take a Sized_incremental_binary; change caller. Use readers
405 in Sized_incremental_binary.
407 (Sized_incremental_binary::find_incremental_inputs_sections):
408 Rename do_find_incremental_inputs_sections to this.
409 (Sized_incremental_binary::setup_readers): New function.
410 (Sized_incremental_binary::do_check_inputs): Check
411 has_incremental_info_ flag; move setup code to setup_readers;
413 (Sized_incremental_binary::do_file_is_unchanged): New function.
414 (Sized_incremental_binary::do_get_input_reader): New function.
415 * incremental.h (class Incremental_binary): Move to end of file.
416 (Incremental_binary::file_is_unchanged): New function.
417 (Incremental_binary::do_file_is_unchanged): New function.
418 (Incremental_binary::Input_reader): New class.
419 (Incremental_binary::get_input_reader): New function.
420 (class Sized_incremental_binary): Move to end of file.
421 (Sized_incremental_binary::Sized_incremental_binary): Setup the
422 input section reader classes.
423 (Sized_incremental_binary::has_incremental_info): New function.
424 (Sized_incremental_binary::inputs_reader): New function.
425 (Sized_incremental_binary::symtab_reader): New function.
426 (Sized_incremental_binary::relocs_reader): New function.
427 (Sized_incremental_binary::got_plt_reader): New function.
428 (Sized_incremental_binary::do_file_is_unchanged): New function.
429 (Sized_incremental_binary::Sized_input_reader): New class.
430 (Sized_incremental_binary::get_input_reader): New function.
431 (Sized_incremental_binary::find_incremental_inputs_sections):
432 Rename do_find_incremental_inputs_sections to this.
433 (Sized_incremental_binary::setup_readers): New function.
434 (Sized_incremental_binary::has_incremental_info_): New data member.
435 (Sized_incremental_binary::inputs_reader_): New data member.
436 (Sized_incremental_binary::symtab_reader_): New data member.
437 (Sized_incremental_binary::relocs_reader_): New data member.
438 (Sized_incremental_binary::got_plt_reader_): New data member.
439 (Sized_incremental_binary::current_input_file_): New data member.
444 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
449 * archive.cc (Archive::include_member): Adjust call to report_object.
450 (Add_archive_symbols::run): Add script_info to call to
451 report_archive_begin.
452 (Lib_group::include_member): Adjust call to report_object.
453 (Add_lib_group_symbols::run): Adjust call to report_object.
454 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
455 blocks. Add object count for script input files.
456 * incremental.cc (Incremental_inputs::report_archive_begin): Add
457 script_info parameter; change all callers.
458 (Incremental_inputs::report_object): Add script_info parameter;
460 (Incremental_inputs::report_script): Store backpointer to
461 incremental info entry.
462 (Output_section_incremental_inputs::set_final_data_size): Record
463 additional information for scripts.
464 (Output_section_incremental_inputs::write_info_blocks): Likewise.
465 * incremental.h (Incremental_script_entry::add_object): New function.
466 (Incremental_script_entry::get_object_count): New function.
467 (Incremental_script_entry::get_object): New function.
468 (Incremental_script_entry::objects_): New data member; adjust
470 (Incremental_inputs::report_archive_begin): Add script_info parameter.
471 (Incremental_inputs::report_object): Add script_info parameter.
472 (Incremental_inputs_reader::get_object_count): New function.
473 (Incremental_inputs_reader::get_object_offset): New function.
474 * options.cc (Input_arguments::add_file): Return reference to
476 * options.h (Input_argument::set_script_info): New function.
477 (Input_argument::script_info): New function.
478 (Input_argument::script_info_): New data member; adjust all
480 (Input_file_group::add_file): Return reference to new input argument.
481 (Input_file_lib::add_file): Likewise.
482 (Input_arguments::add_file): Likewise.
483 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
484 * script.cc (Parser_closure::Parser_closure): Add script_info
485 parameter; adjust all callers.
486 (Parser_closure::script_info): New function.
487 (Parser_closure::script_info_): New data member.
488 (read_input_script): Report scripts earlier to incremental info.
489 (script_add_file): Set script_info in Input_argument.
490 (script_add_library): Likewise.
491 * script.h (Script_options::Script_info): Rewrite class.
495 * archive.cc (Library_base::should_include_member): Move
496 method here from class Archive.
497 (Archive::Archive): Initialize base class.
498 (Archive::should_include_member): Move to base class.
499 (Archive::do_for_all_unused_symbols): New function.
500 (Add_archive_symbols::run): Remove redundant access to
502 (Lib_group::Lib_group): Initialize base class.
503 (Lib_group::do_filename): New function.
504 (Lib_group::include_member): Pass pointer to Lib_group to
506 (Lib_group::do_for_all_unused_symbols): New function.
507 (Add_lib_group_symbols::run): Report archive information for
509 * archive.h (class Library_base): New base class.
510 (class Archive): Derive from Library_base.
511 (Archive::filename): Move to base class.
512 (Archive::set_incremental_info): Likewise.
513 (Archive::incremental_info): Likewise.
514 (Archive::Should_include): Likewise.
515 (Archive::should_include_member): Likewise.
516 (Archive::Armap_entry): Remove.
517 (Archive::Unused_symbol_iterator): Remove.
518 (Archive::unused_symbols_begin): Remove.
519 (Archive::unused_symbols_end): Remove.
520 (Archive::do_filename): New function.
521 (Archive::do_get_mtime): New function.
522 (Archive::do_for_all_unused_symbols): New function.
523 (Archive::task_): Move to base class.
524 (Archive::incremental_info_): Likewise.
525 (class Lib_group): Derive from Library_base.
526 (Lib_group::do_filename): New function.
527 (Lib_group::do_get_mtime): New function.
528 (Lib_group::do_for_all_unused_symbols): New function.
529 (Lib_group::task_): Move to base class.
530 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
532 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
534 * incremental.cc (Incremental_inputs::report_archive_begin):
535 Use Library_base; call library's get_mtime; add incremental inputs
536 entry before members.
537 (class Unused_symbol_visitor): New class.
538 (Incremental_inputs::report_archive_end): Use Library_base; use
539 visitor class to record unused symbols; don't add incremental inputs
541 (Incremental_inputs::report_object): Use Library_base.
543 (Incremental_archive_entry::Incremental_archive_entry): Remove
544 unused Archive parameter.
545 (Incremental_inputs::report_archive_begin): Use Library_base.
546 (Incremental_inputs::report_archive_end): Likewise.
547 (Incremental_inputs::report_object): Likewise.
548 * object.cc (Sized_relobj::do_for_all_global_symbols): New
550 * object.h (Object::for_all_global_symbols): New function.
551 (Object::do_for_all_global_symbols): New function.
552 (Sized_relobj::do_for_all_global_symbols): New function.
553 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
555 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
560 * archive.cc (Archive::interpret_header): Return -1 if something
561 goes wrong. Change callers accordingly.
565 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
566 * testsuite/Makefile.in: Regenerate.
570 * plugin.cc (get_view): New.
571 (Plugin::load): Pass get_view to the plugin.
572 (Plugin_manager::get_view): New.
576 * testsuite/final_layout.sh: Rewrite to not use dc.
577 * testsuite/relro_test.sh: Fail if dc is not present.
581 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
583 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
584 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
586 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
587 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
591 * script-sections.cc (Sort_output_sections::script_compare):
592 Rename from is_before, change return type.
593 (Sort_output_sections::operator()): Adjust accordingly.
598 * testsuite/odr_violation2.cc: Add comment to make all error line
599 numbers double digits.
600 * testsuite/debug_msg.sh: Adjust expected errors.
604 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
605 but mark earlier ones as non-canonical
606 (offset_to_iterator): Update search target and example
607 (do_addr2line): Return extra lines in a vector*
608 (format_file_lineno): Extract from do_addr2line
609 (one_addr2line): Add vector* out-param
610 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
611 when a lineno entry appeared last for its instruction
612 (Dwarf_line_info): Add vector* out-param
613 * object.cc (Relocate_info): Pass NULL for the vector* out-param
614 * symtab.cc (Odr_violation_compare): Include the lineno in the
616 (linenos_from_loc): New. Combine the canonical line for an
617 address with its other lines.
618 (True_if_intersect): New. Helper functor to make
619 std::set_intersection a query.
620 (detect_odr_violations): Compare sets of lines instead of just
621 one line for each function. This became less deterministic, but
622 has fewer false positives.
623 * symtab.h: Declarations.
624 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
625 mix an optimized and non-optimized object in the same binary
626 (odr_violation2.so): Same.
627 * testsuite/Makefile.in: Regenerate from Makefile.am.
628 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
629 * testsuite/debug_msg.sh: Update line numbers and add
631 * testsuite/odr_violation1.cc: Use OdrDerived, in a
632 non-optimized context.
633 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
634 isn't inlined, and use OdrDerived in an optimized context.
635 * testsuite/odr_header1.h: Defines OdrDerived, where
636 optimization will change the
637 first-instruction-in-the-destructor's file and line number.
638 * testsuite/odr_header2.h: Defines OdrBase.
642 * fileread.cc (File_read::clear_views): Don't delete the whole
648 * fileread.cc: #include <climits>.
649 (GOLD_IOV_MAX): Define.
650 (File_read::read_multiple): Limit number of entries by iov_max.
651 * fileread.h (class File_read): Always set max_readv_entries to
657 * options.h (class General_options): Add -dy and -dn.
661 * testsuite/script_test_9.t: Add TLS segment.
665 * configure.ac: Add check for gnu_indirect_function support in
666 the toolchain building binutils.
667 * configure: Rebuild.
671 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
673 (Symbol_table::sized_finalize_symbol) Mark symbol only present
674 in plugin files as not needed in the symbol table.
678 * output.cc (Output_section::add_input_section): Delay fill
679 generation for section ordering.
684 * object.h (class Sized_relobj): Remove clear_local_symbols.
685 * reloc.cc (Sized_relobj::do_relocate): Don't call
690 * plugin.cc (is_visible_from_outside): Return true for symbols
695 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
700 * icf.h (is_section_foldable_candidate): Change type of parameter
702 * icf.cc (Icf::find_identical_sections): Change type of local variable
703 section_name to be std::string.
704 (is_function_ctor_or_dtor): Change type of parameter to std::string.
708 * script.cc (script_add_extern): Rewrite to use
709 add_symbol_reference.
713 * icf.cc (get_section_contents): Always lock section's object.
717 * options.h (class General_options): Accept
718 --no-detect-odr-violations.
722 * version.cc (version_string): Bump to 1.11.
726 * plugin.cc (class Plugin_rescan): Define new class.
727 (Plugin_manager::claim_file): Set any_claimed_.
728 (Plugin_manager::save_archive): New function.
729 (Plugin_manager::save_input_group): New function.
730 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
732 (Plugin_manager::new_undefined_symbol): New function.
733 (Plugin_manager::rescan): New function.
734 (Plugin_manager::rescannable_defines): New function.
735 (Plugin_manager::add_input_file): Set any_added_.
736 * plugin.h (class Plugin_manager): define new fields rescannable_,
737 undefined_symbols_, any_claimed_, and any_added_. Declare
738 Plugin_rescan as friend. Declare new functions.
739 (Plugin_manager::Rescannable): Define type.
740 (Plugin_manager::Rescannable_list): Define type.
741 (Plugin_manager::Undefined_symbol_list): Define type.
742 (Plugin_manager::Plugin_manager): Initialize new fields.
743 * archive.cc (Archive::defines_symbol): New function.
744 (Add_archive_symbols::run): Pass archive to plugins if any.
745 * archive.h (class Archive): Declare defines_symbol.
746 * readsyms.cc (Input_group::~Input_group): New function.
747 (Finish_group::run): Pass input_group to plugins if any.
748 * readsyms.h (class Input_group): Declare destructor.
749 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
754 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
756 (Layout::set_segment_offsets): Reset increase_relro before calling
757 set_section_addresses a second time.
761 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
762 sections before NOBITS sections.
766 * version.cc (print_version): Update copyright to 2011.
770 * output.h (Output_data_reloc::add_output_section): Pass OD instead
771 of OS to this->add. Add OD parameter to second form of the function.
775 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
776 second of two consecutive entries with same offset.
780 * testsuite/Makefile.am (ifuncmain2static_LDADD)
781 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
782 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
783 to avoid unneeded links against $(LDADD).
784 * testsuite/Makefile.in: Regenerate.
789 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
790 for R_X86_64_32 and R_X86_64_PC32.
791 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
792 ver_matching_def_pic.o.
793 (ver_matching_def_pic.o): New target.
797 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
798 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
799 Move definition before File_read::View member definitions.
800 (File_read::View::~View): Initialize and hold lock before
801 updating current_mapped_bytes.
805 * dwarf_reader.cc: Remove outdated comment.
806 * gold-threads.cc: Fix typo in error message.
807 * archive.cc: Fix typos in comments.
808 * archive.h: Likewise.
809 * arm-reloc-property.cc: Likewise.
810 * arm-reloc-property.h: Likewise.
811 * arm-reloc.def: Likewise.
813 * attributes.h: Likewise.
815 * ehframe.cc: Likewise.
816 * fileread.h: Likewise.
820 * incremental.h: Likewise.
821 * int_encoding.cc: Likewise.
822 * layout.h: Likewise.
825 * object.cc: Likewise.
826 * object.h: Likewise.
827 * options.cc: Likewise.
828 * readsyms.cc: Likewise.
829 * reduced_debug_output.cc: Likewise.
830 * reloc.cc: Likewise.
831 * script-sections.cc: Likewise.
832 * sparc.cc: Likewise.
833 * symtab.h: Likewise.
834 * target-reloc.h: Likewise.
835 * target.cc: Likewise.
836 * target.h: Likewise.
837 * timer.cc: Likewise.
839 * x86_64.cc: Likewise.
843 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
845 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
846 parameter; change all callers.
847 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
848 * options.h (warn_execstack): New option.
852 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
853 like function call relocations.
857 * archive.cc (Archive::get_elf_object_for_member): Permit
858 punconfigured to be NULL.
859 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
860 (Archive::include_member): Pass NULL to get_elf_object_for_member
861 if we searched for the archive and this is the first included
866 * dwarf_reader.h (class Sized_dwarf_line_info): Add
867 track_relocs_type_ field.
868 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
869 Set track_relocs_type_.
870 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
871 contents when using RELA relocs.
872 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
874 * reloc.cc (Track_relocs::next_addend): New function.
875 * reloc.h (class Track_relocs): Declare next_addend.
879 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
884 * README: Update compilers known to work and fail.
888 * configure.in: For --enable-gold, handle value `default' instead of
889 `both*'. Always install ld as ld.bfd, install as ld if gold is
891 * configure: Regenerate.
895 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
896 and right_alignment to be zero. Store result alignment only if it is
897 greater than existing alignment.
902 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
903 Check for ".zdebug_line".
908 * output.h (Output_segment::set_section_addresses): Pass increase_relro
909 by reference; adjust all callers.
910 * output.cc (Output_segment::set_section_addresses): Adjust references
911 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
913 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
914 end at page boundary.
919 * layout.cc (Layout::choose_output_section): Transform names of
920 compressed sections even when using a script with a SECTIONS clause.
921 (Layout::output_section_name): Remove code to transform
922 compressed debug section names.
923 * output.cc (Output_section::add_input_section): Use uncompressed
924 section size when tracking input sections.
928 * symtab.h (Symbol::NON_PIC_REF): Remove.
929 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
930 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
931 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
932 (Symbol::use_plt_offset): Take a flags argument and pass it
933 directly to needs_dynamic_reloc. Restrict check for undefined
934 weak symbols to function calls.
935 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
936 (Target_arm::Scan::global): Use it.
937 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
938 (Target_arm::Relocate::relocate): Likewise.
939 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
940 parameter with an r_type parameter. Use get_reference_flags
942 (Target_arm::Relocate::relocate): Update accordingly.
943 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
944 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
945 (Target_i386::Scan::global): Likewise.
946 (Target_i386::Relocate::relocate): Likewise.
947 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
948 parameter with an r_type parameter. Use get_reference_flags
950 (Target_i386::Relocate::relocate): Update accordingly.
951 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
952 (Target_powerpc::Scan::global): Use it.
953 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
954 (Target_powerpc::Relocate::relocate): Likewise.
955 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
956 (Target_sparc::Scan::global): Use it.
957 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
958 (Target_sparc::Relocate::relocate): Likewise.
959 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
960 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
961 (Target_x86_64::Scan::global): Likewise.
962 (Target_x86_64::Relocate::relocate): Likewise.
967 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
968 (Arm_exidx_merge_section::section_contents_): New data member.
969 (Arm_input_section::Arm_input_section): Initialize original_contents_.
970 (Arm_input_section::~Arm_input_section): De-allocate memory.
971 (Arm_input_section::original_contents_): New data member.
972 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
973 in parameters instead of calling Object::section_contents without
975 (Arm_output_section::group_section): New parameter TASK. Pass it
976 to callees that need locking objects.
977 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
978 to lock EXIDX input sections. Fix a formatting issue. Call
979 Arm_exidx_merged_section::build_contents to create merged section
981 (Arm_output_section::create_stub_group): New parameter TASK. Use it
982 to lock object of stub table owner.
983 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
984 TEXT_SIZE to initialize data member TEXT_SIZE_.
985 (Arm_exidx_input_section::addralign): Fix typo in comment.
986 (Arm_exidx_input_section::text_size): New method.
987 (Target_arm::do_relax): New parameter TASK. Pass it to callees
988 that require locking objects. Lock objects before scanning for stubs
989 and updating local symbols.
990 (Arm_input_section<big_endian>::init): Copy contents of original
992 (Arm_input_section<big_endian>::do_write): Use saved contents of
993 original input section instead of calling Object::section_contents
995 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
996 size without calling Object::section_size().
997 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
998 for size. Allocate a buffer for merged EXIDX entries.
999 (Arm_exidx_merged_section::build_contents): New method.
1000 (Arm_exidx_merged_section::do_write): Move merge section contents
1001 building code to Arm_exidx_merged_section::build_contetns. Write
1002 out contetns in buffer instead of building it on the fly.
1003 (Arm_relobj::make_exidx_input_section): Also pass text section size
1004 to Arm_exidx_input_section constructor.
1005 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1006 (Arm_dynobj::do_read_symbols): Fix memory leak.
1007 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1008 * target.h: (class Task): Add forward declaration.
1009 (Target::relax): Add new parameter TASK and pass it to
1011 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1016 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1017 object when reading from the file.
1018 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1020 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1021 when reading section contents.
1022 (get_section_contents): Likewise.
1023 (icf::find_identical_sections): Likewise.
1024 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1025 object when reading from the file.
1026 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1027 the object when doing deferred section layout.
1032 * script.h (class Symbol_assignment: name): New member. Returns
1033 the name of the symbol.
1034 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1035 Returns true if the given symbol name is on the list of
1036 assignments wating to be processed.
1037 * archive.cc (should_incldue_member): If the symbol is undefined,
1038 check to see if it is on the list of symbols pending assignment.
1042 * script-sections.cc (Script_sections::find_memory_region): Check
1043 for a NULL output section pointer.
1047 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1048 Output_section::add_relaxed_input_section.
1049 * output.cc (Output_section::add_relaxed_input_section): Add new
1050 arguments LAYOUT and NAME. Set section order index.
1051 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1052 Copy section order index.
1053 * output.h (Output_section::add_relaxed_input_section): Add new
1054 arguments LAYOUT and NAME.
1058 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1059 NATIVE_OR_CROSS_LINKER.
1060 * testsuite/Makefile.in: Regenerate.
1064 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1065 without SHF_LINK_ORDER flags.
1066 * layout.cc (Layout::choose_output_section): Do not filter
1067 SHF_LINK_ORDER flag in a relocatable link.
1071 * output.h (Output_segment::set_section_addresses): Change function
1072 signature. Update all callers.
1073 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1075 (Output_segment::set_section_addresses): Align after last TLS
1076 section. Add padding before last relro section instead of after.
1080 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1081 GOT output section to be writable.
1085 * debug.h (DEBUG_INCREMENTAL): New flag.
1086 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1087 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1089 * incremental.cc (report_command_line): Ignore all forms of
1091 * layout.cc (Layout::Layout): Check parameters for incremental link
1093 * options.cc (General_options::parse_incremental): New function.
1094 (General_options::parse_no_incremental): New function.
1095 (General_options::parse_incremental_full): New function.
1096 (General_options::parse_incremental_update): New function.
1097 (General_options::incremental_mode_): New data member.
1098 (General_options::finalize): Check incremental_mode_.
1099 * options.h (General_options): Update help text for --incremental.
1100 Add --no-incremental, --incremental-full, --incremental-update.
1101 (General_options::Incremental_mode): New enum type.
1102 (General_options::incremental_mode): New function.
1103 (General_options::incremental_mode_): New data member.
1104 * parameters.cc (Parameters::incremental_mode_): New data member.
1105 (Parameters::set_options): Set incremental_mode_.
1106 (Parameters::set_incremental_full): New function.
1107 (Parameters::incremental): New function.
1108 (Parameters::incremental_update): New function.
1109 (set_parameters_incremental_full): New function.
1110 * parameters.h (Parameters::set_incremental_full): New function.
1111 (Parameters::incremental): New function.
1112 (Parameters::incremental_update): New function.
1113 (Parameters::incremental_mode_): New data member.
1114 (set_parameters_incremental_full): New function.
1115 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1116 incremental link mode.
1117 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1118 (Sized_relobj::do_relocate_sections): Likewise.
1119 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1121 * testsuite/Makefile.in: Regenerate.
1122 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1126 * script-sections.h (class Script_sections): Make
1127 Sections_elements typedef public.
1128 * script-sections.cc (class Sort_output_sections): Add elements_
1129 field. Add constructor which sets it; change all callers.
1130 (Sort_output_sections::is_before): New function.
1131 (Sort_output_sections::operator()): Call is_before.
1132 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1134 * testsuite/script_test_10.sh: New test. Test script section
1136 * testsuite/script_test_10.t: Likewise.
1137 * testsuite/script_test_10.s: Likewise.
1138 * testsuite/Makefile.am: Wrap the cross linker tests and the
1139 common tests into NATIVE_OR_CROSS_LINKER.
1140 (check_SCRIPTS): Add script_test_10.sh.
1141 (check_DATA): Add script_test_10.stdout.
1142 (script_test_10.o, script_test_10): New targets.
1143 (script_test_10.stdout): New target.
1144 * configure, testsuite/Makefile.in: Regenerate.
1148 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1149 error for the deprecated relocations.
1150 (Target_arm::Scan::global): Likewise.
1151 (Target_arm::Relocate::relocate): Likewise.
1155 * fileread.cc (Input_file::find_file): Initialize *found_name
1156 and *namep when using the fallback search for case 4.
1160 * options.h (class General_options): Redefine -z lazy as an alias for
1161 the negation of -z now.
1165 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1170 * script-sections.cc(class Memory_region): Remove
1171 current_lma_offset_ field. Rename current_vma_offset_ to
1172 current_offset_. Add last_section_ field.
1173 (Memory_region::get_current_vma_address): Rename to
1174 get_current_address.
1175 (Memory_region::get_current_lma_address): Delete.
1176 (Memory_region::increment_vma_offset): Rename to
1178 (Memory_region::increment_lma_offset): Delete.
1179 (Memory_region::attributes_compatible): New method. Returns
1180 true if the provided section is compatible with the region.
1181 (Memory_region::get_last_section): New method. Returns the last
1182 section to use the region.
1183 (Memory_region::set_last_section): New method. Stores the last
1184 section to use the region.
1185 (Script_sections::block_in_region): New method. Returns true if
1186 a block of memory is contained within a region.
1187 (Script_sections::find_memory_region): New method. Locates a
1188 memory region to be used to set a VMA or LMA address.
1189 (Output_section_definition::set_section_addresses): Add code to
1190 check for addresses set by memory regions.
1191 (Output_segment::set_section_addresses): Remove memory region
1193 (Script_sections::create_segment): Add a warning if a header
1194 segment is created outside of any region.
1195 * script-sections.h (class Script_sections): Add prototypes for
1196 find_memory_region and block_in_region methods.
1197 * testsuite/memory_test.s: Use .long instead of .word.
1198 * testsuite/memory_test.t: Add some more output sections.
1199 * testsuite/memory_test.sh: Update expected output.
1203 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1204 defintion to symtab.h
1205 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1206 declaration to defintion.
1210 * expression.cc (eval): Replace dummy argument with NULL.
1211 (eval_maybe_dot): Check for a NULL result section pointer.
1212 (Symbol_expression::value): Likewise.
1213 (Dot_expression::value): Likewise.
1214 (BINARY_EXPRESSION): Likewise.
1215 (Max_expression::value): Likewise.
1216 (Min_expression::value): Likewise.
1217 (Absolute_expression::value): Likewise.
1218 (Addr_expression::value_from_output_section): Likewise.
1219 (Loaddddr_expression::value_from_output_section): Likewise.
1220 (Segment_start_expression::value): Likewise.
1221 * script-sections.cc
1222 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1224 (Sections_elememt_dot_assignment::set_section_addresses):
1226 (Output_data_expression::do_write_to_buffer): Likewise.
1227 (Output_section_definition::finalize_symbols): Likewise.
1228 (Output_section_definition::set_section_addresses): Likewise.
1232 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1236 * target.h (Target::can_icf_inline_merge_sections): New virtual
1238 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1240 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1242 * icf.cc (get_section_contents): Inline merge sections only when
1247 * configure: Regenerate.
1251 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1252 * testsuite/Makefile.am (memory_test.o): New target.
1253 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1255 * testsuite/Makefile.in: Rebuild.
1259 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1260 defintion if relocation uses GOT entries of the symbol.
1261 * testsuite/icf_safe_test.sh: Fix test.
1262 * testsuite/icf_safe_so_test.sh: Fix test.
1266 * script_sections.cc (class Memory_region): Remove "NULL" from
1267 vector initializations.
1271 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1272 Resolve forwarding symbols.
1276 * gold/testsuite/script_test_3.t: Add ARM special sections.
1277 * gold/testsuite/script_test_4.t: Same.
1278 * gold/testsuite/script_test_5.t: Same.
1279 * gold/testsuite/script_test_6.t: Same.
1280 * gold/testsuite/script_test_7.t: Same.
1281 * gold/testsuite/script_test_7.t: Same.
1282 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1286 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1287 (Target_x86_64::Relocate::relocate_tls): Replace check for
1288 saw_tls_block_reloc_ with test for executable section.
1292 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1293 position-independent executables to shared libraries need dynamic
1295 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1296 position-independent executables.
1297 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1298 * testsuite/Makefile.in: Regenerate.
1303 * testsuite/memory_test.t: Discard any sections that are not
1309 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1310 "This::" to work around a bug in gcc 4.2.
1312 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1316 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1317 sections with different PF_X flags in the same segment.
1318 (Layout::find_first_load_seg): Search all segments to find the first
1320 * options.h (rosegment): New.
1324 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1328 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1329 (Arm_relobj::do_relocate_sections): Add new parameter for output
1330 file to match the parent.
1331 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1332 of local symbols instead of input values. Update code to track
1333 changes in gold::relocate_section.
1334 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1335 (Sized_relobj::compute_final_local_value_internal): New methods.
1336 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1337 body into private version of Sized_relobj::compute_final_local_value.
1338 Call the inline method.
1339 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1340 merged symbol value if there is one.
1341 (Symbol_value::has_output_value): New method defintiion.
1342 (Sized_relobj::Compute_final_local_value_status): New enum type.
1343 (Sized_relobj::compute_final_local_value): New methods.
1344 (Sized_relobj::compute_final_local_value_internal): New methods.
1345 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1346 and arm_cortex_a8.sh.
1347 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1348 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1350 * Makefile.in: Regenerate.
1351 * testsuite/arm_bl_out_of_range.s: Update test.
1352 * testsuite/thumb_bl_out_of_range.s: Ditto.
1353 * testsuite/thumb_blx_out_of_range.s: Ditto.
1354 * testsuite/arm_branch_out_of_range.sh: New file.
1355 * testsuite/arm_cortex_a8.sh: Ditto.
1356 * testsuite/arm_cortex_a8_b.s: Ditto.
1357 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1358 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1359 * testsuite/arm_cortex_a8_bl.s: Ditto.
1360 * testsuite/arm_cortex_a8_blx.s: Ditto.
1361 * testsuite/arm_cortex_a8_local.s: Ditto.
1362 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1363 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1367 * Makefile.am (memory_test.stdout): Run readelf with -W.
1368 * Makefile.in: Regenerate.
1369 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1374 * script-sections.cc (Script_sections::add_memory_region): Convert
1375 field precision to int.
1376 * script.cc (script_set_section_region, script_set_section_region):
1377 Convert field precision to int.
1381 * arm.cc (do_finalize_sections): Create the __exidx_start and
1382 __exdix_end symbols even when the section is missing.
1386 * README: Remove claim that MEMORY is not supported.
1387 * expression.cc (script_exp_function_origin)
1388 (script_exp_function_length): Move from here to ...
1389 * script.cc: ... here.
1390 (script_set_section_region, script_add_memory)
1391 (script_parse_memory_attr, script_include_directive): New
1393 * script-sections.cc
1394 (class Memory_region): New class.
1395 (class Output_section_definition): Add set_memory_region,
1396 set_section_vma, set_section_lma and get_section_name methods.
1397 (class Script_Sections): Add add_memory_region,
1398 find_memory_region, find_memory_region_origin,
1399 find_memory_region_length and set_memory_region methods.
1400 Have set_section_addresses method walk the list of set memory
1402 Extend the print methos to display memory regions.
1403 * script-sections.h: Add prototypes for new methods.
1404 Add enum for MEMORY region attributes.
1405 * yyscript.y: Add support for parsing MEMORY regions.
1406 * script-c.h: Add prototypes for new functions.
1407 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1408 * testsuite/Makefile.in: Regenerate.
1409 * testsuite/memory_test.sh: New script.
1410 * testsuite/memory_test.s: New assembler source file.
1411 * testsuite/memory_test.t: New linker script.
1415 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1416 reference override an existing dynamic weak reference.
1417 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1418 * testsuite/Makefile.in: Regenerate.
1419 * testsuite/dyn_weak_ref.sh: New file.
1420 * testsuite/dyn_weak_ref_1.c: Ditto.
1421 * testsuite/dyn_weak_ref_2.c: Ditto.
1425 * incremental.h (class Incremental_input_entry): Add virtual
1430 * testsuite/start_lib_test_3.c: Mark t3 as used.
1434 * options.cc (version_script): Fix small typo in previous
1439 * archive.cc: Formatting fixes: Remove whitespace between
1440 typename and following asterisk. Remove whitespace between
1441 function name and opening parenthesis.
1442 * archive.h: Likewise.
1444 * attributes.cc: Likewise.
1445 * attributes.h: Likewise.
1446 * common.cc: Likewise.
1447 * copy-relocs.cc: Likewise.
1448 * dirsearch.h: Likewise.
1449 * dynobj.cc: Likewise.
1450 * ehframe.cc: Likewise.
1451 * ehframe.h: Likewise.
1452 * expression.cc: Likewise.
1453 * fileread.cc: Likewise.
1454 * fileread.h: Likewise.
1456 * gold-threads.cc: Likewise.
1457 * gold.cc: Likewise.
1458 * i386.cc: Likewise.
1460 * incremental-dump.cc: Likewise.
1461 * incremental.cc: Likewise.
1462 * layout.cc: Likewise.
1463 * layout.h: Likewise.
1464 * main.cc: Likewise.
1465 * merge.cc: Likewise.
1466 * merge.h: Likewise.
1467 * object.cc: Likewise.
1468 * object.h: Likewise.
1469 * options.cc: Likewise.
1470 * options.h: Likewise.
1471 * output.cc: Likewise.
1472 * output.h: Likewise.
1473 * plugin.cc: Likewise.
1474 * plugin.h: Likewise.
1475 * powerpc.cc: Likewise.
1476 * reloc.cc: Likewise.
1477 * script-c.h: Likewise.
1478 * script-sections.cc: Likewise.
1479 * script.cc: Likewise.
1480 * stringpool.cc: Likewise.
1481 * symtab.cc: Likewise.
1482 * symtab.h: Likewise.
1483 * target.cc: Likewise.
1484 * timer.cc: Likewise.
1485 * timer.h: Likewise.
1486 * version.cc: Likewise.
1487 * x86_64.cc: Likewise.
1492 * layout.cc (segment_precedes): Sort segments by their physical
1493 addresses, if they have been set.
1497 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1499 (Lib_group::include_member): Unlock object after deleting its
1501 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1507 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1508 constructor, and set_blocker.
1509 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1511 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1512 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1513 * testsuite/Makefile.am (start_lib_test): New test case.
1514 * testsuite/Makefile.in: Regenerate.
1515 * testsuite/start_lib_test_main.c: New file.
1516 * testsuite/start_lib_test_1.c: New file.
1517 * testsuite/start_lib_test_2.c: New file.
1518 * testsuite/start_lib_test_3.c: New file.
1522 * Makefile.in: Rebuild with automake 1.11.1.
1523 * aclocal.m4: Likewise.
1524 * testsuite/Makefile.in: Likewise.
1529 * i386.cc (class Output_data_plt_i386): Update declarations.
1530 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1531 local_ifuncs_ fields.
1532 (Target_i386::do_plt_section_for_global): New function.
1533 (Target_i386::do_plt_section_for_local): New function.
1534 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1535 parameter; change all callers. Initialize global_ifuncs_ and
1536 local_ifuncs_. If doing a static link define __rel_iplt_start and
1538 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1539 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1540 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1542 (Target_i386::make_plt_section): New function, broken out of
1543 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1544 (Target_i386::make_plt_entry): Call make_plt_section.
1545 (Target_i386::make_local_ifunc_plt_entry): New function.
1546 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1547 (Target_i386::Scan::local): Handle IFUNC symbols. Add
1548 R_386_IRELATIVE to switch.
1549 (Target_i386::Scan::global): Likewise.
1550 (Target_i386::Relocate::relocate): Likewise.
1551 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1553 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1554 (Target_x86_64::do_plt_section_for_global): New function.
1555 (Target_x86_64::do_plt_section_for_local): New function.
1556 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1557 parameter; change all callers. If doing a static link define
1558 __rela_iplt_start and __rela_iplt_end.
1559 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1560 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1561 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1563 (Target_x86_64::make_local_ifunc_plt_entry): New function.
1564 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1566 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1567 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
1568 R_X86_64_IRELATIVE to switch.
1569 (Target_x86_64::Scan::global): Likewise.
1570 (Target_x86_64::Relocate::relocate): Likewise.
1571 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1573 * target.h (class Target): Add plt_section_for_global and
1574 plt_section_for_local functions. Add do_plt_section_for_global
1575 and do_plt_section_for_local virtual functions.
1576 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
1577 clarifying comments.
1578 (Symbol::use_plt_offset): Handle IFUNC symbol.
1579 * object.cc (Sized_relobj::Sized_relobj): Initialize
1581 (Sized_relobj::local_has_plt_offset): New function.
1582 (Sized_relobj::local_plt_offset): New function.
1583 (Sized_relobj::set_local_plt_offset): New function.
1584 (Sized_relobj::do_count): Handle IFUNC symbol.
1585 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
1586 a bit away from input_shndx_ field. Add set_is_func_symbol and
1587 is_ifunc_symbol functions.
1588 (class Sized_relobj): Update declarations. Remove Tls_got_entry
1589 and Local_tls_got_offsets. Define Local_plt_offsets. Add
1590 local_plt_offsets_ field.
1591 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1592 * output.h (class Output_section_data): Add non-const
1593 output_section function.
1594 (class Output_data_got): Update declarations.
1595 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1596 Add use_plt_offset parameter to global and local constructors.
1597 Change all callers. Change local_sym_index_ field to 31 bits.
1598 Change GSYM_CODE and CONSTANT_CODE accordingly.
1599 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1600 doing a static link don't set sh_link field.
1601 (Output_data_got::Got_entry::write): Use PLT offset if
1603 (Output_data_got::add_global_plt): New function.
1604 (Output_data_got::add_local_plt): New function.
1605 * target-reloc.h (relocate_section): Handle IFUNC symbol.
1606 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1607 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1608 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1609 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1611 * testsuite/ifunc-sel.h: New file.
1612 * testsuite/ifuncmain1.c: New file.
1613 * testsuite/ifuncmain1vis.c: New file.
1614 * testsuite/ifuncmod1.c: New file.
1615 * testsuite/ifuncdep2.c: New file.
1616 * testsuite/ifuncmain2.c: New file.
1617 * testsuite/ifuncmain3.c: New file.
1618 * testsuite/ifuncmod3.c: New file.
1619 * testsuite/ifuncmain4.c: New file.
1620 * testsuite/ifuncmain5.c: New file.
1621 * testsuite/ifuncmod5.c: New file.
1622 * testsuite/ifuncmain6pie.c: New file.
1623 * testsuite/ifuncmod6.c: New file.
1624 * testsuite/ifuncmain7.c: New file.
1625 * configure, testsuite/Makefile.in: Rebuild.
1630 (Output_section_incremental_inputs::write_input_files): Add cast
1631 to avoid signed/unsigned comparison warning.
1632 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1636 * common.cc (Sort_commons::operator()): Remove unnecessary code.
1640 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1645 * resolve.cc (Symbol_table::should_override): When a weak dynamic
1646 defintion overrides non-weak undef, remember that the original undef
1648 * symtab.cc (Symbol_table::sized_write_global): For undef without
1649 an original weak binding, set binding to global in output.
1650 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1651 * testsuite/Makefile.in: Regenerate.
1652 * testsuite/strong_ref_weak_def.sh: New file.
1653 * testsuite/strong_ref_weak_def_1.c: Ditto.
1654 * testsuite/strong_ref_weak_def_2.c: Ditto.
1658 * testsuite/incremental_test.sh: Rewrite.
1659 * testsuite/incremental_test_1.c: Rewrite.
1660 * testsuite/incremental_test_2.c: Rewrite.
1664 * arm.cc (Target_arm::got_size): Add const.
1665 (Target_arm::got_entry_count): New function.
1666 (Target_arm::plt_entry_count): New function.
1667 (Target_arm::first_plt_entry_offset): New function.
1668 (Target_arm::plt_entry_size): New function.
1669 (Output_data_plt_arm::entry_count): New function.
1670 (Output_data_plt_arm::first_plt_entry_offset): New function.
1671 (Output_data_plt_arm::get_plt_entry_size): New function.
1672 * i386.cc (Target_i386::got_size): Add const.
1673 (Target_i386::got_entry_count): New function.
1674 (Target_i386::plt_entry_count): New function.
1675 (Target_i386::first_plt_entry_offset): New function.
1676 (Target_i386::plt_entry_size): New function.
1677 (Output_data_plt_i386::entry_count): New function.
1678 (Output_data_plt_i386::first_plt_entry_offset): New function.
1679 (Output_data_plt_i386::get_plt_entry_size): New function.
1680 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1681 find_incremental_inputs_sections. Dump incremental_got_plt section.
1682 * incremental.cc: Include target.h.
1683 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1684 parameter. Adjust all callers. Find incremental_got_plt section.
1685 (Incremental_inputs::create_data_sections): Create incremental_got_plt
1687 (Output_section_incremental_inputs::set_final_data_size): Calculate
1688 size of incremental_got_plt section.
1689 (Output_section_incremental_inputs::do_write): Write the
1690 incremental_got_plt section.
1691 (Got_plt_view_info): New struct.
1692 (Local_got_offset_visitor): New class.
1693 (Global_got_offset_visitor): New class.
1694 (Global_symbol_visitor_got_plt): New class.
1695 (Output_section_incremental_inputs::write_got_plt): New function.
1696 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1697 Add parameter. Adjust all callers.
1698 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1699 (Incremental_inputs::got_plt_section): New function.
1700 (Incremental_inputs::got_plt_section_): New data member.
1701 (Incremental_got_plt_reader): New class.
1702 * layout.cc (Layout::create_incremental_info_sections): Add the
1703 incremental_got_plt section.
1704 * object.h (Got_offset_list::get_list): New function.
1705 (Got offset_list::for_all_got_offsets): New function.
1706 (Sized_relobj::local_got_offset_list): New function.
1707 * powerpc.cc (Target_powerpc::got_size): Add const.
1708 (Target_powerpc::got_entry_count): New function.
1709 (Target_powerpc::plt_entry_count): New function.
1710 (Target_powerpc::first_plt_entry_offset): New function.
1711 (Target_powerpc::plt_entry_size): New function.
1712 (Output_data_plt_powerpc::entry_count): New function.
1713 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1714 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1715 * sparc.cc (Target_sparc::got_size): Add const.
1716 (Target_sparc::got_entry_count): New function.
1717 (Target_sparc::plt_entry_count): New function.
1718 (Target_sparc::first_plt_entry_offset): New function.
1719 (Target_sparc::plt_entry_size): New function.
1720 (Output_data_plt_sparc::entry_count): New function.
1721 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1722 (Output_data_plt_sparc::get_plt_entry_size): New function.
1723 * symtab.h (Symbol::got_offset_list): New function.
1724 (Symbol_table::for_all_symbols): New function.
1725 * target.h (Sized_target::got_entry_count): New function.
1726 (Sized_target::plt_entry_count): New function.
1727 (Sized_target::plt_entry_size): New function.
1728 * x86_64.cc (Target_x86_64::got_size): Add const.
1729 (Target_x86_64::got_entry_count): New function.
1730 (Target_x86_64::plt_entry_count): New function.
1731 (Target_x86_64::first_plt_entry_offset): New function.
1732 (Target_x86_64::plt_entry_size): New function.
1733 (Output_data_plt_x86_64::entry_count): New function.
1734 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1735 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1739 * archive.cc: Include incremental.h.
1740 (Archive::Archive): Initialize incremental_info_.
1741 (Archive::include_member): Record archive members in incremental info.
1742 (Add_archive_symbols::run): Record begin and end of an archive in
1744 (Lib_group::include_member): Record objects in incremental info.
1745 * archive.h (Incremental_archive_entry): Forward declaration.
1746 (Archive::set_incremental_info): New member function.
1747 (Archive::incremental_info): New member function.
1748 (Archive::Unused_symbol_iterator): New class.
1749 (Archive::unused_symbols_begin): New member function.
1750 (Archive::unused_symbols_end): New member function.
1751 (Archive::incremental_info_): New data member.
1752 * incremental-dump.cc (find_input_containing_global): New function.
1753 (dump_incremental_inputs): Dump new incremental info sections.
1754 * incremental.cc: Include symtab.h.
1755 (Output_section_incremental_inputs): New class.
1756 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1757 new incremental info sections.
1758 (Sized_incremental_binary::do_check_inputs): Likewise.
1759 (Incremental_inputs::report_archive): Remove.
1760 (Incremental_inputs::report_archive_begin): New function.
1761 (Incremental_inputs::report_archive_end): New function.
1762 (Incremental_inputs::report_object): New function.
1763 (Incremental_inputs::finalize_inputs): Remove.
1764 (Incremental_inputs::report_input_section): New function.
1765 (Incremental_inputs::report_script): Rewrite.
1766 (Incremental_inputs::finalize): Do nothing but finalize string table.
1767 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1768 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1769 (Incremental_inputs::create_data_sections): New function.
1770 (Incremental_inputs::relocs_entsize): New function.
1771 (Output_section_incremental_inputs::set_final_data_size): New function.
1772 (Output_section_incremental_inputs::do_write): New function.
1773 (Output_section_incremental_inputs::write_header): New function.
1774 (Output_section_incremental_inputs::write_input_files): New function.
1775 (Output_section_incremental_inputs::write_info_blocks): New function.
1776 (Output_section_incremental_inputs::write_symtab): New function.
1777 * incremental.h (Incremental_script_entry): Forward declaration.
1778 (Incremental_object_entry): Forward declaration.
1779 (Incremental_archive_entry): Forward declaration.
1780 (Incremental_inputs): Forward declaration.
1781 (Incremental_inputs_header_data): Remove.
1782 (Incremental_inputs_header): Remove.
1783 (Incremental_inputs_header_write): Remove.
1784 (Incremental_inputs_entry_data): Remove.
1785 (Incremental_inputs_entry): Remove.
1786 (Incremental_inputs_entry_write): Remove.
1787 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1788 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1789 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1790 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1792 (Incremental_input_entry): New class.
1793 (Incremental_script_entry): New class.
1794 (Incremental_object_entry): New class.
1795 (Incremental_archive_entry): New class.
1796 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1797 (Incremental_inputs::report_inputs): Remove.
1798 (Incremental_inputs::report_archive): Remove.
1799 (Incremental_inputs::report_archive_begin): New function.
1800 (Incremental_inputs::report_archive_end): New function.
1801 (Incremental_inputs::report_object): Change prototype.
1802 (Incremental_inputs::report_input_section): New function.
1803 (Incremental_inputs::report_script): Change prototype.
1804 (Incremental_inputs::get_reloc_count): New function.
1805 (Incremental_inputs::set_reloc_count): New function.
1806 (Incremental_inputs::create_data_sections): New function.
1807 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1808 (Incremental_inputs::inputs_section): New function.
1809 (Incremental_inputs::symtab_section): New function.
1810 (Incremental_inputs::relocs_section): New function.
1811 (Incremental_inputs::get_stringpool): Add const.
1812 (Incremental_inputs::command_line): Add const.
1813 (Incremental_inputs::inputs): Remove.
1814 (Incremental_inputs::command_line_key): New function.
1815 (Incremental_inputs::input_file_count): New function.
1816 (Incremental_inputs::input_files): New function.
1817 (Incremental_inputs::relocs_entsize): New function.
1818 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1819 (Incremental_inputs::finalize_inputs): Remove.
1820 (Incremental_inputs::Input_info): Remove.
1821 (Incremental_inputs::lock_): Remove.
1822 (Incremental_inputs::inputs_): Change type.
1823 (Incremental_inputs::inputs_map_): Remove.
1824 (Incremental_inputs::current_object_entry_): New data member.
1825 (Incremental_inputs::inputs_section_): New data member.
1826 (Incremental_inputs::symtab_section_): New data member.
1827 (Incremental_inputs::relocs_section_): New data member.
1828 (Incremental_inputs::reloc_count_): New data member.
1829 (Incremental_inputs_reader): New class.
1830 (Incremental_symtab_reader): New class.
1831 (Incremental_relocs_reader): New class.
1832 * layout.cc (Layout::finalize): Move finalization of incremental info
1833 and creation of incremental info sections to follow finalization of
1834 symbol table. Set offsets for postprocessing sections.
1835 (Layout::create_incremental_info_sections): Call
1836 Incremental_inputs::create_data_sections. Add incremental symtab
1837 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1838 sections to layout after input sections.
1839 * layout.h (struct Timespec): Forward declaration.
1840 (Layout::incremental_inputs): Add const.
1841 (Layout::create_incremental_info_sections): Add parameter.
1842 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1843 * object.cc: Include incremental.h.
1844 (Relobj::finalize_incremental_relocs): New function.
1845 (Sized_relobj::do_layout): Record input sections in incremental info.
1846 * object.h (Object::output_section): New function.
1847 (Object::output_section_offset): Moved from Relobj.
1848 (Object::get_incremental_reloc_base): New function.
1849 (Object::get_incremental_reloc_count): New function.
1850 (Object::do_output_section): New function.
1851 (Object::do_output_section_offset): Moved from Relobj.
1852 (Object::do_get_incremental_reloc_base): New function.
1853 (Object::do_get_incremental_reloc_count): New function.
1854 (Object::Object): Initialize new data members.
1855 (Relobj::output_section): Renamed do_output_section and moved to
1857 (Relobj::output_section_offset): Moved to Object.
1858 (Relobj::do_get_incremental_reloc_base): New function.
1859 (Relobj::do_get_incremental_reloc_count): New function.
1860 (Relobj::allocate_incremental_reloc_counts): New function.
1861 (Relobj::count_incremental_reloc): New function.
1862 (Relobj::finalize_incremental_relocs): New function.
1863 (Relobj::next_incremental_reloc_index): New function.
1864 (Relobj::reloc_counts_): New data member.
1865 (Relobj::reloc_bases_): New data member.
1866 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
1867 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
1868 (Sized_relobj::incremental_relocs_scan): New function.
1869 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1870 (Sized_relobj::incremental_relocs_write): New function.
1871 (Sized_relobj::incremental_relocs_write_reltype): New function.
1872 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1874 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1875 archives and object files elsewhere.
1876 (Add_symbols::run): Report object files here.
1877 (Finish_group::run): Report end of archive at end of group.
1878 * reloc.cc: Include layout.h, incremental.h.
1879 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1880 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1881 (Sized_relobj::incremental_relocs_scan): New function.
1882 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1883 (Sized_relobj::do_relocate_sections): Write incremental relocations.
1884 (Sized_relobj::incremental_relocs_write): New function.
1885 (Sized_relobj::incremental_relocs_write_reltype): New function.
1886 * script.cc (read_input_script): Rewrite test for incremental link.
1887 Change call to Incremental_inputs::report_script.
1888 * symtab.h (Symbol_table::first_global_index): New function.
1889 (Symbol_table::output_count): New function.
1893 * arm.cc (Target_arm::merge_object_attributes): Check command line
1894 options --no-wchar-size-warning and --no-enum-size-warning.
1895 * options.h (General_options): Add ld-compatible options
1896 --no-enum-size-warning and --no-wchar-size-warning.
1900 * x86_64.cc (Target_x86_64::Scan::local): Use
1901 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1902 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1903 (Target_x86_64::Scan::global): Likewise.
1904 (Target_x86_64::Relocate::relocate): Likewise.
1905 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1910 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1911 to reserve space in merged_strings vector. Keep total input size
1913 (Output_merge_string::do_print_merge_stats): Print total input size.
1914 * merge.h (Output_merge_string): Add input_size_ field.
1915 * stringpool.cc (Stringpool_template::string_length): Move
1916 implementations out of Stringpool_template class and place in
1918 * stringpool.h (string_length): Move out of Stringpool_template.
1923 * layout.cc (relaxation_loop_body): If address of load segment is
1924 set, adjust address to include headers if possible.
1928 * version.cc (version_string): Bump to 1.10.
1933 * layout.h (enum Output_section_order): Define.
1934 (class Layout): Update declarations.
1935 * layout.cc (Layout::get_output_section): Add order parameter.
1936 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1937 is_first_non_relro parameters. Change all callers.
1938 (Layout::choose_output_section): Likewise.
1939 (Layout::add_output_section_data): Likewise.
1940 (Layout::make_output_section): Likewise. Set order.
1941 (Layout::default_section_order): New function.
1942 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1943 * output.cc (Output_section::Output_section): Initialize order_.
1944 Don't initialize deleted fields.
1945 (Output_segment::Output_segment): Don't initialize deleted
1947 (Output_segment::add_output_section_to_load): New function
1948 replacing add_output_section. Change all callers to call this or
1949 add_output_section_to_nonload.
1950 (Output_segment::add_output_section_to_nonload): New function.
1951 (Output_segment::remove_output_section): Rewrite.
1952 (Output_segment::add_initial_output_data): Likewise.
1953 (Output_segment::has_any_data_sections): Likewise.
1954 (Output_segment::is_first_section_relro): Likewise.
1955 (Output_segment::maximum_alignment): Likewise.
1956 (Output_segment::has_dynamic_reloc): New function replacing
1957 dynamic_reloc_count. Change all callers.
1958 (Output_segment::has_dynamic_reloc_list): New function replacing
1959 dynamic_reloc_count_list. Change all callers.
1960 (Output_segment::set_section_addresses): Rewrite.
1961 (Output_segment::set_offset): Rewrite.
1962 (Output_segment::find_first_and_last_list): Remove.
1963 (Output_segment::set_tls_offsets): Rewrite.
1964 (Output_segment::first_section_load_address): Likewise.
1965 (Output_segment::output_section_count): Likewise.
1966 (Output_segment::section_with_lowest_load_address): Likewise.
1967 (Output_segment::write_section_headers): Likewise.
1968 (Output_segment::print_sections_to_map): Likewise.
1969 * output.h (class Output_data): Remove dynamic_reloc_count_
1970 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
1971 (Output_data::add_dynamic_reloc): Rewrite.
1972 (Output_data::has_dynamic_reloc): New function.
1973 (Output_data::dynamic_reloc_count): Remove.
1974 (class Output_section): Add order_ field. Remvoe is_relro_local_,
1975 is_last_relro_, is_first_non_relro_, is_interp_,
1976 is_dynamic_linker_section_ fields. Add order and set_order
1977 functions. Remove is_relro_local, set_is_relro_local,
1978 is_last_relro, set_is_last_relro, is_first_non_relro,
1979 set_is_first_non_relro functions, is_interp, set_is_interp,
1980 is_dynamic_linker_section, and set_is_dynamic_linker_section
1982 (class Output_segment): Change Output_data_list from std::list to
1983 std:;vector. Add output_lists_ field. Remove output_data_ and
1984 output_bss_ fields. Update declarations.
1988 * arm.cc (Target_arm::gc_process_relocs): Use typename.
1989 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
1990 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
1995 * script.cc (Script_options::Script_options): Initialize
1996 symbol_definitions_ and symbol_references_.
1997 (Script_options::add_symbol_assignment): Update
1998 symbol_definitions_ and symbol_references_.
1999 (Script_options::add_symbol_reference): New function.
2000 (script_symbol): New function.
2001 * script.h (class Script_options): Add symbol_definitions_ and
2002 symbol_references_ fields.
2003 (Script_options::referenced_const_iterator): New type.
2004 (Script_options::referenced_begin): New function.
2005 (Script_options::referenced_end): New function.
2006 (Script_options::is_referenced): New function.
2007 (Script_options::any_unreferenced): New function.
2008 * script-c.h (script_symbol): Declare.
2009 * yyscript.y (exp): Call script_symbol.
2010 * symtab.cc: Include "script.h".
2011 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2012 Change all callers. Check symbols referenced by scripts.
2013 (Symbol_table::add_undefined_symbols_from_command_line): Add
2014 layout parameter. Change all callers.
2015 (Symbol_table::do_add_undefined_symbols_from_command_line):
2016 Likewise. Break out loop body. Check symbols referenced by
2018 (Symbol_table::add_undefined_symbol_from_command_line): New
2019 function broken out of
2020 do_add_undefined_symbols_from_command_line.
2021 * symtab.h (class Symbol_table): Update declarations.
2022 * archive.cc: Include "layout.h".
2023 (Archive::should_include_member): Add layout parameter. Change
2024 all callers. Check for symbol mentioned in expression.
2025 * archive.h (class Archive): Update declaration.
2026 * object.cc (Sized_relobj::do_should_include_member): Add layout
2028 * object.h (Object::should_include_member): Add layout parameter.
2030 (Object::do_should_include_member): Add layout parameter.
2031 (class Sized_relobj): Update declaration.
2032 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2034 * dynobj.h (class Sized_dynobj): Update declaration.
2035 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2037 * plugin.h (class Sized_pluginobj): Update declaration.
2042 * output.cc (Output_segment::set_offset): Search for the first and
2043 last sections rather than assuming that the list is in order.
2044 (Output_segment::find_first_and_last_list): New function.
2045 * output.h (class Output_segment): Update declarations.
2046 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2047 (relro_strip_test_SOURCES): New variable.
2048 (relro_strip_test_DEPENDENCIES): New variable.
2049 (relro_strip_test_LDFLAGS): New variable.
2050 (relro_strip_test_LDADD): New variable.
2051 (relro_strip_test.so): New target.
2055 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2056 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2057 (Target_i386::got_tlsdesc_section): New function.
2058 (Target_i386::got_section): Create space for GOT entries for
2059 TLSDESC relocations.
2060 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2062 (Target_i386::Scan::global): Likewise.
2063 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2065 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2066 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2067 (Target_x86_64::got_tlsdesc_section): New function.
2068 (Target_x86_64::got_section): Create space for GOT entries for
2069 TLSDESC relocations.
2070 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2072 (Target_x86_64::Scan::global): Likewise.
2073 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2078 * testsuite/final_layout.sh: Use dc to convert from hex to
2083 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2084 paramter to the call to gold::gc_process_relocs.
2085 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2086 paramter to the call to gold::gc_process_relocs.
2087 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2088 parameter to the call to gold::gc_process_relocs.
2089 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2090 template parameter to the call to gold::gc_process_relocs.
2091 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2092 paramter to the call to gold::gc_process_relocs.
2093 * gc.h (get_embedded_addend_size): New function.
2094 (gc_process_relocs): Save the size of the reloc for use by ICF.
2095 * icf.cc (get_section_contents): Get the addend from the text section
2096 for SHT_REL relocation sections.
2097 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2098 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2099 * int_encoding.h (read_from_pointer): New overloaded function.
2100 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2101 * testsuite/icf_sht_rel_addend_test.sh: New file.
2102 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2103 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2107 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2108 * Makefile.in: Regenerate.
2109 * testsuite/Makefile.in: Regenerate.
2113 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2114 * gold/testsuite/debug_msg.cc: Likewise.
2115 * gold/testsuite/odr_violation1.cc
2116 * gold/testsuite/odr_violation2.cc
2120 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2121 string, and length fields.
2122 (Output_merge_string::Merged_strings_list): New type.
2123 (Output_merge_string::Merged_strings_lists): New typedef.
2124 (Output_merge_string): Replace merged_strings_ with
2125 merged_strings_lists_.
2126 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2127 Merged_strings_list per input object and section. Don't store pointer
2128 to the string. Don't store length with each merged string entry.
2129 (Output_merge_string::finalize_merged_data): Loop over list of merged
2130 strings lists. Recompute length of each merged string.
2134 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2139 * descriptors.cc (Descriptors::open): Report correct name in error
2144 * arm.cc (Arm_input_section::Arm_input_section): For a
2145 SHT_ARM_EXIDX section, always keeps the input sections.
2146 (Arm_input_section::set_exidx_section_link): New method.
2147 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2148 has_errors_ to false.
2149 (Arm_exidx_input_section::has_errors,
2150 Arm_exidx_input_section::set_has_errors): New methods.
2151 (Arm_exidx_input_section::has_errors_): New data member.
2152 (Arm_relobj::get_exidx_shndx_list): New method.
2153 (Arm_output_section::append_text_sections_to_list): Do not skip
2154 section without SHF_EXECINSTR.
2155 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2157 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2158 section header. Make error messages more verbose. Check for
2159 a non-executable section linked to an EXIDX section.
2160 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2161 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2162 check that there is no deferred EXIDX section if we exit early.
2163 Instead of not making an EXIDX section in case of an error, make one
2164 and set the has_errors flag of it.
2165 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2166 in a relocatable link.
2167 (Target_arm::do_relax): Look for the EXIDX output section instead of
2168 assuming that it is called .ARM.exidx.
2169 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2170 section list. Do not check for SHF_EXECINSTR section flags but
2171 skip any input section with errors.
2172 * output.cc (Output_section::Output_section): Initialize
2173 always_keeps_input_sections_ to false.
2174 (Output_section::add_input_section): Check for
2175 always_keeps_input_sections_.
2176 * output.h (Output_section::always_keeps_input_sections,
2177 Output_section::set_always_keeps_input_sections): New methods.
2178 (Output_section::always_keeps_input_sections): New data member.
2182 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2183 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2188 * output.h (Output_section_lookup_maps::add_merge_section):
2189 Correct check of whether value was inserted.
2190 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2191 (Output_section_lookup_maps::add_relaxed_input_section):
2193 * arm.cc (Target_arm::got_section): Remove used local os.
2194 * i386.cc (Target_i386::got_section): Likewise.
2195 * x86_64.cc (Target_x86_64::got_section): Likewise.
2196 * sparc.cc (Target_sparc::got_section): Likewise.
2197 (Target_sparc::relocate): Remove unused local have_got_offset.
2198 * powerpc.cc (Target_powerpc::relocate): Likewise.
2202 * compressed_output.cc (zlib_decompress): Fix signature in
2205 * archive.cc (Archive::include_member): Unlock an external member
2206 of a thin archive. Don't bother to delete an object we know is
2211 * compressed_output.cc (zlib_decompress): New function.
2212 (get_uncompressed_size): New function.
2213 (decompress_input_section): New function.
2214 * compressed_output.h (get_uncompressed_size): New function.
2215 (decompress_input_section): New function.
2216 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2217 Handle compressed debug sections.
2218 * layout.cc (is_compressed_debug_section): New function.
2219 (Layout::output_section_name): Map compressed section names to
2221 * layout.h (is_compressed_debug_section): New function.
2222 (is_debug_info_section): Recognize compressed debug sections.
2223 * merge.cc: Include compressed_output.h.
2224 (Output_merge_data::do_add_input_section): Handle compressed
2226 (Output_merge_string::do_add_input_section): Handle compressed
2228 * object.cc: Include compressed_output.h.
2229 (Sized_relobj::Sized_relobj): Initialize new data members.
2230 (build_compressed_section_map): New function.
2231 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2232 * object.h (Object::section_is_compressed): New method.
2233 (Object::do_section_is_compressed): New method.
2234 (Sized_relobj::Compressed_section_map): New type.
2235 (Sized_relobj::do_section_is_compressed): New method.
2236 (Sized_relobj::compressed_sections_): New data member.
2237 * output.cc (Output_section::add_input_section): Handle compressed
2239 * reloc.cc: Include compressed_output.h.
2240 (Sized_relobj::write_sections): Handle compressed debug sections.
2244 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2245 weak when resolving to a dynamic def.
2246 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2247 for weak undef/dynamic def cases. Adjust callers.
2248 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2249 undef_binding_weak_.
2250 (Symbol_table::sized_write_globals): Adjust symbol binding.
2251 (Symbol_table::sized_write_symbol): Add binding parameter.
2252 * symtab.h (Symbol::set_undef_binding): New method.
2253 (Symbol::is_undef_binding_weak): New method.
2254 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2255 (Symbol_table::should_override): Add new parameter.
2256 (Symbol_table::sized_write_symbol): Add new parameter.
2258 * testsuite/weak_undef_file1.cc: Add new test case.
2259 * testsuite/weak_undef_file2.cc: Fix header comment.
2260 * testsuite/weak_undef_test.cc: Add new test case.
2264 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2265 Initialize USE_SYMBOL_.
2266 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2268 (Arm_reloc_property::uses_symbol_): New data member declaration.
2269 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2270 uses symbol value and symbol is undefined but not weakly undefined.
2274 * plugin.cc (Plugin::load): Use dlerror.
2278 * symtab.cc (detect_odr_violations): When reporting an ODR
2279 violation, report an object where the symbol is defined.
2283 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2284 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2286 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2287 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2288 target hook to detect function points.
2289 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2290 * icf.h (Icf::check_section_for_function_pointers): Change type of
2291 parameter SECTION_NAME to const reference to std::string. Use
2292 target hook to determine if section may have unsafe pointers.
2293 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2298 * fileread.cc (Input_file::find_fie): New
2299 (Input_file::open): Use Input_file::find_fie.
2300 * fileread.h (Input_file::find_fie): New
2301 * plugin.cc (set_extra_library_path): New.
2302 (Plugin::load): Add set_extra_library_path to the transfer vector.
2303 (Plugin_manager::set_extra_library_path): New.
2304 (Plugin_manager::add_input_file): Use the extra search path if set.
2305 (set_extra_library_path(): New.
2306 * plugin.h (Plugin_manager): Add set_extra_library_path and
2311 * layout.cc (gdb_sections): Add .debug_types.
2312 (lines_only_debug_sections): Likewise.
2316 * plugin.cc (add_input_file,add_input_library)
2317 (Plugin_manager::add_input_file): Make filename arguments const.
2318 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2323 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2324 .ARM.attributes section if we have not merged any input
2325 attributes sections.
2329 * arm.cc: Allow combining objects with no EABI version
2334 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2338 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2339 (struct iovec): Correct !HAVE_READV definition.
2343 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2344 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2346 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2349 * symtab.h (Symbol::is_placeholder): New member function.
2350 * target-reloc.h (relocate_section): Check for placeholder symbols.
2352 * testsuite/Makefile.am (plugin_test_8): New test.
2353 (plugin_test_9): New test.
2354 * testsuite/Makefile.in: Regenerate.
2358 * yyscript.y (input_list_element): Allow strings prefixed with
2359 the '-' character. Treat these as libraries.
2360 * script.cc (script_add_library): New function. Adds a library
2361 specified by "-l<name>" found in an input script.
2362 * script-c.h: Add prototype for script_add_library.
2366 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2367 Restrict stub-group size to be within long conditional branch
2368 range when working around cortex-A8 erratum.
2372 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2379 (Output_section::Input_section_sort_entry::compare_section_ordering):
2380 Change to return non-zero correctly.
2381 (Output_section::Input_section_sort_section_order_index_compare
2382 ::operator()): Change to fix ambiguity in comparisons.
2386 * gold.h (is_wildcard_string): New function.
2387 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2388 (Layout::layout_eh_frame): Ditto.
2389 (Layout::find_section_order_index): New method.
2390 (Layout::read_layout_from_file): New method.
2391 * layout.h (Layout::find_section_order_index): New method.
2392 (Layout::read_layout_from_file): New method.
2393 (Layout::input_section_position_): New private member.
2394 (Layout::input_section_glob_): New private member.
2395 * main.cc (main): Call read_layout_from_file here.
2396 * options.h (--section-ordering-file): New option.
2397 * output.cc (Output_section::input_section_order_specified_): New
2399 (Output_section::Output_section): Initialize new member.
2400 (Output_section::add_input_section): Add new parameter.
2401 Keep input sections when --section-ordering-file is used.
2402 (Output_section::set_final_data_size): Sort input sections when
2403 section ordering file is specified.
2404 (Output_section::Input_section_sort_entry): Add new parameter.
2406 (Output_section::Input_section_sort_entry::compare_section_ordering):
2408 (Output_section::Input_section_sort_compare::operator()): Change to
2409 consider section_order_index.
2410 (Output_section::Input_section_sort_init_fini_compare::operator()):
2411 Change to consider section_order_index.
2412 (Output_section::Input_section_sort_section_order_index_compare
2413 ::operator()): New method.
2414 (Output_section::sort_attached_input_sections): Change to sort
2415 according to section order when specified.
2416 (Output_section::add_input_section<32, true>): Add new parameter.
2417 (Output_section::add_input_section<64, true>): Add new parameter.
2418 (Output_section::add_input_section<32, false>): Add new parameter.
2419 (Output_section::add_input_section<64, false>): Add new parameter.
2420 * output.h (Output_section::add_input_section): Add new parameter.
2421 (Output_section::input_section_order_specified): New
2423 (Output_section::set_input_section_order_specified): New method.
2424 (Input_section::Input_section): Initialize section_order_index_.
2425 (Input_section::section_order_index): New method.
2426 (Input_section::set_section_order_index): New method.
2427 (Input_section::section_order_index_): New member.
2428 (Input_section::Input_section_sort_section_order_index_compare): New
2430 (Output_section::input_section_order_specified_): New member.
2431 * script-sections.cc (is_wildcard_string): Delete and move modified
2433 (Output_section_element_input::Output_section_element_input): Modify
2434 call to is_wildcard_string.
2435 (Output_section_element_input::Input_section_pattern
2436 ::Input_section_pattern): Ditto.
2437 (Output_section_element_input::Output_section_element_input): Ditto.
2438 * testsuite/Makefile.am (final_layout): New test case.
2439 * testsuite/Makefile.in: Regenerate.
2440 * testsuite/final_layout.cc: New file.
2441 * testsuite/final_layout.sh: New file.
2445 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2449 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2450 visibility of symbols.
2454 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2455 from start of output section instead of address for a local symbol
2456 in a merged or relaxed section when doing a relocatable link.
2461 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2462 adding sections the garbage collector removed.
2463 * gold/testsuite/Makefile.am: Add test.
2464 * gold/testsuite/Makefile.in: Regenerate.
2465 * gold/testsuite/plugin_test_7.sh: New.
2466 * gold/testsuite/plugin_test_7_1.c: New.
2467 * gold/testsuite/plugin_test_7_2.c: New.
2471 * script-sections.cc (Output_section_definition::set_section_addresses):
2472 Check for --section-start.
2476 * arm.cc (Arm_scan_relocatable_relocs): New class.
2477 (Target_arm::relocate_special_relocatable): New method.
2478 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2479 (Arm_relocate_functions::thumb_branch_common): Same.
2480 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2481 instead of Default_scan_relocatable_relocs.
2482 * target-reloc.h (relocate_for_relocatable): Let target handle
2483 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2484 * target.h (Sized_target::relocate_special_relocatable): New method.
2488 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2492 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2494 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2495 with a direct branch, not a conditional branch, to a stub.
2496 * merge.cc (Output_merge_base::record_input_section): New method
2498 (Output_merge_data::do_add_input_section): Record input section if
2499 keeps-input-sections flag is set.
2500 (Output_merge_string::do_add_input_section): Ditto.
2501 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2502 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2504 (Output_merge_base::keeps_input_sections,
2505 Output_merge_base::set_keeps_input_sections,
2506 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2508 (Output_merge_base::Input_sections): New type declaration.
2509 (Output_merge_base::input_sections_begin,
2510 Output_merge_base::input_sections_end,
2511 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2512 (Output_merge_base::bool keeps_input_sections_,
2513 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2514 Output_merge_base::input_sections_): New data members.
2515 (Output_merge_data::do_set_keeps_input_sections): New method
2517 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2518 * output.cc (Output_section::Input_section::relobj): Move method
2519 defintion from class declaration to here and handle merge sections.
2520 (Output_section::Input_section::shndx): Ditto.
2521 (Output_section::Output_section): Remove initializations of removed
2522 data members and initialize new data member LOOKUP_MAPS_.
2523 (Output_section::add_input_section): Set keeps-input-sections flag
2524 for a newly created merge output section as appropriate. Adjust code
2525 to use Output_section_lookup_maps class.
2526 (Output_section::add_relaxed_input_section): Adjst code for lookup
2527 maps code refactoring.
2528 (Output_section::add_merge_input_section): Add a new parameter
2529 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2530 class. If adding input section to a newly created merge output
2531 section fails, remove the new merge section.
2532 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2533 Adjust code for use of the Output_section_lookup_maps class.
2534 (Output_section::find_merge_section): Ditto.
2535 (Output_section::build_lookup_maps): New method defintion.
2536 (Output_section::find_relaxed_input_section): Adjust code to use
2537 Output_section_lookup_maps class.
2538 (Output_section::get_input_sections): Export merge sections. Adjust
2539 code to use Output_section_lookup_maps class.
2540 (Output_section:::add_script_input_section): Adjust code to use
2541 Output_section_lookup_maps class. Update lookup maps for merge
2543 (Output_section::discard_states): Use Output_section_lookup_maps.
2544 (Output_section::restore_states): Same.
2545 * output.h (Merge_section_properties): Move class defintion out of
2547 (Output_section_lookup_maps): New class.
2548 (Output_section::Input_section::is_merge_section): New method
2550 (Output_section::Input_section::relobj): Move defintion out of class
2551 defintion. Declare method only.
2552 (Output_section::Input_section::shndx): Ditto.
2553 (Output_section::Input_section::output_merge_base): New method defintion.
2554 (Output_section::Input_section::u2_.pomb): New union field.
2555 (Output_section::Merge_section_by_properties_map,
2556 Output_section::Output_section_data_by_input_section_map,
2557 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2559 (Output_section::add_merge_input_section): Add new parameter
2560 KEEPS_INPUT_SECTIONS.
2561 (Output_section::build_lookup_maps): New method declaration.
2562 (Output_section::merge_section_map_,
2563 Output_section::merge_section_by_properties_map_,
2564 Output_section::relaxed_input_section_map_,
2565 Output_section::is_relaxed_input_section_map_valid_): Remove data
2567 (Output_section::lookup_maps_): New data member.
2572 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2573 avoid a compilation error.
2577 * script-sections.cc (Output_section_definition::allocate_to_segment):
2578 Update the phdrs_list even when the output section is NULL.
2579 * testsuite/Makefile.am: Add test.
2580 * testsuite/Makefile.in: Regenerate.
2581 * testsuite/script_test_9.cc: New.
2582 * testsuite/script_test_9.sh: New.
2583 * testsuite/script_test_9.t: New.
2587 * arm.cc (Arm_input_section::original_size): New method.
2588 (Arm_input_section::do_addralign): Add a cast.
2589 (Arm_input_section::do_output_offset): Remove static cast.
2590 (Arm_input_section::original_addralign,
2591 Arm_input_section::original_size_): Change type to uint32_t.
2592 (Arm_input_section::init): Add safe casts for section alignment
2594 (Arm_input_section::set_final_data_size): Do not set address and
2595 offset of stub table.
2596 (Arm_output_section::fix_exidx_coverage): Change use of of
2597 Output_section::Simple_input_section to that of
2598 Output_section::Input_section.
2599 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2600 except for the first pass.
2601 * output.cc (Output_section::get_input_sections): Change type of
2602 input_sections to std::list<Input_section>.
2603 (Output_section::add_script_input_section): Rename from
2604 Output_section::add_simple_input_section. Change type of SIS
2605 parameter from Simple_input_section to Input_section.
2606 * output.h (Output_section::Simple_input_section): Remove class.
2607 (Output_section::Input_section): Change class visibility to public.
2608 (Output_section::Input_section::addralign): Use stored alignments
2609 for special input sections if set.
2610 (Output_section::Input_section::set_addralign): New method.
2611 (Output_section::get_input_sections): Change parameter type from
2612 list of Simple_input_section to list of Input_section.
2613 (Output_section::add_script_input_section): Rename from
2614 Output_section::add_simple_input_section. Change first parameter's
2615 type from Simple_input_section to Input_section and remove the
2616 second and third parameters.
2617 * script-sections.cc (Input_section::Input_section_list): Change
2618 type to list of Output_section::Input_section/
2619 (Input_section_info::Input_section_info): Change parameter type of
2620 INPUT_SECTION to Output_section::Input_section.
2621 (Input_section_info::input_section): Change return type.
2622 (Input_section_info::input_section_): Change type to
2623 Output_section::Input_section.
2624 (Output_section_element_input::set_section_addresses): Adjust code
2625 to use Output_section::Input_section instead of
2626 Output_section::Simple_input_section. Adjust code for renaming
2627 of Output_section::add_simple_input_section.
2628 (Orphan_output_section::set_section_addresses): Ditto.
2632 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2633 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2637 * options.cc (General_options::finalize): Handle -nostdlib.
2638 * options.h (nostdlib): New option.
2639 * script.cc (script_add_search_dir): Handle -nostdlib.
2643 * arm.cc (Target_arm::do_finalize_sections): Create an empty
2644 attributes section only if there no attributes section after merging.
2645 (Target_arm::merge_object_attributes): Move value of
2646 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2647 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2648 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2649 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2650 and arm_attr_merge_7.stdout.
2651 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2652 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2653 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2654 arm_attr_merge_7b.o): New rules.
2655 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2657 * testsuite/Makefile.in: Regenerate.
2658 * testsuite/arm_attr_merge.sh: New file.
2659 * testsuite/arm_attr_merge_[67][ab].s: Same.
2663 * po/es.po: Updated Spanish translation.
2667 * Makefile.am (install-exec-local): Properly install gold as
2668 default cross linker.
2669 * Makefile.in: Regenerated.
2674 * configure.ac (install_as_default): Define and set to false
2675 unless --enable-gold or --enable-gold=both/gold has been
2677 * configure: Regenerate.
2679 * Makefile.am (install-exec-local): Install the executable as
2680 'ld.gold'. If install_as_default is true then also install it as
2682 * Makefile.in: Regenerated.
2686 * layout.cc (Layout::layout_reloc): In relocatable link don't
2687 combine reloc sections for grouped sections.
2691 * gc.h (gc_process_relocs): Pass information on relocs pointing to
2692 sections that are not ordinary to icf.
2693 * icf.cc (get_section_contents): Handle relocation pointing to section
2694 with no object or shndx information.
2695 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2696 * testsuite/Makefile.in: Regenerate.
2697 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2698 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2702 * expression.cc (Expression::Expression_eval_info): Add
2703 result_alignment_pointer field.
2704 (Expression::eval_with_dot): Add result_alignment_pointer
2705 parameter. Change all callers.
2706 (Expression::eval_maybe_dot): Likewise.
2707 (class Binary_expression): Add alignment_pointer parameter to
2708 left_value and right_value. Change all callers.
2709 (BINARY_EXPRESSION): Set result alignment.
2710 (class Trinary_expression): Add alignment_pointer parameter to
2711 arg2_value and arg3_value. Change all callers.
2712 (Trinary_cond::value): Set result alignment.
2713 (Max_expression::value, Min_expression::value): Likewise.
2714 (Align_expression::value): Likewise.
2715 * script-sections.cc (class Sections_element): Add dot_alignment
2716 parameter to set_section_addresses virtual function. Update
2718 (class Output_section_element): Likewise.
2719 (Script_sections::create_segments): Add dot_alignment parameter.
2721 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2722 (Script_sections::set_phdrs_clause_addresses): Likewise.
2723 * script-sections.h: Update declarations.
2724 * script.h: Update declarations.
2725 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2727 * testsuite/script_test_3.t: Set large alignment.
2728 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2729 segment has expected alignment.
2733 * po/gold.pot: Updated by the Translation project.
2734 * po/vi.po: Updated Vietnamese translation.
2738 * testsuite/Makefile.am (check_PROGRAMS): Add
2739 icf_virtual_function_folding_test.
2740 * testsuite/Makefile.in: Regenerated.
2744 * options.h (merge_exidx_entries): New option.
2745 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2746 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2747 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2748 (Target_arm::merge_exidx_entries): New function.
2749 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2750 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2751 to Arm_exidx_fixup constructor.
2752 Add new arg, merge_exidx_entries.
2753 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2754 Arm_output_section::fix_exidx_coverage.
2758 * icf.cc (get_section_contents): Check for preemptible functions.
2759 Ignore addend when appropriate.
2760 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2762 (add_from_relobj): Check for section folded.
2763 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2764 * symtab.h (should_add_dynsym_entry): Add new parameter.
2765 * target-reloc.h (scan_relocs): Check for section folded.
2766 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2767 Check reloc types for function pointers in shared objects.
2768 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2770 (icf_preemptible_functions_test): New test case.
2771 (icf_string_merge_test): New test case.
2772 * testsuite.Makefile.in: Regenerate.
2773 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2774 bar_glob. Refactor code.
2775 * testsuite/icf_preemptible_functions_test.cc: New file.
2776 * testsuite/icf_preemptible_functions_test.sh: New file.
2777 * testsuite/icf_string_merge_test.cc: New file.
2778 * testsuite/icf_string_merge_test.sh: New file.
2779 * testsuite/icf_virtual_function_folding_test.cc: New file.
2780 * testsuite/icf_virtual_function_folding_test.sh: New file.
2784 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2785 for local symbol recounting if we remove a section due to ICF.
2786 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2787 there are no regular objects in input.
2791 * arm.cc (Arm_input_section::set_final_data_size): Compute
2792 accurate final data size instead of using current data size.
2796 * layout.cc (Layout::choose_output_section): Handle script section
2798 (Layout::make_output_section_for_script): Add section type parameter.
2799 Handle script section types.
2800 * layout.h (Layout::make_output_section_for_script): Add section
2802 * output.cc (Output_section::Output_section): Initialize data member
2804 (Output_section::do_reset_address_and_file_offset): Do not set address
2805 to 0 if section is a NOLOAD section.
2806 * output.h (Output_section::is_noload): New method.
2807 (Output_section::set_is_noload): Ditto.
2808 (Output_section::is_noload_): New data member.
2809 * script-c.h (Script_section_type): New enum type.
2810 (struct Parser_output_section_header): Add new file section_type.
2811 * script-sections.cc (Sections_element::output_section_name): Add
2812 parameter for returning script section type.
2813 (Output_section_definition::output_section_name): Ditto.
2814 (Output_section_definition::section_type)P; New method.
2815 (Output_section_definiton::script_section_type_name): Ditto.
2816 (Output_section_definition::script_section_type_): New data member.
2817 (Output_section_definition::Output_section_definition): Initialize
2818 data member Output_section_definition::script_section_type_.
2819 (Output_section_definition::create_sections): Pass script section type
2820 to Layout::make_output_section_for_script.
2821 (Output_section_definition::output_section_name): Return script
2822 section type to caller.
2823 (Output_section_definition::set_section_address): Do not advance
2824 dot value and load address if section type is NOLOAD. Set address
2825 of NOLOAD sections regardless of section flags.
2826 (Output_section_definition::print): Print section type if it is
2827 not SCRIPT_SECTION_TYPE_NONE.
2828 (Output_section_definition::section_type): New method.
2829 (Output_section_definition::script_section_type_name): Ditto.
2830 (Script_sections::output_section_name): Add new parameter
2831 PSECTION_TYPE for returning script section type. Pass it to
2832 section elements. Handle discard sections.
2833 (Sort_output_sections::operator()): Handle NOLOAD sections.
2834 * script-sections.h (Script_sections::Section_type): New enum type.
2835 (Script_sections::output_section_name): Add a new parameter for
2836 returning script section type.
2837 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2839 * yyscript.y (union): Add new field SECTION_TYPE.
2840 (COPY, DSECT, INFO, NOLOAD): New tokens.
2841 (opt_address_and_section_type): Change type to output_section_header.
2842 (section_type): New non-terminal
2843 (section_header): Handle section type.
2844 (opt_address_and_section_type): Return section type value.
2848 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2849 * testsuite/plugin_common_test_2.c (foo): Likewise.
2853 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2855 * output.cc (Output_section::add_merge_input_section): Simplify
2856 code and return status of Output_merge_base::add_input_section.
2857 Update merge section map only if Output_merge_base::add_input_section
2862 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2863 if section is marked as containing instructions but has no mapping
2865 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2866 correct section index.
2867 (Arm_relobj::find_linked_text_section): Ditto.
2871 * archive.cc (include_member): Destroy Read_symbols_data object before
2873 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2874 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2875 (Read_symbols_data::~Read_symbols_data) New destructor.
2876 (Section_relocs::Section_relocs) New constructor.
2877 (Section_relocs::~Section_relocs) New destructor.
2878 (Read_relocs_data::Read_relocs_data) New constructor.
2879 (Read_relocs_data::~Read_relocs_data) New destructor.
2880 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2881 pointers to NULL after deleting.
2885 * arm.cc: Replace "endianity" with "endianness" in comments.
2886 (Arm_exidx_cantunwind): Ditto.
2887 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2888 (Arm_relobj::merge_flags_and_attributes): New method.
2889 (Arm_relobj::merge_flags_and_attributes_): New data member.
2890 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2891 (Arm_relobj::scan_sections_for_stubs): Ditto.
2892 (Arm_relobj::do_read_symbols): Check to see if we really want to
2893 merge processor-specific flags and attributes. Exit early if
2894 an object is empty except for section names and the undefined symbol.
2895 (Target_arm::do_finalize_sections): Move check for ELF format to
2896 Arm_relobj::do_read_symbols. Merge processor specific flags and
2897 attributes from a regular object only when we have determined that
2898 it is aapropriate. Do not create an .ARM.attributes section in
2899 output if there is no regular input object.
2900 (Target_arm::merge_processor_specific_flags): Check
2901 --warn-mismatch before printing any error.
2902 (Target_arm::merge_object_attributes): Ditto.
2903 * gold.cc (queue_middle_tasks): Handle the case in which there is
2904 no regular object in input.
2905 * options.cc (General_options::parse_EB): New method.
2906 (General_options::parse_EL): Same.
2907 (General_options::General_options): Initialize endianness_.
2908 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2910 (General_options::Endianness): New enum.
2911 (General_options::endianness): New method.
2912 (General_options::endianness_): New data member.
2913 * parameters.cc (Parameters::set_options): Check target endianness.
2914 (Parameters::set_target_once): Ditto.
2915 (Parameters::check_target_endianness): New method.
2916 (parameters_force_valid_target): If either -EL or -EB is specified,
2917 use it to define endianness of default target.
2918 * parameters.h (Parameters::check_target_endianness): New method
2920 * target.h (class Target): Change "endianity" to "endianness"
2925 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2926 * configure: Regenerate.
2927 * Makefile.in: Regenerate.
2928 * testsuite/Makefile.in: Regenerate.
2933 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2934 prevailing definitions of common symbols.
2935 * testsuite/plugin_test_6.sh: New test case.
2936 * testsuite/plugin_common_test_1.c: New test case.
2937 * testsuite/plugin_common_test_2.c: New test case.
2938 * testsuite/Makefile.am (plugin_test_6): New test case.
2939 * testsuite/Makefile.in: Regenerate.
2943 * po/vi.po: New Vietnamese translation.
2947 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2951 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2952 to avoid a conversion warning on a 32-bit host.
2956 * testsuite/script_test_3.t: Add a TLS segment.
2957 * testsuite/Makefile.am (check_PROGRAMS): Add
2958 tls_phdrs_script_test.
2959 (tls_phdrs_script_test_SOURCES): Define.
2960 (tls_phdrs_script_test_DEPENDENCIES): Define.
2961 (tls_phdrs_script_test_LDFLAGS): Define.
2962 (tls_phdrs_script_test_LDADD): Define.
2963 * testsuite/Makefile.in: Rebuild.
2967 * fileread.cc (find_or_make_view): Fix comment.
2971 * script-sections.cc (class Orphan_section_placement): Define
2972 PLACE_TLS and PLACE_TLS_BSS.
2973 (Orphan_section_placement::Orphan_section_placement): Initialize
2975 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
2976 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
2977 (tls_script_test_SOURCES): Define.
2978 (tls_script_test_DEPENDENCIES): Define.
2979 (tls_script_test_LDFLAGS): Define.
2980 (tls_script_test_LDADD): Define.
2981 * testsuite/Makefile.in: Rebuild.
2985 * arm.cc (Arm_relocate_functions::abs8,
2986 Arm_relocate_functions::abs16): Use correct check for overflow
2987 specified in the ARM ELF specs.
2988 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
2989 target of a BLX instruction specially.
2990 (Reloc_stub::stub_type_for_reloc): Ditto.
2991 (Relocate::relocate): Use symbolic names instead of numeric relocation
2992 codes to report error.
2993 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
2995 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
2996 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
2997 thumb2_blx_out_of_range.stdout
2998 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
2999 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3000 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3001 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3002 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3003 thumb2_blx_in_range, thumb2_blx_in_range.o,
3004 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3005 thumb2_blx_out_of_range.o): New rules.
3006 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3007 thumb2_blx_in_range and thumb2_blx_out_of_range.
3008 * testsuite/Makefile.in: Regenerate.
3009 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3010 * testsuite/thumb_blx_in_range.s: New file.
3011 * testsuite/thumb_blx_out_of_range.s: New file.
3015 * archive.cc (Should_include): Move to archive.h.
3016 (should_include_member): Make it a member of Archive.
3018 (Add_lib_group_symbols): New.
3019 * archive.h: Include options.h.
3020 (Archive_member): Moved from Archive.
3021 (Should_include): Moved from archive.cc.
3023 (Add_lib_group_symbols): New.
3024 * dynobj.cc (do_should_include_member): New.
3025 * dynobj.h (do_should_include_member): New.
3026 * gold.cc (queue_initial_tasks): Update call to queue.
3027 * main.cc (main): Print lib group stats.
3028 * object.cc (do_should_include_member): New.
3029 * object.h: Include archive.h.
3030 (Object::should_include_member): New.
3031 (Object::do_should_include_member): New.
3032 (Sized_relobj::do_should_include_member): New.
3033 * options.cc (General_options::parse_start_lib): New.
3034 (General_options::parse_end_lib): New.
3035 (Input_arguments::add_file): Handle lib groups.
3036 (Input_arguments::start_group): Check we are not in a lib.
3037 (Input_arguments::start_lib): New.
3038 (Input_arguments::end_lib): New.
3039 * options.h (General_options): Add start_lib and end_lib.
3040 (Input_argument::lib_): New.
3041 (Input_argument::lib): New.
3042 (Input_argument::is_lib): New.
3043 (Input_file_lib): New.
3044 (Input_arguments::in_lib_): New.
3045 (Input_arguments::in_lib): New.
3046 (Input_arguments::start_lib): New.
3047 (Input_arguments::end_lib_): New.
3048 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3049 in unused members as preempted.
3050 (Sized_pluginobj::do_should_include_member): New.
3051 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3052 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3054 (Read_symbols::do_whole_lib_group): New.
3055 (Read_symbols::do_lib_group): New.
3056 (Read_symbols::do_read_symbols): Handle lib groups.
3057 (Read_symbols::get_name): Handle lib groups.
3058 * readsyms.h (Read_symbols): Add an archive member pointer.
3059 (Read_symbols::do_whole_lib_group): New.
3060 (Read_symbols::do_lib_group): New.
3061 (Read_symbols::member_): New.
3062 * script.cc (read_input_script): Update call to queue_soon.
3066 * arm.cc (Stub_table::Stub_table): Initialize new data members
3067 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3068 (Stub_table::add_reloc_stub): Assign stub offset and update
3069 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3070 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3072 (Stub_table::update_data_size_and_addralign): Use
3073 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3074 instead of going over all reloc stubs.
3075 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3076 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3077 Stringpool_template::offset_ to size of Stringpool_char.
3078 (Stringpool_template::new_key_offset): Remove code to initialize
3079 Stringpool_template::offset_.
3080 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3081 Stringpool_template::offset_ to zero.
3085 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3087 (Stringpool_template::new_key_offset): New method.
3088 (Stringpool_template::add_string): Assign offsets when adding new
3090 (Stringpool_template::set_string_offsets): Do not set string offsets
3091 when not optimizing.
3092 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3094 (Chunked_vector::clear): Clear size_.
3095 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3096 (Chunked_vector::size): Return size_.
3097 (Chunked_vector::push_back): Use size_ to find insert position.
3098 (Chunked_vector::size_): New data member.
3099 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3100 (Stringpool_template::new_key_offset): New method declaration.
3101 (Stringpool_template::offset_): New data member.
3105 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3106 Add_symbols' constructor.
3107 * readsyms.h (Add_symbols): Remove the input_group member.
3111 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3112 target to ask whether a reference to a symbol requires a stack
3114 * target.h (Target::is_call_to_non_split): New function.
3115 (Target::do_is_call_to_non_split): Declare virtual function.
3116 * target.cc: Include "symtab.h".
3117 (Target::do_is_call_to_non_split): New function.
3118 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3122 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3123 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3124 (File_read::open[2]): Add whole_file_view_ to list of views.
3125 (File_read::make_view): Remove test of whole_file_view_.
3126 (File_read::find_or_make_view): Create whole_file_view_ if
3128 (File_read::clear_views): Replace bool parameter with enum;
3129 adjust all callers. Don't delete views with permanent data;
3130 do delete cached views and views from archives if
3131 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3132 if clearing the corresponding view.
3133 * fileread.h (File_read::Clear_views_mode): New enum.
3134 (File_read::View::is_permanent_view): New method.
3135 (File_read::clear_views): Replace bool parameter
3136 with enum; adjust all callers.
3137 * options.h (General_options): Change keep_files_mapped option;
3138 add map_whole_files.
3139 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3141 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3146 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3150 * icf.cc (get_section_contents): Add '@' marker after processing the
3155 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3156 due to a conversion warning.
3157 (Arm_relobj::update_output_local_symbol_count): Check for local
3158 symbol with unset output index.
3162 * options.h (class General_options): Add --spare-dynamic-tags.
3163 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3164 --spare-dynamic-tags.
3168 * incremental.cc: Include "libiberty.h".
3172 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3173 function, is_info_ member.
3174 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3175 (Versions::Versions): Update caller.
3176 (Versions::define_base_version): Likewise.
3177 (Versions::add_def): Likewise.
3181 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3182 (Scan::possible_function_pointer_reloc): New function.
3183 (Scan::local_reloc_may_be_function_pointer): Change to call
3184 possible_function_pointer_reloc.
3185 (Scan::global_reloc_may_be_function_pointer): Ditto.
3186 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3187 relocations in ".data.rel.ro._ZTV" section.
3188 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3189 * testsuite/icf_safe_so_test.cc: Ditto.
3190 * testsuite/icf_safe_test.cc: Ditto.
3191 * testsuite/icf_safe_test.sh: Ditto.
3196 * target-reloc.h (relocate_section): Check the symbol table index
3197 for -1U before setting the local symbol index.
3198 (scan_relocatable_relocs): If copying the relocation, record that
3199 the local symbol is required.
3200 * object.h (Symbol_value::is_output_symtab_index_set): New
3202 (Symbol_value::may_be_discarded_from_output_symtab): New
3204 (Symbol_value::has_output_symtab_entry): New function.
3205 (Symbol_value::needs_output_symtab_entry): Remove.
3206 (Symbol_value::output_symtab_index): Make sure the symbol index is
3208 (Symbol_value::set_output_symtab_index): Make sure the symbol
3209 index is not set. Make sure the new index is valid.
3210 (Symbol_value::set_must_have_output_symtab_entry): New function.
3211 (Symbol_value::has_output_dynsym_entry): New function.
3212 (Symbol_value::set_output_dynsym_index): Make sure the new index
3214 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3215 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3216 local symbol if permitted.
3217 (Sized_relobj::do_finalize_local_symbols): Call
3218 is_output_symtab_index_set rather than needs_output_symtab_entry.
3219 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3220 rather than needs_output_symtab_entry. Call
3221 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3222 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3223 is_output_symtab_index_set rather than needs_output_symtab_entry.
3224 * testsuite/discard_locals_relocatable_test.c: New file.
3225 * testsuite/discard_locals_test.sh: Test -r.
3226 * testsuite/Makefile.am (check_DATA): Add
3227 discard_locals_relocatable_test1.syms,
3228 discard_local_relocatable_test2.syms.
3229 (MOSTLYCLEANFILES): Likewise. Also add
3230 discard_locals_relocatable_test1.lout and
3231 discard_locals_relocatable_test2.out.
3232 (discard_locals_relocatable_test1.syms): New target.
3233 (discard_locals_relocatable_test.o): New target.
3234 (discard_locals_relocatable_test1.out): New target.
3235 (discard_locals_relocatable_test2.syms): New target.
3236 (discard_locals_relocatable_test2.out): New target.
3237 (various): Add missing ../ld-new dependencies.
3238 * testsuite/Makefile.in: Rebuild.
3242 * po/fi.po: New Finnish translation.
3246 * layout.cc (Layout::Layout): Force section types of .init_array*,
3247 .preinit_array* and .fini_array* sections.
3248 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3249 Fix check of return value of std::string::find.().
3250 (Output_section::Input_section_sort_compare::operator()): Remove
3251 comment about .init_array.
3252 (Output_section::Input_section_sort_init_fini_compare::operator()):
3254 (Output_section::sort_attached_input_sections): Handle .init_array
3255 and .fini_array specially.
3256 * output.h (Output_section::Inut_section_sort_compare): Update
3258 (Output_section::Input_section_sort_init_fini_compare): New struct.
3262 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3263 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3264 * testsuite/debug_msg.sh: Avoid matching source line number for
3265 use of global variable undef_int.
3269 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3270 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3271 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3272 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3273 * options.cc (General_options::General_options): Initialize member
3275 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3276 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3277 and rm_no_fix_v4bx.stdout
3278 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3279 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3280 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3281 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3282 and arm_no_fix_v4bx.
3283 * Makefile.in: Regenerate.
3284 * testsuite/arm_fix_v4bx.s: New file.
3285 * testsuite/arm_fix_v4bx.sh: Ditto.
3289 * arm.cc (Target_arm::got_section): Make the .got section the first
3290 non RELRO section in the data segment.
3291 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3292 suffixes of section names.
3296 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3297 flags and attributes merging if an input file is a binary file.
3298 * fileread.cc (Input_file::open): Record format of original file.
3299 * fileread.h (Input_file::Format): New enum type.
3300 (Input_file::Input_file): Initialize data member format_.
3301 (Input_file::format): New method definition.
3302 (Input_file::format_):: New data member.
3306 * arm.cc (Arm_output_data_got): New class.
3307 (ARM_TCB_SIZE): New constant
3308 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3309 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3310 If user uses a script with a SECTIONS clause, issue only a warning
3311 for a misplaced EXIDX input section. Otherwise, issue an error.
3312 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3314 (Target_arm::got_mode_index_entry): Handle static linking.
3315 (Target_arm::Scan::local): Ditto.
3316 (Target_arm::Scan::global): Ditto.
3317 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3318 all incorrectly implemented relocations.
3319 (Target_arm::fix_exidx_coverage): Pass layout to
3320 Arm_output_section::fix_exidx_coverage.
3321 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3322 from ".ARM.exidx." and ".ARM.extab.".
3326 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3327 section if it does not already exist.
3328 * attributes.cc (Attributes_section_data::Attributes_section_data):
3329 Don't crash if size is zero.
3334 * gold.cc (queue_middle_tasks): If no input files were opened,
3336 * workqueue.h (Task_function::Task_function): Assert that there is
3341 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3342 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3343 types to avoid warnings due to different uint64_t implementations
3348 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3349 handling of the maximum backward branch offset.
3350 (Arm_relocate_functions::thumb_branch_common): Ditto.
3351 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3352 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3353 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3354 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3355 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3356 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3357 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3358 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3359 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3360 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3361 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3362 thumb2_bl_out_of_range.o): New rules.
3363 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3364 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3365 thumb2_bl_out_of_range
3366 * testsuite/Makefile.in: Regenerate.
3367 * testsuite/arm_bl_in_range.s: New file.
3368 * testsuite/arm_bl_out_of_range.s: Ditto.
3369 * testsuite/arm_branch_in_range.sh: Ditto.
3370 * testsuite/arm_branch_range.t: Ditto.
3371 * testsuite/thumb2_branch_range.t: Ditto.
3372 * testsuite/thumb_bl_in_range.s: Ditto.
3373 * testsuite/thumb_bl_out_of_range.s: Ditto.
3374 * testsuite/thumb_branch_range.t: Ditto.
3378 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3379 Add reloc offset information.
3380 * icf.cc (get_section_contents): Change iterators to point to the new
3381 vectors. Add reloc offset information to the contents.
3382 * icf.h (Icf::Sections_reachable_info): New typedef.
3383 (Icf::Sections_reachable_list): New typedef.
3384 (Icf::Offset_info): New typedef.
3385 (Icf::Reloc_info): New struct typedef.
3386 (Icf::Reloc_info_list): New typedef.
3387 (Icf::symbol_reloc_list): Delete method.
3388 (Icf::addend_reloc_list): Delete method.
3389 (Icf::section_reloc_list): Delete method.
3390 (Icf::reloc_info_list): New method.
3391 (Icf::reloc_info_list_): New member.
3395 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3396 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3397 * arm.cc (Arm_relocation_functions): New forward declaration.
3398 (Target_arm::Target_arm): Initialize new data members
3399 got_mod_index_offset_ and tls_base_symbol_defined_.
3400 (Target_arm::Relocate::relocate_tls): New method.
3401 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3402 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3404 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3405 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3406 (Target_arm::got_mod_index_offset_,
3407 Target_arm::tls_base_symbol_defined_): New data members.
3408 (Target_arm::Scan::local, Target::Scan::global,
3409 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3414 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3415 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3416 text section as a parameter becuase some broken tools may not set
3417 the link in section header.
3418 (Target_arm::has_got_section): New method.
3419 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3420 without any mapping symbol as data only. Remove warning.
3421 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3422 link in its section header, try to discover the link by inspecting the
3423 REL31 relocation at the beginning of the section.
3424 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3426 (Target_arm::Scan::global): Treat any reference to the symbol
3427 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3431 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3432 (Scan::global_reloc_may_be_function_pointer): New function.
3433 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3434 (Scan::global_reloc_may_be_function_pointer): New function.
3435 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3436 (Scan::global_reloc_may_be_function_pointer): New function.
3437 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3438 (Scan::global_reloc_may_be_function_pointer): New function.
3439 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3440 (Scan::global_reloc_may_be_function_pointer): New function.
3441 (Scan::possible_function_pointer_reloc): New function.
3442 (Target_x86_64::can_check_for_function_pointers): New function.
3443 * gc.h (gc_process_relocs): Scan relocation types to determine if
3444 function pointers were taken for targets that support it.
3445 * icf.cc (Icf::find_identical_sections): Include functions for
3446 folding in safe ICF whose pointer is not taken.
3447 * icf.h (Secn_fptr_taken_set): New typedef.
3448 (fptr_section_id_): New member.
3449 (section_has_function_pointers): New function.
3450 (set_section_has_function_pointers): New function.
3451 (check_section_for_function_pointers): New function.
3452 * options.h: Fix comment for safe ICF option.
3453 * target.h (can_check_for_function_pointers): New function.
3454 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3455 Modify icf_safe_test for X86-64.
3456 * testsuite/Makefile.in: Regenerate.
3457 * testsuite/icf_safe_so_test.cc: New file.
3458 * testsuite/icf_safe_so_test.sh: New file.
3459 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3460 (main): Change to take pointer to function kept_func_3.
3461 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3462 folding is done correctly for X86-64.
3466 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3467 is_symbolless parameter.
3468 (Output_reloc<SHT_REL>::is_symbolless): New.
3469 (Output_reloc<SHT_REL>::is_symbolless_): New.
3470 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3471 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3472 (Output_reloc<SHT_RELA>::is_symbolless): New.
3473 (Output_data_reloc::add_global): Handle is_symbolless.
3474 (Output_data_reloc::add_global_relative): Likewise.
3475 (Output_data_reloc::add_local): Likewise.
3476 (Output_data_reloc::add_local_relative): Likewise.
3477 (Output_data_reloc::add_symbolless_global_addend): New.
3478 (Output_data_reloc::add_symbolless_local_addend): New.
3479 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3481 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3482 instead of ->is_relative_
3483 (Output_reloc::write): Likewise.
3484 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3485 (Output_reloc::write_rel): Simplify.
3487 * sparc.cc (Target_sparc::Scan::local): Use
3488 ->add_symbolless_local_addend as needed.
3489 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3490 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3491 based upon relocation offset.
3495 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3496 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3497 beginning of function.
3498 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3499 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3500 parameter is_32bit in calls to should_apply_static_reloc.
3501 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3502 (check_DATA): Add arm_abs_global.stdout.
3503 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3504 arm_abs_global.stdout): New rules.
3505 (MOSTLLYCLEANFILES): Add arm_abs_global
3506 * Makefile.in: Regenerate.
3507 * testsuite/arm_abs_global.s: New file.
3508 * testsuite/arm_abs_global.sh: Ditto.
3509 * testsuite/arm_abs_lib.s: Ditto.
3513 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3515 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3516 Allocate_commons_task first.
3517 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3518 task, rather than symtab_lock_.
3519 (Gc_process_relocs::~Gc_process_relocs): New function.
3520 (Gc_process_relocs::is_runnable): Check this_blocker_.
3521 (Gc_process_relocs::locks): Use next_blocker_ rather than
3523 (Scan_relocs::~Scan_relocs): New function.
3524 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3526 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3528 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3529 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3530 constructor accordingly.
3531 (class Gc_process_relocs): Likewise.
3532 (class Scan_relocs): Likewise.
3533 * common.h (class Allocate_commons_task): Remove symtab_lock_
3534 field, and corresponding constructor parameter.
3535 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3537 (Allocate_commons_task::locks): Likewise.
3541 * gold-threads.h (class Once): Define.
3542 (class Initialize_lock): Rewrite as child of Once.
3543 * gold-threads.cc (class Once_initialize): Define.
3544 (once_pointer_control): New static variable.
3545 (once_pointer, once_arg): New static variables.
3546 (c_run_once): New static function.
3547 (Once::Once, Once::run_once, Once::internal_run): New functions.
3548 (class Initialize_lock_once): Remove.
3549 (initialize_lock_control): Remove.
3550 (initialize_lock_pointer): Remove.
3551 (initialize_lock_once): Remove.
3552 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3553 (Initialize_lock::initialize): Rewrite.
3554 (Initialize_lock::do_run_once): New function.
3555 * archive.cc (Archive::interpret_header): Only clear name if it is
3557 * fileread.cc: Include "gold-threads.h"
3558 (file_counts_lock): New static variable.
3559 (file_counts_initialize_lock): Likewise.
3560 (File_read::release): Only increment counts when using --stats.
3561 Use a lock around the increment.
3562 * parameters.cc (class Set_parameters_target_once): Define.
3563 (set_parameters_target_once): New static variable.
3564 (Parameters::Parameters): Move here from parameters.h.
3565 (Parameters::set_target): Rewrite.
3566 (Parameters::set_target_once): New function.
3567 (Parameters::clear_target): Move here and rewrite.
3568 * parameters.h (class Parameters): Update declarations. Add
3569 set_parameters_target_once_ field.
3570 (Parameters::Parameters): Move to parameters.cc.
3571 (Parameters::clear_target): Likewise.
3572 * readsyms.cc (Read_symbols::do_group): Create a Start_group
3574 (Start_group::~Start_group): New function.
3575 (Start_group::is_runnable): New function.
3576 (Start_group::locks, Start_group::run): New functions.
3577 (Finish_group::run): Change saw_undefined to size_t.
3578 * readsyms.h (class Start_group): Define.
3579 (class Finish_group): Change saw_undefined_ field to size_t.
3580 (Finish_group::Finish_group): Remove saw_undefined and
3581 this_blocker parameters. Change all callers.
3582 (Finish_group::set_saw_undefined): New function.
3583 (Finish_group::set_blocker): New function.
3584 * symtab.h (class Symbol_table): Change saw_undefined to return
3585 size_t. Change saw_undefined_ field to size_t.
3586 * target-select.cc (Set_target_once::do_run_once): New function.
3587 (Target_selector::Target_selector): Initialize set_target_once_
3588 field. Don't initialize lock_ and initialize_lock_ fields.
3589 (Target_selector::instantiate_target): Rewrite.
3590 (Target_selector::set_target): New function.
3591 * target-select.h (class Set_target_once): Define.
3592 (class Target_selector): Update declarations. Make
3593 Set_target_once a friend. Remove lock_ and initialize_lock_
3594 fields. Add set_target_once_ field.
3598 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3600 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
3601 (queue_middle_tasks): Add all blockers before queueing any tasks.
3602 (queue_final_tasks): Likewise.
3603 * token.h (Task_token::add_blockers): New function.
3604 * object.h (Input_objects::number_of_relobjs): New function.
3608 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3609 shared, not if not position independent.
3610 * x86_64.cc (Relocate::relocate_tls): Likewise.
3611 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3612 (tls_pie_pic_test): New target.
3613 * testsuite/Makefile.in: Rebuild.
3615 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3616 (tls_test_main_pie.o, tls_test_pie.o): New targets.
3617 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3618 * testsuite/Makefile.in: Rebuild.
3622 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3623 R_SPARC_RELATIVE using ->add_local_relative().
3624 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3626 * output.h (Output_data_dynamic::add_section_size): New method
3627 that takes two Output_data objects.
3628 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3629 entry param. Handle it in initializers.
3630 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3631 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3632 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3634 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3635 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3636 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3637 for dynrel_includes_plt.
3638 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3639 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3640 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3642 (Target_sparc::do_finalize_sections): Update to pass true for
3643 dynrel_includes_plt.
3644 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3645 output before .rela.plt
3646 (Target_powerpc::do_finalize_sections): Update to pass true for
3647 dynrel_includes_plt when 32-bit.
3651 * arm.cc (Arm_relobj::simple_input_section_output_address): New
3653 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3654 Arm_relobj::scan_section_for_cortex_a8_stubs,
3655 Arm_relobj::do_relocation_section): Instead of calling
3656 Output_section::output_address, use faster
3657 Arm_relobj::simple_input_section_output_address.
3661 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3662 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3663 relocation helper function.
3665 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3666 just like R_SPARC_GOT{10,13,22}.
3667 (Target_sparc::Scan::local): Likewise.
3668 (Target_sparc::Relocate:relocate): Likewise.
3672 * configure.ac: Rewrite targetobjs duplicate removal code to use
3673 only shell constructs.
3674 * configure: Rebuild.
3679 * arm.cc (Arm_relobj::section_is_scannable): New method.
3680 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3681 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3686 * arm-reloc-property.cc (cstdio): Include.
3687 * configure.ac (targetobjs): Remove duplicates.
3688 * configure: Regenerate.
3689 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3690 big and little endian version for a given address size.
3694 * arm-reloc-property.cc
3695 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3697 * arm-reloc-property.h
3698 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3699 New method definition.
3700 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3702 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3704 (GOT_PREL): Change implemented to Y.
3705 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3706 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3707 (Arm_relocate_functions::movw_abs_nc): Remove method.
3708 (Arm_relocate_functions::movt_abs): Ditto.
3709 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3710 (Arm_relocate_functions::thm_movt_abs): Ditto.
3711 (Arm_relocate_functions::movw_rel_nc): Ditto.
3712 (Arm_relocate_functions::movw_rel): Ditto.
3713 (Arm_relocate_functions::movt_rel): Ditto.
3714 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3715 (Arm_relocate_functions:thm_movw_rel): Ditto.
3716 (Arm_relocate_functions:thm_movt_rel): Ditto.
3717 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3718 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3719 New method definitions.
3720 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3721 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3722 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3723 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3724 (Target_arm::Relocate::relocate): Check for non-static or
3725 unimplemented relocation code and exit early. Change calls to
3726 Target_arm::reloc_uses_thumb_bit and
3727 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3728 instead. Refactor code to handle similar relocations to increase
3729 code sharing. Remove check for unsupported relocation code in switch
3731 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3732 relocation property table to find out size. Change error message to
3733 print out the name of a relocation code instead of the numeric value.
3734 (Target_arm::scan_reloc_for_stub): Use relocation property table
3735 instead of calling Target_arm::reloc_uses_thumb_bit().
3739 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3740 types of relaxed input section.
3744 * Makefile.am (HFILES): Add arm-reloc-property.h.
3746 (TARGETSOURCES): Add arm-reloc-property.cc
3747 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3748 (libgold_a_SOURCES): $(DEFFILES)
3749 * Makefile.in: Regenerate.
3750 * arm-reloc-property.cc: New file.
3751 * arm-reloc-property.h: New file.
3752 * arm-reloc.def: New file.
3753 * arm.cc: Update comments.
3754 (arm-reloc-property.h): New included header.
3755 (arm_reloc_property_table): New global variable.
3756 (Target_arm::do_select_as_default_target): New method definition.
3757 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3758 arm-reloc-property to targ_extra_obj.
3759 * parameters.cc (set_parameters_target): Call
3760 Target::select_as_default_target().
3761 * target.h (Target::select_as_default_target): New method definition.
3762 (Target::do_select_as_default_target): Same.
3766 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3767 first_output_text_section_.
3768 (Arm_exidx_fixup::first_output_text_section): New method definition.
3769 (Arm_exidx_fixup::first_output_text_section_): New data member.
3770 (Arm_exidx_fixup::process_exidx_section): Record the first text
3771 output section seen.
3772 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3773 and entsize in output section header.
3777 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3778 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3779 (Arm_relocate_functions::thm_alu11): New Method.
3780 (Arm_relocate_functions::thm_pc8): New Method.
3781 (Arm_relocate_functions::thm_pc12): New Method.
3782 (Target_arm::Scan::local): Handle the relocations.
3783 (Target_arm::Scan::global): Likewise.
3784 (Target_arm::Relocate::relocate): Likewise.
3785 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3789 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3790 of relocation types as ld.
3794 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3796 (Arm_relocate_functions::thumb_branch_common): Ditto.
3797 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3798 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3799 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3800 Arm_relocate_functions::jump24): Remove.
3801 (Target_arm::Relocate::relocate): Adjust code to call
3802 Arm_relocation_functions::arm_branch_common and
3803 Arm_relocation_functions::thumb_branch_common instead of their removed
3804 wrappers. Merge switch-cases together to reduce source code size.
3808 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3809 output_local_symbol_count_needs_update_.
3810 (Arm_relobj::output_local_symbol_count_needs_update,
3811 Arm_relobj::set_output_local_symbol_count_needs_update,
3812 Arm_relobj::update_output_local_symbol_count): New methods.
3813 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3815 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3816 of pointed function as in a R_ARM_PREL31 relocation.
3817 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3818 for output local symbol count updating.
3819 (Target_arm::do_relax): Update output local symbol counts in objects
3821 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3825 * arm.cc: Added support for the ARM relocations:
3826 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3827 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3828 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3830 (Arm_relocate_functions::movw_rel): New method.
3831 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3832 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3834 (Arm_relocate_functions::thm_movw_rel): New method.
3835 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3837 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3839 (Target_arm::Scan::global): Likewise.
3840 (Target_arm::Relocate::relocate): Likewise.
3841 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3846 * arm.cc: Added support for ARM group relocations.
3847 (Target_arm::reloc_needs_sym_origin): New method.
3848 (Arm_relocate_functions::calc_grp_kn): New method.
3849 (Arm_relocate_functions::calc_grp_residual): New method.
3850 (Arm_relocate_functions::calc_grp_gn): New method.
3851 (Arm_relocate_functions::arm_grp_alu): New Method.
3852 (Arm_relocate_functions::arm_grp_ldr): New Method.
3853 (Arm_relocate_functions::arm_grp_ldrs): New Method.
3854 (Arm_relocate_functions::arm_grp_ldc): New Method.
3855 (Target_arm::Scan::local): Handle the ARM group relocations.
3856 (Target_arm::Scan::global): Likewise.
3857 (Target_arm::Relocate::relocate): Likewise.
3858 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3863 * arm.cc (set): Include.
3864 (class Arm_exidx_fixup): Change type of last_input_section_ to const
3866 (Arm_output_section::Text_section_list): New type.
3867 (Arm_output_section::append_text_sections_to_list): New method.
3868 (Arm_output_section::fix_exidx_coverage): Ditto.
3869 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3870 (Arm_relobj::convert_input_section_to_relaxed_section): Use
3871 Relobj::set_section_offset() instead of
3872 Sized_relobj::invalidate_section_offset().
3873 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3874 parameter for section headers. Ignore relocation sections for
3875 unallocated sections and EXIDX sections.
3876 (Target_arm::fix_exidx_coverage): New method.
3877 (Target_arm::output_section_address_less_than): New type.
3878 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3879 linked text section instead of the EXIDX section.
3880 (Arm_output_section::create_stub_group): Add an assertion to check
3881 that this is not an EXIDX output section.
3882 (Arm_output_section::append_text_sections_to_list): New method.
3883 (Arm_output_section::fix_exidx_coverage): Ditto.
3884 (Arm_relobj::scan_sections_for_stubs): Adjust call to
3885 Arm_relobj::section_needs_reloc_stub_scanning.
3886 (Target_arm::do_relax): Fix EXIDX output section coverage in the
3888 (Target_arm::fix_exidx_coverage): New method.
3889 * object.h (Relobj::set_output_section): New method.
3890 (Sized_relobj::invalidate_section_offset): Remove method.
3891 (Sized_relobj::do_invalidate_section_offset): Remove method.
3892 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3896 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3897 Fix warning due to signed and unsigned comparison on a 32-bit host.
3901 * arm.cc (Target_arm::do_relax): Record an output section for section
3902 offset adjustment it contains any stub table that has changed.
3903 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3904 offsets in an output section if necessary.
3905 * output.cc (Output_section::Output_section): Initialize
3906 section_offsets_need_adjustments_.
3907 (Output_section::add_input_section_for_script): Renamed to
3908 Output_section::add_simple_input_section.
3909 (Output_section::save_states): Add a comment.
3910 (Output_section::discard_states): New method defintion.
3911 (Output_section::adjust_section_offsets): Same.
3912 * output.h (Output_section::add_input_section_for_script): Renamed to
3913 Output_section::add_simple_input_section.
3914 (Output_section::discard_states): New method declaration.
3915 (Output_section::adjust_section_offsets): Same.
3916 (Output_section::section_offsets_need_adjustment,
3917 Output_section::set_section_offsets_need_adjustment): New method
3919 (Output_section::section_offsets_need_adjustment_): New data member.
3920 * script-sections.cc
3921 (Output_section_element_input::set_section_address): Adjust code for
3922 renaming of Output_section::add_input_section_for_script.
3923 (Orphan_output_section::set_section_address): Same.
3927 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3928 Fix_v4bx enum values .
3929 * gold/options.h (General_options): New option definitions.
3930 (General_options::fix_v4bx): New method.
3931 (General_options::Fix_v4bx): New enum.
3932 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3933 (General_options::parse_fix_v4bx_interworking): New method.
3937 * arm.cc (Arm_exidx_fixup): New class.
3941 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3943 (Arm_exidx_section_offset_map): New type.
3947 * arm.cc (Arm_exidx_input_section): New class.
3948 (Arm_relobj::exidx_input_section_by_link,
3949 Arm_relobj::exidx_input_section_by_shndx,
3950 Arm_relobj::make_exidx_input_section): New methods.
3951 (read_arm_attributes_section): Remove.
3952 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3953 information about them.
3954 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3959 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3960 Input_section_specifier to Section_id.
3961 (Target_arm::new_arm_input_section: Adjust code for change of key
3963 (Target_arm::find_arm_input_section): Ditto.
3964 * gc.h (object.h): Include for Section_id nand Section_id_hash.
3965 (Section_id): Remove.
3966 (Garbage_collection::Section_id_hash): Remove.
3967 * icf.h (object.h): Include for Section_id nand Section_id_hash.
3968 (Section_id): Remove.
3969 (Icf::Section_id_hash): Remove.
3970 * object.h (Section_id, Const_section_id, Section_id_hash,
3971 Const_section_id_hash): New type definitions.
3972 * output.cc (Output_section::add_relaxed_input_section): Change to
3973 use Const_section_id instead of Input_section_specifier as key type.
3974 (Output_section::add_merge_input_section): Ditto.
3975 (Output_section::build_relaxation_map): Change to use Section_id
3976 instead of Input_section_specifier as key type.
3977 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3979 (Output_section::convert_input_sections_to_relaxed_sections): Change
3980 to use Const_section_id instead of Input_section_specifier as key type.
3981 (Output_section::find_merge_section): Ditto.
3982 (Output_section::find_relaxed_input_section): Ditto.
3983 * output.h (Input_section_specifier): Remove class.
3984 (Output_section::Output_section_data_by_input_section_map): Change
3985 key type to Const_section_id.
3986 (Output_section::Output_relaxed_input_section_by_input_section_map):
3988 (Output_section::Relaxation_map): Change key type to Section_id.
3992 * gold/arm.cc: Added support for R_ARM_V4BX relocation
3993 (class Arm_v4bx_stub): New class.
3994 (DEF_STUBS): Updated definition to support v4_veneer_bx.
3995 (Stub_factory::make_arm_v4bx_stub): New method.
3996 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
3997 (Stub_table::empty): Handle v4bx stubs.
3998 (Stub_table::add_arm_v4bx_stub): New method.
3999 (Stub_table::find_arm_v4bx_stub): New method.
4000 (Arm_relocate_functions::v4bx): New method.
4001 (Target_arm::fix_v4bx): New method.
4002 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4003 (Stub_table::relocate_stubs): Likewise.
4004 (Stub_table::do_write): Likewise.
4005 (Stub_table::update_data_size_and_addralign): Likewise.
4006 (Stub_table::finalize_stubs): Likewise.
4007 (Target_arm::Scan::local): Likewise.
4008 (Target_arm::Scan::global): Likewise.
4009 (Target_arm::do_finalize_sections): Likewise.
4010 (Target_arm::Relocate::relocate): Likewise.
4011 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4013 (Target_arm::scan_reloc_for_stub): Likewise.
4014 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4018 * output.cc (Output_section_headers::do_sized_write): Write large
4019 segment count to sh_info field.
4020 (Output_file_header::do_sized_write): For large segment count,
4021 write PN_XNUM to e_phnum field.
4025 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4026 (Arm_relocate_functions::thm_jump8): New function.
4027 (Arm_relocate_functions::thm_jump11): New function.
4028 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4030 (Target_arm::Scan::global): Likewise.
4031 (Target_arm::Relocate::relocate): Likewise.
4032 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4037 * arm.cc (map, utility): Include headers.
4038 (Target_arm::apply_cortex_a8_workaround): New method.
4039 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4040 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4041 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4042 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4043 the --[no-]fix-cortex-a8 command line options.
4044 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4045 (Target_arm::relocate_stub): Use addend in instruction template.
4046 * options.h (DEFINE_bool): Set the user-set flag.
4047 (General_options): Add --[no-]-fix-cortex options.
4048 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4049 : Update fast look-up map after conversion.
4053 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4054 in the first pass of do_layout.
4058 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4059 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4060 apparent compiler problem of not folding static constant integral
4061 data members of elfcpp::Elf_sizes<32>.
4065 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4066 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4067 Arm_relobj::scan_section_for_cortex_a8_erratum,
4068 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4069 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4070 sections to scan for relocation stubs into a new method
4071 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4072 relocation and Cortex-A8 stub scanning.
4073 (Target_arm::do_relax): Force stubs to be after stubbed sections
4074 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4075 the beginning of a new relaxation pass. Update a comment.
4076 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4080 * target-reloc.h (visibility_error): New inline function.
4081 (relocate_section): Call visibility_error.
4082 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4083 (MOSTLYCLEANFILES): Likewise.
4084 (protected_4_pic.o, protected_3.err): New targets.
4085 * testsuite/protected_4.cc: New file.
4089 * arm.cc (Cortex_a8_reloc): New class.
4090 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4091 and cortex_a8_relocs_info_.
4092 (Target_arm::fix_cortex_a8): New method definition.
4093 (Target_arm::Cortex_a8_relocs_info): New type.
4094 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4095 New data member declarations.
4096 (Target_arm::scan_reloc_for_stub): Record information about
4097 relocations for THUMB branches that might be exempted from the
4098 Cortex-A8 workaround.
4099 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4100 at the beginning of a relaxation pass.
4104 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4105 (Arm_relobj::Mapping_symbol_position,
4106 Arm_reloj::Mapping_symbol_position_less,
4107 Arm_relobj::Mapping_symbols_info): New types.
4108 (Target_arm::is_mapping_symbol_name): New method definition.
4109 (Arm_relobj::do_count_local_symbols): Save information about mapping
4114 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4115 Arm_relocate_functions::thumb32_branch_upper,
4116 Arm_relocate_functions::thumb32_branch_lower,
4117 Arm_relocate_functions::thumb32_cond_branch_offset,
4118 Arm_relocate_functions::thumb32_cond_branch_upper,
4119 Arm_relocate_functions::thumb32_cond_branch_lower,
4120 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4121 branch offset encoding.
4122 (Arm_relocate_functions::thumb_branch_common): Use new branch
4123 offset encoding methods to avoid code duplication.
4124 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4125 (Stub_addend_reader::operator()): Use new branch encoding method
4126 to avoid code duplication.
4130 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4131 (Target_arm::do_finalize_sections): Define special EXIDX section
4132 symbols only if referenced.
4133 * gc.h (Garbage_collection::add_reference): New method.
4134 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4139 * script.cc (Version_script_info::build_expression_list_lookup):
4140 Change complaing about duplicate wildcard match from error to
4143 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4145 (Version_script_info::Version_script_info): Initialize globs_,
4146 default_version_, default_is_global_, and exact_. Don't
4147 initialize globals_ or locals_.
4148 (Version_script_info::build_lookup_tables): Build local symbols
4150 (Version_script_info::unquote): New function.
4151 (Version_script_info::add_exact_match): New function.
4152 (Version_script_info::build_expression_list_lookup): Remove lookup
4153 parameter. Add is_global parameter. Change all callers. Handle
4154 wildcard pattern specially. Unquote pattern. Call
4156 (Version_script_info::get_name_to_match): New function.
4157 (Version_script_info::get_symbol_version): New function.
4158 (Version_script_info::get_symbol_version_helper): Remove.
4159 (Version_script_info::check_unmatched_names): Call unquote.
4160 * script.h (class Version_script_info): Change get_symbol_version
4161 to be non-inline and add is_global parameter; change all callers.
4162 Rewrite symbol_is_local. Update declarations. Define struct
4163 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4164 Remove globals_ and locals_ members. Add exact_, globs_,
4165 default_version_, is_global_.
4166 (Version_script_info::Glob): Remove pattern, add expression and
4167 is_global. Update constructor. Change all callers.
4168 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4170 (Versions::symbol_section_contents): If a symbol is undefined, or
4171 defined in a dynamic object, set the version index to
4173 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4175 (Symbol_table::add_from_pluginobj): Likewise.
4176 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4180 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4181 (incremental_dump_LDADD): Add linking option for libintl.
4182 * Makefile.in: Regenerate.
4187 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4189 * testsuite/Makefile.in: Regenerated.
4193 * options.h (DEFINE_var): Use parentheses around argument varname__
4194 in macro body to avoid any unintended subsequent substitutions.
4198 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4199 candidates before doing symbol resolution.
4201 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4202 ODR candidates if only one is weak.
4206 * script.cc (Version_script_info::build_expression_list_lookup):
4207 Don't warn about ambiguous version, just record the ambiguity.
4208 (Version_script_info::get_symbol_version_helper): Give error if
4209 version is ambiguous.
4213 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4214 prev_data_size_ and prev_addralign_. Remove initializer for
4215 deleted data member has_been_changed_.
4216 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4217 to determine if the table is empty.
4218 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4220 (Stub_table::add_reloc_stub): Define method in class definition
4221 instead of just declaring it there.
4222 (Stub_table::add_cortex_a8_stub): New method definition.
4223 (Stub_table::update_data_size_and_addralign): Ditto.
4224 (Stub_table::finalize_stubs): Ditto.
4225 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4226 (Stub_table::do_addralign_): Return address alignment in the
4227 (Stub_table::do_reset_address_and_file_offset): Define method in
4228 class definition instead of declaring it there. Set current data
4229 size to be the data size of the previous pass.
4230 (Stub_table::set_final_data_size): Use current data size as the
4232 (Stub_table::relocate_stub): Change parameter type of stub from
4233 Reloc_stub pointer to Stub pointer.
4234 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4235 (Stub_table::Cortex_a8_stub_list): New typedef.
4236 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4237 Stub_table::prev_addralign_): New data member.
4238 (Arm_relobj::Arm_relobj): Initialize data member
4239 section_has_cortex_a8_workaround_.
4240 (Arm_relobj::section_has_cortex_a8_workaround,
4241 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4243 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4245 (Target_arm::relocate_stub): Change parameter type of stub from
4246 Reloc_stub pointer to Stub pointer.
4247 (Insn_template::size, Insn_template::alignment): Handle
4248 THUMB16_SPECIAL_TYPE.
4249 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4250 Stub_table::update_data_size_and_addralign,
4251 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4253 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4254 (Stub_table::do_write): Ditto.
4255 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4260 * symtab.h (class Symbol): Remove fields is_target_special_ and
4261 has_plt_offset_. Add field is_defined_in_discarded_section_.
4262 (Symbol::is_defined_in_discarded_section): New function.
4263 (Symbol::set_is_defined_in_discarded_section): New function.
4264 (Symbol::has_plt_offset): Rewrite.
4265 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4266 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4267 Don't initialize is_target_special_ or has_plt_offset_.
4268 Initialize is_defined_in_discarded_section_.
4269 (Symbol_table::add_from_relobj): If appropriate, set
4270 is_defined_in_discarded_section.
4271 * resolve.cc (Symbol::override_base_with_special): Don't test
4272 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4273 * target-reloc.h (relocate_section): Do special handling for
4274 symbols defined in discarded sections for global symbols as well
4279 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4280 the SHT_SYMTAB case.
4284 * object.cc (Sized_relobj::do_layout): Don't get confused if
4285 layout_eh_frame returns NULL.
4290 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4291 dynamic symbol table, use the normal symbol table.
4292 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4298 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4303 * version.cc (print_version): Change to "Copyright 2010".
4309 * i386.cc (class Target_i386): Change return type of plt_section
4311 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4312 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4313 tls_desc_rel_ field.
4314 (Output_data_plt_i386::rel_tls_desc): New function.
4315 (Target_i386::rel_tls_desc_section): New function.
4316 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4317 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4318 R_386_TLS_DESC reloc in rel_tls_desc_section.
4319 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4320 Define struct Tlsdesc_info.
4321 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4322 (Target_x86_64::do_reloc_symbol_index): New function.
4323 (Target_x86_64::add_tlsdesc_info): New function.
4324 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4325 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4327 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4329 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4330 (Target_x86_64::rela_tlsdesc_section): New function.
4331 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4333 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4334 (Target_x86_64::do_reloc_addend): New function.
4335 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4336 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4337 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4338 (Output_reloc::type): New function.
4339 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4340 (Output_reloc::is_target_specific): New function.
4341 (Output_reloc::target_arg): New function.
4342 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4343 absolute relocs and target specific relocs.
4344 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4345 add_target_specific.
4346 (class Output_data_reloc) [SHT_RELA]: Likewise.
4347 * output.cc (Output_reloc::Output_reloc): Add four new versions
4348 for absolute relocs and target specific relocs.
4349 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4350 (Output_reloc::get_symbol_index): Likewise.
4351 (Output_reloc::local_section_offset): Check that local_sym_index_
4352 is not TARGET_CODE or 0.
4353 (Output_reloc::symbol_value): Likewise.
4354 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4356 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4357 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4359 * layout.cc (add_target_dynamic_tags): Use output section for
4360 DT_PLTRELSZ and DT_JMPREL.
4365 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4367 (class Output_data_reloc_generic): Define.
4368 (class Output_data_reloc_base): Change base class to
4369 Output_data_reloc_generic. Change add() method to call
4370 bump_relative_reloc_count for a relative reloc. Remove
4372 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4374 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4375 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4377 * layout.h (class Layout): Update declaration.
4381 * output.h (class Output_data): Add const version of
4382 output_section and do_output_section.
4383 (class Output_section_data): Add const version of
4385 (class Output_section): Likewise.
4386 * layout.cc (Layout::add_target_dynamic_tags): New function.
4387 * layout.h (class Layout): Update declarations.
4388 * arm.cc (Target_arm::do_finalize_sections): Use
4389 add_target_dynamic_tags.
4390 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4391 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4392 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4393 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4398 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4405 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4406 Xindex::read_symtab_xindex.
4410 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4411 (Insn_template::thumb16_bcond_insn): New method declaration.
4412 (Insn_template): Fix spelling.
4413 (Stub::thumb16_special): New method declaration.
4414 (Stub::do_write): Define virtual method which was previously pure
4416 (Stub::do_thumb16_special): New method declaration.
4417 (Stub::do_fixed_endian_write): New template member.
4418 (Reloc_stub::do_write): Remove.
4419 (Reloc_stub::do_fixed_endian_write): Remove.
4420 (Cortex_a8_stub): New class definition.
4421 (Stub_factory::make_cortex_a8_stub): New method definition.
4422 (Stub_factory::Stub_factory): Add missing static storage class
4423 qualifier for elf32_arm_stub_a8_veneer_blx.
4428 * options.h (class General_options): Add --warn-unresolved-symbols
4429 and --error-unresolved-symbols.
4430 * errors.cc (Errors::undefined_symbol): Implement
4431 --warn-unresolved-symbols.
4433 * options.h (class General_options): Add -z text and -z textoff.
4434 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4438 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4439 (Garbage_collection::cident_sections): New function.
4440 (Garbage_collection::add_cident_section): New function.
4441 (Garbage_collection::cident_sections_): New member.
4442 (gc_process_relocs): Add references to sections whose names are C
4444 * gold.h (cident_section_start_prefix): New constant.
4445 (cident_section_stop_prefix): New constant.
4446 (is_cident): New function.
4447 * layout.cc (Layout::define_section_symbols): Replace string constants
4448 with the newly defined constants.
4449 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4451 * testsuite/Makefile.am: Add gc_orphan_section_test.
4452 * testsuite/Makefile.in: Regenerate.
4453 * testsuite/gc_orphan_section_test.cc: New file.
4454 * testsuite/gc_orphan_section_test.sh: New file.
4459 * options.h (class General_options): Add --warn-shared-textrel.
4460 * layout.cc (Layout::finish_dynamic_section): Implement
4461 --warn-shared-textrel.
4464 * options.h (class General_options): Add --warn-multiple-gp.
4468 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4469 $(THREADSLIB) and $(LIBDL).
4470 * Makefile.in: Rebuild.
4475 * options.cc (General_options::parse_section_start): New function.
4476 (General_options::section_start): New function.
4477 (General_options::General_options): Initialize all members.
4478 * options.h: Include <map>
4479 (class General_options): Add --section-start. Add section_starts_
4481 * layout.cc (Layout::attach_allocated_section_to_segment): If
4482 --section-start was used, set the address of the segment. Remove
4483 local sort_sections.
4484 (Layout::relaxation_loop_body): If the address of the load segment
4485 has been set by --section-start, don't use it.
4486 * output.h (Output_segment::update_flags_for_output_section): New
4488 * output.cc (Output_segment::add_output_section): Call
4489 update_flags_for_output_section.
4494 * options.h (class General_options): Add --undefined-version.
4495 * script.cc (struct Version_expression): Add was_matched_by_symbol
4497 (Version_script_info::matched_symbol): New function.
4498 (Version_script_info::get_symbol_version_helper): Call
4500 (Version_script_info::check_unmatched_names): New function.
4501 * script.h (class Version_script_info): Update declarations.
4502 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4504 * options.h (class General_options): Use DEFINE_bool_alias for
4505 allow_multiple_definition.
4506 * resolve.cc (Symbol_table::should_override): Don't test
4507 allow_multiple_definition.
4510 * options.h (class General_options): Add --cref.
4511 * main.cc (main): Print cref table if --cref. Don't close mapfile
4512 until after printing cref table.
4513 * cref.cc: Include "symtab.h".
4514 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4515 (Cref_table_compare::operator()): New function.
4516 (Cref_inputs::gather_cref): New function.
4517 (filecol): New static const.
4518 (Cref_inputs::print_cref): New function.
4519 (Cref::print_cref): New function.
4520 * cref.h: Include <cstdio>.
4521 (class Cref): Update declarations.
4522 * mapfile.h (Mapfile::file): New function.
4523 * object.h (class Object): Define Symbols. Declare virtual
4524 do_get_global_symbols.
4525 (Object::get_global_symbols): New function.
4526 * object.cc (Input_objects::add_object): Pass object to cref_ if
4528 (Input_objects::archive_start): Likewise.
4529 (Input_objects::archive_stop): Likewise.
4530 (Input_objects::print_cref): New function.
4531 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4532 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4534 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4536 * plugin.h (class Sized_pluginobj): Update declarations.
4540 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4541 to is_default_version. Rename insdef to insdefault.
4542 (Symbol_table::add_from_relobj): Rename def to is_default_version
4543 and local to is_forced_local.
4544 (Symbol_table::add_from_pluginobj): Likewise.
4545 (Symbol_table::add_from_dynobj): Likewise.
4546 (Symbol_table::define_special_symbol): Rename insdef to
4552 * options.h (class General_options): Add
4553 --allow-multiple-definition and -z muldefs.
4554 * resolve.cc (Symbol_table::should_override): Don't warn about a
4555 multiple symbol definition if --allow-multiple-definition or -z
4559 * options.h (class General_options): Add --add-needed and
4560 --copy-dt-needed-entries. Tweak --as-needed help entry.
4561 * object.cc (Input_objects::check_dynamic_dependencies): Give an
4562 error if --copy-dt-needed-entries aka --add-needed is used and
4563 would cause a change in behaviour.
4566 * options.h (class General_options): Add -G as a short version of
4567 --shared. Add no-op options -assert, -g, and -i.
4571 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4572 check for .text or .gnu.linkonce.t sections.
4573 * icf.cc (Icf::find_identical_sections): Ditto.
4574 Change the detection for mangled function name within the section
4576 * icf.h (is_section_foldable_candidate): New function.
4581 * options.h (class General_options): Permit two dashes with
4582 --retain-symbols-file.
4587 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4588 don't put the file header and segment headers in the text
4592 * common.cc (Sort_commons::operator()): Stabilize sort when both
4594 (Symbol_table::do_allocate_commons_list): When allocating common
4595 symbols, skip a symbol which is no longer common.
4596 * symtab.h (Symbol::is_common): Test whether the symbol comes from
4597 an object before checking its type.
4598 * testsuite/common_test_2.c: New file.
4599 * testsuite/common_test_3.c: New file.
4600 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4601 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4602 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4603 (common_test_2_pic.o, common_test_2.so): New targets.
4604 (common_test_3_pic.o, common_test_3.so): New targets.
4605 * testsuite/Makefile.in: Rebuild.
4608 * script.cc (read_input_script): If we see a new SECTIONS clause,
4609 and we have added an input section, give an error.
4610 * layout.h (class Layout): Add have_added_input_section function.
4611 Add have_added_input_section_ field.
4612 * layout.cc (Layout::Layout): Initialize
4613 have_added_input_section_.
4614 (Layout::layout): Set have_added_input_section_.
4615 (Layout::layout_eh_frame): Likewise.
4620 * options.h (class General_options): Add --sort-common option.
4621 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4622 * common.cc (Sort_common): Add sort_order parameter to
4623 constructor. Add sort_order_ field.
4624 (Sort_commons::operator): Check sort_order_.
4625 (Symbol_table::allocate_commons): Determine the sort order.
4626 (Symbol_table::do_allocate_commons): Add sort_order parameter.
4628 (Symbol_table::do_allocate_commons_list): Likewise.
4633 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4634 symbols from this object, don't change the visibility of an
4636 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4641 * script.h (class Version_script_info): Define Language enum.
4642 Update declarations. Define Glob, Exact, and Lookup types. Add
4643 new fields globals_, locals_, and is_finalized_.
4644 * script.cc: Various formatting fixes.
4645 (class Parser_closure): Change language_stack_ from a vector of
4646 std::string to one of Version_script_info::Language. Adjust all
4648 (class Lazy_demangler): Remove.
4649 (struct Version_expression): Change language from std::string to
4650 Version_script_info::Language.
4651 (Version_script_info::Version_script_info): New function.
4652 (Version_script_info::~Version_script_info): Don't call clear.
4653 (Version_script_info::finalize): New function.
4654 (Version_script_info::build_lookup_tables): New function.
4655 (Version_script_info::build_expression_list_lookup): New
4657 (Version_script_info::get_symbol_version_helper): Rewrite to use
4659 (Version_script_info::print_expression_list): Adjust to use
4660 Version_script_info::Language.
4661 (script_push_lex_into_version_mode): Check that the version script
4662 has not been finalized.
4663 (version_script_push_lang): Change language string to
4664 Version_script_info::Language.
4665 * options.cc (Command_line::version_script): New function.
4666 * options.h (class General_options): Add finalize_dynamic_list
4667 function. Change version_script from declaration to definition.
4668 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4669 * testsuite/version_script.map: Remove duplicate def of foo.
4670 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4672 * testsuite/Makefile.in: Rebuild.
4677 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4678 if the input symbol index is 0, make the output symbol index 0.
4683 * options.h (class General_options): Add -x/--discard-all.
4684 * object.cc (Sized_relobj::do_count_local_symbols): Handle
4685 --discard-all. If the local symbol needs a dynamic entry, check
4686 that before handling --discard-locals.
4691 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4693 (Output_segment::add_output_section): Don't change the flags if
4697 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4698 GNU hash table if they need a dynamic value. Otherwise, don't add
4699 them if they are defined in a dynamic object or are forced local.
4704 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4705 .gnu.hash table for a 32-bit target.
4708 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4709 regular and a dynamic object only needs a dynamic symbol table
4710 entry if it is externally visible.
4713 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4714 constructor. Add global_offset_table_ field.
4715 (Target_i386::got_section): Set global_offset_table_.
4716 (Target_i386::do_finalize_sections): Set global_offset_table_
4718 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4719 in constructor. Add global_offset_table_ field.
4720 (Target_x86_64::got_section): Set global_offset_table_.
4721 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4724 * layout.cc (Layout::Layout): Initialize increase_relro_.
4725 (Layout::get_output_section): Add is_relro, is_last_relro, and
4726 is_first_non_relro parameters. Change all callers.
4727 (Layout::choose_output_section): Likewise.
4728 (Layout::add_output_section_data): Likewise.
4729 (Layout::make_output_section): Likewise.
4730 (Layout::set_segment_offsets): Clear increase_relro when using a
4732 * layout.h (class Layout): Add increase_relro method. Add
4733 increase_relro_ field. Update declarations.
4734 * output.cc (Output_section::Output_section): Initialize
4735 is_last_relro_ and is_first_non_relro_.
4736 (Output_segment::add_output_section): Group relro sections is
4737 do_sort is true. Handle is_last_relro and is_first_non_relro.
4738 (Output_segment::maximum_alignment): Remove relro handling.
4739 (Output_segment::set_section_addresses): Add increase_relro
4740 parameter. Change all callers. Add initial alignment to align
4741 relro sections on separate page. Remove old relro handling.
4742 (Output_segment::set_section_list_addresses): Remove in_relro
4743 parameter. Change all callers.
4744 (Output_segment::set_offset): Add increase parameter. Change all
4745 callers. Remove old relro handling.
4746 * output.h (class Output_section): Add new methods: is_last_relro,
4747 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4748 Add is_last_relro_ and is_first_non_relro_ fields.
4749 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4750 Create separate .got.plt section. Call increase_relro.
4751 * x86_64.cc (Target_x86_64::got_section): Likewise.
4752 * testsuite/relro_script_test.t: Add .got.plt.
4755 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4756 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4757 (Layout::finalize): Call set_dynamic_symbol_size.
4758 (Layout::set_dynamic_symbol_size): New function.
4759 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4760 set_dynamic_symbol_size.
4763 * output.h (class Output_section): Add is_entsize_zero_ field.
4764 * output.cc (Output_section::Output_section): Initialize
4766 (Output_section::set_entsize): If two different entsizes are
4767 requested, force it to zero.
4768 (Output_section::add_input_section): Set flags for .debug_str
4769 before updating section flags. Set entsize.
4770 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4771 and SHF_STRING if all input sections have those flags.
4775 * main.cc (main): Fix the sys time reporting.
4776 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4781 * options.cc (General_options::parse_version): Allow -v to exit
4782 without an error if there is nothing to link.
4786 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4787 using a version of gcc before 4.1.
4788 * configure: Rebuild.
4792 * attributes.cc (Output_attributes_section_data::do_write): Use
4793 std::vector::front rather than std::vector::data.
4797 * symtab.h (class Symbol_table): Add enum Defined.
4798 * resolve.cc (Symbol_table::should_override): Add defined
4799 parameter. Change all callers. Test whether object is NULL
4800 before calling a method on it.
4801 (Symbol_table::report_resolve_problem): Add defined parameter.
4803 (Symbol_table::should_override_with_special): Likewise.
4804 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4805 parameter. Change all callers.
4806 (Symbol_table::do_define_in_output_data): Likewise.
4807 (Symbol_table::define_in_output_segment): Likewise.
4808 (Symbol_table::do_define_in_output_segment): Likewise.
4809 (Symbol_table::define_as_constant): Likewise.
4810 (Symbol_table::do_define_as_constant): Likewise.
4811 * script.h (class Symbol_assignment): Add is_defsym parameter to
4812 constructor; change all callers.
4813 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4814 parameter. Change all callers. Add is_defsym_ field.
4815 (class Parser_closure): Add parsing_defsym parameter to
4816 constructor; change all callers. Add parsing_defsym accessor
4817 function. Add parsing_defsym_ field.
4821 * gold.cc (queue_middle_tasks): Fix formatting.
4822 * object.cc (Relobj::is_section_name_included): Likewise.
4826 * i386.cc (Target_i386::do_calls_non_split): Recognize
4827 -fsplit-stack prologue for a function with a static chain.
4828 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4829 -fsplit-stack prologue when using %r11.
4833 * options.cc (General_options::parse_version): Make -v continue and do
4834 the link like GNU ld does.
4838 * Makefile.am (CCFILES): Add timer.cc.
4839 (HFILES): Add timer.h.
4840 * configure.ac: Check for sysconf and times.
4841 * main.cc: include timer.h.
4842 (main): Use Timer instead of get_run_time.
4845 * workqueue.cc: include timer.h.
4846 (Workqueue::find_and_run_task):
4847 Report user, sys and wall time.
4848 * Makefile.in: Regenerate.
4849 * config.in: Regenerate.
4850 * configure: Regenerate.
4854 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4856 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4857 relaxed input sections.
4858 * output.cc (Output_section::find_relaxed_input_section): Change
4859 return type to Output_relaxed_input_section pointer. Adjust code
4860 for new type of relaxed_input_section_map_.
4861 * output.h (Output_section::find_relaxed_input_section): Change
4862 return type to Output_relaxed_input_section pointer.
4863 (Output_section::Output_relaxed_input_section_by_input_section_map):
4865 (Output_section::relaxed_input_section_map_): Change type to
4866 Output_section::Output_relaxed_input_section_by_input_section_map.
4867 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4872 * layout.cc (Layout::create_shstrtab): Only write out after input
4873 sections if we are compressing debug sections.
4877 * archive.cc (Archive::add_symbols): Only look up a symbol without
4878 a version if there is, in fact, a version.
4882 Revert -Wshadow changes, all changes from:
4885 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4889 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4891 * attributes.cc (Object_attribute::size): Ditto.
4892 (Attributes_section_data::size): Ditto.
4893 (Attributes_section_data::Attributes_section_data): Ditto.
4894 (Output_attributes_section_data::do_write): Ditto.
4895 * attributes.h (Object_attribute::set_type): Ditto.
4896 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4900 * archive.cc: Fix shadowed variable warnings.
4902 * compressed_output.cc: Likewise.
4903 * compressed_output.h: Likewise.
4904 * configure: Likewise.
4905 * dwarf_reader.cc: Likewise.
4906 * dynobj.cc: Likewise.
4907 * dynobj.h: Likewise.
4908 * ehframe.cc: Likewise.
4909 * ehframe.h: Likewise.
4910 * errors.cc: Likewise.
4911 * expression.cc: Likewise.
4912 * fileread.cc: Likewise.
4913 * fileread.h: Likewise.
4914 * freebsd.h: Likewise.
4915 * i386.cc: Likewise.
4917 * incremental.h: Likewise.
4918 * layout.cc: Likewise.
4919 * layout.h: Likewise.
4920 * mapfile.cc: Likewise.
4921 * merge.cc: Likewise.
4922 * merge.h: Likewise.
4923 * object.cc: Likewise.
4924 * object.h: Likewise.
4925 * options.h: Likewise.
4926 * output.cc: Likewise.
4927 * output.h: Likewise.
4928 * parameters.cc: Likewise.
4929 * plugin.cc: Likewise.
4930 * powerpc.cc: Likewise.
4931 * reduced_debug_output.cc: Likewise.
4932 * reduced_debug_output.h: Likewise.
4933 * reloc.cc: Likewise.
4934 * reloc.h: Likewise.
4935 * resolve.cc: Likewise.
4936 * script-sections.cc: Likewise.
4937 * script.cc: Likewise.
4938 * script.h: Likewise.
4939 * sparc.cc: Likewise.
4940 * symtab.cc: Likewise.
4941 * symtab.h: Likewise.
4942 * target-select.cc: Likewise.
4943 * target-select.h: Likewise.
4944 * token.h: Likewise.
4945 * workqueue.cc: Likewise.
4946 * workqueue.h: Likewise.
4947 * x86_64.cc: Likewise.
4951 * arm.cc (attributes.h): New include.
4952 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4953 (Arm_relobj::~Arm_relobj): Delete object pointed by
4954 attributes_section_data_.
4955 (Arm_relobj::attributes_section_data): New method definition.
4956 (Arm_relobj::attributes_section_data_): New data member declaration.
4957 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4958 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4959 attributes_section_data_.
4960 (Arm_dynobj::attributes_section_data): New method definition.
4961 (Arm_dynobj::attributes_section_data_): New data member declaration.
4962 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
4963 initialization value of may_use_blx_ to false.
4964 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4965 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4966 object attributes to compute results instead of hard-coding.
4967 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4968 Target_arm::get_secondary_compatible_arch,
4969 Target_arm::set_secondary_compatible_arch
4970 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4971 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
4972 New method declarations.
4973 (Target_arm::get_aeabi_object_attribute): New method definition.
4974 (Target_arm::attributes_section_data_): New data member declaration.
4975 (read_arm_attributes_section): New template definition.
4976 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
4977 (Arm_dynobj::do_read_symbols): Ditto.
4978 (Target_arm::do_finalize_sections): Merge attributes sections from
4979 input. Check for BLX use after attributes section merging.
4980 Fix __exidx_start and __exidx_end visibility. Create an
4981 .ARM.attributes section if necessary.
4982 (Target_arm::get_secondary_compatible_arch,
4983 Target_arm::set_secondary_compatible_arch,
4984 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4985 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
4986 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
4987 New method definitions.
4991 * plugin.cc (Plugin::load): Don't cast from void* to a function
4996 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5001 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5002 Replace two_file_shared_1.so with two_file_shared_2.so.
5003 * testsuite/Makefile.in: Regenerated.
5007 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5008 (HFILES): Add attributes.h and int_encoding.h.
5009 * Makefile.in: Regenerate.
5010 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5011 function definitions to int_encoding.cc
5012 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5013 prototypes to int_encoding.h
5014 * reduced_debug_output.cc (int_encoding.h): New include.
5015 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5016 function definitions to int_encoding.cc
5017 (insert_into_vector, read_from_pointer): Move template definitions to
5019 * attributes.cc: New file.
5020 * attributes.h: New file.
5021 * int_encoding.cc: New file.
5022 * int_encoding.h: New file.
5027 * incremental-dump.cc (dump_incremental_inputs): New.
5028 (main): Use dump_incremental_inputs.
5033 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5034 checking elfcpp::STT_FUNC.
5035 (Target_i386::Relocate::relocate): Likewise.
5036 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5038 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5039 symbols from shared libraries into normal FUNC symbols.
5041 * symtab.h (Symbol): Add is_func and use it.
5045 * arm.cc (Target_arm::arm_info): Initialize new fields
5046 attributes_section and attributes_vendor.
5047 * i386.cc (Target_i386::i386_info): Same.
5048 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5049 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5050 fields attributes_section and attributes_vendor.
5051 * sparc.cc (Target_sparc::sparc_info): Same.
5052 * target.h (Target::attributes_section, Target::attributes_vendor,
5053 Target::is_attributes_section, Target::attribute_arg_type,
5054 Target::attributes_order): New method definitions.
5055 (Target::Target_info::attributes_section,
5056 Target::Target_info::attributes_vendor): New fields.
5057 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5058 virtual method definitions.
5059 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5060 attributes_section and attributes_vendor.
5061 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5065 * arm.cc: Update comments about interworking and stub generation.
5066 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5067 considered as non-PIC.
5068 (Arm_relocate_functions::base_abs): Fix formatting.
5069 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5070 of function to use GOT entry address instead of offset.
5071 (Target_arm::Scan::global): Issue an error if a symbol would need a
5072 PLT does not get one because it is untyped. Remove code to create
5073 dynamic symbols for relative branches.
5074 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5075 takes unsigned integer instead of boolean.
5079 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5080 (two_file_test_LDADD): Likewise.
5081 (common_test_1_LDADD): Likewise.
5082 (exception_test_LDADD) Likewise.
5083 (weak_test_LDADD): Likewise.
5084 (many_sections_test_LDADD): Likewise.
5085 (initpri1_LDADD): Likewise.
5086 (script_test_1_LDADD): Likewise.
5087 (script_test_2_LDADD): Likewise.
5088 (justsyms_LDADD): Likewise.
5089 (binary_test_LDADD): Likewise.
5090 (large_LDADD): Likewise.
5091 * testsuite/Makefile.in: Regenerated.
5095 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5096 (Symbol_table::override_with_special): Likewise.
5097 (Symbol_table::add_from_object): Likewise.
5101 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5102 Don't set the data_offset twice.
5106 * testsuite/Makefile.in: Regenerate.
5110 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5111 (Target_arm::do_finalize_sections): Add parameter for symbol table
5112 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5113 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5114 parameter for symbol table pointer.
5115 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5116 an additional parameter for a pointer to symbol table.
5117 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5118 parameter for a symbol table pointer.
5119 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5120 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5122 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5123 parameter for a symbol table pointer.
5127 * incremental.cc (Incremental_inputs_header)
5128 (Incremental_inputs_header_write, Incremental_inputs_entry)
5129 (Incremental_inputs_entry_write): Move ...
5130 * incremental.h (Incremental_inputs_header)
5131 (Incremental_inputs_header_write, Incremental_inputs_entry)
5132 (Incremental_inputs_entry_write): here.
5136 * incremental.cc (make_sized_incremental_binary): Set the target.
5137 Error if it is incompatible.
5138 * output.h (Output_file): Add filename method.
5142 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5143 from the get_* methods.
5147 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5148 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5149 Write 0 for the data_offset of scripts.
5153 * testsuite/Makefile.am: Add the incremental_test.sh test.
5154 * testsuite/incremental_test.sh: New.
5155 * testsuite/incremental_test_1.c: New.
5156 * testsuite/incremental_test_2.c: New.
5160 * incremental-dump.cc (main): Fix typos.
5165 * incremental-dump.cc (main): Use llu to print 64 bit values.
5170 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5172 (incremental_dump_LDADD): Likewise.
5173 * Makefile.in: Regenerated.
5181 * arm.cc (Target_arm::Target_arm): Move method definition
5182 outside of class definition. Add code to handle
5183 --target1-rel, --target1-abs and --target2= options.
5184 (Target_arm::get_reloc_reloc_type): Change method to be
5185 non-static and const.
5186 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5187 New data member declaration.
5188 (Target_arm::Scan::local, Target_arm::Scan::global,
5189 Target_arm::Relocate::relocate,
5190 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5191 Adjust call to Target_arm::get_real_reloc_type.
5192 (Target_arm::get_real_reloc_type): Use command line options
5193 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5194 * options.h (--target1-rel, --target1-abs, --target2): New
5199 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5200 class definition. Add code to handle --target1-rel, --target1-abs
5201 and --target2= options.
5202 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5204 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5206 (Target_arm::Scan::local, Target_arm::Scan::global,
5207 Target_arm::Relocate::relocate,
5208 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5209 call to Target_arm::get_real_reloc_type.
5210 (Target_arm::get_real_reloc_type): Use command line options to
5211 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5212 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5217 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5218 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5219 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5221 (Arm_relocate_functions::thm_call): Replace body with a call to
5222 Arm_relocate_functions::thumb_branch_common.
5223 (Arm_relocate_functions::thm_jump24,
5224 Arm_relocate_functions::thm_xpc22): New method definitions.
5225 (Arm_relocate_functions::thumb_branch_common): New method definition.
5226 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5228 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5229 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5233 * Makefile.am: Build incremental-dump
5234 * Makefile.in: Regenerate.
5235 * incremental-dump.cc: New.
5236 * incremental.cc (Incremental_inputs_header_data,
5237 Incremental_inputs_entry_data): Move to incremental.h
5238 * incremental.h: (Incremental_inputs_header_data,
5239 Incremental_inputs_entry_data): Move from incremental.cc
5243 * incremental.cc (Incremental_inputs_header,
5244 Incremental_inputs_header_write, Incremental_inputs_entry,
5245 Incremental_inputs_entry_write): Add a typedef with the data type.
5249 * incremental.cc (Incremental_inputs_header,
5250 Incremental_inputs_header_write, Incremental_inputs_entry,
5251 Incremental_inputs_entry_write): Update comment about which
5252 type has the filed descriptions.
5256 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5257 (Arm_relocate_functions::arm_branch_common): Change method defintion
5258 in class definition to a method declaration and update list of formal
5260 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5261 Arm_relocation_functions::jump24): Adjust call to
5262 Arm_relocate_functions::arm_branch_common. Update list of formal
5264 (Arm_relocate_functions::xpc25): New method definition.
5265 (Arm_relocate_functions::arm_branch_common): Move method defintion
5266 out from class definition. Use stubs for mode-switching and extending
5268 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5269 specially. Change code to enable use of stubs in ARM branches.
5273 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5274 in method declaration.
5275 (Target_arm::relocate_stub): New method declaration.
5276 (Target_arm::default_target): Change to return a pointer instead of
5278 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5279 Target_arm::default_target.
5280 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5282 (Target_arm::relocate_section): Adjust view.
5283 (Target_arm::relocate_stub): New method definition.
5287 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5289 * incremental.cc (open_incremental_binary): Initialized local
5290 variables to avoid warnings.
5291 * object.cc (make_elf_object): Ditto.
5292 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5298 * testsuite/plugin_test.c: Include "config.h".
5302 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5303 (arm_symbol_value): Remove.
5304 (Arm_relocate_functions::arm_branch_common,
5305 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5306 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5307 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5308 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5309 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5310 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5311 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5312 Arm_relocate_functions::thm_mobw_abs_nc,
5313 Arm_relocate_functions::thm_mov_abs,
5314 Arm_relocate_functions::movw_prel_nc,
5315 Arm_relocate_functions::thm_movt_abs,
5316 Arm_relocate_functions::movt_prel,
5317 Arm_relocate_functions::thm_movw_prel_nc,
5318 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5319 (Target_arm::Relocate::relocate): Only decompose address into two
5320 parts if relocation type uses the thumb-bit and pass the actual
5321 bit instead of a flag indicating that the thumb-bit is used. Adjust
5322 calls to methods in Arm_relocate_functions for this change.
5327 * reloc.cc: Instantiate
5328 Sized_relobj::initialize_input_to_output_maps and
5329 Sized_relobj:free_input_to_output_maps.
5334 * defstd.cc (in_segment): Set only_if_ref true for "end".
5338 * arm.cc (class Reloc_stub): Correct a comment.
5339 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5340 (Target_arm::scan_section_for_stubs): New method declaration.
5341 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5342 Change methods from private to protected.
5343 (Target_arm::do_may_relax): New method definition.
5344 (Target_arm::do_relax, Target_arm::group_sections,
5345 Target_arm::scan_reloc_for_stub,
5346 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5347 (Target_arm::arm_input_section_map_): New data member declaration.
5348 (Target_arm::scan_reloc_for_stub,
5349 Target_arm::scan_reloc_section_for_stubs,
5350 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5351 Target_arm::do_relax): New method definitions.
5355 * configure.ac: Check for (struct stat)::st_mtim
5356 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5357 * config.in: Regenerate.
5358 * configure: Regenerate.
5363 * output.cc (Output_segment::add_output_section): Add missing
5369 * object.h (class Object): Add is_needed and set_is_needed
5370 methods. Add is_needed_ field. Make bool fields into bitfields.
5371 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5372 defined in a dynamic object and referenced by a regular object,
5373 set is_needed for the dynamic object.
5374 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5375 if the file is marked with as_needed and it is not needed.
5380 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5381 tags if data is discarded by linker script.
5382 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5383 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5384 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5385 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5389 * layout.cc (Layout::get_output_section): Add is_interp and
5390 is_dynamic_linker_section parameters. Change all callers.
5391 (Layout::choose_output_section): Likewise.
5392 (Layout::make_output_section): Likewise.
5393 (Layout::add_output_section_data): Add is_dynamic_linker_section
5394 parameter. Change all callers.
5395 * layout.h (class Layout): Update declarations.
5396 * output.h (class Output_section): Add is_interp, set_is_interp,
5397 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5398 Add is_interp_, is_dynamic_linker_section_ fields. Change
5399 generate_code_fills_at_write_ to a bitfield.
5400 * output.cc (Output_section::Output_sections): Initialize new
5402 (Output_segment::add_output_section): Add do_sort parameter.
5408 * options.h (class General_options): Add --warn-common.
5409 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5410 merging two common symbols.
5411 (Symbol_table::should_override): Handle --warn-common when merging
5412 a common symbol with a defined symbol. Use report_resolve_problem
5413 for multiple definitions.
5414 (Symbol_table::report_resolve_problem): New function.
5415 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5419 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5421 (Target_arm::stub_factory): New method definition.
5422 (Target_arm::new_arm_input_section,
5423 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5424 Target_arm::reloc_uses_thumb_bit): New method declarations.
5425 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5426 New type definitions.
5427 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5428 member declarations.
5429 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5430 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5431 New method definitions.
5435 * options.h (class General_options): Add --warn_constructors.
5440 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5441 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5446 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5447 --msgid-bugs-address.
5448 (install-pdf): New target.
5449 (install-data_yes): Look up one directory to find mkinstalldirs.
5453 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5458 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5462 * arm.cc (Stub_addend_reader): New struct template definition
5463 and partial specializations.
5464 (Stub_addend_reader::operator()): New method definition for a
5465 partially specialized template.
5469 * arm.cc (Arm_relobj::processor_specific_flags): New method
5471 (Arm_relobj::do_read_symbols): New method declaration.
5472 (Arm_relobj::processor_specific_flags_): New data member declaration.
5473 (Arm_dynobj): New class definition.
5474 (Target_arm::do_finalize_sections): Add input_objects parameter.
5475 (Target_arm::do_adjust_elf_header): New method declaration.
5476 (Target_arm::are_eabi_versions_compatible,
5477 (Target_arm::merge_processor_specific_flags): New method declaration.
5478 (Target_arm::do_make_elf_object): New overloaded method definitions
5480 (Arm_relobj::do_read_symbols): New method definition.
5481 (Arm_dynobj::do_read_symbols): Ditto.
5482 (Target_arm::do_finalize_sections): Add input_objects parameters.
5483 Merge processor-specific flags from all input objects.
5484 (Target_arm::are_eabi_versions_compatible,
5485 Target_arm::merge_processor_specific_flags,
5486 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5487 New method definitions.
5488 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5489 Input_objects pointer type parameter.
5490 * layout.cc (Layout::finalize): Pass input objects to target's.
5491 finalize_sections function.
5492 * output.cc (Output_file_header::do_sized_write): Set ELF file
5493 header's processor-specific flags.
5494 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5495 Input_objects pointer type parameter.
5496 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5497 * target.h (Input_objects): New forward class declaration.
5498 (Target::processor_specific_flags,
5499 Target::are_processor_specific_flags_sect): New method definitions.
5500 (Target::finalize_sections): Add input_objects parameter.
5501 (Target::Target): Initialize processor_specific_flags_ and
5502 are_processor_specific_flags_set_.
5503 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5505 (Target::set_processor_specific_flags): New method definition.
5506 (Target::processor_specific_flags_,
5507 Target::are_processor_specific_flags_set_): New data member
5509 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5510 Input_objects pointer type parameter.
5514 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5518 * object.h (class Relobj): Drop options parameter from
5519 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5520 do_scan_relocs, do_relocate. Change all callers.
5521 (class Sized_relobj): Drop options parameters from
5522 do_gc_process_relocs, do_scan_relocs, do_relocate,
5523 do_relocate_sections, relocate_sections, emit_relocs_scan,
5524 emit_relocs_scan_reltype. Change all callers.
5525 (struct Relocate_info): Remove options field and all references to
5527 * reloc.h (class Read_relocs): Remove options constructor
5528 parameter and options_ field. Change all callers.
5529 (class Gc_process_relocs, class Scan_relocs): Likewise.
5530 (class Relocate_task): Likewise.
5531 * target-reloc.h (scan_relocs): Remove options parameter. Change
5533 (scan_relocatable_relocs): Likewise.
5534 * target.h (class Sized_target): Remove options parameter from
5535 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5537 * gc.h (gc_process_relocs): Remove options parameter. Change all
5539 * arm.cc: Update functions to remove options parameters.
5540 * i386.cc: Likewise.
5541 * powerpc.cc: Likewise.
5542 * sparc.cc: Likewise.
5543 * x86_64.cc: Likewise.
5544 * testsuite/testfile.cc: Likewise.
5548 * arm.cc (Arm_relobj): New class definition.
5549 (Arm_relobj::scan_sections_for_stubs,
5550 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5551 New method definitions.
5555 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5556 (Plugin::cleanup_done_): New member.
5557 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5558 (Plugin_manager::cleanup_done_): Remove.
5559 (Plugin_manager::add_input_file): Edit error message.
5560 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5561 (Plugin_manager::cleanup): Remove use of cleanup_done_.
5565 * fileread.cc: (File_read::View::~View): Use the new
5566 data_ownership_ filed.
5567 (File_read::~File_read): Dispose the new whole_file_view_.
5568 (File_read::open): Mmap the whole file if needed.
5569 (File_read::open): Use whole_file_view_ instead of contents_.
5570 (File_read::find_view): Use whole_file_view_ if applicable.
5571 (File_read::do_read): Use whole_file_view_ instead of contents_.
5572 (File_read::make_view): Use whole_file_view_ instead of contents_,
5573 update File_read::View::View call.
5574 (File_read::find_or_make_view): Update File_read::View::View
5576 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5578 (File_read::View::Data_ownership): New enum.
5579 (File_read::View::View): Replace bool mapped_ with Data_ownership
5581 (File_read::View::mapped_): Remove (replaced by data_ownership_).
5582 (File_read::View::data_ownership_): New field.
5583 (File_read::contents_): Remove (replaced by whole_file_view_).
5584 (File_read::whole_file_view_): New field.
5585 * options.h (class General_options): Add --keep-files-mapped.
5589 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5590 * testsuite/Makefile.am (plugin_test_5): New test case.
5591 * testsuite/Makefile.in: Regenerate.
5595 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5596 from private to protected to allow access by child class.
5597 (Sized_relobj::do_relocate_sections): New method declaration.
5598 (Sized_relobj::relocate_sections): Virtualize.
5599 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5600 Sized_relobj::relocate_sections. Instantiate template explicitly
5601 for different target sizes and endianity.
5605 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5606 (Arm_input_section::as_arm_input_section): New method.
5607 (Arm_output_section): New class definition.
5608 (Arm_output_section::create_stub_group,
5609 Arm_output_section::group_sections): New method definitions.
5613 * arm.cc (Arm_input_section): New class definition.
5614 (Arm_input_section::init, Arm_input_section:do_write,
5615 Arm_input_section::set_final_data_size,
5616 Arm_input_section::do_reset_address_and_file_offset): New method
5621 * arm.cc (Stub_table, Arm_input_section): New forward class
5623 (Stub_table): New class defintion.
5624 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5625 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5626 New method definition.
5630 * arm.cc: Update copyright comments.
5631 (Target_arm): New forward class template declaration.
5632 (Arm_address): New type.
5633 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5634 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5635 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5637 (Insn_template): Same.
5638 (DEF_STUBS): New macro.
5639 (Stub_type): New enum type.
5640 (Stub_template): New class definition.
5643 (Stub_factory): Same.
5644 (Target_arm::Target_arm): Initialize may_use_blx_ and
5645 should_force_pic_veneer_.
5646 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5647 Target_arm::should_force_pic_veneer,
5648 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5649 Target_arm::using_thumb_only, Target_arm:;default_target): New
5651 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5652 New data member declarations.
5653 (Insn_template::size, Insn_template::alignment): New method defintions.
5654 (Stub_template::Stub_template): New method definition.
5655 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5656 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5657 (Stub_factory::Stub_factory): New method definition.
5658 * gold.h (string_hash): New template.
5659 * output.h (Input_section_specifier::hash_value): Use
5661 (Input_section_specifier::string_hash): Remove.
5662 * stringpool.cc (Stringpool_template::string_hash): Use
5667 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5668 symbols of relaxed input sections.
5669 * output.h (Output_section::find_relaxed_input_section): Make
5674 * dynobj.cc (Versions::Versions): Initialize version_script_.
5675 Only insert base version symbol definition for a shared object
5676 if version script defines any version versions.
5677 (Versions::define_base_version): New method definition.
5678 (Versions::add_def): Check that base version is not needed.
5679 (Versions::add_need): Define base version lazily.
5680 * dynobj.h (Versions::define_base_version): New method declaration.
5681 (Versions::needs_base_version_): New data member declaration.
5682 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5683 (check_DATA): Add no_version_test.stdout.
5684 (libno_version_test.so, no_version_test.o no_version_test.stdout):
5686 * testsuite/Makefile.in: Regenerate.
5687 * testsuite/no_version_test.c: New file.
5688 * testsuite/no_version_test.sh: Ditto.
5692 * expression.cc (class Segment_start_expression): New class definition.
5693 (Segment_start_expression::value): New method definition.
5694 (script_exp_function_segment_start): Return a new
5695 Segment_start_expression.
5696 * gold/script-c.h (script_saw_segment_start_expression): New function
5698 * script-sections.cc (Script_sections::Script_sections): Initialize
5699 SAW_SEGMENT_START_EXPRESSION_ to false.
5700 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5701 and -Tbbs options to specify section addresses if given in
5702 command line and no SEGMENT_START expression is seen in a script.
5703 * script-sections.h (Script_sections::saw_segment_start_expression,
5704 Script_sections::set_saw_segment_start_expression): New method
5706 (Script_sections::saw_segment_start_expression_): New data member
5708 * script.cc (script_saw_segment_start_expression): New function.
5709 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5710 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5711 script_test_7.sh and script_test_8.sh.
5712 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5713 script_test_8.stdout.
5714 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5715 (script_test_6, script_test_6.stdout, script_test_7,
5716 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5717 * Makefile.in: Regenerate.
5718 * testsuite/script_test_6.sh: New file.
5719 * testsuite/script_test_6.t: Same.
5720 * testsuite/script_test_7.sh: Same.
5721 * testsuite/script_test_7.t: Same.
5722 * testsuite/script_test_8.sh: Same.
5726 * output.cc (Output_segment::set_section_list_address): Cast
5727 expressions to unsigned long long type to avoid format warnings.
5731 * script.cc (Script_options::add_symbol_assignment): Always add a
5732 dot assignment to script_sections_.
5733 * script-sections.cc (Script_sections::add_dot_assignment):
5734 Initialize if necessary.
5736 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5737 program headers with no load segment if there is a linker script.
5739 * layout.cc (Layout::set_segment_offsets): Align the file offset
5740 to the segment aligment for -N or -n with no load segment.
5741 * output.cc (Output_segment::add_output_section): Don't crash if
5742 the first section is a TLS section.
5743 (Output_segment::set_section_list_addresses): Print an error
5744 message if the address moves backward in a linker script.
5745 * script-sections.cc
5746 (Output_section_element_input::set_section_addresses): Don't
5747 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5748 (Orphan_output_section::set_section_addresses): Likewise.
5752 * layout.cc (Layout::finish_dynamic_section): Generate tags
5753 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5754 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5755 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5759 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5761 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5762 data_shdr fields of relinfo.
5763 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5764 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5765 R_386_TLS_LDO_32, adjust based on section flags.
5766 (Target_i386::Relocate::fix_up_ldo): Remove.
5770 Add support for -pie.
5771 * options.h (class General_options): Add -pie and
5773 (General_options::output_is_position_independent): Test -pie.
5774 (General_options::output_is_executable): Return true if not shared
5775 and not relocatable.
5776 (General_options::output_is_pie): Remove.
5777 * options.cc (General_options::finalize): Reject incompatible uses
5779 * gold.cc (queue_middle_tasks): A -pie link is not static.
5780 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5781 * symtab.cc (Symbol::final_value_is_known): Return false if
5782 output_is_position_independent.
5783 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5784 output_is_position_independent.
5785 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5786 output_is_position_independent.
5787 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5788 output_is_position_independent.
5789 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5791 (basic_pie_test.o, basic_pie_test): New targets.
5792 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5793 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5794 (two_file_pie_test): New target.
5795 * testsuite/Makefile.in: Rebuild.
5796 * README: Remove note saying that -pie is not supported.
5800 * options.h (class General_options): Add -init and -fini.
5801 * layout.cc (Layout::finish_dynamic_section): Emit
5802 given init and fini functions.
5806 * gc.h (gc_process_relocs): Check if icf is enabled using new
5808 * gold.cc (queue_initial_tasks): Likewise.
5809 (queue_middle_tasks): Likewise.
5810 * object.cc (do_layout): Likewise.
5811 * symtab.cc (is_section_folded): Likewise.
5812 * main.cc (main): Likewise.
5813 * reloc.cc (Read_relocs::run): Likewise.
5814 (Sized_relobj::do_scan_relocs): Likewise.
5815 * icf.cc (is_function_ctor_or_dtor): New function.
5816 (Icf::find_identical_sections): Check if function is ctor or dtor when
5818 * options.h (General_options::icf): Change option to be an enum.
5819 (Icf_status): New enum.
5820 (icf_enabled): New method.
5821 (icf_safe_folding): New method.
5822 (set_icf_status): New method.
5823 (icf_status_): New variable.
5824 * (options.cc) (General_options::finalize): Set icf_status_.
5825 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5826 icf_test and icf_keep_unique_test to use the --icf enum flag.
5827 * testsuite/icf_safe_test.sh: New file.
5828 * testsuite/icf_safe_test.cc: New file.
5832 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5833 includes to gc.h and icf.h.
5834 * arm.cc: Include gc.h.
5835 * gold.cc: Likewise.
5836 * i386.cc: Likewise.
5837 * powerpc.cc: Likewise.
5838 * sparc.cc: Likewise.
5839 * x86_64.cc: Likewise.
5840 * gc.h: Include icf.h.
5844 * plugin.cc: Include "gold.h" before other header files.
5848 * options.h (Input_file_argument::Input_file_type): New enum.
5849 (Input_file_argument::is_lib_): Replace with...
5850 (Input_file_argument::type_): New member.
5851 (Input_file_argument::Input_file_argument): Take Input_file_type
5852 'type' rather than boolean 'is_lib' as second argument.
5853 (Input_file_argument::is_lib): Use type_.
5854 (Input_file_argument::is_searched_file): New function.
5855 (Input_file_argument::may_need_search): Handle is_searched_file.
5856 * options.cc (General_options::parse_library): Support -l:filename.
5857 (General_options::parse_just_symbols): Update for Input_file_argument
5859 (Command_line::process): Likewise.
5860 * archive.cc (Archive::get_file_and_offset): Likewise.
5861 * plugin.cc (Plugin_manager::release_input_file): Likewise.
5862 * script.cc (read_script_file, script_add_file): Likewise.
5863 * fileread.cc (Input_file::Input_file): Likewise.
5864 (Input_file::will_search_for): Handle is_searched_file.
5865 (Input_file::open): Likewise.
5866 * readsyms.cc (Read_symbols::get_name): Likewise.
5867 * testsuite/Makefile.am (searched_file_test): New test.
5868 * testsuite/Makefile.in: Regenerate.
5869 * testsuite/searched_file_test.cc: New file.
5870 * testsuite/searched_file_test_lib.cc: New file.
5875 * descriptor.cc: Include <cstdio> and "binary-io.h".
5876 (Descriptors::open): Open the files in binary mode always.
5877 * script.cc (Lex::get_token): Treat \r as whitespace.
5881 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5886 * configure.ac: Check for readv function also.
5887 * fileread.cc (readv): Define if not HAVE_READV.
5888 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5890 * config.in: Regenerate.
5891 * configure: Regenerate.
5895 * layout.cc (Layout::make_output_section): Call target hook to make
5896 ordinary output section.
5897 (Layout::finalize): Adjust parameter list of call the
5898 Target::may_relax().
5899 * layout.h (class Layout::section_list): New method.
5900 * merge.h (Output_merge_base::entsize): Change visibility to public.
5901 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5903 (Output_merge_string::do_is_string): New method.
5904 * object.cc (Sized_relobj::do_setup): renamed from
5905 Sized_relobj::set_up.
5906 * object.h (Sized_relobj::adjust_shndx,
5907 Sized_relobj::initializ_input_to_output_maps,
5908 Sized_relobj::free_input_to_output_maps): Change visibilities to
5910 (Sized_relobj::setup): Virtualize.
5911 (Sized_relobj::do_setup): New method declaration.
5912 (Sized_relobj::invalidate_section_offset,
5913 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5914 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5915 * options.cc (parse_int): New function.
5916 * options.h (parse_int): New declaration.
5917 (DEFINE_int): New macro.
5918 (stub_group_size): New option.
5919 * output.cc (Output_section::Output_section): Initialize memebers
5920 merge_section_map_, merge_section_by_properties_map_,
5921 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5922 (Output_section::add_input_section): Handled deferred code-fill
5923 generation and remove an old comment.
5924 (Output_section::add_relaxed_input_section): New method definition.
5925 (Output_section::add_merge_input_section): Use merge section by
5926 properties map to speed to search. Update merge section maps
5928 (Output_section::build_relaxation_map): New method definition.
5929 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5931 (Output_section::relax_input_section): Renamed to
5932 Output_section::convert_input_sections_to_relaxed_sections and change
5933 interface to take a vector of pointers to relaxed sections.
5934 (Output_section::find_merge_section,
5935 Output_section::find_relaxed_input_section): New method definitions.
5936 (Output_section::is_input_address_mapped,
5937 Output_section::output_offset, Output_section::output_address):
5938 Use output section data maps to speed up searching.
5939 (Output_section::find_starting_output_address): Add comments.
5940 (Output_section::do_write,
5941 Output_section::write_to_postprocessing_buffer): Do code-fill
5942 generation as appropriate.
5943 (Output_section::get_input_sections): Invalidate relaxed input section
5945 (Output_section::restore_states): Adjust type of checkpoint .
5946 Invalidate relaxed input section map.
5947 * output.h (Output_merge_base): New class declaration.
5948 (Input_section_specifier): New class defintion.
5949 (class Output_relaxed_input_section) Change base class to
5950 Output_section_data_build.
5951 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5952 base class initializer.
5953 (Output_section::add_relaxed_input_section): New method declaration.
5954 (Output_section::Input_section): Change visibility to protected.
5955 (Output_section::Input_section::relobj,
5956 Output_section::Input_section::shndx): Handle relaxed input sections.
5957 Output_section::input_sections) Change visibility to protected. Also
5958 define overload to return a non-const pointer.
5959 (Output_section::Merge_section_properties): New class defintion.
5960 (Output_section::Merge_section_by_properties_map,
5961 Output_section::Output_section_data_by_input_section_map,
5962 Output_section::Relaxation_map): New types.
5963 (Output_section::relax_input_section): Rename method to
5964 Output_section::convert_input_sections_to_relaxed_sections and change
5965 interface to take a vector of relaxed section pointers.
5966 (Output_section::find_merge_section,
5967 Output_section::find_relaxed_input_section,
5968 Output_section::build_relaxation_map,
5969 Output_section::convert_input_sections_in_list_to_relaxed_sections):
5970 New method declarations.
5971 (Output_section::merge_section_map_
5972 Output_section::merge_section_by_properties_map_,
5973 Output_section::relaxed_input_section_map_,
5974 Output_section::is_relaxed_input_section_map_valid_,
5975 Output_section::generate_code_fills_at_write_): New data members.
5976 * script-sections.cc
5977 (Output_section_element_input::set_section_addresses): Call
5978 current_data_size and addralign methods of relaxed input sections.
5979 (Orphan_output_section::set_section_addresses): Call current_data_size
5980 and addralign methods of relaxed input sections.
5981 * symtab.cc (Symbol_table::compute_final_value): Extract template
5982 from the body of Symbol_table::sized_finalize_symbol.
5983 (Symbol_table::sized_finalized_symbol): Call
5984 Symbol_table::compute_final_value.
5985 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
5986 (Symbol_table::compute_final_value): New templated method declaration.
5987 * target.cc (Target::do_make_output_section): New method defintion.
5988 * target.h (Target::make_output_section): New method declaration.
5989 (Target::relax): Add more parameters for input objects, symbol table
5990 and layout. Adjust call to do_relax.
5991 (Target::do_make_output_section): New method declaration.
5992 (Target::do_relax): Add parameters for input objects, symbol table
5997 * pread.c: Include stdio.h.
6001 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6006 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6007 Change read_shndx type to unsigned int.
6008 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6010 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6011 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6012 Change read_shndx type to unsigned int.
6013 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6015 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6016 * layout.cc (Layout::create_symtab_sections): Cast the result of
6017 local_symcount * symsize to off_t in the gold_assert.
6021 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6022 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6024 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6025 (Arm_relocate_functions::thm_abs5): New function.
6026 (Arm_relocate_functions::abs12): New function.
6027 (Arm_relocate_functions::abs16): New function.
6028 (Arm_relocate_functions::base_abs): New function.
6029 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6030 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6031 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6033 (Scan::global): Likewise.
6034 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6035 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6036 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6037 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6042 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6043 (Arm_relocate_functions::movt_prel): New function.
6044 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6045 (Arm_relocate_functions::thm_movt_prel): New function.
6046 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6047 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6048 (Scan::global, Relocate::relocate): Likewise.
6049 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6053 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6054 Incremental_checker.
6055 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6057 (class Incremental_inputs_header): New class.
6058 (Incremental_inputs_header_writer): Edit comment.
6059 (Incremental_inputs_entry): New class.
6060 (Incremental_inputs_entry_writer): Edit comment.
6061 (Sized_incremental_binary::do_find_incremental_inputs_section):
6062 Add *strtab_shndx parameter, fill it.
6063 (Sized_incremental_binary::do_check_inputs): New method.
6064 (Incremental_checker::can_incrementally_link_output_file): Use
6065 Sized_incremental_binary::check_inputs.
6066 (Incremental_inputs::report_command_line): Save command line in
6069 (Incremental_binary::find_incremental_inputs_section): New
6071 (Incremental_binary::do_find_incremental_inputs_section): Add
6072 strtab_shndx parameter.
6073 (Incremental_binary::do_check_inputs): New pure virtual method.
6074 (Sized_incremental_binary::do_check_inputs): Declare.
6075 (Incremental_checker::Incremental_checker): Add incremental_inputs
6076 parameter, use it to initialize incremental_inputs_.
6077 (Incremental_checker::incremental_inputs_): New field.
6078 (Incremental_checker::command_line): New method.
6079 (Incremental_checker::inputs): New method.
6080 (Incremental_checker::command_line_): New field.
6084 * incremental.cc: Include <cstdarg> and "target-select.h".
6085 (vexplain_no_incremental): New function.
6086 (explain_no_incremental): New function.
6087 (Incremental_binary::error): New method.
6088 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6090 (make_sized_incremental_binary): New function.
6091 (open_incremental_binary): New function.
6092 (can_incrementally_link_file): Add checks if output is ELF and has
6094 * incremental.h: Include "elfcpp_file.h" and "output.h".
6095 (Incremental_binary): New class.
6096 (Sized_incremental_binary): New class.
6097 (open_incremental_binary): Declare.
6098 * object.cc (is_elf_object): Use
6099 elfcpp::Elf_recognizer::is_elf_file.
6100 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6101 * output.h (Output_file::filesize): New method.
6105 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6107 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6108 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6110 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6112 (Arm_relocate_functions::movw_abs_nc): New function.
6113 (Arm_relocate_functions::movt_abs): New function.
6114 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6115 (Arm_relocate_functions::thm_movt_abs): New function.
6116 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6117 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6118 (Scan::global): Likewise.
6119 (Relocate::relocate): Likewise.
6120 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6124 * arm.cc (Arm_relocate_functions::got_prel) New function.
6125 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6126 (Relocate::relocate): Likewise.
6127 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6131 * options.h (class General_options): Define
6132 split_stack_adjust_size parameter.
6133 * object.h (class Object): Add uses_split_stack_ and
6134 has_no_split_stack_ fields. Add uses_split_stack and
6135 has_no_split_stack accessor functions. Declare
6136 handle_split_stack_section.
6137 (class Reloc_symbol_changes): Define.
6138 (class Sized_relobj): Define Function_offsets. Declare
6139 split_stack_adjust, split_stack_adjust_reltype, and
6141 * object.cc (Object::handle_split_stack_section): New function.
6142 (Sized_relobj::do_layout): Call handle_split_stack_section.
6143 * dynobj.cc (Sized_dynobj::do_layout): Call
6144 handle_split_stack_section.
6145 * reloc.cc (Sized_relobj::relocate_sections): Call
6146 split_stack_adjust for executable sections in split_stack
6147 objects. Pass reloc_map to relocate_section.
6148 (Sized_relobj::split_stack_adjust): New function.
6149 (Sized_relobj::split_stack_adjust_reltype): New function.
6150 (Sized_relobj::find_functions): New function.
6151 * target-reloc.h: Include "object.h".
6152 (relocate_section): Add reloc_symbol_changes parameter. Change
6154 * target.h (class Target): Add calls_non_split method. Declare
6155 do_calls_non_split virtual method. Declare match_view and
6157 * target.cc: Include "elfcpp.h".
6158 (Target::do_calls_non_split): New function.
6159 (Target::match_view): New function.
6160 (Target::set_view_to_nop): New function.
6161 * gold.cc (queue_middle_tasks): Give an error if mixing
6162 split-stack and non-split-stack objects with -r.
6163 * i386.cc (Target_i386::relocate_section): Add
6164 reloc_symbol_changes parameter.
6165 (Target_i386::do_calls_non_split): New function.
6166 * x86_64.cc (Target_x86_64::relocate_section): Add
6167 reloc_symbol_changes parameter.
6168 (Target_x86_64::do_calls_non_split): New function.
6169 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6171 * powerpc.cc (Target_powerpc::relocate_section): Add
6172 reloc_symbol_changes parameter.
6173 * sparc.cc (Target_sparc::relocate_section): Add
6174 reloc_symbol_changes parameter.
6175 * configure.ac: Call AM_CONDITIONAL for the default target.
6176 * configure: Rebuild.
6177 * testsuite/Makefile.am (TEST_AS): New variable.
6178 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6179 (check_DATA): Add split_i386 and split_x86_64 files.
6180 (SPLIT_DEFSYMS): Define.
6181 (split_i386_[1234n].o): New targets.
6182 (split_i386_[124]): New targets.
6183 (split_i386_[1234r].stdout): New targets.
6184 (split_x86_64_[1234n].o): New targets.
6185 (split_x86_64_[124]): New targets.
6186 (split_x86_64_[1234r].stdout): New targets.
6187 (MOSTLYCLEANFILES): Add new executables.
6188 * testsuite/split_i386.sh: New file.
6189 * testsuite/split_x86_64.sh: New file.
6190 * testsuite/split_i386_1.s: New file.
6191 * testsuite/split_i386_2.s: New file.
6192 * testsuite/split_i386_3.s: New file.
6193 * testsuite/split_i386_4.s: New file.
6194 * testsuite/split_i386_n.s: New file.
6195 * testsuite/split_x86_64_1.s: New file.
6196 * testsuite/split_x86_64_2.s: New file.
6197 * testsuite/split_x86_64_3.s: New file.
6198 * testsuite/split_x86_64_4.s: New file.
6199 * testsuite/split_x86_64_n.s: New file.
6200 * testsuite/testfile.cc (Target_test): Update relocation_section
6202 * testsuite/Makefile.in: Rebuild.
6206 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6207 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6208 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6209 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6210 the address on ldo_addrs_.
6211 (Target_i386::Relocate::fix_up_ldo): New function.
6215 * plugin.cc (add_input_library): New.
6216 (Plugin::load): Add add_input_library to tv.
6217 (Plugin_manager::add_input_file): Add the is_lib argument.
6218 (add_input_file): Update call to Plugin_manager::add_input_file.
6219 (add_input_library): New.
6220 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6224 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6225 symbol and call Symbol::may_need_copy_reloc to determine if
6226 a copy reloc is needed.
6227 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6228 nocopyreloc is given in command line.
6229 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6230 given in command line.
6231 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6232 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6233 of the removed Target_i386::may_need_copy_reloc.
6234 * options.h (copyreloc): New option with default value false.
6235 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6236 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6237 instead of the removed Target_powerpc::may_need_copy_reloc.
6238 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6239 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6240 instead of the removed Target_sparc::may_need_copy_reloc.
6241 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6242 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6243 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6244 instead of the removed Target_x86_64::may_need_copy_reloc.
6248 * object.h (class Object): Remove target_ field, and target,
6249 sized_target, and set_target methods.
6250 (Object::sized_target): Remove.
6251 (class Sized_relobj): Update declarations. Remove sized_target.
6252 * object.cc (Sized_relobj::setup): Remove target parameter.
6254 (Input_objects::add_object): Don't do anything with the target.
6255 (make_elf_sized_object): Add punconfigured parameter. Change all
6256 callers. Set or test parameter target.
6257 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6259 * parameters.cc (Parameters::set_target): Change parameter type to
6261 (Parameters::default_target): Remove.
6262 (set_parameters_target): Change parameter type to be non-const.
6263 (parameters_force_valid_target): New function.
6264 (parameters_clear_target): New function.
6265 * parameters.h (class Parameters): Update declarations. Remove
6266 default_target method. Add sized_target and clear_target
6267 methods. Change target_ to be non-const.
6268 (set_parameters_target): Update declaration.
6269 (parameters_force_valid_target): Declare.
6270 (parameters_clear_target): Declare.
6271 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6272 as NULL if we aren't searching.
6273 (Add_symbols::run): Don't check for compatible target.
6274 * fileread.cc (Input_file::open_binary): Call
6275 parameters_force_valid_target.
6276 * gold.cc (queue_middle_tasks): Likewise.
6277 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6278 set_target on object.
6279 * dynobj.h (class Sized_dynobj): Update declarations.
6280 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6281 make_elf_object returns NULL.
6282 (Archive::include_member): Don't check whether object target is
6284 * output.cc (Output_section::add_input_section): Get target from
6286 (Output_section::relax_input_section): Likewise.
6287 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6289 (Sized_relobj::do_scan_relocs): Likewise.
6290 (Sized_relobj::relocate_sections): Likewise.
6291 * resolve.cc (Symbol_table::resolve): Likewise.
6292 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6293 parameter. Change all callers.
6294 (Symbol_table::add_from_object): Get target from parameters.
6295 (Symbol_table::add_from_relobj): Don't check object target.
6296 (Symbol_table::add_from_dynobj): Likewise.
6297 (Symbol_table::define_special_symbol): Get target from
6299 * symtab.h (class Symbol_table): Update declaration.
6300 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6301 parameter. Change all callers. Clear parameter target.
6302 (Binary_test): Test target here.
6303 * testsuite/object_unittest.cc (gold_testsuite): Remove
6304 target_test_pointer parameter. Change all callers.
6305 (Object_test): Test target here.
6309 * testsuite/initpri1.c: Don't try to use constructor priorities if
6310 compiling with gcc before 4.3.
6314 * testsuite/retain_symbols_file_test.sh (check_present): Change
6315 output file name to retain_symbols_file_test.stdout.
6316 (check_absent): Likewise.
6320 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6321 * options.cc: Include <cerrno> and <fstream>.
6322 (General_options::finalize): Parse -retain-symbols-file tag.
6323 * options.h: New flag.
6324 (General_options): New method should_retain_symbol, new
6325 variable symbols_to_retain.
6326 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6327 should_retain_symbol map.
6328 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6329 * testsuite/Makefile.in: Regenerate.
6330 * testsuite/retain_symbols_file_test.sh: New file.
6334 * po/es.po: Updated Spanish translation.
6338 * debug.h (DEBUG_RELAXATION): New constant.
6339 (DEBUG_ALL): Add DEBUG_RELAXATION.
6340 (debug_string_to_enum): Add relaxation debug option.
6342 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6343 Layout::Relaxation_debug_check::read_sections,
6344 Layout::Relaxation_debug_check::read_sections): New method definitions.
6345 (Layout::Layout): Initialize data members
6346 record_output_section_data_from_scrips_,
6347 script_output_section_data_list_ and relaxation_debug_check_.
6348 (Layout::save_segments, Layout::restore_segments,
6349 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6350 Layout::relaxation_loop_body): New method definitions.
6351 (Layout::finalize): Support relaxation. Move section layout code to
6352 Layout::relaxation_loop_body.
6353 (Layout::set_asection_address_from_script): Move code for orphan
6354 section placement out.
6355 (Layout::place_orphan_sections_in_script): New method definition.
6356 * layout.h (Output_segment_headers, Output_file_header):
6357 New forward class declarations.
6358 (Layout::~Layout): Define.
6359 (Layout::new_output_section_data_from_script): New method definition.
6360 (Layout::place_orphan_sections_in_script): New method declaration.
6361 (Layout::Segment_states): New type declaration.
6362 (Layout::save_segments, Layout::restore_segments,
6363 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6364 Layout::relaxation_loop_body): New method declarations.
6365 (Layout::Output_section_data_list): New type declaration.
6366 (Layout::Relaxation_debug_check): New class definition.
6367 (Layout::record_output_section_data_from_script_,
6368 Layout::script_output_section_data_list_, Layout::segment_states_,
6369 Layout::relaxation_debug_check_): New data members.
6370 * output.cc: (Output_section_headers::do_size): New method definition.
6371 (Output_section_headers::Output_section_headers): Move size
6372 computation to Output_section_headers::do_size.
6373 (Output_segment_headers::do_size): New method definition.
6374 (Output_file_header::Output_file_header): Move size computation to
6375 Output_file_header::do_size and call it.
6376 (Output_file_header::do_size): New method definition.
6377 (Output_data_group::Output_data_group): Adjust call to
6378 Output_section_data.
6379 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6380 (Output_symtab_xindex::do_write): Add array bound check.
6381 (Output_section::Input_section::print_to_mapfile): Handle
6382 RELAXED_INPUT_SECTION_CODE.
6383 (Output_section::Output_section): Initialize data member checkpoint_.
6384 (Output_section::~Output_section): Delete checkpoint object pointed
6386 (Output_section::add_input_section): Always add an Input_section if
6388 (Output_section::add_merge_input_section): Add assert.
6389 (Output_section::relax_input_section): New method definition.
6390 (Output_section::set_final_data_size): Set load address to zero for
6391 an unallocated section.
6392 (Output_section::do_address_and_file_offset_have_reset_values):
6393 New method definition.
6394 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6395 Handle relaxed input section.
6396 (Output_section::sort_attached_input_sections): Checkpoint input
6397 section list lazily.
6398 (Output_section::get_input_sections): Change type of input_sections to
6399 list of Simple_input_section pointers. Checkpoint input section list
6400 lazily. Also handle relaxed input sections.
6401 (Output_section::add_input_section_for_script): Take a reference to
6402 a Simple_input_section object instead of Relobj pointer and section
6403 index as parameter. Handle relaxed input sections.
6404 (Output_section::save_states, Output_section::restore_states): New
6406 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6407 (Output_data::is_data_size_fixed): New method definition.
6408 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6410 (Output_data::address_and_file_offset_have_reset_values): New method
6412 (Output_data::do_address_and_file_offset_have_reset_values): New method
6414 (Output_data::set_data_size): Check that data size is not fixed.
6415 (Output_data::fix_data_size): New method definition.
6416 (Output_data::is_data_size_fixed_): New data member.
6417 (Output_section_headers::set_final_data_size): New method definition.
6418 (Output_section_headers::do_size): New method declaration.
6419 (Output_segment_headers::set_final_data_size): New method definition.
6420 (Output_segment_headers::do_size): New method declaration.
6421 (Output_file_header::set_final_data_size)::New method definition.
6422 (Output_file_header::do_size)::New method declaration.
6423 (Output_section_data::Output_section_data): Add new parameter
6424 is_data_size_fixed and use it to fix data size.
6425 (Output_data_const::Output_data_const): Adjust call to base class
6426 constructor and fix data size.
6427 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6428 base class constructor and fix data size.
6429 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6430 base class constructor and fix data size.
6431 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6432 class constructor and fix data size.
6433 (Output_data_group::set_final_data_size): New method definition.
6434 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6435 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6436 class constructor and fix data size.
6437 (Output_relaxed_input_section): New class definition.
6438 (Output_section::Simple_input_section): New class definition.
6439 (Output_section::get_input_sections): Adjust parameter list.
6440 (Output_section::add_input_section_for_script): Same.
6441 (Output_section::save_states, Output_section::restore_states,
6442 Output_section::do_address_and_file_offset_have_reset_values,
6443 (Output_section::Input_section::Input_section): Handle
6444 RELAXED_INPUT_SECTION_CODE. Add new overload for
6445 Output_relaxed_input_section.
6446 (Output_section::Input_section::is_input_section,
6447 Output_section::Input_section::set_output_section): Handle relaxed
6449 (Output_section::Input_section::is_relaxed_input_section,
6450 Output_section::Input_section::output_section_data,
6451 Output_section::Input_section::relaxed_input_section): New method
6453 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6455 (Output_section::Input_section::u1_): Update comments.
6456 (Output_section::Input_section::u2_): Add new union member poris.
6457 (Output_section::Checkpoint_output_section): New classs definition.
6458 (Output_section::relax_input_section): New method declaration.
6459 (Output_section::checkpoint_): New data member.
6460 (Output_segment): Update comments.
6461 (Output_segment::Output_segment): Un-privatize copy constructor.
6462 (Output_segment::operator=): Un-privatize.
6463 * script-sections.cc (Output_section_element::Input_section_list):
6464 Change element type to Output_section::Simple_input_section.
6465 (Output_section_element_dot_assignment::set_section_addresses):
6466 Register output section data for relaxation clean up.
6467 (Output_data_exression::Output_data_expression): Adjust call to base
6468 constructor to fix data size.
6469 (Output_section_element_data::set_section_addresses): Register
6470 Output_data_expression object for relaxation clean up.
6471 (struct Input_section_info): Replace Relobj pointer and section index
6472 pair with Output_section::Simple_input_section and Convert struct to a
6474 (Input_section_sorter::operator()): Adjust access to
6475 Input_section_info data member to use accessors.
6476 (Output_section_element_input::set_section_addresses): Use layout
6477 parameter. Adjust code to use Output_section::Simple_input_section
6478 and Input_secction_info classes. Register filler for relaxation
6480 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6481 and section index pair with Output_section::Simple_input_section
6482 class. Adjust code accordingly.
6483 (Phdrs_element::release_segment): New method definition.
6484 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6486 (Script_sections::release_segments): New method definition.
6487 * gold/script-sections.h (Script_sections::release_segments): New
6489 * gold/target.h (Target::may_relax, Target::relax,
6490 Target::do_may_relax, Target::do_relax): New method definitions.
6494 * arm.cc (has_signed_unsigned_overflow): New function.
6495 (Arm_relocate_functions::abs8): New function.
6496 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6497 (Target_arm::Scan::global): Likewise.
6498 (Target_arm::relocate::relocate): Likewise.
6499 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6504 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6505 * testsuite/Makefile.in: Regenerate.
6509 * po/gold.pot: Updated by the Translation project.
6513 * output.cc (Output_file::open): Add execute permission to empty file.
6514 * testsuite/Makefile.am (permission_test): New test.
6515 * testsuite/Makefile.in: Regenerate.
6519 * output.cc (Output_file::resize): Call map_no_anonymous rather
6524 * gold.cc: Include "incremental.h".
6525 (queue_initial_tasks): Call Incremental_checker methods.
6526 * incremental.cc: Include "output.h".
6527 (Incremental_checker::can_incrementally_link_output_file): New
6529 * incremental.h (Incremental_checker): New class.
6531 * output.cc (Output_file::open_for_modification): New method.
6532 (Output_file::map_anonymous): Changed return type to bool. Record
6534 (Output_file::map_no_anonymous): New method, broken out of map.
6535 (Output_file::map): Use map_no_anonymous and map_anonymous.
6536 * output.h (class Output_file): Update declarations.
6540 * options.h (Command_line::Pre_options): New class.
6541 (Command_line::pre_options): New member.
6542 * options.cc (gold::options::ready_to_register): New variable.
6543 (One_option::register_option): Do nothing if not registering options.
6544 Assert if same short option registered twice.
6545 (General_options::General_options): Turn off option registration when
6547 (Command_line::Pre_options::Pre_options): New constructor.
6551 * options.h (General_options::no_keep_memory): Remove incorrect
6556 * Makefile.am (am__skiplex, am__skipyacc): New.
6557 * Makefile.in: Regenerate.
6561 * Makefile.am (AM_CPPFLAGS): Renamed from ...
6562 (INCLUDES): ... this.
6563 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6564 (AM_CPPFLAGS): Renamed from ...
6565 (INCLUDE): ... this.
6566 * Makefile.in, testsuite/Makefile.in: Regenerate.
6568 * Makefile.in: Regenerate.
6569 * aclocal.m4: Likewise.
6570 * config.in: Likewise.
6571 * configure: Likewise.
6572 * testsuite/Makefile.in: Likewise.
6574 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6575 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6576 * Makefile.in: Regenerate.
6577 * testsuite/Makefile.in: Regenerate.
6581 * resolve.cc (Symbol_table::resolve): Don't complain about defined
6582 symbols in shared libraries overridden by hidden or internal symbols
6583 in the main program.
6587 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6588 checking source file names in error messages.
6592 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6593 an elcpp::Ehdr as parameter. Adjust call to set_target.
6594 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6595 an elfcpp::Ehdr as parameter.
6596 * object.cc (Object::set_target): Remove the version that looks up
6597 a target and sets it.
6598 (Sized_relobj::setup): Take a Target object instead of
6599 an elfcpp::Ehdr as parameter. Adjust call to set_target.
6600 (make_elf_sized_object): Find target and ask target to
6602 * object.h: (Object::set_target): Remove the version that looks up
6603 a target and sets it.
6604 (Sized_relobj::setup): Take a Target object instead of
6605 an elfcpp:Ehdr as parameter.
6606 * target.cc: Include dynobj.h.
6607 (Target::do_make_elf_object_implementation): New.
6608 (Target::do_make_elf_object): New.
6609 * target.h (Target::make_elf_object): New template declaration.
6610 (Target::do_make_elf_object): New method declarations.
6611 (Target::do_make_elf_object_implementation): New template declaration.
6615 * gold.h (FUNCTION_NAME): Define.
6616 (gold_unreachable): Use FUNCTION_NAME.
6620 * icf.cc (Icf::find_identical_sections): Issue a warning when a
6621 symbol in the --keep-unique list is not found.
6625 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6626 been maked as --keep-unique.
6627 (Icf::unfold_section): New function.
6628 * icf.h (Icf::unfold_section): New function.
6629 * options.h (General_options::keep_unique): New option.
6630 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6631 * testsuite/Makefile.in: Regenerate.
6632 * testsuite/icf_keep_unique_test.sh: New file.
6633 * testsuite/icf_keep_unique_test.cc: New file.
6638 * resolve.cc (Symbol_table::resolve): Check for references from
6639 dynamic objects to hidden and internal symbols.
6640 * testsuite/Makefile.am (hidden_test.sh): New test.
6641 * testsuite/Makefile.in: Regenerate.
6642 * testsuite/hidden_test.sh: New script.
6643 * testsuite/hidden_test_1.c: New test source.
6644 * testsuite/hidden_test_main.c: New test source.
6648 * arm.cc: Update comments.
6649 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6650 segment to locate the .ARM.exidx section if present.
6654 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6658 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6663 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6664 valid tls_segment only for non-debug-section relocations.
6665 * testsuite/Makefile.am: Add gc_tls_test.
6666 * testsuite/Makefile.in: Regenerate.
6667 * testsuite/gc_tls_test.cc: New file.
6668 * testsuite/gc_tls_test.sh: New file.
6674 * Makefile.am (CCFILES): Add icf.cc.
6676 * Makefile.in: Regenerate.
6677 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6678 * gc.h (gc_process_relocs): Populate lists used by icf to contain
6679 section, symbol and addend information for the relocs.
6680 * gold.cc (queue_middle_tasks): Call identical code folding.
6681 * gold.h: Add defines for multimap.
6682 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6683 to the call of finalize_local_symbols.
6684 * main.cc (main): Create object of class Icf.
6685 * object.cc (Sized_relobj::do_layout): Allow this function to be
6686 called twice during icf.
6687 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6688 to sections marked as identical by icf.
6689 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6691 (Sized_relobj::do_section_entsize): New function.
6692 * object.h (Object::section_entsize): New function.
6693 (Object::do_section_entsize): New pure virtual function.
6694 (Relobj::finalize_local_symbols): Add new parameter.
6695 (Relobj::do_section_entsize): New function.
6696 * options.h (General_options::icf): New option.
6697 (General_options::icf_iterations): New option.
6698 (General_options::print_icf_sections): New option.
6699 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6700 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6701 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6703 * symtab.cc (Symbol_table::is_section_folded): New function.
6704 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6705 to sections marked as identical by icf.
6706 * symtab.h (Symbol_table::set_icf): New function.
6707 (Symbol_table::icf): New function.
6708 (Symbol_table::is_section_folded): New function.
6709 (Symbol_table::icf_): New data member.
6710 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6711 * testsuite/Makefile.am: Add commands to build icf_test.
6712 * testsuite/Makefile.in: Regenerate.
6713 * testsuite/icf_test.sh: New file.
6714 * testsuite/icf_test.cc: New file.
6718 * layout.cc (is_compressible_debug_section): Fix incorrect
6719 comment about compressed section names.
6724 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6729 * layout.h: #include <map>.
6730 (class Kept_section): Change from struct to class. Add accessors
6731 and setters. Add section size to Comdat_group mapping. Change
6732 Comdat_group to std::map. Add is_comdat_ field. Add
6733 linkonce_size field in union.
6734 (class Layout): Update declaration of find_or_add_kept_section.
6735 Don't declare find_kept_object.
6736 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6737 parameter. Add object, shndx, is_comdat, and is_group_name
6738 parameters. Change all callers. Adjust for new Kept_section.
6739 (Layout::find_kept_object): Remove.
6740 * object.cc (Sized_relobj::include_section_group): Update use of
6741 Kept_section. Rename secnum to shndx. Only record
6742 Kept_comdat_section if sections are the same size.
6743 (Sized_relobj::include_linkonce_section): Update use of
6744 Kept_section. Only record Kept_comdat_section if sections are the
6745 same size. Set size of linkonce section.
6746 (Sized_relobj::map_to_kept_section): Update call to
6747 get_kept_comdat_section.
6748 * object.h (class Sized_relobj): Rename fields in
6749 Kept_comdat_section to drop trailing underscores; change object
6750 field to Relobj*. Change Kept_comdat_section_table to store
6751 struct rather than pointer.
6752 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6753 Add kept_object and kept_shndx parameters. Change all callers.
6754 (Sized_relobj::get_kept_comdat_section): Change return type to
6755 bool. Add kept_object and kept_shndx parameters. Change all
6757 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6758 Layout::find_or_add_kept_section.
6762 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6763 Reserve space in the hash table.
6767 * fileread.cc (File_read::get_mtime): New method.
6768 * fileread.h (Timespec): New structure.
6769 (File_read::get_mtime): New method.
6770 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6771 Renamed from timestamp_nsec.
6772 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6774 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6776 (Incremental_inputs::report_archive): Save mtime; style fix.
6777 (Incremental_inputs::report_obejct): Save mtime; style fix.
6778 (Incremental_inputs::report_script): Save mtime; style fix.
6779 (Incremental_inputs::finalize_inputs): Style fix.
6780 (Incremental_inputs::finalize): Style fix.
6781 (Incremental_inputs::create_input_section_data): Store inputs
6783 * incremental.h (Incremental_inputs::report_script): Add mtime
6785 (Incremental_inputs::Input_info::Input_info): Intialize only one
6787 (Incremental_inputs::Input_info::archive): Move to nameless
6789 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6790 (Incremental_inputs::Input_info::script): Move to nameless union.
6791 (Incremental_inputs::mtime): New field.
6792 * script.cc (read_input_script): Pass file mtime to
6794 * script.h (Script_info::inputs): Style fix.
6798 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6804 * layout.cc (Layout::choose_output_section): If we find an
6805 existing section, update the flags.
6806 (Layout::create_notes): New function, broken out of
6808 (Layout::finalize): Don't create note sections.
6809 (Layout::create_note): Don't crash if linker script discards
6811 (Layout::create_gold_note): Likewise.
6812 (Layout::create_build_id): Likewise. Don't set
6813 after_input_sections on the section.
6814 (Layout::create_executable_stack_info): Remove target parameter.
6816 * layout.h (class Layout): Declare create_notes. Update
6817 declaration of create_executable_stack_info.
6818 * gold.cc (queue_middle_tasks): Call create_notes.
6819 * output.cc (Output_section::update_flags_for_input_section): Move
6820 here from output.h. If SHF_ALLOC flag is newly set, mark address
6822 * output.h (Output_data::mark_address_invalid): New function.
6823 (class Output_section): Only declare, not define,
6824 update_flags_for_input_section. Remove set_flags.
6828 * script-sections.cc (Output_section_definition::
6829 set_section_addresses): Rename shadowing local load_address to
6835 * reloc.cc (relocate_sections): Skip empty relocation sections.
6840 * layout.cc (Layout::create_note): Use choose_output_section
6841 rather than make_output_section.
6846 * options.cc (General_options::parse_V): Set printed_version_.
6847 (General_options::General_options): Initialize printed_version_.
6848 * options.h (class General_options): Add printed_version_ field.
6849 * gold.cc (queue_initial_tasks): If there are no input files,
6850 don't give a fatal error if we printed the version information.
6851 (queue_middle_tasks): If using -r with a shared object, give a
6852 fatal error rather than an ordinary error.
6857 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6858 (Layout::make_output_section): Set have_stabstr_section_ if we see
6859 a .stab*str section.
6860 (Layout::finalize): Call link_stabs_sections.
6861 (Layout::link_stabs_sections): New file.
6862 * layout.h (class Layout): Add have_stabstr_section_ field.
6863 Declare link_stabs_sections.
6867 * Makefile.am (libgold_a_LIBADD): New.
6868 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6869 * Makefile.in: Regenerate.
6870 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6871 * configure: Regenerate.
6872 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6873 * fileread.cc: Include sys/state.h
6874 * gold.h: Declare memmem and strndup if found missing.
6875 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6879 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6880 * configure: Rebuild.
6885 * object.cc (Object::section_contents): Don't try to get a view if
6886 the section has length zero.
6887 (Object::handle_gnu_warning_section): If the section is empty, use
6888 the name of the section as the warning.
6893 * stringpool.h (class Stringpool_template): Add optimize_ field.
6894 (Stringpool_template::set_optimize): New function.
6895 * stringpool.cc (Stringpool_template::Stringpool_template):
6896 Initialize optimize_ field.
6897 (Stringpool_template::set_string_offsets): Test local optimize
6898 fild rather than parameter.
6899 * layout.cc (Layout::Layout): Call set_optimize on the section
6905 * yyscript.y: Parse TARGET.
6906 * script.cc (script_set_target): New function.
6907 * script-c.h (script_set_target): Declare.
6908 * options.cc (General_options::string_to_object_format): Rename
6909 from string_to_object_format in anonymous namespace. Change
6911 * options.h (class General_options): Declare
6912 string_to_object_format.
6916 * script-sections.cc (Script_sections::create_segments): Don't put
6917 program headers in a PT_LOAD segment if -n or -N.
6922 * options.h (class General_options): Add -z lazy and -z now. Sort
6923 -z options into alphabetical order.
6924 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6928 * layout.cc (Layout::make_output_section): Call
6929 Target::new_output_section.
6930 (Layout::attach_allocated_section_to_segment): Put large section
6931 sections in a separate load segment with the large segment flag
6933 (Layout::segment_precedes): Sort large data segments after other
6935 (align_file_offset): New static function.
6936 (Layout::set_segment_offsets): Use align_file_offset.
6937 * output.h (class Output_section): Add is_small_section_ and
6938 is_large_section_ fields.
6939 (Output_section::is_small_section): New function.
6940 (Output_section::set_is_small_section): New function.
6941 (Output_section::is_large_section): New function.
6942 (Output_section::set_is_large_section): New function.
6943 (Output_section::is_large_data_section): New function.
6944 (class Output_segment): Add is_large_data_segment_ field.
6945 (Output_segment::is_large_data_segment): New function.
6946 (Output_segment::set_is_large_data_segment): New function.
6947 * output.cc (Output_section::Output_section): Initialize new
6949 (Output_segment::Output_segment): Likewise.
6950 (Output_segment::add_output_section): Add assertion that large
6951 data sections always go in large data segments. Force small data
6952 sections to the end of the list of data sections. Force small BSS
6953 sections to the start of the list of BSS sections. For large BSS
6954 sections to the end of the list of BSS sections.
6955 * symtab.h (class Symbol): Declare is_common_shndx.
6956 (Symbol::is_defined): Check Symbol::is_common_shndx.
6957 (Symbol::is_common): Likewise.
6958 (class Symbol_table): Define enum Commons_section_type. Update
6959 declarations. Add small_commons_ and large_commons_ fields.
6960 * symtab.cc (Symbol::is_common_shndx): New function.
6961 (Symbol_table::Symbol_table): Initialize new fields.
6962 (Symbol_table::add_from_object): Put small and large common
6963 symbols in the right list.
6964 (Symbol_table::sized_finalized_symbol): Check
6965 Symbol::is_common_shndx.
6966 (Symbol_table::sized_write_globals): Likewise.
6967 * common.cc (Symbol_table::do_allocate_commons): Allocate new
6968 common symbol lists. Don't call do_allocate_commons_list if the
6970 (Symbol_table::do_allocate_commons_list): Remove is_tls
6971 parameter. Add comons_section_type parameter. Change all
6972 callers. Handle small and large common symbols.
6973 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
6974 Symbol::is_common_shndx.
6975 * resolve.cc (symbol_to_bits): Likewise.
6976 * target.h (Target::small_common_shndx): New function.
6977 (Target::small_common_section_flags): New function.
6978 (Target::large_common_shndx): New function.
6979 (Target::large_common_section_flags): New function.
6980 (Target::new_output_section): New function.
6981 (Target::Target_info): Add small_common_shndx, large_common_shndx,
6982 small_common_section_flags, and large_common_section_flags
6984 (Target::do_new_output_section): New virtual function.
6985 * arm.cc (Target_arm::arm_info): Initialize new fields.
6986 * i386.cc (Target_i386::i386_info): Likewise.
6987 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6989 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
6990 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6991 (Target_x86_64::do_new_output_section): New function.
6992 * configure.ac: Define conditional MCMODEL_MEDIUM.
6993 * testsuite/Makefile.am (check_PROGRAMS): Add large.
6994 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
6995 (large_LDFLAGS): Define.
6996 * testsuite/large.c: New file.
6997 * testsuite/testfile.cc (Target_test::test_target_info):
6998 Initialize new fields.
6999 * configure, testsuite/Makefile.in: Rebuild.
7003 * Makefile.am (CCFILES): Add target.cc.
7004 * Makefile.in: Regenerate.
7005 * i386.cc (class Target_i386): Define new virtual method to
7006 override do_is_local_label_name in parent.
7007 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7008 local symbols if --discard-locals or -X is given.
7009 * options.h (class General_options): Declare new options
7010 '--discard-locals' and '-X' for discarding locals.
7011 * target.h (class Target): Define new methods is_local_label_name.
7012 Declare new virtual method do_is_local_label_name.
7013 * target.cc: New file.
7014 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7015 (check_SCRIPTS): Add discard_locals_test.sh.
7016 (check_DATA): Add discard_local_tests.syms.
7017 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7018 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7019 * testsuite/Makefile.in: Regenerate.
7020 * testsuite/discard_locals_test.c: New file.
7021 * testsuite/discard_locals_test.sh: Same.
7025 * object.cc (Sized_relobj::Sized_relobj): Initialize
7026 discarded_eh_frame_shndx_ to -1U.
7027 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7029 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7030 a discarded .eh_frame section.
7031 (Sized_relobj::do_finalize_local_symbols): Ditto.
7032 * object.h (class Sized_relobj): Declare new member
7033 discarded_eh_frame_shndx_.
7034 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7035 (local_labels_test.o, local_labels_test): New rules.
7036 * testsuite/Makefile.in: Regenerate.
7040 * layout.cc (Layout::section_name_mapping): Add mapping for
7041 special ARM sections.
7045 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7046 (utils::has_overflow): Same.
7050 * layout.cc (Layout::section_name_mapping): New array, replacing
7051 Layout::linkonce_mapping.
7052 (Layout::section_name_mapping_count): New variable, replacing
7053 Layout::linkonce_mapping_count.
7054 (Layout::linkonce_output_name): Remove.
7055 (Layout::output_section_name): Rewrite.
7056 * layout.h (class Layout): Rename Linkonce_mapping to
7057 Section_name_mapping, linkonce_mapping to section_name_mapping,
7058 linkonce_mapping_count to section_name_mapping_count. Don't
7059 declare linkonce_output_name.
7063 * gold/arm.cc (namespace utils): New.
7064 (Target_arm::reloc_is_non_pic): Define new method.
7065 (class Arm_relocate_functions): New.
7066 (Target_arm::Relocate::relocate): Handle relocation types used by
7071 * arm.cc (Target_arm::scan::global): Use || instead of |.
7075 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7076 issued_non_pic_error_.
7077 (class Target_arm::Scan): Declare new method check_non_pic.
7078 Define new method symbol_needs_plt_entry.
7079 Declare new data member issued_non_pic_error_.
7080 (class Target_arm::Relocate): Declare new method
7081 should_apply_static_reloc.
7082 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7083 (Target_arm::Scan::check_non_pic): Define new method.
7084 (Target_arm::Scan::local): Handle a small subset of reloc types used
7086 (Target_arm::Scan::local): Same.
7087 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7091 * incremental.cc (Incremental_inputs::report_command_line): Filter
7092 out --incremental-* options.
7096 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7098 (class Target_arm): Update comment.
7099 (Target_arm::Target_arm): Initialize new data members GOT_,
7100 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7101 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7102 and Target_arm::rel_dyn_section.
7103 Declare new_enum Target_arm::Got_type.
7104 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7106 Update commments for member do_dynsym_value.
7107 (Target_arm::got_size, Target_arm::plt_section,
7108 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7109 new methods inside class defintion.
7110 (Target_arm::got_section): Define new method.
7111 (Target_arm::rel_dyn_section): Same.
7112 (Output_data_plt_arm): New template class.
7113 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7114 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7115 (Output_data_plt_arm::add_entry): Same.
7116 (Output_data_plt_arm::first_plt_entry): Define new
7117 static data member for PLT instruction template.
7118 (Output_data_plt_arm::plt_entry): Same.
7119 (Output_data_plt_arm::do_write): Define new method.
7120 (Target_arm::make_plt_entry): Same.
7121 (Target_arm::do_finalize_sections): Same.
7122 (Target_arm::do_dynsym_value): Same.
7126 * Makefile.am (TARGETSOURCES): Add arm.cc.
7127 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7128 * Makefile.in: Regenerate.
7130 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7134 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7135 (General_options::check_excluded_libs): Strip off directories in
7136 archive name before matching like GNU ld does.
7137 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7138 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7139 (exclude_libs_test_LDFLAGS): Add linker option
7140 -Wl,--exclude-libs,libexclude_libs_test_3
7141 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7142 an explicit archive without using -l.
7143 (alt/libexclude_libs_test_3.a): New make rule.
7144 * testsuite/Makefile.in: Regenerate.
7145 * testsuite/exclude_libs_test.c : Declare lib3_default().
7147 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7148 * exclude_libs_test_3.c: New file.
7152 * po/id.po: New Indonesian translation.
7153 * po/gold.pot: Updated template file.
7157 * testsuite/Makefile.am: Add -ffunction-sections to compile
7158 gc_comdat_test files. Add -Wl,--gc-sections to build
7160 * testsuite/Makefile.in: Regenerate.
7161 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7165 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7166 kept comdat section was garbage collected.
7167 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7168 * testsuite/Makefile.in: Regenerate.
7169 * testsuite/gc_comdat_test.sh: New file.
7170 * testsuite/gc_comdat_test_1.cc: New file.
7171 * testsuite/gc_comdat_test_2.cc: New file.
7175 * archive.cc (Archive::Archive): Move constructor from archive.h
7176 to here. Initialize no_export_.
7177 (Archive::get_elf_object_for_member): Set no_export flag of object.
7178 * archive.h (Archive::Archive): Move constructor body to
7180 (Archive::no_export): New method.
7181 (Archive::no_export_): New field.
7182 * object.h (Object::Object): Initialize no_export_ to false.
7183 (Object::no_export, Object::set_no_export): New methods.
7184 (Object::no_export_): New field.
7185 * options.cc (General_options::parse_exclude_libs): New method.
7186 (General_options::check_excluded_libs) Same.
7187 * options.h (exclude_libs): New option.
7188 (General_options::check_excluded_libs): New method declaration.
7189 (General_options::excluded_libs_): New field.
7190 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7191 default or protected visibility if an object has no-export flag set.
7192 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7193 (check_SCRIPTS): Add exclude_libs_test.sh.
7194 (check_DATA): Add exclude_libs_test.syms.
7195 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7196 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7197 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7198 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7199 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7200 libexclude_libs_test_2.a): New rules.
7201 * testsuite/Makefile.in: Regenerate.
7202 * testsuite/exclude_libs_test.c: New file.
7203 * testsuite/exclude_libs_test.sh: Ditto.
7204 * testsuite/exclude_libs_test_1.c: Ditto.
7205 * testsuite/exclude_libs_test_2.c: Ditto.
7209 * configure.ac: Check for declarations for cases where libiberty.h
7210 checks HAVE_DECL_xxx.
7211 * configure, config.in: Rebuild.
7215 * gold.h (Incremental_argument_list): Remove (invalid) forward
7217 * incremental.cc (Incremental_inputs::report_achive): New method.
7218 (Incremental_inputs::report_object): New method.
7219 (Incremental_inputs::report_script): New method.
7220 (Incremental_inputs::finalize_inputs): New method.
7221 (Incremental_inputs::finalize): Call finalize_inputs().
7222 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7223 Create inputs entries.
7224 * incremental.h (Incremental_input_type): New enum.
7225 (Incremental_inputs::Incremental_input): Initialize new fields.
7226 (Incremental_inputs::report_inputs): New method.
7227 (Incremental_inputs::report_achive): New method.
7228 (Incremental_inputs::report_object): New method.
7229 (Incremental_inputs::report_script): New method.
7230 (Incremental_inputs::finalize_inputs): New method.
7231 (Incremental_inputs::Input_info): New struct.
7232 (Incremental_inputs::Input_info_map): New typedef.
7233 (Incremental_inputs::lock_): New field.
7234 (Incremental_inputs::Inputs_): New field.
7235 (Incremental_inputs::Inputs_map): New field.
7236 * main.cc (main): Call Incremental_input::report_inputs.
7237 * options.h (Input_argument_list): Typedef moved from
7239 (Input_file_group::Files): Remove, use ::Input_argument_list.
7240 (Input_file_group::Input_argument_list): Remove, use
7241 ::Input_argument_list.
7242 * plugin.cc (Plugin_manager::add_input_file): Add error in
7244 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7246 * script.cc (read_input_script): Call
7247 Incremental_input::report_script.
7248 * script.h (Script_info): New class.
7252 * x86_64.cc (do_adjust_output_section): Set entsize to
7257 * output.cc (Output_file::close): After short writes, continue
7258 writing from the correct offset in the buffer being written.
7262 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7263 * configure: Regenerate.
7264 * config.in: Regenerate.
7265 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7266 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7270 * incremental.cc (Incremental_inputs_header_data): Renamed from
7271 Incremental_input_header_data.
7272 (Incremental_inputs_header_data::data_size): New field.
7273 (Incremental_inputs_header_data::put_input_file_count): Renamed
7274 from input_file_count.
7275 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7276 from command_line_offset.
7277 (Incremental_inputs_header_data::put_reserved): Renamed from
7279 (Incremental_inputs_entry_data): Renamed from
7280 Incremental_input_entry_data.
7281 (Incremental_inputs_entry_data::data_size): New field.
7282 (Incremental_inputs::report_command_line): New method.
7283 (Incremental_inputs::finalize): New method.
7284 (Incremental_inputs::create_incremental_inputs_data): New method.
7285 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7286 * incremental.h: New file.
7287 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7288 (Layout::finalize): Create incremental inputs section in
7290 (Layout::create_incremental_info_sections): New method.
7291 * layout.h (Layout::incremental_inputs): New method.
7292 (Layout::create_incremental_info_sections): New method.
7293 (Layout::incremental_inputs_): New field.
7294 * main.cc (main): Notify Incremental_input of the command line.
7299 * gold.h (reserve_unordered_map): Define, three versions, one for
7300 each version of Unordered_map.
7301 * layout.cc (Layout::Layout): Remove options parameter. Add
7302 number_of_input_files parameter. Don't initialize options_.
7303 Initialize number_of_input_files_ and resized_signatures_. Move
7304 sections_are_attached_.
7305 (Layout::layout_group): Reserve space for group_signatures_.
7306 (Layout::find_or_add_kept_section): Change name parameter to be a
7307 reference. Resize signatures_ map when it gets large enough.
7308 (Layout::layout_eh_frame): Use parameters->options() instead of
7310 (Layout::make_output_section): Likewise.
7311 (Layout::attach_allocated_section_to_segment): Likewise.
7312 (Layout::finalize, Layout::create_executable_stack): Likewise.
7313 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7314 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7315 * layout.h (class Layout): Update declarations. Remove options_
7316 field. Add number_of_input_files_ and resized_signatures_
7317 fields. Move sections_are_attached_ field.
7318 * main.cc (main): Pass number of input files to Layout
7319 constructor. Don't pass options.
7323 * ffsll.c (ffsll): Correct implementation.
7327 * ffsll.c: New file.
7328 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7329 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7330 * ftruncate.c (ftruncate): Declare before definition.
7331 * mremap.c (mremap): Likewise.
7332 * pread.c (pread): Likewise.
7333 * configure, Makefile.in, config.in: Rebuild.
7335 * mremap.c: New file.
7336 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7337 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7338 (mremap): Declare if HAVE_MREMAP is not defined.
7339 * configure, Makefile.in, config.in: Rebuild.
7343 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7344 position independent.
7345 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7346 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7350 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7352 (needs_dynamic_reloc): Likewise.
7356 * yyscript.y (file_cmd): Recognize EXTERN.
7357 (extern_name_list, extern_name_list_body): New nonterminals.
7358 * script.cc (script_add_extern): Define.
7359 * script-c.h (script_add_extern): Declare.
7363 * object.cc (is_elf_object): Define.
7364 * object.h (is_elf_object): Declare.
7365 * archive.cc (Archive::get_elf_object_for_member): Call
7367 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7371 * output.cc (Output_file::map_anonymous): Define.
7372 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7373 try an anonymous one. Report the size if the mmap fails.
7374 * output.h (class Output_file): Declare map_anonymous.
7378 * target-select.cc (instantiate_target): Don't acquire the lock if
7379 the instantiated_target_ field has already been set.
7383 * gold-threads.h (class Initialize_lock): Define.
7384 * gold-threads.cc (class Initialize_lock_once): Define.
7385 (initialize_lock_control): New static variable.
7386 (initialize_lock_pointer): New static variable.
7387 (initialize_lock_once): New static function.
7388 (Initialize_lock::Initialize_lock): Define.
7389 (Initialize_lock::initialize): Define.
7390 * target-select.h: Include "gold-threads.h".
7391 (class Target_selector): Add lock_ and initialize_lock_ fields.
7392 Don't define instantiate_target, just declare it.
7393 * target-select.cc (Target_selector::Target_selector): Initialize
7395 (Target_selector::instantiate_target): Define.
7396 * descriptors.h: Include "gold-threads.h".
7397 (class Descriptors): Add initialize_lock_ field.
7398 * descriptors.cc (Descriptors::Descriptors): Initialize new
7400 (Descriptors::open): Use initialize_lock_ field
7401 * errors.h (class Errors): Add initialize_lock_ field.
7402 * errors.cc (Errors::Errors): Initialize new field.
7403 (Errors::initialize_lock): Use initialize_lock_ field.
7404 * powerpc.cc (class Target_selector_powerpc): Remove
7405 instantiated_target_ field. In do_recognize call
7406 instantiate_target rather than do_instantiate_target. In
7407 do_instantiate_target just allocate a new target.
7408 * sparc.cc (class Target_selector_sparc): Likewise.
7410 * freebsd.h: New file.
7411 * i386.cc: Include "freebsd.h".
7412 (Target_i386): Derive from Target_freebsd rather than
7414 (Target_selector_i386): Derive from Target_selector_freebsd rather
7415 than Target_selector.
7416 * x86_64.cc: Include "freebsd.h".
7417 (Target_x86_64): Derive from Target_freebsd rather than
7419 (Target_selector_x86_64): Derive from Target_selector_freebsd
7420 rather than Target_selector.
7421 * target.h (class Target): Add adjust_elf_header and
7422 do_adjust_elf_header.
7423 * output.cc (Output_file_header:: do_sized_write): Call target
7424 adjust_elf_header routine.
7425 * configure.tgt: Set targ_osabi.
7426 * configure.ac: Define GOLD_DEFAULT_OSABI.
7427 * parameters.cc (Parameters::default_target): Pass
7428 GOLD_DEFAULT_OSABI to select_target.
7429 * target-select.h (class Target_selector): Make instantiate_target
7430 protected rather than private.
7431 * Makefile.am (HFILES): Add freebsd.h.
7432 * configure, Makefile.in, config.in: Rebuild.
7434 * merge.cc (do_add_input_section): Correct pend value. Change
7435 message about last entry not being null terminated from error to
7440 * incremental.cc: New file.
7441 * Makefile.am (CCFILES): Add incremental.cc.
7442 * Makefile.in: Rebuild.
7446 * layout.cc (Layout::output_section_name): Preserve names
7447 of '.note.' sections.
7451 * descriptors.cc (Descriptors::open): Check that the options are
7452 valid before using them.
7456 * script-sections.h: Include <list>.
7457 (class Script_sections): Change Sections_elements from std::vector
7458 to std::list. Typedef public Elements_iterator. Add
7459 orphan_section_placement_, data_segment_align_start_, and
7460 saw_data_segment_align_ fields. Remove data_segment_align_index_
7462 * script-sections.cc (class Orphan_section_placement): New class.
7463 (class Sections_element): Add virtual functions is_relro and
7464 orphan_section_init. Remove virtual function place_orphan_here.
7465 (class Output_section_definition): Add is_relro and
7466 orphan_section_init. Remove place_orphan_here.
7467 (class Orphan_output_section): Likewise.
7468 (Script_sections::Script_sections): Update for field changes.
7469 (Script_sections::data_segment_align): Set saw_data_segment_align_
7470 and data_segment_align_start_, not data_segment_align_index.
7471 (Script_sections::data_segment_relro_end): Check
7472 saw_data_segment_align_. Use data_segment_align_start_ rather
7473 than data_segment_align_index_.
7474 (Script_sections::place_orphan): Rewrite to use
7475 Orphan_section_placement.
7479 * archive.cc (Archive::add_symbols): Check for a version attached
7480 to the symbol name in the archive map.
7481 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7482 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7483 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7484 (ver_test_11.a): New target.
7485 * testsuite/Makefile.in: Rebuild.
7487 * configure.ac: Check for chsize and posix_fallocate. Replace
7489 * ftruncate.c: New file, from gnulib.
7490 * output.cc (posix_fallocate): Define dummy version if not
7491 HAVE_POSIX_FALLOCATE.
7492 (Output_file::map): Call posix_fallocate rather than lseek and
7494 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7495 * configure, Makefile.in, config.in: Rebuild.
7499 * layout.h (Layout::create_note): Add section_name parameter.
7500 * layout.cc (Layout::create_note): Likewise.
7501 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7505 * descriptors.cc: Include "options.h".
7506 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7507 (Descriptors::open): Always use O_CLOEXEC when opening a new
7508 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7509 then set FD_CLOEXEC.
7511 * sparc.cc (class Target_sparc): Add has_got_section.
7512 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7513 make sure we have a GOT section.
7515 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7516 (Target_sparc::Scan::local): Likewise.
7517 (Target_sparc::Scan::global): Likewise.
7518 (Target_sparc::Relocate::relocate): Likewise.
7519 (Target_sparc::Relocate::relocate_tls): Likewise.
7521 * symtab.cc (Symbol_table::define_default_version): New function,
7522 broken out of add_from_object.
7523 (Symbol_table::add_from_object): Call define_default_version.
7524 (Symbol_table::define_special_symbol): Add resolve_oldsym
7525 parameter. Change all callers. If the version for a symbol comes
7526 from a version script, resolve it with the symbol with the same
7527 name with no version. Also add the symbol without a version if
7529 (do_define_in_output_data): If resolving with oldsym, don't delete
7531 (do_define_in_output_segment): Likewise.
7532 (do_define_as_constant): Likewise.
7533 * symtab.h (class Symbol_table): Update declarations.
7537 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7538 (Read_symbols::requeue): New function.
7539 (Read_symbols::do_read_symbols): If make_elf_object fails because
7540 the target type is not configured, and the file was searched for,
7541 issue a warning and retry with the next directory.
7542 (Add_symbols::run): If the file has an incompatible format, and
7543 it was searched for, requeue the Read_symbols task. On error,
7545 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
7546 dirindex parameter to constructor. Change all callers. Declare
7547 incompatible_warning and requeue.
7548 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7549 input_argument_ and input_group_ fields. Add them to
7550 constructor. Change all callers.
7551 (class Read_script): Add dirindex_ field. Add it to constructor.
7553 * archive.cc (Archive::setup): Remove input_objects parameter.
7555 (Archive::get_file_and_offset): Likewise.
7556 (Archive::read_all_symbols): Likewise.
7557 (Archive::read_symbols): Likewise.
7558 (Archive::get_elf_object_for_member): Remove input_objects
7559 parameter. Add punconfigured parameter. Change all callers.
7560 (Archive::add_symbols): Change return type to bool. Check return
7561 value of include_member.
7562 (Archive::include_all_members): Likewise.
7563 (Archive::include_member): Change return type to bool. Return
7564 false if first included object has incompatible target. Set
7565 included_member_ field.
7566 (Add_archive_symbols::run): If add_symbols returns false, requeue
7568 * archive.h (class Archive): Add included_member_ field.
7569 Initialize it in constructor. Add input_file and searched_for
7570 methods. Update declarations.
7571 (class Add_archive_symbols): Add dirpath_, dirindex_, and
7572 input_argument_ fields. Add them to constructor. Change all
7574 * script.cc: Include "target-select.h".
7575 (class Parser_closure): Add skip_on_incompatible_target_ and
7576 found_incompatible_target_ fields. Add
7577 skip_on_incompatible_target parameter to constructor. Change all
7578 callers. Add methods skip_on_incompatible_target,
7579 clear_skip_on_incompatible_target, found_incompatible_target, and
7580 set_found_incompatible_target.
7581 (read_input_script): Add dirindex parameter. Change all callers.
7582 If parser finds an incompatible target, requeue Read_symbols
7584 (script_set_symbol): Clear skip_on_incompatible_target in
7586 (script_add_assertion, script_parse_option): Likewise.
7587 (script_start_sections, script_add_phdr): Likewise.
7588 (script_check_output_format): New function.
7589 * script.h (read_input_script): Update declaration.
7590 * script-c.h (script_check_output_format): Declare.
7591 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7592 (ignore_cmd): Remove OUTPUT_FORMAT.
7593 * fileread.cc (Input_file::Input_file): Add explicit this.
7594 (Input_file::will_search_for): New function.
7595 (Input_file::open): Add pindex parameter. Change all callers.
7596 * fileread.h (class Input_file): Add input_file_argument method.
7597 Declare will_search_for. Update declarations.
7598 * object.cc (make_elf_object): Add punconfigured parameter.
7600 * object.h (class Object): Make input_file public. Add
7601 searched_for method.
7602 (make_elf_object): Update declaration.
7603 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
7605 * dirsearch.h (class Dirsearch): Update declaration.
7606 * options.h (class General_options): Add --warn-search-mismatch.
7607 * parameters.cc (Parameters::is_compatible_target): New function.
7608 * parameters.h (class Parameters): Declare is_compatible_target.
7609 * workqueue.cc (Workqueue::add_blocker): New function.
7610 * workqueue.h (class Workqueue): Declare add_blocker.
7612 * fileread.cc (Input_file::open): Remove options parameter.
7614 (Input_file::open_binary): Likewise.
7615 * script.cc (read_input_script): Likewise.
7616 * readsyms.h (class Read_symbols): Remove options_ field. Remove
7617 options parameter from constructor. Change all callers.
7618 (class Read_script): Likewise.
7619 * fileread.h (class Input_file): Update declarations.
7620 * script.h (read_input_script): Update declaration.
7624 * po/es.po: New Spanish translation.
7628 * options.cc (parse_short_option): Keep dash_z from registering itself.
7633 * target-reloc.h (relocate_section): Pass output_section to
7635 * i386.cc (Target_i386::should_apply_static_reloc): Add
7636 output_section parameter. Change all callers.
7637 (Target_i386::Relocate::relocate): Add output_section parameter.
7638 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7639 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7640 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7641 * testsuite/two_file_shared.sh: New script.
7642 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7643 (check_DATA): Add two_file_shared.dbg.
7644 (two_file_shared.dbg): New target.
7645 * testsuite/Makefile.in: Rebuild.
7649 * configure.ac: Check for byteswap.h.
7650 * configure: Rebuild.
7651 * config.in: Rebuild.
7655 * layout.cc (Layout::find_or_add_kept_section): New function.
7656 (Layout::add_comdat): Removed.
7657 * layout.h (struct Kept_section): Move out of class Layout.
7658 Remove trailing underscores from field names. Add group_sections
7659 field. Rename group_ field to is_group. Change all uses.
7660 (class Layout): Declare find_or_add_kept_section, not add_comdat.
7661 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7662 comdat_groups_ field.
7663 (Sized_relobj::include_section_group): Use
7664 find_or_add_kept_section and Kept_section::group_sections.
7665 (Sized_relobj::include_linkonce_section): Likewise.
7666 * object.cc (class Sized_relobj): Don't define Comdat_group or
7667 Comdat_group_table. Remove find_comdat_group and
7668 add_comdat_group. Remove comdat_groups_ field.
7669 * plugin.cc (include_comdat_group): Use
7670 Layout::find_or_add_kept_section.
7674 * README: --gc-sections and map files are now supported. Document
7675 some build requirements.
7678 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7679 relocatable link set the value of the section symbol to zero.
7680 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7681 relocatable link don't include the section address in the local
7687 * options.h (class Search_directory): Add is_system_directory.
7688 (class General_options): Declare is_in_system_directory.
7689 * options.cc (get_relative_sysroot): Make static.
7690 (get_default_sysroot): Make static.
7691 (General_optoins::is_in_system_directory): New function.
7692 * fileread.cc (Input_file::is_in_system_directory): New function.
7693 * fileread.h (class Input_file): Declare is_in_system_directory.
7694 * object.h (class Object): Add is_in_system_directory.
7695 (class Input_objects): Remove system_library_directory_ field.
7696 * object.cc (Input_objects::add_object): Don't set
7697 system_library_directory_.
7698 (input_objects::found_in_system_library_directory): Remove.
7699 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7700 parameter. Change all callers.
7701 (Symbol_table::sized_write_globals): Likewise.
7702 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7703 Call Object::is_in_system_directory.
7704 * symtab.h (class Symbol_table): Update declarations.
7707 * descriptors.h (Open_descriptor): Add is_on_stack field.
7708 * descriptors.cc (Descriptors::open): If the descriptor is on the
7709 top of the stack, remove it. Initialize is_on_stack field.
7710 (Descriptors::release): Only add pod to stack if it is not on the
7712 (Descriptors::close_some_descriptor): Clear stack_next and
7716 * output.cc (Output_section::find_starting_output_address): Rename
7717 from starting_output_address; add PADDR parameter; change return
7719 * output.h (class Output_section): Declare
7720 find_starting_output_address instead of starting_output_address.
7721 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7722 section symbol for which we can't find a merge section.
7725 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7726 hidden or internal, force the symbol to be local.
7727 * resolve.cc (Symbol::override_visibility): Define.
7728 (Symbol::override_base): Use override_visibility.
7729 (Symbol_table::resolve): Likewise.
7730 (Symbol::override_base_with_special): Likewise.
7731 (Symbol_table::override_with_special): If the visibility is hidden
7732 or internal, force the symbol to be local.
7733 * symtab.h (class Symbol): Add set_visibility and
7734 override_visibility.
7735 * testsuite/ver_test_1.sh: New file.
7736 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7737 (check_DATA): Add ver_test_1.syms.
7738 (ver_test_1.syms): New target.
7739 * testsuite/Makefile.in: Rebuild.
7743 * layout.cc (Layout::choose_output_section): Don't rename sections
7744 when using a linker script that has a SECTIONS clause.
7745 * Makefile.in: Regenerate.
7747 * testsuite/Makefile.am (script_test_5.sh): New test case.
7748 * testsuite/Makefile.in: Regenerate.
7749 * testsuite/script_test_5.cc: New file.
7750 * testsuite/script_test_5.sh: New file.
7751 * testsuite/script_test_5.t: New file.
7755 * archive.cc (Archive::include_member): Update calls to add_symbols.
7756 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7757 the Layout argument.
7758 * dynobj.h (do_add_symbols): Add the Layout argument.
7759 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7761 * object.h (Object::add_symbols): Add the Layout argument.
7762 (Object::do_add_symbols): Add the Layout argument.
7763 (Sized_relobj::do_add_symbols): Add the Layout argument.
7764 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7765 Unify the two versions.
7766 (Add_plugin_symbols): Remove.
7767 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7768 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7769 (Add_plugin_symbols): Remove.
7770 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7771 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7772 (Add_symbols::run): Make it work with Pulginobj.
7776 * object.cc (Sized_relobj::do_layout): Make info message start
7777 with lower case letter.
7781 * binary.cc: Fix file comment.
7783 * options.h (enum Incremental_disposition): Define.
7784 (class General_options): Add new options: --incremental,
7785 --incremental_changed, --incremental_unchanged,
7786 --incremental_unknown. Add incremental_disposition_ and
7787 implicit_incremental_ fields.
7788 (General_options::incremental_disposition): New function.
7789 (class Position_dependent_options): Add incremental_disposition
7791 (Position_dependent_options::copy_from_options): Set incremental
7793 * options.cc (General_options::parse_incremental_changed): New
7795 (General_options::parse_incremental_unchanged): New function.
7796 (General_options::parse_incremental_unknown): New function.
7797 (General_options::General_options): Initialize new fields
7798 incremental_disposition_ and implicit_incremental_.
7799 (General_options::finalize): Check for uasge of --incremental-*
7800 without --incremental.
7804 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7805 pointer and to report location as the file name associated with
7807 (gold_undefined_symbol_at_location): New function to replace the
7808 old gold_undefined_symbol functionality.
7809 * target-reloc.h (relocate_section): Update to use
7810 gold_undefined_symbol_at_location.
7811 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7812 Call gold_undefined_symbol function rather than gold_error.
7813 * errors.h (Errors::undefined_symbol): Take location as a
7814 string, rather than calculating it from a relocation.
7815 * errors.cc (Errors::fatal): Print "fatal error:" before the
7817 (Errors::error, Errors::error_at_location): Print "error: "
7818 before the formatted message.
7819 (Errors::undefined_symbol): Take location as a string, rather
7820 than calculating it from a relocation.
7821 (gold_undefined_symbol_at_location): New function akin to
7822 old gold_undefined_symbol, calculates location from relocation.
7823 (gold_undefined_symbol): Change to take only a Symbol pointer
7824 and to report location as the file name associated with the symbol.
7825 * testsuite/debug_msg.sh: Update for changed error messages.
7826 * testsuite/undef_symbol.sh: Likewise.
7831 * reduced_debug_output.h
7832 (Output_reduced_debug_abbrev_section::failed): Use format for
7834 (Output_reduced_debug_info_section::faild): Likewise.
7838 * script.cc (Lazy_demangler): New class.
7839 (Version_script_info::get_symbol_version_helper): Demangle a
7844 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7846 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7850 * version.cc (version_string): Bump to 1.9.
7852 * gold.h: Include <cstring> and <stdint.h>.
7853 * version.cc: Include <cstdio>.
7854 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7856 * reduced_debug_output.cc (insert_into_vector): Rename from
7857 Insert_into_vector; change all callers. Use Swap_unaligned to
7858 avoid aliasing issue; remove union since it is unnecessary.
7862 * Makefile.am (CCFILES): Add gc.cc.
7864 * Makefile.in: Regenerate.
7865 * gold.cc (Gc_runner): New class.
7866 (queue_initial_tasks): Call garbage collection related tasks
7867 when corresponding options are invoked.
7868 (queue_middle_gc_tasks): New function.
7869 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7870 processed early before laying out sections during garbage collection.
7871 * gold.h (queue_middle_gc_tasks): New function.
7872 (is_prefix_of): Move from "layout.cc".
7873 * i386.cc (Target_i386::gc_process_relocs): New function.
7874 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7875 * main.cc (main): Create object of class "Garbage_collection".
7876 * object.cc (Relobj::copy_symbols_data): New function.
7877 (Relobj::is_section_name_included): New function.
7878 (Sized_relobj::do_layout): Allow this function to be called twice
7879 during garbage collection and defer layout of section during the
7881 * object.h (Relobj::get_symbols_data): New function.
7882 (Relobj::is_section_name_included): New function.
7883 (Relobj::copy_symbols_data): New function.
7884 (Relobj::set_symbols_data): New function.
7885 (Relobj::get_relocs_data): New function.
7886 (Relobj::set_relocs_data): New function.
7887 (Relobj::is_output_section_offset_invalid): New pure virtual function.
7888 (Relobj::gc_process_relocs): New function.
7889 (Relobj::do_gc_process_relocs): New pure virtual function.
7890 (Relobj::sd_): New data member.
7891 (Sized_relobj::is_output_section_offset_invalid): New function.
7892 (Sized_relobj::do_gc_process_relocs): New function.
7893 * options.h (General_options::gc_sections): Modify to not be a no-op.
7894 (General_options::print_gc_sections): New option.
7895 * plugin.cc (Plugin_finish::run): Remove function call to
7896 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7897 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7898 * reloc.cc (Read_relocs::run): Add task to process relocs and
7899 determine unreferenced sections when doing garbage collection.
7900 (Gc_process_relocs): New class.
7901 (Sized_relobj::do_gc_process_relocs): New function.
7902 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7903 sections that are garbage collected.
7904 * reloc.h (Gc_process_relocs): New class.
7905 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7906 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7907 symbols whose corresponding sections are garbage collected.
7908 (Symbol_table::Symbol_table): Add new parameter for the garbage
7910 (Symbol_table::gc_mark_undef_symbols): New function.
7911 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7912 (Symbol_table::gc_mark_dyn_syms): New function.
7913 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7915 (Symbol_table::add_from_object): Likewise.
7916 (Symbol_table::add_from_relobj): When building shared objects, do not
7917 treat externally visible symbols as garbage.
7918 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7919 table information for static and relocatable links.
7920 * symtab.h (Symbol_table::set_gc): New function.
7921 (Symbol_table::gc): New function.
7922 (Symbol_table::gc_mark_undef_symbols): New function.
7923 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7924 (Symbol_table::gc_mark_dyn_syms): New function.
7925 (Symbol_table::gc_): New data member.
7926 * target.h (Sized_target::gc_process_relocs): New pure virtual
7928 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7929 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7933 * options.h (General_options::gc_sections): Define as a no-op for now.
7934 (General_options::no_keep_memory): Ditto.
7935 (General_options::Bshareable): Define.
7936 * options.cc (General_options::finalize): Honor -Bshareable.
7940 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7941 read the value in the contents, since we don't use it. Use the
7942 template endianness when writing.
7943 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7947 * configure.tgt (powerpc64-*): Fix targ_obj.
7951 * object.cc (Sized_relobj::write_local_symbols): Don't write out
7952 local symbols when stripping all symbols.
7956 * output.cc (Output_reloc): Add explicit instantiations.
7960 * archive.cc (Archive::get_elf_object_for_member): Remove call
7961 to File_read::claim_for_plugin.
7962 * descriptors.cc (Descriptors::open): Remove reference to
7964 (Descriptors::claim_for_plugin): Remove.
7965 * descriptors.h (Descriptors::claim_for_plugin): Remove.
7966 (Descriptors::is_claimed): Remove.
7967 (claim_descriptor_for_plugin): Remove.
7968 * fileread.cc (File_read::claim_for_plugin): Remove.
7969 * fileread.h (File_read::claim_for_plugin): Remove.
7970 (File_read::descriptor): Reopen descriptor if necessary.
7971 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
7972 (Plugin_manager::all_symbols_read): Add task parameter. Change
7974 (Plugin_manager::get_input_file): New function.
7975 (Plugin_manager::release_input_file): New function.
7976 (Pluginobj::Pluginobj): Add filesize parameter and initialize
7977 corresponding data member.
7978 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
7979 and pass to base constructor. Change all callers.
7980 (get_input_file, release_input_file): New functions.
7981 (make_sized_plugin_object): Add filesize parameter. Change all callers.
7982 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
7983 (Plugin_manager::all_symbols_read): Add task parameter.
7984 (Plugin_manager::get_input_file): New function.
7985 (Plugin_manager::release_input_file): New function.
7986 (Plugin_manager::task_): New data member.
7987 (Pluginobj::Pluginobj): Add filesize parameter.
7988 (Pluginobj::filename): New function.
7989 (Pluginobj::descriptor): New function.
7990 (Pluginobj::filesize): New function.
7991 (Pluginobj::filesize_): New data member.
7992 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
7993 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
7994 File_read::claim_for_plugin; use Object::unlock to unlock the file.
7996 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
7997 with archive libraries.
7998 * testsuite/Makefile.in: Regenerate.
7999 * testsuite/plugin_test.c (struct sym_info): New type.
8000 (get_input_file, release_input_file): New static variables.
8001 (onload): Capture new transfer vector entries.
8002 (claim_file_hook): Stop reading at end of file according to filesize.
8003 Factor out parsing of readelf output into separate function.
8004 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8005 APIs and get the source file name from the symbol table. Convert
8006 source file name to corresponding object file name. Print info
8007 message when adding new input files.
8008 (parse_readelf_line): New function.
8009 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8010 * testsuite/plugin_test_2.sh: Likewise.
8011 * testsuite/plugin_test_3.sh: Likewise.
8012 * testsuite/plugin_test_4.sh: New test case.
8016 * version.cc (version_string): Bump to 1.8.
8020 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8021 * plugin.cc (Plugin_manager::finish): Rename as
8022 layout_deferred_objects. Move cleanup to separate function.
8023 (Plugin_manager::cleanup): New function.
8024 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8026 * plugin.h (Plugin_manager::finish): Rename as
8027 layout_deferred_objects.
8028 (Plugin_manager::cleanup): New function.
8029 (Plugin_manager::cleanup_done): New field.
8033 * plugin.cc (is_visible_from_outside): New function.
8034 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8035 so we don't return "IR only" status for exported symbols or -r links.
8037 * testsuite/Makefile.am (plugin_test_3): New test case.
8038 * testsuite/Makefile.in: Regenerate.
8039 * testsuite/plugin_test_3.sh: New file.
8043 * object.cc (Sized_relobj::layout_section): New function.
8044 (Sized_relobj::do_layout): Defer layout of input sections until after
8045 plugin has provided replacement files.
8046 (Sized_relobj::do_layout_deferred_sections): New function.
8047 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8048 (Relobj::layout_deferred_sections): New function.
8049 (Relobj::do_layout_deferred_sections): New function.
8050 (Sized_relobj::do_layout_deferred_sections): New function.
8051 (Sized_relobj::layout_section): New function.
8052 (Sized_relobj::Deferred_layout): New structure.
8053 (Sized_relobj::deferred_layout_): New field.
8054 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8055 Change all callers. Layout deferred sections.
8056 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8058 (Plugin_hook::run): Move code from do_plugin_hook inline.
8059 (Plugin_hook::do_plugin_hook): Remove.
8060 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8061 (Plugin_manager::finish): Renamed, was cleanup.
8062 (Plugin_manager::should_defer_layout): New function.
8063 (Plugin_manager::add_deferred_layout_object): New function.
8064 (Plugin_manager::Deferred_layout_list): New type.
8065 (Plugin_manager::deferred_layout_objects_): New field.
8066 (Plugin_hook::do_plugin_hook): Remove.
8070 * options.h (class General_options): Add --no case for
8075 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8077 (Plugin_manager::claim_file): Create plugin object even if
8078 plugin did not call the add_symbols callback.
8079 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8080 asking for more symbols than were added.
8081 * testsuite/Makefile.am (plugin_test_1): Add test case with
8083 (empty.syms): New target.
8084 * testsuite/Makefile.in: Regenerate.
8085 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8086 message. Don't call add_symbols if no globals.
8087 (all_symbols_read_hook): Don't provide replacement for empty
8092 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8093 r_type == 0 for a local symbol with r_sym == 0.
8094 (scan_relocatable_relocs): Pass r_sym to
8095 local_non_section_strategy.
8096 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8099 * configure.ac: Update test for TLS descriptors: they are
8100 supported as of glibc 2.9.
8101 * configure: Rebuild.
8106 * target-reloc.h (Default_scan_relocatable_relocs): For each
8107 function, map r_type == 0 to RELOC_DISCARD.
8111 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8112 object to override a kept COMDAT group from a plugin object.
8117 * yyscript.y (file_cmd): Handle INPUT.
8119 * testsuite/initpri1.c: Change all declarations to be full
8120 prototypes by adding void, to avoid compiler warnings.
8124 * options.cc (General_options::parse_plugin_opt): New.
8125 (General_options::add_plugin): The argument now is just the filename.
8126 (General_options::add_plugin_option): New.
8127 * options.h (plugin_opt): New.
8128 (add_plugin): Change argument name.
8129 (add_plugin_option): New.
8130 * plugin.cc (Plugin::load): Don't parse the plugin option.
8131 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8132 (Plugin::add_option): New.
8133 (Plugin::args_): Change type.
8134 (Plugin::filename_): New.
8135 (Plugin_manager::add_plugin_option): New.
8136 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8137 * testsuite/Makefile.in: Regenerate.
8141 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8142 Handle --strip-lto-sections option.
8143 * options.h (strip_lto_sections): New option.
8147 * plugin.cc (ld_plugin_message): Change format parameter to const.
8148 Fix mismatch between new[] and delete.
8152 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8157 * options.cc (General_options::parse_dynamic_list): New function.
8158 * options.h (General_options): New flags dynamic_list,
8159 dynamic_list_data, dynamic_list_cpp_new, and
8160 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8161 (General_options::in_dynamic_list): New function.
8162 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8163 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8164 (Lex::can_continue_name): Likewise.
8166 (read_script_file): New parameter script_options.
8167 (read_dynamic_list): New function.
8168 (Script_options::define_dynamic_list): New function.
8169 (dynamic_list_keyword_parsecodes): New variable.
8170 (dynamic_list_keywords): New variable.
8171 * script.h (Script_options::define_dynamic_list): New function
8173 (read_dynamic_list): New function prototype.
8174 * symtab.cc (strprefix): New macro.
8175 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8176 dynamic_list_data, dynamic_list_cpp_new, and
8177 dynamic_list_cpp_typeinfo.
8178 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8179 (dynamic_list_expr): New rule.
8180 (dynamic_list_nodes): Likewise.
8181 (dynamic_list_node): Likewise.
8182 * testsuite/Makefile.am (dynamic_list): New test.
8183 * testsuite/Makefile.in: Regenerated.
8184 * testsuite/dynamic_list.t: New file.
8185 * testsuite/dynamic_list.sh: New file.
8189 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8190 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8191 (t11_last): Likewise.
8192 * testsuite/ver_test_6.c (main): Likewise.
8196 * options.c (General_options::finalize): Add check for -static and
8198 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8203 * plugin.cc (make_sized_plugin_object): Fix conditional
8204 compilation to work when not all targets are enabled.
8208 * archive.cc (Archive::get_file_and_offset): Use filename instead
8209 of name to get library path.
8210 (Archive::include_member): Unlock external member of a thin archive.
8212 * testsuite/Makefile.am (TEST_AR): New variable.
8213 (thin_archive_test_1): New test.
8214 (thin_archive_test_2): New test.
8215 * testsuite/Makefile.in: Regenerate.
8216 * testsuite/thin_archive_main.cc: New file.
8217 * testsuite/thin_archive_test_1.cc: New file.
8218 * testsuite/thin_archive_test_2.cc: New file.
8219 * testsuite/thin_archive_test_3.cc: New file.
8220 * testsuite/thin_archive_test_4.cc: New file.
8224 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8225 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8227 (Sized_relobj::do_finalize_local_symbols): Likewise.
8228 (Sized_relobj::map_to_kept_section): Likewise.
8229 * object.h (Sized_relobj::invalid_address): New constant.
8230 (Sized_relobj::do_output_section_offset): Check for invalid_address
8232 * output.cc (Output_reloc::local_section_offset): Use constant
8233 invalid_address instead of -1U.
8234 (Output_reloc::get_address): Likewise.
8235 (Output_section::output_address): Change -1U to -1ULL.
8236 * output.h (Output_reloc::invalid_address): New constant.
8237 * reloc.cc (Sized_relobj::write_sections): Use constant
8238 invalid_address instead of -1U.
8239 (Sized_relobj::relocate_sections): Likewise.
8240 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8241 values for merge sections.
8242 * target-reloc.h (relocate_for_relocatable): Use constant
8243 invalid_address instead of -1U.
8247 Add plugin functionality for link-time optimization (LTO).
8248 * configure.ac (plugins): Add --enable-plugins option.
8249 * configure: Regenerate.
8250 * config.in: Regenerate.
8251 * Makefile.am (LIBDL): New variable.
8252 (CCFILES): Add plugin.cc.
8253 (HFILES): Add plugin.h.
8254 (ldadd_var): Add LIBDL.
8255 * Makefile.in: Regenerate.
8257 * archive.cc: Include "plugin.h".
8258 (Archive::setup): Don't preread archive symbols when using a plugin.
8259 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8260 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8262 (Archive::include_member): Add symbols from plugin objects.
8263 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8264 * descriptors.cc (Descriptors::open): Check for file descriptors
8265 abandoned by plugins.
8266 (Descriptors::claim_for_plugin): New function.
8267 * descriptors.h (Descriptors::claim_for_plugin): New function.
8268 (Open_descriptor::is_claimed): New field.
8269 (claim_descriptor_for_plugin): New function.
8270 * fileread.cc (File_read::claim_for_plugin): New function.
8271 * fileread.h (File_read::claim_for_plugin): New function.
8272 (File_read::descriptor): New function.
8273 * gold.cc: Include "plugin.h".
8274 (queue_initial_tasks): Add task to call plugin hooks for generating
8276 * main.cc: Include "plugin.h".
8277 (main): Load plugin libraries.
8278 * object.h (Pluginobj): Declare.
8279 (Object::pluginobj): New function.
8280 (Object::do_pluginobj): New function.
8281 (Object::set_target): New function.
8282 * options.cc: Include "plugin.h".
8283 (General_options::parse_plugin): New function.
8284 (General_options::General_options): Initialize plugins_ field.
8285 (General_options::add_plugin): New function.
8286 * options.h (Plugin_manager): Declare.
8287 (General_options): Add --plugin option.
8288 (General_options::has_plugins): New function.
8289 (General_options::plugins): New function.
8290 (General_options::add_plugin): New function.
8291 (General_options::plugins_): New field.
8292 * plugin.cc: New file.
8293 * plugin.h: New file.
8294 * readsyms.cc: Include "plugin.h".
8295 (Read_symbols::do_read_symbols): Check for archive before checking
8296 for ELF file. Call plugin hooks to claim files.
8297 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8298 from a real object file; force override when processing replacement
8300 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8301 (Symbol::init_base_object): Likewise.
8302 (Symbol::init_base_output_data): Likewise.
8303 (Symbol::init_base_output_segment): Likewise.
8304 (Symbol::init_base_constant): Likewise.
8305 (Symbol::init_base_undefined): Likewise.
8306 (Symbol::output_section): Assert that object is not a plugin.
8307 (Symbol_table::add_from_pluginobj): New function.
8308 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8310 (Symbol_table::sized_write_globals): Likewise.
8311 (Symbol_table::add_from_pluginobj): Instantiate template.
8312 * symtab.h (Sized_pluginobj): Declare.
8313 (Symbol::in_real_elf): New function.
8314 (Symbol::set_in_real_elf): New function.
8315 (Symbol::in_real_elf_): New field.
8316 (Symbol_table::add_from_pluginobj): New function.
8318 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8319 (LIBDL): New variable.
8321 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8322 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8323 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8324 (MOSTLYCLEANFILES): Likewise.
8325 * testsuite/Makefile.in: Regenerate.
8326 * testsuite/plugin_test.c: New file.
8327 * testsuite/plugin_test_1.sh: New file.
8328 * testsuite/plugin_test_2.sh: New file.
8332 * target-reloc.h (relocate_section): Check whether a symbol is
8333 defined by the ABI before reporting an undefined symbol error.
8334 * target.h (Target::is_defined_by_abi): Make parameter const.
8335 (Target::do_is_defined_by_abi): Likewise.
8336 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8337 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8338 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8339 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8340 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8341 * testsuite/Makefile.in: Rebuild.
8343 * fileread.cc (make_view): Add casts to avoid warning.
8347 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8348 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8352 * options.h (General_options::output_is_executable): New.
8353 (General_options::output_is_pie): New.
8354 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8355 for shared libraries.
8356 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8360 * options.h (origin): New -z option.
8361 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8362 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8367 * fileread.cc (File_read::make_view): Add check for attempt to map
8372 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8373 explicit instantiations.
8378 * options.cc (General_options::finalize): Allow undefined symbols
8379 in shlibs if linking -shared.
8382 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8383 symbols as not needing a dynsym entry.
8387 * fileread.cc (File_read::open): Do not lock the file unless it
8388 was successfully opened.
8392 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8393 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8394 * testsuite/tls_test.cc (struct int128): 128-bit struct
8395 for testing TLS relocs with non-zero addend.
8396 (v12): New TLS variable.
8398 (t_last): Add check for v12.
8399 * testsuite/tls_test.h (t12): New function.
8400 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8404 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8405 set tls_segment_ or relro_segment_.
8406 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8408 * output.h (Output_section::clear_is_relro): New function.
8409 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8410 sections specially even when output_data_ is empty.
8411 (Output_segment::maximum_alignment): When first section is relro,
8412 only force alignment for PT_LOAD segments.
8413 * script.cc (script_data_segment_align): New function.
8414 (script_data_segment_relro_end): New function.
8415 * script-c.h (script_data_segment_align): Declare.
8416 (script_data_segment_relro_end): Declare.
8417 * script-sections.h (class Script_sections): Declare
8418 data_segment_align and data_segment_relro_end. Add fields
8419 segment_align_index_ and saw_relro_end_.
8420 * script-sections.cc (class Sections_element): Add set_is_relro
8421 virtual function. Add new bool* parameter to place_orphan_here.
8422 Add get_output_section virtual function.
8423 (class Output_section_definition): Add set_is_relro. Add new
8424 bool* parameter to place_orphan_here. Add get_output_section.
8425 Add is_relro_ field.
8426 (Output_section_definition::Output_section_definition): Initialize
8427 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8428 and is_relro_ fields.
8429 (Output_section_definition::place_orphan_here): Add is_relro
8431 (Output_section_definition::set_section_addresses): Set relro for
8433 (Output_section_definition::alternate_constraint): Likewise.
8434 (class Orphan_output_section): Add new bool* parameter to
8435 place_orphan_here. Add get_output_section.
8436 (Orphan_output_section::place_orphan_here): Add is_relro
8438 (Script_sections::Script_sections): Initialize
8439 data_segment_align_index_ and saw_relro_end_.
8440 (Script_sections::data_segment_align): New function.
8441 (Script_sections::data_segment_relro_end): New function.
8442 (Script_sections::place_orphan): Set or clear is_relro.
8443 (Script_sections::set_section_addresses): Force alignment of first
8445 * yyscript.y (exp): Call script_data_segment_align and
8446 script_data_segment_relro_end.
8447 * testsuite/relro_script_test.t: New file.
8448 * testsuite/relro_test.cc (using_script): Declare.
8449 (t1, t2): Test using_script.
8450 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8451 (relro_script_test_SOURCES): Define.
8452 (relro_script_test_DEPENDENCIES): Define.
8453 (relro_script_test_LDFLAGS): Define.
8454 (relro_script_test_LDADD): Define.
8455 (relro_script_test.so): New target.
8456 * testsuite/Makefile.in: Rebuild.
8460 * archive.cc (Archive::total_archives, Archive::total_members)
8461 (Archive::total_members_loaded): New variables.
8462 (Archive::setup): Add parameter. Add option to preread
8464 (Archive::read_armap): Add counter.
8465 (Archive::get_file_and_offset): New function.
8466 (Archive::get_elf_object_for_member): New function.
8467 (Archive::read_all_symbols): New function.
8468 (Archive::read_symbols): New function.
8469 (Archive::add_symbols): Add counters.
8470 (Archive::include_all_members): Use armap to find members if it's
8472 (Archive::include_member): Skip reading symbols if already read.
8473 Factored code into Archive::get_file_and_offset and
8474 Archive::get_elf_object_for_member. Changed call to
8475 Mapfile::report_include_archive_member.
8476 (Archive::print_stats): New function.
8477 * archive.h: Declare Object and Read_symbols_data classes.
8478 (Archive::Archive): Add initializers for new members.
8479 (Archive::setup): Add parameter.
8480 (Archive::print_stats): New function.
8481 (Archive::total_archives, Archive::total_members)
8482 (Archive::total_members_loaded): New variables.
8483 (Archive::get_file_and_offset): New function.
8484 (Archive::get_elf_object_for_member): New function.
8485 (Archive::read_all_symbols): New function.
8486 (Archive::read_symbols): New function.
8487 (Archive::Archive_member): New class.
8488 (Archive::members_): New member.
8489 (Archive::num_members_): New member.
8490 * main.cc: Include archive.h.
8491 (main): Call Archive::print_stats.
8492 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8493 archive parameter; member_name is now the fully-decorated name.
8494 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8495 * options.h: (General_options): Add --preread-archive-symbols option.
8496 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8501 * symtab.h (Symbol::use_plt_offset): New function.
8502 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8503 * powerpc.cc (Relocate::relocate): Likewise.
8504 * sparc.cc (Relocate::relocate): Likewise.
8505 * x86_64.cc (Relocate::relocate): Likewise.
8506 * testsuite/weak_plt.sh: New test.
8507 * testsuite/weak_plt_main.cc: New test.
8508 * testsuite/weak_plt_shared.cc: New test.
8509 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8510 (check_PROGRAMS): Add weak_plt.
8511 (check_DATA): Add weak_plt_shared.so.
8512 (weak_plt_main_pic.o, weak_plt): New targets.
8513 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8514 * testsuite/Makefile.in: Rebuild.
8516 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8518 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8519 * testsuite/Makefile.in: Rebuild.
8523 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8524 * Makefile.in: Regenerate.
8525 * po/POTFILES.in: Regenerate.
8529 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8530 symbols before other symbols.
8531 * testsuite/script_test_2.cc (test_addr): Declare.
8532 (test_addr_alias): Declare.
8533 (main): Check that test_addr and test_addr_alias have the right
8535 * testsuite/script_test_2.t: Define test_addr_alias and
8541 * descriptors.cc: New file.
8542 * descriptors.h: New file.
8543 * gold-threads.h (class Hold_optional_lock): New class.
8544 * fileread.cc: Include "descriptors.h".
8545 (File_read::~File_read): Release descriptor rather than closing
8547 (File_read::open) [file]: Call open_descriptor rather than open.
8548 Set is_descriptor_opened_.
8549 (File_read::open) [memory]: Assert that descriptor is not open.
8550 (File_read::reopen_descriptor): New function.
8551 (File_read::release): Release descriptor.
8552 (File_read::do_read): Make non-const. Reopen descriptor.
8553 (File_read::read): Make non-const.
8554 (File_read::make_view): Reopen descriptor.
8555 (File_read::do_readv): Likewise.
8556 * fileread.h (class File_read): Add is_descriptor_opened_ field.
8557 Update declarations.
8558 * layout.cc: Include "descriptors.h".
8559 (Layout::create_build_id): Use open_descriptor rather than open.
8560 * output.cc: Include "descriptors.h".
8561 (Output_file::open): Use open_descriptor rather than open.
8562 * archive.cc (Archive::const_iterator): Change Archive to be
8564 (Archive::begin, Archive::end): Make non-const.
8565 (Archive::count_members): Likewise.
8566 * archive.h (class Archive): Update declarations.
8567 * object.h (Object::read): Make non-const.
8568 * Makefile.am (CCFILES): Add descriptors.cc.
8569 (HFILES): Add descriptors.h.
8570 * Makefile.in: Rebuild.
8573 * gold.h: Always include <clocale>. Add Solaris workarounds
8574 following code in binutils/sysdep.h.
8577 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8578 this->eh_frame_hdr_ is NULL before using it.
8580 * dynobj.cc (Versions::Versions): Update comment.
8582 * dynobj.cc (Versions::Versions): If there is an soname, use it as
8583 the base version name.
8585 * stringpool.cc (Stringpool_template::add_with_length): Set key to
8586 array size plus one.
8587 (Stringpool_template::set_string_offsets): Subtract one from key
8588 before using it as an array index.
8589 (Stringpool_template::get_offset_with_length): Likewise.
8590 (Stringpool_template::write_to_buffer): Likewise.
8591 * stringpool.h (Stringpool_template::get_offset_from_key):
8597 * object.h (Merged_symbol_value::value): Do our best to handle a
8601 * script.cc (Version_script_info::get_versions): Don't add empty
8602 version tag to return value.
8603 (Version_script_info::get_symbol_version_helper): Change return
8604 type to bool. Add pversion parameter. Change all callers.
8605 (script_register_vers_node): Don't require a non-NULL tag.
8606 * script.h (class Version_script_info): Update declarations.
8607 (Version_script_info::get_symbol_version): Change return type to
8608 bool. Add version parameter. Change all callers.
8609 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8610 handling. Handle an empty version from a version script.
8611 (Symbol_table::define_special_symbol): Likewise.
8612 * testsuite/ver_test_10.script: New file.
8613 * testsuite/ver_test_10.sh: New file.
8614 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8615 (check_DATA): Add ver_test_10.syms.
8616 (ver_test_10.syms, ver_test_10.so): New target.
8617 * testsuite/Makefile.in: Rebuild.
8621 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8622 to zero for undefined symbols from dynamic libraries.
8626 * symtab.cc (Symbol_table::resolve): Remove version parameter.
8628 * symtab.h (class Symbol_table): Update declaration.
8629 * testsuite/ver_test_9.cc: New file.
8630 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8631 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8632 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8633 (ver_test_9.so, ver_test_9.o): New targets.
8634 * testsuite/Makefile.in: Rebuild.
8638 * options.h (class General_options): Define --check-sections.
8639 * layout.cc (Layout::set_segment_offsets): Handle
8642 * options.h (class General_options): Define -n/--nmagic and
8644 * options.cc (General_options::finalize): For -n/--nmagic or
8645 -N/--omagic, set -static.
8646 * layout.cc (Layout::attach_allocated_section_to_segment): If
8647 -N/--omagic, don't put read-only and read-write sections in
8649 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8650 finding a read-only segment.
8651 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8652 don't set the minimum segment alignment to the common page size,
8653 and don't set the file offset to the address modulo the page size.
8654 * script-sections.cc (Script_sections::create_segments): If
8655 -n/--omagic, don't put read-only and read-write sections in
8658 * cref.cc: New file.
8660 * options.h (class General_options): Add --print-symbol-counts.
8661 * main.cc (main): Issue defined symbol report if requested.
8662 * archive.cc (Archive::interpret_header): Make into a const member
8664 (Archive::add_symbols): Call Input_objects::archive_start and
8666 (Archive::const_iterator): Define new class.
8667 (Archive::begin, Archive::end): New functions.
8668 (Archive::include_all_members): Rewrite to use iterator.
8669 (Archive::count_members): New function.
8670 * archive.h (class Archive): Update declarations.
8671 (Archive::filename): New function.
8672 * object.cc: Include "cref.h".
8673 (Sized_relobj::Sized_relobj): Initialize defined_count_.
8674 (Sized_relobj::do_get_global_symbol_counts): New function.
8675 (Input_objects::add_object): Add object to cross-referencer.
8676 (Input_objects::archive_start): New function.
8677 (Input_objects::archive_stop): New function.
8678 (Input_objects::print_symbol_counts): New function.
8679 * object.h: Declare Cref and Archive.
8680 (Object::get_global_symbol_counts): New function.
8681 (Object::do_get_global_symbol_counts): New pure virtual function.
8682 (class Sized_relobj): Add defined_count_ field. Update
8684 (class Input_objects): Add cref_ field. Update constructor.
8685 Update declarations.
8686 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8688 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8690 (Sized_dynobj::do_get_global_symbol_counts): New function.
8691 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8692 defined_count_. Update declarations. Define Symbols typedef.
8693 * symtab.cc (Symbol_table::add_from_relobj): Add defined
8694 parameter. Change all callers.
8695 (Symbol_table::add_from_dynobj): Add sympointers and defined
8696 parameters. Change all callers.
8697 * symtab.h (class Symbol_table): Update declarations.
8698 * Makefile.am (CCFILES): Add cref.cc.
8699 (HFILES): Add cref.h.
8700 * Makefile.in: Rebuild.
8704 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8705 to zero when writing undefined symbols.
8709 * output.cc (Output_section::add_input_section): Don't try to
8710 merge empty merge sections.
8714 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8715 Include symbol version in error message.
8719 * configure.ac (gold_cv_c_random_seed): New configured variable.
8720 (RANDOM_SEED_CFLAGS): New substituted variable.
8721 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8722 * configure: Rebuild.
8723 * Makefile.in: Likewise.
8724 * testsuite/Makefile.in: Likewise.
8728 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8729 where we see NAME/NULL and NAME/VERSION as separate symbols.
8730 * testsuite/ver_test_main.cc (main): Call t4.
8731 (t4, t4_2a): Define.
8732 * testsuite/ver_test_2.cc (t4_2): Define.
8733 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8734 * testsuite/ver_test_4.cc (t4_2a): Define.
8735 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8736 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8740 * dynobj.cc (Versions::add_def): If we give an error about a
8741 missing version, go ahead and create the version anyhow.
8745 Handle output sections with more than 0x7fffffff bytes.
8746 * object.h (class Relobj): Change map_to_output_ to
8747 output_sections_, and just keep a section pointer. Change all
8748 uses. Move comdat group support to Sized_relobj.
8749 (Relobj::is_section_specially_mapped): Remove.
8750 (Relobj::output_section): Remove poff parameter. Change all
8752 (Relobj::output_section_offset): New function.
8753 (Relobj::set_section_offset): Rewrite.
8754 (Relobj::map_to_output): Remove.
8755 (Relobj::output_sections): New function.
8756 (Relobj::do_output_section_offset): New pure virtual function.
8757 (Relobj::do_set_section_offset): Likewise.
8758 (class Sized_relobj): Add section_offsets_ field. Add comdat
8759 group support from Relobj. Update declarations.
8760 (Sized_relobj::get_output_section_offset): New function.
8761 (Sized_relobj::do_output_section_offset): New function.
8762 (Sized_relobj::do_set_section_offset): New function.
8763 * object.cc (Relobj::output_section_address): Remove.
8764 (Sized_relobj::Sized_relobj): Initialize new fields.
8765 (Sized_relobj::include_section_group): Cast find_kept_object to
8767 (Sized_relobj::include_linkonce_section): Likewise.
8768 (Sized_relobj::do_layout): Use separate arrays for output section
8770 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8772 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8773 output_sections and section_offsets.
8774 (Sized_relobj::write_local_symbols): Likewise.
8775 (map_to_kept_section): Compute output address directly.
8776 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8777 output_sections and section_offsets.
8778 (Sized_relobj::write_sections): Likewise.
8779 (Sized_relobj::relocate_sections): Likewise.
8780 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8781 * output.h (class Output_reloc): Update declarations. Change
8782 u2_.relobj to Sized_relobj*.
8783 (class Output_data_reloc): Change add functions to use
8785 * output.cc (Output_reloc::Output_reloc): Change relobj to
8787 (Output_reloc::local_section_offset): Change return type to
8788 Elf_Addr. Use get_output_section_offset.
8789 (Output_reloc::get_address): Likewise.
8790 (Output_section::is_input_address_mapped): Don't call
8791 is_section_specially_mapped.
8792 (Output_section::output_offset): Likewise.
8793 (Output_section::output_address): Likewise.
8794 (Output_section::starting_output_address): Likewise.
8795 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8796 parameter to Sized_relobj*.
8797 (Copy_relocs::need_copy_reloc): Likewise.
8798 (Copy_relocs::save): Likewise.
8799 * copy-relocs.h (class Copy_relocs): Update declarations.
8800 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8801 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8802 * target-reloc.h (relocate_for_relocatable): Change
8803 offset_in_output_section type to Elf_Addr. Change code that uses
8805 * layout.cc (Layout::layout): Always set *off.
8806 * mapfile.cc (Mapfile::print_input_section): Use
8807 output_section_offset.
8808 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8810 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8811 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8812 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8816 * layout.cc (Layout::include_section): Do not discard unrecognized
8817 SHT_STRTAB sections.
8821 * script.cc (Lex::can_continue_name): Make '?' allowable in
8822 version-script names.
8823 * testsuite/version_script.map: Change glob pattern to use '?'
8828 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8835 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8836 versions]: Don't try to read the value in the contents, since we
8837 don't use it. Use the template endianness when writing.
8841 * fileread.cc (File_read::make_view): Assert on zero-length view.
8842 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8843 symbol table when there are no symbols to read.
8847 * version.cc (version_string): Bump to 1.7
8851 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8852 constant 0xFFFF to type Valtype.
8853 (Powerpc_relocate_functions::rel16_ha): Likewise.
8857 * output.h (Output_section::Input_section): Initialize p2align_ to
8858 zero for Output_section_data constructors.
8859 (Output_section::Input_section::addralign): If not an input
8860 section, return the alignment of the Output_section_data.
8861 * testsuite/copy_test.cc: New file.
8862 * testsuite/copy_test_1.cc: New file.
8863 * testsuite/copy_test_2.cc: New file.
8864 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8865 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8866 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8867 (copy_test_1_pic.o, copy_test_1.so): New targets.
8868 (copy_test_2_pic.o, copy_test_2.so): New targets.
8869 * testsuite/Makefile.in: Rebuild.
8871 * script-sections.cc (Script_sections::place_orphan): Initialize
8872 local variable exact.
8876 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8881 * powerpc.cc: New file.
8882 * Makefile.am (TARGETSOURCES): Add powerpc.cc
8883 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8884 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8885 * Makefile.in: Rebuild.
8889 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8891 (throwing, orig_terminate): New static variables.
8892 (terminate_handler): New static function.
8893 (t2): Set terminate handler.
8898 * binary.cc (Binary_to_elf::sized_convert): Fix .data
8903 * archive.cc (Archive::include_all_members) Correct to step
8904 over symbol table and extended name table in thin archives.
8909 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8914 * reduced_debug_output.cc: New file.
8915 * reduced_debug_output.h: New file.
8916 * options.h (class General_options): Add --strip-debug-non-line.
8917 * options.cc (General_options::finalize): Add strip_debug_non_line
8918 to the strip heirarchy.
8919 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8921 * layout.cc: Include "reduced_debug_output.h".
8922 (Layout::Layout): Initialize new fields.
8923 (line_only_debug_sections): New static array.
8924 (is_lines_only_debug_sections): New static inline function.
8925 (Layout::include_section): Handle --strip-debug-non-line.
8926 (Layout::make_output_section): If --strip-debug-non-line, build
8927 new output sections for .debug_abbrev and .debug_info.
8928 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8929 gold. Warn about possible overflow.
8930 (read_signed_LEB_128): Likewise.
8931 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8932 (read_signed_LEB_128): Declare.
8933 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8934 (HFILES): Add reduced_debug_output.h.
8935 * Makefile.in: Rebuild.
8939 * mapfile.cc: New file.
8940 * mapfile.h: New file.
8941 * options.h (class General_options): Add -M/--print-map and -Map.
8942 * options.cc (General_options::finalize): Make -M equivalent to
8944 * main.cc: Include <cstdio> and "mapfile.h".
8945 (main): Open mapfile if requested.
8946 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8947 constructor. Change caller.
8948 (queue_initial_tasks): Add mapfile parameter. Change caller.
8949 (queue_middle_tasks): Likewise.
8950 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8952 * archive.cc: Include "mapfile.h".
8953 (Archive::add_symbols): Add mapfile parameter. Change all
8954 callers. Pass mapfile, symbol, and reason to include_member.
8955 (Archive::include_all_members): Add mapfile parameter. Change all
8957 (Archive::include_member): Add mapfile, sym, and why parameters.
8958 Change all callers. Report inclusion to map file.
8959 * archive.h: Include "fileread.h".
8960 (class Archive): Update declarations.
8961 (Archive::file): New const method.
8962 (class Add_archive_symbols): Add mapfile_ field. Update
8963 constructor. Change all callers.
8964 * readsyms.h (class Read_symbols): Likewise.
8965 (class Finish_group): Likewise.
8966 (class Read_script): Likewise.
8967 * common.cc: Include "mapfile.h".
8968 (Symbol_table::allocate_commons): Add mapfile parameter. Change
8970 (Symbol_table::do_allocate_commons): Likewise.
8971 (Symbol_table::do_allocate_commons_list): Likewise. Report common
8972 symbol allocation to mapfile.
8973 * common.h (class Allocate_commons_task): Add mapfile_ field.
8974 Update constructor. Change all callers.
8975 * symtab.h (class Symbol_table): Update declarations.
8976 * layout.cc: Include "mapfile.h".
8977 (Layout_task_runner::run): Print information to mapfile.
8978 (Layout::create_gold_note): Change Output_data_fixed_space to
8979 Output_data_zero_fill.
8980 (Layout::create_build_id): Likewise.
8981 (Layout::print_to_mapfile): New function.
8982 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
8983 constructor. Change caller.
8984 (class Layout): Declare print_to_mapfile.
8985 * output.cc (Output_section::Input_section::print_to_mapfile): New
8987 (Output_section::add_input_section): If producing a map, always
8988 add to input_sections_ list.
8989 (Output_section::do_print_to_mapfile): New function.
8990 (Output_segment::print_sections_to_mapfile): New function.
8991 (Output_segment::print_section_list_to_mapfile): New function.
8992 * output.h: Include "mapfile.h".
8993 (Output_data::print_to_mapfile): New function.
8994 (Output_data::do_print_to_mapfile): New virtual function.
8995 (Output_segment_headers::do_print_to_mapfile): New function.
8996 (Output_file_header::do_print_to_mapfile): New function.
8997 (Output_data_const::do_print_to_mapfile): New function.
8998 (class Output_data_const_buffer): Add map_name_ field. Update
8999 constructor. Change all callers. Add do_print_to_mapfile
9001 (class Output_data_fixed_space): Likewise.
9002 (class Output_data_space): Likewise.
9003 (class Output_data_zero_fill): New class.
9004 (Output_data_strtab::do_print_to_mapfile): New function.
9005 (Output_data_reloc_base::do_print_to_mapfile): New function.
9006 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9007 (Output_data_group::do_print_to_mapfile): New function.
9008 (Output_data_got::do_print_to_mapfile): New function.
9009 (Output_data_dynamic::do_print_to_mapfile): New function.
9010 (Output_symtab_xindex::do_print_to_mapfile): New function.
9011 (class Output_section): Declare do_print_to_mapflie. Declare
9012 print_to_mapfile in Input_section.
9013 (class Output_segment): Declare new functions.
9014 * object.h (Sized_relobj::symbol_count): New function.
9015 * script-sections.cc
9016 (Output_section_element_dot_assignment::set_section_addresses):
9017 Change Output_data_fixed_space to Output_data_zero_fill.
9018 (Output_data_expression::do_print_to_mapfile): New function.
9019 * script.cc (read_input_script): Add mapfile parameter. Change
9021 * script.h (read_input_script): Update declaration.
9022 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9023 (Eh_frame::do_print_to_mapfile): New function.
9024 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9025 (Output_merge_string::do_print_to_mapfile): New function.
9026 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9028 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9030 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9032 * Makefile.am (CCFILES): Add mapfile.cc.
9033 (HFILES): Add mapfile.h.
9034 * Makefile.in: Rebuild.
9038 * options.h (class General_options): Add -z relro.
9039 * layout.cc (Layout::Layout): Initialize relro_segment_.
9040 (Layout::add_output_section_data): Return the output section.
9041 (Layout::make_output_section): Rcognize relro sections and mark
9043 (Layout::attach_allocated_section_to_segment): Put relro sections
9044 in a PT_GNU_RELRO segment.
9045 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9047 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9049 (Layout::linkonce_mapping): Map d.rel.ro.local to
9051 (Layout::output_section_name): Us .data.rel.ro.local for any
9052 section which begins with that.
9053 * layout.h (class Layout): Update add_output_section_data
9054 declaration. Add relro_segment_ field.
9055 * output.cc (Output_section::Output_section): Initialize is_relro_
9056 and is_relro_local_ fields.
9057 (Output_segment::add_output_section): Group relro sections.
9058 (Output_segment::is_first_section_relro): New function.
9059 (Output_segment::maximum_alignment): If there is a relro section,
9060 align the segment to the common page size.
9061 (Output_segment::set_section_addresses): Track whether we are
9062 looking at relro sections. If the last section is a relro
9063 section, align to the common page size.
9064 (Output_segment::set_section_list_addresses): Add in_relro
9065 parameter. Change all callers. Align to the page size when
9066 moving from relro to non-relro section.
9067 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9069 * output.h (class Output_section): Add is_relro_ and
9070 is_relro_local_ fields.
9071 (Output_section::is_relro): New function.
9072 (Output_section::set_is_relro): New function.
9073 (Output_section::is_relro_local): New function.
9074 (Output_section::set_is_relro_local): New function.
9075 (class Output_segment): Update declarations.
9076 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9077 * sparc.cc (Target_sparc::got_section): Likewise.
9078 * x86_64.cc (Target_x86_64::got_section): Likewise.
9079 * testsuite/relro_test_main.cc: New file.
9080 * testsuite/relro_test.cc: New file.
9081 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9082 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9083 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9084 (relro_test.so, relro_test_pic.o): New targets.
9085 * testsuite/Makefile.in: Rebuild.
9089 * output.cc (Output_segment::add_output_section): Remove front
9091 * output.h (class Output_segment): Remove
9092 add_initial_output_section and overloaded add_output_section.
9093 Update declaration of remaining add_output_section.
9094 * layout.cc (Layout::create_interp): Call add_output_section
9095 rather than add_initial_output_section.
9096 (Layout::finish_dynamic_section): Likewise.
9098 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9099 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9100 know the dynamic type.
9101 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9102 field. Initialize it in constructor.
9103 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9104 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9105 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9108 * output.cc (Output_reloc::get_address): Change return type to
9110 * output.h (class Output_reloc): Update get_address declaration.
9111 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9112 for section addresses.
9117 * gold.cc (gold_nomem): Use return value of write.
9121 * symtab.c (Symbol::init_base_output_data): Add version
9122 parameter. Change all callers.
9123 (Symbol::init_base_output_segment): Likewise.
9124 (Symbol::init_base_constant): Likewise.
9125 (Symbol::init_base_undefined): Likewise.
9126 (Sized_symbol::init_output_data): Likewise.
9127 (Sized_symbol::init_output_segment): Likewise.
9128 (Sized_symbol::init_constant): Likewise.
9129 (Sized_symbol::init_undefined): Likewise.
9130 (Symbol_table::do_define_in_output_data): If the new symbol has a
9131 version, mark it as the default.
9132 (Symbol_table::do_define_in_output_segment): Likewise.
9133 (Symbol_table::do_define_as_constant): Likewise.
9134 * symtab.h (class Symbol): Update declarations.
9135 (class Sized_symbol): Likewise.
9136 * resolve.cc (Symbol::override_version): New function.
9137 (Symbol::override_base): Call override_version.
9138 (Symbol::override_base_with_special): Likewise.
9139 * testsuite/ver_script_8.script: New file.
9140 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9141 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9142 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9143 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9148 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9150 (class General_options): Remove existing --undefined, and add
9151 --no-undefined instead. Add new --undefined as synonym for -u.
9152 * archive.cc (Archive::add_symbols): Check whether symbol was
9154 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9155 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9156 all uses. Add IS_UNDEFINED. Update declarations to split
9157 different versions of init_base. Declare init_base_undefined.
9158 (Symbol::is_defined): Handle IS_UNDEFINED.
9159 (Symbol::is_undefined): Likewise.
9160 (Symbol::is_weak_undefined): Call is_undefined.
9161 (Symbol::is_absolute): Handle IS_CONSTANT.
9162 (class Sized_symbol): Update declarations to split different
9163 versions of init. Declare init_undefined.
9164 (class Symbol_table): Declare new functions.
9165 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9167 (Symbol::init_base_output_data): Likewise.
9168 (Symbol::init_base_output_segment): Likewise.
9169 (Symbol::init_base_constant): Likewise.
9170 (Symbol::init_base_undefined): New function.
9171 (Sized_symbol::init_object): Rename from init. Change all
9173 (Sized_symbol::init_output_data): Likewise.
9174 (Sized_symbol::init_output_segment): Likewise.
9175 (Sized_symbol::init_constant): Likewise.
9176 (Sized_symbol::init_undefined): New function.
9177 (Symbol_table::add_undefined_symbols_from_command_line): New
9179 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9181 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9182 (Symbol::output_section): Likewise.
9183 (Symbol::set_output_section): Likewise.
9184 (Symbol_table::sized_finalize_symbol): Likewise.
9185 (Symbol_table::sized_write_globals): Likewise.
9186 * resolve.cc (Symbol_table::should_override): Likewise.
9187 (Symbol::override_base_with_special): Likewise.
9189 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9190 symbol, change it to have default visibility.
9191 * testsuite/protected_1.cc: New file.
9192 * testsuite/protected_2.cc: New file.
9193 * testsuite/protected_3.cc: New file.
9194 * testsuite/protected_main_1.cc: New file.
9195 * testsuite/protected_main_2.cc: New file.
9196 * testsuite/protected_main_3.cc: New file.
9197 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9198 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9199 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9200 (protected_1.so): New target.
9201 (protected_1_pic.o, protected_2_pic.o): New targets.
9202 (protected_3_pic.o): New target.
9203 (check_PROGRAMS): Add protected_2.
9204 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9205 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9206 * testsuite/Makefile.in: Rebuild.
9208 * options.h (DEFINE_var): Add set_user_set_##varname__.
9209 (DEFINE_bool_alias): New macro.
9210 (class General_options): Define -Bstatic using DEFINE_bool_alias
9211 rather than DEFINE_special. Add --undefined as an alias for -z
9213 * options.cc (General_options::parse_Bstatic): Remove.
9215 * options.h (class General_options): Add --fatal-warnings.
9216 * main.cc (main): Implement --fatal-warnings.
9217 * errors.h (Errors::warning_count): New function.
9219 * options.h (class General_options): Add -Bsymbolic-functions.
9220 * symtab.h (Symbol::is_preemptible): Check for
9221 -Bsymbolic-functions.
9225 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9226 as noVARNAME rather than no-VARNAME.
9227 (class General_options): Add option -z combreloc.
9228 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9230 (Output_reloc::sort_before) [SHT_REL]: New function.
9231 (Output_reloc::sort_before) [SHT_RELA]: New function.
9232 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9233 Sort_relocs_comparison.
9234 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9235 parameter. Change all callers.
9236 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9237 sort_relocs parameter. Change all callers.
9238 * output.cc (Output_reloc::get_address): New function, broken out
9240 (Output_reloc::write_rel): Call it.
9241 (Output_reloc::compare): New function.
9242 (Output_data_reloc_base::do_write): Optionally sort relocs.
9244 * configure.ac: If targ_extra_obj is set, link it in.
9245 * configure.tgt: Initialize all variables.
9246 (x86_64*): Set targ_extra_obj and targ_extra_size.
9247 * configure: Rebuild.
9249 * object.cc (Sized_relobj::include_section_group): Adjust section
9250 indexes read from group data. Build vector to pass to
9252 * layout.cc (Layout::layout_group): Add flags and shndxes
9253 parameters. Remove contents parameter. Change caller. Update
9254 explicit instantiations.
9255 * layout.h (class Layout): Update layout_group declaration.
9256 * output.cc (Output_data_group::Output_data_group): Add flags and
9257 input_shndxes parameters. Remove contents parameter. Change
9259 (Output_data_group::do_write): Change input_sections_ to
9261 * output.h (class Output_data_group): Update constructor
9262 declaration. Rename input_sections_ to input_shndxes_.
9263 * testsuite/many_sections_test.cc: Add template.
9267 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9269 * layout.cc (Layout::include_section): Refactored check for debug
9271 (Layout::add_comdat): Add new parameters. Change type
9272 of signature parameter. Add object and shndx to signatures table.
9273 (Layout::find_kept_object): New function.
9274 * layout.h: Include <cstring>.
9275 (Layout::is_debug_info_section): New function.
9276 (Layout::add_comdat): Add new parameters.
9277 (Layout::find_kept_object): New function.
9278 (Layout::Kept_section): New struct.
9279 (Layout::Signatures): Change type of map range.
9280 * object.cc (Relobj::output_section_address): New function.
9281 (Sized_relobj::include_section_group): Add new parameters. Change
9282 calls to Layout::add_comdat. Change to build table of kept comdat
9283 groups and table mapping discarded sections to kept sections.
9284 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9285 (Sized_relobj::do_layout): Change calls to include_section_group and
9286 include_linkonce_section.
9287 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9288 value to zero when section is discarded.
9289 (Sized_relobj::map_to_kept_section): New function.
9290 * object.h (Relobj::output_section_address): New function.
9291 (Relobj::Comdat_group): New type.
9292 (Relobj::find_comdat_group): New function.
9293 (Relobj::Comdat_group_table): New type.
9294 (Relobj::Kept_comdat_section): New type.
9295 (Relobj::Kept_comdat_section_table): New type.
9296 (Relobj::add_comdat_group): New function.
9297 (Relobj::set_kept_comdat_section): New function.
9298 (Relobj::get_kept_comdat_section): New function.
9299 (Relobj::comdat_groups_): New field.
9300 (Relobj::kept_comdat_sections_): New field.
9301 (Symbol_value::input_value): Update comment.
9302 (Sized_relobj::map_to_kept_section) New function.
9303 (Sized_relobj::include_linkonce_section): Add new parameter.
9304 * target-reloc.h (Comdat_behavior): New type.
9305 (get_comdat_behavior): New function.
9306 (relocate_section): Add code to map a discarded section to the
9307 corresponding kept section when applying a relocation.
9311 * dwarf_reader.cc (next_generation_count): New static var.
9312 (Addr2line_cache_entry): New struct.
9313 (addr2line_cache): New static var.
9314 (Dwarf_line_info::one_addr2line): Added caching.
9315 (Dwarf_line_info::clear_addr2line_cache): New function.
9316 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9317 cache-size parameter.
9318 (Dwarf_line_info::one_addr2line_cache): New function.
9319 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9320 new cache-size argument to one_addr2line(), and clear cache.
9324 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9325 R_386_PC8 relocations.
9329 * object.cc (Sized_relobj::include_section_group): Check for
9330 invalid section group.
9332 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9335 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9336 than read for file header.
9337 * archive.cc (Archive::include_member): Likewise.
9341 * aclocal.m4: Regenerate.
9342 * configure: Regenerate.
9346 * version.cc (version_string): Bump to 1.6.
9348 * testsuite/Makefile.am (many_sections_r_test): New target.
9349 (many_sections_r_test_SOURCES): Remove.
9350 (many_sections_r_test_DEPENDENCIES): Remove.
9351 (many_sections_r_test_LDFLAGS): Remove.
9352 (many_sections_r_test_LDADD): Remove.
9354 * object.cc (Sized_relobj::do_add_symbols): Always pass
9355 local_symbol_count_ to add_from_relobj.
9357 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9358 every thousand variables.
9359 * testsuite/Makefile.in: Rebuild.
9361 * object.cc (Xindex::initialize_symtab_xindex): New function.
9362 (Xindex::read_symtab_xindex): New function.
9363 (Xindex::sym_xindex_to_shndx): New function.
9364 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9366 (Sized_relobj::do_initialize_xindex): New function.
9367 (Sized_relobj::do_read_symbols): Adjust section links.
9368 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9369 parameter. Change all callers.
9370 (Sized_relobj::include_section_group): Adjust section links and
9371 symbol section indexes.
9372 (Sized_relobj::do_layout): Adjust section links.
9373 (Sized_relobj::do_count_local_symbols): Adjust section links and
9374 symbol section indexes.
9375 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9376 ordinary and special symbols.
9377 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9378 dynsym_xindex parameters. Change all callers. Adjust section
9379 links. Use SHN_XINDEX when needed.
9380 (Sized_relobj::get_symbol_location_info): Adjust section links.
9381 Don't get fooled by special symbols.
9382 * object.h (class Xindex): Define.
9383 (class Object): Add xindex_ parameter. Declare virtual functoin
9384 do_initialize_xindex.
9385 (Object::adjust_sym_shndx): New function.
9386 (Object::set_xindex): New protected function.
9387 (class Symbol_value): Add is_ordinary_shndx_ field.
9388 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9389 (Symbol_value::value): Assert ordinary section.
9390 (Symbol_value::initialize_input_to_output_map): Likewise.
9391 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9393 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9395 (class Sized_relobj): Update declarations.
9396 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9397 parameter. Change all callers.
9398 (Sized_relobj::adjust_shndx): New function.
9399 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9401 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9402 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9403 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9404 (Sized_dynobj::read_dynsym_section): Adjust section links.
9405 (Sized_dynobj::read_dynamic): Likewise.
9406 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9408 (Sized_dynobj::do_initialize_xindex): New function.
9409 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9410 do_initialize_xindex.
9411 (Sized_dynobj::adjust_shndx): New function.
9412 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9413 dynsym_xindex_ fields.
9414 (Layout::finalize): Add a call to set_section_indexes before
9415 creating the symtab sections.
9416 (Layout::set_section_indexes): Don't do anything if the section
9417 already has a section index.
9418 (Layout::create_symtab_sections): Add shnum parameter. Change
9419 caller. Create .symtab_shndx section if needed.
9420 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9422 (Layout::allocated_output_section_count): New function.
9423 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9425 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9426 fields. Update declarations.
9427 (Layout::symtab_xindex): New function.
9428 (Layout::dynsym_xindex): New function.
9429 (class Write_symbols_task): Add layout_ field.
9430 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9432 * output.cc (Output_section_headers::Output_section_headers): Add
9433 shstrtab_section parameter. Change all callers.
9434 (Output_section_headers::do_sized_write): Store overflow values
9435 for section count and section string table section index in
9436 section header zero.
9437 (Output_file_header::do_sized_write): Check for overflow of
9438 section count and section string table section index.
9439 (Output_symtab_xindex::do_write): New function.
9440 (Output_symtab_xindex::endian_do_write): New function.
9441 * output.h (class Output_section_headers): Add shstrtab_section_.
9442 Update declarations.
9443 (class Output_symtab_xindex): Define.
9444 (Output_section::has_out_shndx): New function.
9445 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9447 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9449 (Sized_symbol::init): Likewise.
9450 (Symbol::output_section): Check for ordinary symbol.
9451 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9452 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9454 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9455 Change all callers. Simplify handling of symbols from sections
9456 not included in the link.
9457 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9459 (Weak_alias_sorter::operator()): Assert that symbols are
9461 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9463 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9464 parameters. Change all callers.
9465 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9466 symbol distinction. Use SHN_XINDEX when needed.
9467 (Symbol_table::write_section_symbol): Add symtab_xindex
9468 parameter. Change all callers.
9469 (Symbol_table::sized_write_section_symbol): Likewise. Use
9470 SHN_XINDEX when needed.
9471 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9473 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9474 (Symbol::is_defined): Check is_ordinary.
9475 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9476 (Symbol::is_absolute, Symbol::is_common): Likewise.
9477 (class Sized_symbol): Update declarations.
9478 (class Symbol_table): Update declarations.
9479 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9480 parameters. Change all callers.
9481 (Sized_symbol::override): Likewise.
9482 (Symbol_table::override): Likewise.
9483 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9484 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9485 is_ordinary, and orig_st_shndx parameters. Change all callers.
9486 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9487 to be in an ordinary section.
9488 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9489 object and is_ordinary parameters. Change all callers.
9490 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9491 Change all callers. Don't add undefined or non-ordinary symbols
9493 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9495 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9497 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9498 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9499 (Sized_relobj::relocate_sections): Likewise.
9500 * target-reloc.h (scan_relocs): Adjust section symbol index.
9501 (scan_relocatable_relocs): Likewise.
9502 * i386.cc (Scan::local): Check for ordinary symbols.
9503 * sparc.cc (Scan::local): Likewise.
9504 * x86_64.cc (Scan::local): Likewise.
9505 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9506 to symbol_section_and_value.
9507 * testsuite/many_sections_test.cc: New file.
9508 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9509 (check_PROGRAMS): Add many_sections_test.
9510 (many_sections_test_SOURCES): Define.
9511 (many_sections_test_DEPENDENCIES): Define.
9512 (many_sections_test_LDFLAGS): Define.
9513 (BUILT_SOURCES): Add many_sections_define.h.
9514 (many_sections_define.h): New target.
9515 (BUILT_SOURCES): Add many_sections_check.h.
9516 (many_sections_check.h): New target.
9517 (check_PROGRAMS): Add many_sections_r_test.
9518 (many_sections_r_test_SOURCES): Define.
9519 (many_sections_r_test_DEPENDENCIES): Define.
9520 (many_sections_r_test_LDFLAGS): Define.
9521 (many_sections_r_test_LDADD): Define.
9522 (many_sections_r_test.o): New target.
9523 * testsuite/Makefile.in: Rebuild.
9527 * errors.cc (Errors::info): New function.
9528 (gold_info): New function.
9529 * errors.h (Errors::info): New function.
9530 * gold.h (gold_info): New function.
9531 * object.cc (Input_objects::add_object): Print trace output.
9532 * options.cc (options::parse_set): New function.
9533 (General_options::parse_wrap): Deleted.
9534 (General_options::General_options): Deleted initializer.
9535 * options.h (options::String_set): New typedef.
9536 (options::parse_set): New function.
9537 (DEFINE_set): New macro.
9538 (General_options::wrap): Changed to use DEFINE_set. Changed
9539 callers of any_wrap_symbols and is_wrap_symbol.
9540 (General_options::trace, General_options::trace_symbol):
9542 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9543 (General_options::wrap_symbols_): Deleted.
9544 * symtab.cc (Symbol_table::add_from_object): Print trace output.
9548 * options.cc (General_options::parse_V): New function.
9549 * options.h: Add entries for -V and -Qy.
9553 * common.cc (Symbol_table::allocate_commons): Remove options
9554 parameter. Change caller.
9555 (Symbol_table::do_allocate_commons): Remove options parameter.
9556 Change caller. Just call do_allocate_commons_list twice.
9557 (Symbol_table::do_allocate_commons_list): New function, broken out
9558 of do_allocate_commons.
9559 * common.h (class Allocate_commons_task): Remove options_ field.
9561 * symtab.cc (Symbol_table::Symbol_table): Initialize
9563 (Symbol_table::add_from_object): Put TLS common symbols on
9565 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9566 which are IN_OUTPUT_DATA.
9567 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
9568 allocate_commons and do_allocate_commons declarations. Declare
9569 do_allocate_commons_list.
9570 * gold.cc (queue_middle_tasks): Update creation of
9571 Allocate_commons_task to not pass options.
9572 * testsuite/Makefile.am (INCLUDES): Add -I.. .
9573 (TLS_TEST_C_FLAGS): New variable.
9574 (tls_test_c_pic.o): New target.
9575 (tls_test_shared.so): Link in tls_test_c_pic.o.
9576 (tls_test_c_pic_ie.o): New target.
9577 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9578 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9579 (tls_test_c.o): New target.
9580 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9581 (tls_pic_test_LDADD): Likewise.
9582 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9583 (tls_shared_gd_to_ie_test_LDADD): Likewise.
9584 (tls_test_c_gnu2.o): New target.
9585 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9587 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9588 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9589 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9590 * testsuite/tls_test.cc: Include "config.h".
9591 (t_last): Call t11_last.
9592 * testsuite/tls_test.h (t11, t11_last): Declare.
9593 * testsuite/tls_test_c.c: New file.
9594 * testsuite/tls_test_main.cc (thread_routine): Call t11.
9595 * configure.ac: Check for OpenMP support.
9596 * configure, config.in, Makefile.in: Rebuild.
9597 * testsuite/Makefile.in: Rebuild.
9601 * i386.cc (Target_i386::define_tls_base_symbol): New function.
9602 (Target_i386::tls_base_symbol_defined_): New field.
9603 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9604 (Target_i386::Scan::global): Likewise.
9605 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9606 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9607 (Target_x86_64::tls_base_symbol_defined_): New field.
9608 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9609 (Target_x86_64::Scan::global): Likewise.
9613 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9614 (Symbol::needs_plt_entry): Allow weak undefined symbols.
9615 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9616 building shared libraries.
9617 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9618 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9619 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9620 * testsuite/Makefile.in: Rebuild.
9621 * testsuite/weak_undef.h: New file.
9622 * testsuite/weak_undef_file1.cc: Add extra test cases.
9623 * testsuite/weak_undef_file2.cc: Likewise.
9624 * testsuite/weak_undef_test.cc: Likewise.
9628 * sparc.cc (Target_sparc::Scan): Change from struct to class.
9629 Add issued_non_pic_error_ field. Declare check_non_pic.
9630 (Target_sparc::Scan::check_non_pic): New function.
9631 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9632 (Target_sparc::Scan::global): Likewise.
9634 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9635 * configure: Rebuild.
9637 * options.h (DEFINE_enable): New macro.
9638 (new_dtags): New enable option.
9639 (initfirst, interpose, loadfltr, nodefaultlib,
9640 nodelete, nodlopen, nodump): New -z options.
9641 * layout.cc (Layout:finish_dynamic_section): If new
9642 dtags enabled, emit DT_RUNPATH. Also, emit a
9643 DT_FLAGS_1 containing any specified -z flags.
9647 * copy-relocs.cc: New file.
9648 * copy-relocs.h: New file.
9649 * reloc.cc: Remove Copy_relocs code.
9650 * reloc.h: Likewise.
9651 * reloc-types.h (struct Reloc_types) [both versions]: Add
9652 get_reloc_addend_noerror.
9653 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9654 variants of add_global which take an addend which must be zero.
9655 * i386.cc: Include "copy-relocs.h".
9656 (class Target_i386): Change type of copy_relocs_ to variable,
9658 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9660 (Target_i386::do_finalize_sections): Change handling of
9662 * sparc.cc: Include "copy-relocs.h".
9663 (class Target_sparc): Change type of copy_relocs_ to variable,
9665 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9667 (Target_sparc::do_finalize_sections): Change handling of
9669 * x86_64.cc: Include "copy-relocs.h".
9670 (class Target_x86_64): Change type of copy_relocs_ to variable,
9672 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9673 class. Change all callers.
9674 (Target_x86_64::do_finalize_sections): Change handling of
9676 * Makefile.am (CCFILES): Add copy-relocs.cc.
9677 (HFILES): Add copy-relocs.h.
9679 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9681 * testsuite/script_test_4.sh: Permit leading zeroes.
9685 * script-sections.cc (Script_sections::create_segments): Use
9686 header_size_adjustment even when there is enough room for the
9688 * testsuite/script_test_4.sh: New file.
9689 * testsuite/script_test_4.t: New file.
9690 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9691 (check_DATA): Add script_test_4.stdout.
9692 (MOSTLYCLEANFILES): Likewise.
9693 (script_test_4): New target.
9694 (script_test_4.stdout): New target.
9695 * testsuite/Makefile.in: Rebuild.
9697 * sparc.cc: Add definitions for Output_data_plt_sparc class
9702 * sparc.cc: New file.
9703 * Makefile.am (TARGETSOURCES): Add sparc.cc
9704 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9705 * configure.tgt: Document targ_extra_size and
9706 targ_extra_big_endian. Add entries for sparc-* and
9708 * configure.ac: Handle targ_extra_size and
9709 targ_extra_big_endian.
9710 * Makefile.in: Rebuild.
9711 * configure: Likewise.
9712 * po/POTFILES.in: Likewise.
9713 * po/gold.pot: Likewise.
9717 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9718 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9719 in the name/type/flags to section mapping. Don't call
9720 allocate_output_section.
9721 (Layout::choose_output_section): Change parameter from adjust_name
9722 to is_input_section. Don't permit input sections after sections
9723 are attached to segments. Don't call allocate_output_section.
9724 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9725 not write_enable_output_section.
9726 (Layout::make_output_section): Don't push to
9727 unattached_section_list_ nor call attach_to_segment. Call
9728 attach_section_to_segment if sections are attached.
9729 (Layout::attach_sections_to_segments): New function.
9730 (Layout::attach_section_to_segment): New function.
9731 (Layout::attach_allocated_section_to_segment): Rename from
9732 attach_to_segment. Remove flags parameter.
9733 (Layout::allocate_output_section): Remove function.
9734 (Layout::write_enable_output_section): Remove function.
9735 * layout.h (class Layout): Update for above changes. Add new
9736 field sections_are_attached_.
9737 * output.h (Output_section::update_flags_for_input_section): New
9739 * output.cc (Output_section::add_input_section): Call
9740 update_flags_for_input_section.
9741 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9745 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9746 thought unnecessary.
9747 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9751 * output.h (class Output_section_data): Remove inline definition
9753 * output.cc (Output_section_data::set_addralign): New function.
9757 Add support for TLS descriptors for i386 and x86_64.
9758 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9759 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9760 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9762 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9763 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9764 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9766 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9767 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9768 Fix problem with initial-exec relocations.
9769 (Target_i386::Relocate::relocate_tls): Likewise.
9770 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9772 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9773 support for section-plus-offset dynamic table entries.
9774 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9775 (Output_data_dynamic::Dynamic_entry): Add support for
9776 section-plus-offset dynamic table entries.
9777 (Output_data_dynamic::Classification): Likewise.
9778 (Output_data_dynamic::classification_): Renamed offset_.
9779 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9780 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9781 (Target_x86_64::make_plt_section): New function.
9782 (Target_x86_64::reserve_tlsdesc_entries): New function.
9783 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9784 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9785 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9786 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9787 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9788 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9789 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9790 add extra PLT entry for TLS descriptors.
9791 (Output_data_plt_x86_64::got_): New field.
9792 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9793 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9795 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9797 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9798 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9799 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9800 R_386_TLS_DESC_CALL relocations.
9801 (Target_x86_64::Scan::global): Likewise.
9802 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9803 for TLS descriptors.
9804 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9805 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9806 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9807 GD-to-IE relaxation.
9808 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9809 and TLS_DESCRIPTORS.
9810 * Makefile.in: Rebuild.
9811 * configure: Rebuild.
9812 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9813 (tls_test_shared2.so): New target.
9814 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9815 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9816 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9817 (tls_shared_gd_to_ie_test_LDADD): New variable.
9818 (tls_shared_gnu2_gd_to_ie_test): New target.
9819 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9821 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9822 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9823 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9824 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9825 (tls_shared_gnu2_test): New target.
9826 (tls_test_gnu2_shared.so): New target.
9827 (tls_shared_gnu2_test_SOURCES): New variable.
9828 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9829 (tls_shared_gnu2_test_LDFLAGS): New variable.
9830 (tls_shared_gnu2_test_LDADD): New variable.
9831 * testsuite/Makefile.in: Rebuild.
9832 * testsuite/Makefile.
9836 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9838 * testsuite/Makefile.in: Rebuild.
9840 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9842 * testsuite/script_test_2.cc (main): Adjust test.
9847 * options.h (General_options): Add entries for '-Y' and
9849 * options.cc (General_options:finalize): If -Y was used, add those
9850 entries to the library path instead of the default "/lib" and
9855 * testsuite/justsyms.t: Start at 0x100.
9856 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9857 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9859 * testsuite/script_test_2.cc: Adjust string and section length
9865 * script-sections.cc (Sections_element::allocate_to_segment): Add
9867 (Output_section_definition::allocate_to_segment): Likewise.
9868 (Orphan_output_section::allocate_to_segment): Likewise.
9869 (Script_sections::attach_sections_using_phdrs_clause): Don't
9870 propagate non-PT_LOAD segments to orphan sections.
9871 * testsuite/Makefile.am (script_test_3.stdout): Generate using
9872 readelf rather than objdump.
9873 * testsuite/script_test_3.sh: Adjust accordingly. Test that
9874 .interp section and PT_INTERP segment are the same size.
9875 * testsuite/Makefile.in: Rebuild.
9877 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9878 aliases for symbols defined in the same object.
9879 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9880 (weak_alias_test_SOURCES): New variable.
9881 (weak_alias_test_DEPENDENCIES): New variable.
9882 (weak_alias_test_LDFLAGS): New variable.
9883 (weak_alias_test_LDADD): New variable.
9884 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9885 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9886 (weak_alias_test_3.o): New target.
9887 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9888 * testsuite/weak_alias_test_main.cc: New file.
9889 * testsuite/weak_alias_test_1.cc: New file.
9890 * testsuite/weak_alias_test_2.cc: New file.
9891 * testsuite/weak_alias_test_3.cc: New file.
9895 * options.h (class General_options): Add --noinhibit-exec option.
9896 * main.cc (main): Check --noinhibit-exec.
9898 * options.h (class General_options): Define --wrap as a special
9899 option. Add wrap_symbols_ field.
9900 (General_options::any_wrap_symbols): New function.
9901 (General_options::is_wrap_symbol): New function.
9902 * options.cc (General_options::parse_wrap): New function.
9903 (General_options::General_options): Initialize wrap_symbols_.
9904 * symtab.cc (Symbol_table::wrap_symbol): New function.
9905 (Symbol_table::add_from_object): Handle --wrap.
9906 * symtab.h (class Symbol_table): Declare wrap_symbol.
9907 * target.h (Target::wrap_char): New function.
9908 (Target::Target_info): Add wrap_char field.
9909 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9910 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9911 * testsuite/testfile.cc (Target_test::test_target_info):
9914 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9917 * layout.h (class Layout): Add added_eh_frame_data_ field.
9918 * layout.cc (Layout::Layout): Initialize new field.
9919 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9920 output section until we find a section we merged successfully.
9921 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9922 that the size be non-zero.
9924 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9929 * configure.ac: Export new conditional variable HAVE_ZLIB.
9930 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9932 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9933 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9937 * version.cc (version_string): Set to "1.5".
9939 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9940 Add issued_non_pic_error_ field. Declare check_non_pic.
9941 (Target_x86_64::Scan::check_non_pic): New function.
9942 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9943 (Target_x86_64::Scan::global): Likewise.
9945 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9946 addend parameter. Change caller. Handle merge sections.
9947 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9948 Address to Addend. Don't add in the result of
9949 local_section_offset, pass down the addend and use the returned
9951 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9952 Update declarations of local_section_offset and symbol_value.
9953 * testsuite/two_file_test_1.cc (t18): New function.
9954 * testsuite/two_file_test_2.cc (f18): New function.
9955 * testsuite/two_file_test_main.cc (main): Call t18.
9956 * testsuite/two_file_test.h (t18, f18): Declare.
9958 * configure.ac: Don't test for objdump, c++filt, or readelf.
9959 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9961 (TEST_READELF): New variable.
9962 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9963 (check_PROGRAMS): Add two_file_strip_test.
9964 (two_file_strip_test): New target.
9965 (check_PROGRAMS): Add two_file_same_shared_strip_test.
9966 (two_file_same_shared_strip_test_SOURCES): New variable.
9967 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9968 (two_file_same_shared_strip_test_LDFLAGS): New variable.
9969 (two_file_same_shared_strip_test_LDADD): New variable.
9970 (two_file_shared_strip.so): New target.
9971 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
9972 (ver_test_5.syms, ver_test_7.syms): Likewise.
9973 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
9974 (strip_test_3.stdout): Use TEST_OBJDUMP.
9975 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9979 * symtab.h (Symbol::is_weak_undefined): New function.
9980 (Symbol::is_strong_undefined): New function.
9981 (Symbol::is_absolute): New function.
9982 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
9983 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
9985 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
9986 (weak_undef_test): New target.
9987 * testsuite/Makefile.in: Rebuild.
9988 * testsuite/weak_undef_file1.cc: New file.
9989 * testsuite/weak_undef_file2.cc: New file.
9990 * testsuite/weak_undef_test.cc: New file.
9994 * compressed_output.h (class Output_compressed_section): Use
9996 * compressed_output.cc (zlib_compress): Use unsigned buffers,
9998 (zlib_compressed_suffix): Removed.
9999 (Output_compressed_section::set_final_data_size): Use unsigned
10001 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10002 Fix linker invocation.
10003 (flagstest_o_specialfile_and_compress_debug_sections):
10005 * testsuite/Makefile.in: Regenerated.
10009 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10010 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10018 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10019 parameters. Update for new key type to views_. Change all
10021 (File_read::read): Adjust for byteshift in returned view.
10022 (File_read::add_view): New function, broken out of
10023 find_and_make_view.
10024 (File_read::make_view): New function, broken out of
10025 find_and_make_view.
10026 (File_read::find_or_make_view): Add offset and aligned
10027 parameters. Rewrite accordingly. Change all callers.
10028 (File_read::get_view): Add offset and aligned parameters. Adjust
10029 for byteshift in return value.
10030 (File_read::get_lasting_view): Likewise.
10031 * fileread.h (class File_read): Update declarations.
10032 (class File_read::View): Add byteshift_ field. Add byteshift to
10033 constructor. Add byteshift method.
10034 * archive.h (Archive::clear_uncached_views): New function.
10035 (Archive::get_view): Add aligned parameter. Change all callers.
10036 * object.h (Object::get_view): Add aligned parameter. Change all
10038 (Object::get_lasting_view): Likewise.
10040 * fileread.cc (File_read::release): Don't call clear_views if
10041 there are multiple objects.
10042 * fileread.h (File_read::clear_uncached_views): New function.
10043 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10048 Add thin archive support.
10049 * archive.cc (Archive::armagt): New const.
10050 (Archive::setup): Remove task parameter and calls to unlock.
10051 (Archive::unlock_nested_archives): New function.
10052 (Archive::read_header): Add nested_off parameter. Change
10054 (Archive::interpret_header): Likewise.
10055 (Archive::include_all_members): Change to handle thin
10057 (Archive::include_member): Likewise.
10058 * archive.h (Archive::Archive): Add new parameters and
10060 (Archive::armagt): New const.
10061 (Archive::setup): Remove task parameter.
10062 (Archive::unlock_nested_archives): New function.
10063 (Archive::read_header): Add nested_off parameter.
10064 (Archive::interpret_header): Likewise.
10065 (Archive::Nested_archive_table): New typedef.
10066 (Archive::is_thin_archive_): New field.
10067 (Archive::nested_archives_): New field.
10068 (Archive::options_): New field.
10069 (Archive::dirpath_): New field.
10070 (Archive::task_): New field.
10071 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10072 for thin archives. Pass additional parameters to
10073 Archive::Archive. Unlock the archive file after calling
10078 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10079 version symbol to be local.
10080 * testsuite/ver_test_4.sh: New file.
10081 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10082 (check_DATA): Add ver_test_4.syms.
10083 (ver_test_4.syms): New target.
10084 * testsuite/Makefile.in: Rebuild.
10087 (Output_section::Input_section_sort_entry::has_priority): New
10089 (Output_section::Input_section_sort_entry::match_file_name): New
10091 (Output_section::Input_section_sort_entry::match_section_name):
10093 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10095 (Output_section::Input_section_sort_entry::match_section_file):
10097 (Output_section::Input_section_sort_compare::operator()): Rewrite
10098 using new Input_section_sort_entry functions. Sort crtbegin and
10099 crtend first. Sort sections with no priority before sections with
10101 * testsuite/initpri1.c (d3): Check j != 4.
10102 (cd5): New constructor/destructor function.
10103 (main): Check j != 2.
10105 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10106 new symbol when resolving, don't call set_is_default.
10107 * testsuite/ver_test_7.cc: New file.
10108 * testsuite/ver_test_7.sh: New file.
10109 * testsuite/Makefile.am (ver_test_7.so): New target.
10110 (ver_test_7.o): New target.
10111 (check_SCRIPTS): Add ver_test_7.sh.
10112 (check_DATA): Add ver_test_7.syms.
10113 (ver_test_7.syms): New target.
10117 * layout.cc (Layout::layout): If we see an input section with a
10118 name that needs sorting, set the must_sort flag for the output
10120 (Layout::make_output_section): If the name of the output section
10121 indicates that it might require sorting, set the may_sort flag.
10122 * output.h (Output_section::may_sort_attached_input_sections): New
10124 (Output_section::set_may_sort_attached_input_sections): New
10126 (Output_section::must_sort_attached_input_sections): New
10128 (Output_section::set_must_sort_attached_input_sections): New
10130 (class Output_section): Declare Input_section_sort_entry. Define
10131 Input_section_sort_compare. Declare
10132 sort_attached_input_sections. Add new fields:
10133 may_sort_attached_input_sections_,
10134 must_sort_attached_input_sections_,
10135 attached_input_sections_are_sorted_.
10136 * output.cc (Output_section::Output_section): Initialize new
10138 (Output_section::add_input_section): Add an entry to
10139 input_sections_ if may_sort or must_sort are true.
10140 (Output_section::set_final_data_size): Call
10141 sort_attached_input_sections if necessary.
10142 (Output_section::Input_section_sort_entry): Define new class.
10143 (Output_section::Input_section_sort_compare::operator()): New
10145 (Output_section::sort_attached_input_sections): New function.
10146 * configure.ac: Check whether the compiler supports constructor
10147 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10148 * testsuite/initpri1.c: New file.
10149 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10150 CONSTRUCTOR_PRIORITY.
10151 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10152 (initpri1_LDFLAGS): New variable.
10153 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10157 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10158 * testsuite/common_test_1.c: New file.
10159 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10160 (common_test_1_SOURCES): New variable.
10161 (common_test_1_DEPENDENCIES): New variable.
10162 (common_test_1_LDFLAGS): New variable.
10164 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10165 and commons_ correctly when NAME/VERSION does not override
10167 * testsuite/ver_test_6.c: New file.
10168 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10169 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10170 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10174 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10175 of an undefined symbol from a version script.
10176 * testsuite/Makefile.am (ver_test_5.so): New target.
10177 (ver_test_5.o): New target.
10178 (check_SCRIPTS): Add ver_test_5.sh.
10179 (check_DATA): Add ver_test_5.syms.
10180 (ver_test_5.syms): New target.
10181 * testsuite/ver_test_5.cc: New file.
10182 * testsuite/ver_test_5.script: New file.
10183 * testsuite/ver_test_5.sh: New file.
10184 * Makefile.in, testsuite/Makefile.in: Rebuild.
10187 Fix problems building gold with gcc 4.3.0.
10188 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10189 (gold_error_at_location, gold_warning_at_location): Use it.
10190 * configure.ac: Check whether we can compile and use a template
10191 function with a printf attribute.
10192 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10193 when jumping over bytes.
10194 * object.cc: Instantiate Object::read_section_data.
10195 * debug.h: Include <cstring>
10196 * dwarf_reader.cc: Include <algorithm>
10197 * main.cc: Include <cstring>.
10198 * options.cc: Include <cstring>.
10199 * output.cc: Include <cstring>.
10200 * script.cc: Include <cstring>.
10201 * script.h: Include <string>.
10202 * symtab.cc: Include <cstring> and <algorithm>.
10203 * target-select.cc: Include <cstring>.
10204 * version.cc: Include <string>.
10205 * testsuite/testmain.cc: Include <cstdlib>.
10206 * configure, config.in: Rebuild.
10210 * options.cc: Include "../bfd/bfdver.h".
10211 (options::help): Print bug reporting address.
10213 * version.cc (print_version): Adjust output for current value of
10214 BFD_VERSION_STRING.
10218 * options.cc (options::help): Print list of supported targets.
10219 * target-select.h: Include <vector>.
10220 (class Target_selector): Make machine_, size_, and is_big_endian_
10221 fields const. Add bfd_name_ and instantiated_target_ fields.
10222 (Target_selector::Target_selector): Add bfd_name parameter.
10223 (Target_selector::recognize): Make non-virtual, call
10225 (Target_selector::recognize_by_name): Make non-virtual, call
10226 do_recognize_by_name.
10227 (Target_selector::supported_names): New function.
10228 (Target_selector::bfd_name): New function.
10229 (Target_selector::do_instantiate_target): New pure virtual
10231 (Target_selector::do_recognize): New virtual function.
10232 (Target_selector::do_recognize_by_name): New virtual function.
10233 (Target_selector::instantiate_target): New private function.
10234 (supported_target_names): Declare.
10235 * target-select.cc (Target_selector::Target_selector): Update for
10236 new parameter and fields.
10237 (select_target_by_name): Check that the name matches before
10238 calling recognize_by_name.
10239 (supported_target_names): New function.
10240 * i386.cc (class Target_selector_i386): Update Target_selector
10241 constructor call. Remove recognize and recognize_by_name. Add
10242 do_instantiate_target.
10243 * x86_64.cc (class Target_selector_x86_64): Likewise.
10244 * testsuite/testfile.cc (class Target_selector_test): Update for
10245 changes to Target_selector.
10247 * README: Rewrite, with some notes on unsupported features.
10251 * i386.cc (Target_i386::Got_type): New enum declaration.
10252 (Target_i386::Scan::local): Updated callers of Output_data_got
10254 (Target_i386::Scan::global): Likewise.
10255 (Target_i386::Relocate::relocate): Likewise.
10256 (Target_i386::Relocate::relocate_tls): Likewise.
10257 * object.h (Got_offset_list): New class.
10258 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10259 (Sized_relobj::local_got_offset): Likewise.
10260 (Sized_relobj::set_local_got_offset): Likewise.
10261 (Sized_relobj::local_has_tls_got_offset): Removed.
10262 (Sized_relobj::local_tls_got_offset): Removed.
10263 (Sized_relobj::set_local_tls_got_offset): Removed.
10264 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10265 * output.cc (Output_data_got::add_global): Added got_type parameter.
10266 (Output_data_got::add_global_with_rel): Likewise.
10267 (Output_data_got::add_global_with_rela): Likewise.
10268 (Output_data_got::add_global_pair_with_rel): New function.
10269 (Output_data_got::add_global_pair_with_rela): New function.
10270 (Output_data_got::add_local): Added got_type parameter.
10271 (Output_data_got::add_local_with_rel): Likewise.
10272 (Output_data_got::add_local_with_rela): Likewise.
10273 (Output_data_got::add_local_pair_with_rel): New function.
10274 (Output_data_got::add_local_pair_with_rela): New function.
10275 (Output_data_got::add_global_tls): Removed.
10276 (Output_data_got::add_global_tls_with_rel): Removed.
10277 (Output_data_got::add_global_tls_with_rela): Removed.
10278 (Output_data_got::add_local_tls): Removed.
10279 (Output_data_got::add_local_tls_with_rel): Removed.
10280 (Output_data_got::add_local_tls_with_rela): Removed.
10281 * output.h (Output_data_got::add_global): Added got_type parameter.
10282 (Output_data_got::add_global_with_rel): Likewise.
10283 (Output_data_got::add_global_with_rela): Likewise.
10284 (Output_data_got::add_global_pair_with_rel): New function.
10285 (Output_data_got::add_global_pair_with_rela): New function.
10286 (Output_data_got::add_local): Added got_type parameter.
10287 (Output_data_got::add_local_with_rel): Likewise.
10288 (Output_data_got::add_local_with_rela): Likewise.
10289 (Output_data_got::add_local_pair_with_rel): New function.
10290 (Output_data_got::add_local_pair_with_rela): New function.
10291 (Output_data_got::add_global_tls): Removed.
10292 (Output_data_got::add_global_tls_with_rel): Removed.
10293 (Output_data_got::add_global_tls_with_rela): Removed.
10294 (Output_data_got::add_local_tls): Removed.
10295 (Output_data_got::add_local_tls_with_rel): Removed.
10296 (Output_data_got::add_local_tls_with_rela): Removed.
10297 * resolve.cc (Symbol::override_base_with_special): Removed
10298 reference to has_got_offset_ field.
10299 * symtab.cc (Symbol::init_fields): Replaced initialization
10300 of got_offset_ with got_offsets_. Removed initialization
10302 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10303 (Symbol::got_offset): Likewise.
10304 (Symbol::set_got_offset): Likewise.
10305 (Symbol::has_tls_got_offset): Removed.
10306 (Symbol::tls_got_offset): Removed.
10307 (Symbol::set_tls_got_offset): Removed.
10308 (Symbol::got_offset_): Removed.
10309 (Symbol::tls_mod_got_offset_): Removed.
10310 (Symbol::tls_pair_got_offset_): Removed.
10311 (Symbol::got_offsets_): New field.
10312 (Symbol::has_got_offset): Removed.
10313 (Symbol::has_tls_mod_got_offset): Removed.
10314 (Symbol::has_tls_pair_got_offset): Removed.
10315 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10316 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10318 (Target_x86_64::Scan::global): Likewise.
10319 (Target_x86_64::Relocate::relocate): Likewise.
10320 (Target_x86_64::Relocate::relocate_tls): Likewise.
10324 * yyscript.y: Fix spelling error in comment.
10328 * options.h (class General_options): Define build_id option.
10329 * layout.h (class Layout): Declare write_build_id, create_note,
10330 create_build_id. Add build_id_note_ member.
10331 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10332 "libiberty.h", "md5.h", "sha1.h".
10333 (Layout::Layout): Initialize eh_frame_data_,
10334 eh_frame_hdr_section_, and build_id_note_.
10335 (Layout::finalize): Call create_build_id.
10336 (Layout::create_note): New function, broken out of
10337 Layout::create_gold_note.
10338 (Layout::create_gold_note): Call create_note.
10339 (Layout::create_build_id): New function.
10340 (Layout::write_build_id): New function.
10341 (Close_task_runner::run): Call write_build_id.
10343 * x86_64.cc: Correct license to GPLv3.
10347 * options.cc: Include "demangle.h".
10348 (parse_optional_string): New function.
10349 (parse_long_option): Handle takes_optional_argument.
10350 (parse_short_option): Update dash_z initializer. Handle
10351 takes_optional_argument.
10352 (General_options::General_options): Initialize do_demangle_.
10353 (General_options::finalize): Set do_demangle_. Handle demangling
10355 * options.h (parse_optional_string): Declare.
10356 (struct One_option): Add optional_arg field. Update constructor.
10357 Update call constructor calls. Add takes_optional_argument
10359 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10360 (DEFINE_optional_string): Define.
10361 (General_options::demangle): Change from DEFINE_bool to
10362 DEFINE_optional_string.
10363 (General_options::no_demangle): New function.
10364 (General_options::do_demangle): New function.
10365 (General_options::set_do_demangle): New function.
10366 (General_options::execstack_status_): Move definition to end of
10368 (General_options::static_): Likewise.
10369 (General_options::do_demangle_): New field.
10370 * object.cc (big_endian>::get_symbol_location_info): Call
10371 Options::do_demangle, not Options::demangle.
10372 * symtab.cc (demangle): Likewise.
10376 * gold.h: Include <cstddef> and <sys/types.h>
10377 * options.h: Include <cstring>.
10381 * Added source code to GNU binutils.