daily update
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2011-04-14 Cary Coutant <ccoutant@google.com>
2
3 * gold/layout.cc (Layout::symtab_section_offset): New function.
4 * gold/layout.h (Layout::symtab_section_offset): New function.
5 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6
7 2011-04-12 Ian Lance Taylor <iant@google.com>
8
9 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
10 with MREMAP_MAYMOVE.
11 * output.h (class Output_file): Add map_is_allocated_ field.
12 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
13 not available, provide stubs. If mremap is not available, #define
14 it to gold_mremap.
15 (MREMAP_MAYMOVE): Define if not defined.
16 (Output_file::Output_file): Initialize map_is_allocated_.
17 (Output_file::resize): Check map_is_allocated_.
18 (Output_file::map_anonymous): If mmap fails, use malloc.
19 (Output_file::unmap): Don't do anything for an anonymous map.
20 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
21 is not available, provide stubs.
22 (File_read::View::~View): Use free rather than delete[].
23 (File_read::make_view): Use malloc rather than new[]. If mmap
24 fails, use malloc.
25 (File_read::find_or_make_view): Use malloc rather than new[].
26 * gold.h: Remove HAVE_REMAP code.
27 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
28 exists. Rename mremap to gold_mremap. If mmap is not available
29 don't do anything.
30 * configure, config.in: Rebuild.
31
32 2011-04-11 Ian Lance Taylor <iant@google.com>
33
34 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
35 initialize local variable v.
36
37 2011-04-11 Cary Coutant <ccoutant@google.com>
38
39 * archive.cc (Archive::include_member): Adjust call to
40 report_object.
41 (Add_archive_symbols::run): Track argument serial numbers.
42 (Lib_group::include_member): Likewise.
43 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
44 * archive.h (Incremental_archive_entry::Archive_member):
45 Initialize arg_serial_.
46 (Archive_member::arg_serial_): New data member.
47 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
48 (Sized_dynobj::do_add_symbols): Track symbols when doing an
49 incremental link.
50 (Sized_dynobj::do_for_all_local_got_entries): New function.
51 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
52 function.
53 * fileread.cc (get_mtime): New function.
54 * fileread.h (get_mtime): New function.
55 * gold.cc (queue_initial_tasks): Check for incremental update.
56 (process_incremental_input): New function.
57 (queue_middle_tasks): Don't force valid target for incremental
58 update.
59 * incremental-dump.cc (find_input_containing_global): Adjust
60 size of symbol info entry.
61 (dump_incremental_inputs): Dump argument serial number and
62 in_system_directory flag; bias shndx by 1; print symbol names
63 when dumping per-file symbol lists; use new symbol info readers.
64 * incremental.cc
65 (Output_section_incremental_inputs:update_data_size): New function.
66 (Sized_incremental_binary::setup_readers): Setup input readers
67 for each input file; build maps for files added from libraries
68 and scripts.
69 (Sized_incremental_binary::check_input_args): New function.
70 (Sized_incremental_binary::do_check_inputs): Build map of argument
71 serial numbers to input arguments.
72 (Sized_incremental_binary::do_file_has_changed): Rename
73 do_file_is_unchanged to this; compare file modification times.
74 (Sized_incremental_binary::do_init_layout): New function.
75 (Sized_incremental_binary::do_reserve_layout): New function.
76 (Sized_incremental_binary::do_get_input_reader): Remove.
77 (Sized_incremental_binary::get_symtab_view): New function.
78 (Incremental_checker::can_incrementally_link_output_file): Remove.
79 (Incremental_inputs::report_command_line): Exclude --debug options.
80 (Incremental_inputs::report_archive_begin): Add parameter; track
81 argument serial numbers; don't put input file entry for archive
82 before archive members.
83 (Incremental_inputs::report_archive_end): Put input file entry
84 for archive after archive members.
85 (Incremental_inputs::report_object): Add parameter; track argument
86 serial numbers and in_system_directory flag.
87 (Incremental_inputs::report_script): Add parameter; track argument
88 serial numbers.
89 (Output_section_incremental_inputs::set_final_data_size): Adjust
90 size of symbol info entry; check for forwarding symbols.
91 (Output_section_incremental_inputs::write_input_files): Write
92 in_system_directory flag and argument serial number.
93 (Output_section_incremental_inputs::write_info_blocks): Map section
94 indices between incremental info and original input file; store
95 input section index for each symbol.
96 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
97 change operator() to visit().
98 (class Global_got_offset_visitor): Likewise.
99 (class Global_symbol_visitor_got_plt):
100 (Output_section_incremental_inputs::write_got_plt): Use new visitor
101 classes.
102 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
103 (Sized_incr_relobj::do_read_symbols): New function.
104 (Sized_incr_relobj::do_layout): New function.
105 (Sized_incr_relobj::do_layout_deferred_sections): New function.
106 (Sized_incr_relobj::do_add_symbols): New function.
107 (Sized_incr_relobj::do_should_include_member): New function.
108 (Sized_incr_relobj::do_for_all_global_symbols): New function.
109 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
110 (Sized_incr_relobj::do_section_size): New function.
111 (Sized_incr_relobj::do_section_name): New function.
112 (Sized_incr_relobj::do_section_contents): New function.
113 (Sized_incr_relobj::do_section_flags): New function.
114 (Sized_incr_relobj::do_section_entsize): New function.
115 (Sized_incr_relobj::do_section_address): New function.
116 (Sized_incr_relobj::do_section_type): New function.
117 (Sized_incr_relobj::do_section_link): New function.
118 (Sized_incr_relobj::do_section_info): New function.
119 (Sized_incr_relobj::do_section_addralign): New function.
120 (Sized_incr_relobj::do_initialize_xindex): New function.
121 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
122 (Sized_incr_relobj::do_read_relocs): New function.
123 (Sized_incr_relobj::do_gc_process_relocs): New function.
124 (Sized_incr_relobj::do_scan_relocs): New function.
125 (Sized_incr_relobj::do_count_local_symbols): New function.
126 (Sized_incr_relobj::do_finalize_local_symbols): New function.
127 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
128 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
129 (Sized_incr_relobj::do_relocate): New function.
130 (Sized_incr_relobj::do_set_section_offset): New function.
131 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
132 (Sized_incr_dynobj::do_read_symbols): New function.
133 (Sized_incr_dynobj::do_layout): New function.
134 (Sized_incr_dynobj::do_add_symbols): New function.
135 (Sized_incr_dynobj::do_should_include_member): New function.
136 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
137 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
138 (Sized_incr_dynobj::do_section_size): New function.
139 (Sized_incr_dynobj::do_section_name): New function.
140 (Sized_incr_dynobj::do_section_contents): New function.
141 (Sized_incr_dynobj::do_section_flags): New function.
142 (Sized_incr_dynobj::do_section_entsize): New function.
143 (Sized_incr_dynobj::do_section_address): New function.
144 (Sized_incr_dynobj::do_section_type): New function.
145 (Sized_incr_dynobj::do_section_link): New function.
146 (Sized_incr_dynobj::do_section_info): New function.
147 (Sized_incr_dynobj::do_section_addralign): New function.
148 (Sized_incr_dynobj::do_initialize_xindex): New function.
149 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
150 (make_sized_incremental_object): New function.
151 (Incremental_library::copy_unused_symbols): New function.
152 (Incremental_library::do_for_all_unused_symbols): New function.
153 * incremental.h (enum Incremental_input_flags): New type.
154 (class Incremental_checker): Remove.
155 (Incremental_input_entry::Incremental_input_entry): Add argument
156 serial number.
157 (Incremental_input_entry::arg_serial): New function.
158 (Incremental_input_entry::set_is_in_system_directory): New function.
159 (Incremental_input_entry::is_in_system_directory): New function.
160 (Incremental_input_entry::arg_serial_): New data member.
161 (Incremental_input_entry::is_in_system_directory_): New data member.
162 (class Script_info): Move here from script.h.
163 (Script_info::Script_info): Add filename parameter.
164 (Script_info::filename): New function.
165 (Script_info::filename_): New data member.
166 (Incremental_script_entry::Incremental_script_entry): Add argument
167 serial number.
168 (Incremental_object_entry::Incremental_object_entry): Likewise.
169 (Incremental_object_entry::add_input_section): Build list of input
170 sections with map to original shndx.
171 (Incremental_object_entry::get_input_section_index): New function.
172 (Incremental_object_entry::shndx_): New data member.
173 (Incremental_object_entry::name_key_): Rename; adjust all refs.
174 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
175 (Incremental_archive_entry::Incremental_archive_entry): Add argument
176 serial number.
177 (Incremental_inputs::report_archive_begin): Likewise.
178 (Incremental_inputs::report_object): Likewise.
179 (Incremental_inputs::report_script): Likewise.
180 (class Incremental_global_symbol_reader): New class.
181 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
182 and store flags and input file type.
183 (Incremental_input_entry_reader::arg_serial): New function.
184 (Incremental_input_entry_reader::type): Extract type from flags.
185 (Incremental_input_entry_reader::is_in_system_directory): New function.
186 (Incremental_input_entry_reader::get_input_section_count): Call
187 accessor function for type.
188 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
189 function for type; adjust size of global symbol entry.
190 (Incremental_input_entry_reader::get_global_symbol_count): Call
191 accessor function for type.
192 (Incremental_input_entry_reader::get_object_count): Likewise.
193 (Incremental_input_entry_reader::get_object_offset): Likewise.
194 (Incremental_input_entry_reader::get_member_count): Likewise.
195 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
196 (Incremental_input_entry_reader::get_member_offset): Likewise.
197 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
198 (Incremental_input_entry_reader::Global_symbol_info): Remove.
199 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
200 (Incremental_input_entry_reader::get_global_symbol_reader): New
201 function.
202 (Incremental_input_entry_reader::get_output_symbol_index): New
203 function.
204 (Incremental_input_entry_reader::type_): Remove.
205 (Incremental_input_entry_reader::flags_): New data member.
206 (Incremental_inputs_reader::input_file_offset): New function.
207 (Incremental_inputs_reader::input_file_index): New function.
208 (Incremental_inputs_reader::input_file): Call input_file_offset.
209 (Incremental_inputs_reader::input_file_at_offset): New function.
210 (Incremental_relocs_reader::get_r_type): Reformat.
211 (Incremental_relocs_reader::get_r_shndx): Reformat.
212 (Incremental_relocs_reader::get_r_offset): Reformat.
213 (Incremental_relocs_reader::data): New function.
214 (Incremental_binary::Incremental_binary): Initialize new data members.
215 (Incremental_binary::check_inputs): Add cmdline parameter.
216 (Incremental_binary::file_is_unchanged): Remove.
217 (Input_reader::arg_serial): New function.
218 (Input_reader::get_unused_symbol_count): New function.
219 (Input_reader::get_unused_symbol): New function.
220 (Input_reader::do_arg_serial): New function.
221 (Input_reader::do_get_unused_symbol_count): New function.
222 (Input_reader::do_get_unused_symbol): New function.
223 (Incremental_binary::input_file_count): New function.
224 (Incremental_binary::get_input_reader): Change signature to use
225 index instead of filename.
226 (Incremental_binary::file_has_changed): New function.
227 (Incremental_binary::get_input_argument): New function.
228 (Incremental_binary::get_library): New function.
229 (Incremental_binary::get_script_info): New function.
230 (Incremental_binary::init_layout): New function.
231 (Incremental_binary::reserve_layout): New function.
232 (Incremental_binary::output_file): New function.
233 (Incremental_binary::do_check_inputs): New function.
234 (Incremental_binary::do_file_is_unchanged): Remove.
235 (Incremental_binary::do_file_has_changed): New function.
236 (Incremental_binary::do_init_layout): New function.
237 (Incremental_binary::do_reserve_layout): New function.
238 (Incremental_binary::do_input_file_count): New function.
239 (Incremental_binary::do_get_input_reader): Change signature.
240 (Incremental_binary::input_args_map_): New data member.
241 (Incremental_binary::library_map_): New data member.
242 (Incremental_binary::script_map_): New data member.
243 (Sized_incremental_binary::Sized_incremental_binary): Initialize
244 new data members.
245 (Sized_incremental_binary::output_section): New function.
246 (Sized_incremental_binary::inputs_reader): Add const.
247 (Sized_incremental_binary::symtab_reader): Add const.
248 (Sized_incremental_binary::relocs_reader): Add const.
249 (Sized_incremental_binary::got_plt_reader): Add const.
250 (Sized_incremental_binary::get_symtab_view): New function.
251 (Sized_incremental_binary::Inputs_reader): New typedef.
252 (Sized_incremental_binary::Input_entry_reader): New typedef.
253 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
254 (Sized_incremental_binary::do_file_is_unchanged): Remove.
255 (Sized_incremental_binary::do_file_has_changed): New function.
256 (Sized_incremental_binary::do_init_layout): New function.
257 (Sized_incremental_binary::do_reserve_layout): New function.
258 (Sized_input_reader::Inputs_reader): Remove.
259 (Sized_input_reader::Input_entry_reader): Remove.
260 (Sized_input_reader::do_arg_serial): New function.
261 (Sized_input_reader::do_get_unused_symbol_count): New function.
262 (Sized_input_reader::do_get_unused_symbol): New function.
263 (Sized_incremental_binary::do_input_file_count): New function.
264 (Sized_incremental_binary::do_get_input_reader): Change signature;
265 use index instead of filename.
266 (Sized_incremental_binary::section_map_): New data member.
267 (Sized_incremental_binary::input_entry_readers_): New data member.
268 (class Sized_incr_relobj): New class.
269 (class Sized_incr_dynobj): New class.
270 (make_sized_incremental_object): New function.
271 (class Incremental_library): New class.
272 * layout.cc (Free_list::num_lists): New static data member.
273 (Free_list::num_nodes): New static data member.
274 (Free_list::num_removes): New static data member.
275 (Free_list::num_remove_visits): New static data member.
276 (Free_list::num_allocates): New static data member.
277 (Free_list::num_allocate_visits): New static data member.
278 (Free_list::init): New function.
279 (Free_list::remove): New function.
280 (Free_list::allocate): New function.
281 (Free_list::dump): New function.
282 (Free_list::print_stats): New function.
283 (Layout_task_runner::run): Resize output file for incremental updates.
284 (Layout::Layout): Initialize new data members.
285 (Layout::set_incremental_base): New function.
286 (Layout::init_fixed_output_section): New function.
287 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
288 incremental updates.
289 (Layout::create_gold_note): Do not create gold note section for
290 incremental updates.
291 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
292 for incremental updates.
293 (Layout::set_section_offsets): For incremental updates, allocate space
294 from free list.
295 (Layout::create_symtab_sections): Layout with offsets relative to
296 start of section; for incremental updates, allocate space from free
297 list.
298 (Layout::create_shdrs): For incremental updates, allocate space from
299 free list.
300 (Layout::finish_dynamic_section): For incremental updates, do not
301 check --as-needed (fixed in subsequent patch).
302 * layout.h (class Free_list): New class.
303 (Layout::set_incremental_base): New function.
304 (Layout::incremental_base): New function.
305 (Layout::init_fixed_output_section): New function.
306 (Layout::allocate): New function.
307 (Layout::incremental_base_): New data member.
308 (Layout::free_list_): New data member.
309 * main.cc (main): Print Free_list statistics.
310 * object.cc (Relobj::finalize_incremental_relocs): Add
311 clear_counts parameter; clear counts only when clear_counts is set.
312 (Sized_relobj::Sized_relobj): Initialize new base class.
313 (Sized_relobj::do_layout): Don't report special sections.
314 (Sized_relobj::do_for_all_local_got_entries): New function.
315 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
316 symtab_off to all symbol table offsets.
317 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
318 * object.h (class Got_offset_list): Move to top of file.
319 (Object::Object): Allow case where input_file == NULL.
320 (Object::~Object): Likewise.
321 (Object::input_file): Assert that input_file != NULL.
322 (Object::lock): Allow case where input_file == NULL.
323 (Object::unlock): Likewise.
324 (Object::is_locked): Likewise.
325 (Object::token): Likewise.
326 (Object::release): Likewise.
327 (Object::is_incremental): New function.
328 (Object::get_mtime): New function.
329 (Object::for_all_local_got_entries): New function.
330 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
331 (Object::set_is_in_system_directory): New function.
332 (Object::is_in_system_directory): New function.
333 (Object::do_is_incremental): New function.
334 (Object::do_get_mtime): New function.
335 (Object::do_for_all_local_got_entries): New function.
336 (Object::is_in_system_directory_): New data member.
337 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
338 (class Sized_relobj_base): New class.
339 (class Sized_relobj): Derive from Sized_relobj_base.
340 (class Sized_relobj::Symbols): Redeclare from base class.
341 (class Sized_relobj::local_got_offset_list): Remove.
342 (class Sized_relobj::Output_sections): Redeclare from base class.
343 (class Sized_relobj::do_for_all_local_got_entries): New function.
344 (class Sized_relobj::write_local_symbols): Add offset parameter.
345 (class Sized_relobj::local_symbol_offset_): Update comment.
346 (class Sized_relobj::local_dynsym_offset_): Update comment.
347 * options.cc (Input_arguments::add_file): Remove const.
348 * options.h (Input_file_argument::Input_file_argument):
349 Initialize arg_serial_ (all constructors).
350 (Input_file_argument::set_arg_serial): New function.
351 (Input_file_argument::arg_serial): New function.
352 (Input_file_argument::arg_serial_): New data member.
353 (Input_arguments::Input_arguments): Initialize file_count_.
354 (Input_arguments::add_file): Remove const.
355 (Input_arguments::number_of_input_files): New function.
356 (Input_arguments::file_count_): New data member.
357 (Command_line::number_of_input_files): Call
358 Input_arguments::number_of_input_files.
359 * output.cc (Output_segment_headers::Output_segment_headers):
360 Set current size.
361 (Output_section::Input_section::current_data_size): New function.
362 (Output_section::Output_section): Initialize new data members.
363 (Output_section::add_input_section): Don't do merge sections for
364 an incremental link; allocate space from free list for an
365 incremental update.
366 (Output_section::add_output_section_data): Allocate space from
367 free list for an incremental update.
368 (Output_section::update_data_size): New function.
369 (Output_section::set_fixed_layout): New function.
370 (Output_section::reserve): New function.
371 (Output_segment::set_section_addresses): Remove const.
372 (Output_segment::set_section_list_addresses): Remove const; allocate
373 space from free list for an incremental update.
374 (Output_segment::set_offset): Adjust size of RELRO segment for an
375 incremental update.
376 * output.h (Output_data::current_data_size): Move here from
377 child classes.
378 (Output_data::pre_finalize_data_size): New function.
379 (Output_data::update_data_size): New function.
380 (Output_section_headers::update_data_size): new function.
381 (Output_section_data_build::current_data_size): Move to Output_data.
382 (Output_data_strtab::update_data_size): New function.
383 (Output_section::current_data_size): Move to Output_data.
384 (Output_section::set_fixed_layout): New function.
385 (Output_section::has_fixed_layout): New function.
386 (Output_section::reserve): New function.
387 (Output_section::update_data_size): New function.
388 (Output_section::has_fixed_layout_): New data member.
389 (Output_section::free_list_): New data member.
390 (Output_segment::set_section_addresses): Remove const.
391 (Output_segment::set_section_list_addresses): Remove const.
392 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
393 New function.
394 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
395 New function.
396 * readsyms.cc (Read_symbols::do_read_symbols): Add library
397 parameter when calling Add_symbols constructor; store argument
398 serial number for members of a lib group.
399 (Add_symbols::locks): Allow case where token == NULL.
400 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
401 (Read_member::~Read_member): New function.
402 (Read_member::is_runnable): New function.
403 (Read_member::locks): New function.
404 (Read_member::run): New function.
405 (Check_script::~Check_script): New function.
406 (Check_script::is_runnable): New function.
407 (Check_script::locks): New function.
408 (Check_script::run): New function.
409 (Check_library::~Check_library): New function.
410 (Check_library::is_runnable): New function.
411 (Check_library::locks): New function.
412 (Check_library::run): New function.
413 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
414 (Add_symbols::library_): New data member.
415 (class Read_member): New class.
416 (class Check_script): New class.
417 (class Check_library): New class.
418 * reloc.cc (Read_relocs::is_runnable): Allow case where
419 token == NULL.
420 (Read_relocs::locks): Likewise.
421 (Scan_relocs::locks): Likewise.
422 (Relocate_task::locks): Likewise.
423 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
424 to clear counters.
425 (Sized_relobj::incremental_relocs_scan): Fix comment.
426 (Sized_relobj::do_relocate): Pass output file offset to
427 write_local_symbols.
428 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
429 from class declaration.
430 * script.cc (read_input_script): Allocate Script_info; pass
431 argument serial number to report_script.
432 * script.h (class Script_info): Move to incremental.h.
433 * symtab.cc (Symbol_table::add_from_incrobj): New function.
434 * symtab.h (Symbol_table::add_from_incrobj): New function.
435 (Symbol_table::set_file_offset): New function.
436
437 2011-04-05 Cary Coutant <ccoutant@google.com>
438
439 * incremental-dump.cc (dump_incremental_inputs): Change signature
440 to take a Sized_incremental_binary; change caller. Use readers
441 in Sized_incremental_binary.
442 * incremental.cc
443 (Sized_incremental_binary::find_incremental_inputs_sections):
444 Rename do_find_incremental_inputs_sections to this.
445 (Sized_incremental_binary::setup_readers): New function.
446 (Sized_incremental_binary::do_check_inputs): Check
447 has_incremental_info_ flag; move setup code to setup_readers;
448 use input readers.
449 (Sized_incremental_binary::do_file_is_unchanged): New function.
450 (Sized_incremental_binary::do_get_input_reader): New function.
451 * incremental.h (class Incremental_binary): Move to end of file.
452 (Incremental_binary::file_is_unchanged): New function.
453 (Incremental_binary::do_file_is_unchanged): New function.
454 (Incremental_binary::Input_reader): New class.
455 (Incremental_binary::get_input_reader): New function.
456 (class Sized_incremental_binary): Move to end of file.
457 (Sized_incremental_binary::Sized_incremental_binary): Setup the
458 input section reader classes.
459 (Sized_incremental_binary::has_incremental_info): New function.
460 (Sized_incremental_binary::inputs_reader): New function.
461 (Sized_incremental_binary::symtab_reader): New function.
462 (Sized_incremental_binary::relocs_reader): New function.
463 (Sized_incremental_binary::got_plt_reader): New function.
464 (Sized_incremental_binary::do_file_is_unchanged): New function.
465 (Sized_incremental_binary::Sized_input_reader): New class.
466 (Sized_incremental_binary::get_input_reader): New function.
467 (Sized_incremental_binary::find_incremental_inputs_sections):
468 Rename do_find_incremental_inputs_sections to this.
469 (Sized_incremental_binary::setup_readers): New function.
470 (Sized_incremental_binary::has_incremental_info_): New data member.
471 (Sized_incremental_binary::inputs_reader_): New data member.
472 (Sized_incremental_binary::symtab_reader_): New data member.
473 (Sized_incremental_binary::relocs_reader_): New data member.
474 (Sized_incremental_binary::got_plt_reader_): New data member.
475 (Sized_incremental_binary::current_input_file_): New data member.
476
477 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
478
479 PR gold/12640
480 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
481 violation.
482
483 2011-03-30 Cary Coutant <ccoutant@google.com>
484
485 * archive.cc (Archive::include_member): Adjust call to report_object.
486 (Add_archive_symbols::run): Add script_info to call to
487 report_archive_begin.
488 (Lib_group::include_member): Adjust call to report_object.
489 (Add_lib_group_symbols::run): Adjust call to report_object.
490 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
491 blocks. Add object count for script input files.
492 * incremental.cc (Incremental_inputs::report_archive_begin): Add
493 script_info parameter; change all callers.
494 (Incremental_inputs::report_object): Add script_info parameter;
495 change all callers.
496 (Incremental_inputs::report_script): Store backpointer to
497 incremental info entry.
498 (Output_section_incremental_inputs::set_final_data_size): Record
499 additional information for scripts.
500 (Output_section_incremental_inputs::write_info_blocks): Likewise.
501 * incremental.h (Incremental_script_entry::add_object): New function.
502 (Incremental_script_entry::get_object_count): New function.
503 (Incremental_script_entry::get_object): New function.
504 (Incremental_script_entry::objects_): New data member; adjust
505 constructor.
506 (Incremental_inputs::report_archive_begin): Add script_info parameter.
507 (Incremental_inputs::report_object): Add script_info parameter.
508 (Incremental_inputs_reader::get_object_count): New function.
509 (Incremental_inputs_reader::get_object_offset): New function.
510 * options.cc (Input_arguments::add_file): Return reference to
511 new input argument.
512 * options.h (Input_argument::set_script_info): New function.
513 (Input_argument::script_info): New function.
514 (Input_argument::script_info_): New data member; adjust all
515 constructors.
516 (Input_file_group::add_file): Return reference to new input argument.
517 (Input_file_lib::add_file): Likewise.
518 (Input_arguments::add_file): Likewise.
519 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
520 * script.cc (Parser_closure::Parser_closure): Add script_info
521 parameter; adjust all callers.
522 (Parser_closure::script_info): New function.
523 (Parser_closure::script_info_): New data member.
524 (read_input_script): Report scripts earlier to incremental info.
525 (script_add_file): Set script_info in Input_argument.
526 (script_add_library): Likewise.
527 * script.h (Script_options::Script_info): Rewrite class.
528
529 2011-03-29 Cary Coutant <ccoutant@google.com>
530
531 * archive.cc (Library_base::should_include_member): Move
532 method here from class Archive.
533 (Archive::Archive): Initialize base class.
534 (Archive::should_include_member): Move to base class.
535 (Archive::do_for_all_unused_symbols): New function.
536 (Add_archive_symbols::run): Remove redundant access to
537 incremental_inputs.
538 (Lib_group::Lib_group): Initialize base class.
539 (Lib_group::do_filename): New function.
540 (Lib_group::include_member): Pass pointer to Lib_group to
541 report_object.
542 (Lib_group::do_for_all_unused_symbols): New function.
543 (Add_lib_group_symbols::run): Report archive information for
544 incremental links.
545 * archive.h (class Library_base): New base class.
546 (class Archive): Derive from Library_base.
547 (Archive::filename): Move to base class.
548 (Archive::set_incremental_info): Likewise.
549 (Archive::incremental_info): Likewise.
550 (Archive::Should_include): Likewise.
551 (Archive::should_include_member): Likewise.
552 (Archive::Armap_entry): Remove.
553 (Archive::Unused_symbol_iterator): Remove.
554 (Archive::unused_symbols_begin): Remove.
555 (Archive::unused_symbols_end): Remove.
556 (Archive::do_filename): New function.
557 (Archive::do_get_mtime): New function.
558 (Archive::do_for_all_unused_symbols): New function.
559 (Archive::task_): Move to base class.
560 (Archive::incremental_info_): Likewise.
561 (class Lib_group): Derive from Library_base.
562 (Lib_group::do_filename): New function.
563 (Lib_group::do_get_mtime): New function.
564 (Lib_group::do_for_all_unused_symbols): New function.
565 (Lib_group::task_): Move to base class.
566 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
567 function.
568 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
569 function.
570 * incremental.cc (Incremental_inputs::report_archive_begin):
571 Use Library_base; call library's get_mtime; add incremental inputs
572 entry before members.
573 (class Unused_symbol_visitor): New class.
574 (Incremental_inputs::report_archive_end): Use Library_base; use
575 visitor class to record unused symbols; don't add incremental inputs
576 entry after members.
577 (Incremental_inputs::report_object): Use Library_base.
578 * incremental.h
579 (Incremental_archive_entry::Incremental_archive_entry): Remove
580 unused Archive parameter.
581 (Incremental_inputs::report_archive_begin): Use Library_base.
582 (Incremental_inputs::report_archive_end): Likewise.
583 (Incremental_inputs::report_object): Likewise.
584 * object.cc (Sized_relobj::do_for_all_global_symbols): New
585 function.
586 * object.h (Object::for_all_global_symbols): New function.
587 (Object::do_for_all_global_symbols): New function.
588 (Sized_relobj::do_for_all_global_symbols): New function.
589 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
590 function.
591 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
592 function.
593
594 2011-03-27 Ian Lance Taylor <iant@google.com>
595
596 * archive.cc (Archive::interpret_header): Return -1 if something
597 goes wrong. Change callers accordingly.
598
599 2011-03-25 Cary Coutant <ccoutant@google.com>
600
601 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
602 * testsuite/Makefile.in: Regenerate.
603
604 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
605
606 * plugin.cc (get_view): New.
607 (Plugin::load): Pass get_view to the plugin.
608 (Plugin_manager::get_view): New.
609
610 2011-03-21 Ian Lance Taylor <iant@google.com>
611
612 * testsuite/final_layout.sh: Rewrite to not use dc.
613 * testsuite/relro_test.sh: Fail if dc is not present.
614
615 2011-03-21 Sriraman Tallam <tmsriram@google.com>
616
617 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
618 Change == to -eq.
619 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
620 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
621 Change == to -eq.
622 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
623 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
624
625 2011-03-14 Ian Lance Taylor <iant@google.com>
626
627 * script-sections.cc (Sort_output_sections::script_compare):
628 Rename from is_before, change return type.
629 (Sort_output_sections::operator()): Adjust accordingly.
630
631 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
632
633 PR gold/12572
634 * testsuite/odr_violation2.cc: Add comment to make all error line
635 numbers double digits.
636 * testsuite/debug_msg.sh: Adjust expected errors.
637
638 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
639
640 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
641 but mark earlier ones as non-canonical
642 (offset_to_iterator): Update search target and example
643 (do_addr2line): Return extra lines in a vector*
644 (format_file_lineno): Extract from do_addr2line
645 (one_addr2line): Add vector* out-param
646 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
647 when a lineno entry appeared last for its instruction
648 (Dwarf_line_info): Add vector* out-param
649 * object.cc (Relocate_info): Pass NULL for the vector* out-param
650 * symtab.cc (Odr_violation_compare): Include the lineno in the
651 comparison again.
652 (linenos_from_loc): New. Combine the canonical line for an
653 address with its other lines.
654 (True_if_intersect): New. Helper functor to make
655 std::set_intersection a query.
656 (detect_odr_violations): Compare sets of lines instead of just
657 one line for each function. This became less deterministic, but
658 has fewer false positives.
659 * symtab.h: Declarations.
660 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
661 mix an optimized and non-optimized object in the same binary
662 (odr_violation2.so): Same.
663 * testsuite/Makefile.in: Regenerate from Makefile.am.
664 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
665 * testsuite/debug_msg.sh: Update line numbers and add
666 assertions.
667 * testsuite/odr_violation1.cc: Use OdrDerived, in a
668 non-optimized context.
669 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
670 isn't inlined, and use OdrDerived in an optimized context.
671 * testsuite/odr_header1.h: Defines OdrDerived, where
672 optimization will change the
673 first-instruction-in-the-destructor's file and line number.
674 * testsuite/odr_header2.h: Defines OdrBase.
675
676 2011-03-09 Ian Lance Taylor <iant@google.com>
677
678 * fileread.cc (File_read::clear_views): Don't delete the whole
679 file view.
680
681 2011-03-08 Ian Lance Taylor <iant@google.com>
682
683 PR gold/12525
684 * fileread.cc: #include <climits>.
685 (GOLD_IOV_MAX): Define.
686 (File_read::read_multiple): Limit number of entries by iov_max.
687 * fileread.h (class File_read): Always set max_readv_entries to
688 128.
689
690 2011-03-07 Ian Lance Taylor <iant@google.com>
691
692 PR gold/12525
693 * options.h (class General_options): Add -dy and -dn.
694
695 2011-03-02 Cary Coutant <ccoutant@google.com>
696
697 * testsuite/script_test_9.t: Add TLS segment.
698
699 2011-03-02 Simon Baldwin <simonb@google.com>
700
701 * configure.ac: Add check for gnu_indirect_function support in
702 the toolchain building binutils.
703 * configure: Rebuild.
704
705 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
706
707 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
708 plugin only symbols.
709 (Symbol_table::sized_finalize_symbol) Mark symbol only present
710 in plugin files as not needed in the symbol table.
711
712 2011-02-11 Sriraman Tallam <tmsriram@google.com>
713
714 * output.cc (Output_section::add_input_section): Delay fill
715 generation for section ordering.
716
717 2011-02-09 Ian Lance Taylor <iant@google.com>
718
719 PR gold/12316
720 * object.h (class Sized_relobj): Remove clear_local_symbols.
721 * reloc.cc (Sized_relobj::do_relocate): Don't call
722 clear_local_symbols.
723
724 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
725
726 * plugin.cc (is_visible_from_outside): Return true for symbols
727 in the -u option.
728
729 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
730
731 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
732 filename.
733
734 2011-02-02 Sriraman Tallam <tmsriram@google.com>
735
736 * icf.h (is_section_foldable_candidate): Change type of parameter
737 to std::string.
738 * icf.cc (Icf::find_identical_sections): Change type of local variable
739 section_name to be std::string.
740 (is_function_ctor_or_dtor): Change type of parameter to std::string.
741
742 2011-01-25 Ian Lance Taylor <iant@google.com>
743
744 * script.cc (script_add_extern): Rewrite to use
745 add_symbol_reference.
746
747 2011-01-25 Doug Kwan <dougkwan@google.com>
748
749 * icf.cc (get_section_contents): Always lock section's object.
750
751 2011-01-24 Ian Lance Taylor <iant@google.com>
752
753 * options.h (class General_options): Accept
754 --no-detect-odr-violations.
755
756 2011-01-24 Ian Lance Taylor <iant@google.com>
757
758 * version.cc (version_string): Bump to 1.11.
759
760 2011-01-24 Ian Lance Taylor <iant@google.com>
761
762 * plugin.cc (class Plugin_rescan): Define new class.
763 (Plugin_manager::claim_file): Set any_claimed_.
764 (Plugin_manager::save_archive): New function.
765 (Plugin_manager::save_input_group): New function.
766 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
767 necessary.
768 (Plugin_manager::new_undefined_symbol): New function.
769 (Plugin_manager::rescan): New function.
770 (Plugin_manager::rescannable_defines): New function.
771 (Plugin_manager::add_input_file): Set any_added_.
772 * plugin.h (class Plugin_manager): define new fields rescannable_,
773 undefined_symbols_, any_claimed_, and any_added_. Declare
774 Plugin_rescan as friend. Declare new functions.
775 (Plugin_manager::Rescannable): Define type.
776 (Plugin_manager::Rescannable_list): Define type.
777 (Plugin_manager::Undefined_symbol_list): Define type.
778 (Plugin_manager::Plugin_manager): Initialize new fields.
779 * archive.cc (Archive::defines_symbol): New function.
780 (Add_archive_symbols::run): Pass archive to plugins if any.
781 * archive.h (class Archive): Declare defines_symbol.
782 * readsyms.cc (Input_group::~Input_group): New function.
783 (Finish_group::run): Pass input_group to plugins if any.
784 * readsyms.h (class Input_group): Declare destructor.
785 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
786 any.
787
788 2011-01-10 Ian Lance Taylor <iant@google.com>
789
790 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
791 section as relro.
792 (Layout::set_segment_offsets): Reset increase_relro before calling
793 set_section_addresses a second time.
794
795 2011-01-04 Cary Coutant <ccoutant@google.com>
796
797 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
798 sections before NOBITS sections.
799
800 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
801
802 * version.cc (print_version): Update copyright to 2011.
803
804 2010-12-23 Cary Coutant <ccoutant@google.com>
805
806 * output.h (Output_data_reloc::add_output_section): Pass OD instead
807 of OS to this->add. Add OD parameter to second form of the function.
808
809 2010-12-20 Ian Lance Taylor <iant@google.com>
810
811 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
812 second of two consecutive entries with same offset.
813
814 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
815
816 * testsuite/Makefile.am (ifuncmain2static_LDADD)
817 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
818 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
819 to avoid unneeded links against $(LDADD).
820 * testsuite/Makefile.in: Regenerate.
821
822 2010-12-15 Ian Lance Taylor <iant@google.com>
823
824 PR gold/12324
825 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
826 for R_X86_64_32 and R_X86_64_PC32.
827 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
828 ver_matching_def_pic.o.
829 (ver_matching_def_pic.o): New target.
830
831 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
832
833 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
834 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
835 Move definition before File_read::View member definitions.
836 (File_read::View::~View): Initialize and hold lock before
837 updating current_mapped_bytes.
838
839 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
840
841 * dwarf_reader.cc: Remove outdated comment.
842 * gold-threads.cc: Fix typo in error message.
843 * archive.cc: Fix typos in comments.
844 * archive.h: Likewise.
845 * arm-reloc-property.cc: Likewise.
846 * arm-reloc-property.h: Likewise.
847 * arm-reloc.def: Likewise.
848 * arm.cc: Likewise.
849 * attributes.h: Likewise.
850 * cref.cc: Likewise.
851 * ehframe.cc: Likewise.
852 * fileread.h: Likewise.
853 * gold.h: Likewise.
854 * i386.cc: Likewise.
855 * icf.cc: Likewise.
856 * incremental.h: Likewise.
857 * int_encoding.cc: Likewise.
858 * layout.h: Likewise.
859 * main.cc: Likewise.
860 * merge.h: Likewise.
861 * object.cc: Likewise.
862 * object.h: Likewise.
863 * options.cc: Likewise.
864 * readsyms.cc: Likewise.
865 * reduced_debug_output.cc: Likewise.
866 * reloc.cc: Likewise.
867 * script-sections.cc: Likewise.
868 * sparc.cc: Likewise.
869 * symtab.h: Likewise.
870 * target-reloc.h: Likewise.
871 * target.cc: Likewise.
872 * target.h: Likewise.
873 * timer.cc: Likewise.
874 * timer.h: Likewise.
875 * x86_64.cc: Likewise.
876
877 2010-12-09 Cary Coutant <ccoutant@google.com>
878
879 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
880 stack.
881 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
882 parameter; change all callers.
883 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
884 * options.h (warn_execstack): New option.
885
886 2010-12-07 Doug Kwan <dougkwan@google.com>
887
888 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
889 like function call relocations.
890
891 2010-12-07 Ian Lance Taylor <iant@google.com>
892
893 * archive.cc (Archive::get_elf_object_for_member): Permit
894 punconfigured to be NULL.
895 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
896 (Archive::include_member): Pass NULL to get_elf_object_for_member
897 if we searched for the archive and this is the first included
898 object.
899
900 2010-12-01 Ian Lance Taylor <iant@google.com>
901
902 * dwarf_reader.h (class Sized_dwarf_line_info): Add
903 track_relocs_type_ field.
904 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
905 Set track_relocs_type_.
906 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
907 contents when using RELA relocs.
908 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
909 reloc_map_.
910 * reloc.cc (Track_relocs::next_addend): New function.
911 * reloc.h (class Track_relocs): Declare next_addend.
912
913 2010-12-01 Ian Lance Taylor <iant@google.com>
914
915 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
916 virtual destructor.
917
918 2010-12-01 Ian Lance Taylor <iant@google.com>
919
920 * README: Update compilers known to work and fail.
921
922 2010-11-23 Matthias Klose <doko@ubuntu.com>
923
924 * configure.in: For --enable-gold, handle value `default' instead of
925 `both*'. Always install ld as ld.bfd, install as ld if gold is
926 not the default.
927 * configure: Regenerate.
928
929 2010-11-18 Doug Kwan <dougkwan@google.com>
930
931 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
932 and right_alignment to be zero. Store result alignment only if it is
933 greater than existing alignment.
934
935 2010-11-16 Cary Coutant <ccoutant@google.com>
936
937 PR gold/12220
938 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
939 Check for ".zdebug_line".
940
941 2010-11-16 Doug Kwan <dougkwan@google.com>
942 Cary Coutant <ccoutant@google.com>
943
944 * output.h (Output_segment::set_section_addresses): Pass increase_relro
945 by reference; adjust all callers.
946 * output.cc (Output_segment::set_section_addresses): Adjust references
947 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
948 list is empty.
949 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
950 end at page boundary.
951
952 2010-11-16 Cary Coutant <ccoutant@google.com>
953
954 PR gold/12220
955 * layout.cc (Layout::choose_output_section): Transform names of
956 compressed sections even when using a script with a SECTIONS clause.
957 (Layout::output_section_name): Remove code to transform
958 compressed debug section names.
959 * output.cc (Output_section::add_input_section): Use uncompressed
960 section size when tracking input sections.
961
962 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
963
964 * symtab.h (Symbol::NON_PIC_REF): Remove.
965 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
966 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
967 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
968 (Symbol::use_plt_offset): Take a flags argument and pass it
969 directly to needs_dynamic_reloc. Restrict check for undefined
970 weak symbols to function calls.
971 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
972 (Target_arm::Scan::global): Use it.
973 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
974 (Target_arm::Relocate::relocate): Likewise.
975 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
976 parameter with an r_type parameter. Use get_reference_flags
977 to get the flags.
978 (Target_arm::Relocate::relocate): Update accordingly.
979 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
980 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
981 (Target_i386::Scan::global): Likewise.
982 (Target_i386::Relocate::relocate): Likewise.
983 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
984 parameter with an r_type parameter. Use get_reference_flags
985 to get the flags.
986 (Target_i386::Relocate::relocate): Update accordingly.
987 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
988 (Target_powerpc::Scan::global): Use it.
989 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
990 (Target_powerpc::Relocate::relocate): Likewise.
991 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
992 (Target_sparc::Scan::global): Use it.
993 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
994 (Target_sparc::Relocate::relocate): Likewise.
995 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
996 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
997 (Target_x86_64::Scan::global): Likewise.
998 (Target_x86_64::Relocate::relocate): Likewise.
999
1000 2010-11-08 Doug Kwan <dougkwan@google.com>
1001 Cary Coutant <ccoutant@google.com>
1002
1003 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1004 (Arm_exidx_merge_section::section_contents_): New data member.
1005 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1006 (Arm_input_section::~Arm_input_section): De-allocate memory.
1007 (Arm_input_section::original_contents_): New data member.
1008 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1009 in parameters instead of calling Object::section_contents without
1010 locking.
1011 (Arm_output_section::group_section): New parameter TASK. Pass it
1012 to callees that need locking objects.
1013 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1014 to lock EXIDX input sections. Fix a formatting issue. Call
1015 Arm_exidx_merged_section::build_contents to create merged section
1016 contents.
1017 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1018 to lock object of stub table owner.
1019 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1020 TEXT_SIZE to initialize data member TEXT_SIZE_.
1021 (Arm_exidx_input_section::addralign): Fix typo in comment.
1022 (Arm_exidx_input_section::text_size): New method.
1023 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1024 that require locking objects. Lock objects before scanning for stubs
1025 and updating local symbols.
1026 (Arm_input_section<big_endian>::init): Copy contents of original
1027 input section.
1028 (Arm_input_section<big_endian>::do_write): Use saved contents of
1029 original input section instead of calling Object::section_contents
1030 without locking.
1031 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1032 size without calling Object::section_size().
1033 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1034 for size. Allocate a buffer for merged EXIDX entries.
1035 (Arm_exidx_merged_section::build_contents): New method.
1036 (Arm_exidx_merged_section::do_write): Move merge section contents
1037 building code to Arm_exidx_merged_section::build_contetns. Write
1038 out contetns in buffer instead of building it on the fly.
1039 (Arm_relobj::make_exidx_input_section): Also pass text section size
1040 to Arm_exidx_input_section constructor.
1041 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1042 (Arm_dynobj::do_read_symbols): Fix memory leak.
1043 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1044 * target.h: (class Task): Add forward declaration.
1045 (Target::relax): Add new parameter TASK and pass it to
1046 Target::do_relax().
1047 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1048
1049 2010-11-05 Cary Coutant <ccoutant@google.com>
1050
1051 PR gold/10708
1052 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1053 object when reading from the file.
1054 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1055 second layout pass.
1056 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1057 when reading section contents.
1058 (get_section_contents): Likewise.
1059 (icf::find_identical_sections): Likewise.
1060 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1061 object when reading from the file.
1062 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1063 the object when doing deferred section layout.
1064
1065 2010-11-03 Nick Clifton <nickc@redhat.com>
1066
1067 PR gold/12001
1068 * script.h (class Symbol_assignment: name): New member. Returns
1069 the name of the symbol.
1070 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1071 Returns true if the given symbol name is on the list of
1072 assignments wating to be processed.
1073 * archive.cc (should_incldue_member): If the symbol is undefined,
1074 check to see if it is on the list of symbols pending assignment.
1075
1076 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1077
1078 * script-sections.cc (Script_sections::find_memory_region): Check
1079 for a NULL output section pointer.
1080
1081 2010-10-29 Doug Kwan <dougkwan@google.com>
1082
1083 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1084 Output_section::add_relaxed_input_section.
1085 * output.cc (Output_section::add_relaxed_input_section): Add new
1086 arguments LAYOUT and NAME. Set section order index.
1087 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1088 Copy section order index.
1089 * output.h (Output_section::add_relaxed_input_section): Add new
1090 arguments LAYOUT and NAME.
1091
1092 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1093
1094 * testsuite/Makefile.am: Move gcctestdir/ld rule to
1095 NATIVE_OR_CROSS_LINKER.
1096 * testsuite/Makefile.in: Regenerate.
1097
1098 2010-10-20 Doug Kwan <dougkwan@google.com>
1099
1100 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1101 without SHF_LINK_ORDER flags.
1102 * layout.cc (Layout::choose_output_section): Do not filter
1103 SHF_LINK_ORDER flag in a relocatable link.
1104
1105 2010-10-17 Cary Coutant <ccoutant@google.com>
1106
1107 * output.h (Output_segment::set_section_addresses): Change function
1108 signature. Update all callers.
1109 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1110 sections.
1111 (Output_segment::set_section_addresses): Align after last TLS
1112 section. Add padding before last relro section instead of after.
1113
1114 2010-10-17 Doug Kwan <dougkwan@google.com>
1115
1116 * gold/arm.cc (Target_arm::got_section): Use correct order and set
1117 GOT output section to be writable.
1118
1119 2010-10-14 Cary Coutant <ccoutant@google.com>
1120
1121 * debug.h (DEBUG_INCREMENTAL): New flag.
1122 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1123 * gold.cc (queue_initial_tasks): Check parameters for incremental link
1124 mode.
1125 * incremental.cc (report_command_line): Ignore all forms of
1126 --incremental.
1127 * layout.cc (Layout::Layout): Check parameters for incremental link
1128 mode.
1129 * options.cc (General_options::parse_incremental): New function.
1130 (General_options::parse_no_incremental): New function.
1131 (General_options::parse_incremental_full): New function.
1132 (General_options::parse_incremental_update): New function.
1133 (General_options::incremental_mode_): New data member.
1134 (General_options::finalize): Check incremental_mode_.
1135 * options.h (General_options): Update help text for --incremental.
1136 Add --no-incremental, --incremental-full, --incremental-update.
1137 (General_options::Incremental_mode): New enum type.
1138 (General_options::incremental_mode): New function.
1139 (General_options::incremental_mode_): New data member.
1140 * parameters.cc (Parameters::incremental_mode_): New data member.
1141 (Parameters::set_options): Set incremental_mode_.
1142 (Parameters::set_incremental_full): New function.
1143 (Parameters::incremental): New function.
1144 (Parameters::incremental_update): New function.
1145 (set_parameters_incremental_full): New function.
1146 * parameters.h (Parameters::set_incremental_full): New function.
1147 (Parameters::incremental): New function.
1148 (Parameters::incremental_update): New function.
1149 (Parameters::incremental_mode_): New data member.
1150 (set_parameters_incremental_full): New function.
1151 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1152 incremental link mode.
1153 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1154 (Sized_relobj::do_relocate_sections): Likewise.
1155 * testsuite/Makefile.am (incremental_test): Use --incremental-full
1156 option.
1157 * testsuite/Makefile.in: Regenerate.
1158 * testsuite/incremental_test.sh: Filter all forms of --incremental.
1159
1160 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1161
1162 * script-sections.h (class Script_sections): Make
1163 Sections_elements typedef public.
1164 * script-sections.cc (class Sort_output_sections): Add elements_
1165 field. Add constructor which sets it; change all callers.
1166 (Sort_output_sections::is_before): New function.
1167 (Sort_output_sections::operator()): Call is_before.
1168 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1169 conditional.
1170 * testsuite/script_test_10.sh: New test. Test script section
1171 order.
1172 * testsuite/script_test_10.t: Likewise.
1173 * testsuite/script_test_10.s: Likewise.
1174 * testsuite/Makefile.am: Wrap the cross linker tests and the
1175 common tests into NATIVE_OR_CROSS_LINKER.
1176 (check_SCRIPTS): Add script_test_10.sh.
1177 (check_DATA): Add script_test_10.stdout.
1178 (script_test_10.o, script_test_10): New targets.
1179 (script_test_10.stdout): New target.
1180 * configure, testsuite/Makefile.in: Regenerate.
1181
1182 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1183
1184 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1185 error for the deprecated relocations.
1186 (Target_arm::Scan::global): Likewise.
1187 (Target_arm::Relocate::relocate): Likewise.
1188
1189 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
1190
1191 * fileread.cc (Input_file::find_file): Initialize *found_name
1192 and *namep when using the fallback search for case 4.
1193
1194 2010-10-11 Cary Coutant <ccoutant@google.com>
1195
1196 * options.h (class General_options): Redefine -z lazy as an alias for
1197 the negation of -z now.
1198
1199 2010-10-11 Ian Lance Taylor <iant@google.com>
1200
1201 * resolve.cc (symbol_to_bits): Report the value of the unsupported
1202 binding.
1203
1204 2010-10-06 Nick Clifton <nickc@redhat.com>
1205
1206 * script-sections.cc(class Memory_region): Remove
1207 current_lma_offset_ field. Rename current_vma_offset_ to
1208 current_offset_. Add last_section_ field.
1209 (Memory_region::get_current_vma_address): Rename to
1210 get_current_address.
1211 (Memory_region::get_current_lma_address): Delete.
1212 (Memory_region::increment_vma_offset): Rename to
1213 increment_offset.
1214 (Memory_region::increment_lma_offset): Delete.
1215 (Memory_region::attributes_compatible): New method. Returns
1216 true if the provided section is compatible with the region.
1217 (Memory_region::get_last_section): New method. Returns the last
1218 section to use the region.
1219 (Memory_region::set_last_section): New method. Stores the last
1220 section to use the region.
1221 (Script_sections::block_in_region): New method. Returns true if
1222 a block of memory is contained within a region.
1223 (Script_sections::find_memory_region): New method. Locates a
1224 memory region to be used to set a VMA or LMA address.
1225 (Output_section_definition::set_section_addresses): Add code to
1226 check for addresses set by memory regions.
1227 (Output_segment::set_section_addresses): Remove memory region
1228 walking code.
1229 (Script_sections::create_segment): Add a warning if a header
1230 segment is created outside of any region.
1231 * script-sections.h (class Script_sections): Add prototypes for
1232 find_memory_region and block_in_region methods.
1233 * testsuite/memory_test.s: Use .long instead of .word.
1234 * testsuite/memory_test.t: Add some more output sections.
1235 * testsuite/memory_test.sh: Update expected output.
1236
1237 2010-10-02 Doug Kwan <dougkwan@google.com>
1238
1239 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1240 defintion to symtab.h
1241 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1242 declaration to defintion.
1243
1244 2010-10-01 Nick Clifton <nickc@redhat.com>
1245
1246 * expression.cc (eval): Replace dummy argument with NULL.
1247 (eval_maybe_dot): Check for a NULL result section pointer.
1248 (Symbol_expression::value): Likewise.
1249 (Dot_expression::value): Likewise.
1250 (BINARY_EXPRESSION): Likewise.
1251 (Max_expression::value): Likewise.
1252 (Min_expression::value): Likewise.
1253 (Absolute_expression::value): Likewise.
1254 (Addr_expression::value_from_output_section): Likewise.
1255 (Loaddddr_expression::value_from_output_section): Likewise.
1256 (Segment_start_expression::value): Likewise.
1257 * script-sections.cc
1258 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1259 argument with NULL.
1260 (Sections_elememt_dot_assignment::set_section_addresses):
1261 Likewise.
1262 (Output_data_expression::do_write_to_buffer): Likewise.
1263 (Output_section_definition::finalize_symbols): Likewise.
1264 (Output_section_definition::set_section_addresses): Likewise.
1265
1266 2010-09-30 Doug Kwan <dougkwan@google.com>
1267
1268 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1269
1270 2010-09-28 Sriraman Tallam <tmsriram@google.com>
1271
1272 * target.h (Target::can_icf_inline_merge_sections): New virtual
1273 function.
1274 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1275 virtual function.
1276 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1277 virtual function.
1278 * icf.cc (get_section_contents): Inline merge sections only when
1279 target allows it.
1280
1281 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1282
1283 * configure: Regenerate.
1284
1285 2010-09-17 Ian Lance Taylor <iant@google.com>
1286
1287 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1288 * testsuite/Makefile.am (memory_test.o): New target.
1289 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1290 memory_test.t.
1291 * testsuite/Makefile.in: Rebuild.
1292
1293 2010-09-17 Doug Kwan <dougkwan@google.com>
1294
1295 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1296 defintion if relocation uses GOT entries of the symbol.
1297 * testsuite/icf_safe_test.sh: Fix test.
1298 * testsuite/icf_safe_so_test.sh: Fix test.
1299
1300 2010-09-16 Cary Coutant <ccoutant@google.com>
1301
1302 * script_sections.cc (class Memory_region): Remove "NULL" from
1303 vector initializations.
1304
1305 2010-09-15 Cary Coutant <ccoutant@google.com>
1306
1307 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1308 Resolve forwarding symbols.
1309
1310 2010-09-15 Doug Kwan <dougkwan@google.com>
1311
1312 * gold/testsuite/script_test_3.t: Add ARM special sections.
1313 * gold/testsuite/script_test_4.t: Same.
1314 * gold/testsuite/script_test_5.t: Same.
1315 * gold/testsuite/script_test_6.t: Same.
1316 * gold/testsuite/script_test_7.t: Same.
1317 * gold/testsuite/script_test_7.t: Same.
1318 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1319
1320 2010-09-14 Cary Coutant <ccoutant@google.com>
1321
1322 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1323 (Target_x86_64::Relocate::relocate_tls): Replace check for
1324 saw_tls_block_reloc_ with test for executable section.
1325
1326 2010-09-12 Cary Coutant <ccoutant@google.com>
1327
1328 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1329 position-independent executables to shared libraries need dynamic
1330 relocations.
1331 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1332 position-independent executables.
1333 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1334 * testsuite/Makefile.in: Regenerate.
1335
1336 2010-09-10 Nick Clifton <nickc@redhat.com>
1337
1338 PR gold/11997
1339 * testsuite/memory_test.t: Discard any sections that are not
1340 needed.
1341
1342 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
1343
1344 PR gold/11996
1345 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1346 "This::" to work around a bug in gcc 4.2.
1347
1348 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1349
1350 2010-09-09 Rafael Espindola <espindola@google.com>
1351
1352 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1353 sections with different PF_X flags in the same segment.
1354 (Layout::find_first_load_seg): Search all segments to find the first
1355 one.
1356 * options.h (rosegment): New.
1357
1358 2010-09-08 Rafael Espindola <espindola@google.com>
1359
1360 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1361
1362 2010-09-08 Doug Kwan <dougkwan@google.com>
1363
1364 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1365 (Arm_relobj::do_relocate_sections): Add new parameter for output
1366 file to match the parent.
1367 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1368 of local symbols instead of input values. Update code to track
1369 changes in gold::relocate_section.
1370 * object.cc (Sized_relobj::compute_final_local_value): New methods.
1371 (Sized_relobj::compute_final_local_value_internal): New methods.
1372 (Sized_relobj::do_finalize_local_symbols): Move code from loop
1373 body into private version of Sized_relobj::compute_final_local_value.
1374 Call the inline method.
1375 * object.h (Symbol_value::Symbol_value): Define destructor. Free
1376 merged symbol value if there is one.
1377 (Symbol_value::has_output_value): New method defintiion.
1378 (Sized_relobj::Compute_final_local_value_status): New enum type.
1379 (Sized_relobj::compute_final_local_value): New methods.
1380 (Sized_relobj::compute_final_local_value_internal): New methods.
1381 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1382 and arm_cortex_a8.sh.
1383 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1384 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1385 New tests.
1386 * Makefile.in: Regenerate.
1387 * testsuite/arm_bl_out_of_range.s: Update test.
1388 * testsuite/thumb_bl_out_of_range.s: Ditto.
1389 * testsuite/thumb_blx_out_of_range.s: Ditto.
1390 * testsuite/arm_branch_out_of_range.sh: New file.
1391 * testsuite/arm_cortex_a8.sh: Ditto.
1392 * testsuite/arm_cortex_a8_b.s: Ditto.
1393 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1394 * testsuite/arm_cortex_a8_b_local.s: Ditto.
1395 * testsuite/arm_cortex_a8_bl.s: Ditto.
1396 * testsuite/arm_cortex_a8_blx.s: Ditto.
1397 * testsuite/arm_cortex_a8_local.s: Ditto.
1398 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1399 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1400
1401 2010-09-08 Rafael Espindola <espindola@google.com>
1402
1403 * Makefile.am (memory_test.stdout): Run readelf with -W.
1404 * Makefile.in: Regenerate.
1405 * testsuite/memory_test.sh: Make the regexps accept both 32 and
1406 64 bit output.
1407
1408 2010-09-08 Rafael Espindola <espindola@google.com>
1409
1410 * script-sections.cc (Script_sections::add_memory_region): Convert
1411 field precision to int.
1412 * script.cc (script_set_section_region, script_set_section_region):
1413 Convert field precision to int.
1414
1415 2010-09-08 Rafael Espindola <espindola@google.com>
1416
1417 * arm.cc (do_finalize_sections): Create the __exidx_start and
1418 __exdix_end symbols even when the section is missing.
1419
1420 2010-09-08 Nick Clifton <nickc@redhat.com>
1421
1422 * README: Remove claim that MEMORY is not supported.
1423 * expression.cc (script_exp_function_origin)
1424 (script_exp_function_length): Move from here to ...
1425 * script.cc: ... here.
1426 (script_set_section_region, script_add_memory)
1427 (script_parse_memory_attr, script_include_directive): New
1428 functions.
1429 * script-sections.cc
1430 (class Memory_region): New class.
1431 (class Output_section_definition): Add set_memory_region,
1432 set_section_vma, set_section_lma and get_section_name methods.
1433 (class Script_Sections): Add add_memory_region,
1434 find_memory_region, find_memory_region_origin,
1435 find_memory_region_length and set_memory_region methods.
1436 Have set_section_addresses method walk the list of set memory
1437 regions.
1438 Extend the print methos to display memory regions.
1439 * script-sections.h: Add prototypes for new methods.
1440 Add enum for MEMORY region attributes.
1441 * yyscript.y: Add support for parsing MEMORY regions.
1442 * script-c.h: Add prototypes for new functions.
1443 * testsuite/Makefile.am: Add test of MEMORY region functionality.
1444 * testsuite/Makefile.in: Regenerate.
1445 * testsuite/memory_test.sh: New script.
1446 * testsuite/memory_test.s: New assembler source file.
1447 * testsuite/memory_test.t: New linker script.
1448
1449 2010-08-27 Doug Kwan <dougkwan@google.com>
1450
1451 * gold/resolve.cc (Symbol_table::should_override): Let a weak
1452 reference override an existing dynamic weak reference.
1453 * testsuite/Makefile.am: Add new test dyn_weak_ref.
1454 * testsuite/Makefile.in: Regenerate.
1455 * testsuite/dyn_weak_ref.sh: New file.
1456 * testsuite/dyn_weak_ref_1.c: Ditto.
1457 * testsuite/dyn_weak_ref_2.c: Ditto.
1458
1459 2010-08-27 Ian Lance Taylor <iant@google.com>
1460
1461 * incremental.h (class Incremental_input_entry): Add virtual
1462 destructor.
1463
1464 2010-08-27 Ian Lance Taylor <iant@google.com>
1465
1466 * testsuite/start_lib_test_3.c: Mark t3 as used.
1467
1468 2010-08-27 Nick Clifton <nickc@redhat.com>
1469
1470 * options.cc (version_script): Fix small typo in previous
1471 whitespace tidyup.
1472
1473 2010-08-25 Nick Clifton <nickc@redhat.com>
1474
1475 * archive.cc: Formatting fixes: Remove whitespace between
1476 typename and following asterisk. Remove whitespace between
1477 function name and opening parenthesis.
1478 * archive.h: Likewise.
1479 * arm.cc: Likewise.
1480 * attributes.cc: Likewise.
1481 * attributes.h: Likewise.
1482 * common.cc: Likewise.
1483 * copy-relocs.cc: Likewise.
1484 * dirsearch.h: Likewise.
1485 * dynobj.cc: Likewise.
1486 * ehframe.cc: Likewise.
1487 * ehframe.h: Likewise.
1488 * expression.cc: Likewise.
1489 * fileread.cc: Likewise.
1490 * fileread.h: Likewise.
1491 * gc.h: Likewise.
1492 * gold-threads.cc: Likewise.
1493 * gold.cc: Likewise.
1494 * i386.cc: Likewise.
1495 * icf.h: Likewise.
1496 * incremental-dump.cc: Likewise.
1497 * incremental.cc: Likewise.
1498 * layout.cc: Likewise.
1499 * layout.h: Likewise.
1500 * main.cc: Likewise.
1501 * merge.cc: Likewise.
1502 * merge.h: Likewise.
1503 * object.cc: Likewise.
1504 * object.h: Likewise.
1505 * options.cc: Likewise.
1506 * options.h: Likewise.
1507 * output.cc: Likewise.
1508 * output.h: Likewise.
1509 * plugin.cc: Likewise.
1510 * plugin.h: Likewise.
1511 * powerpc.cc: Likewise.
1512 * reloc.cc: Likewise.
1513 * script-c.h: Likewise.
1514 * script-sections.cc: Likewise.
1515 * script.cc: Likewise.
1516 * stringpool.cc: Likewise.
1517 * symtab.cc: Likewise.
1518 * symtab.h: Likewise.
1519 * target.cc: Likewise.
1520 * timer.cc: Likewise.
1521 * timer.h: Likewise.
1522 * version.cc: Likewise.
1523 * x86_64.cc: Likewise.
1524
1525 2010-08-24 Nick Clifton <nickc@redhat.com>
1526
1527 PR 11899
1528 * layout.cc (segment_precedes): Sort segments by their physical
1529 addresses, if they have been set.
1530
1531 2010-08-23 Cary Coutant <ccoutant@google.com>
1532
1533 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1534 symbols data.
1535 (Lib_group::include_member): Unlock object after deleting its
1536 symbols data.
1537 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1538 the bug fixed here.
1539
1540 2010-08-19 Neil Vachharajani <nvachhar@google.com>
1541 Cary Coutant <ccoutant@google.com>
1542
1543 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1544 constructor, and set_blocker.
1545 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1546 readsyms_blocker_.
1547 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1548 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1549 * testsuite/Makefile.am (start_lib_test): New test case.
1550 * testsuite/Makefile.in: Regenerate.
1551 * testsuite/start_lib_test_main.c: New file.
1552 * testsuite/start_lib_test_1.c: New file.
1553 * testsuite/start_lib_test_2.c: New file.
1554 * testsuite/start_lib_test_3.c: New file.
1555
1556 2010-08-19 Ian Lance Taylor <iant@google.com>
1557
1558 * Makefile.in: Rebuild with automake 1.11.1.
1559 * aclocal.m4: Likewise.
1560 * testsuite/Makefile.in: Likewise.
1561
1562 2010-08-19 Ian Lance Taylor <iant@google.com>
1563
1564 PR 10893
1565 * i386.cc (class Output_data_plt_i386): Update declarations.
1566 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
1567 local_ifuncs_ fields.
1568 (Target_i386::do_plt_section_for_global): New function.
1569 (Target_i386::do_plt_section_for_local): New function.
1570 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1571 parameter; change all callers. Initialize global_ifuncs_ and
1572 local_ifuncs_. If doing a static link define __rel_iplt_start and
1573 __rel_iplt_end.
1574 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1575 (Output_data_plt_i386::add_local_ifunc_entry): New function.
1576 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1577 symbols.
1578 (Target_i386::make_plt_section): New function, broken out of
1579 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
1580 (Target_i386::make_plt_entry): Call make_plt_section.
1581 (Target_i386::make_local_ifunc_plt_entry): New function.
1582 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1583 (Target_i386::Scan::local): Handle IFUNC symbols. Add
1584 R_386_IRELATIVE to switch.
1585 (Target_i386::Scan::global): Likewise.
1586 (Target_i386::Relocate::relocate): Likewise.
1587 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1588 switch.
1589 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1590 (Target_x86_64::do_plt_section_for_global): New function.
1591 (Target_x86_64::do_plt_section_for_local): New function.
1592 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1593 parameter; change all callers. If doing a static link define
1594 __rela_iplt_start and __rela_iplt_end.
1595 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1596 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1597 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1598 to point to .plt.
1599 (Target_x86_64::make_local_ifunc_plt_entry): New function.
1600 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1601 switch.
1602 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1603 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
1604 R_X86_64_IRELATIVE to switch.
1605 (Target_x86_64::Scan::global): Likewise.
1606 (Target_x86_64::Relocate::relocate): Likewise.
1607 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1608 switch.
1609 * target.h (class Target): Add plt_section_for_global and
1610 plt_section_for_local functions. Add do_plt_section_for_global
1611 and do_plt_section_for_local virtual functions.
1612 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
1613 clarifying comments.
1614 (Symbol::use_plt_offset): Handle IFUNC symbol.
1615 * object.cc (Sized_relobj::Sized_relobj): Initialize
1616 local_plt_offsets_.
1617 (Sized_relobj::local_has_plt_offset): New function.
1618 (Sized_relobj::local_plt_offset): New function.
1619 (Sized_relobj::set_local_plt_offset): New function.
1620 (Sized_relobj::do_count): Handle IFUNC symbol.
1621 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
1622 a bit away from input_shndx_ field. Add set_is_func_symbol and
1623 is_ifunc_symbol functions.
1624 (class Sized_relobj): Update declarations. Remove Tls_got_entry
1625 and Local_tls_got_offsets. Define Local_plt_offsets. Add
1626 local_plt_offsets_ field.
1627 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1628 * output.h (class Output_section_data): Add non-const
1629 output_section function.
1630 (class Output_data_got): Update declarations.
1631 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1632 Add use_plt_offset parameter to global and local constructors.
1633 Change all callers. Change local_sym_index_ field to 31 bits.
1634 Change GSYM_CODE and CONSTANT_CODE accordingly.
1635 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1636 doing a static link don't set sh_link field.
1637 (Output_data_got::Got_entry::write): Use PLT offset if
1638 appropriate.
1639 (Output_data_got::add_global_plt): New function.
1640 (Output_data_got::add_local_plt): New function.
1641 * target-reloc.h (relocate_section): Handle IFUNC symbol.
1642 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1643 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1644 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1645 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1646 IFUNC conditional.
1647 * testsuite/ifunc-sel.h: New file.
1648 * testsuite/ifuncmain1.c: New file.
1649 * testsuite/ifuncmain1vis.c: New file.
1650 * testsuite/ifuncmod1.c: New file.
1651 * testsuite/ifuncdep2.c: New file.
1652 * testsuite/ifuncmain2.c: New file.
1653 * testsuite/ifuncmain3.c: New file.
1654 * testsuite/ifuncmod3.c: New file.
1655 * testsuite/ifuncmain4.c: New file.
1656 * testsuite/ifuncmain5.c: New file.
1657 * testsuite/ifuncmod5.c: New file.
1658 * testsuite/ifuncmain6pie.c: New file.
1659 * testsuite/ifuncmod6.c: New file.
1660 * testsuite/ifuncmain7.c: New file.
1661 * configure, testsuite/Makefile.in: Rebuild.
1662
1663 2010-08-18 Ian Lance Taylor <iant@google.com>
1664
1665 * incremental.cc
1666 (Output_section_incremental_inputs::write_input_files): Add cast
1667 to avoid signed/unsigned comparison warning.
1668 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1669
1670 2010-08-12 Cary Coutant <ccoutant@google.com>
1671
1672 * common.cc (Sort_commons::operator()): Remove unnecessary code.
1673
1674 2010-08-13 Ian Lance Taylor <iant@google.com>
1675
1676 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1677
1678 2010-08-12 Cary Coutant <ccoutant@google.com>
1679 Doug Kwan <dougkwan@google.com>
1680
1681 * resolve.cc (Symbol_table::should_override): When a weak dynamic
1682 defintion overrides non-weak undef, remember that the original undef
1683 is not weak.
1684 * symtab.cc (Symbol_table::sized_write_global): For undef without
1685 an original weak binding, set binding to global in output.
1686 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1687 * testsuite/Makefile.in: Regenerate.
1688 * testsuite/strong_ref_weak_def.sh: New file.
1689 * testsuite/strong_ref_weak_def_1.c: Ditto.
1690 * testsuite/strong_ref_weak_def_2.c: Ditto.
1691
1692 2010-08-12 Cary Coutant <ccoutant@google.com>
1693
1694 * testsuite/incremental_test.sh: Rewrite.
1695 * testsuite/incremental_test_1.c: Rewrite.
1696 * testsuite/incremental_test_2.c: Rewrite.
1697
1698 2010-08-12 Cary Coutant <ccoutant@google.com>
1699
1700 * arm.cc (Target_arm::got_size): Add const.
1701 (Target_arm::got_entry_count): New function.
1702 (Target_arm::plt_entry_count): New function.
1703 (Target_arm::first_plt_entry_offset): New function.
1704 (Target_arm::plt_entry_size): New function.
1705 (Output_data_plt_arm::entry_count): New function.
1706 (Output_data_plt_arm::first_plt_entry_offset): New function.
1707 (Output_data_plt_arm::get_plt_entry_size): New function.
1708 * i386.cc (Target_i386::got_size): Add const.
1709 (Target_i386::got_entry_count): New function.
1710 (Target_i386::plt_entry_count): New function.
1711 (Target_i386::first_plt_entry_offset): New function.
1712 (Target_i386::plt_entry_size): New function.
1713 (Output_data_plt_i386::entry_count): New function.
1714 (Output_data_plt_i386::first_plt_entry_offset): New function.
1715 (Output_data_plt_i386::get_plt_entry_size): New function.
1716 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1717 find_incremental_inputs_sections. Dump incremental_got_plt section.
1718 * incremental.cc: Include target.h.
1719 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1720 parameter. Adjust all callers. Find incremental_got_plt section.
1721 (Incremental_inputs::create_data_sections): Create incremental_got_plt
1722 section.
1723 (Output_section_incremental_inputs::set_final_data_size): Calculate
1724 size of incremental_got_plt section.
1725 (Output_section_incremental_inputs::do_write): Write the
1726 incremental_got_plt section.
1727 (Got_plt_view_info): New struct.
1728 (Local_got_offset_visitor): New class.
1729 (Global_got_offset_visitor): New class.
1730 (Global_symbol_visitor_got_plt): New class.
1731 (Output_section_incremental_inputs::write_got_plt): New function.
1732 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1733 Add parameter. Adjust all callers.
1734 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1735 (Incremental_inputs::got_plt_section): New function.
1736 (Incremental_inputs::got_plt_section_): New data member.
1737 (Incremental_got_plt_reader): New class.
1738 * layout.cc (Layout::create_incremental_info_sections): Add the
1739 incremental_got_plt section.
1740 * object.h (Got_offset_list::get_list): New function.
1741 (Got offset_list::for_all_got_offsets): New function.
1742 (Sized_relobj::local_got_offset_list): New function.
1743 * powerpc.cc (Target_powerpc::got_size): Add const.
1744 (Target_powerpc::got_entry_count): New function.
1745 (Target_powerpc::plt_entry_count): New function.
1746 (Target_powerpc::first_plt_entry_offset): New function.
1747 (Target_powerpc::plt_entry_size): New function.
1748 (Output_data_plt_powerpc::entry_count): New function.
1749 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1750 (Output_data_plt_powerpc::get_plt_entry_size): New function.
1751 * sparc.cc (Target_sparc::got_size): Add const.
1752 (Target_sparc::got_entry_count): New function.
1753 (Target_sparc::plt_entry_count): New function.
1754 (Target_sparc::first_plt_entry_offset): New function.
1755 (Target_sparc::plt_entry_size): New function.
1756 (Output_data_plt_sparc::entry_count): New function.
1757 (Output_data_plt_sparc::first_plt_entry_offset): New function.
1758 (Output_data_plt_sparc::get_plt_entry_size): New function.
1759 * symtab.h (Symbol::got_offset_list): New function.
1760 (Symbol_table::for_all_symbols): New function.
1761 * target.h (Sized_target::got_entry_count): New function.
1762 (Sized_target::plt_entry_count): New function.
1763 (Sized_target::plt_entry_size): New function.
1764 * x86_64.cc (Target_x86_64::got_size): Add const.
1765 (Target_x86_64::got_entry_count): New function.
1766 (Target_x86_64::plt_entry_count): New function.
1767 (Target_x86_64::first_plt_entry_offset): New function.
1768 (Target_x86_64::plt_entry_size): New function.
1769 (Output_data_plt_x86_64::entry_count): New function.
1770 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1771 (Output_data_plt_x86_64::get_plt_entry_size): New function.
1772
1773 2010-08-12 Cary Coutant <ccoutant@google.com>
1774
1775 * archive.cc: Include incremental.h.
1776 (Archive::Archive): Initialize incremental_info_.
1777 (Archive::include_member): Record archive members in incremental info.
1778 (Add_archive_symbols::run): Record begin and end of an archive in
1779 incremental info.
1780 (Lib_group::include_member): Record objects in incremental info.
1781 * archive.h (Incremental_archive_entry): Forward declaration.
1782 (Archive::set_incremental_info): New member function.
1783 (Archive::incremental_info): New member function.
1784 (Archive::Unused_symbol_iterator): New class.
1785 (Archive::unused_symbols_begin): New member function.
1786 (Archive::unused_symbols_end): New member function.
1787 (Archive::incremental_info_): New data member.
1788 * incremental-dump.cc (find_input_containing_global): New function.
1789 (dump_incremental_inputs): Dump new incremental info sections.
1790 * incremental.cc: Include symtab.h.
1791 (Output_section_incremental_inputs): New class.
1792 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1793 new incremental info sections.
1794 (Sized_incremental_binary::do_check_inputs): Likewise.
1795 (Incremental_inputs::report_archive): Remove.
1796 (Incremental_inputs::report_archive_begin): New function.
1797 (Incremental_inputs::report_archive_end): New function.
1798 (Incremental_inputs::report_object): New function.
1799 (Incremental_inputs::finalize_inputs): Remove.
1800 (Incremental_inputs::report_input_section): New function.
1801 (Incremental_inputs::report_script): Rewrite.
1802 (Incremental_inputs::finalize): Do nothing but finalize string table.
1803 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1804 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1805 (Incremental_inputs::create_data_sections): New function.
1806 (Incremental_inputs::relocs_entsize): New function.
1807 (Output_section_incremental_inputs::set_final_data_size): New function.
1808 (Output_section_incremental_inputs::do_write): New function.
1809 (Output_section_incremental_inputs::write_header): New function.
1810 (Output_section_incremental_inputs::write_input_files): New function.
1811 (Output_section_incremental_inputs::write_info_blocks): New function.
1812 (Output_section_incremental_inputs::write_symtab): New function.
1813 * incremental.h (Incremental_script_entry): Forward declaration.
1814 (Incremental_object_entry): Forward declaration.
1815 (Incremental_archive_entry): Forward declaration.
1816 (Incremental_inputs): Forward declaration.
1817 (Incremental_inputs_header_data): Remove.
1818 (Incremental_inputs_header): Remove.
1819 (Incremental_inputs_header_write): Remove.
1820 (Incremental_inputs_entry_data): Remove.
1821 (Incremental_inputs_entry): Remove.
1822 (Incremental_inputs_entry_write): Remove.
1823 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1824 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1825 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1826 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1827 Likewise.
1828 (Incremental_input_entry): New class.
1829 (Incremental_script_entry): New class.
1830 (Incremental_object_entry): New class.
1831 (Incremental_archive_entry): New class.
1832 (Incremental_inputs::Incremental_inputs): Initialize new data members.
1833 (Incremental_inputs::report_inputs): Remove.
1834 (Incremental_inputs::report_archive): Remove.
1835 (Incremental_inputs::report_archive_begin): New function.
1836 (Incremental_inputs::report_archive_end): New function.
1837 (Incremental_inputs::report_object): Change prototype.
1838 (Incremental_inputs::report_input_section): New function.
1839 (Incremental_inputs::report_script): Change prototype.
1840 (Incremental_inputs::get_reloc_count): New function.
1841 (Incremental_inputs::set_reloc_count): New function.
1842 (Incremental_inputs::create_data_sections): New function.
1843 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1844 (Incremental_inputs::inputs_section): New function.
1845 (Incremental_inputs::symtab_section): New function.
1846 (Incremental_inputs::relocs_section): New function.
1847 (Incremental_inputs::get_stringpool): Add const.
1848 (Incremental_inputs::command_line): Add const.
1849 (Incremental_inputs::inputs): Remove.
1850 (Incremental_inputs::command_line_key): New function.
1851 (Incremental_inputs::input_file_count): New function.
1852 (Incremental_inputs::input_files): New function.
1853 (Incremental_inputs::relocs_entsize): New function.
1854 (Incremental_inputs::sized_create_inputs_section_data): Remove.
1855 (Incremental_inputs::finalize_inputs): Remove.
1856 (Incremental_inputs::Input_info): Remove.
1857 (Incremental_inputs::lock_): Remove.
1858 (Incremental_inputs::inputs_): Change type.
1859 (Incremental_inputs::inputs_map_): Remove.
1860 (Incremental_inputs::current_object_entry_): New data member.
1861 (Incremental_inputs::inputs_section_): New data member.
1862 (Incremental_inputs::symtab_section_): New data member.
1863 (Incremental_inputs::relocs_section_): New data member.
1864 (Incremental_inputs::reloc_count_): New data member.
1865 (Incremental_inputs_reader): New class.
1866 (Incremental_symtab_reader): New class.
1867 (Incremental_relocs_reader): New class.
1868 * layout.cc (Layout::finalize): Move finalization of incremental info
1869 and creation of incremental info sections to follow finalization of
1870 symbol table. Set offsets for postprocessing sections.
1871 (Layout::create_incremental_info_sections): Call
1872 Incremental_inputs::create_data_sections. Add incremental symtab
1873 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
1874 sections to layout after input sections.
1875 * layout.h (struct Timespec): Forward declaration.
1876 (Layout::incremental_inputs): Add const.
1877 (Layout::create_incremental_info_sections): Add parameter.
1878 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1879 * object.cc: Include incremental.h.
1880 (Relobj::finalize_incremental_relocs): New function.
1881 (Sized_relobj::do_layout): Record input sections in incremental info.
1882 * object.h (Object::output_section): New function.
1883 (Object::output_section_offset): Moved from Relobj.
1884 (Object::get_incremental_reloc_base): New function.
1885 (Object::get_incremental_reloc_count): New function.
1886 (Object::do_output_section): New function.
1887 (Object::do_output_section_offset): Moved from Relobj.
1888 (Object::do_get_incremental_reloc_base): New function.
1889 (Object::do_get_incremental_reloc_count): New function.
1890 (Object::Object): Initialize new data members.
1891 (Relobj::output_section): Renamed do_output_section and moved to
1892 protected.
1893 (Relobj::output_section_offset): Moved to Object.
1894 (Relobj::do_get_incremental_reloc_base): New function.
1895 (Relobj::do_get_incremental_reloc_count): New function.
1896 (Relobj::allocate_incremental_reloc_counts): New function.
1897 (Relobj::count_incremental_reloc): New function.
1898 (Relobj::finalize_incremental_relocs): New function.
1899 (Relobj::next_incremental_reloc_index): New function.
1900 (Relobj::reloc_counts_): New data member.
1901 (Relobj::reloc_bases_): New data member.
1902 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
1903 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
1904 (Sized_relobj::incremental_relocs_scan): New function.
1905 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1906 (Sized_relobj::incremental_relocs_write): New function.
1907 (Sized_relobj::incremental_relocs_write_reltype): New function.
1908 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1909 incremental link.
1910 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1911 archives and object files elsewhere.
1912 (Add_symbols::run): Report object files here.
1913 (Finish_group::run): Report end of archive at end of group.
1914 * reloc.cc: Include layout.h, incremental.h.
1915 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1916 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1917 (Sized_relobj::incremental_relocs_scan): New function.
1918 (Sized_relobj::incremental_relocs_scan_reltype): New function.
1919 (Sized_relobj::do_relocate_sections): Write incremental relocations.
1920 (Sized_relobj::incremental_relocs_write): New function.
1921 (Sized_relobj::incremental_relocs_write_reltype): New function.
1922 * script.cc (read_input_script): Rewrite test for incremental link.
1923 Change call to Incremental_inputs::report_script.
1924 * symtab.h (Symbol_table::first_global_index): New function.
1925 (Symbol_table::output_count): New function.
1926
1927 2010-08-12 Doug Kwan <dougkwan@google.com>
1928
1929 * arm.cc (Target_arm::merge_object_attributes): Check command line
1930 options --no-wchar-size-warning and --no-enum-size-warning.
1931 * options.h (General_options): Add ld-compatible options
1932 --no-enum-size-warning and --no-wchar-size-warning.
1933
1934 2010-08-04 Ian Lance Taylor <iant@google.com>
1935
1936 * x86_64.cc (Target_x86_64::Scan::local): Use
1937 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1938 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1939 (Target_x86_64::Scan::global): Likewise.
1940 (Target_x86_64::Relocate::relocate): Likewise.
1941 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1942 Likewise.
1943
1944 2010-08-03 Cary Coutant <ccoutant@google.com>
1945
1946 * merge.cc (Output_merge_string::do_add_input_section): Count strings
1947 to reserve space in merged_strings vector. Keep total input size
1948 for stats.
1949 (Output_merge_string::do_print_merge_stats): Print total input size.
1950 * merge.h (Output_merge_string): Add input_size_ field.
1951 * stringpool.cc (Stringpool_template::string_length): Move
1952 implementations out of Stringpool_template class and place in
1953 stringpool.h.
1954 * stringpool.h (string_length): Move out of Stringpool_template.
1955
1956 2010-08-03 Ian Lance Taylor <iant@google.com>
1957
1958 PR 11712
1959 * layout.cc (relaxation_loop_body): If address of load segment is
1960 set, adjust address to include headers if possible.
1961
1962 2010-08-03 Ian Lance Taylor <iant@google.com>
1963
1964 * version.cc (version_string): Bump to 1.10.
1965
1966 2010-08-03 Ian Lance Taylor <iant@google.com>
1967
1968 PR 11805
1969 * layout.h (enum Output_section_order): Define.
1970 (class Layout): Update declarations.
1971 * layout.cc (Layout::get_output_section): Add order parameter.
1972 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1973 is_first_non_relro parameters. Change all callers.
1974 (Layout::choose_output_section): Likewise.
1975 (Layout::add_output_section_data): Likewise.
1976 (Layout::make_output_section): Likewise. Set order.
1977 (Layout::default_section_order): New function.
1978 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1979 * output.cc (Output_section::Output_section): Initialize order_.
1980 Don't initialize deleted fields.
1981 (Output_segment::Output_segment): Don't initialize deleted
1982 fields.
1983 (Output_segment::add_output_section_to_load): New function
1984 replacing add_output_section. Change all callers to call this or
1985 add_output_section_to_nonload.
1986 (Output_segment::add_output_section_to_nonload): New function.
1987 (Output_segment::remove_output_section): Rewrite.
1988 (Output_segment::add_initial_output_data): Likewise.
1989 (Output_segment::has_any_data_sections): Likewise.
1990 (Output_segment::is_first_section_relro): Likewise.
1991 (Output_segment::maximum_alignment): Likewise.
1992 (Output_segment::has_dynamic_reloc): New function replacing
1993 dynamic_reloc_count. Change all callers.
1994 (Output_segment::has_dynamic_reloc_list): New function replacing
1995 dynamic_reloc_count_list. Change all callers.
1996 (Output_segment::set_section_addresses): Rewrite.
1997 (Output_segment::set_offset): Rewrite.
1998 (Output_segment::find_first_and_last_list): Remove.
1999 (Output_segment::set_tls_offsets): Rewrite.
2000 (Output_segment::first_section_load_address): Likewise.
2001 (Output_segment::output_section_count): Likewise.
2002 (Output_segment::section_with_lowest_load_address): Likewise.
2003 (Output_segment::write_section_headers): Likewise.
2004 (Output_segment::print_sections_to_map): Likewise.
2005 * output.h (class Output_data): Remove dynamic_reloc_count_
2006 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2007 (Output_data::add_dynamic_reloc): Rewrite.
2008 (Output_data::has_dynamic_reloc): New function.
2009 (Output_data::dynamic_reloc_count): Remove.
2010 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2011 is_last_relro_, is_first_non_relro_, is_interp_,
2012 is_dynamic_linker_section_ fields. Add order and set_order
2013 functions. Remove is_relro_local, set_is_relro_local,
2014 is_last_relro, set_is_last_relro, is_first_non_relro,
2015 set_is_first_non_relro functions, is_interp, set_is_interp,
2016 is_dynamic_linker_section, and set_is_dynamic_linker_section
2017 functions.
2018 (class Output_segment): Change Output_data_list from std::list to
2019 std:;vector. Add output_lists_ field. Remove output_data_ and
2020 output_bss_ fields. Update declarations.
2021
2022 2010-08-02 Ian Lance Taylor <iant@google.com>
2023
2024 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2025 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2026 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2027
2028 2010-08-02 Ian Lance Taylor <iant@google.com>
2029
2030 PR 11855
2031 * script.cc (Script_options::Script_options): Initialize
2032 symbol_definitions_ and symbol_references_.
2033 (Script_options::add_symbol_assignment): Update
2034 symbol_definitions_ and symbol_references_.
2035 (Script_options::add_symbol_reference): New function.
2036 (script_symbol): New function.
2037 * script.h (class Script_options): Add symbol_definitions_ and
2038 symbol_references_ fields.
2039 (Script_options::referenced_const_iterator): New type.
2040 (Script_options::referenced_begin): New function.
2041 (Script_options::referenced_end): New function.
2042 (Script_options::is_referenced): New function.
2043 (Script_options::any_unreferenced): New function.
2044 * script-c.h (script_symbol): Declare.
2045 * yyscript.y (exp): Call script_symbol.
2046 * symtab.cc: Include "script.h".
2047 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2048 Change all callers. Check symbols referenced by scripts.
2049 (Symbol_table::add_undefined_symbols_from_command_line): Add
2050 layout parameter. Change all callers.
2051 (Symbol_table::do_add_undefined_symbols_from_command_line):
2052 Likewise. Break out loop body. Check symbols referenced by
2053 scripts.
2054 (Symbol_table::add_undefined_symbol_from_command_line): New
2055 function broken out of
2056 do_add_undefined_symbols_from_command_line.
2057 * symtab.h (class Symbol_table): Update declarations.
2058 * archive.cc: Include "layout.h".
2059 (Archive::should_include_member): Add layout parameter. Change
2060 all callers. Check for symbol mentioned in expression.
2061 * archive.h (class Archive): Update declaration.
2062 * object.cc (Sized_relobj::do_should_include_member): Add layout
2063 parameter.
2064 * object.h (Object::should_include_member): Add layout parameter.
2065 Change all callers.
2066 (Object::do_should_include_member): Add layout parameter.
2067 (class Sized_relobj): Update declaration.
2068 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2069 parameter.
2070 * dynobj.h (class Sized_dynobj): Update declaration.
2071 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2072 layout parameter.
2073 * plugin.h (class Sized_pluginobj): Update declaration.
2074
2075 2010-08-02 Ian Lance Taylor <iant@google.com>
2076
2077 PR 11866
2078 * output.cc (Output_segment::set_offset): Search for the first and
2079 last sections rather than assuming that the list is in order.
2080 (Output_segment::find_first_and_last_list): New function.
2081 * output.h (class Output_segment): Update declarations.
2082 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2083 (relro_strip_test_SOURCES): New variable.
2084 (relro_strip_test_DEPENDENCIES): New variable.
2085 (relro_strip_test_LDFLAGS): New variable.
2086 (relro_strip_test_LDADD): New variable.
2087 (relro_strip_test.so): New target.
2088
2089 2010-08-02 Ian Lance Taylor <iant@google.com>
2090
2091 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2092 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2093 (Target_i386::got_tlsdesc_section): New function.
2094 (Target_i386::got_section): Create space for GOT entries for
2095 TLSDESC relocations.
2096 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2097 R_386_TLS_GOTDESC.
2098 (Target_i386::Scan::global): Likewise.
2099 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2100 using TLSDESC GOT.
2101 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2102 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2103 (Target_x86_64::got_tlsdesc_section): New function.
2104 (Target_x86_64::got_section): Create space for GOT entries for
2105 TLSDESC relocations.
2106 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2107 R_386_TLS_GOTDESC.
2108 (Target_x86_64::Scan::global): Likewise.
2109 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2110 using TLSDESC GOT.
2111
2112 2010-08-02 Ian Lance Taylor <iant@google.com>
2113
2114 * testsuite/final_layout.sh: Use dc to convert from hex to
2115 decimal.
2116
2117 2010-07-29 Sriraman Tallam <tmsriram@google.com>
2118
2119 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2120 paramter to the call to gold::gc_process_relocs.
2121 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2122 paramter to the call to gold::gc_process_relocs.
2123 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2124 parameter to the call to gold::gc_process_relocs.
2125 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2126 template parameter to the call to gold::gc_process_relocs.
2127 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2128 paramter to the call to gold::gc_process_relocs.
2129 * gc.h (get_embedded_addend_size): New function.
2130 (gc_process_relocs): Save the size of the reloc for use by ICF.
2131 * icf.cc (get_section_contents): Get the addend from the text section
2132 for SHT_REL relocation sections.
2133 * icf.h (Icf::Reloc_addend_size_info): New typedef.
2134 (Icf::Reloc_info): Add new member reloc_addend_size_info.
2135 * int_encoding.h (read_from_pointer): New overloaded function.
2136 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2137 * testsuite/icf_sht_rel_addend_test.sh: New file.
2138 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2139 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2140
2141 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2142
2143 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2144 * Makefile.in: Regenerate.
2145 * testsuite/Makefile.in: Regenerate.
2146
2147 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
2148
2149 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2150 * gold/testsuite/debug_msg.cc: Likewise.
2151 * gold/testsuite/odr_violation1.cc
2152 * gold/testsuite/odr_violation2.cc
2153
2154 2010-07-21 Cary Coutant <ccoutant@google.com>
2155
2156 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2157 string, and length fields.
2158 (Output_merge_string::Merged_strings_list): New type.
2159 (Output_merge_string::Merged_strings_lists): New typedef.
2160 (Output_merge_string): Replace merged_strings_ with
2161 merged_strings_lists_.
2162 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2163 Merged_strings_list per input object and section. Don't store pointer
2164 to the string. Don't store length with each merged string entry.
2165 (Output_merge_string::finalize_merged_data): Loop over list of merged
2166 strings lists. Recompute length of each merged string.
2167
2168 2010-07-15 Cary Coutant <ccoutant@google.com>
2169
2170 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2171 here.
2172
2173 2010-07-14 Ian Lance Taylor <iant@google.com>
2174
2175 * descriptors.cc (Descriptors::open): Report correct name in error
2176 message.
2177
2178 2010-07-13 Doug Kwan <dougkwan@google.com>
2179
2180 * arm.cc (Arm_input_section::Arm_input_section): For a
2181 SHT_ARM_EXIDX section, always keeps the input sections.
2182 (Arm_input_section::set_exidx_section_link): New method.
2183 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2184 has_errors_ to false.
2185 (Arm_exidx_input_section::has_errors,
2186 Arm_exidx_input_section::set_has_errors): New methods.
2187 (Arm_exidx_input_section::has_errors_): New data member.
2188 (Arm_relobj::get_exidx_shndx_list): New method.
2189 (Arm_output_section::append_text_sections_to_list): Do not skip
2190 section without SHF_EXECINSTR.
2191 (Arm_output_section::fix_exidx_coverage): Skip input sections with
2192 errors.
2193 (Arm_relobj::make_exidx_input_section): Add new parameter for text
2194 section header. Make error messages more verbose. Check for
2195 a non-executable section linked to an EXIDX section.
2196 (Arm_relobj::do_read_symbols): Remove error checking, which has been
2197 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
2198 check that there is no deferred EXIDX section if we exit early.
2199 Instead of not making an EXIDX section in case of an error, make one
2200 and set the has_errors flag of it.
2201 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2202 in a relocatable link.
2203 (Target_arm::do_relax): Look for the EXIDX output section instead of
2204 assuming that it is called .ARM.exidx.
2205 (Target_arm::fix_exidx_coverage): Add a new parameter for input
2206 section list. Do not check for SHF_EXECINSTR section flags but
2207 skip any input section with errors.
2208 * output.cc (Output_section::Output_section): Initialize
2209 always_keeps_input_sections_ to false.
2210 (Output_section::add_input_section): Check for
2211 always_keeps_input_sections_.
2212 * output.h (Output_section::always_keeps_input_sections,
2213 Output_section::set_always_keeps_input_sections): New methods.
2214 (Output_section::always_keeps_input_sections): New data member.
2215
2216 2010-07-13 Rafael Espindola <espindola@google.com>
2217
2218 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2219 * fileread.h (Input_file): Add try_extra_search_path and find_file.
2220
2221 2010-07-13 Philip Herron <herron.philip@googlemail.com>
2222 Ian Lance Taylor <iant@google.com>
2223
2224 * output.h (Output_section_lookup_maps::add_merge_section):
2225 Correct check of whether value was inserted.
2226 (Output_section_lookup_maps::add_merge_input_section): Likewise.
2227 (Output_section_lookup_maps::add_relaxed_input_section):
2228 Likewise.
2229 * arm.cc (Target_arm::got_section): Remove used local os.
2230 * i386.cc (Target_i386::got_section): Likewise.
2231 * x86_64.cc (Target_x86_64::got_section): Likewise.
2232 * sparc.cc (Target_sparc::got_section): Likewise.
2233 (Target_sparc::relocate): Remove unused local have_got_offset.
2234 * powerpc.cc (Target_powerpc::relocate): Likewise.
2235
2236 2010-07-13 Ian Lance Taylor <iant@google.com>
2237
2238 * compressed_output.cc (zlib_decompress): Fix signature in
2239 !HAVE_ZLIB_H case.
2240
2241 * archive.cc (Archive::include_member): Unlock an external member
2242 of a thin archive. Don't bother to delete an object we know is
2243 NULL.
2244
2245 2010-07-12 Cary Coutant <ccoutant@google.com>
2246
2247 * compressed_output.cc (zlib_decompress): New function.
2248 (get_uncompressed_size): New function.
2249 (decompress_input_section): New function.
2250 * compressed_output.h (get_uncompressed_size): New function.
2251 (decompress_input_section): New function.
2252 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2253 Handle compressed debug sections.
2254 * layout.cc (is_compressed_debug_section): New function.
2255 (Layout::output_section_name): Map compressed section names to
2256 canonical names.
2257 * layout.h (is_compressed_debug_section): New function.
2258 (is_debug_info_section): Recognize compressed debug sections.
2259 * merge.cc: Include compressed_output.h.
2260 (Output_merge_data::do_add_input_section): Handle compressed
2261 debug sections.
2262 (Output_merge_string::do_add_input_section): Handle compressed
2263 debug sections.
2264 * object.cc: Include compressed_output.h.
2265 (Sized_relobj::Sized_relobj): Initialize new data members.
2266 (build_compressed_section_map): New function.
2267 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2268 * object.h (Object::section_is_compressed): New method.
2269 (Object::do_section_is_compressed): New method.
2270 (Sized_relobj::Compressed_section_map): New type.
2271 (Sized_relobj::do_section_is_compressed): New method.
2272 (Sized_relobj::compressed_sections_): New data member.
2273 * output.cc (Output_section::add_input_section): Handle compressed
2274 debug sections.
2275 * reloc.cc: Include compressed_output.h.
2276 (Sized_relobj::write_sections): Handle compressed debug sections.
2277
2278 2010-07-08 Cary Coutant <ccoutant@google.com>
2279
2280 * resolve.cc (Symbol_table::resolve): Remember whether undef was
2281 weak when resolving to a dynamic def.
2282 (Symbol_table::should_override): Add adjust_dyndef flag; set it
2283 for weak undef/dynamic def cases. Adjust callers.
2284 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2285 undef_binding_weak_.
2286 (Symbol_table::sized_write_globals): Adjust symbol binding.
2287 (Symbol_table::sized_write_symbol): Add binding parameter.
2288 * symtab.h (Symbol::set_undef_binding): New method.
2289 (Symbol::is_undef_binding_weak): New method.
2290 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2291 (Symbol_table::should_override): Add new parameter.
2292 (Symbol_table::sized_write_symbol): Add new parameter.
2293
2294 * testsuite/weak_undef_file1.cc: Add new test case.
2295 * testsuite/weak_undef_file2.cc: Fix header comment.
2296 * testsuite/weak_undef_test.cc: Add new test case.
2297
2298 2010-06-29 Doug Kwan <dougkwan@google.com>
2299
2300 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2301 Initialize USE_SYMBOL_.
2302 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2303 definition.
2304 (Arm_reloc_property::uses_symbol_): New data member declaration.
2305 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2306 uses symbol value and symbol is undefined but not weakly undefined.
2307
2308 2010-06-28 Rafael Espindola <espindola@google.com>
2309
2310 * plugin.cc (Plugin::load): Use dlerror.
2311
2312 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
2313
2314 * symtab.cc (detect_odr_violations): When reporting an ODR
2315 violation, report an object where the symbol is defined.
2316
2317 2010-06-25 Doug Kwan <dougkwan@google.com>
2318
2319 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2320 (Target_arm::section_may_have_icf_unsafe_pointers): New method
2321 definition.
2322 (Target_arm::Scan::local_reloc_may_be_function_pointer,
2323 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2324 target hook to detect function points.
2325 (Target_arm::Scan::possible_function_pointer_reloc): New method.
2326 * icf.h (Icf::check_section_for_function_pointers): Change type of
2327 parameter SECTION_NAME to const reference to std::string. Use
2328 target hook to determine if section may have unsafe pointers.
2329 * target.h (Target::section_may_have_icf_unsafe_pointers): New
2330 method definition.
2331
2332 2010-06-21 Rafael Espindola <espindola@google.com>
2333
2334 * fileread.cc (Input_file::find_fie): New
2335 (Input_file::open): Use Input_file::find_fie.
2336 * fileread.h (Input_file::find_fie): New
2337 * plugin.cc (set_extra_library_path): New.
2338 (Plugin::load): Add set_extra_library_path to the transfer vector.
2339 (Plugin_manager::set_extra_library_path): New.
2340 (Plugin_manager::add_input_file): Use the extra search path if set.
2341 (set_extra_library_path(): New.
2342 * plugin.h (Plugin_manager): Add set_extra_library_path and
2343 extra_search_path_.
2344
2345 2010-06-19 Cary Coutant <ccoutant@google.com>
2346
2347 * layout.cc (gdb_sections): Add .debug_types.
2348 (lines_only_debug_sections): Likewise.
2349
2350 2010-06-18 Rafael Espindola <espindola@google.com>
2351
2352 * plugin.cc (add_input_file,add_input_library)
2353 (Plugin_manager::add_input_file): Make filename arguments const.
2354 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2355 const.
2356
2357 2010-06-16 Doug Kwan <dougkwan@google.com>
2358
2359 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2360 .ARM.attributes section if we have not merged any input
2361 attributes sections.
2362
2363 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2364
2365 * arm.cc: Allow combining objects with no EABI version
2366 information.
2367
2368 2010-06-15 Rafael Espindola <espindola@google.com>
2369
2370 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2371
2372 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2373
2374 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2375 (struct iovec): Correct !HAVE_READV definition.
2376
2377 2010-06-10 Cary Coutant <ccoutant@google.com>
2378
2379 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2380 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2381 reloc sections.
2382 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2383
2384 PR 11683
2385 * symtab.h (Symbol::is_placeholder): New member function.
2386 * target-reloc.h (relocate_section): Check for placeholder symbols.
2387
2388 * testsuite/Makefile.am (plugin_test_8): New test.
2389 (plugin_test_9): New test.
2390 * testsuite/Makefile.in: Regenerate.
2391
2392 2010-06-09 Nick Clifton <nickc@redhat.com>
2393
2394 * yyscript.y (input_list_element): Allow strings prefixed with
2395 the '-' character. Treat these as libraries.
2396 * script.cc (script_add_library): New function. Adds a library
2397 specified by "-l<name>" found in an input script.
2398 * script-c.h: Add prototype for script_add_library.
2399
2400 2010-06-07 Doug Kwan <dougkwan@google.com>
2401
2402 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2403 Restrict stub-group size to be within long conditional branch
2404 range when working around cortex-A8 erratum.
2405
2406 2010-06-07 Damien Diederen <dd@crosstwine.com>
2407
2408 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2409 #ifdef typo.
2410
2411 2010-06-03 Sriraman Tallam <tmsriram@google.com>
2412
2413 PR gold/11658
2414 * output.cc
2415 (Output_section::Input_section_sort_entry::compare_section_ordering):
2416 Change to return non-zero correctly.
2417 (Output_section::Input_section_sort_section_order_index_compare
2418 ::operator()): Change to fix ambiguity in comparisons.
2419
2420 2010-06-01 Sriraman Tallam <tmsriram@google.com>
2421
2422 * gold.h (is_wildcard_string): New function.
2423 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2424 (Layout::layout_eh_frame): Ditto.
2425 (Layout::find_section_order_index): New method.
2426 (Layout::read_layout_from_file): New method.
2427 * layout.h (Layout::find_section_order_index): New method.
2428 (Layout::read_layout_from_file): New method.
2429 (Layout::input_section_position_): New private member.
2430 (Layout::input_section_glob_): New private member.
2431 * main.cc (main): Call read_layout_from_file here.
2432 * options.h (--section-ordering-file): New option.
2433 * output.cc (Output_section::input_section_order_specified_): New
2434 member.
2435 (Output_section::Output_section): Initialize new member.
2436 (Output_section::add_input_section): Add new parameter.
2437 Keep input sections when --section-ordering-file is used.
2438 (Output_section::set_final_data_size): Sort input sections when
2439 section ordering file is specified.
2440 (Output_section::Input_section_sort_entry): Add new parameter.
2441 Check sorting type.
2442 (Output_section::Input_section_sort_entry::compare_section_ordering):
2443 New method.
2444 (Output_section::Input_section_sort_compare::operator()): Change to
2445 consider section_order_index.
2446 (Output_section::Input_section_sort_init_fini_compare::operator()):
2447 Change to consider section_order_index.
2448 (Output_section::Input_section_sort_section_order_index_compare
2449 ::operator()): New method.
2450 (Output_section::sort_attached_input_sections): Change to sort
2451 according to section order when specified.
2452 (Output_section::add_input_section<32, true>): Add new parameter.
2453 (Output_section::add_input_section<64, true>): Add new parameter.
2454 (Output_section::add_input_section<32, false>): Add new parameter.
2455 (Output_section::add_input_section<64, false>): Add new parameter.
2456 * output.h (Output_section::add_input_section): Add new parameter.
2457 (Output_section::input_section_order_specified): New
2458 method.
2459 (Output_section::set_input_section_order_specified): New method.
2460 (Input_section::Input_section): Initialize section_order_index_.
2461 (Input_section::section_order_index): New method.
2462 (Input_section::set_section_order_index): New method.
2463 (Input_section::section_order_index_): New member.
2464 (Input_section::Input_section_sort_section_order_index_compare): New
2465 struct.
2466 (Output_section::input_section_order_specified_): New member.
2467 * script-sections.cc (is_wildcard_string): Delete and move modified
2468 method to gold.h.
2469 (Output_section_element_input::Output_section_element_input): Modify
2470 call to is_wildcard_string.
2471 (Output_section_element_input::Input_section_pattern
2472 ::Input_section_pattern): Ditto.
2473 (Output_section_element_input::Output_section_element_input): Ditto.
2474 * testsuite/Makefile.am (final_layout): New test case.
2475 * testsuite/Makefile.in: Regenerate.
2476 * testsuite/final_layout.cc: New file.
2477 * testsuite/final_layout.sh: New file.
2478
2479 2010-06-01 Rafael Espindola <espindola@google.com>
2480
2481 * plugin.cc (Plugin::load): Pass the output name to the plugin.
2482
2483 2010-06-01 Rafael Espindola <espindola@google.com>
2484
2485 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2486 visibility of symbols.
2487
2488 2010-05-27 Doug Kwan <dougkwan@google.com>
2489
2490 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2491 from start of output section instead of address for a local symbol
2492 in a merged or relaxed section when doing a relocatable link.
2493
2494 2010-05-26 Rafael Espindola <espindola@google.com>
2495
2496 PR 11604
2497 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2498 adding sections the garbage collector removed.
2499 * gold/testsuite/Makefile.am: Add test.
2500 * gold/testsuite/Makefile.in: Regenerate.
2501 * gold/testsuite/plugin_test_7.sh: New.
2502 * gold/testsuite/plugin_test_7_1.c: New.
2503 * gold/testsuite/plugin_test_7_2.c: New.
2504
2505 2010-05-26 Rafael Espindola <espindola@google.com>
2506
2507 * script-sections.cc (Output_section_definition::set_section_addresses):
2508 Check for --section-start.
2509
2510 2010-05-26 Doug Kwan <dougkwan@google.com>
2511
2512 * arm.cc (Arm_scan_relocatable_relocs): New class.
2513 (Target_arm::relocate_special_relocatable): New method.
2514 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2515 (Arm_relocate_functions::thumb_branch_common): Same.
2516 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2517 instead of Default_scan_relocatable_relocs.
2518 * target-reloc.h (relocate_for_relocatable): Let target handle
2519 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2520 * target.h (Sized_target::relocate_special_relocatable): New method.
2521
2522 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2523
2524 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2525
2526 2010-05-23 Doug Kwan <dougkwan@google.com>
2527
2528 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2529 instead of a cast.
2530 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2531 with a direct branch, not a conditional branch, to a stub.
2532 * merge.cc (Output_merge_base::record_input_section): New method
2533 defintion.
2534 (Output_merge_data::do_add_input_section): Record input section if
2535 keeps-input-sections flag is set.
2536 (Output_merge_string::do_add_input_section): Ditto.
2537 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2538 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2539 INPUT_SECTIONS_.
2540 (Output_merge_base::keeps_input_sections,
2541 Output_merge_base::set_keeps_input_sections,
2542 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2543 method definitions.
2544 (Output_merge_base::Input_sections): New type declaration.
2545 (Output_merge_base::input_sections_begin,
2546 Output_merge_base::input_sections_end,
2547 Output_merge_base::do_set_keeps_input_sections): New method definitions.
2548 (Output_merge_base::bool keeps_input_sections_,
2549 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2550 Output_merge_base::input_sections_): New data members.
2551 (Output_merge_data::do_set_keeps_input_sections): New method
2552 defintion.
2553 (Output_merge_string::do_set_keeps_input_sections): Ditto.
2554 * output.cc (Output_section::Input_section::relobj): Move method
2555 defintion from class declaration to here and handle merge sections.
2556 (Output_section::Input_section::shndx): Ditto.
2557 (Output_section::Output_section): Remove initializations of removed
2558 data members and initialize new data member LOOKUP_MAPS_.
2559 (Output_section::add_input_section): Set keeps-input-sections flag
2560 for a newly created merge output section as appropriate. Adjust code
2561 to use Output_section_lookup_maps class.
2562 (Output_section::add_relaxed_input_section): Adjst code for lookup
2563 maps code refactoring.
2564 (Output_section::add_merge_input_section): Add a new parameter
2565 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
2566 class. If adding input section to a newly created merge output
2567 section fails, remove the new merge section.
2568 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2569 Adjust code for use of the Output_section_lookup_maps class.
2570 (Output_section::find_merge_section): Ditto.
2571 (Output_section::build_lookup_maps): New method defintion.
2572 (Output_section::find_relaxed_input_section): Adjust code to use
2573 Output_section_lookup_maps class.
2574 (Output_section::get_input_sections): Export merge sections. Adjust
2575 code to use Output_section_lookup_maps class.
2576 (Output_section:::add_script_input_section): Adjust code to use
2577 Output_section_lookup_maps class. Update lookup maps for merge
2578 sections also.
2579 (Output_section::discard_states): Use Output_section_lookup_maps.
2580 (Output_section::restore_states): Same.
2581 * output.h (Merge_section_properties): Move class defintion out of
2582 Output_section.
2583 (Output_section_lookup_maps): New class.
2584 (Output_section::Input_section::is_merge_section): New method
2585 defintion.
2586 (Output_section::Input_section::relobj): Move defintion out of class
2587 defintion. Declare method only.
2588 (Output_section::Input_section::shndx): Ditto.
2589 (Output_section::Input_section::output_merge_base): New method defintion.
2590 (Output_section::Input_section::u2_.pomb): New union field.
2591 (Output_section::Merge_section_by_properties_map,
2592 Output_section::Output_section_data_by_input_section_map,
2593 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2594 Remove types.
2595 (Output_section::add_merge_input_section): Add new parameter
2596 KEEPS_INPUT_SECTIONS.
2597 (Output_section::build_lookup_maps): New method declaration.
2598 (Output_section::merge_section_map_,
2599 Output_section::merge_section_by_properties_map_,
2600 Output_section::relaxed_input_section_map_,
2601 Output_section::is_relaxed_input_section_map_valid_): Remove data
2602 members.
2603 (Output_section::lookup_maps_): New data member.
2604
2605 2010-05-21 Doug Kwan <dougkwan@google.com>
2606
2607 PR gold/11619
2608 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2609 avoid a compilation error.
2610
2611 2010-05-19 Rafael Espindola <espindola@google.com>
2612
2613 * script-sections.cc (Output_section_definition::allocate_to_segment):
2614 Update the phdrs_list even when the output section is NULL.
2615 * testsuite/Makefile.am: Add test.
2616 * testsuite/Makefile.in: Regenerate.
2617 * testsuite/script_test_9.cc: New.
2618 * testsuite/script_test_9.sh: New.
2619 * testsuite/script_test_9.t: New.
2620
2621 2010-05-19 Doug Kwan <dougkwan@google.com>
2622
2623 * arm.cc (Arm_input_section::original_size): New method.
2624 (Arm_input_section::do_addralign): Add a cast.
2625 (Arm_input_section::do_output_offset): Remove static cast.
2626 (Arm_input_section::original_addralign,
2627 Arm_input_section::original_size_): Change type to uint32_t.
2628 (Arm_input_section::init): Add safe casts for section alignment
2629 and size.
2630 (Arm_input_section::set_final_data_size): Do not set address and
2631 offset of stub table.
2632 (Arm_output_section::fix_exidx_coverage): Change use of of
2633 Output_section::Simple_input_section to that of
2634 Output_section::Input_section.
2635 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2636 except for the first pass.
2637 * output.cc (Output_section::get_input_sections): Change type of
2638 input_sections to std::list<Input_section>.
2639 (Output_section::add_script_input_section): Rename from
2640 Output_section::add_simple_input_section. Change type of SIS
2641 parameter from Simple_input_section to Input_section.
2642 * output.h (Output_section::Simple_input_section): Remove class.
2643 (Output_section::Input_section): Change class visibility to public.
2644 (Output_section::Input_section::addralign): Use stored alignments
2645 for special input sections if set.
2646 (Output_section::Input_section::set_addralign): New method.
2647 (Output_section::get_input_sections): Change parameter type from
2648 list of Simple_input_section to list of Input_section.
2649 (Output_section::add_script_input_section): Rename from
2650 Output_section::add_simple_input_section. Change first parameter's
2651 type from Simple_input_section to Input_section and remove the
2652 second and third parameters.
2653 * script-sections.cc (Input_section::Input_section_list): Change
2654 type to list of Output_section::Input_section/
2655 (Input_section_info::Input_section_info): Change parameter type of
2656 INPUT_SECTION to Output_section::Input_section.
2657 (Input_section_info::input_section): Change return type.
2658 (Input_section_info::input_section_): Change type to
2659 Output_section::Input_section.
2660 (Output_section_element_input::set_section_addresses): Adjust code
2661 to use Output_section::Input_section instead of
2662 Output_section::Simple_input_section. Adjust code for renaming
2663 of Output_section::add_simple_input_section.
2664 (Orphan_output_section::set_section_addresses): Ditto.
2665
2666 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2667
2668 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2669 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2670
2671 2010-05-18 Rafael Espindola <espindola@google.com>
2672
2673 * options.cc (General_options::finalize): Handle -nostdlib.
2674 * options.h (nostdlib): New option.
2675 * script.cc (script_add_search_dir): Handle -nostdlib.
2676
2677 2010-05-12 Doug Kwan <dougkwan@google.com>
2678
2679 * arm.cc (Target_arm::do_finalize_sections): Create an empty
2680 attributes section only if there no attributes section after merging.
2681 (Target_arm::merge_object_attributes): Move value of
2682 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2683 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2684 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2685 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2686 and arm_attr_merge_7.stdout.
2687 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2688 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2689 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2690 arm_attr_merge_7b.o): New rules.
2691 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2692 arm_attr_merge_7
2693 * testsuite/Makefile.in: Regenerate.
2694 * testsuite/arm_attr_merge.sh: New file.
2695 * testsuite/arm_attr_merge_[67][ab].s: Same.
2696
2697 2010-05-05 Nick Clifton <nickc@redhat.com>
2698
2699 * po/es.po: Updated Spanish translation.
2700
2701 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2702
2703 * Makefile.am (install-exec-local): Properly install gold as
2704 default cross linker.
2705 * Makefile.in: Regenerated.
2706
2707 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
2708 Nick Clifton <nickc@redhat.com>
2709
2710 * configure.ac (install_as_default): Define and set to false
2711 unless --enable-gold or --enable-gold=both/gold has been
2712 specified.
2713 * configure: Regenerate.
2714
2715 * Makefile.am (install-exec-local): Install the executable as
2716 'ld.gold'. If install_as_default is true then also install it as
2717 'ld'.
2718 * Makefile.in: Regenerated.
2719
2720 2010-04-24 Ian Lance Taylor <iant@google.com>
2721
2722 * layout.cc (Layout::layout_reloc): In relocatable link don't
2723 combine reloc sections for grouped sections.
2724
2725 2010-04-23 Sriraman Tallam <tmsriram@google.com>
2726
2727 * gc.h (gc_process_relocs): Pass information on relocs pointing to
2728 sections that are not ordinary to icf.
2729 * icf.cc (get_section_contents): Handle relocation pointing to section
2730 with no object or shndx information.
2731 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2732 * testsuite/Makefile.in: Regenerate.
2733 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2734 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2735
2736 2010-04-22 Ian Lance Taylor <iant@google.com>
2737
2738 * expression.cc (Expression::Expression_eval_info): Add
2739 result_alignment_pointer field.
2740 (Expression::eval_with_dot): Add result_alignment_pointer
2741 parameter. Change all callers.
2742 (Expression::eval_maybe_dot): Likewise.
2743 (class Binary_expression): Add alignment_pointer parameter to
2744 left_value and right_value. Change all callers.
2745 (BINARY_EXPRESSION): Set result alignment.
2746 (class Trinary_expression): Add alignment_pointer parameter to
2747 arg2_value and arg3_value. Change all callers.
2748 (Trinary_cond::value): Set result alignment.
2749 (Max_expression::value, Min_expression::value): Likewise.
2750 (Align_expression::value): Likewise.
2751 * script-sections.cc (class Sections_element): Add dot_alignment
2752 parameter to set_section_addresses virtual function. Update
2753 instantiations.
2754 (class Output_section_element): Likewise.
2755 (Script_sections::create_segments): Add dot_alignment parameter.
2756 Change all callers.
2757 (Script_sections::create_segments_from_phdrs_clause): Likewise.
2758 (Script_sections::set_phdrs_clause_addresses): Likewise.
2759 * script-sections.h: Update declarations.
2760 * script.h: Update declarations.
2761 * output.h (Output_segment::set_minimum_p_align): Don't decrease
2762 min_p_align.
2763 * testsuite/script_test_3.t: Set large alignment.
2764 * testsuite/script_test_3.sh: Make sure that at least one LOAD
2765 segment has expected alignment.
2766
2767 2010-04-22 Nick Clifton <nickc@redhat.com>
2768
2769 * po/gold.pot: Updated by the Translation project.
2770 * po/vi.po: Updated Vietnamese translation.
2771
2772 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
2773
2774 * testsuite/Makefile.am (check_PROGRAMS): Add
2775 icf_virtual_function_folding_test.
2776 * testsuite/Makefile.in: Regenerated.
2777
2778 2010-04-15 Andrew Haley <aph@redhat.com>
2779
2780 * options.h (merge_exidx_entries): New option.
2781 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2782 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2783 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2784 (Target_arm::merge_exidx_entries): New function.
2785 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2786 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2787 to Arm_exidx_fixup constructor.
2788 Add new arg, merge_exidx_entries.
2789 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2790 Arm_output_section::fix_exidx_coverage.
2791
2792 2010-04-18 Sriraman Tallam <tmsriram@google.com>
2793
2794 * icf.cc (get_section_contents): Check for preemptible functions.
2795 Ignore addend when appropriate.
2796 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
2797 section folded.
2798 (add_from_relobj): Check for section folded.
2799 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2800 * symtab.h (should_add_dynsym_entry): Add new parameter.
2801 * target-reloc.h (scan_relocs): Check for section folded.
2802 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2803 Check reloc types for function pointers in shared objects.
2804 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2805 case.
2806 (icf_preemptible_functions_test): New test case.
2807 (icf_string_merge_test): New test case.
2808 * testsuite.Makefile.in: Regenerate.
2809 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2810 bar_glob. Refactor code.
2811 * testsuite/icf_preemptible_functions_test.cc: New file.
2812 * testsuite/icf_preemptible_functions_test.sh: New file.
2813 * testsuite/icf_string_merge_test.cc: New file.
2814 * testsuite/icf_string_merge_test.sh: New file.
2815 * testsuite/icf_virtual_function_folding_test.cc: New file.
2816 * testsuite/icf_virtual_function_folding_test.sh: New file.
2817
2818 2010-04-14 Doug Kwan <dougkwan@google.com>
2819
2820 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2821 for local symbol recounting if we remove a section due to ICF.
2822 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2823 there are no regular objects in input.
2824
2825 2010-04-13 Doug Kwan <dougkwan@google.com>
2826
2827 * arm.cc (Arm_input_section::set_final_data_size): Compute
2828 accurate final data size instead of using current data size.
2829
2830 2010-04-09 Doug Kwan <dougkwan@google.com>
2831
2832 * layout.cc (Layout::choose_output_section): Handle script section
2833 types.
2834 (Layout::make_output_section_for_script): Add section type parameter.
2835 Handle script section types.
2836 * layout.h (Layout::make_output_section_for_script): Add section
2837 type parameter.
2838 * output.cc (Output_section::Output_section): Initialize data member
2839 is_noload_.
2840 (Output_section::do_reset_address_and_file_offset): Do not set address
2841 to 0 if section is a NOLOAD section.
2842 * output.h (Output_section::is_noload): New method.
2843 (Output_section::set_is_noload): Ditto.
2844 (Output_section::is_noload_): New data member.
2845 * script-c.h (Script_section_type): New enum type.
2846 (struct Parser_output_section_header): Add new file section_type.
2847 * script-sections.cc (Sections_element::output_section_name): Add
2848 parameter for returning script section type.
2849 (Output_section_definition::output_section_name): Ditto.
2850 (Output_section_definition::section_type)P; New method.
2851 (Output_section_definiton::script_section_type_name): Ditto.
2852 (Output_section_definition::script_section_type_): New data member.
2853 (Output_section_definition::Output_section_definition): Initialize
2854 data member Output_section_definition::script_section_type_.
2855 (Output_section_definition::create_sections): Pass script section type
2856 to Layout::make_output_section_for_script.
2857 (Output_section_definition::output_section_name): Return script
2858 section type to caller.
2859 (Output_section_definition::set_section_address): Do not advance
2860 dot value and load address if section type is NOLOAD. Set address
2861 of NOLOAD sections regardless of section flags.
2862 (Output_section_definition::print): Print section type if it is
2863 not SCRIPT_SECTION_TYPE_NONE.
2864 (Output_section_definition::section_type): New method.
2865 (Output_section_definition::script_section_type_name): Ditto.
2866 (Script_sections::output_section_name): Add new parameter
2867 PSECTION_TYPE for returning script section type. Pass it to
2868 section elements. Handle discard sections.
2869 (Sort_output_sections::operator()): Handle NOLOAD sections.
2870 * script-sections.h (Script_sections::Section_type): New enum type.
2871 (Script_sections::output_section_name): Add a new parameter for
2872 returning script section type.
2873 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2874 INFO and NOLOAD.
2875 * yyscript.y (union): Add new field SECTION_TYPE.
2876 (COPY, DSECT, INFO, NOLOAD): New tokens.
2877 (opt_address_and_section_type): Change type to output_section_header.
2878 (section_type): New non-terminal
2879 (section_header): Handle section type.
2880 (opt_address_and_section_type): Return section type value.
2881
2882 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
2883
2884 * testsuite/plugin_common_test_1.c (foo): Add prototype.
2885 * testsuite/plugin_common_test_2.c (foo): Likewise.
2886
2887 2010-04-08 Doug Kwan <dougkwan@google.com>
2888
2889 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2890 Output_merge_data.
2891 * output.cc (Output_section::add_merge_input_section): Simplify
2892 code and return status of Output_merge_base::add_input_section.
2893 Update merge section map only if Output_merge_base::add_input_section
2894 returns true.
2895
2896 2010-04-07 Doug Kwan <dougkwan@google.com>
2897
2898 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2899 if section is marked as containing instructions but has no mapping
2900 symbols.
2901 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2902 correct section index.
2903 (Arm_relobj::find_linked_text_section): Ditto.
2904
2905 2010-04-07 Cary Coutant <ccoutant@google.com>
2906
2907 * archive.cc (include_member): Destroy Read_symbols_data object before
2908 releasing file.
2909 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2910 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2911 (Read_symbols_data::~Read_symbols_data) New destructor.
2912 (Section_relocs::Section_relocs) New constructor.
2913 (Section_relocs::~Section_relocs) New destructor.
2914 (Read_relocs_data::Read_relocs_data) New constructor.
2915 (Read_relocs_data::~Read_relocs_data) New destructor.
2916 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2917 pointers to NULL after deleting.
2918
2919 2010-04-07 Doug Kwan <dougkwan@google.com>
2920
2921 * arm.cc: Replace "endianity" with "endianness" in comments.
2922 (Arm_exidx_cantunwind): Ditto.
2923 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2924 (Arm_relobj::merge_flags_and_attributes): New method.
2925 (Arm_relobj::merge_flags_and_attributes_): New data member.
2926 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2927 (Arm_relobj::scan_sections_for_stubs): Ditto.
2928 (Arm_relobj::do_read_symbols): Check to see if we really want to
2929 merge processor-specific flags and attributes. Exit early if
2930 an object is empty except for section names and the undefined symbol.
2931 (Target_arm::do_finalize_sections): Move check for ELF format to
2932 Arm_relobj::do_read_symbols. Merge processor specific flags and
2933 attributes from a regular object only when we have determined that
2934 it is aapropriate. Do not create an .ARM.attributes section in
2935 output if there is no regular input object.
2936 (Target_arm::merge_processor_specific_flags): Check
2937 --warn-mismatch before printing any error.
2938 (Target_arm::merge_object_attributes): Ditto.
2939 * gold.cc (queue_middle_tasks): Handle the case in which there is
2940 no regular object in input.
2941 * options.cc (General_options::parse_EB): New method.
2942 (General_options::parse_EL): Same.
2943 (General_options::General_options): Initialize endianness_.
2944 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2945 New options.
2946 (General_options::Endianness): New enum.
2947 (General_options::endianness): New method.
2948 (General_options::endianness_): New data member.
2949 * parameters.cc (Parameters::set_options): Check target endianness.
2950 (Parameters::set_target_once): Ditto.
2951 (Parameters::check_target_endianness): New method.
2952 (parameters_force_valid_target): If either -EL or -EB is specified,
2953 use it to define endianness of default target.
2954 * parameters.h (Parameters::check_target_endianness): New method
2955 declaration.
2956 * target.h (class Target): Change "endianity" to "endianness"
2957 in comments.
2958
2959 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2960
2961 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2962 * configure: Regenerate.
2963 * Makefile.in: Regenerate.
2964 * testsuite/Makefile.in: Regenerate.
2965
2966 2010-04-06 Cary Coutant <ccoutant@google.com>
2967
2968 gcc PR lto/42757
2969 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2970 prevailing definitions of common symbols.
2971 * testsuite/plugin_test_6.sh: New test case.
2972 * testsuite/plugin_common_test_1.c: New test case.
2973 * testsuite/plugin_common_test_2.c: New test case.
2974 * testsuite/Makefile.am (plugin_test_6): New test case.
2975 * testsuite/Makefile.in: Regenerate.
2976
2977 2010-04-06 Nick Clifton <nickc@redhat.com>
2978
2979 * po/vi.po: New Vietnamese translation.
2980
2981 2010-03-30 Doug Kwan <dougkwan@google.com>
2982
2983 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2984
2985 2010-03-25 Doug Kwan <dougkwan@google.com>
2986
2987 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2988 to avoid a conversion warning on a 32-bit host.
2989
2990 2010-03-24 Ian Lance Taylor <iant@google.com>
2991
2992 * testsuite/script_test_3.t: Add a TLS segment.
2993 * testsuite/Makefile.am (check_PROGRAMS): Add
2994 tls_phdrs_script_test.
2995 (tls_phdrs_script_test_SOURCES): Define.
2996 (tls_phdrs_script_test_DEPENDENCIES): Define.
2997 (tls_phdrs_script_test_LDFLAGS): Define.
2998 (tls_phdrs_script_test_LDADD): Define.
2999 * testsuite/Makefile.in: Rebuild.
3000
3001 2010-03-23 Cary Coutant <ccoutant@google.com>
3002
3003 * fileread.cc (find_or_make_view): Fix comment.
3004
3005 2010-03-23 Ian Lance Taylor <iant@google.com>
3006
3007 * script-sections.cc (class Orphan_section_placement): Define
3008 PLACE_TLS and PLACE_TLS_BSS.
3009 (Orphan_section_placement::Orphan_section_placement): Initialize
3010 new places.
3011 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3012 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3013 (tls_script_test_SOURCES): Define.
3014 (tls_script_test_DEPENDENCIES): Define.
3015 (tls_script_test_LDFLAGS): Define.
3016 (tls_script_test_LDADD): Define.
3017 * testsuite/Makefile.in: Rebuild.
3018
3019 2010-03-22 Doug Kwan <dougkwan@google.com>
3020
3021 * arm.cc (Arm_relocate_functions::abs8,
3022 Arm_relocate_functions::abs16): Use correct check for overflow
3023 specified in the ARM ELF specs.
3024 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3025 target of a BLX instruction specially.
3026 (Reloc_stub::stub_type_for_reloc): Ditto.
3027 (Relocate::relocate): Use symbolic names instead of numeric relocation
3028 codes to report error.
3029 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3030 workaround.
3031 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3032 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3033 thumb2_blx_out_of_range.stdout
3034 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3035 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3036 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3037 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3038 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3039 thumb2_blx_in_range, thumb2_blx_in_range.o,
3040 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3041 thumb2_blx_out_of_range.o): New rules.
3042 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3043 thumb2_blx_in_range and thumb2_blx_out_of_range.
3044 * testsuite/Makefile.in: Regenerate.
3045 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3046 * testsuite/thumb_blx_in_range.s: New file.
3047 * testsuite/thumb_blx_out_of_range.s: New file.
3048
3049 2010-03-22 Rafael Espindola <espindola@google.com>
3050
3051 * archive.cc (Should_include): Move to archive.h.
3052 (should_include_member): Make it a member of Archive.
3053 (Lib_group): New.
3054 (Add_lib_group_symbols): New.
3055 * archive.h: Include options.h.
3056 (Archive_member): Moved from Archive.
3057 (Should_include): Moved from archive.cc.
3058 (Lib_group): New.
3059 (Add_lib_group_symbols): New.
3060 * dynobj.cc (do_should_include_member): New.
3061 * dynobj.h (do_should_include_member): New.
3062 * gold.cc (queue_initial_tasks): Update call to queue.
3063 * main.cc (main): Print lib group stats.
3064 * object.cc (do_should_include_member): New.
3065 * object.h: Include archive.h.
3066 (Object::should_include_member): New.
3067 (Object::do_should_include_member): New.
3068 (Sized_relobj::do_should_include_member): New.
3069 * options.cc (General_options::parse_start_lib): New.
3070 (General_options::parse_end_lib): New.
3071 (Input_arguments::add_file): Handle lib groups.
3072 (Input_arguments::start_group): Check we are not in a lib.
3073 (Input_arguments::start_lib): New.
3074 (Input_arguments::end_lib): New.
3075 * options.h (General_options): Add start_lib and end_lib.
3076 (Input_argument::lib_): New.
3077 (Input_argument::lib): New.
3078 (Input_argument::is_lib): New.
3079 (Input_file_lib): New.
3080 (Input_arguments::in_lib_): New.
3081 (Input_arguments::in_lib): New.
3082 (Input_arguments::start_lib): New.
3083 (Input_arguments::end_lib_): New.
3084 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3085 in unused members as preempted.
3086 (Sized_pluginobj::do_should_include_member): New.
3087 * plugin.h (Sized_pluginobj::do_should_include_member): New.
3088 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3089 return the blocker.
3090 (Read_symbols::do_whole_lib_group): New.
3091 (Read_symbols::do_lib_group): New.
3092 (Read_symbols::do_read_symbols): Handle lib groups.
3093 (Read_symbols::get_name): Handle lib groups.
3094 * readsyms.h (Read_symbols): Add an archive member pointer.
3095 (Read_symbols::do_whole_lib_group): New.
3096 (Read_symbols::do_lib_group): New.
3097 (Read_symbols::member_): New.
3098 * script.cc (read_input_script): Update call to queue_soon.
3099
3100 2010-03-19 Doug Kwan <dougkwan@google.com>
3101
3102 * arm.cc (Stub_table::Stub_table): Initialize new data members
3103 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3104 (Stub_table::add_reloc_stub): Assign stub offset and update
3105 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3106 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3107 New data members.
3108 (Stub_table::update_data_size_and_addralign): Use
3109 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3110 instead of going over all reloc stubs.
3111 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3112 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3113 Stringpool_template::offset_ to size of Stringpool_char.
3114 (Stringpool_template::new_key_offset): Remove code to initialize
3115 Stringpool_template::offset_.
3116 * stringpool.h (Stringpool_template::set_no_zero_null): Set
3117 Stringpool_template::offset_ to zero.
3118
3119 2010-03-15 Doug Kwan <dougkwan@google.com>
3120
3121 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3122 offset_.
3123 (Stringpool_template::new_key_offset): New method.
3124 (Stringpool_template::add_string): Assign offsets when adding new
3125 strings.
3126 (Stringpool_template::set_string_offsets): Do not set string offsets
3127 when not optimizing.
3128 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3129 member size_.
3130 (Chunked_vector::clear): Clear size_.
3131 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3132 (Chunked_vector::size): Return size_.
3133 (Chunked_vector::push_back): Use size_ to find insert position.
3134 (Chunked_vector::size_): New data member.
3135 (Stringpool_template::set_no_zero_null): Assert string set is empty.
3136 (Stringpool_template::new_key_offset): New method declaration.
3137 (Stringpool_template::offset_): New data member.
3138
3139 2010-03-15 Rafael Espindola <espindola@google.com>
3140
3141 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3142 Add_symbols' constructor.
3143 * readsyms.h (Add_symbols): Remove the input_group member.
3144
3145 2010-03-10 Ian Lance Taylor <iant@google.com>
3146
3147 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3148 target to ask whether a reference to a symbol requires a stack
3149 split.
3150 * target.h (Target::is_call_to_non_split): New function.
3151 (Target::do_is_call_to_non_split): Declare virtual function.
3152 * target.cc: Include "symtab.h".
3153 (Target::do_is_call_to_non_split): New function.
3154 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3155
3156 2010-03-10 Cary Coutant <ccoutant@google.com>
3157
3158 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3159 (File_read::open[1]): Remove initial mapping of whole_file_view_.
3160 (File_read::open[2]): Add whole_file_view_ to list of views.
3161 (File_read::make_view): Remove test of whole_file_view_.
3162 (File_read::find_or_make_view): Create whole_file_view_ if
3163 necessary.
3164 (File_read::clear_views): Replace bool parameter with enum;
3165 adjust all callers. Don't delete views with permanent data;
3166 do delete cached views and views from archives if
3167 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
3168 if clearing the corresponding view.
3169 * fileread.h (File_read::Clear_views_mode): New enum.
3170 (File_read::View::is_permanent_view): New method.
3171 (File_read::clear_views): Replace bool parameter
3172 with enum; adjust all callers.
3173 * options.h (General_options): Change keep_files_mapped option;
3174 add map_whole_files.
3175 * readsyms.cc (Add_symbols::run): Delete sd_ object before
3176 releasing the file.
3177 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3178 the file.
3179
3180 2010-03-10 David S. Miller <davem@davemloft.net>
3181
3182 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3183
3184 2010-03-09 Sriraman Tallam <tmsriram@google.com>
3185
3186 * icf.cc (get_section_contents): Add '@' marker after processing the
3187 merge reloc.
3188
3189 2010-03-08 Doug Kwan <dougkwan@google.com>
3190
3191 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3192 due to a conversion warning.
3193 (Arm_relobj::update_output_local_symbol_count): Check for local
3194 symbol with unset output index.
3195
3196 2010-03-05 Ian Lance Taylor <iant@google.com>
3197
3198 * options.h (class General_options): Add --spare-dynamic-tags.
3199 * output.cc (Output_data_dynamic::set_final_data_size): Implement
3200 --spare-dynamic-tags.
3201
3202 2010-03-05 Ian Lance Taylor <iant@google.com>
3203
3204 * incremental.cc: Include "libiberty.h".
3205
3206 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
3207
3208 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3209 function, is_info_ member.
3210 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3211 (Versions::Versions): Update caller.
3212 (Versions::define_base_version): Likewise.
3213 (Versions::add_def): Likewise.
3214
3215 2010-03-03 Sriraman Tallam <tmsriram@google.com>
3216
3217 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3218 (Scan::possible_function_pointer_reloc): New function.
3219 (Scan::local_reloc_may_be_function_pointer): Change to call
3220 possible_function_pointer_reloc.
3221 (Scan::global_reloc_may_be_function_pointer): Ditto.
3222 * icf.h (Icf::check_section_for_function_pointers): Change to reject
3223 relocations in ".data.rel.ro._ZTV" section.
3224 * testsuite/icf_safe_so_test.sh: Change to pass i386.
3225 * testsuite/icf_safe_so_test.cc: Ditto.
3226 * testsuite/icf_safe_test.cc: Ditto.
3227 * testsuite/icf_safe_test.sh: Ditto.
3228
3229 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3230 Ian Lance Taylor <iant@google.com>
3231
3232 * target-reloc.h (relocate_section): Check the symbol table index
3233 for -1U before setting the local symbol index.
3234 (scan_relocatable_relocs): If copying the relocation, record that
3235 the local symbol is required.
3236 * object.h (Symbol_value::is_output_symtab_index_set): New
3237 function.
3238 (Symbol_value::may_be_discarded_from_output_symtab): New
3239 function.
3240 (Symbol_value::has_output_symtab_entry): New function.
3241 (Symbol_value::needs_output_symtab_entry): Remove.
3242 (Symbol_value::output_symtab_index): Make sure the symbol index is
3243 set.
3244 (Symbol_value::set_output_symtab_index): Make sure the symbol
3245 index is not set. Make sure the new index is valid.
3246 (Symbol_value::set_must_have_output_symtab_entry): New function.
3247 (Symbol_value::has_output_dynsym_entry): New function.
3248 (Symbol_value::set_output_dynsym_index): Make sure the new index
3249 is valid.
3250 (Sized_relobj::set_must_have_output_symtab_entry): New function.
3251 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3252 local symbol if permitted.
3253 (Sized_relobj::do_finalize_local_symbols): Call
3254 is_output_symtab_index_set rather than needs_output_symtab_entry.
3255 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3256 rather than needs_output_symtab_entry. Call
3257 has_output_dynsym_entry rather than needs_output_dynsym_entry.
3258 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3259 is_output_symtab_index_set rather than needs_output_symtab_entry.
3260 * testsuite/discard_locals_relocatable_test.c: New file.
3261 * testsuite/discard_locals_test.sh: Test -r.
3262 * testsuite/Makefile.am (check_DATA): Add
3263 discard_locals_relocatable_test1.syms,
3264 discard_local_relocatable_test2.syms.
3265 (MOSTLYCLEANFILES): Likewise. Also add
3266 discard_locals_relocatable_test1.lout and
3267 discard_locals_relocatable_test2.out.
3268 (discard_locals_relocatable_test1.syms): New target.
3269 (discard_locals_relocatable_test.o): New target.
3270 (discard_locals_relocatable_test1.out): New target.
3271 (discard_locals_relocatable_test2.syms): New target.
3272 (discard_locals_relocatable_test2.out): New target.
3273 (various): Add missing ../ld-new dependencies.
3274 * testsuite/Makefile.in: Rebuild.
3275
3276 2010-03-03 Nick Clifton <nickc@redhat.com>
3277
3278 * po/fi.po: New Finnish translation.
3279
3280 2010-03-01 Doug Kwan <dougkwan@google.com>
3281
3282 * layout.cc (Layout::Layout): Force section types of .init_array*,
3283 .preinit_array* and .fini_array* sections.
3284 * output.cc (Output_section::Input_section_sort_entry::has_priority):
3285 Fix check of return value of std::string::find.().
3286 (Output_section::Input_section_sort_compare::operator()): Remove
3287 comment about .init_array.
3288 (Output_section::Input_section_sort_init_fini_compare::operator()):
3289 New method.
3290 (Output_section::sort_attached_input_sections): Handle .init_array
3291 and .fini_array specially.
3292 * output.h (Output_section::Inut_section_sort_compare): Update
3293 comment.
3294 (Output_section::Input_section_sort_init_fini_compare): New struct.
3295
3296 2010-02-26 Doug Kwan <dougkwan@google.com>
3297
3298 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3299 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3300 * testsuite/debug_msg.sh: Avoid matching source line number for
3301 use of global variable undef_int.
3302
3303 2010-02-26 Doug Kwan <dougkwan@google.com>
3304
3305 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3306 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3307 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3308 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3309 * options.cc (General_options::General_options): Initialize member
3310 fix_v4bx_.
3311 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3312 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3313 and rm_no_fix_v4bx.stdout
3314 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3315 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3316 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3317 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3318 and arm_no_fix_v4bx.
3319 * Makefile.in: Regenerate.
3320 * testsuite/arm_fix_v4bx.s: New file.
3321 * testsuite/arm_fix_v4bx.sh: Ditto.
3322
3323 2010-02-24 Doug Kwan <dougkwan@google.com>
3324
3325 * arm.cc (Target_arm::got_section): Make the .got section the first
3326 non RELRO section in the data segment.
3327 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3328 suffixes of section names.
3329
3330 2010-02-24 Doug Kwan <dougkwan@google.com>
3331
3332 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3333 flags and attributes merging if an input file is a binary file.
3334 * fileread.cc (Input_file::open): Record format of original file.
3335 * fileread.h (Input_file::Format): New enum type.
3336 (Input_file::Input_file): Initialize data member format_.
3337 (Input_file::format): New method definition.
3338 (Input_file::format_):: New data member.
3339
3340 2010-02-24 Doug Kwan <dougkwan@google.com>
3341
3342 * arm.cc (Arm_output_data_got): New class.
3343 (ARM_TCB_SIZE): New constant
3344 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3345 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3346 If user uses a script with a SECTIONS clause, issue only a warning
3347 for a misplaced EXIDX input section. Otherwise, issue an error.
3348 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3349 garbage collection.
3350 (Target_arm::got_mode_index_entry): Handle static linking.
3351 (Target_arm::Scan::local): Ditto.
3352 (Target_arm::Scan::global): Ditto.
3353 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
3354 all incorrectly implemented relocations.
3355 (Target_arm::fix_exidx_coverage): Pass layout to
3356 Arm_output_section::fix_exidx_coverage.
3357 * layout.cc (Layout::section_name_mapping): Remove trailing dots
3358 from ".ARM.exidx." and ".ARM.extab.".
3359
3360 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3361
3362 * arm.cc (Target_arm::do_finalize_sections): Create attribute
3363 section if it does not already exist.
3364 * attributes.cc (Attributes_section_data::Attributes_section_data):
3365 Don't crash if size is zero.
3366
3367 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3368 Ian Lance Taylor <iant@google.com>
3369
3370 * gold.cc (queue_middle_tasks): If no input files were opened,
3371 exit.
3372 * workqueue.h (Task_function::Task_function): Assert that there is
3373 a blocker.
3374
3375 2010-02-22 Doug Kwan <dougkwan@google.com>
3376
3377 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3378 * icf.cc (get_section_contents): Cast snprintf arguments to long long
3379 types to avoid warnings due to different uint64_t implementations
3380 on different hosts.
3381
3382 2010-02-21 Doug Kwan <dougkwan@google.com>
3383
3384 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3385 handling of the maximum backward branch offset.
3386 (Arm_relocate_functions::thumb_branch_common): Ditto.
3387 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3388 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3389 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3390 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3391 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3392 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3393 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3394 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3395 thumb_bl_out_of_range thumb_bl_out_of_range.o,
3396 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3397 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3398 thumb2_bl_out_of_range.o): New rules.
3399 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3400 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3401 thumb2_bl_out_of_range
3402 * testsuite/Makefile.in: Regenerate.
3403 * testsuite/arm_bl_in_range.s: New file.
3404 * testsuite/arm_bl_out_of_range.s: Ditto.
3405 * testsuite/arm_branch_in_range.sh: Ditto.
3406 * testsuite/arm_branch_range.t: Ditto.
3407 * testsuite/thumb2_branch_range.t: Ditto.
3408 * testsuite/thumb_bl_in_range.s: Ditto.
3409 * testsuite/thumb_bl_out_of_range.s: Ditto.
3410 * testsuite/thumb_branch_range.t: Ditto.
3411
3412 2010-02-20 Sriraman Tallam <tmsriram@google.com>
3413
3414 * gc.h (gc_process_relocs): Change vectors to point to the new list.
3415 Add reloc offset information.
3416 * icf.cc (get_section_contents): Change iterators to point to the new
3417 vectors. Add reloc offset information to the contents.
3418 * icf.h (Icf::Sections_reachable_info): New typedef.
3419 (Icf::Sections_reachable_list): New typedef.
3420 (Icf::Offset_info): New typedef.
3421 (Icf::Reloc_info): New struct typedef.
3422 (Icf::Reloc_info_list): New typedef.
3423 (Icf::symbol_reloc_list): Delete method.
3424 (Icf::addend_reloc_list): Delete method.
3425 (Icf::section_reloc_list): Delete method.
3426 (Icf::reloc_info_list): New method.
3427 (Icf::reloc_info_list_): New member.
3428
3429 2010-02-19 Doug Kwan <dougkwan@google.com>
3430
3431 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3432 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3433 * arm.cc (Arm_relocation_functions): New forward declaration.
3434 (Target_arm::Target_arm): Initialize new data members
3435 got_mod_index_offset_ and tls_base_symbol_defined_.
3436 (Target_arm::Relocate::relocate_tls): New method.
3437 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3438 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3439 New methods.
3440 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3441 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3442 (Target_arm::got_mod_index_offset_,
3443 Target_arm::tls_base_symbol_defined_): New data members.
3444 (Target_arm::Scan::local, Target::Scan::global,
3445 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3446 relocations.
3447
3448 2010-02-18 Doug Kwan <dougkwan@google.com>
3449
3450 * arm.cc (Arm_relobj::find_linked_text_section): New method.
3451 (Arm_relobj::make_exidx_input_section): Pass section index of linked
3452 text section as a parameter becuase some broken tools may not set
3453 the link in section header.
3454 (Target_arm::has_got_section): New method.
3455 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3456 without any mapping symbol as data only. Remove warning.
3457 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3458 link in its section header, try to discover the link by inspecting the
3459 REL31 relocation at the beginning of the section.
3460 (Target_arm::Scan::check_non_pic): Report name of offending relocation
3461 in error message.
3462 (Target_arm::Scan::global): Treat any reference to the symbol
3463 _GLOBAL_OFFSET_TABLE_ as a GOT access.
3464
3465 2010-02-12 Sriraman Tallam <tmsriram@google.com>
3466
3467 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3468 (Scan::global_reloc_may_be_function_pointer): New function.
3469 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3470 (Scan::global_reloc_may_be_function_pointer): New function.
3471 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3472 (Scan::global_reloc_may_be_function_pointer): New function.
3473 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3474 (Scan::global_reloc_may_be_function_pointer): New function.
3475 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3476 (Scan::global_reloc_may_be_function_pointer): New function.
3477 (Scan::possible_function_pointer_reloc): New function.
3478 (Target_x86_64::can_check_for_function_pointers): New function.
3479 * gc.h (gc_process_relocs): Scan relocation types to determine if
3480 function pointers were taken for targets that support it.
3481 * icf.cc (Icf::find_identical_sections): Include functions for
3482 folding in safe ICF whose pointer is not taken.
3483 * icf.h (Secn_fptr_taken_set): New typedef.
3484 (fptr_section_id_): New member.
3485 (section_has_function_pointers): New function.
3486 (set_section_has_function_pointers): New function.
3487 (check_section_for_function_pointers): New function.
3488 * options.h: Fix comment for safe ICF option.
3489 * target.h (can_check_for_function_pointers): New function.
3490 * testsuite/Makefile.am: Add icf_safe_so_test test case.
3491 Modify icf_safe_test for X86-64.
3492 * testsuite/Makefile.in: Regenerate.
3493 * testsuite/icf_safe_so_test.cc: New file.
3494 * testsuite/icf_safe_so_test.sh: New file.
3495 * testsuite/icf_safe_test.cc (kept_func_3): New function.
3496 (main): Change to take pointer to function kept_func_3.
3497 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3498 folding is done correctly for X86-64.
3499
3500 2010-02-12 David S. Miller <davem@davemloft.net>
3501
3502 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3503 is_symbolless parameter.
3504 (Output_reloc<SHT_REL>::is_symbolless): New.
3505 (Output_reloc<SHT_REL>::is_symbolless_): New.
3506 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3507 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3508 (Output_reloc<SHT_RELA>::is_symbolless): New.
3509 (Output_data_reloc::add_global): Handle is_symbolless.
3510 (Output_data_reloc::add_global_relative): Likewise.
3511 (Output_data_reloc::add_local): Likewise.
3512 (Output_data_reloc::add_local_relative): Likewise.
3513 (Output_data_reloc::add_symbolless_global_addend): New.
3514 (Output_data_reloc::add_symbolless_local_addend): New.
3515 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3516 is_symbolless.
3517 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3518 instead of ->is_relative_
3519 (Output_reloc::write): Likewise.
3520 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3521 (Output_reloc::write_rel): Simplify.
3522
3523 * sparc.cc (Target_sparc::Scan::local): Use
3524 ->add_symbolless_local_addend as needed.
3525 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3526 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
3527 based upon relocation offset.
3528
3529 2010-02-11 Doug Kwan <dougkwan@google.com>
3530
3531 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3532 (Target_arm::Scan::global): Ditto. Also remove a comment before the
3533 beginning of function.
3534 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3535 and MOVT_ABS relocations. Those are non issued in scanning. Fix
3536 parameter is_32bit in calls to should_apply_static_reloc.
3537 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3538 (check_DATA): Add arm_abs_global.stdout.
3539 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3540 arm_abs_global.stdout): New rules.
3541 (MOSTLLYCLEANFILES): Add arm_abs_global
3542 * Makefile.in: Regenerate.
3543 * testsuite/arm_abs_global.s: New file.
3544 * testsuite/arm_abs_global.sh: Ditto.
3545 * testsuite/arm_abs_lib.s: Ditto.
3546
3547 2010-02-11 Ian Lance Taylor <iant@google.com>
3548
3549 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3550 Read_relocs task.
3551 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
3552 Allocate_commons_task first.
3553 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3554 task, rather than symtab_lock_.
3555 (Gc_process_relocs::~Gc_process_relocs): New function.
3556 (Gc_process_relocs::is_runnable): Check this_blocker_.
3557 (Gc_process_relocs::locks): Use next_blocker_ rather than
3558 blocker_.
3559 (Scan_relocs::~Scan_relocs): New function.
3560 (Scan_relocs::is_runnable): Check this_blocker_ rather than
3561 symtab_lock_.
3562 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
3563 next_blocker_.
3564 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3565 fields. Add this_blocker_ and next_blocker_ fields. Adjust
3566 constructor accordingly.
3567 (class Gc_process_relocs): Likewise.
3568 (class Scan_relocs): Likewise.
3569 * common.h (class Allocate_commons_task): Remove symtab_lock_
3570 field, and corresponding constructor parameter.
3571 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3572 symtab_lock_.
3573 (Allocate_commons_task::locks): Likewise.
3574
3575 2010-02-11 Ian Lance Taylor <iant@google.com>
3576
3577 * gold-threads.h (class Once): Define.
3578 (class Initialize_lock): Rewrite as child of Once.
3579 * gold-threads.cc (class Once_initialize): Define.
3580 (once_pointer_control): New static variable.
3581 (once_pointer, once_arg): New static variables.
3582 (c_run_once): New static function.
3583 (Once::Once, Once::run_once, Once::internal_run): New functions.
3584 (class Initialize_lock_once): Remove.
3585 (initialize_lock_control): Remove.
3586 (initialize_lock_pointer): Remove.
3587 (initialize_lock_once): Remove.
3588 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3589 (Initialize_lock::initialize): Rewrite.
3590 (Initialize_lock::do_run_once): New function.
3591 * archive.cc (Archive::interpret_header): Only clear name if it is
3592 not already empty.
3593 * fileread.cc: Include "gold-threads.h"
3594 (file_counts_lock): New static variable.
3595 (file_counts_initialize_lock): Likewise.
3596 (File_read::release): Only increment counts when using --stats.
3597 Use a lock around the increment.
3598 * parameters.cc (class Set_parameters_target_once): Define.
3599 (set_parameters_target_once): New static variable.
3600 (Parameters::Parameters): Move here from parameters.h.
3601 (Parameters::set_target): Rewrite.
3602 (Parameters::set_target_once): New function.
3603 (Parameters::clear_target): Move here and rewrite.
3604 * parameters.h (class Parameters): Update declarations. Add
3605 set_parameters_target_once_ field.
3606 (Parameters::Parameters): Move to parameters.cc.
3607 (Parameters::clear_target): Likewise.
3608 * readsyms.cc (Read_symbols::do_group): Create a Start_group
3609 task.
3610 (Start_group::~Start_group): New function.
3611 (Start_group::is_runnable): New function.
3612 (Start_group::locks, Start_group::run): New functions.
3613 (Finish_group::run): Change saw_undefined to size_t.
3614 * readsyms.h (class Start_group): Define.
3615 (class Finish_group): Change saw_undefined_ field to size_t.
3616 (Finish_group::Finish_group): Remove saw_undefined and
3617 this_blocker parameters. Change all callers.
3618 (Finish_group::set_saw_undefined): New function.
3619 (Finish_group::set_blocker): New function.
3620 * symtab.h (class Symbol_table): Change saw_undefined to return
3621 size_t. Change saw_undefined_ field to size_t.
3622 * target-select.cc (Set_target_once::do_run_once): New function.
3623 (Target_selector::Target_selector): Initialize set_target_once_
3624 field. Don't initialize lock_ and initialize_lock_ fields.
3625 (Target_selector::instantiate_target): Rewrite.
3626 (Target_selector::set_target): New function.
3627 * target-select.h (class Set_target_once): Define.
3628 (class Target_selector): Update declarations. Make
3629 Set_target_once a friend. Remove lock_ and initialize_lock_
3630 fields. Add set_target_once_ field.
3631
3632 2010-02-10 Ian Lance Taylor <iant@google.com>
3633
3634 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3635 queueing any tasks.
3636 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
3637 (queue_middle_tasks): Add all blockers before queueing any tasks.
3638 (queue_final_tasks): Likewise.
3639 * token.h (Task_token::add_blockers): New function.
3640 * object.h (Input_objects::number_of_relobjs): New function.
3641
3642 2010-02-10 Ian Lance Taylor <iant@google.com>
3643
3644 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3645 shared, not if not position independent.
3646 * x86_64.cc (Relocate::relocate_tls): Likewise.
3647 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3648 (tls_pie_pic_test): New target.
3649 * testsuite/Makefile.in: Rebuild.
3650
3651 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3652 (tls_test_main_pie.o, tls_test_pie.o): New targets.
3653 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3654 * testsuite/Makefile.in: Rebuild.
3655
3656 2010-02-09 David S. Miller <davem@davemloft.net>
3657
3658 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3659 R_SPARC_RELATIVE using ->add_local_relative().
3660 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3661
3662 * output.h (Output_data_dynamic::add_section_size): New method
3663 that takes two Output_data objects.
3664 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3665 entry param. Handle it in initializers.
3666 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3667 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3668 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3669 arg.
3670 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3671 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3672 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3673 for dynrel_includes_plt.
3674 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3675 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3676 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3677 before .rela.plt
3678 (Target_sparc::do_finalize_sections): Update to pass true for
3679 dynrel_includes_plt.
3680 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3681 output before .rela.plt
3682 (Target_powerpc::do_finalize_sections): Update to pass true for
3683 dynrel_includes_plt when 32-bit.
3684
3685 2010-02-08 Doug Kwan <dougkwan@google.com>
3686
3687 * arm.cc (Arm_relobj::simple_input_section_output_address): New
3688 method.
3689 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3690 Arm_relobj::scan_section_for_cortex_a8_stubs,
3691 Arm_relobj::do_relocation_section): Instead of calling
3692 Output_section::output_address, use faster
3693 Arm_relobj::simple_input_section_output_address.
3694
3695 2010-02-08 David S. Miller <davem@davemloft.net>
3696
3697 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3698 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3699 relocation helper function.
3700
3701 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3702 just like R_SPARC_GOT{10,13,22}.
3703 (Target_sparc::Scan::local): Likewise.
3704 (Target_sparc::Relocate:relocate): Likewise.
3705
3706 2010-02-06 Ian Lance Taylor <iant@google.com>
3707
3708 * configure.ac: Rewrite targetobjs duplicate removal code to use
3709 only shell constructs.
3710 * configure: Rebuild.
3711
3712 2010-02-05 Doug Kwan <dougkwan@google.com>
3713
3714 PR 11247
3715 * arm.cc (Arm_relobj::section_is_scannable): New method.
3716 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3717 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3718
3719 2010-02-04 Doug Kwan <dougkwan@google.com>
3720
3721 PR 11247
3722 * arm-reloc-property.cc (cstdio): Include.
3723 * configure.ac (targetobjs): Remove duplicates.
3724 * configure: Regenerate.
3725 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3726 big and little endian version for a given address size.
3727
3728 2010-02-03 Doug Kwan <dougkwan@google.com>
3729
3730 * arm-reloc-property.cc
3731 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3732 definition.
3733 * arm-reloc-property.h
3734 (Arm_reloc_property_table::get_implemented_static_reloc_property):
3735 New method definition.
3736 (Arm_reloc_property_table::reloc_name_in_error_message): New method
3737 declaration.
3738 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3739 overflow to N.
3740 (GOT_PREL): Change implemented to Y.
3741 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3742 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3743 (Arm_relocate_functions::movw_abs_nc): Remove method.
3744 (Arm_relocate_functions::movt_abs): Ditto.
3745 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3746 (Arm_relocate_functions::thm_movt_abs): Ditto.
3747 (Arm_relocate_functions::movw_rel_nc): Ditto.
3748 (Arm_relocate_functions::movw_rel): Ditto.
3749 (Arm_relocate_functions::movt_rel): Ditto.
3750 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3751 (Arm_relocate_functions:thm_movw_rel): Ditto.
3752 (Arm_relocate_functions:thm_movt_rel): Ditto.
3753 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3754 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3755 New method definitions.
3756 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3757 (Arm_relocation_functions::arm_grp_ldr): Ditto.
3758 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3759 (Arm_relocation_functions::arm_grp_ldc): Ditto.
3760 (Target_arm::Relocate::relocate): Check for non-static or
3761 unimplemented relocation code and exit early. Change calls to
3762 Target_arm::reloc_uses_thumb_bit and
3763 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3764 instead. Refactor code to handle similar relocations to increase
3765 code sharing. Remove check for unsupported relocation code in switch
3766 statement.
3767 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3768 relocation property table to find out size. Change error message to
3769 print out the name of a relocation code instead of the numeric value.
3770 (Target_arm::scan_reloc_for_stub): Use relocation property table
3771 instead of calling Target_arm::reloc_uses_thumb_bit().
3772
3773 2010-02-02 Doug Kwan <dougkwan@google.com>
3774
3775 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3776 types of relaxed input section.
3777
3778 2010-02-02 Doug Kwan <dougkwan@google.com>
3779
3780 * Makefile.am (HFILES): Add arm-reloc-property.h.
3781 (DEFFILES): New.
3782 (TARGETSOURCES): Add arm-reloc-property.cc
3783 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3784 (libgold_a_SOURCES): $(DEFFILES)
3785 * Makefile.in: Regenerate.
3786 * arm-reloc-property.cc: New file.
3787 * arm-reloc-property.h: New file.
3788 * arm-reloc.def: New file.
3789 * arm.cc: Update comments.
3790 (arm-reloc-property.h): New included header.
3791 (arm_reloc_property_table): New global variable.
3792 (Target_arm::do_select_as_default_target): New method definition.
3793 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3794 arm-reloc-property to targ_extra_obj.
3795 * parameters.cc (set_parameters_target): Call
3796 Target::select_as_default_target().
3797 * target.h (Target::select_as_default_target): New method definition.
3798 (Target::do_select_as_default_target): Same.
3799
3800 2010-02-01 Doug Kwan <dougkwan@google.com>
3801
3802 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3803 first_output_text_section_.
3804 (Arm_exidx_fixup::first_output_text_section): New method definition.
3805 (Arm_exidx_fixup::first_output_text_section_): New data member.
3806 (Arm_exidx_fixup::process_exidx_section): Record the first text
3807 output section seen.
3808 (Arm_output_section::fix_exidx_coverage): Set correct linked section
3809 and entsize in output section header.
3810
3811 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3812
3813 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3814 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3815 (Arm_relocate_functions::thm_alu11): New Method.
3816 (Arm_relocate_functions::thm_pc8): New Method.
3817 (Arm_relocate_functions::thm_pc12): New Method.
3818 (Target_arm::Scan::local): Handle the relocations.
3819 (Target_arm::Scan::global): Likewise.
3820 (Target_arm::Relocate::relocate): Likewise.
3821 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3822
3823 2010-01-29 Doug Kwan <dougkwan@google.com>
3824
3825 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3826 of relocation types as ld.
3827
3828 2010-01-29 Doug Kwan <dougkwan@google.com>
3829
3830 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3831 to public.
3832 (Arm_relocate_functions::thumb_branch_common): Ditto.
3833 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3834 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3835 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3836 Arm_relocate_functions::jump24): Remove.
3837 (Target_arm::Relocate::relocate): Adjust code to call
3838 Arm_relocation_functions::arm_branch_common and
3839 Arm_relocation_functions::thumb_branch_common instead of their removed
3840 wrappers. Merge switch-cases together to reduce source code size.
3841
3842 2010-01-29 Doug Kwan <dougkwan@google.com>
3843
3844 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3845 output_local_symbol_count_needs_update_.
3846 (Arm_relobj::output_local_symbol_count_needs_update,
3847 Arm_relobj::set_output_local_symbol_count_needs_update,
3848 Arm_relobj::update_output_local_symbol_count): New methods.
3849 (Arm_relobj::output_local_symbol_count_needs_update_): New data
3850 member.
3851 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3852 of pointed function as in a R_ARM_PREL31 relocation.
3853 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3854 for output local symbol count updating.
3855 (Target_arm::do_relax): Update output local symbol counts in objects
3856 if necessary.
3857 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3858
3859 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3860
3861 * arm.cc: Added support for the ARM relocations:
3862 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3863 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3864 (Arm_relocate_functions::movw_rel_nc): Renamed (was
3865 movw_prel_nc).
3866 (Arm_relocate_functions::movw_rel): New method.
3867 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3868 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3869 thm_movw_prel_nc).
3870 (Arm_relocate_functions::thm_movw_rel): New method.
3871 (Arm_relocate_functions::thm_movt_rel): Renamed (was
3872 thm_movt_prel).
3873 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3874 relocations.
3875 (Target_arm::Scan::global): Likewise.
3876 (Target_arm::Relocate::relocate): Likewise.
3877 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3878 Likewise.
3879
3880 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3881
3882 * arm.cc: Added support for ARM group relocations.
3883 (Target_arm::reloc_needs_sym_origin): New method.
3884 (Arm_relocate_functions::calc_grp_kn): New method.
3885 (Arm_relocate_functions::calc_grp_residual): New method.
3886 (Arm_relocate_functions::calc_grp_gn): New method.
3887 (Arm_relocate_functions::arm_grp_alu): New Method.
3888 (Arm_relocate_functions::arm_grp_ldr): New Method.
3889 (Arm_relocate_functions::arm_grp_ldrs): New Method.
3890 (Arm_relocate_functions::arm_grp_ldc): New Method.
3891 (Target_arm::Scan::local): Handle the ARM group relocations.
3892 (Target_arm::Scan::global): Likewise.
3893 (Target_arm::Relocate::relocate): Likewise.
3894 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3895 Likewise.
3896
3897 2010-01-26 Doug Kwan <dougkwan@google.com>
3898
3899 * arm.cc (set): Include.
3900 (class Arm_exidx_fixup): Change type of last_input_section_ to const
3901 pointer type.
3902 (Arm_output_section::Text_section_list): New type.
3903 (Arm_output_section::append_text_sections_to_list): New method.
3904 (Arm_output_section::fix_exidx_coverage): Ditto.
3905 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3906 (Arm_relobj::convert_input_section_to_relaxed_section): Use
3907 Relobj::set_section_offset() instead of
3908 Sized_relobj::invalidate_section_offset().
3909 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3910 parameter for section headers. Ignore relocation sections for
3911 unallocated sections and EXIDX sections.
3912 (Target_arm::fix_exidx_coverage): New method.
3913 (Target_arm::output_section_address_less_than): New type.
3914 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3915 linked text section instead of the EXIDX section.
3916 (Arm_output_section::create_stub_group): Add an assertion to check
3917 that this is not an EXIDX output section.
3918 (Arm_output_section::append_text_sections_to_list): New method.
3919 (Arm_output_section::fix_exidx_coverage): Ditto.
3920 (Arm_relobj::scan_sections_for_stubs): Adjust call to
3921 Arm_relobj::section_needs_reloc_stub_scanning.
3922 (Target_arm::do_relax): Fix EXIDX output section coverage in the
3923 first pass.
3924 (Target_arm::fix_exidx_coverage): New method.
3925 * object.h (Relobj::set_output_section): New method.
3926 (Sized_relobj::invalidate_section_offset): Remove method.
3927 (Sized_relobj::do_invalidate_section_offset): Remove method.
3928 (Sized_relobj::do_set_section_offset): Handle offset value -1.
3929
3930 2010-01-25 Doug Kwan <dougkwan@google.com>
3931
3932 * arm.cc (Arm_exidx_merged_section::do_output_offset):
3933 Fix warning due to signed and unsigned comparison on a 32-bit host.
3934
3935 2010-01-22 Doug Kwan <dougkwan@google.com>
3936
3937 * arm.cc (Target_arm::do_relax): Record an output section for section
3938 offset adjustment it contains any stub table that has changed.
3939 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3940 offsets in an output section if necessary.
3941 * output.cc (Output_section::Output_section): Initialize
3942 section_offsets_need_adjustments_.
3943 (Output_section::add_input_section_for_script): Renamed to
3944 Output_section::add_simple_input_section.
3945 (Output_section::save_states): Add a comment.
3946 (Output_section::discard_states): New method defintion.
3947 (Output_section::adjust_section_offsets): Same.
3948 * output.h (Output_section::add_input_section_for_script): Renamed to
3949 Output_section::add_simple_input_section.
3950 (Output_section::discard_states): New method declaration.
3951 (Output_section::adjust_section_offsets): Same.
3952 (Output_section::section_offsets_need_adjustment,
3953 Output_section::set_section_offsets_need_adjustment): New method
3954 definitions.
3955 (Output_section::section_offsets_need_adjustment_): New data member.
3956 * script-sections.cc
3957 (Output_section_element_input::set_section_address): Adjust code for
3958 renaming of Output_section::add_input_section_for_script.
3959 (Orphan_output_section::set_section_address): Same.
3960
3961 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3962
3963 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3964 Fix_v4bx enum values .
3965 * gold/options.h (General_options): New option definitions.
3966 (General_options::fix_v4bx): New method.
3967 (General_options::Fix_v4bx): New enum.
3968 * gold/options.cc (General_options::parse_fix_v4bx): New method.
3969 (General_options::parse_fix_v4bx_interworking): New method.
3970
3971 2010-01-22 Doug Kwan <dougkwan@google.com>
3972
3973 * arm.cc (Arm_exidx_fixup): New class.
3974
3975 2010-01-21 Doug Kwan <dougkwan@google.com>
3976
3977 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3978 classes.
3979 (Arm_exidx_section_offset_map): New type.
3980
3981 2010-01-21 Doug Kwan <dougkwan@google.com>
3982
3983 * arm.cc (Arm_exidx_input_section): New class.
3984 (Arm_relobj::exidx_input_section_by_link,
3985 Arm_relobj::exidx_input_section_by_shndx,
3986 Arm_relobj::make_exidx_input_section): New methods.
3987 (read_arm_attributes_section): Remove.
3988 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3989 information about them.
3990 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3991 to here.
3992
3993 2010-01-20 Doug Kwan <dougkwan@google.com>
3994
3995 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3996 Input_section_specifier to Section_id.
3997 (Target_arm::new_arm_input_section: Adjust code for change of key
3998 type.
3999 (Target_arm::find_arm_input_section): Ditto.
4000 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4001 (Section_id): Remove.
4002 (Garbage_collection::Section_id_hash): Remove.
4003 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4004 (Section_id): Remove.
4005 (Icf::Section_id_hash): Remove.
4006 * object.h (Section_id, Const_section_id, Section_id_hash,
4007 Const_section_id_hash): New type definitions.
4008 * output.cc (Output_section::add_relaxed_input_section): Change to
4009 use Const_section_id instead of Input_section_specifier as key type.
4010 (Output_section::add_merge_input_section): Ditto.
4011 (Output_section::build_relaxation_map): Change to use Section_id
4012 instead of Input_section_specifier as key type.
4013 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4014 Ditto.
4015 (Output_section::convert_input_sections_to_relaxed_sections): Change
4016 to use Const_section_id instead of Input_section_specifier as key type.
4017 (Output_section::find_merge_section): Ditto.
4018 (Output_section::find_relaxed_input_section): Ditto.
4019 * output.h (Input_section_specifier): Remove class.
4020 (Output_section::Output_section_data_by_input_section_map): Change
4021 key type to Const_section_id.
4022 (Output_section::Output_relaxed_input_section_by_input_section_map):
4023 Ditto.
4024 (Output_section::Relaxation_map): Change key type to Section_id.
4025
4026 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4027
4028 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4029 (class Arm_v4bx_stub): New class.
4030 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4031 (Stub_factory::make_arm_v4bx_stub): New method.
4032 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4033 (Stub_table::empty): Handle v4bx stubs.
4034 (Stub_table::add_arm_v4bx_stub): New method.
4035 (Stub_table::find_arm_v4bx_stub): New method.
4036 (Arm_relocate_functions::v4bx): New method.
4037 (Target_arm::fix_v4bx): New method.
4038 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4039 (Stub_table::relocate_stubs): Likewise.
4040 (Stub_table::do_write): Likewise.
4041 (Stub_table::update_data_size_and_addralign): Likewise.
4042 (Stub_table::finalize_stubs): Likewise.
4043 (Target_arm::Scan::local): Likewise.
4044 (Target_arm::Scan::global): Likewise.
4045 (Target_arm::do_finalize_sections): Likewise.
4046 (Target_arm::Relocate::relocate): Likewise.
4047 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4048 Likewise.
4049 (Target_arm::scan_reloc_for_stub): Likewise.
4050 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4051
4052 2010-01-19 Ian Lance Taylor <iant@google.com>
4053
4054 * output.cc (Output_section_headers::do_sized_write): Write large
4055 segment count to sh_info field.
4056 (Output_file_header::do_sized_write): For large segment count,
4057 write PN_XNUM to e_phnum field.
4058
4059 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4060
4061 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4062 (Arm_relocate_functions::thm_jump8): New function.
4063 (Arm_relocate_functions::thm_jump11): New function.
4064 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4065 R_ARM_THM_JUMP11.
4066 (Target_arm::Scan::global): Likewise.
4067 (Target_arm::Relocate::relocate): Likewise.
4068 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4069 Likewise.
4070
4071 2010-01-14 Doug Kwan <dougkwan@google.com>
4072
4073 * arm.cc (map, utility): Include headers.
4074 (Target_arm::apply_cortex_a8_workaround): New method.
4075 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4076 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4077 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4078 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4079 the --[no-]fix-cortex-a8 command line options.
4080 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4081 (Target_arm::relocate_stub): Use addend in instruction template.
4082 * options.h (DEFINE_bool): Set the user-set flag.
4083 (General_options): Add --[no-]-fix-cortex options.
4084 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4085 : Update fast look-up map after conversion.
4086
4087 2010-01-14 Sriraman Tallam <tmsriram@google.com>
4088
4089 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4090 in the first pass of do_layout.
4091
4092 2010-01-13 Doug Kwan <dougkwan@google.com>
4093
4094 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4095 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4096 apparent compiler problem of not folding static constant integral
4097 data members of elfcpp::Elf_sizes<32>.
4098
4099 2010-01-13 Doug Kwan <dougkwan@google.com>
4100
4101 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4102 Arm_relobj::section_needs_cortex_a8_stub_scanning,
4103 Arm_relobj::scan_section_for_cortex_a8_erratum,
4104 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4105 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4106 sections to scan for relocation stubs into a new method
4107 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
4108 relocation and Cortex-A8 stub scanning.
4109 (Target_arm::do_relax): Force stubs to be after stubbed sections
4110 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
4111 the beginning of a new relaxation pass. Update a comment.
4112 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4113
4114 2010-01-12 Ian Lance Taylor <iant@google.com>
4115
4116 * target-reloc.h (visibility_error): New inline function.
4117 (relocate_section): Call visibility_error.
4118 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4119 (MOSTLYCLEANFILES): Likewise.
4120 (protected_4_pic.o, protected_3.err): New targets.
4121 * testsuite/protected_4.cc: New file.
4122
4123 2010-01-12 Doug Kwan <dougkwan@google.com>
4124
4125 * arm.cc (Cortex_a8_reloc): New class.
4126 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4127 and cortex_a8_relocs_info_.
4128 (Target_arm::fix_cortex_a8): New method definition.
4129 (Target_arm::Cortex_a8_relocs_info): New type.
4130 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4131 New data member declarations.
4132 (Target_arm::scan_reloc_for_stub): Record information about
4133 relocations for THUMB branches that might be exempted from the
4134 Cortex-A8 workaround.
4135 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4136 at the beginning of a relaxation pass.
4137
4138 2010-01-12 Doug Kwan <dougkwan@google.com>
4139
4140 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4141 (Arm_relobj::Mapping_symbol_position,
4142 Arm_reloj::Mapping_symbol_position_less,
4143 Arm_relobj::Mapping_symbols_info): New types.
4144 (Target_arm::is_mapping_symbol_name): New method definition.
4145 (Arm_relobj::do_count_local_symbols): Save information about mapping
4146 symbols.
4147
4148 2010-01-11 Doug Kwan <dougkwan@google.com>
4149
4150 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4151 Arm_relocate_functions::thumb32_branch_upper,
4152 Arm_relocate_functions::thumb32_branch_lower,
4153 Arm_relocate_functions::thumb32_cond_branch_offset,
4154 Arm_relocate_functions::thumb32_cond_branch_upper,
4155 Arm_relocate_functions::thumb32_cond_branch_lower,
4156 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4157 branch offset encoding.
4158 (Arm_relocate_functions::thumb_branch_common): Use new branch
4159 offset encoding methods to avoid code duplication.
4160 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4161 (Stub_addend_reader::operator()): Use new branch encoding method
4162 to avoid code duplication.
4163
4164 2010-01-11 Doug Kwan <dougkwan@google.com>
4165
4166 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4167 (Target_arm::do_finalize_sections): Define special EXIDX section
4168 symbols only if referenced.
4169 * gc.h (Garbage_collection::add_reference): New method.
4170 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4171 code duplication.
4172
4173 2010-01-11 Ian Lance Taylor <iant@google.com>
4174
4175 * script.cc (Version_script_info::build_expression_list_lookup):
4176 Change complaing about duplicate wildcard match from error to
4177 warning.
4178
4179 * script.cc (class Lazy_demangler): Recreate--revert part of patch
4180 of 2009-12-30.
4181 (Version_script_info::Version_script_info): Initialize globs_,
4182 default_version_, default_is_global_, and exact_. Don't
4183 initialize globals_ or locals_.
4184 (Version_script_info::build_lookup_tables): Build local symbols
4185 first.
4186 (Version_script_info::unquote): New function.
4187 (Version_script_info::add_exact_match): New function.
4188 (Version_script_info::build_expression_list_lookup): Remove lookup
4189 parameter. Add is_global parameter. Change all callers. Handle
4190 wildcard pattern specially. Unquote pattern. Call
4191 add_exact_match.
4192 (Version_script_info::get_name_to_match): New function.
4193 (Version_script_info::get_symbol_version): New function.
4194 (Version_script_info::get_symbol_version_helper): Remove.
4195 (Version_script_info::check_unmatched_names): Call unquote.
4196 * script.h (class Version_script_info): Change get_symbol_version
4197 to be non-inline and add is_global parameter; change all callers.
4198 Rewrite symbol_is_local. Update declarations. Define struct
4199 Version_tree_match, Exact, Globs. Don't define struct Lookup.
4200 Remove globals_ and locals_ members. Add exact_, globs_,
4201 default_version_, is_global_.
4202 (Version_script_info::Glob): Remove pattern, add expression and
4203 is_global. Update constructor. Change all callers.
4204 * dynobj.cc (Versions::finalize): Mark the version symbol as the
4205 default version.
4206 (Versions::symbol_section_contents): If a symbol is undefined, or
4207 defined in a dynamic object, set the version index to
4208 VER_NDX_LOCAL.
4209 * symtab.cc (Symbol_table::add_from_relobj): Don't call
4210 symbol_is_local.
4211 (Symbol_table::add_from_pluginobj): Likewise.
4212 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4213
4214 2010-01-11 Doug Kwan <dougkwan@google.com>
4215
4216 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4217 (incremental_dump_LDADD): Add linking option for libintl.
4218 * Makefile.in: Regenerate.
4219
4220 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
4221
4222 PR gold/11144
4223 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4224 instead of -Ds.
4225 * testsuite/Makefile.in: Regenerated.
4226
4227 2010-01-10 Doug Kwan <dougkwan@google.com>
4228
4229 * options.h (DEFINE_var): Use parentheses around argument varname__
4230 in macro body to avoid any unintended subsequent substitutions.
4231
4232 2010-01-10 Ian Lance Taylor <iant@google.com>
4233
4234 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4235 candidates before doing symbol resolution.
4236
4237 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4238 ODR candidates if only one is weak.
4239
4240 2010-01-08 Ian Lance Taylor <iant@google.com>
4241
4242 * script.cc (Version_script_info::build_expression_list_lookup):
4243 Don't warn about ambiguous version, just record the ambiguity.
4244 (Version_script_info::get_symbol_version_helper): Give error if
4245 version is ambiguous.
4246
4247 2010-01-08 Doug Kwan <dougkwan@google.com>
4248
4249 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4250 prev_data_size_ and prev_addralign_. Remove initializer for
4251 deleted data member has_been_changed_.
4252 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4253 to determine if the table is empty.
4254 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4255 Remove.
4256 (Stub_table::add_reloc_stub): Define method in class definition
4257 instead of just declaring it there.
4258 (Stub_table::add_cortex_a8_stub): New method definition.
4259 (Stub_table::update_data_size_and_addralign): Ditto.
4260 (Stub_table::finalize_stubs): Ditto.
4261 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4262 (Stub_table::do_addralign_): Return address alignment in the
4263 (Stub_table::do_reset_address_and_file_offset): Define method in
4264 class definition instead of declaring it there. Set current data
4265 size to be the data size of the previous pass.
4266 (Stub_table::set_final_data_size): Use current data size as the
4267 final data size.
4268 (Stub_table::relocate_stub): Change parameter type of stub from
4269 Reloc_stub pointer to Stub pointer.
4270 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4271 (Stub_table::Cortex_a8_stub_list): New typedef.
4272 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4273 Stub_table::prev_addralign_): New data member.
4274 (Arm_relobj::Arm_relobj): Initialize data member
4275 section_has_cortex_a8_workaround_.
4276 (Arm_relobj::section_has_cortex_a8_workaround,
4277 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4278 definitions.
4279 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4280 declarations.
4281 (Target_arm::relocate_stub): Change parameter type of stub from
4282 Reloc_stub pointer to Stub pointer.
4283 (Insn_template::size, Insn_template::alignment): Handle
4284 THUMB16_SPECIAL_TYPE.
4285 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4286 Stub_table::update_data_size_and_addralign,
4287 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4288 definitions.
4289 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4290 (Stub_table::do_write): Ditto.
4291 (Target_arm::do_relax): Adjust code for changes in Stub_table.
4292
4293 2010-01-08 Ian Lance Taylor <iant@google.com>
4294
4295 PR 11108
4296 * symtab.h (class Symbol): Remove fields is_target_special_ and
4297 has_plt_offset_. Add field is_defined_in_discarded_section_.
4298 (Symbol::is_defined_in_discarded_section): New function.
4299 (Symbol::set_is_defined_in_discarded_section): New function.
4300 (Symbol::has_plt_offset): Rewrite.
4301 (Symbol::set_plt_offset): Verify that new offset is not -1U.
4302 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4303 Don't initialize is_target_special_ or has_plt_offset_.
4304 Initialize is_defined_in_discarded_section_.
4305 (Symbol_table::add_from_relobj): If appropriate, set
4306 is_defined_in_discarded_section.
4307 * resolve.cc (Symbol::override_base_with_special): Don't test
4308 is_target_special_. Change has_plt_offset_ to has_plt_offset().
4309 * target-reloc.h (relocate_section): Do special handling for
4310 symbols defined in discarded sections for global symbols as well
4311 as local symbols.
4312
4313 2010-01-08 Ian Lance Taylor <iant@google.com>
4314
4315 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4316 the SHT_SYMTAB case.
4317
4318 2010-01-08 Ian Lance Taylor <iant@google.com>
4319
4320 * object.cc (Sized_relobj::do_layout): Don't get confused if
4321 layout_eh_frame returns NULL.
4322
4323 2010-01-08 Ian Lance Taylor <iant@google.com>
4324
4325 PR 11084
4326 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4327 dynamic symbol table, use the normal symbol table.
4328 (Sized_dynobj::do_read_symbols): Remove assertion about type of
4329 symbol table.
4330
4331 2010-01-08 Ian Lance Taylor <iant@google.com>
4332
4333 PR 11072
4334 * layout.cc (Layout::include_section): Remove .gnu_debuglink
4335 sections.
4336
4337 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
4338
4339 * version.cc (print_version): Change to "Copyright 2010".
4340
4341 2010-01-08 Ian Lance Taylor <iant@google.com>
4342
4343 PR 10287
4344 PR 11063
4345 * i386.cc (class Target_i386): Change return type of plt_section
4346 to be non-const.
4347 (class Output_data_plt_i386): Add tls_desc_rel_ field.
4348 (Output_data_plt_i386::Output_data_plt_i386): Initialize
4349 tls_desc_rel_ field.
4350 (Output_data_plt_i386::rel_tls_desc): New function.
4351 (Target_i386::rel_tls_desc_section): New function.
4352 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4353 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4354 R_386_TLS_DESC reloc in rel_tls_desc_section.
4355 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4356 Define struct Tlsdesc_info.
4357 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4358 (Target_x86_64::do_reloc_symbol_index): New function.
4359 (Target_x86_64::add_tlsdesc_info): New function.
4360 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4361 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4362 tlsdesc_rel_ field.
4363 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
4364 all callers.
4365 (Output_data_plt_x86_64::rela_tlsdesc): New function.
4366 (Target_x86_64::rela_tlsdesc_section): New function.
4367 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4368 handling.
4369 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4370 (Target_x86_64::do_reloc_addend): New function.
4371 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4372 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4373 declarations. Define TARGET_CODE. Add arg field to u1_ union.
4374 (Output_reloc::type): New function.
4375 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4376 (Output_reloc::is_target_specific): New function.
4377 (Output_reloc::target_arg): New function.
4378 (class Output_reloc) [SHT_RELA]: Add four new constructors for
4379 absolute relocs and target specific relocs.
4380 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4381 add_target_specific.
4382 (class Output_data_reloc) [SHT_RELA]: Likewise.
4383 * output.cc (Output_reloc::Output_reloc): Add four new versions
4384 for absolute relocs and target specific relocs.
4385 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4386 (Output_reloc::get_symbol_index): Likewise.
4387 (Output_reloc::local_section_offset): Check that local_sym_index_
4388 is not TARGET_CODE or 0.
4389 (Output_reloc::symbol_value): Likewise.
4390 (Output_reloc::write) [SHT_RELA]: Call target for target specific
4391 reloc.
4392 * target.h (class Target): Add reloc_symbol_index and reloc_addend
4393 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
4394 functions.
4395 * layout.cc (add_target_dynamic_tags): Use output section for
4396 DT_PLTRELSZ and DT_JMPREL.
4397
4398 2010-01-07 Ian Lance Taylor <iant@google.com>
4399
4400 PR 11061
4401 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4402 function.
4403 (class Output_data_reloc_generic): Define.
4404 (class Output_data_reloc_base): Change base class to
4405 Output_data_reloc_generic. Change add() method to call
4406 bump_relative_reloc_count for a relative reloc. Remove
4407 sort_relocs_ field.
4408 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4409 to sort_relocs().
4410 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4411 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
4412 appropriate.
4413 * layout.h (class Layout): Update declaration.
4414
4415 2010-01-07 Ian Lance Taylor <iant@google.com>
4416
4417 * output.h (class Output_data): Add const version of
4418 output_section and do_output_section.
4419 (class Output_section_data): Add const version of
4420 do_output_section.
4421 (class Output_section): Likewise.
4422 * layout.cc (Layout::add_target_dynamic_tags): New function.
4423 * layout.h (class Layout): Update declarations.
4424 * arm.cc (Target_arm::do_finalize_sections): Use
4425 add_target_dynamic_tags.
4426 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4427 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4428 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4429 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4430
4431 2010-01-07 Ian Lance Taylor <iant@google.com>
4432
4433 PR 11042
4434 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4435 object as needed.
4436
4437 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
4438 Ian Lance Taylor <iant@google.com>
4439
4440 PR 11019
4441 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4442 Xindex::read_symtab_xindex.
4443
4444 2010-01-07 Doug Kwan <dougkwan@google.com>
4445
4446 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4447 (Insn_template::thumb16_bcond_insn): New method declaration.
4448 (Insn_template): Fix spelling.
4449 (Stub::thumb16_special): New method declaration.
4450 (Stub::do_write): Define virtual method which was previously pure
4451 virtual.
4452 (Stub::do_thumb16_special): New method declaration.
4453 (Stub::do_fixed_endian_write): New template member.
4454 (Reloc_stub::do_write): Remove.
4455 (Reloc_stub::do_fixed_endian_write): Remove.
4456 (Cortex_a8_stub): New class definition.
4457 (Stub_factory::make_cortex_a8_stub): New method definition.
4458 (Stub_factory::Stub_factory): Add missing static storage class
4459 qualifier for elf32_arm_stub_a8_veneer_blx.
4460
4461 2010-01-07 Ian Lance Taylor <iant@google.com>
4462
4463 PR 10980
4464 * options.h (class General_options): Add --warn-unresolved-symbols
4465 and --error-unresolved-symbols.
4466 * errors.cc (Errors::undefined_symbol): Implement
4467 --warn-unresolved-symbols.
4468
4469 * options.h (class General_options): Add -z text and -z textoff.
4470 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4471
4472 2010-01-06 Sriraman Tallam <tmsriram@google.com>
4473
4474 * gc.h (Garbage_collection::Cident_section_map): New typedef.
4475 (Garbage_collection::cident_sections): New function.
4476 (Garbage_collection::add_cident_section): New function.
4477 (Garbage_collection::cident_sections_): New member.
4478 (gc_process_relocs): Add references to sections whose names are C
4479 identifiers.
4480 * gold.h (cident_section_start_prefix): New constant.
4481 (cident_section_stop_prefix): New constant.
4482 (is_cident): New function.
4483 * layout.cc (Layout::define_section_symbols): Replace string constants
4484 with the newly defined constants.
4485 * object.cc (Sized_relobj::do_layout): Track sections whose names are
4486 C identifiers.
4487 * testsuite/Makefile.am: Add gc_orphan_section_test.
4488 * testsuite/Makefile.in: Regenerate.
4489 * testsuite/gc_orphan_section_test.cc: New file.
4490 * testsuite/gc_orphan_section_test.sh: New file.
4491
4492 2010-01-06 Ian Lance Taylor <iant@google.com>
4493
4494 PR 10980
4495 * options.h (class General_options): Add --warn-shared-textrel.
4496 * layout.cc (Layout::finish_dynamic_section): Implement
4497 --warn-shared-textrel.
4498
4499 PR 10980
4500 * options.h (class General_options): Add --warn-multiple-gp.
4501
4502 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4503
4504 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4505 $(THREADSLIB) and $(LIBDL).
4506 * Makefile.in: Rebuild.
4507
4508 2010-01-06 Ian Lance Taylor <iant@google.com>
4509
4510 PR 10980
4511 * options.cc (General_options::parse_section_start): New function.
4512 (General_options::section_start): New function.
4513 (General_options::General_options): Initialize all members.
4514 * options.h: Include <map>
4515 (class General_options): Add --section-start. Add section_starts_
4516 member.
4517 * layout.cc (Layout::attach_allocated_section_to_segment): If
4518 --section-start was used, set the address of the segment. Remove
4519 local sort_sections.
4520 (Layout::relaxation_loop_body): If the address of the load segment
4521 has been set by --section-start, don't use it.
4522 * output.h (Output_segment::update_flags_for_output_section): New
4523 function.
4524 * output.cc (Output_segment::add_output_section): Call
4525 update_flags_for_output_section.
4526
4527 2010-01-05 Ian Lance Taylor <iant@google.com>
4528
4529 PR 10980
4530 * options.h (class General_options): Add --undefined-version.
4531 * script.cc (struct Version_expression): Add was_matched_by_symbol
4532 field.
4533 (Version_script_info::matched_symbol): New function.
4534 (Version_script_info::get_symbol_version_helper): Call
4535 matched_symbol.
4536 (Version_script_info::check_unmatched_names): New function.
4537 * script.h (class Version_script_info): Update declarations.
4538 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4539
4540 * options.h (class General_options): Use DEFINE_bool_alias for
4541 allow_multiple_definition.
4542 * resolve.cc (Symbol_table::should_override): Don't test
4543 allow_multiple_definition.
4544
4545 PR 10980
4546 * options.h (class General_options): Add --cref.
4547 * main.cc (main): Print cref table if --cref. Don't close mapfile
4548 until after printing cref table.
4549 * cref.cc: Include "symtab.h".
4550 (class Cref_inputs): Define Cref_table_compare and Cref_table.
4551 (Cref_table_compare::operator()): New function.
4552 (Cref_inputs::gather_cref): New function.
4553 (filecol): New static const.
4554 (Cref_inputs::print_cref): New function.
4555 (Cref::print_cref): New function.
4556 * cref.h: Include <cstdio>.
4557 (class Cref): Update declarations.
4558 * mapfile.h (Mapfile::file): New function.
4559 * object.h (class Object): Define Symbols. Declare virtual
4560 do_get_global_symbols.
4561 (Object::get_global_symbols): New function.
4562 * object.cc (Input_objects::add_object): Pass object to cref_ if
4563 --cref.
4564 (Input_objects::archive_start): Likewise.
4565 (Input_objects::archive_stop): Likewise.
4566 (Input_objects::print_cref): New function.
4567 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4568 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4569 --cref.
4570 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4571 function.
4572 * plugin.h (class Sized_pluginobj): Update declarations.
4573
4574 2010-01-05 Ian Lance Taylor <iant@google.com>
4575
4576 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4577 to is_default_version. Rename insdef to insdefault.
4578 (Symbol_table::add_from_relobj): Rename def to is_default_version
4579 and local to is_forced_local.
4580 (Symbol_table::add_from_pluginobj): Likewise.
4581 (Symbol_table::add_from_dynobj): Likewise.
4582 (Symbol_table::define_special_symbol): Rename insdef to
4583 insdefault.
4584
4585 2010-01-04 Ian Lance Taylor <iant@google.com>
4586
4587 PR 10980
4588 * options.h (class General_options): Add
4589 --allow-multiple-definition and -z muldefs.
4590 * resolve.cc (Symbol_table::should_override): Don't warn about a
4591 multiple symbol definition if --allow-multiple-definition or -z
4592 muldefs.
4593
4594 PR 10980
4595 * options.h (class General_options): Add --add-needed and
4596 --copy-dt-needed-entries. Tweak --as-needed help entry.
4597 * object.cc (Input_objects::check_dynamic_dependencies): Give an
4598 error if --copy-dt-needed-entries aka --add-needed is used and
4599 would cause a change in behaviour.
4600
4601 PR 10980
4602 * options.h (class General_options): Add -G as a short version of
4603 --shared. Add no-op options -assert, -g, and -i.
4604
4605 2010-01-04 Sriraman Tallam <tmsriram@google.com>
4606
4607 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4608 check for .text or .gnu.linkonce.t sections.
4609 * icf.cc (Icf::find_identical_sections): Ditto.
4610 Change the detection for mangled function name within the section
4611 name.
4612 * icf.h (is_section_foldable_candidate): New function.
4613
4614 2009-12-30 Ian Lance Taylor <iant@google.com>
4615
4616 PR 10980
4617 * options.h (class General_options): Permit two dashes with
4618 --retain-symbols-file.
4619
4620 2009-12-30 Ian Lance Taylor <iant@google.com>
4621
4622 PR 10979
4623 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4624 don't put the file header and segment headers in the text
4625 segment.
4626
4627 PR 10979
4628 * common.cc (Sort_commons::operator()): Stabilize sort when both
4629 entries are NULL.
4630 (Symbol_table::do_allocate_commons_list): When allocating common
4631 symbols, skip a symbol which is no longer common.
4632 * symtab.h (Symbol::is_common): Test whether the symbol comes from
4633 an object before checking its type.
4634 * testsuite/common_test_2.c: New file.
4635 * testsuite/common_test_3.c: New file.
4636 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4637 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4638 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4639 (common_test_2_pic.o, common_test_2.so): New targets.
4640 (common_test_3_pic.o, common_test_3.so): New targets.
4641 * testsuite/Makefile.in: Rebuild.
4642
4643 PR 10979
4644 * script.cc (read_input_script): If we see a new SECTIONS clause,
4645 and we have added an input section, give an error.
4646 * layout.h (class Layout): Add have_added_input_section function.
4647 Add have_added_input_section_ field.
4648 * layout.cc (Layout::Layout): Initialize
4649 have_added_input_section_.
4650 (Layout::layout): Set have_added_input_section_.
4651 (Layout::layout_eh_frame): Likewise.
4652
4653 2009-12-30 Ian Lance Taylor <iant@google.com>
4654
4655 PR 10931
4656 * options.h (class General_options): Add --sort-common option.
4657 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4658 * common.cc (Sort_common): Add sort_order parameter to
4659 constructor. Add sort_order_ field.
4660 (Sort_commons::operator): Check sort_order_.
4661 (Symbol_table::allocate_commons): Determine the sort order.
4662 (Symbol_table::do_allocate_commons): Add sort_order parameter.
4663 Change all callers.
4664 (Symbol_table::do_allocate_commons_list): Likewise.
4665
4666 2009-12-30 Ian Lance Taylor <iant@google.com>
4667
4668 PR 10916
4669 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4670 symbols from this object, don't change the visibility of an
4671 undefined symbol.
4672 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4673
4674 2009-12-30 Ian Lance Taylor <iant@google.com>
4675
4676 PR 10861
4677 * script.h (class Version_script_info): Define Language enum.
4678 Update declarations. Define Glob, Exact, and Lookup types. Add
4679 new fields globals_, locals_, and is_finalized_.
4680 * script.cc: Various formatting fixes.
4681 (class Parser_closure): Change language_stack_ from a vector of
4682 std::string to one of Version_script_info::Language. Adjust all
4683 uses accordingly.
4684 (class Lazy_demangler): Remove.
4685 (struct Version_expression): Change language from std::string to
4686 Version_script_info::Language.
4687 (Version_script_info::Version_script_info): New function.
4688 (Version_script_info::~Version_script_info): Don't call clear.
4689 (Version_script_info::finalize): New function.
4690 (Version_script_info::build_lookup_tables): New function.
4691 (Version_script_info::build_expression_list_lookup): New
4692 function.
4693 (Version_script_info::get_symbol_version_helper): Rewrite to use
4694 lookup tables.
4695 (Version_script_info::print_expression_list): Adjust to use
4696 Version_script_info::Language.
4697 (script_push_lex_into_version_mode): Check that the version script
4698 has not been finalized.
4699 (version_script_push_lang): Change language string to
4700 Version_script_info::Language.
4701 * options.cc (Command_line::version_script): New function.
4702 * options.h (class General_options): Add finalize_dynamic_list
4703 function. Change version_script from declaration to definition.
4704 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4705 * testsuite/version_script.map: Remove duplicate def of foo.
4706 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4707 version_script.map.
4708 * testsuite/Makefile.in: Rebuild.
4709
4710 2009-12-30 Ian Lance Taylor <iant@google.com>
4711
4712 PR 10843
4713 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4714 if the input symbol index is 0, make the output symbol index 0.
4715
4716 2009-12-30 Ian Lance Taylor <iant@google.com>
4717
4718 PR 10670
4719 * options.h (class General_options): Add -x/--discard-all.
4720 * object.cc (Sized_relobj::do_count_local_symbols): Handle
4721 --discard-all. If the local symbol needs a dynamic entry, check
4722 that before handling --discard-locals.
4723
4724 2009-12-30 Ian Lance Taylor <iant@google.com>
4725
4726 PR 10450
4727 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4728 flags to PF_R.
4729 (Output_segment::add_output_section): Don't change the flags if
4730 the type is PT_TLS.
4731
4732 PR 10450
4733 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4734 GNU hash table if they need a dynamic value. Otherwise, don't add
4735 them if they are defined in a dynamic object or are forced local.
4736
4737 2009-12-29 Ian Lance Taylor <iant@google.com>
4738
4739 PR 10450
4740 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4741 .gnu.hash table for a 32-bit target.
4742
4743 PR 10450
4744 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4745 regular and a dynamic object only needs a dynamic symbol table
4746 entry if it is externally visible.
4747
4748 PR 10450
4749 * i386.cc (class Target_i386): Initialize global_offset_table_ in
4750 constructor. Add global_offset_table_ field.
4751 (Target_i386::got_section): Set global_offset_table_.
4752 (Target_i386::do_finalize_sections): Set global_offset_table_
4753 size.
4754 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4755 in constructor. Add global_offset_table_ field.
4756 (Target_x86_64::got_section): Set global_offset_table_.
4757 (Target_x86_64::do_finalize_sections): Set global_offset_table_
4758 size.
4759
4760 * layout.cc (Layout::Layout): Initialize increase_relro_.
4761 (Layout::get_output_section): Add is_relro, is_last_relro, and
4762 is_first_non_relro parameters. Change all callers.
4763 (Layout::choose_output_section): Likewise.
4764 (Layout::add_output_section_data): Likewise.
4765 (Layout::make_output_section): Likewise.
4766 (Layout::set_segment_offsets): Clear increase_relro when using a
4767 linker script.
4768 * layout.h (class Layout): Add increase_relro method. Add
4769 increase_relro_ field. Update declarations.
4770 * output.cc (Output_section::Output_section): Initialize
4771 is_last_relro_ and is_first_non_relro_.
4772 (Output_segment::add_output_section): Group relro sections is
4773 do_sort is true. Handle is_last_relro and is_first_non_relro.
4774 (Output_segment::maximum_alignment): Remove relro handling.
4775 (Output_segment::set_section_addresses): Add increase_relro
4776 parameter. Change all callers. Add initial alignment to align
4777 relro sections on separate page. Remove old relro handling.
4778 (Output_segment::set_section_list_addresses): Remove in_relro
4779 parameter. Change all callers.
4780 (Output_segment::set_offset): Add increase parameter. Change all
4781 callers. Remove old relro handling.
4782 * output.h (class Output_section): Add new methods: is_last_relro,
4783 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4784 Add is_last_relro_ and is_first_non_relro_ fields.
4785 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4786 Create separate .got.plt section. Call increase_relro.
4787 * x86_64.cc (Target_x86_64::got_section): Likewise.
4788 * testsuite/relro_script_test.t: Add .got.plt.
4789
4790 PR 10450
4791 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4792 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4793 (Layout::finalize): Call set_dynamic_symbol_size.
4794 (Layout::set_dynamic_symbol_size): New function.
4795 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
4796 set_dynamic_symbol_size.
4797
4798 PR 10450
4799 * output.h (class Output_section): Add is_entsize_zero_ field.
4800 * output.cc (Output_section::Output_section): Initialize
4801 is_entsize_zero_.
4802 (Output_section::set_entsize): If two different entsizes are
4803 requested, force it to zero.
4804 (Output_section::add_input_section): Set flags for .debug_str
4805 before updating section flags. Set entsize.
4806 (Output_section::update_flags_for_input_section): Set SHF_MERGE
4807 and SHF_STRING if all input sections have those flags.
4808
4809 2009-12-29 Rafael Espindola <espindola@google.com>
4810
4811 * main.cc (main): Fix the sys time reporting.
4812 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4813 reporting.
4814
4815 2009-12-29 Sriraman Tallam <tmsriram@google.com>
4816
4817 * options.cc (General_options::parse_version): Allow -v to exit
4818 without an error if there is nothing to link.
4819
4820 2009-12-29 Ian Lance Taylor <iant@google.com>
4821
4822 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4823 using a version of gcc before 4.1.
4824 * configure: Rebuild.
4825
4826 2009-12-28 Chris Demetriou <cgd@google.com>
4827
4828 * attributes.cc (Output_attributes_section_data::do_write): Use
4829 std::vector::front rather than std::vector::data.
4830
4831 2009-12-28 Ian Lance Taylor <iant@google.com>
4832
4833 * symtab.h (class Symbol_table): Add enum Defined.
4834 * resolve.cc (Symbol_table::should_override): Add defined
4835 parameter. Change all callers. Test whether object is NULL
4836 before calling a method on it.
4837 (Symbol_table::report_resolve_problem): Add defined parameter.
4838 Change all callers.
4839 (Symbol_table::should_override_with_special): Likewise.
4840 * symtab.cc (Symbol_table::define_in_output_data): Add defined
4841 parameter. Change all callers.
4842 (Symbol_table::do_define_in_output_data): Likewise.
4843 (Symbol_table::define_in_output_segment): Likewise.
4844 (Symbol_table::do_define_in_output_segment): Likewise.
4845 (Symbol_table::define_as_constant): Likewise.
4846 (Symbol_table::do_define_as_constant): Likewise.
4847 * script.h (class Symbol_assignment): Add is_defsym parameter to
4848 constructor; change all callers.
4849 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4850 parameter. Change all callers. Add is_defsym_ field.
4851 (class Parser_closure): Add parsing_defsym parameter to
4852 constructor; change all callers. Add parsing_defsym accessor
4853 function. Add parsing_defsym_ field.
4854
4855 2009-12-28 Ian Lance Taylor <iant@google.com>
4856
4857 * gold.cc (queue_middle_tasks): Fix formatting.
4858 * object.cc (Relobj::is_section_name_included): Likewise.
4859
4860 2009-12-23 Ian Lance Taylor <iant@google.com>
4861
4862 * i386.cc (Target_i386::do_calls_non_split): Recognize
4863 -fsplit-stack prologue for a function with a static chain.
4864 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4865 -fsplit-stack prologue when using %r11.
4866
4867 2009-12-21 Sriraman Tallam <tmsriram@google.com>
4868
4869 * options.cc (General_options::parse_version): Make -v continue and do
4870 the link like GNU ld does.
4871
4872 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
4873
4874 * Makefile.am (CCFILES): Add timer.cc.
4875 (HFILES): Add timer.h.
4876 * configure.ac: Check for sysconf and times.
4877 * main.cc: include timer.h.
4878 (main): Use Timer instead of get_run_time.
4879 * timer.cc: New.
4880 * timer.h: New.
4881 * workqueue.cc: include timer.h.
4882 (Workqueue::find_and_run_task):
4883 Report user, sys and wall time.
4884 * Makefile.in: Regenerate.
4885 * config.in: Regenerate.
4886 * configure: Regenerate.
4887
4888 2009-12-16 Doug Kwan <dougkwan@google.com>
4889
4890 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4891 sections.
4892 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4893 relaxed input sections.
4894 * output.cc (Output_section::find_relaxed_input_section): Change
4895 return type to Output_relaxed_input_section pointer. Adjust code
4896 for new type of relaxed_input_section_map_.
4897 * output.h (Output_section::find_relaxed_input_section): Change
4898 return type to Output_relaxed_input_section pointer.
4899 (Output_section::Output_relaxed_input_section_by_input_section_map):
4900 New type.
4901 (Output_section::relaxed_input_section_map_): Change type to
4902 Output_section::Output_relaxed_input_section_by_input_section_map.
4903 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4904 input section.
4905
4906 2009-12-15 Ian Lance Taylor <iant@google.com>
4907
4908 * layout.cc (Layout::create_shstrtab): Only write out after input
4909 sections if we are compressing debug sections.
4910
4911 2009-12-15 Ian Lance Taylor <iant@google.com>
4912
4913 * archive.cc (Archive::add_symbols): Only look up a symbol without
4914 a version if there is, in fact, a version.
4915
4916 2009-12-14 Ian Lance Taylor <iant@google.com>
4917
4918 Revert -Wshadow changes, all changes from:
4919 2009-12-11 Doug Kwan <dougkwan@google.com>
4920 2009-12-11 Nick Clifton <nickc@redhat.com>
4921 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4922
4923 2009-12-11 Doug Kwan <dougkwan@google.com>
4924
4925 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4926 due to -Wshadow.
4927 * attributes.cc (Object_attribute::size): Ditto.
4928 (Attributes_section_data::size): Ditto.
4929 (Attributes_section_data::Attributes_section_data): Ditto.
4930 (Output_attributes_section_data::do_write): Ditto.
4931 * attributes.h (Object_attribute::set_type): Ditto.
4932 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4933
4934 2009-12-11 Nick Clifton <nickc@redhat.com>
4935
4936 * archive.cc: Fix shadowed variable warnings.
4937 * arm.cc: Likewise.
4938 * compressed_output.cc: Likewise.
4939 * compressed_output.h: Likewise.
4940 * configure: Likewise.
4941 * dwarf_reader.cc: Likewise.
4942 * dynobj.cc: Likewise.
4943 * dynobj.h: Likewise.
4944 * ehframe.cc: Likewise.
4945 * ehframe.h: Likewise.
4946 * errors.cc: Likewise.
4947 * expression.cc: Likewise.
4948 * fileread.cc: Likewise.
4949 * fileread.h: Likewise.
4950 * freebsd.h: Likewise.
4951 * i386.cc: Likewise.
4952 * icf.cc: Likewise.
4953 * incremental.h: Likewise.
4954 * layout.cc: Likewise.
4955 * layout.h: Likewise.
4956 * mapfile.cc: Likewise.
4957 * merge.cc: Likewise.
4958 * merge.h: Likewise.
4959 * object.cc: Likewise.
4960 * object.h: Likewise.
4961 * options.h: Likewise.
4962 * output.cc: Likewise.
4963 * output.h: Likewise.
4964 * parameters.cc: Likewise.
4965 * plugin.cc: Likewise.
4966 * powerpc.cc: Likewise.
4967 * reduced_debug_output.cc: Likewise.
4968 * reduced_debug_output.h: Likewise.
4969 * reloc.cc: Likewise.
4970 * reloc.h: Likewise.
4971 * resolve.cc: Likewise.
4972 * script-sections.cc: Likewise.
4973 * script.cc: Likewise.
4974 * script.h: Likewise.
4975 * sparc.cc: Likewise.
4976 * symtab.cc: Likewise.
4977 * symtab.h: Likewise.
4978 * target-select.cc: Likewise.
4979 * target-select.h: Likewise.
4980 * token.h: Likewise.
4981 * workqueue.cc: Likewise.
4982 * workqueue.h: Likewise.
4983 * x86_64.cc: Likewise.
4984
4985 2009-12-10 Doug Kwan <dougkwan@google.com>
4986
4987 * arm.cc (attributes.h): New include.
4988 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4989 (Arm_relobj::~Arm_relobj): Delete object pointed by
4990 attributes_section_data_.
4991 (Arm_relobj::attributes_section_data): New method definition.
4992 (Arm_relobj::attributes_section_data_): New data member declaration.
4993 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4994 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4995 attributes_section_data_.
4996 (Arm_dynobj::attributes_section_data): New method definition.
4997 (Arm_dynobj::attributes_section_data_): New data member declaration.
4998 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
4999 initialization value of may_use_blx_ to false.
5000 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5001 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5002 object attributes to compute results instead of hard-coding.
5003 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5004 Target_arm::get_secondary_compatible_arch,
5005 Target_arm::set_secondary_compatible_arch
5006 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5007 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5008 New method declarations.
5009 (Target_arm::get_aeabi_object_attribute): New method definition.
5010 (Target_arm::attributes_section_data_): New data member declaration.
5011 (read_arm_attributes_section): New template definition.
5012 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5013 (Arm_dynobj::do_read_symbols): Ditto.
5014 (Target_arm::do_finalize_sections): Merge attributes sections from
5015 input. Check for BLX use after attributes section merging.
5016 Fix __exidx_start and __exidx_end visibility. Create an
5017 .ARM.attributes section if necessary.
5018 (Target_arm::get_secondary_compatible_arch,
5019 Target_arm::set_secondary_compatible_arch,
5020 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5021 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5022 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5023 New method definitions.
5024
5025 2009-12-09 Ian Lance Taylor <iant@google.com>
5026
5027 * plugin.cc (Plugin::load): Don't cast from void* to a function
5028 pointer.
5029
5030 2009-12-09 Ian Lance Taylor <iant@google.com>
5031
5032 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5033 information fields.
5034
5035 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5036
5037 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5038 Replace two_file_shared_1.so with two_file_shared_2.so.
5039 * testsuite/Makefile.in: Regenerated.
5040
5041 2009-12-08 Doug Kwan <dougkwan@google.com>
5042
5043 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5044 (HFILES): Add attributes.h and int_encoding.h.
5045 * Makefile.in: Regenerate.
5046 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5047 function definitions to int_encoding.cc
5048 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5049 prototypes to int_encoding.h
5050 * reduced_debug_output.cc (int_encoding.h): New include.
5051 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5052 function definitions to int_encoding.cc
5053 (insert_into_vector, read_from_pointer): Move template definitions to
5054 int_encoding.h
5055 * attributes.cc: New file.
5056 * attributes.h: New file.
5057 * int_encoding.cc: New file.
5058 * int_encoding.h: New file.
5059
5060 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5061
5062 PR gold/11055
5063 * incremental-dump.cc (dump_incremental_inputs): New.
5064 (main): Use dump_incremental_inputs.
5065
5066 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5067
5068 PR gold/10893
5069 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5070 checking elfcpp::STT_FUNC.
5071 (Target_i386::Relocate::relocate): Likewise.
5072 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5073
5074 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5075 symbols from shared libraries into normal FUNC symbols.
5076
5077 * symtab.h (Symbol): Add is_func and use it.
5078
5079 2009-12-05 Doug Kwan <dougkwan@google.com>
5080
5081 * arm.cc (Target_arm::arm_info): Initialize new fields
5082 attributes_section and attributes_vendor.
5083 * i386.cc (Target_i386::i386_info): Same.
5084 * object.cc (Sized_relobj::do_layout): Skip attribute section.
5085 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5086 fields attributes_section and attributes_vendor.
5087 * sparc.cc (Target_sparc::sparc_info): Same.
5088 * target.h (Target::attributes_section, Target::attributes_vendor,
5089 Target::is_attributes_section, Target::attribute_arg_type,
5090 Target::attributes_order): New method definitions.
5091 (Target::Target_info::attributes_section,
5092 Target::Target_info::attributes_vendor): New fields.
5093 (Target::do_attribute_arg_type, Target::do_attributes_order): New
5094 virtual method definitions.
5095 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5096 attributes_section and attributes_vendor.
5097 * testsuite/testfile.cc (Target_test::test_target_info): Same.
5098
5099 2009-12-05 Doug Kwan <dougkwan@google.com>
5100
5101 * arm.cc: Update comments about interworking and stub generation.
5102 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5103 considered as non-PIC.
5104 (Arm_relocate_functions::base_abs): Fix formatting.
5105 (Arm_relocate_functions::got_prel): Fix comment. Change interface
5106 of function to use GOT entry address instead of offset.
5107 (Target_arm::Scan::global): Issue an error if a symbol would need a
5108 PLT does not get one because it is untyped. Remove code to create
5109 dynamic symbols for relative branches.
5110 (Target_arm::Relocate::relocate: Use 0 instead of false since function
5111 takes unsigned integer instead of boolean.
5112
5113 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
5114
5115 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5116 (two_file_test_LDADD): Likewise.
5117 (common_test_1_LDADD): Likewise.
5118 (exception_test_LDADD) Likewise.
5119 (weak_test_LDADD): Likewise.
5120 (many_sections_test_LDADD): Likewise.
5121 (initpri1_LDADD): Likewise.
5122 (script_test_1_LDADD): Likewise.
5123 (script_test_2_LDADD): Likewise.
5124 (justsyms_LDADD): Likewise.
5125 (binary_test_LDADD): Likewise.
5126 (large_LDADD): Likewise.
5127 * testsuite/Makefile.in: Regenerated.
5128
5129 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
5130
5131 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5132 (Symbol_table::override_with_special): Likewise.
5133 (Symbol_table::add_from_object): Likewise.
5134
5135 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5136
5137 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5138 Don't set the data_offset twice.
5139
5140 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
5141
5142 * testsuite/Makefile.in: Regenerate.
5143
5144 2009-12-03 Doug Kwan <dougkwan@google.com>
5145
5146 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5147 (Target_arm::do_finalize_sections): Add parameter for symbol table
5148 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
5149 * i386.cc (Target_i386::do_finalize_sections): Add an additional
5150 parameter for symbol table pointer.
5151 * layout.cc (Layout::finalize): Call Target::finalize_sections with
5152 an additional parameter for a pointer to symbol table.
5153 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5154 parameter for a symbol table pointer.
5155 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5156 * target.h (Target::finalize_sections, Target::do_finalize_sections):
5157 Ditto.
5158 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5159 parameter for a symbol table pointer.
5160
5161 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
5162
5163 * incremental.cc (Incremental_inputs_header)
5164 (Incremental_inputs_header_write, Incremental_inputs_entry)
5165 (Incremental_inputs_entry_write): Move ...
5166 * incremental.h (Incremental_inputs_header)
5167 (Incremental_inputs_header_write, Incremental_inputs_entry)
5168 (Incremental_inputs_entry_write): here.
5169
5170 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5171
5172 * incremental.cc (make_sized_incremental_binary): Set the target.
5173 Error if it is incompatible.
5174 * output.h (Output_file): Add filename method.
5175
5176 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5177
5178 * incremental.cc (Incremental_inputs_entry): Remove unused argument
5179 from the get_* methods.
5180
5181 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5182
5183 * incremental-dump.cc (main): Check that the offeset of a script is 0.
5184 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5185 Write 0 for the data_offset of scripts.
5186
5187 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
5188
5189 * testsuite/Makefile.am: Add the incremental_test.sh test.
5190 * testsuite/incremental_test.sh: New.
5191 * testsuite/incremental_test_1.c: New.
5192 * testsuite/incremental_test_2.c: New.
5193
5194 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
5195
5196 * incremental-dump.cc (main): Fix typos.
5197
5198 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
5199
5200 PR gold/11025
5201 * incremental-dump.cc (main): Use llu to print 64 bit values.
5202
5203 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
5204 H.J. Lu <hongjiu.lu@intel.com>
5205
5206 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5207 $(LIBDL).
5208 (incremental_dump_LDADD): Likewise.
5209 * Makefile.in: Regenerated.
5210
5211 2009-11-25 Doug Kwan <dougkwan@google.com>
5212
5213 Revert:
5214
5215 2009-11-25 Doug Kwan <dougkwan@google.com>
5216
5217 * arm.cc (Target_arm::Target_arm): Move method definition
5218 outside of class definition. Add code to handle
5219 --target1-rel, --target1-abs and --target2= options.
5220 (Target_arm::get_reloc_reloc_type): Change method to be
5221 non-static and const.
5222 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5223 New data member declaration.
5224 (Target_arm::Scan::local, Target_arm::Scan::global,
5225 Target_arm::Relocate::relocate,
5226 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5227 Adjust call to Target_arm::get_real_reloc_type.
5228 (Target_arm::get_real_reloc_type): Use command line options
5229 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5230 * options.h (--target1-rel, --target1-abs, --target2): New
5231 ARM-only options.
5232
5233 2009-11-25 Doug Kwan <dougkwan@google.com>
5234
5235 * arm.cc (Target_arm::Target_arm): Move method definition outside of
5236 class definition. Add code to handle --target1-rel, --target1-abs
5237 and --target2= options.
5238 (Target_arm::get_reloc_reloc_type): Change method to be non-static
5239 and const.
5240 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5241 member declaration.
5242 (Target_arm::Scan::local, Target_arm::Scan::global,
5243 Target_arm::Relocate::relocate,
5244 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5245 call to Target_arm::get_real_reloc_type.
5246 (Target_arm::get_real_reloc_type): Use command line options to
5247 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5248 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5249 options.
5250
5251 2009-11-25 Doug Kwan <dougkwan@google.com>
5252
5253 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5254 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5255 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5256 formatting.
5257 (Arm_relocate_functions::thm_call): Replace body with a call to
5258 Arm_relocate_functions::thumb_branch_common.
5259 (Arm_relocate_functions::thm_jump24,
5260 Arm_relocate_functions::thm_xpc22): New method definitions.
5261 (Arm_relocate_functions::thumb_branch_common): New method definition.
5262 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5263 operator.
5264 (Target_arm::Relocate::relocate): Adjust call to thm_call.
5265 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5266
5267 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5268
5269 * Makefile.am: Build incremental-dump
5270 * Makefile.in: Regenerate.
5271 * incremental-dump.cc: New.
5272 * incremental.cc (Incremental_inputs_header_data,
5273 Incremental_inputs_entry_data): Move to incremental.h
5274 * incremental.h: (Incremental_inputs_header_data,
5275 Incremental_inputs_entry_data): Move from incremental.cc
5276
5277 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5278
5279 * incremental.cc (Incremental_inputs_header,
5280 Incremental_inputs_header_write, Incremental_inputs_entry,
5281 Incremental_inputs_entry_write): Add a typedef with the data type.
5282
5283 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
5284
5285 * incremental.cc (Incremental_inputs_header,
5286 Incremental_inputs_header_write, Incremental_inputs_entry,
5287 Incremental_inputs_entry_write): Update comment about which
5288 type has the filed descriptions.
5289
5290 2009-11-15 Doug Kwan <dougkwan@google.com>
5291
5292 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5293 (Arm_relocate_functions::arm_branch_common): Change method defintion
5294 in class definition to a method declaration and update list of formal
5295 parameters.
5296 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5297 Arm_relocation_functions::jump24): Adjust call to
5298 Arm_relocate_functions::arm_branch_common. Update list of formal
5299 parameters.
5300 (Arm_relocate_functions::xpc25): New method definition.
5301 (Arm_relocate_functions::arm_branch_common): Move method defintion
5302 out from class definition. Use stubs for mode-switching and extending
5303 branch ranges.
5304 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5305 specially. Change code to enable use of stubs in ARM branches.
5306
5307 2009-11-10 Doug Kwan <dougkwan@google.com>
5308
5309 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5310 in method declaration.
5311 (Target_arm::relocate_stub): New method declaration.
5312 (Target_arm::default_target): Change to return a pointer instead of
5313 a const reference.
5314 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5315 Target_arm::default_target.
5316 (Arm_Relobj::do_relocate_sections): Remove options paramater in
5317 method definition.
5318 (Target_arm::relocate_section): Adjust view.
5319 (Target_arm::relocate_stub): New method definition.
5320
5321 2009-11-10 Doug Kwan <dougkwan@google.com>
5322
5323 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5324 a format warning.
5325 * incremental.cc (open_incremental_binary): Initialized local
5326 variables to avoid warnings.
5327 * object.cc (make_elf_object): Ditto.
5328 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5329 a format warning.
5330
5331 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
5332
5333 PR gold/10930
5334 * testsuite/plugin_test.c: Include "config.h".
5335
5336 2009-11-09 Doug Kwan <dougkwan@google.com>
5337
5338 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5339 (arm_symbol_value): Remove.
5340 (Arm_relocate_functions::arm_branch_common,
5341 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5342 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5343 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5344 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5345 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5346 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5347 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5348 Arm_relocate_functions::thm_mobw_abs_nc,
5349 Arm_relocate_functions::thm_mov_abs,
5350 Arm_relocate_functions::movw_prel_nc,
5351 Arm_relocate_functions::thm_movt_abs,
5352 Arm_relocate_functions::movt_prel,
5353 Arm_relocate_functions::thm_movw_prel_nc,
5354 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5355 (Target_arm::Relocate::relocate): Only decompose address into two
5356 parts if relocation type uses the thumb-bit and pass the actual
5357 bit instead of a flag indicating that the thumb-bit is used. Adjust
5358 calls to methods in Arm_relocate_functions for this change.
5359
5360 2009-11-08 Ian Lance Taylor <iant@google.com>
5361
5362 PR 10925
5363 * reloc.cc: Instantiate
5364 Sized_relobj::initialize_input_to_output_maps and
5365 Sized_relobj:free_input_to_output_maps.
5366
5367 2009-11-06 Ian Lance Taylor <iant@google.com>
5368
5369 PR 10876
5370 * defstd.cc (in_segment): Set only_if_ref true for "end".
5371
5372 2009-11-06 Doug Kwan <dougkwan@google.com>
5373
5374 * arm.cc (class Reloc_stub): Correct a comment.
5375 (Target_arm::Target_arm): Initialize arm_input_section_map_.
5376 (Target_arm::scan_section_for_stubs): New method declaration.
5377 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5378 Change methods from private to protected.
5379 (Target_arm::do_may_relax): New method definition.
5380 (Target_arm::do_relax, Target_arm::group_sections,
5381 Target_arm::scan_reloc_for_stub,
5382 Target_arm::scan_reloc_section_for_stubs): New method declarations.
5383 (Target_arm::arm_input_section_map_): New data member declaration.
5384 (Target_arm::scan_reloc_for_stub,
5385 Target_arm::scan_reloc_section_for_stubs,
5386 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5387 Target_arm::do_relax): New method definitions.
5388
5389 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
5390
5391 * configure.ac: Check for (struct stat)::st_mtim
5392 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5393 * config.in: Regenerate.
5394 * configure: Regenerate.
5395
5396 2009-11-05 Ian Lance Taylor <iant@google.com>
5397
5398 PR 10910
5399 * output.cc (Output_segment::add_output_section): Add missing
5400 return statement.
5401
5402 2009-11-04 Ian Lance Taylor <iant@google.com>
5403
5404 PR 10880
5405 * object.h (class Object): Add is_needed and set_is_needed
5406 methods. Add is_needed_ field. Make bool fields into bitfields.
5407 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5408 defined in a dynamic object and referenced by a regular object,
5409 set is_needed for the dynamic object.
5410 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5411 if the file is marked with as_needed and it is not needed.
5412
5413 2009-11-04 Ian Lance Taylor <iant@google.com>
5414
5415 PR 10887
5416 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5417 tags if data is discarded by linker script.
5418 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5419 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5420 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5421 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5422
5423 2009-11-04 Ian Lance Taylor <iant@google.com>
5424
5425 * layout.cc (Layout::get_output_section): Add is_interp and
5426 is_dynamic_linker_section parameters. Change all callers.
5427 (Layout::choose_output_section): Likewise.
5428 (Layout::make_output_section): Likewise.
5429 (Layout::add_output_section_data): Add is_dynamic_linker_section
5430 parameter. Change all callers.
5431 * layout.h (class Layout): Update declarations.
5432 * output.h (class Output_section): Add is_interp, set_is_interp,
5433 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5434 Add is_interp_, is_dynamic_linker_section_ fields. Change
5435 generate_code_fills_at_write_ to a bitfield.
5436 * output.cc (Output_section::Output_sections): Initialize new
5437 fields.
5438 (Output_segment::add_output_section): Add do_sort parameter.
5439 Change all callers.
5440
5441 2009-11-03 Ian Lance Taylor <iant@google.com>
5442
5443 PR 10860
5444 * options.h (class General_options): Add --warn-common.
5445 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5446 merging two common symbols.
5447 (Symbol_table::should_override): Handle --warn-common when merging
5448 a common symbol with a defined symbol. Use report_resolve_problem
5449 for multiple definitions.
5450 (Symbol_table::report_resolve_problem): New function.
5451 * symtab.h (class Symbol_table): Declare report_resolve_problem.
5452
5453 2009-11-03 Doug Kwan <dougkwan@google.com>
5454
5455 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5456 stub_factory_.
5457 (Target_arm::stub_factory): New method definition.
5458 (Target_arm::new_arm_input_section,
5459 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5460 Target_arm::reloc_uses_thumb_bit): New method declarations.
5461 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5462 New type definitions.
5463 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5464 member declarations.
5465 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5466 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5467 New method definitions.
5468
5469 2009-11-03 Ian Lance Taylor <iant@google.com>
5470
5471 * options.h (class General_options): Add --warn_constructors.
5472
5473 2009-11-03 Ian Lance Taylor <iant@google.com>
5474
5475 PR 10893
5476 * defstd.cc (in_section): Add entries for __rel_iplt_start,
5477 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5478
5479 2009-11-03 Ian Lance Taylor <iant@google.com>
5480
5481 PR 10895
5482 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5483 --msgid-bugs-address.
5484 (install-pdf): New target.
5485 (install-data_yes): Look up one directory to find mkinstalldirs.
5486
5487 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
5488
5489 * po/Make-in (.po.gmo): Don't generate .gmo files in source
5490 tree.
5491
5492 2009-10-30 Doug Kwan <dougkwan@google.com>
5493
5494 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5495
5496 2009-10-30 Doug Kwan <dougkwan@google.com>
5497
5498 * arm.cc (Stub_addend_reader): New struct template definition
5499 and partial specializations.
5500 (Stub_addend_reader::operator()): New method definition for a
5501 partially specialized template.
5502
5503 2009-10-30 Doug Kwan <dougkwan@google.com>
5504
5505 * arm.cc (Arm_relobj::processor_specific_flags): New method
5506 definition.
5507 (Arm_relobj::do_read_symbols): New method declaration.
5508 (Arm_relobj::processor_specific_flags_): New data member declaration.
5509 (Arm_dynobj): New class definition.
5510 (Target_arm::do_finalize_sections): Add input_objects parameter.
5511 (Target_arm::do_adjust_elf_header): New method declaration.
5512 (Target_arm::are_eabi_versions_compatible,
5513 (Target_arm::merge_processor_specific_flags): New method declaration.
5514 (Target_arm::do_make_elf_object): New overloaded method definitions
5515 and declaration.
5516 (Arm_relobj::do_read_symbols): New method definition.
5517 (Arm_dynobj::do_read_symbols): Ditto.
5518 (Target_arm::do_finalize_sections): Add input_objects parameters.
5519 Merge processor-specific flags from all input objects.
5520 (Target_arm::are_eabi_versions_compatible,
5521 Target_arm::merge_processor_specific_flags,
5522 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5523 New method definitions.
5524 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5525 Input_objects pointer type parameter.
5526 * layout.cc (Layout::finalize): Pass input objects to target's.
5527 finalize_sections function.
5528 * output.cc (Output_file_header::do_sized_write): Set ELF file
5529 header's processor-specific flags.
5530 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5531 Input_objects pointer type parameter.
5532 * sparc.cc (Target_sparc::do_finalize_sections): Same.
5533 * target.h (Input_objects): New forward class declaration.
5534 (Target::processor_specific_flags,
5535 Target::are_processor_specific_flags_sect): New method definitions.
5536 (Target::finalize_sections): Add input_objects parameter.
5537 (Target::Target): Initialize processor_specific_flags_ and
5538 are_processor_specific_flags_set_.
5539 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5540 parameter.
5541 (Target::set_processor_specific_flags): New method definition.
5542 (Target::processor_specific_flags_,
5543 Target::are_processor_specific_flags_set_): New data member
5544 declarations.
5545 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5546 Input_objects pointer type parameter.
5547
5548 2009-10-30 Doug Kwan <dougkwan@google.com>
5549
5550 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5551
5552 2009-10-28 Ian Lance Taylor <iant@google.com>
5553
5554 * object.h (class Relobj): Drop options parameter from
5555 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5556 do_scan_relocs, do_relocate. Change all callers.
5557 (class Sized_relobj): Drop options parameters from
5558 do_gc_process_relocs, do_scan_relocs, do_relocate,
5559 do_relocate_sections, relocate_sections, emit_relocs_scan,
5560 emit_relocs_scan_reltype. Change all callers.
5561 (struct Relocate_info): Remove options field and all references to
5562 it.
5563 * reloc.h (class Read_relocs): Remove options constructor
5564 parameter and options_ field. Change all callers.
5565 (class Gc_process_relocs, class Scan_relocs): Likewise.
5566 (class Relocate_task): Likewise.
5567 * target-reloc.h (scan_relocs): Remove options parameter. Change
5568 all callers.
5569 (scan_relocatable_relocs): Likewise.
5570 * target.h (class Sized_target): Remove options parameter from
5571 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
5572 all callers.
5573 * gc.h (gc_process_relocs): Remove options parameter. Change all
5574 callers.
5575 * arm.cc: Update functions to remove options parameters.
5576 * i386.cc: Likewise.
5577 * powerpc.cc: Likewise.
5578 * sparc.cc: Likewise.
5579 * x86_64.cc: Likewise.
5580 * testsuite/testfile.cc: Likewise.
5581
5582 2009-10-28 Doug Kwan <dougkwan@google.com>
5583
5584 * arm.cc (Arm_relobj): New class definition.
5585 (Arm_relobj::scan_sections_for_stubs,
5586 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5587 New method definitions.
5588
5589 2009-10-28 Cary Coutant <ccoutant@google.com>
5590
5591 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5592 (Plugin::cleanup_done_): New member.
5593 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5594 (Plugin_manager::cleanup_done_): Remove.
5595 (Plugin_manager::add_input_file): Edit error message.
5596 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5597 (Plugin_manager::cleanup): Remove use of cleanup_done_.
5598
5599 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
5600
5601 * fileread.cc: (File_read::View::~View): Use the new
5602 data_ownership_ filed.
5603 (File_read::~File_read): Dispose the new whole_file_view_.
5604 (File_read::open): Mmap the whole file if needed.
5605 (File_read::open): Use whole_file_view_ instead of contents_.
5606 (File_read::find_view): Use whole_file_view_ if applicable.
5607 (File_read::do_read): Use whole_file_view_ instead of contents_.
5608 (File_read::make_view): Use whole_file_view_ instead of contents_,
5609 update File_read::View::View call.
5610 (File_read::find_or_make_view): Update File_read::View::View
5611 call.
5612 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5613 remove contents_
5614 (File_read::View::Data_ownership): New enum.
5615 (File_read::View::View): Replace bool mapped_ with Data_ownership
5616 argument.
5617 (File_read::View::mapped_): Remove (replaced by data_ownership_).
5618 (File_read::View::data_ownership_): New field.
5619 (File_read::contents_): Remove (replaced by whole_file_view_).
5620 (File_read::whole_file_view_): New field.
5621 * options.h (class General_options): Add --keep-files-mapped.
5622
5623 2009-10-27 Cary Coutant <ccoutant@google.com>
5624
5625 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5626 * testsuite/Makefile.am (plugin_test_5): New test case.
5627 * testsuite/Makefile.in: Regenerate.
5628
5629 2009-10-25 Doug Kwan <dougkwan@google.com>
5630
5631 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5632 from private to protected to allow access by child class.
5633 (Sized_relobj::do_relocate_sections): New method declaration.
5634 (Sized_relobj::relocate_sections): Virtualize.
5635 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5636 Sized_relobj::relocate_sections. Instantiate template explicitly
5637 for different target sizes and endianity.
5638
5639 2009-10-24 Doug Kwan <dougkwan@google.com>
5640
5641 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5642 (Arm_input_section::as_arm_input_section): New method.
5643 (Arm_output_section): New class definition.
5644 (Arm_output_section::create_stub_group,
5645 Arm_output_section::group_sections): New method definitions.
5646
5647 2009-10-22 Doug Kwan <dougkwan@google.com>
5648
5649 * arm.cc (Arm_input_section): New class definition.
5650 (Arm_input_section::init, Arm_input_section:do_write,
5651 Arm_input_section::set_final_data_size,
5652 Arm_input_section::do_reset_address_and_file_offset): New method
5653 definitions.
5654
5655 2009-10-21 Doug Kwan <dougkwan@google.com>
5656
5657 * arm.cc (Stub_table, Arm_input_section): New forward class
5658 declarations.
5659 (Stub_table): New class defintion.
5660 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5661 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5662 New method definition.
5663
5664 2009-10-21 Doug Kwan <dougkwan@google.com>
5665
5666 * arm.cc: Update copyright comments.
5667 (Target_arm): New forward class template declaration.
5668 (Arm_address): New type.
5669 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5670 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5671 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5672 constants.
5673 (Insn_template): Same.
5674 (DEF_STUBS): New macro.
5675 (Stub_type): New enum type.
5676 (Stub_template): New class definition.
5677 (Stub): Same.
5678 (Reloc_stub): Same.
5679 (Stub_factory): Same.
5680 (Target_arm::Target_arm): Initialize may_use_blx_ and
5681 should_force_pic_veneer_.
5682 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5683 Target_arm::should_force_pic_veneer,
5684 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5685 Target_arm::using_thumb_only, Target_arm:;default_target): New
5686 method defintions.
5687 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5688 New data member declarations.
5689 (Insn_template::size, Insn_template::alignment): New method defintions.
5690 (Stub_template::Stub_template): New method definition.
5691 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5692 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5693 (Stub_factory::Stub_factory): New method definition.
5694 * gold.h (string_hash): New template.
5695 * output.h (Input_section_specifier::hash_value): Use
5696 gold::string_hash.
5697 (Input_section_specifier::string_hash): Remove.
5698 * stringpool.cc (Stringpool_template::string_hash): Use
5699 gold::string_hash.
5700
5701 2009-10-20 Doug Kwan <dougkwan@google.com>
5702
5703 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5704 symbols of relaxed input sections.
5705 * output.h (Output_section::find_relaxed_input_section): Make
5706 method public.
5707
5708 2009-10-16 Doug Kwan <dougkwan@google.com>
5709
5710 * dynobj.cc (Versions::Versions): Initialize version_script_.
5711 Only insert base version symbol definition for a shared object
5712 if version script defines any version versions.
5713 (Versions::define_base_version): New method definition.
5714 (Versions::add_def): Check that base version is not needed.
5715 (Versions::add_need): Define base version lazily.
5716 * dynobj.h (Versions::define_base_version): New method declaration.
5717 (Versions::needs_base_version_): New data member declaration.
5718 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5719 (check_DATA): Add no_version_test.stdout.
5720 (libno_version_test.so, no_version_test.o no_version_test.stdout):
5721 New make rules.
5722 * testsuite/Makefile.in: Regenerate.
5723 * testsuite/no_version_test.c: New file.
5724 * testsuite/no_version_test.sh: Ditto.
5725
5726 2009-10-16 Doug Kwan <dougkwan@google.com>
5727
5728 * expression.cc (class Segment_start_expression): New class definition.
5729 (Segment_start_expression::value): New method definition.
5730 (script_exp_function_segment_start): Return a new
5731 Segment_start_expression.
5732 * gold/script-c.h (script_saw_segment_start_expression): New function
5733 prototype.
5734 * script-sections.cc (Script_sections::Script_sections): Initialize
5735 SAW_SEGMENT_START_EXPRESSION_ to false.
5736 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5737 and -Tbbs options to specify section addresses if given in
5738 command line and no SEGMENT_START expression is seen in a script.
5739 * script-sections.h (Script_sections::saw_segment_start_expression,
5740 Script_sections::set_saw_segment_start_expression): New method
5741 definition.
5742 (Script_sections::saw_segment_start_expression_): New data member
5743 declaration.
5744 * script.cc (script_saw_segment_start_expression): New function.
5745 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5746 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5747 script_test_7.sh and script_test_8.sh.
5748 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5749 script_test_8.stdout.
5750 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5751 (script_test_6, script_test_6.stdout, script_test_7,
5752 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5753 * Makefile.in: Regenerate.
5754 * testsuite/script_test_6.sh: New file.
5755 * testsuite/script_test_6.t: Same.
5756 * testsuite/script_test_7.sh: Same.
5757 * testsuite/script_test_7.t: Same.
5758 * testsuite/script_test_8.sh: Same.
5759
5760 2009-10-16 Doug Kwan <dougkwan@google.com>
5761
5762 * output.cc (Output_segment::set_section_list_address): Cast
5763 expressions to unsigned long long type to avoid format warnings.
5764
5765 2009-10-15 Ian Lance Taylor <iant@google.com>
5766
5767 * script.cc (Script_options::add_symbol_assignment): Always add a
5768 dot assignment to script_sections_.
5769 * script-sections.cc (Script_sections::add_dot_assignment):
5770 Initialize if necessary.
5771
5772 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5773 program headers with no load segment if there is a linker script.
5774
5775 * layout.cc (Layout::set_segment_offsets): Align the file offset
5776 to the segment aligment for -N or -n with no load segment.
5777 * output.cc (Output_segment::add_output_section): Don't crash if
5778 the first section is a TLS section.
5779 (Output_segment::set_section_list_addresses): Print an error
5780 message if the address moves backward in a linker script.
5781 * script-sections.cc
5782 (Output_section_element_input::set_section_addresses): Don't
5783 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5784 (Orphan_output_section::set_section_addresses): Likewise.
5785
5786 2009-10-15 Doug Kwan <dougkwan@google.com>
5787
5788 * layout.cc (Layout::finish_dynamic_section): Generate tags
5789 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5790 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5791 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5792
5793 2009-10-14 Ian Lance Taylor <iant@google.com>
5794
5795 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5796 fields.
5797 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5798 data_shdr fields of relinfo.
5799 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5800 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
5801 R_386_TLS_LDO_32, adjust based on section flags.
5802 (Target_i386::Relocate::fix_up_ldo): Remove.
5803
5804 2009-10-13 Ian Lance Taylor <iant@google.com>
5805
5806 Add support for -pie.
5807 * options.h (class General_options): Add -pie and
5808 --pic-executable.
5809 (General_options::output_is_position_independent): Test -pie.
5810 (General_options::output_is_executable): Return true if not shared
5811 and not relocatable.
5812 (General_options::output_is_pie): Remove.
5813 * options.cc (General_options::finalize): Reject incompatible uses
5814 of -pie.
5815 * gold.cc (queue_middle_tasks): A -pie link is not static.
5816 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5817 * symtab.cc (Symbol::final_value_is_known): Return false if
5818 output_is_position_independent.
5819 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5820 output_is_position_independent.
5821 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5822 output_is_position_independent.
5823 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5824 output_is_position_independent.
5825 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5826 two_file_pie_test.
5827 (basic_pie_test.o, basic_pie_test): New targets.
5828 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5829 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5830 (two_file_pie_test): New target.
5831 * testsuite/Makefile.in: Rebuild.
5832 * README: Remove note saying that -pie is not supported.
5833
5834 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
5835
5836 * options.h (class General_options): Add -init and -fini.
5837 * layout.cc (Layout::finish_dynamic_section): Emit
5838 given init and fini functions.
5839
5840 2009-10-13 Sriraman Tallam <tmsriram@google.com>
5841
5842 * gc.h (gc_process_relocs): Check if icf is enabled using new
5843 function.
5844 * gold.cc (queue_initial_tasks): Likewise.
5845 (queue_middle_tasks): Likewise.
5846 * object.cc (do_layout): Likewise.
5847 * symtab.cc (is_section_folded): Likewise.
5848 * main.cc (main): Likewise.
5849 * reloc.cc (Read_relocs::run): Likewise.
5850 (Sized_relobj::do_scan_relocs): Likewise.
5851 * icf.cc (is_function_ctor_or_dtor): New function.
5852 (Icf::find_identical_sections): Check if function is ctor or dtor when
5853 safe icf is chosen.
5854 * options.h (General_options::icf): Change option to be an enum.
5855 (Icf_status): New enum.
5856 (icf_enabled): New method.
5857 (icf_safe_folding): New method.
5858 (set_icf_status): New method.
5859 (icf_status_): New variable.
5860 * (options.cc) (General_options::finalize): Set icf_status_.
5861 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5862 icf_test and icf_keep_unique_test to use the --icf enum flag.
5863 * testsuite/icf_safe_test.sh: New file.
5864 * testsuite/icf_safe_test.cc: New file.
5865
5866 2009-10-12 Sriraman Tallam <tmsriram@google.com>
5867
5868 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5869 includes to gc.h and icf.h.
5870 * arm.cc: Include gc.h.
5871 * gold.cc: Likewise.
5872 * i386.cc: Likewise.
5873 * powerpc.cc: Likewise.
5874 * sparc.cc: Likewise.
5875 * x86_64.cc: Likewise.
5876 * gc.h: Include icf.h.
5877
5878 2009-10-11 Ian Lance Taylor <iant@google.com>
5879
5880 * plugin.cc: Include "gold.h" before other header files.
5881
5882 2009-10-10 Chris Demetriou <cgd@google.com>
5883
5884 * options.h (Input_file_argument::Input_file_type): New enum.
5885 (Input_file_argument::is_lib_): Replace with...
5886 (Input_file_argument::type_): New member.
5887 (Input_file_argument::Input_file_argument): Take Input_file_type
5888 'type' rather than boolean 'is_lib' as second argument.
5889 (Input_file_argument::is_lib): Use type_.
5890 (Input_file_argument::is_searched_file): New function.
5891 (Input_file_argument::may_need_search): Handle is_searched_file.
5892 * options.cc (General_options::parse_library): Support -l:filename.
5893 (General_options::parse_just_symbols): Update for Input_file_argument
5894 changes.
5895 (Command_line::process): Likewise.
5896 * archive.cc (Archive::get_file_and_offset): Likewise.
5897 * plugin.cc (Plugin_manager::release_input_file): Likewise.
5898 * script.cc (read_script_file, script_add_file): Likewise.
5899 * fileread.cc (Input_file::Input_file): Likewise.
5900 (Input_file::will_search_for): Handle is_searched_file.
5901 (Input_file::open): Likewise.
5902 * readsyms.cc (Read_symbols::get_name): Likewise.
5903 * testsuite/Makefile.am (searched_file_test): New test.
5904 * testsuite/Makefile.in: Regenerate.
5905 * testsuite/searched_file_test.cc: New file.
5906 * testsuite/searched_file_test_lib.cc: New file.
5907
5908 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5909 Ian Lance Taylor <iant@google.com>
5910
5911 * descriptor.cc: Include <cstdio> and "binary-io.h".
5912 (Descriptors::open): Open the files in binary mode always.
5913 * script.cc (Lex::get_token): Treat \r as whitespace.
5914
5915 2009-10-09 Ian Lance Taylor <iant@google.com>
5916
5917 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5918
5919 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
5920 Ian Lance Taylor <iant@google.com>
5921
5922 * configure.ac: Check for readv function also.
5923 * fileread.cc (readv): Define if not HAVE_READV.
5924 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5925 does not exist.
5926 * config.in: Regenerate.
5927 * configure: Regenerate.
5928
5929 2009-10-09 Doug Kwan <dougkwan@google.com>
5930
5931 * layout.cc (Layout::make_output_section): Call target hook to make
5932 ordinary output section.
5933 (Layout::finalize): Adjust parameter list of call the
5934 Target::may_relax().
5935 * layout.h (class Layout::section_list): New method.
5936 * merge.h (Output_merge_base::entsize): Change visibility to public.
5937 (Output_merge_base::is_string, Output_merge_base::do_is_string):
5938 New methods.
5939 (Output_merge_string::do_is_string): New method.
5940 * object.cc (Sized_relobj::do_setup): renamed from
5941 Sized_relobj::set_up.
5942 * object.h (Sized_relobj::adjust_shndx,
5943 Sized_relobj::initializ_input_to_output_maps,
5944 Sized_relobj::free_input_to_output_maps): Change visibilities to
5945 protected.
5946 (Sized_relobj::setup): Virtualize.
5947 (Sized_relobj::do_setup): New method declaration.
5948 (Sized_relobj::invalidate_section_offset,
5949 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5950 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5951 * options.cc (parse_int): New function.
5952 * options.h (parse_int): New declaration.
5953 (DEFINE_int): New macro.
5954 (stub_group_size): New option.
5955 * output.cc (Output_section::Output_section): Initialize memebers
5956 merge_section_map_, merge_section_by_properties_map_,
5957 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5958 (Output_section::add_input_section): Handled deferred code-fill
5959 generation and remove an old comment.
5960 (Output_section::add_relaxed_input_section): New method definition.
5961 (Output_section::add_merge_input_section): Use merge section by
5962 properties map to speed to search. Update merge section maps
5963 as appropriate.
5964 (Output_section::build_relaxation_map): New method definition.
5965 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5966 Same.
5967 (Output_section::relax_input_section): Renamed to
5968 Output_section::convert_input_sections_to_relaxed_sections and change
5969 interface to take a vector of pointers to relaxed sections.
5970 (Output_section::find_merge_section,
5971 Output_section::find_relaxed_input_section): New method definitions.
5972 (Output_section::is_input_address_mapped,
5973 Output_section::output_offset, Output_section::output_address):
5974 Use output section data maps to speed up searching.
5975 (Output_section::find_starting_output_address): Add comments.
5976 (Output_section::do_write,
5977 Output_section::write_to_postprocessing_buffer): Do code-fill
5978 generation as appropriate.
5979 (Output_section::get_input_sections): Invalidate relaxed input section
5980 map.
5981 (Output_section::restore_states): Adjust type of checkpoint .
5982 Invalidate relaxed input section map.
5983 * output.h (Output_merge_base): New class declaration.
5984 (Input_section_specifier): New class defintion.
5985 (class Output_relaxed_input_section) Change base class to
5986 Output_section_data_build.
5987 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5988 base class initializer.
5989 (Output_section::add_relaxed_input_section): New method declaration.
5990 (Output_section::Input_section): Change visibility to protected.
5991 (Output_section::Input_section::relobj,
5992 Output_section::Input_section::shndx): Handle relaxed input sections.
5993 Output_section::input_sections) Change visibility to protected. Also
5994 define overload to return a non-const pointer.
5995 (Output_section::Merge_section_properties): New class defintion.
5996 (Output_section::Merge_section_by_properties_map,
5997 Output_section::Output_section_data_by_input_section_map,
5998 Output_section::Relaxation_map): New types.
5999 (Output_section::relax_input_section): Rename method to
6000 Output_section::convert_input_sections_to_relaxed_sections and change
6001 interface to take a vector of relaxed section pointers.
6002 (Output_section::find_merge_section,
6003 Output_section::find_relaxed_input_section,
6004 Output_section::build_relaxation_map,
6005 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6006 New method declarations.
6007 (Output_section::merge_section_map_
6008 Output_section::merge_section_by_properties_map_,
6009 Output_section::relaxed_input_section_map_,
6010 Output_section::is_relaxed_input_section_map_valid_,
6011 Output_section::generate_code_fills_at_write_): New data members.
6012 * script-sections.cc
6013 (Output_section_element_input::set_section_addresses): Call
6014 current_data_size and addralign methods of relaxed input sections.
6015 (Orphan_output_section::set_section_addresses): Call current_data_size
6016 and addralign methods of relaxed input sections.
6017 * symtab.cc (Symbol_table::compute_final_value): Extract template
6018 from the body of Symbol_table::sized_finalize_symbol.
6019 (Symbol_table::sized_finalized_symbol): Call
6020 Symbol_table::compute_final_value.
6021 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6022 (Symbol_table::compute_final_value): New templated method declaration.
6023 * target.cc (Target::do_make_output_section): New method defintion.
6024 * target.h (Target::make_output_section): New method declaration.
6025 (Target::relax): Add more parameters for input objects, symbol table
6026 and layout. Adjust call to do_relax.
6027 (Target::do_make_output_section): New method declaration.
6028 (Target::do_relax): Add parameters for input objects, symbol table
6029 and layout.
6030
6031 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6032
6033 * pread.c: Include stdio.h.
6034
6035 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6036
6037 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6038 defined.
6039
6040 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6041
6042 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6043 Change read_shndx type to unsigned int.
6044 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6045 int.
6046 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6047 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6048 Change read_shndx type to unsigned int.
6049 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6050 int.
6051 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6052 * layout.cc (Layout::create_symtab_sections): Cast the result of
6053 local_symcount * symsize to off_t in the gold_assert.
6054
6055 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6056
6057 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6058 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6059 R_ARM_BASE_ABS.
6060 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6061 (Arm_relocate_functions::thm_abs5): New function.
6062 (Arm_relocate_functions::abs12): New function.
6063 (Arm_relocate_functions::abs16): New function.
6064 (Arm_relocate_functions::base_abs): New function.
6065 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6066 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6067 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6068 R_ARM_BASE_ABS.
6069 (Scan::global): Likewise.
6070 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6071 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6072 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6073 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6074 R_ARM_BASE_ABS.
6075
6076 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6077
6078 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6079 (Arm_relocate_functions::movt_prel): New function.
6080 (Arm_relocate_functions::thm_movw_prel_nc): New function.
6081 (Arm_relocate_functions::thm_movt_prel): New function.
6082 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6083 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6084 (Scan::global, Relocate::relocate): Likewise.
6085 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6086
6087 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6088
6089 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6090 Incremental_checker.
6091 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6092 unsigned int.
6093 (class Incremental_inputs_header): New class.
6094 (Incremental_inputs_header_writer): Edit comment.
6095 (Incremental_inputs_entry): New class.
6096 (Incremental_inputs_entry_writer): Edit comment.
6097 (Sized_incremental_binary::do_find_incremental_inputs_section):
6098 Add *strtab_shndx parameter, fill it.
6099 (Sized_incremental_binary::do_check_inputs): New method.
6100 (Incremental_checker::can_incrementally_link_output_file): Use
6101 Sized_incremental_binary::check_inputs.
6102 (Incremental_inputs::report_command_line): Save command line in
6103 command_line_.
6104 * incremental.h:
6105 (Incremental_binary::find_incremental_inputs_section): New
6106 method.
6107 (Incremental_binary::do_find_incremental_inputs_section): Add
6108 strtab_shndx parameter.
6109 (Incremental_binary::do_check_inputs): New pure virtual method.
6110 (Sized_incremental_binary::do_check_inputs): Declare.
6111 (Incremental_checker::Incremental_checker): Add incremental_inputs
6112 parameter, use it to initialize incremental_inputs_.
6113 (Incremental_checker::incremental_inputs_): New field.
6114 (Incremental_checker::command_line): New method.
6115 (Incremental_checker::inputs): New method.
6116 (Incremental_checker::command_line_): New field.
6117
6118 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
6119
6120 * incremental.cc: Include <cstdarg> and "target-select.h".
6121 (vexplain_no_incremental): New function.
6122 (explain_no_incremental): New function.
6123 (Incremental_binary::error): New method.
6124 (Sized_incremental_binary::do_find_incremental_inputs_section): New
6125 method.
6126 (make_sized_incremental_binary): New function.
6127 (open_incremental_binary): New function.
6128 (can_incrementally_link_file): Add checks if output is ELF and has
6129 inputs section.
6130 * incremental.h: Include "elfcpp_file.h" and "output.h".
6131 (Incremental_binary): New class.
6132 (Sized_incremental_binary): New class.
6133 (open_incremental_binary): Declare.
6134 * object.cc (is_elf_object): Use
6135 elfcpp::Elf_recognizer::is_elf_file.
6136 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6137 * output.h (Output_file::filesize): New method.
6138
6139 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6140
6141 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6142 New function.
6143 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6144 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6145 function.
6146 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6147 function.
6148 (Arm_relocate_functions::movw_abs_nc): New function.
6149 (Arm_relocate_functions::movt_abs): New function.
6150 (Arm_relocate_functions::thm_movw_abs_nc): New function.
6151 (Arm_relocate_functions::thm_movt_abs): New function.
6152 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6153 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6154 (Scan::global): Likewise.
6155 (Relocate::relocate): Likewise.
6156 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6157
6158 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6159
6160 * arm.cc (Arm_relocate_functions::got_prel) New function.
6161 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6162 (Relocate::relocate): Likewise.
6163 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6164
6165 2009-10-06 Ian Lance Taylor <iant@google.com>
6166
6167 * options.h (class General_options): Define
6168 split_stack_adjust_size parameter.
6169 * object.h (class Object): Add uses_split_stack_ and
6170 has_no_split_stack_ fields. Add uses_split_stack and
6171 has_no_split_stack accessor functions. Declare
6172 handle_split_stack_section.
6173 (class Reloc_symbol_changes): Define.
6174 (class Sized_relobj): Define Function_offsets. Declare
6175 split_stack_adjust, split_stack_adjust_reltype, and
6176 find_functions.
6177 * object.cc (Object::handle_split_stack_section): New function.
6178 (Sized_relobj::do_layout): Call handle_split_stack_section.
6179 * dynobj.cc (Sized_dynobj::do_layout): Call
6180 handle_split_stack_section.
6181 * reloc.cc (Sized_relobj::relocate_sections): Call
6182 split_stack_adjust for executable sections in split_stack
6183 objects. Pass reloc_map to relocate_section.
6184 (Sized_relobj::split_stack_adjust): New function.
6185 (Sized_relobj::split_stack_adjust_reltype): New function.
6186 (Sized_relobj::find_functions): New function.
6187 * target-reloc.h: Include "object.h".
6188 (relocate_section): Add reloc_symbol_changes parameter. Change
6189 all callers.
6190 * target.h (class Target): Add calls_non_split method. Declare
6191 do_calls_non_split virtual method. Declare match_view and
6192 set_view_to_nop.
6193 * target.cc: Include "elfcpp.h".
6194 (Target::do_calls_non_split): New function.
6195 (Target::match_view): New function.
6196 (Target::set_view_to_nop): New function.
6197 * gold.cc (queue_middle_tasks): Give an error if mixing
6198 split-stack and non-split-stack objects with -r.
6199 * i386.cc (Target_i386::relocate_section): Add
6200 reloc_symbol_changes parameter.
6201 (Target_i386::do_calls_non_split): New function.
6202 * x86_64.cc (Target_x86_64::relocate_section): Add
6203 reloc_symbol_changes parameter.
6204 (Target_x86_64::do_calls_non_split): New function.
6205 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6206 parameter.
6207 * powerpc.cc (Target_powerpc::relocate_section): Add
6208 reloc_symbol_changes parameter.
6209 * sparc.cc (Target_sparc::relocate_section): Add
6210 reloc_symbol_changes parameter.
6211 * configure.ac: Call AM_CONDITIONAL for the default target.
6212 * configure: Rebuild.
6213 * testsuite/Makefile.am (TEST_AS): New variable.
6214 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6215 (check_DATA): Add split_i386 and split_x86_64 files.
6216 (SPLIT_DEFSYMS): Define.
6217 (split_i386_[1234n].o): New targets.
6218 (split_i386_[124]): New targets.
6219 (split_i386_[1234r].stdout): New targets.
6220 (split_x86_64_[1234n].o): New targets.
6221 (split_x86_64_[124]): New targets.
6222 (split_x86_64_[1234r].stdout): New targets.
6223 (MOSTLYCLEANFILES): Add new executables.
6224 * testsuite/split_i386.sh: New file.
6225 * testsuite/split_x86_64.sh: New file.
6226 * testsuite/split_i386_1.s: New file.
6227 * testsuite/split_i386_2.s: New file.
6228 * testsuite/split_i386_3.s: New file.
6229 * testsuite/split_i386_4.s: New file.
6230 * testsuite/split_i386_n.s: New file.
6231 * testsuite/split_x86_64_1.s: New file.
6232 * testsuite/split_x86_64_2.s: New file.
6233 * testsuite/split_x86_64_3.s: New file.
6234 * testsuite/split_x86_64_4.s: New file.
6235 * testsuite/split_x86_64_n.s: New file.
6236 * testsuite/testfile.cc (Target_test): Update relocation_section
6237 function.
6238 * testsuite/Makefile.in: Rebuild.
6239
6240 2009-10-06 Ian Lance Taylor <iant@google.com>
6241
6242 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6243 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6244 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
6245 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6246 the address on ldo_addrs_.
6247 (Target_i386::Relocate::fix_up_ldo): New function.
6248
6249 2009-10-06 Rafael Espindola <espindola@google.com>
6250
6251 * plugin.cc (add_input_library): New.
6252 (Plugin::load): Add add_input_library to tv.
6253 (Plugin_manager::add_input_file): Add the is_lib argument.
6254 (add_input_file): Update call to Plugin_manager::add_input_file.
6255 (add_input_library): New.
6256 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6257
6258 2009-09-30 Doug Kwan <dougkwan@google.com>
6259
6260 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6261 symbol and call Symbol::may_need_copy_reloc to determine if
6262 a copy reloc is needed.
6263 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6264 nocopyreloc is given in command line.
6265 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6266 given in command line.
6267 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6268 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6269 of the removed Target_i386::may_need_copy_reloc.
6270 * options.h (copyreloc): New option with default value false.
6271 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6272 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6273 instead of the removed Target_powerpc::may_need_copy_reloc.
6274 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6275 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6276 instead of the removed Target_sparc::may_need_copy_reloc.
6277 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6278 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6279 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6280 instead of the removed Target_x86_64::may_need_copy_reloc.
6281
6282 2009-09-30 Ian Lance Taylor <iant@google.com>
6283
6284 * object.h (class Object): Remove target_ field, and target,
6285 sized_target, and set_target methods.
6286 (Object::sized_target): Remove.
6287 (class Sized_relobj): Update declarations. Remove sized_target.
6288 * object.cc (Sized_relobj::setup): Remove target parameter.
6289 Change all callers.
6290 (Input_objects::add_object): Don't do anything with the target.
6291 (make_elf_sized_object): Add punconfigured parameter. Change all
6292 callers. Set or test parameter target.
6293 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6294 Change all callers.
6295 * parameters.cc (Parameters::set_target): Change parameter type to
6296 be non-const.
6297 (Parameters::default_target): Remove.
6298 (set_parameters_target): Change parameter type to be non-const.
6299 (parameters_force_valid_target): New function.
6300 (parameters_clear_target): New function.
6301 * parameters.h (class Parameters): Update declarations. Remove
6302 default_target method. Add sized_target and clear_target
6303 methods. Change target_ to be non-const.
6304 (set_parameters_target): Update declaration.
6305 (parameters_force_valid_target): Declare.
6306 (parameters_clear_target): Declare.
6307 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6308 as NULL if we aren't searching.
6309 (Add_symbols::run): Don't check for compatible target.
6310 * fileread.cc (Input_file::open_binary): Call
6311 parameters_force_valid_target.
6312 * gold.cc (queue_middle_tasks): Likewise.
6313 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
6314 set_target on object.
6315 * dynobj.h (class Sized_dynobj): Update declarations.
6316 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6317 make_elf_object returns NULL.
6318 (Archive::include_member): Don't check whether object target is
6319 compatible.
6320 * output.cc (Output_section::add_input_section): Get target from
6321 parameters.
6322 (Output_section::relax_input_section): Likewise.
6323 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6324 parameters.
6325 (Sized_relobj::do_scan_relocs): Likewise.
6326 (Sized_relobj::relocate_sections): Likewise.
6327 * resolve.cc (Symbol_table::resolve): Likewise.
6328 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
6329 parameter. Change all callers.
6330 (Symbol_table::add_from_object): Get target from parameters.
6331 (Symbol_table::add_from_relobj): Don't check object target.
6332 (Symbol_table::add_from_dynobj): Likewise.
6333 (Symbol_table::define_special_symbol): Get target from
6334 parameters.
6335 * symtab.h (class Symbol_table): Update declaration.
6336 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6337 parameter. Change all callers. Clear parameter target.
6338 (Binary_test): Test target here.
6339 * testsuite/object_unittest.cc (gold_testsuite): Remove
6340 target_test_pointer parameter. Change all callers.
6341 (Object_test): Test target here.
6342
6343 2009-09-26 Ian Lance Taylor <iant@google.com>
6344
6345 * testsuite/initpri1.c: Don't try to use constructor priorities if
6346 compiling with gcc before 4.3.
6347
6348 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
6349
6350 * testsuite/retain_symbols_file_test.sh (check_present): Change
6351 output file name to retain_symbols_file_test.stdout.
6352 (check_absent): Likewise.
6353
6354 2009-09-18 Craig Silverstein <csilvers@google.com>
6355
6356 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6357 * options.cc: Include <cerrno> and <fstream>.
6358 (General_options::finalize): Parse -retain-symbols-file tag.
6359 * options.h: New flag.
6360 (General_options): New method should_retain_symbol, new
6361 variable symbols_to_retain.
6362 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6363 should_retain_symbol map.
6364 * testsuite/Makefile.am (retain_symbols_file_test): New test.
6365 * testsuite/Makefile.in: Regenerate.
6366 * testsuite/retain_symbols_file_test.sh: New file.
6367
6368 2009-09-18 Nick Clifton <nickc@redhat.com>
6369
6370 * po/es.po: Updated Spanish translation.
6371
6372 2009-09-17 Doug Kwan <dougkwan@google.com>
6373
6374 * debug.h (DEBUG_RELAXATION): New constant.
6375 (DEBUG_ALL): Add DEBUG_RELAXATION.
6376 (debug_string_to_enum): Add relaxation debug option.
6377 * layout.cc
6378 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6379 Layout::Relaxation_debug_check::read_sections,
6380 Layout::Relaxation_debug_check::read_sections): New method definitions.
6381 (Layout::Layout): Initialize data members
6382 record_output_section_data_from_scrips_,
6383 script_output_section_data_list_ and relaxation_debug_check_.
6384 (Layout::save_segments, Layout::restore_segments,
6385 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6386 Layout::relaxation_loop_body): New method definitions.
6387 (Layout::finalize): Support relaxation. Move section layout code to
6388 Layout::relaxation_loop_body.
6389 (Layout::set_asection_address_from_script): Move code for orphan
6390 section placement out.
6391 (Layout::place_orphan_sections_in_script): New method definition.
6392 * layout.h (Output_segment_headers, Output_file_header):
6393 New forward class declarations.
6394 (Layout::~Layout): Define.
6395 (Layout::new_output_section_data_from_script): New method definition.
6396 (Layout::place_orphan_sections_in_script): New method declaration.
6397 (Layout::Segment_states): New type declaration.
6398 (Layout::save_segments, Layout::restore_segments,
6399 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6400 Layout::relaxation_loop_body): New method declarations.
6401 (Layout::Output_section_data_list): New type declaration.
6402 (Layout::Relaxation_debug_check): New class definition.
6403 (Layout::record_output_section_data_from_script_,
6404 Layout::script_output_section_data_list_, Layout::segment_states_,
6405 Layout::relaxation_debug_check_): New data members.
6406 * output.cc: (Output_section_headers::do_size): New method definition.
6407 (Output_section_headers::Output_section_headers): Move size
6408 computation to Output_section_headers::do_size.
6409 (Output_segment_headers::do_size): New method definition.
6410 (Output_file_header::Output_file_header): Move size computation to
6411 Output_file_header::do_size and call it.
6412 (Output_file_header::do_size): New method definition.
6413 (Output_data_group::Output_data_group): Adjust call to
6414 Output_section_data.
6415 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6416 (Output_symtab_xindex::do_write): Add array bound check.
6417 (Output_section::Input_section::print_to_mapfile): Handle
6418 RELAXED_INPUT_SECTION_CODE.
6419 (Output_section::Output_section): Initialize data member checkpoint_.
6420 (Output_section::~Output_section): Delete checkpoint object pointed
6421 by checkpoint_.
6422 (Output_section::add_input_section): Always add an Input_section if
6423 relaxing.
6424 (Output_section::add_merge_input_section): Add assert.
6425 (Output_section::relax_input_section): New method definition.
6426 (Output_section::set_final_data_size): Set load address to zero for
6427 an unallocated section.
6428 (Output_section::do_address_and_file_offset_have_reset_values):
6429 New method definition.
6430 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6431 Handle relaxed input section.
6432 (Output_section::sort_attached_input_sections): Checkpoint input
6433 section list lazily.
6434 (Output_section::get_input_sections): Change type of input_sections to
6435 list of Simple_input_section pointers. Checkpoint input section list
6436 lazily. Also handle relaxed input sections.
6437 (Output_section::add_input_section_for_script): Take a reference to
6438 a Simple_input_section object instead of Relobj pointer and section
6439 index as parameter. Handle relaxed input sections.
6440 (Output_section::save_states, Output_section::restore_states): New
6441 method definitions.
6442 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6443 (Output_data::is_data_size_fixed): New method definition.
6444 (Output_data::reset_addresss_and_file_offset): Do not reset data size
6445 if it is fixed.
6446 (Output_data::address_and_file_offset_have_reset_values): New method
6447 definition.
6448 (Output_data::do_address_and_file_offset_have_reset_values): New method
6449 definition.
6450 (Output_data::set_data_size): Check that data size is not fixed.
6451 (Output_data::fix_data_size): New method definition.
6452 (Output_data::is_data_size_fixed_): New data member.
6453 (Output_section_headers::set_final_data_size): New method definition.
6454 (Output_section_headers::do_size): New method declaration.
6455 (Output_segment_headers::set_final_data_size): New method definition.
6456 (Output_segment_headers::do_size): New method declaration.
6457 (Output_file_header::set_final_data_size)::New method definition.
6458 (Output_file_header::do_size)::New method declaration.
6459 (Output_section_data::Output_section_data): Add new parameter
6460 is_data_size_fixed and use it to fix data size.
6461 (Output_data_const::Output_data_const): Adjust call to base class
6462 constructor and fix data size.
6463 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6464 base class constructor and fix data size.
6465 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6466 base class constructor and fix data size.
6467 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6468 class constructor and fix data size.
6469 (Output_data_group::set_final_data_size): New method definition.
6470 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6471 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6472 class constructor and fix data size.
6473 (Output_relaxed_input_section): New class definition.
6474 (Output_section::Simple_input_section): New class definition.
6475 (Output_section::get_input_sections): Adjust parameter list.
6476 (Output_section::add_input_section_for_script): Same.
6477 (Output_section::save_states, Output_section::restore_states,
6478 Output_section::do_address_and_file_offset_have_reset_values,
6479 (Output_section::Input_section::Input_section): Handle
6480 RELAXED_INPUT_SECTION_CODE. Add new overload for
6481 Output_relaxed_input_section.
6482 (Output_section::Input_section::is_input_section,
6483 Output_section::Input_section::set_output_section): Handle relaxed
6484 input section.
6485 (Output_section::Input_section::is_relaxed_input_section,
6486 Output_section::Input_section::output_section_data,
6487 Output_section::Input_section::relaxed_input_section): New method
6488 definitions.
6489 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6490 value.
6491 (Output_section::Input_section::u1_): Update comments.
6492 (Output_section::Input_section::u2_): Add new union member poris.
6493 (Output_section::Checkpoint_output_section): New classs definition.
6494 (Output_section::relax_input_section): New method declaration.
6495 (Output_section::checkpoint_): New data member.
6496 (Output_segment): Update comments.
6497 (Output_segment::Output_segment): Un-privatize copy constructor.
6498 (Output_segment::operator=): Un-privatize.
6499 * script-sections.cc (Output_section_element::Input_section_list):
6500 Change element type to Output_section::Simple_input_section.
6501 (Output_section_element_dot_assignment::set_section_addresses):
6502 Register output section data for relaxation clean up.
6503 (Output_data_exression::Output_data_expression): Adjust call to base
6504 constructor to fix data size.
6505 (Output_section_element_data::set_section_addresses): Register
6506 Output_data_expression object for relaxation clean up.
6507 (struct Input_section_info): Replace Relobj pointer and section index
6508 pair with Output_section::Simple_input_section and Convert struct to a
6509 class.
6510 (Input_section_sorter::operator()): Adjust access to
6511 Input_section_info data member to use accessors.
6512 (Output_section_element_input::set_section_addresses): Use layout
6513 parameter. Adjust code to use Output_section::Simple_input_section
6514 and Input_secction_info classes. Register filler for relaxation
6515 clean up.
6516 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6517 and section index pair with Output_section::Simple_input_section
6518 class. Adjust code accordingly.
6519 (Phdrs_element::release_segment): New method definition.
6520 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6521 segment list.
6522 (Script_sections::release_segments): New method definition.
6523 * gold/script-sections.h (Script_sections::release_segments): New
6524 method declaration.
6525 * gold/target.h (Target::may_relax, Target::relax,
6526 Target::do_may_relax, Target::do_relax): New method definitions.
6527
6528 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6529
6530 * arm.cc (has_signed_unsigned_overflow): New function.
6531 (Arm_relocate_functions::abs8): New function.
6532 (Target_arm::Scan::local): Handle R_ARM_ABS8.
6533 (Target_arm::Scan::global): Likewise.
6534 (Target_arm::relocate::relocate): Likewise.
6535 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6536 Likewise.
6537
6538 2009-09-16 Cary Coutant <ccoutant@google.com>
6539
6540 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6541 * testsuite/Makefile.in: Regenerate.
6542
6543 2009-09-11 Nick Clifton <nickc@redhat.com>
6544
6545 * po/gold.pot: Updated by the Translation project.
6546
6547 2009-09-08 Cary Coutant <ccoutant@google.com>
6548
6549 * output.cc (Output_file::open): Add execute permission to empty file.
6550 * testsuite/Makefile.am (permission_test): New test.
6551 * testsuite/Makefile.in: Regenerate.
6552
6553 2009-09-02 Ian Lance Taylor <iant@google.com>
6554
6555 * output.cc (Output_file::resize): Call map_no_anonymous rather
6556 than map.
6557
6558 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
6559
6560 * gold.cc: Include "incremental.h".
6561 (queue_initial_tasks): Call Incremental_checker methods.
6562 * incremental.cc: Include "output.h".
6563 (Incremental_checker::can_incrementally_link_output_file): New
6564 method.
6565 * incremental.h (Incremental_checker): New class.
6566
6567 * output.cc (Output_file::open_for_modification): New method.
6568 (Output_file::map_anonymous): Changed return type to bool. Record
6569 map in base_ field.
6570 (Output_file::map_no_anonymous): New method, broken out of map.
6571 (Output_file::map): Use map_no_anonymous and map_anonymous.
6572 * output.h (class Output_file): Update declarations.
6573
6574 2009-08-24 Cary Coutant <ccoutant@google.com>
6575
6576 * options.h (Command_line::Pre_options): New class.
6577 (Command_line::pre_options): New member.
6578 * options.cc (gold::options::ready_to_register): New variable.
6579 (One_option::register_option): Do nothing if not registering options.
6580 Assert if same short option registered twice.
6581 (General_options::General_options): Turn off option registration when
6582 done constructing.
6583 (Command_line::Pre_options::Pre_options): New constructor.
6584
6585 2009-08-24 Cary Coutant <ccoutant@google.com>
6586
6587 * options.h (General_options::no_keep_memory): Remove incorrect
6588 short option.
6589
6590 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6591
6592 * Makefile.am (am__skiplex, am__skipyacc): New.
6593 * Makefile.in: Regenerate.
6594
6595 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6596
6597 * Makefile.am (AM_CPPFLAGS): Renamed from ...
6598 (INCLUDES): ... this.
6599 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6600 (AM_CPPFLAGS): Renamed from ...
6601 (INCLUDE): ... this.
6602 * Makefile.in, testsuite/Makefile.in: Regenerate.
6603
6604 * Makefile.in: Regenerate.
6605 * aclocal.m4: Likewise.
6606 * config.in: Likewise.
6607 * configure: Likewise.
6608 * testsuite/Makefile.in: Likewise.
6609
6610 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6611 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6612 * Makefile.in: Regenerate.
6613 * testsuite/Makefile.in: Regenerate.
6614
6615 2009-08-19 Cary Coutant <ccoutant@google.com>
6616
6617 * resolve.cc (Symbol_table::resolve): Don't complain about defined
6618 symbols in shared libraries overridden by hidden or internal symbols
6619 in the main program.
6620
6621 2009-08-19 Chris Demetriou <cgd@google.com>
6622
6623 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6624 checking source file names in error messages.
6625
6626 2009-08-18 Doug Kwan <dougkwan@google.com>
6627
6628 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6629 an elcpp::Ehdr as parameter. Adjust call to set_target.
6630 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6631 an elfcpp::Ehdr as parameter.
6632 * object.cc (Object::set_target): Remove the version that looks up
6633 a target and sets it.
6634 (Sized_relobj::setup): Take a Target object instead of
6635 an elfcpp::Ehdr as parameter. Adjust call to set_target.
6636 (make_elf_sized_object): Find target and ask target to
6637 make an ELF object.
6638 * object.h: (Object::set_target): Remove the version that looks up
6639 a target and sets it.
6640 (Sized_relobj::setup): Take a Target object instead of
6641 an elfcpp:Ehdr as parameter.
6642 * target.cc: Include dynobj.h.
6643 (Target::do_make_elf_object_implementation): New.
6644 (Target::do_make_elf_object): New.
6645 * target.h (Target::make_elf_object): New template declaration.
6646 (Target::do_make_elf_object): New method declarations.
6647 (Target::do_make_elf_object_implementation): New template declaration.
6648
6649 2009-08-14 Ian Lance Taylor <iant@google.com>
6650
6651 * gold.h (FUNCTION_NAME): Define.
6652 (gold_unreachable): Use FUNCTION_NAME.
6653
6654 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6655
6656 * icf.cc (Icf::find_identical_sections): Issue a warning when a
6657 symbol in the --keep-unique list is not found.
6658
6659 2009-08-12 Sriraman Tallam <tmsriram@google.com>
6660
6661 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6662 been maked as --keep-unique.
6663 (Icf::unfold_section): New function.
6664 * icf.h (Icf::unfold_section): New function.
6665 * options.h (General_options::keep_unique): New option.
6666 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6667 * testsuite/Makefile.in: Regenerate.
6668 * testsuite/icf_keep_unique_test.sh: New file.
6669 * testsuite/icf_keep_unique_test.cc: New file.
6670
6671 2009-08-12 Cary Coutant <ccoutant@google.com>
6672
6673 PR 10471
6674 * resolve.cc (Symbol_table::resolve): Check for references from
6675 dynamic objects to hidden and internal symbols.
6676 * testsuite/Makefile.am (hidden_test.sh): New test.
6677 * testsuite/Makefile.in: Regenerate.
6678 * testsuite/hidden_test.sh: New script.
6679 * testsuite/hidden_test_1.c: New test source.
6680 * testsuite/hidden_test_main.c: New test source.
6681
6682 2009-08-11 Doug Kwan <dougkwan@google.com>
6683
6684 * arm.cc: Update comments.
6685 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6686 segment to locate the .ARM.exidx section if present.
6687
6688 2009-08-09 Doug Kwan <dougkwan@google.com>
6689
6690 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6691 patch.
6692
6693 2009-08-07 Sriraman Tallam <tmsriram@google.com>
6694 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6695 compiler warnings.
6696
6697 2009-08-06 Sriraman Tallam <tmsriram@google.com>
6698
6699 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6700 valid tls_segment only for non-debug-section relocations.
6701 * testsuite/Makefile.am: Add gc_tls_test.
6702 * testsuite/Makefile.in: Regenerate.
6703 * testsuite/gc_tls_test.cc: New file.
6704 * testsuite/gc_tls_test.sh: New file.
6705
6706 2009-08-05 Sriraman Tallam <tmsriram@google.com>
6707
6708 * icf.cc: New file.
6709 * icf.h: New file.
6710 * Makefile.am (CCFILES): Add icf.cc.
6711 (HFILES): Add icf.h
6712 * Makefile.in: Regenerate.
6713 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6714 * gc.h (gc_process_relocs): Populate lists used by icf to contain
6715 section, symbol and addend information for the relocs.
6716 * gold.cc (queue_middle_tasks): Call identical code folding.
6717 * gold.h: Add defines for multimap.
6718 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6719 to the call of finalize_local_symbols.
6720 * main.cc (main): Create object of class Icf.
6721 * object.cc (Sized_relobj::do_layout): Allow this function to be
6722 called twice during icf.
6723 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6724 to sections marked as identical by icf.
6725 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6726 when available.
6727 (Sized_relobj::do_section_entsize): New function.
6728 * object.h (Object::section_entsize): New function.
6729 (Object::do_section_entsize): New pure virtual function.
6730 (Relobj::finalize_local_symbols): Add new parameter.
6731 (Relobj::do_section_entsize): New function.
6732 * options.h (General_options::icf): New option.
6733 (General_options::icf_iterations): New option.
6734 (General_options::print_icf_sections): New option.
6735 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6736 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6737 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6738 icf.
6739 * symtab.cc (Symbol_table::is_section_folded): New function.
6740 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
6741 to sections marked as identical by icf.
6742 * symtab.h (Symbol_table::set_icf): New function.
6743 (Symbol_table::icf): New function.
6744 (Symbol_table::is_section_folded): New function.
6745 (Symbol_table::icf_): New data member.
6746 * target-reloc.h (relocate_section): Ignore sections folded by icf.
6747 * testsuite/Makefile.am: Add commands to build icf_test.
6748 * testsuite/Makefile.in: Regenerate.
6749 * testsuite/icf_test.sh: New file.
6750 * testsuite/icf_test.cc: New file.
6751
6752 2009-07-24 Chris Demetriou <cgd@google.com>
6753
6754 * layout.cc (is_compressible_debug_section): Fix incorrect
6755 comment about compressed section names.
6756
6757 2009-07-20 Ian Lance Taylor <ian@airs.com>
6758
6759 PR 10419
6760 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6761
6762 2009-07-16 Ian Lance Taylor <iant@google.com>
6763
6764 PR 10400
6765 * layout.h: #include <map>.
6766 (class Kept_section): Change from struct to class. Add accessors
6767 and setters. Add section size to Comdat_group mapping. Change
6768 Comdat_group to std::map. Add is_comdat_ field. Add
6769 linkonce_size field in union.
6770 (class Layout): Update declaration of find_or_add_kept_section.
6771 Don't declare find_kept_object.
6772 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6773 parameter. Add object, shndx, is_comdat, and is_group_name
6774 parameters. Change all callers. Adjust for new Kept_section.
6775 (Layout::find_kept_object): Remove.
6776 * object.cc (Sized_relobj::include_section_group): Update use of
6777 Kept_section. Rename secnum to shndx. Only record
6778 Kept_comdat_section if sections are the same size.
6779 (Sized_relobj::include_linkonce_section): Update use of
6780 Kept_section. Only record Kept_comdat_section if sections are the
6781 same size. Set size of linkonce section.
6782 (Sized_relobj::map_to_kept_section): Update call to
6783 get_kept_comdat_section.
6784 * object.h (class Sized_relobj): Rename fields in
6785 Kept_comdat_section to drop trailing underscores; change object
6786 field to Relobj*. Change Kept_comdat_section_table to store
6787 struct rather than pointer.
6788 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6789 Add kept_object and kept_shndx parameters. Change all callers.
6790 (Sized_relobj::get_kept_comdat_section): Change return type to
6791 bool. Add kept_object and kept_shndx parameters. Change all
6792 callers.
6793 * plugin.cc (Pluginobj::include_comdat_group): Update call to
6794 Layout::find_or_add_kept_section.
6795
6796 2009-07-09 Ian Lance Taylor <iant@google.com>
6797
6798 * merge.cc (Object_merge_map::initialize_input_to_output_map):
6799 Reserve space in the hash table.
6800
6801 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
6802
6803 * fileread.cc (File_read::get_mtime): New method.
6804 * fileread.h (Timespec): New structure.
6805 (File_read::get_mtime): New method.
6806 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6807 Renamed from timestamp_nsec.
6808 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6809 Elf_Xword.
6810 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6811 timestamp_nsec.
6812 (Incremental_inputs::report_archive): Save mtime; style fix.
6813 (Incremental_inputs::report_obejct): Save mtime; style fix.
6814 (Incremental_inputs::report_script): Save mtime; style fix.
6815 (Incremental_inputs::finalize_inputs): Style fix.
6816 (Incremental_inputs::finalize): Style fix.
6817 (Incremental_inputs::create_input_section_data): Store inputs
6818 mtime.
6819 * incremental.h (Incremental_inputs::report_script): Add mtime
6820 argument.
6821 (Incremental_inputs::Input_info::Input_info): Intialize only one
6822 union member.
6823 (Incremental_inputs::Input_info::archive): Move to nameless
6824 union.
6825 (Incremental_inputs::Input_info::obejct): Move to nameless union.
6826 (Incremental_inputs::Input_info::script): Move to nameless union.
6827 (Incremental_inputs::mtime): New field.
6828 * script.cc (read_input_script): Pass file mtime to
6829 Incremental_input.
6830 * script.h (Script_info::inputs): Style fix.
6831
6832 2009-07-01 Ian Lance Taylor <ian@airs.com>
6833
6834 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6835 instead of 32.
6836
6837 2009-06-24 Ian Lance Taylor <iant@google.com>
6838
6839 PR 10156
6840 * layout.cc (Layout::choose_output_section): If we find an
6841 existing section, update the flags.
6842 (Layout::create_notes): New function, broken out of
6843 Layout::finalize.
6844 (Layout::finalize): Don't create note sections.
6845 (Layout::create_note): Don't crash if linker script discards
6846 section.
6847 (Layout::create_gold_note): Likewise.
6848 (Layout::create_build_id): Likewise. Don't set
6849 after_input_sections on the section.
6850 (Layout::create_executable_stack_info): Remove target parameter.
6851 Change caller.
6852 * layout.h (class Layout): Declare create_notes. Update
6853 declaration of create_executable_stack_info.
6854 * gold.cc (queue_middle_tasks): Call create_notes.
6855 * output.cc (Output_section::update_flags_for_input_section): Move
6856 here from output.h. If SHF_ALLOC flag is newly set, mark address
6857 invalid.
6858 * output.h (Output_data::mark_address_invalid): New function.
6859 (class Output_section): Only declare, not define,
6860 update_flags_for_input_section. Remove set_flags.
6861
6862 2009-06-24 Ian Lance Taylor <iant@google.com>
6863
6864 * script-sections.cc (Output_section_definition::
6865 set_section_addresses): Rename shadowing local load_address to
6866 laddr.
6867
6868 2009-06-24 Ian Lance Taylor <iant@google.com>
6869
6870 PR 10244
6871 * reloc.cc (relocate_sections): Skip empty relocation sections.
6872
6873 2009-06-23 Ian Lance Taylor <iant@google.com>
6874
6875 PR 10156
6876 * layout.cc (Layout::create_note): Use choose_output_section
6877 rather than make_output_section.
6878
6879 2009-06-23 Ian Lance Taylor <iant@google.com>
6880
6881 PR 10237
6882 * options.cc (General_options::parse_V): Set printed_version_.
6883 (General_options::General_options): Initialize printed_version_.
6884 * options.h (class General_options): Add printed_version_ field.
6885 * gold.cc (queue_initial_tasks): If there are no input files,
6886 don't give a fatal error if we printed the version information.
6887 (queue_middle_tasks): If using -r with a shared object, give a
6888 fatal error rather than an ordinary error.
6889
6890 2009-06-23 Ian Lance Taylor <iant@google.com>
6891
6892 PR 10219
6893 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6894 (Layout::make_output_section): Set have_stabstr_section_ if we see
6895 a .stab*str section.
6896 (Layout::finalize): Call link_stabs_sections.
6897 (Layout::link_stabs_sections): New file.
6898 * layout.h (class Layout): Add have_stabstr_section_ field.
6899 Declare link_stabs_sections.
6900
6901 2009-06-23 Doug Kwan <dougkwan@google.com>
6902
6903 * Makefile.am (libgold_a_LIBADD): New.
6904 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6905 * Makefile.in: Regenerate.
6906 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6907 * configure: Regenerate.
6908 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6909 * fileread.cc: Include sys/state.h
6910 * gold.h: Declare memmem and strndup if found missing.
6911 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6912
6913 2009-06-23 Ian Lance Taylor <iant@google.com>
6914
6915 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6916 * configure: Rebuild.
6917
6918 2009-06-23 Ian Lance Taylor <iant@google.com>
6919
6920 PR 10147
6921 * object.cc (Object::section_contents): Don't try to get a view if
6922 the section has length zero.
6923 (Object::handle_gnu_warning_section): If the section is empty, use
6924 the name of the section as the warning.
6925
6926 2009-06-23 Ian Lance Taylor <iant@google.com>
6927
6928 PR 10133
6929 * stringpool.h (class Stringpool_template): Add optimize_ field.
6930 (Stringpool_template::set_optimize): New function.
6931 * stringpool.cc (Stringpool_template::Stringpool_template):
6932 Initialize optimize_ field.
6933 (Stringpool_template::set_string_offsets): Test local optimize
6934 fild rather than parameter.
6935 * layout.cc (Layout::Layout): Call set_optimize on the section
6936 name stringpool.
6937
6938 2009-06-22 Ian Lance Taylor <iant@google.com>
6939
6940 PR 10030
6941 * yyscript.y: Parse TARGET.
6942 * script.cc (script_set_target): New function.
6943 * script-c.h (script_set_target): Declare.
6944 * options.cc (General_options::string_to_object_format): Rename
6945 from string_to_object_format in anonymous namespace. Change
6946 callers.
6947 * options.h (class General_options): Declare
6948 string_to_object_format.
6949
6950 2009-06-22 Ian Lance Taylor <iant@google.com>
6951
6952 * script-sections.cc (Script_sections::create_segments): Don't put
6953 program headers in a PT_LOAD segment if -n or -N.
6954
6955 2009-06-22 Ian Lance Taylor <iant@google.com>
6956
6957 PR 10141
6958 * options.h (class General_options): Add -z lazy and -z now. Sort
6959 -z options into alphabetical order.
6960 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6961
6962 2009-06-21 Ian Lance Taylor <iant@google.com>
6963
6964 * layout.cc (Layout::make_output_section): Call
6965 Target::new_output_section.
6966 (Layout::attach_allocated_section_to_segment): Put large section
6967 sections in a separate load segment with the large segment flag
6968 set.
6969 (Layout::segment_precedes): Sort large data segments after other
6970 load segments.
6971 (align_file_offset): New static function.
6972 (Layout::set_segment_offsets): Use align_file_offset.
6973 * output.h (class Output_section): Add is_small_section_ and
6974 is_large_section_ fields.
6975 (Output_section::is_small_section): New function.
6976 (Output_section::set_is_small_section): New function.
6977 (Output_section::is_large_section): New function.
6978 (Output_section::set_is_large_section): New function.
6979 (Output_section::is_large_data_section): New function.
6980 (class Output_segment): Add is_large_data_segment_ field.
6981 (Output_segment::is_large_data_segment): New function.
6982 (Output_segment::set_is_large_data_segment): New function.
6983 * output.cc (Output_section::Output_section): Initialize new
6984 fields.
6985 (Output_segment::Output_segment): Likewise.
6986 (Output_segment::add_output_section): Add assertion that large
6987 data sections always go in large data segments. Force small data
6988 sections to the end of the list of data sections. Force small BSS
6989 sections to the start of the list of BSS sections. For large BSS
6990 sections to the end of the list of BSS sections.
6991 * symtab.h (class Symbol): Declare is_common_shndx.
6992 (Symbol::is_defined): Check Symbol::is_common_shndx.
6993 (Symbol::is_common): Likewise.
6994 (class Symbol_table): Define enum Commons_section_type. Update
6995 declarations. Add small_commons_ and large_commons_ fields.
6996 * symtab.cc (Symbol::is_common_shndx): New function.
6997 (Symbol_table::Symbol_table): Initialize new fields.
6998 (Symbol_table::add_from_object): Put small and large common
6999 symbols in the right list.
7000 (Symbol_table::sized_finalized_symbol): Check
7001 Symbol::is_common_shndx.
7002 (Symbol_table::sized_write_globals): Likewise.
7003 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7004 common symbol lists. Don't call do_allocate_commons_list if the
7005 list is empty.
7006 (Symbol_table::do_allocate_commons_list): Remove is_tls
7007 parameter. Add comons_section_type parameter. Change all
7008 callers. Handle small and large common symbols.
7009 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7010 Symbol::is_common_shndx.
7011 * resolve.cc (symbol_to_bits): Likewise.
7012 * target.h (Target::small_common_shndx): New function.
7013 (Target::small_common_section_flags): New function.
7014 (Target::large_common_shndx): New function.
7015 (Target::large_common_section_flags): New function.
7016 (Target::new_output_section): New function.
7017 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7018 small_common_section_flags, and large_common_section_flags
7019 fields.
7020 (Target::do_new_output_section): New virtual function.
7021 * arm.cc (Target_arm::arm_info): Initialize new fields.
7022 * i386.cc (Target_i386::i386_info): Likewise.
7023 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7024 Likewise.
7025 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7026 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7027 (Target_x86_64::do_new_output_section): New function.
7028 * configure.ac: Define conditional MCMODEL_MEDIUM.
7029 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7030 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7031 (large_LDFLAGS): Define.
7032 * testsuite/large.c: New file.
7033 * testsuite/testfile.cc (Target_test::test_target_info):
7034 Initialize new fields.
7035 * configure, testsuite/Makefile.in: Rebuild.
7036
7037 2009-06-05 Doug Kwan <dougkwan@google.com>
7038
7039 * Makefile.am (CCFILES): Add target.cc.
7040 * Makefile.in: Regenerate.
7041 * i386.cc (class Target_i386): Define new virtual method to
7042 override do_is_local_label_name in parent.
7043 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7044 local symbols if --discard-locals or -X is given.
7045 * options.h (class General_options): Declare new options
7046 '--discard-locals' and '-X' for discarding locals.
7047 * target.h (class Target): Define new methods is_local_label_name.
7048 Declare new virtual method do_is_local_label_name.
7049 * target.cc: New file.
7050 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7051 (check_SCRIPTS): Add discard_locals_test.sh.
7052 (check_DATA): Add discard_local_tests.syms.
7053 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7054 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7055 * testsuite/Makefile.in: Regenerate.
7056 * testsuite/discard_locals_test.c: New file.
7057 * testsuite/discard_locals_test.sh: Same.
7058
7059 2009-06-05 Doug Kwan <dougkwan@google.com>
7060
7061 * object.cc (Sized_relobj::Sized_relobj): Initialize
7062 discarded_eh_frame_shndx_ to -1U.
7063 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7064 section.
7065 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7066 a discarded .eh_frame section.
7067 (Sized_relobj::do_finalize_local_symbols): Ditto.
7068 * object.h (class Sized_relobj): Declare new member
7069 discarded_eh_frame_shndx_.
7070 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7071 (local_labels_test.o, local_labels_test): New rules.
7072 * testsuite/Makefile.in: Regenerate.
7073
7074 2009-06-04 Doug Kwan <dougkwan@google.com>
7075
7076 * layout.cc (Layout::section_name_mapping): Add mapping for
7077 special ARM sections.
7078
7079 2009-06-03 Doug Kwan <dougkwan@google.com>
7080
7081 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7082 (utils::has_overflow): Same.
7083
7084 2009-06-03 Ian Lance Taylor <iant@google.com>
7085
7086 * layout.cc (Layout::section_name_mapping): New array, replacing
7087 Layout::linkonce_mapping.
7088 (Layout::section_name_mapping_count): New variable, replacing
7089 Layout::linkonce_mapping_count.
7090 (Layout::linkonce_output_name): Remove.
7091 (Layout::output_section_name): Rewrite.
7092 * layout.h (class Layout): Rename Linkonce_mapping to
7093 Section_name_mapping, linkonce_mapping to section_name_mapping,
7094 linkonce_mapping_count to section_name_mapping_count. Don't
7095 declare linkonce_output_name.
7096
7097 2009-06-03 Doug Kwan <dougkwan@google.com>
7098
7099 * gold/arm.cc (namespace utils): New.
7100 (Target_arm::reloc_is_non_pic): Define new method.
7101 (class Arm_relocate_functions): New.
7102 (Target_arm::Relocate::relocate): Handle relocation types used by
7103 Android.
7104
7105 2009-06-03 Ian Lance Taylor <iant@google.com>
7106
7107 * arm.cc (Target_arm::scan::global): Use || instead of |.
7108
7109 2009-06-02 Doug Kwan <dougkwan@google.com>
7110
7111 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
7112 issued_non_pic_error_.
7113 (class Target_arm::Scan): Declare new method check_non_pic.
7114 Define new method symbol_needs_plt_entry.
7115 Declare new data member issued_non_pic_error_.
7116 (class Target_arm::Relocate): Declare new method
7117 should_apply_static_reloc.
7118 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7119 (Target_arm::Scan::check_non_pic): Define new method.
7120 (Target_arm::Scan::local): Handle a small subset of reloc types used
7121 by Android.
7122 (Target_arm::Scan::local): Same.
7123 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7124
7125 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
7126
7127 * incremental.cc (Incremental_inputs::report_command_line): Filter
7128 out --incremental-* options.
7129
7130 2009-05-29 Doug Kwan <dougkwan@google.com>
7131
7132 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7133 template class.
7134 (class Target_arm): Update comment.
7135 (Target_arm::Target_arm): Initialize new data members GOT_,
7136 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7137 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7138 and Target_arm::rel_dyn_section.
7139 Declare new_enum Target_arm::Got_type.
7140 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7141 and DYNBSS_.
7142 Update commments for member do_dynsym_value.
7143 (Target_arm::got_size, Target_arm::plt_section,
7144 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7145 new methods inside class defintion.
7146 (Target_arm::got_section): Define new method.
7147 (Target_arm::rel_dyn_section): Same.
7148 (Output_data_plt_arm): New template class.
7149 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7150 (Output_data_plt_arm:do_adjust_output_section): Define new method.
7151 (Output_data_plt_arm::add_entry): Same.
7152 (Output_data_plt_arm::first_plt_entry): Define new
7153 static data member for PLT instruction template.
7154 (Output_data_plt_arm::plt_entry): Same.
7155 (Output_data_plt_arm::do_write): Define new method.
7156 (Target_arm::make_plt_entry): Same.
7157 (Target_arm::do_finalize_sections): Same.
7158 (Target_arm::do_dynsym_value): Same.
7159
7160 2009-05-28 Doug Kwan <dougkwan@google.com>
7161
7162 * Makefile.am (TARGETSOURCES): Add arm.cc.
7163 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7164 * Makefile.in: Regenerate.
7165 * arm.cc: New file.
7166 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7167
7168 2009-05-26 Doug Kwan <dougkwan@google.com>
7169
7170 * options.cc (General_options::parse_exclude_libs). Fix a comment.
7171 (General_options::check_excluded_libs): Strip off directories in
7172 archive name before matching like GNU ld does.
7173 * testsuite/Makefile.am (MOSTLYCLEANFILES,
7174 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7175 (exclude_libs_test_LDFLAGS): Add linker option
7176 -Wl,--exclude-libs,libexclude_libs_test_3
7177 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7178 an explicit archive without using -l.
7179 (alt/libexclude_libs_test_3.a): New make rule.
7180 * testsuite/Makefile.in: Regenerate.
7181 * testsuite/exclude_libs_test.c : Declare lib3_default().
7182 (main): Call it.
7183 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7184 * exclude_libs_test_3.c: New file.
7185
7186 2009-05-26 Nick Clifton <nickc@redhat.com>
7187
7188 * po/id.po: New Indonesian translation.
7189 * po/gold.pot: Updated template file.
7190
7191 2009-05-22 Sriraman Tallam <tmsriram@google.com>
7192
7193 * testsuite/Makefile.am: Add -ffunction-sections to compile
7194 gc_comdat_test files. Add -Wl,--gc-sections to build
7195 gc_comdat_test.
7196 * testsuite/Makefile.in: Regenerate.
7197 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7198
7199 2009-05-21 Sriraman Tallam <tmsriram@google.com>
7200
7201 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7202 kept comdat section was garbage collected.
7203 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7204 * testsuite/Makefile.in: Regenerate.
7205 * testsuite/gc_comdat_test.sh: New file.
7206 * testsuite/gc_comdat_test_1.cc: New file.
7207 * testsuite/gc_comdat_test_2.cc: New file.
7208
7209 2009-05-19 Doug Kwan <dougkwan@google.com>
7210
7211 * archive.cc (Archive::Archive): Move constructor from archive.h
7212 to here. Initialize no_export_.
7213 (Archive::get_elf_object_for_member): Set no_export flag of object.
7214 * archive.h (Archive::Archive): Move constructor body to
7215 archive.cc.
7216 (Archive::no_export): New method.
7217 (Archive::no_export_): New field.
7218 * object.h (Object::Object): Initialize no_export_ to false.
7219 (Object::no_export, Object::set_no_export): New methods.
7220 (Object::no_export_): New field.
7221 * options.cc (General_options::parse_exclude_libs): New method.
7222 (General_options::check_excluded_libs) Same.
7223 * options.h (exclude_libs): New option.
7224 (General_options::check_excluded_libs): New method declaration.
7225 (General_options::excluded_libs_): New field.
7226 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7227 default or protected visibility if an object has no-export flag set.
7228 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7229 (check_SCRIPTS): Add exclude_libs_test.sh.
7230 (check_DATA): Add exclude_libs_test.syms.
7231 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7232 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7233 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7234 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7235 (exclude_libs_test.syms, libexclude_libs_test_1.a,
7236 libexclude_libs_test_2.a): New rules.
7237 * testsuite/Makefile.in: Regenerate.
7238 * testsuite/exclude_libs_test.c: New file.
7239 * testsuite/exclude_libs_test.sh: Ditto.
7240 * testsuite/exclude_libs_test_1.c: Ditto.
7241 * testsuite/exclude_libs_test_2.c: Ditto.
7242
7243 2009-05-15 Ian Lance Taylor <iant@google.com>
7244
7245 * configure.ac: Check for declarations for cases where libiberty.h
7246 checks HAVE_DECL_xxx.
7247 * configure, config.in: Rebuild.
7248
7249 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
7250
7251 * gold.h (Incremental_argument_list): Remove (invalid) forward
7252 declaration.
7253 * incremental.cc (Incremental_inputs::report_achive): New method.
7254 (Incremental_inputs::report_object): New method.
7255 (Incremental_inputs::report_script): New method.
7256 (Incremental_inputs::finalize_inputs): New method.
7257 (Incremental_inputs::finalize): Call finalize_inputs().
7258 (Incremental_inputs::sized_create_incremental_inputs_section_data):
7259 Create inputs entries.
7260 * incremental.h (Incremental_input_type): New enum.
7261 (Incremental_inputs::Incremental_input): Initialize new fields.
7262 (Incremental_inputs::report_inputs): New method.
7263 (Incremental_inputs::report_achive): New method.
7264 (Incremental_inputs::report_object): New method.
7265 (Incremental_inputs::report_script): New method.
7266 (Incremental_inputs::finalize_inputs): New method.
7267 (Incremental_inputs::Input_info): New struct.
7268 (Incremental_inputs::Input_info_map): New typedef.
7269 (Incremental_inputs::lock_): New field.
7270 (Incremental_inputs::Inputs_): New field.
7271 (Incremental_inputs::Inputs_map): New field.
7272 * main.cc (main): Call Incremental_input::report_inputs.
7273 * options.h (Input_argument_list): Typedef moved from
7274 Input_arguments.
7275 (Input_file_group::Files): Remove, use ::Input_argument_list.
7276 (Input_file_group::Input_argument_list): Remove, use
7277 ::Input_argument_list.
7278 * plugin.cc (Plugin_manager::add_input_file): Add error in
7279 incremental build.
7280 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7281 functions.
7282 * script.cc (read_input_script): Call
7283 Incremental_input::report_script.
7284 * script.h (Script_info): New class.
7285
7286 2009-04-27 Ian Lance Taylor <iant@google.com>
7287
7288 * x86_64.cc (do_adjust_output_section): Set entsize to
7289 plt_entry_size.
7290
7291 2009-04-23 Elliott Hughes <enh@google.com>
7292
7293 * output.cc (Output_file::close): After short writes, continue
7294 writing from the correct offset in the buffer being written.
7295
7296 2009-04-23 Chris Demetriou <cgd@google.com>
7297
7298 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7299 * configure: Regenerate.
7300 * config.in: Regenerate.
7301 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7302 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7303
7304 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
7305
7306 * incremental.cc (Incremental_inputs_header_data): Renamed from
7307 Incremental_input_header_data.
7308 (Incremental_inputs_header_data::data_size): New field.
7309 (Incremental_inputs_header_data::put_input_file_count): Renamed
7310 from input_file_count.
7311 (Incremental_inputs_header_data::put_command_line_offset): Renamed
7312 from command_line_offset.
7313 (Incremental_inputs_header_data::put_reserved): Renamed from
7314 put_reserved.
7315 (Incremental_inputs_entry_data): Renamed from
7316 Incremental_input_entry_data.
7317 (Incremental_inputs_entry_data::data_size): New field.
7318 (Incremental_inputs::report_command_line): New method.
7319 (Incremental_inputs::finalize): New method.
7320 (Incremental_inputs::create_incremental_inputs_data): New method.
7321 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7322 * incremental.h: New file.
7323 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7324 (Layout::finalize): Create incremental inputs section in
7325 incremental builds.
7326 (Layout::create_incremental_info_sections): New method.
7327 * layout.h (Layout::incremental_inputs): New method.
7328 (Layout::create_incremental_info_sections): New method.
7329 (Layout::incremental_inputs_): New field.
7330 * main.cc (main): Notify Incremental_input of the command line.
7331
7332 2009-04-01 Ian Lance Taylor <iant@google.com>
7333 Mikolaj Zalewski <mikolajz@google.com>
7334
7335 * gold.h (reserve_unordered_map): Define, three versions, one for
7336 each version of Unordered_map.
7337 * layout.cc (Layout::Layout): Remove options parameter. Add
7338 number_of_input_files parameter. Don't initialize options_.
7339 Initialize number_of_input_files_ and resized_signatures_. Move
7340 sections_are_attached_.
7341 (Layout::layout_group): Reserve space for group_signatures_.
7342 (Layout::find_or_add_kept_section): Change name parameter to be a
7343 reference. Resize signatures_ map when it gets large enough.
7344 (Layout::layout_eh_frame): Use parameters->options() instead of
7345 this->options_.
7346 (Layout::make_output_section): Likewise.
7347 (Layout::attach_allocated_section_to_segment): Likewise.
7348 (Layout::finalize, Layout::create_executable_stack): Likewise.
7349 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7350 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7351 * layout.h (class Layout): Update declarations. Remove options_
7352 field. Add number_of_input_files_ and resized_signatures_
7353 fields. Move sections_are_attached_ field.
7354 * main.cc (main): Pass number of input files to Layout
7355 constructor. Don't pass options.
7356
7357 2009-03-30 Ian Lance Taylor <iant@google.com>
7358
7359 * ffsll.c (ffsll): Correct implementation.
7360
7361 2009-03-27 Ian Lance Taylor <iant@google.com>
7362
7363 * ffsll.c: New file.
7364 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7365 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7366 * ftruncate.c (ftruncate): Declare before definition.
7367 * mremap.c (mremap): Likewise.
7368 * pread.c (pread): Likewise.
7369 * configure, Makefile.in, config.in: Rebuild.
7370
7371 * mremap.c: New file.
7372 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7373 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7374 (mremap): Declare if HAVE_MREMAP is not defined.
7375 * configure, Makefile.in, config.in: Rebuild.
7376
7377 2009-03-27 Cary Coutant <ccoutant@google.com>
7378
7379 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7380 position independent.
7381 * sparc.cc (Target_sparc::check_non_pic): Likewise.
7382 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7383
7384 2009-03-24 Cary Coutant <ccoutant@google.com>
7385
7386 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7387 an executable.
7388 (needs_dynamic_reloc): Likewise.
7389
7390 2009-03-24 Ian Lance Taylor <iant@google.com>
7391
7392 * yyscript.y (file_cmd): Recognize EXTERN.
7393 (extern_name_list, extern_name_list_body): New nonterminals.
7394 * script.cc (script_add_extern): Define.
7395 * script-c.h (script_add_extern): Declare.
7396
7397 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
7398
7399 * object.cc (is_elf_object): Define.
7400 * object.h (is_elf_object): Declare.
7401 * archive.cc (Archive::get_elf_object_for_member): Call
7402 is_elf_object.
7403 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7404
7405 2009-03-24 Elliott Hughes <enh@google.com>
7406
7407 * output.cc (Output_file::map_anonymous): Define.
7408 (Output_file::map): Use map_anonymous. If the regular mmap fails,
7409 try an anonymous one. Report the size if the mmap fails.
7410 * output.h (class Output_file): Declare map_anonymous.
7411
7412 2009-03-24 Ian Lance Taylor <iant@google.com>
7413
7414 * target-select.cc (instantiate_target): Don't acquire the lock if
7415 the instantiated_target_ field has already been set.
7416
7417 2009-03-23 Ian Lance Taylor <iant@google.com>
7418
7419 * gold-threads.h (class Initialize_lock): Define.
7420 * gold-threads.cc (class Initialize_lock_once): Define.
7421 (initialize_lock_control): New static variable.
7422 (initialize_lock_pointer): New static variable.
7423 (initialize_lock_once): New static function.
7424 (Initialize_lock::Initialize_lock): Define.
7425 (Initialize_lock::initialize): Define.
7426 * target-select.h: Include "gold-threads.h".
7427 (class Target_selector): Add lock_ and initialize_lock_ fields.
7428 Don't define instantiate_target, just declare it.
7429 * target-select.cc (Target_selector::Target_selector): Initialize
7430 new fields.
7431 (Target_selector::instantiate_target): Define.
7432 * descriptors.h: Include "gold-threads.h".
7433 (class Descriptors): Add initialize_lock_ field.
7434 * descriptors.cc (Descriptors::Descriptors): Initialize new
7435 field.
7436 (Descriptors::open): Use initialize_lock_ field
7437 * errors.h (class Errors): Add initialize_lock_ field.
7438 * errors.cc (Errors::Errors): Initialize new field.
7439 (Errors::initialize_lock): Use initialize_lock_ field.
7440 * powerpc.cc (class Target_selector_powerpc): Remove
7441 instantiated_target_ field. In do_recognize call
7442 instantiate_target rather than do_instantiate_target. In
7443 do_instantiate_target just allocate a new target.
7444 * sparc.cc (class Target_selector_sparc): Likewise.
7445
7446 * freebsd.h: New file.
7447 * i386.cc: Include "freebsd.h".
7448 (Target_i386): Derive from Target_freebsd rather than
7449 Sized_target.
7450 (Target_selector_i386): Derive from Target_selector_freebsd rather
7451 than Target_selector.
7452 * x86_64.cc: Include "freebsd.h".
7453 (Target_x86_64): Derive from Target_freebsd rather than
7454 Sized_target.
7455 (Target_selector_x86_64): Derive from Target_selector_freebsd
7456 rather than Target_selector.
7457 * target.h (class Target): Add adjust_elf_header and
7458 do_adjust_elf_header.
7459 * output.cc (Output_file_header:: do_sized_write): Call target
7460 adjust_elf_header routine.
7461 * configure.tgt: Set targ_osabi.
7462 * configure.ac: Define GOLD_DEFAULT_OSABI.
7463 * parameters.cc (Parameters::default_target): Pass
7464 GOLD_DEFAULT_OSABI to select_target.
7465 * target-select.h (class Target_selector): Make instantiate_target
7466 protected rather than private.
7467 * Makefile.am (HFILES): Add freebsd.h.
7468 * configure, Makefile.in, config.in: Rebuild.
7469
7470 * merge.cc (do_add_input_section): Correct pend value. Change
7471 message about last entry not being null terminated from error to
7472 warning.
7473
7474 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
7475
7476 * incremental.cc: New file.
7477 * Makefile.am (CCFILES): Add incremental.cc.
7478 * Makefile.in: Rebuild.
7479
7480 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
7481
7482 * layout.cc (Layout::output_section_name): Preserve names
7483 of '.note.' sections.
7484
7485 2009-03-19 Ian Lance Taylor <iant@google.com>
7486
7487 * descriptors.cc (Descriptors::open): Check that the options are
7488 valid before using them.
7489
7490 2009-03-18 Ian Lance Taylor <iant@google.com>
7491
7492 * script-sections.h: Include <list>.
7493 (class Script_sections): Change Sections_elements from std::vector
7494 to std::list. Typedef public Elements_iterator. Add
7495 orphan_section_placement_, data_segment_align_start_, and
7496 saw_data_segment_align_ fields. Remove data_segment_align_index_
7497 field.
7498 * script-sections.cc (class Orphan_section_placement): New class.
7499 (class Sections_element): Add virtual functions is_relro and
7500 orphan_section_init. Remove virtual function place_orphan_here.
7501 (class Output_section_definition): Add is_relro and
7502 orphan_section_init. Remove place_orphan_here.
7503 (class Orphan_output_section): Likewise.
7504 (Script_sections::Script_sections): Update for field changes.
7505 (Script_sections::data_segment_align): Set saw_data_segment_align_
7506 and data_segment_align_start_, not data_segment_align_index.
7507 (Script_sections::data_segment_relro_end): Check
7508 saw_data_segment_align_. Use data_segment_align_start_ rather
7509 than data_segment_align_index_.
7510 (Script_sections::place_orphan): Rewrite to use
7511 Orphan_section_placement.
7512
7513 2009-03-17 Ian Lance Taylor <iant@google.com>
7514
7515 * archive.cc (Archive::add_symbols): Check for a version attached
7516 to the symbol name in the archive map.
7517 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7518 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7519 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7520 (ver_test_11.a): New target.
7521 * testsuite/Makefile.in: Rebuild.
7522
7523 * configure.ac: Check for chsize and posix_fallocate. Replace
7524 ftruncate.
7525 * ftruncate.c: New file, from gnulib.
7526 * output.cc (posix_fallocate): Define dummy version if not
7527 HAVE_POSIX_FALLOCATE.
7528 (Output_file::map): Call posix_fallocate rather than lseek and
7529 write.
7530 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7531 * configure, Makefile.in, config.in: Rebuild.
7532
7533 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
7534
7535 * layout.h (Layout::create_note): Add section_name parameter.
7536 * layout.cc (Layout::create_note): Likewise.
7537 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7538
7539 2009-03-17 Ian Lance Taylor <iant@google.com>
7540
7541 * descriptors.cc: Include "options.h".
7542 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7543 (Descriptors::open): Always use O_CLOEXEC when opening a new
7544 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
7545 then set FD_CLOEXEC.
7546
7547 * sparc.cc (class Target_sparc): Add has_got_section.
7548 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7549 make sure we have a GOT section.
7550
7551 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7552 (Target_sparc::Scan::local): Likewise.
7553 (Target_sparc::Scan::global): Likewise.
7554 (Target_sparc::Relocate::relocate): Likewise.
7555 (Target_sparc::Relocate::relocate_tls): Likewise.
7556
7557 * symtab.cc (Symbol_table::define_default_version): New function,
7558 broken out of add_from_object.
7559 (Symbol_table::add_from_object): Call define_default_version.
7560 (Symbol_table::define_special_symbol): Add resolve_oldsym
7561 parameter. Change all callers. If the version for a symbol comes
7562 from a version script, resolve it with the symbol with the same
7563 name with no version. Also add the symbol without a version if
7564 appropriate.
7565 (do_define_in_output_data): If resolving with oldsym, don't delete
7566 sym.
7567 (do_define_in_output_segment): Likewise.
7568 (do_define_as_constant): Likewise.
7569 * symtab.h (class Symbol_table): Update declarations.
7570
7571 2009-03-13 Ian Lance Taylor <iant@google.com>
7572
7573 * readsyms.cc (Read_symbols::incompatible_warning): New function.
7574 (Read_symbols::requeue): New function.
7575 (Read_symbols::do_read_symbols): If make_elf_object fails because
7576 the target type is not configured, and the file was searched for,
7577 issue a warning and retry with the next directory.
7578 (Add_symbols::run): If the file has an incompatible format, and
7579 it was searched for, requeue the Read_symbols task. On error,
7580 release the object.
7581 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
7582 dirindex parameter to constructor. Change all callers. Declare
7583 incompatible_warning and requeue.
7584 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7585 input_argument_ and input_group_ fields. Add them to
7586 constructor. Change all callers.
7587 (class Read_script): Add dirindex_ field. Add it to constructor.
7588 Change all callers.
7589 * archive.cc (Archive::setup): Remove input_objects parameter.
7590 Change all callers.
7591 (Archive::get_file_and_offset): Likewise.
7592 (Archive::read_all_symbols): Likewise.
7593 (Archive::read_symbols): Likewise.
7594 (Archive::get_elf_object_for_member): Remove input_objects
7595 parameter. Add punconfigured parameter. Change all callers.
7596 (Archive::add_symbols): Change return type to bool. Check return
7597 value of include_member.
7598 (Archive::include_all_members): Likewise.
7599 (Archive::include_member): Change return type to bool. Return
7600 false if first included object has incompatible target. Set
7601 included_member_ field.
7602 (Add_archive_symbols::run): If add_symbols returns false, requeue
7603 Read_symbols task.
7604 * archive.h (class Archive): Add included_member_ field.
7605 Initialize it in constructor. Add input_file and searched_for
7606 methods. Update declarations.
7607 (class Add_archive_symbols): Add dirpath_, dirindex_, and
7608 input_argument_ fields. Add them to constructor. Change all
7609 callers.
7610 * script.cc: Include "target-select.h".
7611 (class Parser_closure): Add skip_on_incompatible_target_ and
7612 found_incompatible_target_ fields. Add
7613 skip_on_incompatible_target parameter to constructor. Change all
7614 callers. Add methods skip_on_incompatible_target,
7615 clear_skip_on_incompatible_target, found_incompatible_target, and
7616 set_found_incompatible_target.
7617 (read_input_script): Add dirindex parameter. Change all callers.
7618 If parser finds an incompatible target, requeue Read_symbols
7619 task.
7620 (script_set_symbol): Clear skip_on_incompatible_target in
7621 closure.
7622 (script_add_assertion, script_parse_option): Likewise.
7623 (script_start_sections, script_add_phdr): Likewise.
7624 (script_check_output_format): New function.
7625 * script.h (read_input_script): Update declaration.
7626 * script-c.h (script_check_output_format): Declare.
7627 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7628 (ignore_cmd): Remove OUTPUT_FORMAT.
7629 * fileread.cc (Input_file::Input_file): Add explicit this.
7630 (Input_file::will_search_for): New function.
7631 (Input_file::open): Add pindex parameter. Change all callers.
7632 * fileread.h (class Input_file): Add input_file_argument method.
7633 Declare will_search_for. Update declarations.
7634 * object.cc (make_elf_object): Add punconfigured parameter.
7635 Change all callers.
7636 * object.h (class Object): Make input_file public. Add
7637 searched_for method.
7638 (make_elf_object): Update declaration.
7639 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
7640 restart search.
7641 * dirsearch.h (class Dirsearch): Update declaration.
7642 * options.h (class General_options): Add --warn-search-mismatch.
7643 * parameters.cc (Parameters::is_compatible_target): New function.
7644 * parameters.h (class Parameters): Declare is_compatible_target.
7645 * workqueue.cc (Workqueue::add_blocker): New function.
7646 * workqueue.h (class Workqueue): Declare add_blocker.
7647
7648 * fileread.cc (Input_file::open): Remove options parameter.
7649 Change all callers.
7650 (Input_file::open_binary): Likewise.
7651 * script.cc (read_input_script): Likewise.
7652 * readsyms.h (class Read_symbols): Remove options_ field. Remove
7653 options parameter from constructor. Change all callers.
7654 (class Read_script): Likewise.
7655 * fileread.h (class Input_file): Update declarations.
7656 * script.h (read_input_script): Update declaration.
7657
7658 2009-03-10 Nick Clifton <nickc@redhat.com>
7659
7660 * po/es.po: New Spanish translation.
7661
7662 2009-03-06 Cary Coutant <ccoutant@google.com>
7663
7664 * options.cc (parse_short_option): Keep dash_z from registering itself.
7665
7666 2009-03-03 Ian Lance Taylor <iant@google.com>
7667
7668 PR 9918
7669 * target-reloc.h (relocate_section): Pass output_section to
7670 relocate.
7671 * i386.cc (Target_i386::should_apply_static_reloc): Add
7672 output_section parameter. Change all callers.
7673 (Target_i386::Relocate::relocate): Add output_section parameter.
7674 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7675 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7676 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7677 * testsuite/two_file_shared.sh: New script.
7678 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7679 (check_DATA): Add two_file_shared.dbg.
7680 (two_file_shared.dbg): New target.
7681 * testsuite/Makefile.in: Rebuild.
7682
7683 2009-03-01 Ian Lance Taylor <iant@google.com>
7684
7685 * configure.ac: Check for byteswap.h.
7686 * configure: Rebuild.
7687 * config.in: Rebuild.
7688
7689 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
7690
7691 * layout.cc (Layout::find_or_add_kept_section): New function.
7692 (Layout::add_comdat): Removed.
7693 * layout.h (struct Kept_section): Move out of class Layout.
7694 Remove trailing underscores from field names. Add group_sections
7695 field. Rename group_ field to is_group. Change all uses.
7696 (class Layout): Declare find_or_add_kept_section, not add_comdat.
7697 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7698 comdat_groups_ field.
7699 (Sized_relobj::include_section_group): Use
7700 find_or_add_kept_section and Kept_section::group_sections.
7701 (Sized_relobj::include_linkonce_section): Likewise.
7702 * object.cc (class Sized_relobj): Don't define Comdat_group or
7703 Comdat_group_table. Remove find_comdat_group and
7704 add_comdat_group. Remove comdat_groups_ field.
7705 * plugin.cc (include_comdat_group): Use
7706 Layout::find_or_add_kept_section.
7707
7708 2009-02-28 Ian Lance Taylor <iant@google.com>
7709
7710 * README: --gc-sections and map files are now supported. Document
7711 some build requirements.
7712
7713 PR 6992
7714 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7715 relocatable link set the value of the section symbol to zero.
7716 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7717 relocatable link don't include the section address in the local
7718 symbol value.
7719
7720 2009-02-27 Ian Lance Taylor <iant@google.com>
7721
7722 PR 6811
7723 * options.h (class Search_directory): Add is_system_directory.
7724 (class General_options): Declare is_in_system_directory.
7725 * options.cc (get_relative_sysroot): Make static.
7726 (get_default_sysroot): Make static.
7727 (General_optoins::is_in_system_directory): New function.
7728 * fileread.cc (Input_file::is_in_system_directory): New function.
7729 * fileread.h (class Input_file): Declare is_in_system_directory.
7730 * object.h (class Object): Add is_in_system_directory.
7731 (class Input_objects): Remove system_library_directory_ field.
7732 * object.cc (Input_objects::add_object): Don't set
7733 system_library_directory_.
7734 (input_objects::found_in_system_library_directory): Remove.
7735 * symtab.cc (Symbol_table::write_globals): Remove input_objects
7736 parameter. Change all callers.
7737 (Symbol_table::sized_write_globals): Likewise.
7738 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7739 Call Object::is_in_system_directory.
7740 * symtab.h (class Symbol_table): Update declarations.
7741
7742 PR 5990
7743 * descriptors.h (Open_descriptor): Add is_on_stack field.
7744 * descriptors.cc (Descriptors::open): If the descriptor is on the
7745 top of the stack, remove it. Initialize is_on_stack field.
7746 (Descriptors::release): Only add pod to stack if it is not on the
7747 stack already.
7748 (Descriptors::close_some_descriptor): Clear stack_next and
7749 is_on_stack fields.
7750
7751 PR 7091
7752 * output.cc (Output_section::find_starting_output_address): Rename
7753 from starting_output_address; add PADDR parameter; change return
7754 type.
7755 * output.h (class Output_section): Declare
7756 find_starting_output_address instead of starting_output_address.
7757 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7758 section symbol for which we can't find a merge section.
7759
7760 PR 9836
7761 * symtab.cc (Symbol_table::add_from_object): If the visibility is
7762 hidden or internal, force the symbol to be local.
7763 * resolve.cc (Symbol::override_visibility): Define.
7764 (Symbol::override_base): Use override_visibility.
7765 (Symbol_table::resolve): Likewise.
7766 (Symbol::override_base_with_special): Likewise.
7767 (Symbol_table::override_with_special): If the visibility is hidden
7768 or internal, force the symbol to be local.
7769 * symtab.h (class Symbol): Add set_visibility and
7770 override_visibility.
7771 * testsuite/ver_test_1.sh: New file.
7772 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7773 (check_DATA): Add ver_test_1.syms.
7774 (ver_test_1.syms): New target.
7775 * testsuite/Makefile.in: Rebuild.
7776
7777 2009-02-25 Cary Coutant <ccoutant@google.com>
7778
7779 * layout.cc (Layout::choose_output_section): Don't rename sections
7780 when using a linker script that has a SECTIONS clause.
7781 * Makefile.in: Regenerate.
7782
7783 * testsuite/Makefile.am (script_test_5.sh): New test case.
7784 * testsuite/Makefile.in: Regenerate.
7785 * testsuite/script_test_5.cc: New file.
7786 * testsuite/script_test_5.sh: New file.
7787 * testsuite/script_test_5.t: New file.
7788
7789 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
7790
7791 * archive.cc (Archive::include_member): Update calls to add_symbols.
7792 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7793 the Layout argument.
7794 * dynobj.h (do_add_symbols): Add the Layout argument.
7795 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7796 Layout argument.
7797 * object.h (Object::add_symbols): Add the Layout argument.
7798 (Object::do_add_symbols): Add the Layout argument.
7799 (Sized_relobj::do_add_symbols): Add the Layout argument.
7800 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7801 Unify the two versions.
7802 (Add_plugin_symbols): Remove.
7803 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7804 (Sized_pluginobj::do_add_symbols): Unify the two versions.
7805 (Add_plugin_symbols): Remove.
7806 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7807 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7808 (Add_symbols::run): Make it work with Pulginobj.
7809
7810 2009-02-06 Ian Lance Taylor <iant@google.com>
7811
7812 * object.cc (Sized_relobj::do_layout): Make info message start
7813 with lower case letter.
7814
7815 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
7816
7817 * binary.cc: Fix file comment.
7818
7819 * options.h (enum Incremental_disposition): Define.
7820 (class General_options): Add new options: --incremental,
7821 --incremental_changed, --incremental_unchanged,
7822 --incremental_unknown. Add incremental_disposition_ and
7823 implicit_incremental_ fields.
7824 (General_options::incremental_disposition): New function.
7825 (class Position_dependent_options): Add incremental_disposition
7826 option.
7827 (Position_dependent_options::copy_from_options): Set incremental
7828 dispositions.
7829 * options.cc (General_options::parse_incremental_changed): New
7830 function.
7831 (General_options::parse_incremental_unchanged): New function.
7832 (General_options::parse_incremental_unknown): New function.
7833 (General_options::General_options): Initialize new fields
7834 incremental_disposition_ and implicit_incremental_.
7835 (General_options::finalize): Check for uasge of --incremental-*
7836 without --incremental.
7837
7838 2009-02-06 Chris Demetriou <cgd@google.com>
7839
7840 * gold.h (gold_undefined_symbol): Change to take only a Symbol
7841 pointer and to report location as the file name associated with
7842 the symbol.
7843 (gold_undefined_symbol_at_location): New function to replace the
7844 old gold_undefined_symbol functionality.
7845 * target-reloc.h (relocate_section): Update to use
7846 gold_undefined_symbol_at_location.
7847 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7848 Call gold_undefined_symbol function rather than gold_error.
7849 * errors.h (Errors::undefined_symbol): Take location as a
7850 string, rather than calculating it from a relocation.
7851 * errors.cc (Errors::fatal): Print "fatal error:" before the
7852 formatted message.
7853 (Errors::error, Errors::error_at_location): Print "error: "
7854 before the formatted message.
7855 (Errors::undefined_symbol): Take location as a string, rather
7856 than calculating it from a relocation.
7857 (gold_undefined_symbol_at_location): New function akin to
7858 old gold_undefined_symbol, calculates location from relocation.
7859 (gold_undefined_symbol): Change to take only a Symbol pointer
7860 and to report location as the file name associated with the symbol.
7861 * testsuite/debug_msg.sh: Update for changed error messages.
7862 * testsuite/undef_symbol.sh: Likewise.
7863
7864 2009-02-04 Duncan Sands <baldrick@free.fr>
7865
7866 PR 9812
7867 * reduced_debug_output.h
7868 (Output_reduced_debug_abbrev_section::failed): Use format for
7869 gold_warning.
7870 (Output_reduced_debug_info_section::faild): Likewise.
7871
7872 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
7873
7874 * script.cc (Lazy_demangler): New class.
7875 (Version_script_info::get_symbol_version_helper): Demangle a
7876 symbol only once.
7877
7878 2009-01-29 Cary Coutant <ccoutant@google.com>
7879
7880 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7881 to __tls_get_addr.
7882 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7883
7884 2009-01-28 Ian Lance Taylor <iant@google.com>
7885
7886 * version.cc (version_string): Bump to 1.9.
7887
7888 * gold.h: Include <cstring> and <stdint.h>.
7889 * version.cc: Include <cstdio>.
7890 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7891 warning.
7892 * reduced_debug_output.cc (insert_into_vector): Rename from
7893 Insert_into_vector; change all callers. Use Swap_unaligned to
7894 avoid aliasing issue; remove union since it is unnecessary.
7895
7896 2009-01-27 Sriraman Tallam <tmsriram@google.com>
7897
7898 * Makefile.am (CCFILES): Add gc.cc.
7899 (HFILES): Add gc.h.
7900 * Makefile.in: Regenerate.
7901 * gold.cc (Gc_runner): New class.
7902 (queue_initial_tasks): Call garbage collection related tasks
7903 when corresponding options are invoked.
7904 (queue_middle_gc_tasks): New function.
7905 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7906 processed early before laying out sections during garbage collection.
7907 * gold.h (queue_middle_gc_tasks): New function.
7908 (is_prefix_of): Move from "layout.cc".
7909 * i386.cc (Target_i386::gc_process_relocs): New function.
7910 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7911 * main.cc (main): Create object of class "Garbage_collection".
7912 * object.cc (Relobj::copy_symbols_data): New function.
7913 (Relobj::is_section_name_included): New function.
7914 (Sized_relobj::do_layout): Allow this function to be called twice
7915 during garbage collection and defer layout of section during the
7916 first call.
7917 * object.h (Relobj::get_symbols_data): New function.
7918 (Relobj::is_section_name_included): New function.
7919 (Relobj::copy_symbols_data): New function.
7920 (Relobj::set_symbols_data): New function.
7921 (Relobj::get_relocs_data): New function.
7922 (Relobj::set_relocs_data): New function.
7923 (Relobj::is_output_section_offset_invalid): New pure virtual function.
7924 (Relobj::gc_process_relocs): New function.
7925 (Relobj::do_gc_process_relocs): New pure virtual function.
7926 (Relobj::sd_): New data member.
7927 (Sized_relobj::is_output_section_offset_invalid): New function.
7928 (Sized_relobj::do_gc_process_relocs): New function.
7929 * options.h (General_options::gc_sections): Modify to not be a no-op.
7930 (General_options::print_gc_sections): New option.
7931 * plugin.cc (Plugin_finish::run): Remove function call to
7932 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
7933 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7934 * reloc.cc (Read_relocs::run): Add task to process relocs and
7935 determine unreferenced sections when doing garbage collection.
7936 (Gc_process_relocs): New class.
7937 (Sized_relobj::do_gc_process_relocs): New function.
7938 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7939 sections that are garbage collected.
7940 * reloc.h (Gc_process_relocs): New class.
7941 * sparc.cc (Target_sparc::gc_process_relocs): New function.
7942 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7943 symbols whose corresponding sections are garbage collected.
7944 (Symbol_table::Symbol_table): Add new parameter for the garbage
7945 collection object.
7946 (Symbol_table::gc_mark_undef_symbols): New function.
7947 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7948 (Symbol_table::gc_mark_dyn_syms): New function.
7949 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7950 as garbage.
7951 (Symbol_table::add_from_object): Likewise.
7952 (Symbol_table::add_from_relobj): When building shared objects, do not
7953 treat externally visible symbols as garbage.
7954 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7955 table information for static and relocatable links.
7956 * symtab.h (Symbol_table::set_gc): New function.
7957 (Symbol_table::gc): New function.
7958 (Symbol_table::gc_mark_undef_symbols): New function.
7959 (Symbol_table::gc_mark_symbol_for_shlib): New function.
7960 (Symbol_table::gc_mark_dyn_syms): New function.
7961 (Symbol_table::gc_): New data member.
7962 * target.h (Sized_target::gc_process_relocs): New pure virtual
7963 function.
7964 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7965 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7966
7967 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
7968
7969 * options.h (General_options::gc_sections): Define as a no-op for now.
7970 (General_options::no_keep_memory): Ditto.
7971 (General_options::Bshareable): Define.
7972 * options.cc (General_options::finalize): Honor -Bshareable.
7973
7974 2009-01-20 Andreas Schwab <schwab@suse.de>
7975
7976 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7977 read the value in the contents, since we don't use it. Use the
7978 template endianness when writing.
7979 (Relocate::relocate): Use it for R_PPC_REL16_HA.
7980
7981 2009-01-19 Andreas Schwab <schwab@suse.de>
7982
7983 * configure.tgt (powerpc64-*): Fix targ_obj.
7984
7985 2009-01-15 Ian Lance Taylor <iant@google.com>
7986
7987 * object.cc (Sized_relobj::write_local_symbols): Don't write out
7988 local symbols when stripping all symbols.
7989
7990 2009-01-14 Cary Coutant <ccoutant@google.com>
7991
7992 * output.cc (Output_reloc): Add explicit instantiations.
7993
7994 2009-01-14 Cary Coutant <ccoutant@google.com>
7995
7996 * archive.cc (Archive::get_elf_object_for_member): Remove call
7997 to File_read::claim_for_plugin.
7998 * descriptors.cc (Descriptors::open): Remove reference to
7999 is_claimed.
8000 (Descriptors::claim_for_plugin): Remove.
8001 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8002 (Descriptors::is_claimed): Remove.
8003 (claim_descriptor_for_plugin): Remove.
8004 * fileread.cc (File_read::claim_for_plugin): Remove.
8005 * fileread.h (File_read::claim_for_plugin): Remove.
8006 (File_read::descriptor): Reopen descriptor if necessary.
8007 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8008 (Plugin_manager::all_symbols_read): Add task parameter. Change
8009 all callers.
8010 (Plugin_manager::get_input_file): New function.
8011 (Plugin_manager::release_input_file): New function.
8012 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8013 corresponding data member.
8014 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8015 and pass to base constructor. Change all callers.
8016 (get_input_file, release_input_file): New functions.
8017 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8018 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8019 (Plugin_manager::all_symbols_read): Add task parameter.
8020 (Plugin_manager::get_input_file): New function.
8021 (Plugin_manager::release_input_file): New function.
8022 (Plugin_manager::task_): New data member.
8023 (Pluginobj::Pluginobj): Add filesize parameter.
8024 (Pluginobj::filename): New function.
8025 (Pluginobj::descriptor): New function.
8026 (Pluginobj::filesize): New function.
8027 (Pluginobj::filesize_): New data member.
8028 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8029 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8030 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8031
8032 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8033 with archive libraries.
8034 * testsuite/Makefile.in: Regenerate.
8035 * testsuite/plugin_test.c (struct sym_info): New type.
8036 (get_input_file, release_input_file): New static variables.
8037 (onload): Capture new transfer vector entries.
8038 (claim_file_hook): Stop reading at end of file according to filesize.
8039 Factor out parsing of readelf output into separate function.
8040 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8041 APIs and get the source file name from the symbol table. Convert
8042 source file name to corresponding object file name. Print info
8043 message when adding new input files.
8044 (parse_readelf_line): New function.
8045 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8046 * testsuite/plugin_test_2.sh: Likewise.
8047 * testsuite/plugin_test_3.sh: Likewise.
8048 * testsuite/plugin_test_4.sh: New test case.
8049
8050 2009-01-07 Ian Lance Taylor <iant@google.com>
8051
8052 * version.cc (version_string): Bump to 1.8.
8053
8054 2008-12-23 Cary Coutant <ccoutant@google.com>
8055
8056 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8057 * plugin.cc (Plugin_manager::finish): Rename as
8058 layout_deferred_objects. Move cleanup to separate function.
8059 (Plugin_manager::cleanup): New function.
8060 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8061 separately.
8062 * plugin.h (Plugin_manager::finish): Rename as
8063 layout_deferred_objects.
8064 (Plugin_manager::cleanup): New function.
8065 (Plugin_manager::cleanup_done): New field.
8066
8067 2008-12-23 Cary Coutant <ccoutant@google.com>
8068
8069 * plugin.cc (is_visible_from_outside): New function.
8070 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8071 so we don't return "IR only" status for exported symbols or -r links.
8072
8073 * testsuite/Makefile.am (plugin_test_3): New test case.
8074 * testsuite/Makefile.in: Regenerate.
8075 * testsuite/plugin_test_3.sh: New file.
8076
8077 2008-12-22 Cary Coutant <ccoutant@google.com>
8078
8079 * object.cc (Sized_relobj::layout_section): New function.
8080 (Sized_relobj::do_layout): Defer layout of input sections until after
8081 plugin has provided replacement files.
8082 (Sized_relobj::do_layout_deferred_sections): New function.
8083 * object.h (Relobj::set_section_offset): Remove virtual keyword.
8084 (Relobj::layout_deferred_sections): New function.
8085 (Relobj::do_layout_deferred_sections): New function.
8086 (Sized_relobj::do_layout_deferred_sections): New function.
8087 (Sized_relobj::layout_section): New function.
8088 (Sized_relobj::Deferred_layout): New structure.
8089 (Sized_relobj::deferred_layout_): New field.
8090 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8091 Change all callers. Layout deferred sections.
8092 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
8093 references.
8094 (Plugin_hook::run): Move code from do_plugin_hook inline.
8095 (Plugin_hook::do_plugin_hook): Remove.
8096 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8097 (Plugin_manager::finish): Renamed, was cleanup.
8098 (Plugin_manager::should_defer_layout): New function.
8099 (Plugin_manager::add_deferred_layout_object): New function.
8100 (Plugin_manager::Deferred_layout_list): New type.
8101 (Plugin_manager::deferred_layout_objects_): New field.
8102 (Plugin_hook::do_plugin_hook): Remove.
8103
8104 2008-12-17 Ian Lance Taylor <iant@google.com>
8105
8106 * options.h (class General_options): Add --no case for
8107 --export-dynamic.
8108
8109 2008-12-16 Cary Coutant <ccoutant@google.com>
8110
8111 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8112 vector.
8113 (Plugin_manager::claim_file): Create plugin object even if
8114 plugin did not call the add_symbols callback.
8115 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8116 asking for more symbols than were added.
8117 * testsuite/Makefile.am (plugin_test_1): Add test case with
8118 no global symbols.
8119 (empty.syms): New target.
8120 * testsuite/Makefile.in: Regenerate.
8121 * testsuite/plugin_test.c (claim_file_hook): Add new debug
8122 message. Don't call add_symbols if no globals.
8123 (all_symbols_read_hook): Don't provide replacement for empty
8124 claimed file.
8125
8126 2008-12-12 Ian Lance Taylor <iant@google.com>
8127
8128 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8129 r_type == 0 for a local symbol with r_sym == 0.
8130 (scan_relocatable_relocs): Pass r_sym to
8131 local_non_section_strategy.
8132 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8133 r_sym parameter.
8134
8135 * configure.ac: Update test for TLS descriptors: they are
8136 supported as of glibc 2.9.
8137 * configure: Rebuild.
8138
8139 2008-12-11 Ian Lance Taylor <iant@google.com>
8140
8141 PR 7091
8142 * target-reloc.h (Default_scan_relocatable_relocs): For each
8143 function, map r_type == 0 to RELOC_DISCARD.
8144
8145 2008-12-10 Cary Coutant <ccoutant@google.com>
8146
8147 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8148 object to override a kept COMDAT group from a plugin object.
8149
8150 2008-12-09 Ian Lance Taylor <iant@google.com>
8151
8152 PR 7088
8153 * yyscript.y (file_cmd): Handle INPUT.
8154
8155 * testsuite/initpri1.c: Change all declarations to be full
8156 prototypes by adding void, to avoid compiler warnings.
8157
8158 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
8159
8160 * options.cc (General_options::parse_plugin_opt): New.
8161 (General_options::add_plugin): The argument now is just the filename.
8162 (General_options::add_plugin_option): New.
8163 * options.h (plugin_opt): New.
8164 (add_plugin): Change argument name.
8165 (add_plugin_option): New.
8166 * plugin.cc (Plugin::load): Don't parse the plugin option.
8167 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8168 (Plugin::add_option): New.
8169 (Plugin::args_): Change type.
8170 (Plugin::filename_): New.
8171 (Plugin_manager::add_plugin_option): New.
8172 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8173 * testsuite/Makefile.in: Regenerate.
8174
8175 2008-12-05 Cary Coutant <ccoutant@google.com>
8176
8177 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8178 Handle --strip-lto-sections option.
8179 * options.h (strip_lto_sections): New option.
8180
8181 2008-12-01 Cary Coutant <ccoutant@google.com>
8182
8183 * plugin.cc (ld_plugin_message): Change format parameter to const.
8184 Fix mismatch between new[] and delete.
8185
8186 2008-11-14 Cary Coutant <ccoutant@google.com>
8187
8188 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8189 instead of -1U.
8190
8191 2008-11-05 Craig Silverstein <csilvers@google.com>
8192
8193 * options.cc (General_options::parse_dynamic_list): New function.
8194 * options.h (General_options): New flags dynamic_list,
8195 dynamic_list_data, dynamic_list_cpp_new, and
8196 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
8197 (General_options::in_dynamic_list): New function.
8198 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8199 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8200 (Lex::can_continue_name): Likewise.
8201 (yylex): Likewise.
8202 (read_script_file): New parameter script_options.
8203 (read_dynamic_list): New function.
8204 (Script_options::define_dynamic_list): New function.
8205 (dynamic_list_keyword_parsecodes): New variable.
8206 (dynamic_list_keywords): New variable.
8207 * script.h (Script_options::define_dynamic_list): New function
8208 prototype.
8209 (read_dynamic_list): New function prototype.
8210 * symtab.cc (strprefix): New macro.
8211 (Symbol::should_add_dynsym_entry): Support dynamic_list,
8212 dynamic_list_data, dynamic_list_cpp_new, and
8213 dynamic_list_cpp_typeinfo.
8214 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8215 (dynamic_list_expr): New rule.
8216 (dynamic_list_nodes): Likewise.
8217 (dynamic_list_node): Likewise.
8218 * testsuite/Makefile.am (dynamic_list): New test.
8219 * testsuite/Makefile.in: Regenerated.
8220 * testsuite/dynamic_list.t: New file.
8221 * testsuite/dynamic_list.sh: New file.
8222
8223 2008-11-05 Craig Silverstein <csilvers@google.com>
8224
8225 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8226 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8227 (t11_last): Likewise.
8228 * testsuite/ver_test_6.c (main): Likewise.
8229
8230 2008-10-07 Cary Coutant <ccoutant@google.com>
8231
8232 * options.c (General_options::finalize): Add check for -static and
8233 -shared.
8234 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8235 is not empty.
8236
8237 2008-10-02 Cary Coutant <ccoutant@google.com>
8238
8239 * plugin.cc (make_sized_plugin_object): Fix conditional
8240 compilation to work when not all targets are enabled.
8241
8242 2008-09-29 Cary Coutant <ccoutant@google.com>
8243
8244 * archive.cc (Archive::get_file_and_offset): Use filename instead
8245 of name to get library path.
8246 (Archive::include_member): Unlock external member of a thin archive.
8247
8248 * testsuite/Makefile.am (TEST_AR): New variable.
8249 (thin_archive_test_1): New test.
8250 (thin_archive_test_2): New test.
8251 * testsuite/Makefile.in: Regenerate.
8252 * testsuite/thin_archive_main.cc: New file.
8253 * testsuite/thin_archive_test_1.cc: New file.
8254 * testsuite/thin_archive_test_2.cc: New file.
8255 * testsuite/thin_archive_test_3.cc: New file.
8256 * testsuite/thin_archive_test_4.cc: New file.
8257
8258 2008-09-29 Cary Coutant <ccoutant@google.com>
8259
8260 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8261 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8262 instead of -1U.
8263 (Sized_relobj::do_finalize_local_symbols): Likewise.
8264 (Sized_relobj::map_to_kept_section): Likewise.
8265 * object.h (Sized_relobj::invalid_address): New constant.
8266 (Sized_relobj::do_output_section_offset): Check for invalid_address
8267 and return -1ULL.
8268 * output.cc (Output_reloc::local_section_offset): Use constant
8269 invalid_address instead of -1U.
8270 (Output_reloc::get_address): Likewise.
8271 (Output_section::output_address): Change -1U to -1ULL.
8272 * output.h (Output_reloc::invalid_address): New constant.
8273 * reloc.cc (Sized_relobj::write_sections): Use constant
8274 invalid_address instead of -1U.
8275 (Sized_relobj::relocate_sections): Likewise.
8276 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8277 values for merge sections.
8278 * target-reloc.h (relocate_for_relocatable): Use constant
8279 invalid_address instead of -1U.
8280
8281 2008-09-19 Cary Coutant <ccoutant@google.com>
8282
8283 Add plugin functionality for link-time optimization (LTO).
8284 * configure.ac (plugins): Add --enable-plugins option.
8285 * configure: Regenerate.
8286 * config.in: Regenerate.
8287 * Makefile.am (LIBDL): New variable.
8288 (CCFILES): Add plugin.cc.
8289 (HFILES): Add plugin.h.
8290 (ldadd_var): Add LIBDL.
8291 * Makefile.in: Regenerate.
8292
8293 * archive.cc: Include "plugin.h".
8294 (Archive::setup): Don't preread archive symbols when using a plugin.
8295 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
8296 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8297 files.
8298 (Archive::include_member): Add symbols from plugin objects.
8299 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8300 * descriptors.cc (Descriptors::open): Check for file descriptors
8301 abandoned by plugins.
8302 (Descriptors::claim_for_plugin): New function.
8303 * descriptors.h (Descriptors::claim_for_plugin): New function.
8304 (Open_descriptor::is_claimed): New field.
8305 (claim_descriptor_for_plugin): New function.
8306 * fileread.cc (File_read::claim_for_plugin): New function.
8307 * fileread.h (File_read::claim_for_plugin): New function.
8308 (File_read::descriptor): New function.
8309 * gold.cc: Include "plugin.h".
8310 (queue_initial_tasks): Add task to call plugin hooks for generating
8311 new object files.
8312 * main.cc: Include "plugin.h".
8313 (main): Load plugin libraries.
8314 * object.h (Pluginobj): Declare.
8315 (Object::pluginobj): New function.
8316 (Object::do_pluginobj): New function.
8317 (Object::set_target): New function.
8318 * options.cc: Include "plugin.h".
8319 (General_options::parse_plugin): New function.
8320 (General_options::General_options): Initialize plugins_ field.
8321 (General_options::add_plugin): New function.
8322 * options.h (Plugin_manager): Declare.
8323 (General_options): Add --plugin option.
8324 (General_options::has_plugins): New function.
8325 (General_options::plugins): New function.
8326 (General_options::add_plugin): New function.
8327 (General_options::plugins_): New field.
8328 * plugin.cc: New file.
8329 * plugin.h: New file.
8330 * readsyms.cc: Include "plugin.h".
8331 (Read_symbols::do_read_symbols): Check for archive before checking
8332 for ELF file. Call plugin hooks to claim files.
8333 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8334 from a real object file; force override when processing replacement
8335 files.
8336 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8337 (Symbol::init_base_object): Likewise.
8338 (Symbol::init_base_output_data): Likewise.
8339 (Symbol::init_base_output_segment): Likewise.
8340 (Symbol::init_base_constant): Likewise.
8341 (Symbol::init_base_undefined): Likewise.
8342 (Symbol::output_section): Assert that object is not a plugin.
8343 (Symbol_table::add_from_pluginobj): New function.
8344 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8345 undefined.
8346 (Symbol_table::sized_write_globals): Likewise.
8347 (Symbol_table::add_from_pluginobj): Instantiate template.
8348 * symtab.h (Sized_pluginobj): Declare.
8349 (Symbol::in_real_elf): New function.
8350 (Symbol::set_in_real_elf): New function.
8351 (Symbol::in_real_elf_): New field.
8352 (Symbol_table::add_from_pluginobj): New function.
8353
8354 * testsuite/Makefile.am (AM_CFLAGS): New variable.
8355 (LIBDL): New variable.
8356 (LDADD): Add LIBDL.
8357 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8358 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8359 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8360 (MOSTLYCLEANFILES): Likewise.
8361 * testsuite/Makefile.in: Regenerate.
8362 * testsuite/plugin_test.c: New file.
8363 * testsuite/plugin_test_1.sh: New file.
8364 * testsuite/plugin_test_2.sh: New file.
8365
8366 2008-09-16 Ian Lance Taylor <iant@google.com>
8367
8368 * target-reloc.h (relocate_section): Check whether a symbol is
8369 defined by the ABI before reporting an undefined symbol error.
8370 * target.h (Target::is_defined_by_abi): Make parameter const.
8371 (Target::do_is_defined_by_abi): Likewise.
8372 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8373 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8374 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8375 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8376 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8377 * testsuite/Makefile.in: Rebuild.
8378
8379 * fileread.cc (make_view): Add casts to avoid warning.
8380
8381 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8382
8383 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8384 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8385
8386 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
8387
8388 * options.h (General_options::output_is_executable): New.
8389 (General_options::output_is_pie): New.
8390 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8391 for shared libraries.
8392 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8393
8394 2008-09-11 Chris Demetriou <cgd@google.com>
8395
8396 * options.h (origin): New -z option.
8397 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8398 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8399 in DT_FLAGS_1.
8400
8401 2008-09-05 Cary Coutant <ccoutant@google.com>
8402
8403 * fileread.cc (File_read::make_view): Add check for attempt to map
8404 beyond end of file.
8405
8406 2008-09-05 Cary Coutant <ccoutant@google.com>
8407
8408 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8409 explicit instantiations.
8410
8411 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
8412
8413 PR gold/6858
8414 * options.cc (General_options::finalize): Allow undefined symbols
8415 in shlibs if linking -shared.
8416
8417 PR gold/6859
8418 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8419 symbols as not needing a dynsym entry.
8420
8421 2008-08-20 Craig Silverstein <csilvers@google.com>
8422
8423 * fileread.cc (File_read::open): Do not lock the file unless it
8424 was successfully opened.
8425
8426 2008-08-14 Cary Coutant <ccoutant@google.com>
8427
8428 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8429 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8430 * testsuite/tls_test.cc (struct int128): 128-bit struct
8431 for testing TLS relocs with non-zero addend.
8432 (v12): New TLS variable.
8433 (t12): New test.
8434 (t_last): Add check for v12.
8435 * testsuite/tls_test.h (t12): New function.
8436 * testsuite/tls_test_main.cc (thread_routine): Call new test.
8437
8438 2008-08-13 Ian Lance Taylor <iant@google.com>
8439
8440 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8441 set tls_segment_ or relro_segment_.
8442 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8443 when appropriate.
8444 * output.h (Output_section::clear_is_relro): New function.
8445 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8446 sections specially even when output_data_ is empty.
8447 (Output_segment::maximum_alignment): When first section is relro,
8448 only force alignment for PT_LOAD segments.
8449 * script.cc (script_data_segment_align): New function.
8450 (script_data_segment_relro_end): New function.
8451 * script-c.h (script_data_segment_align): Declare.
8452 (script_data_segment_relro_end): Declare.
8453 * script-sections.h (class Script_sections): Declare
8454 data_segment_align and data_segment_relro_end. Add fields
8455 segment_align_index_ and saw_relro_end_.
8456 * script-sections.cc (class Sections_element): Add set_is_relro
8457 virtual function. Add new bool* parameter to place_orphan_here.
8458 Add get_output_section virtual function.
8459 (class Output_section_definition): Add set_is_relro. Add new
8460 bool* parameter to place_orphan_here. Add get_output_section.
8461 Add is_relro_ field.
8462 (Output_section_definition::Output_section_definition): Initialize
8463 evaluated_address_, evaluated_load_address, evaluated_addralign_,
8464 and is_relro_ fields.
8465 (Output_section_definition::place_orphan_here): Add is_relro
8466 parameter.
8467 (Output_section_definition::set_section_addresses): Set relro for
8468 output section.
8469 (Output_section_definition::alternate_constraint): Likewise.
8470 (class Orphan_output_section): Add new bool* parameter to
8471 place_orphan_here. Add get_output_section.
8472 (Orphan_output_section::place_orphan_here): Add is_relro
8473 parameter.
8474 (Script_sections::Script_sections): Initialize
8475 data_segment_align_index_ and saw_relro_end_.
8476 (Script_sections::data_segment_align): New function.
8477 (Script_sections::data_segment_relro_end): New function.
8478 (Script_sections::place_orphan): Set or clear is_relro.
8479 (Script_sections::set_section_addresses): Force alignment of first
8480 TLS section.
8481 * yyscript.y (exp): Call script_data_segment_align and
8482 script_data_segment_relro_end.
8483 * testsuite/relro_script_test.t: New file.
8484 * testsuite/relro_test.cc (using_script): Declare.
8485 (t1, t2): Test using_script.
8486 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8487 (relro_script_test_SOURCES): Define.
8488 (relro_script_test_DEPENDENCIES): Define.
8489 (relro_script_test_LDFLAGS): Define.
8490 (relro_script_test_LDADD): Define.
8491 (relro_script_test.so): New target.
8492 * testsuite/Makefile.in: Rebuild.
8493
8494 2008-08-06 Cary Coutant <ccoutant@google.com>
8495
8496 * archive.cc (Archive::total_archives, Archive::total_members)
8497 (Archive::total_members_loaded): New variables.
8498 (Archive::setup): Add parameter. Add option to preread
8499 archive symbols.
8500 (Archive::read_armap): Add counter.
8501 (Archive::get_file_and_offset): New function.
8502 (Archive::get_elf_object_for_member): New function.
8503 (Archive::read_all_symbols): New function.
8504 (Archive::read_symbols): New function.
8505 (Archive::add_symbols): Add counters.
8506 (Archive::include_all_members): Use armap to find members if it's
8507 already built.
8508 (Archive::include_member): Skip reading symbols if already read.
8509 Factored code into Archive::get_file_and_offset and
8510 Archive::get_elf_object_for_member. Changed call to
8511 Mapfile::report_include_archive_member.
8512 (Archive::print_stats): New function.
8513 * archive.h: Declare Object and Read_symbols_data classes.
8514 (Archive::Archive): Add initializers for new members.
8515 (Archive::setup): Add parameter.
8516 (Archive::print_stats): New function.
8517 (Archive::total_archives, Archive::total_members)
8518 (Archive::total_members_loaded): New variables.
8519 (Archive::get_file_and_offset): New function.
8520 (Archive::get_elf_object_for_member): New function.
8521 (Archive::read_all_symbols): New function.
8522 (Archive::read_symbols): New function.
8523 (Archive::Archive_member): New class.
8524 (Archive::members_): New member.
8525 (Archive::num_members_): New member.
8526 * main.cc: Include archive.h.
8527 (main): Call Archive::print_stats.
8528 * mapfile.cc (Mapfile::report_include_archive_member): Delete
8529 archive parameter; member_name is now the fully-decorated name.
8530 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8531 * options.h: (General_options): Add --preread-archive-symbols option.
8532 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8533 Archive::setup.
8534
8535 2008-08-04 Ian Lance Taylor <iant@google.com>
8536
8537 * symtab.h (Symbol::use_plt_offset): New function.
8538 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8539 * powerpc.cc (Relocate::relocate): Likewise.
8540 * sparc.cc (Relocate::relocate): Likewise.
8541 * x86_64.cc (Relocate::relocate): Likewise.
8542 * testsuite/weak_plt.sh: New test.
8543 * testsuite/weak_plt_main.cc: New test.
8544 * testsuite/weak_plt_shared.cc: New test.
8545 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8546 (check_PROGRAMS): Add weak_plt.
8547 (check_DATA): Add weak_plt_shared.so.
8548 (weak_plt_main_pic.o, weak_plt): New targets.
8549 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8550 * testsuite/Makefile.in: Rebuild.
8551
8552 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8553 gcctestdir/ld.
8554 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8555 * testsuite/Makefile.in: Rebuild.
8556
8557 2008-08-04 Alan Modra <amodra@bigpond.net.au>
8558
8559 * Makefile.am (POTFILES.in): Set LC_ALL=C.
8560 * Makefile.in: Regenerate.
8561 * po/POTFILES.in: Regenerate.
8562
8563 2008-07-29 Ian Lance Taylor <iant@google.com>
8564
8565 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8566 symbols before other symbols.
8567 * testsuite/script_test_2.cc (test_addr): Declare.
8568 (test_addr_alias): Declare.
8569 (main): Check that test_addr and test_addr_alias have the right
8570 values.
8571 * testsuite/script_test_2.t: Define test_addr_alias and
8572 test_addr.
8573
8574 2008-07-24 Ian Lance Taylor <iant@google.com>
8575
8576 PR 5990
8577 * descriptors.cc: New file.
8578 * descriptors.h: New file.
8579 * gold-threads.h (class Hold_optional_lock): New class.
8580 * fileread.cc: Include "descriptors.h".
8581 (File_read::~File_read): Release descriptor rather than closing
8582 it.
8583 (File_read::open) [file]: Call open_descriptor rather than open.
8584 Set is_descriptor_opened_.
8585 (File_read::open) [memory]: Assert that descriptor is not open.
8586 (File_read::reopen_descriptor): New function.
8587 (File_read::release): Release descriptor.
8588 (File_read::do_read): Make non-const. Reopen descriptor.
8589 (File_read::read): Make non-const.
8590 (File_read::make_view): Reopen descriptor.
8591 (File_read::do_readv): Likewise.
8592 * fileread.h (class File_read): Add is_descriptor_opened_ field.
8593 Update declarations.
8594 * layout.cc: Include "descriptors.h".
8595 (Layout::create_build_id): Use open_descriptor rather than open.
8596 * output.cc: Include "descriptors.h".
8597 (Output_file::open): Use open_descriptor rather than open.
8598 * archive.cc (Archive::const_iterator): Change Archive to be
8599 non-const.
8600 (Archive::begin, Archive::end): Make non-const.
8601 (Archive::count_members): Likewise.
8602 * archive.h (class Archive): Update declarations.
8603 * object.h (Object::read): Make non-const.
8604 * Makefile.am (CCFILES): Add descriptors.cc.
8605 (HFILES): Add descriptors.h.
8606 * Makefile.in: Rebuild.
8607
8608 PR 6716
8609 * gold.h: Always include <clocale>. Add Solaris workarounds
8610 following code in binutils/sysdep.h.
8611
8612 PR 6048
8613 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8614 this->eh_frame_hdr_ is NULL before using it.
8615
8616 * dynobj.cc (Versions::Versions): Update comment.
8617
8618 * dynobj.cc (Versions::Versions): If there is an soname, use it as
8619 the base version name.
8620
8621 * stringpool.cc (Stringpool_template::add_with_length): Set key to
8622 array size plus one.
8623 (Stringpool_template::set_string_offsets): Subtract one from key
8624 before using it as an array index.
8625 (Stringpool_template::get_offset_with_length): Likewise.
8626 (Stringpool_template::write_to_buffer): Likewise.
8627 * stringpool.h (Stringpool_template::get_offset_from_key):
8628 Likewise.
8629
8630 2008-07-23 Ian Lance Taylor <iant@google.com>
8631
8632 PR 6658
8633 * object.h (Merged_symbol_value::value): Do our best to handle a
8634 negative addend.
8635
8636 PR 6647
8637 * script.cc (Version_script_info::get_versions): Don't add empty
8638 version tag to return value.
8639 (Version_script_info::get_symbol_version_helper): Change return
8640 type to bool. Add pversion parameter. Change all callers.
8641 (script_register_vers_node): Don't require a non-NULL tag.
8642 * script.h (class Version_script_info): Update declarations.
8643 (Version_script_info::get_symbol_version): Change return type to
8644 bool. Add version parameter. Change all callers.
8645 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8646 handling. Handle an empty version from a version script.
8647 (Symbol_table::define_special_symbol): Likewise.
8648 * testsuite/ver_test_10.script: New file.
8649 * testsuite/ver_test_10.sh: New file.
8650 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8651 (check_DATA): Add ver_test_10.syms.
8652 (ver_test_10.syms, ver_test_10.so): New target.
8653 * testsuite/Makefile.in: Rebuild.
8654
8655 2008-07-23 Simon Baldwin <simonb@google.com>
8656
8657 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8658 to zero for undefined symbols from dynamic libraries.
8659
8660 2008-07-23 Ian Lance Taylor <iant@google.com>
8661
8662 * symtab.cc (Symbol_table::resolve): Remove version parameter.
8663 Change all callers.
8664 * symtab.h (class Symbol_table): Update declaration.
8665 * testsuite/ver_test_9.cc: New file.
8666 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8667 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8668 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8669 (ver_test_9.so, ver_test_9.o): New targets.
8670 * testsuite/Makefile.in: Rebuild.
8671
8672 2008-07-22 Ian Lance Taylor <iant@google.com>
8673
8674 * options.h (class General_options): Define --check-sections.
8675 * layout.cc (Layout::set_segment_offsets): Handle
8676 --check-sections.
8677
8678 * options.h (class General_options): Define -n/--nmagic and
8679 -N/--omagic.
8680 * options.cc (General_options::finalize): For -n/--nmagic or
8681 -N/--omagic, set -static.
8682 * layout.cc (Layout::attach_allocated_section_to_segment): If
8683 -N/--omagic, don't put read-only and read-write sections in
8684 different segments.
8685 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8686 finding a read-only segment.
8687 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8688 don't set the minimum segment alignment to the common page size,
8689 and don't set the file offset to the address modulo the page size.
8690 * script-sections.cc (Script_sections::create_segments): If
8691 -n/--omagic, don't put read-only and read-write sections in
8692 different segments.
8693
8694 * cref.cc: New file.
8695 * cref.h: New file.
8696 * options.h (class General_options): Add --print-symbol-counts.
8697 * main.cc (main): Issue defined symbol report if requested.
8698 * archive.cc (Archive::interpret_header): Make into a const member
8699 function.
8700 (Archive::add_symbols): Call Input_objects::archive_start and
8701 archive_stop.
8702 (Archive::const_iterator): Define new class.
8703 (Archive::begin, Archive::end): New functions.
8704 (Archive::include_all_members): Rewrite to use iterator.
8705 (Archive::count_members): New function.
8706 * archive.h (class Archive): Update declarations.
8707 (Archive::filename): New function.
8708 * object.cc: Include "cref.h".
8709 (Sized_relobj::Sized_relobj): Initialize defined_count_.
8710 (Sized_relobj::do_get_global_symbol_counts): New function.
8711 (Input_objects::add_object): Add object to cross-referencer.
8712 (Input_objects::archive_start): New function.
8713 (Input_objects::archive_stop): New function.
8714 (Input_objects::print_symbol_counts): New function.
8715 * object.h: Declare Cref and Archive.
8716 (Object::get_global_symbol_counts): New function.
8717 (Object::do_get_global_symbol_counts): New pure virtual function.
8718 (class Sized_relobj): Add defined_count_ field. Update
8719 declarations.
8720 (class Input_objects): Add cref_ field. Update constructor.
8721 Update declarations.
8722 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8723 defined_count_.
8724 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8725 symbol counts.
8726 (Sized_dynobj::do_get_global_symbol_counts): New function.
8727 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8728 defined_count_. Update declarations. Define Symbols typedef.
8729 * symtab.cc (Symbol_table::add_from_relobj): Add defined
8730 parameter. Change all callers.
8731 (Symbol_table::add_from_dynobj): Add sympointers and defined
8732 parameters. Change all callers.
8733 * symtab.h (class Symbol_table): Update declarations.
8734 * Makefile.am (CCFILES): Add cref.cc.
8735 (HFILES): Add cref.h.
8736 * Makefile.in: Rebuild.
8737
8738 2008-07-22 Simon Baldwin <simonb@google.com>
8739
8740 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8741 to zero when writing undefined symbols.
8742
8743 2008-07-22 Ian Lance Taylor <iant@google.com>
8744
8745 * output.cc (Output_section::add_input_section): Don't try to
8746 merge empty merge sections.
8747
8748 2008-07-21 Craig Silverstein <csilvers@google.com>
8749
8750 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8751 Include symbol version in error message.
8752
8753 2008-07-20 Chris Demetriou <cgd@google.com>
8754
8755 * configure.ac (gold_cv_c_random_seed): New configured variable.
8756 (RANDOM_SEED_CFLAGS): New substituted variable.
8757 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8758 * configure: Rebuild.
8759 * Makefile.in: Likewise.
8760 * testsuite/Makefile.in: Likewise.
8761
8762 2008-07-18 Ian Lance Taylor <iant@google.com>
8763
8764 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8765 where we see NAME/NULL and NAME/VERSION as separate symbols.
8766 * testsuite/ver_test_main.cc (main): Call t4.
8767 (t4, t4_2a): Define.
8768 * testsuite/ver_test_2.cc (t4_2): Define.
8769 * testsuite/ver_test_2.script: Put t4_2a in VER2.
8770 * testsuite/ver_test_4.cc (t4_2a): Define.
8771 * testsuite/ver_test_4.script: Put t4_2a in VER2.
8772 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8773
8774 2008-07-17 Ian Lance Taylor <iant@google.com>
8775
8776 * dynobj.cc (Versions::add_def): If we give an error about a
8777 missing version, go ahead and create the version anyhow.
8778
8779 2008-07-10 Ian Lance Taylor <iant@google.com>
8780
8781 Handle output sections with more than 0x7fffffff bytes.
8782 * object.h (class Relobj): Change map_to_output_ to
8783 output_sections_, and just keep a section pointer. Change all
8784 uses. Move comdat group support to Sized_relobj.
8785 (Relobj::is_section_specially_mapped): Remove.
8786 (Relobj::output_section): Remove poff parameter. Change all
8787 callers.
8788 (Relobj::output_section_offset): New function.
8789 (Relobj::set_section_offset): Rewrite.
8790 (Relobj::map_to_output): Remove.
8791 (Relobj::output_sections): New function.
8792 (Relobj::do_output_section_offset): New pure virtual function.
8793 (Relobj::do_set_section_offset): Likewise.
8794 (class Sized_relobj): Add section_offsets_ field. Add comdat
8795 group support from Relobj. Update declarations.
8796 (Sized_relobj::get_output_section_offset): New function.
8797 (Sized_relobj::do_output_section_offset): New function.
8798 (Sized_relobj::do_set_section_offset): New function.
8799 * object.cc (Relobj::output_section_address): Remove.
8800 (Sized_relobj::Sized_relobj): Initialize new fields.
8801 (Sized_relobj::include_section_group): Cast find_kept_object to
8802 Sized_relobj.
8803 (Sized_relobj::include_linkonce_section): Likewise.
8804 (Sized_relobj::do_layout): Use separate arrays for output section
8805 and output offset.
8806 (Sized_relobj::do_count_local_symbols): Change map_to_output to
8807 output_sections.
8808 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8809 output_sections and section_offsets.
8810 (Sized_relobj::write_local_symbols): Likewise.
8811 (map_to_kept_section): Compute output address directly.
8812 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8813 output_sections and section_offsets.
8814 (Sized_relobj::write_sections): Likewise.
8815 (Sized_relobj::relocate_sections): Likewise.
8816 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8817 * output.h (class Output_reloc): Update declarations. Change
8818 u2_.relobj to Sized_relobj*.
8819 (class Output_data_reloc): Change add functions to use
8820 Sized_relobj*.
8821 * output.cc (Output_reloc::Output_reloc): Change relobj to
8822 Sized_relobj*.
8823 (Output_reloc::local_section_offset): Change return type to
8824 Elf_Addr. Use get_output_section_offset.
8825 (Output_reloc::get_address): Likewise.
8826 (Output_section::is_input_address_mapped): Don't call
8827 is_section_specially_mapped.
8828 (Output_section::output_offset): Likewise.
8829 (Output_section::output_address): Likewise.
8830 (Output_section::starting_output_address): Likewise.
8831 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8832 parameter to Sized_relobj*.
8833 (Copy_relocs::need_copy_reloc): Likewise.
8834 (Copy_relocs::save): Likewise.
8835 * copy-relocs.h (class Copy_relocs): Update declarations.
8836 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8837 Sized_relobj*. Change relobj_ field to Sized_relobj*.
8838 * target-reloc.h (relocate_for_relocatable): Change
8839 offset_in_output_section type to Elf_Addr. Change code that uses
8840 it as well.
8841 * layout.cc (Layout::layout): Always set *off.
8842 * mapfile.cc (Mapfile::print_input_section): Use
8843 output_section_offset.
8844 * i386.cc (Target_i386::copy_reloc): Change object parameter to
8845 Sized_relobj*.
8846 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8847 * sparc.cc (Target_sparc::copy_reloc): Likewise.
8848 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8849
8850 2008-07-03 Ian Lance Taylor <iant@google.com>
8851
8852 * layout.cc (Layout::include_section): Do not discard unrecognized
8853 SHT_STRTAB sections.
8854
8855 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
8856
8857 * script.cc (Lex::can_continue_name): Make '?' allowable in
8858 version-script names.
8859 * testsuite/version_script.map: Change glob pattern to use '?'
8860
8861 2008-06-30 Manish Singh <yosh@gimp.org>
8862
8863 PR 6585
8864 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8865 Correct typo.
8866
8867 2008-06-30 Ian Lance Taylor <iant@google.com>
8868
8869 PR 6660
8870 PR 6682
8871 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8872 versions]: Don't try to read the value in the contents, since we
8873 don't use it. Use the template endianness when writing.
8874
8875 2008-06-25 Cary Coutant <ccoutant@google.com>
8876
8877 * fileread.cc (File_read::make_view): Assert on zero-length view.
8878 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8879 symbol table when there are no symbols to read.
8880
8881 2008-06-23 Craig Silverstein <csilvers@google.com>
8882
8883 * version.cc (version_string): Bump to 1.7
8884
8885 2008-06-18 Craig Silverstein <csilvers@google.com>
8886
8887 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8888 constant 0xFFFF to type Valtype.
8889 (Powerpc_relocate_functions::rel16_ha): Likewise.
8890
8891 2008-06-17 Ian Lance Taylor <iant@google.com>
8892
8893 * output.h (Output_section::Input_section): Initialize p2align_ to
8894 zero for Output_section_data constructors.
8895 (Output_section::Input_section::addralign): If not an input
8896 section, return the alignment of the Output_section_data.
8897 * testsuite/copy_test.cc: New file.
8898 * testsuite/copy_test_1.cc: New file.
8899 * testsuite/copy_test_2.cc: New file.
8900 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8901 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8902 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8903 (copy_test_1_pic.o, copy_test_1.so): New targets.
8904 (copy_test_2_pic.o, copy_test_2.so): New targets.
8905 * testsuite/Makefile.in: Rebuild.
8906
8907 * script-sections.cc (Script_sections::place_orphan): Initialize
8908 local variable exact.
8909
8910 2008-06-13 David Edelsohn <edelsohn@gnu.org>
8911
8912 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8913
8914 2008-06-12 David Edelsohn <edelsohn@gnu.org>
8915 David S. Miller <davem@davemloft.net>
8916
8917 * powerpc.cc: New file.
8918 * Makefile.am (TARGETSOURCES): Add powerpc.cc
8919 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8920 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8921 * Makefile.in: Rebuild.
8922
8923 2008-06-09 Ian Lance Taylor <iant@google.com>
8924
8925 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8926 <exception>.
8927 (throwing, orig_terminate): New static variables.
8928 (terminate_handler): New static function.
8929 (t2): Set terminate handler.
8930
8931 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
8932
8933 PR 6584
8934 * binary.cc (Binary_to_elf::sized_convert): Fix .data
8935 alignment.
8936
8937 2008-05-30 Cary Coutant <ccoutant@google.com>
8938
8939 * archive.cc (Archive::include_all_members) Correct to step
8940 over symbol table and extended name table in thin archives.
8941
8942 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
8943
8944 PR 6407
8945 * target-reloc.h (relocate_for_relocatable): Fix new_offset
8946 calculation.
8947
8948 2008-05-28 Caleb Howe <cshowe@google.com>
8949
8950 * reduced_debug_output.cc: New file.
8951 * reduced_debug_output.h: New file.
8952 * options.h (class General_options): Add --strip-debug-non-line.
8953 * options.cc (General_options::finalize): Add strip_debug_non_line
8954 to the strip heirarchy.
8955 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8956 fields.
8957 * layout.cc: Include "reduced_debug_output.h".
8958 (Layout::Layout): Initialize new fields.
8959 (line_only_debug_sections): New static array.
8960 (is_lines_only_debug_sections): New static inline function.
8961 (Layout::include_section): Handle --strip-debug-non-line.
8962 (Layout::make_output_section): If --strip-debug-non-line, build
8963 new output sections for .debug_abbrev and .debug_info.
8964 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8965 gold. Warn about possible overflow.
8966 (read_signed_LEB_128): Likewise.
8967 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8968 (read_signed_LEB_128): Declare.
8969 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8970 (HFILES): Add reduced_debug_output.h.
8971 * Makefile.in: Rebuild.
8972
8973 2008-05-21 Ian Lance Taylor <iant@google.com>
8974
8975 * mapfile.cc: New file.
8976 * mapfile.h: New file.
8977 * options.h (class General_options): Add -M/--print-map and -Map.
8978 * options.cc (General_options::finalize): Make -M equivalent to
8979 -Map -.
8980 * main.cc: Include <cstdio> and "mapfile.h".
8981 (main): Open mapfile if requested.
8982 * gold.cc (class Middle_runner): Add mapfile_ field. Update
8983 constructor. Change caller.
8984 (queue_initial_tasks): Add mapfile parameter. Change caller.
8985 (queue_middle_tasks): Likewise.
8986 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8987 declarations.
8988 * archive.cc: Include "mapfile.h".
8989 (Archive::add_symbols): Add mapfile parameter. Change all
8990 callers. Pass mapfile, symbol, and reason to include_member.
8991 (Archive::include_all_members): Add mapfile parameter. Change all
8992 callers.
8993 (Archive::include_member): Add mapfile, sym, and why parameters.
8994 Change all callers. Report inclusion to map file.
8995 * archive.h: Include "fileread.h".
8996 (class Archive): Update declarations.
8997 (Archive::file): New const method.
8998 (class Add_archive_symbols): Add mapfile_ field. Update
8999 constructor. Change all callers.
9000 * readsyms.h (class Read_symbols): Likewise.
9001 (class Finish_group): Likewise.
9002 (class Read_script): Likewise.
9003 * common.cc: Include "mapfile.h".
9004 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9005 all callers.
9006 (Symbol_table::do_allocate_commons): Likewise.
9007 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9008 symbol allocation to mapfile.
9009 * common.h (class Allocate_commons_task): Add mapfile_ field.
9010 Update constructor. Change all callers.
9011 * symtab.h (class Symbol_table): Update declarations.
9012 * layout.cc: Include "mapfile.h".
9013 (Layout_task_runner::run): Print information to mapfile.
9014 (Layout::create_gold_note): Change Output_data_fixed_space to
9015 Output_data_zero_fill.
9016 (Layout::create_build_id): Likewise.
9017 (Layout::print_to_mapfile): New function.
9018 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9019 constructor. Change caller.
9020 (class Layout): Declare print_to_mapfile.
9021 * output.cc (Output_section::Input_section::print_to_mapfile): New
9022 function.
9023 (Output_section::add_input_section): If producing a map, always
9024 add to input_sections_ list.
9025 (Output_section::do_print_to_mapfile): New function.
9026 (Output_segment::print_sections_to_mapfile): New function.
9027 (Output_segment::print_section_list_to_mapfile): New function.
9028 * output.h: Include "mapfile.h".
9029 (Output_data::print_to_mapfile): New function.
9030 (Output_data::do_print_to_mapfile): New virtual function.
9031 (Output_segment_headers::do_print_to_mapfile): New function.
9032 (Output_file_header::do_print_to_mapfile): New function.
9033 (Output_data_const::do_print_to_mapfile): New function.
9034 (class Output_data_const_buffer): Add map_name_ field. Update
9035 constructor. Change all callers. Add do_print_to_mapfile
9036 function.
9037 (class Output_data_fixed_space): Likewise.
9038 (class Output_data_space): Likewise.
9039 (class Output_data_zero_fill): New class.
9040 (Output_data_strtab::do_print_to_mapfile): New function.
9041 (Output_data_reloc_base::do_print_to_mapfile): New function.
9042 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9043 (Output_data_group::do_print_to_mapfile): New function.
9044 (Output_data_got::do_print_to_mapfile): New function.
9045 (Output_data_dynamic::do_print_to_mapfile): New function.
9046 (Output_symtab_xindex::do_print_to_mapfile): New function.
9047 (class Output_section): Declare do_print_to_mapflie. Declare
9048 print_to_mapfile in Input_section.
9049 (class Output_segment): Declare new functions.
9050 * object.h (Sized_relobj::symbol_count): New function.
9051 * script-sections.cc
9052 (Output_section_element_dot_assignment::set_section_addresses):
9053 Change Output_data_fixed_space to Output_data_zero_fill.
9054 (Output_data_expression::do_print_to_mapfile): New function.
9055 * script.cc (read_input_script): Add mapfile parameter. Change
9056 all callers.
9057 * script.h (read_input_script): Update declaration.
9058 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9059 (Eh_frame::do_print_to_mapfile): New function.
9060 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9061 (Output_merge_string::do_print_to_mapfile): New function.
9062 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9063 function.
9064 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9065 function.
9066 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9067 function.
9068 * Makefile.am (CCFILES): Add mapfile.cc.
9069 (HFILES): Add mapfile.h.
9070 * Makefile.in: Rebuild.
9071
9072 2008-05-19 Ian Lance Taylor <iant@google.com>
9073
9074 * options.h (class General_options): Add -z relro.
9075 * layout.cc (Layout::Layout): Initialize relro_segment_.
9076 (Layout::add_output_section_data): Return the output section.
9077 (Layout::make_output_section): Rcognize relro sections and mark
9078 them appropriately.
9079 (Layout::attach_allocated_section_to_segment): Put relro sections
9080 in a PT_GNU_RELRO segment.
9081 (Layout::create_initial_dynamic_sections): Mark the .dynamic
9082 section as relro.
9083 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9084 PT_TLS segments.
9085 (Layout::linkonce_mapping): Map d.rel.ro.local to
9086 .data.rel.ro.local.
9087 (Layout::output_section_name): Us .data.rel.ro.local for any
9088 section which begins with that.
9089 * layout.h (class Layout): Update add_output_section_data
9090 declaration. Add relro_segment_ field.
9091 * output.cc (Output_section::Output_section): Initialize is_relro_
9092 and is_relro_local_ fields.
9093 (Output_segment::add_output_section): Group relro sections.
9094 (Output_segment::is_first_section_relro): New function.
9095 (Output_segment::maximum_alignment): If there is a relro section,
9096 align the segment to the common page size.
9097 (Output_segment::set_section_addresses): Track whether we are
9098 looking at relro sections. If the last section is a relro
9099 section, align to the common page size.
9100 (Output_segment::set_section_list_addresses): Add in_relro
9101 parameter. Change all callers. Align to the page size when
9102 moving from relro to non-relro section.
9103 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9104 segment.
9105 * output.h (class Output_section): Add is_relro_ and
9106 is_relro_local_ fields.
9107 (Output_section::is_relro): New function.
9108 (Output_section::set_is_relro): New function.
9109 (Output_section::is_relro_local): New function.
9110 (Output_section::set_is_relro_local): New function.
9111 (class Output_segment): Update declarations.
9112 * i386.cc (Target_i386::got_section): Mark .got section as relro.
9113 * sparc.cc (Target_sparc::got_section): Likewise.
9114 * x86_64.cc (Target_x86_64::got_section): Likewise.
9115 * testsuite/relro_test_main.cc: New file.
9116 * testsuite/relro_test.cc: New file.
9117 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9118 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9119 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9120 (relro_test.so, relro_test_pic.o): New targets.
9121 * testsuite/Makefile.in: Rebuild.
9122
9123 2008-05-16 Ian Lance Taylor <iant@google.com>
9124
9125 * output.cc (Output_segment::add_output_section): Remove front
9126 parameter.
9127 * output.h (class Output_segment): Remove
9128 add_initial_output_section and overloaded add_output_section.
9129 Update declaration of remaining add_output_section.
9130 * layout.cc (Layout::create_interp): Call add_output_section
9131 rather than add_initial_output_section.
9132 (Layout::finish_dynamic_section): Likewise.
9133
9134 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9135 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
9136 know the dynamic type.
9137 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9138 field. Initialize it in constructor.
9139 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9140 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9141 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9142 reloc.
9143
9144 * output.cc (Output_reloc::get_address): Change return type to
9145 Elf_Addr.
9146 * output.h (class Output_reloc): Update get_address declaration.
9147 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9148 for section addresses.
9149
9150 2008-05-09 Ian Lance Taylor <iant@google.com>
9151
9152 PR 6493
9153 * gold.cc (gold_nomem): Use return value of write.
9154
9155 2008-05-08 Ian Lance Taylor <iant@google.com>
9156
9157 * symtab.c (Symbol::init_base_output_data): Add version
9158 parameter. Change all callers.
9159 (Symbol::init_base_output_segment): Likewise.
9160 (Symbol::init_base_constant): Likewise.
9161 (Symbol::init_base_undefined): Likewise.
9162 (Sized_symbol::init_output_data): Likewise.
9163 (Sized_symbol::init_output_segment): Likewise.
9164 (Sized_symbol::init_constant): Likewise.
9165 (Sized_symbol::init_undefined): Likewise.
9166 (Symbol_table::do_define_in_output_data): If the new symbol has a
9167 version, mark it as the default.
9168 (Symbol_table::do_define_in_output_segment): Likewise.
9169 (Symbol_table::do_define_as_constant): Likewise.
9170 * symtab.h (class Symbol): Update declarations.
9171 (class Sized_symbol): Likewise.
9172 * resolve.cc (Symbol::override_version): New function.
9173 (Symbol::override_base): Call override_version.
9174 (Symbol::override_base_with_special): Likewise.
9175 * testsuite/ver_script_8.script: New file.
9176 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9177 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9178 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9179 (ver_test_8_1.so, ver_test_8_2.so): New targets.
9180
9181 2008-05-06 Ian Lance Taylor <iant@google.com>
9182
9183 PR 6049
9184 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9185 functions.
9186 (class General_options): Remove existing --undefined, and add
9187 --no-undefined instead. Add new --undefined as synonym for -u.
9188 * archive.cc (Archive::add_symbols): Check whether symbol was
9189 named with -u.
9190 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9191 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9192 all uses. Add IS_UNDEFINED. Update declarations to split
9193 different versions of init_base. Declare init_base_undefined.
9194 (Symbol::is_defined): Handle IS_UNDEFINED.
9195 (Symbol::is_undefined): Likewise.
9196 (Symbol::is_weak_undefined): Call is_undefined.
9197 (Symbol::is_absolute): Handle IS_CONSTANT.
9198 (class Sized_symbol): Update declarations to split different
9199 versions of init. Declare init_undefined.
9200 (class Symbol_table): Declare new functions.
9201 * symtab.cc (Symbol::init_base_object): Rename from init_base.
9202 Change all callers.
9203 (Symbol::init_base_output_data): Likewise.
9204 (Symbol::init_base_output_segment): Likewise.
9205 (Symbol::init_base_constant): Likewise.
9206 (Symbol::init_base_undefined): New function.
9207 (Sized_symbol::init_object): Rename from init. Change all
9208 callers.
9209 (Sized_symbol::init_output_data): Likewise.
9210 (Sized_symbol::init_output_segment): Likewise.
9211 (Sized_symbol::init_constant): Likewise.
9212 (Sized_symbol::init_undefined): New function.
9213 (Symbol_table::add_undefined_symbols_from_command_line): New
9214 function.
9215 (Symbol_table::do_add_undefined_symbols_from_command_line): New
9216 function.
9217 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9218 (Symbol::output_section): Likewise.
9219 (Symbol::set_output_section): Likewise.
9220 (Symbol_table::sized_finalize_symbol): Likewise.
9221 (Symbol_table::sized_write_globals): Likewise.
9222 * resolve.cc (Symbol_table::should_override): Likewise.
9223 (Symbol::override_base_with_special): Likewise.
9224
9225 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9226 symbol, change it to have default visibility.
9227 * testsuite/protected_1.cc: New file.
9228 * testsuite/protected_2.cc: New file.
9229 * testsuite/protected_3.cc: New file.
9230 * testsuite/protected_main_1.cc: New file.
9231 * testsuite/protected_main_2.cc: New file.
9232 * testsuite/protected_main_3.cc: New file.
9233 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9234 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9235 (protected_1_LDFLAGS, protected_1_LDADD): Define.
9236 (protected_1.so): New target.
9237 (protected_1_pic.o, protected_2_pic.o): New targets.
9238 (protected_3_pic.o): New target.
9239 (check_PROGRAMS): Add protected_2.
9240 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9241 (protected_2_LDFLAGS, protected_2_LDADD): Define.
9242 * testsuite/Makefile.in: Rebuild.
9243
9244 * options.h (DEFINE_var): Add set_user_set_##varname__.
9245 (DEFINE_bool_alias): New macro.
9246 (class General_options): Define -Bstatic using DEFINE_bool_alias
9247 rather than DEFINE_special. Add --undefined as an alias for -z
9248 defs.
9249 * options.cc (General_options::parse_Bstatic): Remove.
9250
9251 * options.h (class General_options): Add --fatal-warnings.
9252 * main.cc (main): Implement --fatal-warnings.
9253 * errors.h (Errors::warning_count): New function.
9254
9255 * options.h (class General_options): Add -Bsymbolic-functions.
9256 * symtab.h (Symbol::is_preemptible): Check for
9257 -Bsymbolic-functions.
9258
9259 2008-05-05 Ian Lance Taylor <iant@google.com>
9260
9261 * options.h (DEFINE_bool): For DASH_Z, create the negative option
9262 as noVARNAME rather than no-VARNAME.
9263 (class General_options): Add option -z combreloc.
9264 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9265 get_address.
9266 (Output_reloc::sort_before) [SHT_REL]: New function.
9267 (Output_reloc::sort_before) [SHT_RELA]: New function.
9268 (class Output_data_reloc_base): Add sort_relocs_ field. Define
9269 Sort_relocs_comparison.
9270 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9271 parameter. Change all callers.
9272 (Output_data_reloc::Output_data_reloc) [both versions]: Add
9273 sort_relocs parameter. Change all callers.
9274 * output.cc (Output_reloc::get_address): New function, broken out
9275 of write_rel.
9276 (Output_reloc::write_rel): Call it.
9277 (Output_reloc::compare): New function.
9278 (Output_data_reloc_base::do_write): Optionally sort relocs.
9279
9280 * configure.ac: If targ_extra_obj is set, link it in.
9281 * configure.tgt: Initialize all variables.
9282 (x86_64*): Set targ_extra_obj and targ_extra_size.
9283 * configure: Rebuild.
9284
9285 * object.cc (Sized_relobj::include_section_group): Adjust section
9286 indexes read from group data. Build vector to pass to
9287 layout_group.
9288 * layout.cc (Layout::layout_group): Add flags and shndxes
9289 parameters. Remove contents parameter. Change caller. Update
9290 explicit instantiations.
9291 * layout.h (class Layout): Update layout_group declaration.
9292 * output.cc (Output_data_group::Output_data_group): Add flags and
9293 input_shndxes parameters. Remove contents parameter. Change
9294 caller.
9295 (Output_data_group::do_write): Change input_sections_ to
9296 input_shndxes_.
9297 * output.h (class Output_data_group): Update constructor
9298 declaration. Rename input_sections_ to input_shndxes_.
9299 * testsuite/many_sections_test.cc: Add template.
9300
9301 2008-04-30 Cary Coutant <ccoutant@google.com>
9302
9303 * target-reloc.h (relocate_section): Fix dead-pointer bug.
9304
9305 * layout.cc (Layout::include_section): Refactored check for debug
9306 info section.
9307 (Layout::add_comdat): Add new parameters. Change type
9308 of signature parameter. Add object and shndx to signatures table.
9309 (Layout::find_kept_object): New function.
9310 * layout.h: Include <cstring>.
9311 (Layout::is_debug_info_section): New function.
9312 (Layout::add_comdat): Add new parameters.
9313 (Layout::find_kept_object): New function.
9314 (Layout::Kept_section): New struct.
9315 (Layout::Signatures): Change type of map range.
9316 * object.cc (Relobj::output_section_address): New function.
9317 (Sized_relobj::include_section_group): Add new parameters. Change
9318 calls to Layout::add_comdat. Change to build table of kept comdat
9319 groups and table mapping discarded sections to kept sections.
9320 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
9321 (Sized_relobj::do_layout): Change calls to include_section_group and
9322 include_linkonce_section.
9323 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9324 value to zero when section is discarded.
9325 (Sized_relobj::map_to_kept_section): New function.
9326 * object.h (Relobj::output_section_address): New function.
9327 (Relobj::Comdat_group): New type.
9328 (Relobj::find_comdat_group): New function.
9329 (Relobj::Comdat_group_table): New type.
9330 (Relobj::Kept_comdat_section): New type.
9331 (Relobj::Kept_comdat_section_table): New type.
9332 (Relobj::add_comdat_group): New function.
9333 (Relobj::set_kept_comdat_section): New function.
9334 (Relobj::get_kept_comdat_section): New function.
9335 (Relobj::comdat_groups_): New field.
9336 (Relobj::kept_comdat_sections_): New field.
9337 (Symbol_value::input_value): Update comment.
9338 (Sized_relobj::map_to_kept_section) New function.
9339 (Sized_relobj::include_linkonce_section): Add new parameter.
9340 * target-reloc.h (Comdat_behavior): New type.
9341 (get_comdat_behavior): New function.
9342 (relocate_section): Add code to map a discarded section to the
9343 corresponding kept section when applying a relocation.
9344
9345 2008-04-30 Craig Silverstein <csilvers@google.com>
9346
9347 * dwarf_reader.cc (next_generation_count): New static var.
9348 (Addr2line_cache_entry): New struct.
9349 (addr2line_cache): New static var.
9350 (Dwarf_line_info::one_addr2line): Added caching.
9351 (Dwarf_line_info::clear_addr2line_cache): New function.
9352 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9353 cache-size parameter.
9354 (Dwarf_line_info::one_addr2line_cache): New function.
9355 * symtab.cc (Symbol_table::detect_odr_violations): Pass
9356 new cache-size argument to one_addr2line(), and clear cache.
9357
9358 2008-04-28 Cary Coutant <ccoutant@google.com>
9359
9360 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9361 R_386_PC8 relocations.
9362
9363 2008-04-23 Ian Lance Taylor <iant@google.com>
9364
9365 * object.cc (Sized_relobj::include_section_group): Check for
9366 invalid section group.
9367
9368 * object.cc (make_elf_object): Correct test for 64-bit ELF file
9369 header size.
9370
9371 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9372 than read for file header.
9373 * archive.cc (Archive::include_member): Likewise.
9374
9375 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
9376
9377 * aclocal.m4: Regenerate.
9378 * configure: Regenerate.
9379
9380 2008-04-19 Ian Lance Taylor <iant@google.com>
9381
9382 * version.cc (version_string): Bump to 1.6.
9383
9384 * testsuite/Makefile.am (many_sections_r_test): New target.
9385 (many_sections_r_test_SOURCES): Remove.
9386 (many_sections_r_test_DEPENDENCIES): Remove.
9387 (many_sections_r_test_LDFLAGS): Remove.
9388 (many_sections_r_test_LDADD): Remove.
9389
9390 * object.cc (Sized_relobj::do_add_symbols): Always pass
9391 local_symbol_count_ to add_from_relobj.
9392
9393 * testsuite/Makefile.am (many_sections_check.h): Only check one in
9394 every thousand variables.
9395 * testsuite/Makefile.in: Rebuild.
9396
9397 * object.cc (Xindex::initialize_symtab_xindex): New function.
9398 (Xindex::read_symtab_xindex): New function.
9399 (Xindex::sym_xindex_to_shndx): New function.
9400 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9401 available.
9402 (Sized_relobj::do_initialize_xindex): New function.
9403 (Sized_relobj::do_read_symbols): Adjust section links.
9404 (Sized_relobj::symbol_section_and_value): Add is_ordinary
9405 parameter. Change all callers.
9406 (Sized_relobj::include_section_group): Adjust section links and
9407 symbol section indexes.
9408 (Sized_relobj::do_layout): Adjust section links.
9409 (Sized_relobj::do_count_local_symbols): Adjust section links and
9410 symbol section indexes.
9411 (Sized_relobj::do_finalize_local_symbols): Distinguish between
9412 ordinary and special symbols.
9413 (Sized_relobj::write_local_symbols): Add symtab_xindex and
9414 dynsym_xindex parameters. Change all callers. Adjust section
9415 links. Use SHN_XINDEX when needed.
9416 (Sized_relobj::get_symbol_location_info): Adjust section links.
9417 Don't get fooled by special symbols.
9418 * object.h (class Xindex): Define.
9419 (class Object): Add xindex_ parameter. Declare virtual functoin
9420 do_initialize_xindex.
9421 (Object::adjust_sym_shndx): New function.
9422 (Object::set_xindex): New protected function.
9423 (class Symbol_value): Add is_ordinary_shndx_ field.
9424 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9425 (Symbol_value::value): Assert ordinary section.
9426 (Symbol_value::initialize_input_to_output_map): Likewise.
9427 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9428 Change all callers.
9429 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
9430 all callers.
9431 (class Sized_relobj): Update declarations.
9432 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9433 parameter. Change all callers.
9434 (Sized_relobj::adjust_shndx): New function.
9435 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9436 field.
9437 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9438 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
9439 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
9440 (Sized_dynobj::read_dynsym_section): Adjust section links.
9441 (Sized_dynobj::read_dynamic): Likewise.
9442 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
9443 section links.
9444 (Sized_dynobj::do_initialize_xindex): New function.
9445 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
9446 do_initialize_xindex.
9447 (Sized_dynobj::adjust_shndx): New function.
9448 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9449 dynsym_xindex_ fields.
9450 (Layout::finalize): Add a call to set_section_indexes before
9451 creating the symtab sections.
9452 (Layout::set_section_indexes): Don't do anything if the section
9453 already has a section index.
9454 (Layout::create_symtab_sections): Add shnum parameter. Change
9455 caller. Create .symtab_shndx section if needed.
9456 (Layout::create_shdrs): Add shstrtab_section parameter. Change
9457 caller.
9458 (Layout::allocated_output_section_count): New function.
9459 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9460 needed.
9461 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9462 fields. Update declarations.
9463 (Layout::symtab_xindex): New function.
9464 (Layout::dynsym_xindex): New function.
9465 (class Write_symbols_task): Add layout_ field.
9466 (Write_symbols_task::Write_symbols_task): Add layout parameter.
9467 Change caller.
9468 * output.cc (Output_section_headers::Output_section_headers): Add
9469 shstrtab_section parameter. Change all callers.
9470 (Output_section_headers::do_sized_write): Store overflow values
9471 for section count and section string table section index in
9472 section header zero.
9473 (Output_file_header::do_sized_write): Check for overflow of
9474 section count and section string table section index.
9475 (Output_symtab_xindex::do_write): New function.
9476 (Output_symtab_xindex::endian_do_write): New function.
9477 * output.h (class Output_section_headers): Add shstrtab_section_.
9478 Update declarations.
9479 (class Output_symtab_xindex): Define.
9480 (Output_section::has_out_shndx): New function.
9481 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9482 field.
9483 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9484 Change all callers.
9485 (Sized_symbol::init): Likewise.
9486 (Symbol::output_section): Check for ordinary symbol.
9487 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
9488 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
9489 callers.
9490 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9491 Change all callers. Simplify handling of symbols from sections
9492 not included in the link.
9493 (Symbol_table::add_from_dynobj): Handle ordinary symbol
9494 distinction.
9495 (Weak_alias_sorter::operator()): Assert that symbols are
9496 ordinary.
9497 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9498 distinction.
9499 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9500 parameters. Change all callers.
9501 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
9502 symbol distinction. Use SHN_XINDEX when needed.
9503 (Symbol_table::write_section_symbol): Add symtab_xindex
9504 parameter. Change all callers.
9505 (Symbol_table::sized_write_section_symbol): Likewise. Use
9506 SHN_XINDEX when needed.
9507 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
9508 declarations.
9509 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
9510 (Symbol::is_defined): Check is_ordinary.
9511 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9512 (Symbol::is_absolute, Symbol::is_common): Likewise.
9513 (class Sized_symbol): Update declarations.
9514 (class Symbol_table): Update declarations.
9515 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9516 parameters. Change all callers.
9517 (Sized_symbol::override): Likewise.
9518 (Symbol_table::override): Likewise.
9519 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
9520 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
9521 is_ordinary, and orig_st_shndx parameters. Change all callers.
9522 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9523 to be in an ordinary section.
9524 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9525 object and is_ordinary parameters. Change all callers.
9526 (Sized_dwarf_line_info::read_relocs): Add object parameter.
9527 Change all callers. Don't add undefined or non-ordinary symbols
9528 to reloc_map_.
9529 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9530 Change all callers.
9531 * dwarf_reader.h (class Sized_dwarf_line_info): Update
9532 declarations.
9533 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9534 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9535 (Sized_relobj::relocate_sections): Likewise.
9536 * target-reloc.h (scan_relocs): Adjust section symbol index.
9537 (scan_relocatable_relocs): Likewise.
9538 * i386.cc (Scan::local): Check for ordinary symbols.
9539 * sparc.cc (Scan::local): Likewise.
9540 * x86_64.cc (Scan::local): Likewise.
9541 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9542 to symbol_section_and_value.
9543 * testsuite/many_sections_test.cc: New file.
9544 * testsuite/Makefile.am (BUILT_SOURCES): Define.
9545 (check_PROGRAMS): Add many_sections_test.
9546 (many_sections_test_SOURCES): Define.
9547 (many_sections_test_DEPENDENCIES): Define.
9548 (many_sections_test_LDFLAGS): Define.
9549 (BUILT_SOURCES): Add many_sections_define.h.
9550 (many_sections_define.h): New target.
9551 (BUILT_SOURCES): Add many_sections_check.h.
9552 (many_sections_check.h): New target.
9553 (check_PROGRAMS): Add many_sections_r_test.
9554 (many_sections_r_test_SOURCES): Define.
9555 (many_sections_r_test_DEPENDENCIES): Define.
9556 (many_sections_r_test_LDFLAGS): Define.
9557 (many_sections_r_test_LDADD): Define.
9558 (many_sections_r_test.o): New target.
9559 * testsuite/Makefile.in: Rebuild.
9560
9561 2008-04-17 Cary Coutant <ccoutant@google.com>
9562
9563 * errors.cc (Errors::info): New function.
9564 (gold_info): New function.
9565 * errors.h (Errors::info): New function.
9566 * gold.h (gold_info): New function.
9567 * object.cc (Input_objects::add_object): Print trace output.
9568 * options.cc (options::parse_set): New function.
9569 (General_options::parse_wrap): Deleted.
9570 (General_options::General_options): Deleted initializer.
9571 * options.h (options::String_set): New typedef.
9572 (options::parse_set): New function.
9573 (DEFINE_set): New macro.
9574 (General_options::wrap): Changed to use DEFINE_set. Changed
9575 callers of any_wrap_symbols and is_wrap_symbol.
9576 (General_options::trace, General_options::trace_symbol):
9577 New options.
9578 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9579 (General_options::wrap_symbols_): Deleted.
9580 * symtab.cc (Symbol_table::add_from_object): Print trace output.
9581
9582 2008-04-17 David S. Miller <davem@davemloft.net>
9583
9584 * options.cc (General_options::parse_V): New function.
9585 * options.h: Add entries for -V and -Qy.
9586
9587 2008-04-17 Ian Lance Taylor <iant@google.com>
9588
9589 * common.cc (Symbol_table::allocate_commons): Remove options
9590 parameter. Change caller.
9591 (Symbol_table::do_allocate_commons): Remove options parameter.
9592 Change caller. Just call do_allocate_commons_list twice.
9593 (Symbol_table::do_allocate_commons_list): New function, broken out
9594 of do_allocate_commons.
9595 * common.h (class Allocate_commons_task): Remove options_ field.
9596 Update constructor.
9597 * symtab.cc (Symbol_table::Symbol_table): Initialize
9598 tls_commons_.
9599 (Symbol_table::add_from_object): Put TLS common symbols on
9600 tls_commons_ list.
9601 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9602 which are IN_OUTPUT_DATA.
9603 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
9604 allocate_commons and do_allocate_commons declarations. Declare
9605 do_allocate_commons_list.
9606 * gold.cc (queue_middle_tasks): Update creation of
9607 Allocate_commons_task to not pass options.
9608 * testsuite/Makefile.am (INCLUDES): Add -I.. .
9609 (TLS_TEST_C_FLAGS): New variable.
9610 (tls_test_c_pic.o): New target.
9611 (tls_test_shared.so): Link in tls_test_c_pic.o.
9612 (tls_test_c_pic_ie.o): New target.
9613 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9614 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9615 (tls_test_c.o): New target.
9616 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9617 (tls_pic_test_LDADD): Likewise.
9618 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9619 (tls_shared_gd_to_ie_test_LDADD): Likewise.
9620 (tls_test_c_gnu2.o): New target.
9621 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9622 tls_test_c_gnu2.o.
9623 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9624 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9625 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9626 * testsuite/tls_test.cc: Include "config.h".
9627 (t_last): Call t11_last.
9628 * testsuite/tls_test.h (t11, t11_last): Declare.
9629 * testsuite/tls_test_c.c: New file.
9630 * testsuite/tls_test_main.cc (thread_routine): Call t11.
9631 * configure.ac: Check for OpenMP support.
9632 * configure, config.in, Makefile.in: Rebuild.
9633 * testsuite/Makefile.in: Rebuild.
9634
9635 2008-04-16 Cary Coutant <ccoutant@google.com>
9636
9637 * i386.cc (Target_i386::define_tls_base_symbol): New function.
9638 (Target_i386::tls_base_symbol_defined_): New field.
9639 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9640 (Target_i386::Scan::global): Likewise.
9641 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9642 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9643 (Target_x86_64::tls_base_symbol_defined_): New field.
9644 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9645 (Target_x86_64::Scan::global): Likewise.
9646
9647 2008-04-16 Cary Coutant <ccoutant@google.com>
9648
9649 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9650 (Symbol::needs_plt_entry): Allow weak undefined symbols.
9651 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9652 building shared libraries.
9653 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9654 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9655 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9656 * testsuite/Makefile.in: Rebuild.
9657 * testsuite/weak_undef.h: New file.
9658 * testsuite/weak_undef_file1.cc: Add extra test cases.
9659 * testsuite/weak_undef_file2.cc: Likewise.
9660 * testsuite/weak_undef_test.cc: Likewise.
9661
9662 2008-04-16 David S. Miller <davem@davemloft.net>
9663
9664 * sparc.cc (Target_sparc::Scan): Change from struct to class.
9665 Add issued_non_pic_error_ field. Declare check_non_pic.
9666 (Target_sparc::Scan::check_non_pic): New function.
9667 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9668 (Target_sparc::Scan::global): Likewise.
9669
9670 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9671 * configure: Rebuild.
9672
9673 * options.h (DEFINE_enable): New macro.
9674 (new_dtags): New enable option.
9675 (initfirst, interpose, loadfltr, nodefaultlib,
9676 nodelete, nodlopen, nodump): New -z options.
9677 * layout.cc (Layout:finish_dynamic_section): If new
9678 dtags enabled, emit DT_RUNPATH. Also, emit a
9679 DT_FLAGS_1 containing any specified -z flags.
9680
9681 2008-04-16 Ian Lance Taylor <iant@google.com>
9682
9683 * copy-relocs.cc: New file.
9684 * copy-relocs.h: New file.
9685 * reloc.cc: Remove Copy_relocs code.
9686 * reloc.h: Likewise.
9687 * reloc-types.h (struct Reloc_types) [both versions]: Add
9688 get_reloc_addend_noerror.
9689 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9690 variants of add_global which take an addend which must be zero.
9691 * i386.cc: Include "copy-relocs.h".
9692 (class Target_i386): Change type of copy_relocs_ to variable,
9693 update initializer.
9694 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9695 Change all callers.
9696 (Target_i386::do_finalize_sections): Change handling of
9697 copy_relocs_.
9698 * sparc.cc: Include "copy-relocs.h".
9699 (class Target_sparc): Change type of copy_relocs_ to variable,
9700 update initializer.
9701 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9702 Change all callers.
9703 (Target_sparc::do_finalize_sections): Change handling of
9704 copy_relocs_.
9705 * x86_64.cc: Include "copy-relocs.h".
9706 (class Target_x86_64): Change type of copy_relocs_ to variable,
9707 update initializer.
9708 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9709 class. Change all callers.
9710 (Target_x86_64::do_finalize_sections): Change handling of
9711 copy_relocs_.
9712 * Makefile.am (CCFILES): Add copy-relocs.cc.
9713 (HFILES): Add copy-relocs.h.
9714
9715 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9716
9717 * testsuite/script_test_4.sh: Permit leading zeroes.
9718
9719 2008-04-15 Ian Lance Taylor <iant@google.com>
9720
9721 * script-sections.cc (Script_sections::create_segments): Use
9722 header_size_adjustment even when there is enough room for the
9723 headers.
9724 * testsuite/script_test_4.sh: New file.
9725 * testsuite/script_test_4.t: New file.
9726 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9727 (check_DATA): Add script_test_4.stdout.
9728 (MOSTLYCLEANFILES): Likewise.
9729 (script_test_4): New target.
9730 (script_test_4.stdout): New target.
9731 * testsuite/Makefile.in: Rebuild.
9732
9733 * sparc.cc: Add definitions for Output_data_plt_sparc class
9734 constants.
9735
9736 2008-04-14 David S. Miller <davem@davemloft.net>
9737
9738 * sparc.cc: New file.
9739 * Makefile.am (TARGETSOURCES): Add sparc.cc
9740 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9741 * configure.tgt: Document targ_extra_size and
9742 targ_extra_big_endian. Add entries for sparc-* and
9743 sparc64-*.
9744 * configure.ac: Handle targ_extra_size and
9745 targ_extra_big_endian.
9746 * Makefile.in: Rebuild.
9747 * configure: Likewise.
9748 * po/POTFILES.in: Likewise.
9749 * po/gold.pot: Likewise.
9750
9751 2008-04-14 Ian Lance Taylor <iant@google.com>
9752
9753 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9754 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9755 in the name/type/flags to section mapping. Don't call
9756 allocate_output_section.
9757 (Layout::choose_output_section): Change parameter from adjust_name
9758 to is_input_section. Don't permit input sections after sections
9759 are attached to segments. Don't call allocate_output_section.
9760 (Layout::layout_eh_frame): Call update_flags_for_input_section,
9761 not write_enable_output_section.
9762 (Layout::make_output_section): Don't push to
9763 unattached_section_list_ nor call attach_to_segment. Call
9764 attach_section_to_segment if sections are attached.
9765 (Layout::attach_sections_to_segments): New function.
9766 (Layout::attach_section_to_segment): New function.
9767 (Layout::attach_allocated_section_to_segment): Rename from
9768 attach_to_segment. Remove flags parameter.
9769 (Layout::allocate_output_section): Remove function.
9770 (Layout::write_enable_output_section): Remove function.
9771 * layout.h (class Layout): Update for above changes. Add new
9772 field sections_are_attached_.
9773 * output.h (Output_section::update_flags_for_input_section): New
9774 function.
9775 * output.cc (Output_section::add_input_section): Call
9776 update_flags_for_input_section.
9777 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9778
9779 2008-04-11 Cary Coutant <ccoutant@google.com>
9780
9781 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9782 thought unnecessary.
9783 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9784
9785 2008-04-11 Ian Lance Taylor <iant@google.com>
9786
9787 * output.h (class Output_section_data): Remove inline definition
9788 of set_addralign.
9789 * output.cc (Output_section_data::set_addralign): New function.
9790
9791 2008-04-11 Cary Coutant <ccoutant@google.com>
9792
9793 Add support for TLS descriptors for i386 and x86_64.
9794 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9795 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9796 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9797 GOT_TYPE_TLS_DESC.
9798 (Target_i386::got_mod_index_entry): Remove unnecessary code.
9799 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9800 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
9801 relocations.
9802 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9803 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9804 Fix problem with initial-exec relocations.
9805 (Target_i386::Relocate::relocate_tls): Likewise.
9806 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9807 relaxation.
9808 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9809 support for section-plus-offset dynamic table entries.
9810 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9811 (Output_data_dynamic::Dynamic_entry): Add support for
9812 section-plus-offset dynamic table entries.
9813 (Output_data_dynamic::Classification): Likewise.
9814 (Output_data_dynamic::classification_): Renamed offset_.
9815 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9816 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9817 (Target_x86_64::make_plt_section): New function.
9818 (Target_x86_64::reserve_tlsdesc_entries): New function.
9819 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9820 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9821 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9822 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9823 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9824 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9825 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9826 add extra PLT entry for TLS descriptors.
9827 (Output_data_plt_x86_64::got_): New field.
9828 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9829 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9830 fields.
9831 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9832 descriptors.
9833 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9834 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9835 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9836 R_386_TLS_DESC_CALL relocations.
9837 (Target_x86_64::Scan::global): Likewise.
9838 (Target_x86_64::do_finalize_sections): Add dynamic table entries
9839 for TLS descriptors.
9840 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9841 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9842 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9843 GD-to-IE relaxation.
9844 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9845 and TLS_DESCRIPTORS.
9846 * Makefile.in: Rebuild.
9847 * configure: Rebuild.
9848 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9849 (tls_test_shared2.so): New target.
9850 (tls_shared_gd_to_ie_test_SOURCES): New variable.
9851 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9852 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9853 (tls_shared_gd_to_ie_test_LDADD): New variable.
9854 (tls_shared_gnu2_gd_to_ie_test): New target.
9855 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9856 New targets.
9857 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9858 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9859 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9860 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9861 (tls_shared_gnu2_test): New target.
9862 (tls_test_gnu2_shared.so): New target.
9863 (tls_shared_gnu2_test_SOURCES): New variable.
9864 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9865 (tls_shared_gnu2_test_LDFLAGS): New variable.
9866 (tls_shared_gnu2_test_LDADD): New variable.
9867 * testsuite/Makefile.in: Rebuild.
9868 * testsuite/Makefile.
9869
9870 2008-04-11 Ian Lance Taylor <iant@google.com>
9871
9872 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9873 justsyms.t.
9874 * testsuite/Makefile.in: Rebuild.
9875
9876 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9877 long.
9878 * testsuite/script_test_2.cc (main): Adjust test.
9879
9880 2008-04-11 David S. Miller <davem@davemloft.net>
9881 Ian Lance Taylor <iant@google.com>
9882
9883 * options.h (General_options): Add entries for '-Y' and
9884 '-relax'.
9885 * options.cc (General_options:finalize): If -Y was used, add those
9886 entries to the library path instead of the default "/lib" and
9887 "/usr/lib".
9888
9889 2008-04-11 David S. Miller <davem@davemloft.net>
9890
9891 * testsuite/justsyms.t: Start at 0x100.
9892 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9893 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9894 long.
9895 * testsuite/script_test_2.cc: Adjust string and section length
9896 checks.
9897
9898 2008-04-09 Ian Lance Taylor <iant@google.com>
9899
9900 PR gold/5996
9901 * script-sections.cc (Sections_element::allocate_to_segment): Add
9902 orphan parameter.
9903 (Output_section_definition::allocate_to_segment): Likewise.
9904 (Orphan_output_section::allocate_to_segment): Likewise.
9905 (Script_sections::attach_sections_using_phdrs_clause): Don't
9906 propagate non-PT_LOAD segments to orphan sections.
9907 * testsuite/Makefile.am (script_test_3.stdout): Generate using
9908 readelf rather than objdump.
9909 * testsuite/script_test_3.sh: Adjust accordingly. Test that
9910 .interp section and PT_INTERP segment are the same size.
9911 * testsuite/Makefile.in: Rebuild.
9912
9913 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9914 aliases for symbols defined in the same object.
9915 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9916 (weak_alias_test_SOURCES): New variable.
9917 (weak_alias_test_DEPENDENCIES): New variable.
9918 (weak_alias_test_LDFLAGS): New variable.
9919 (weak_alias_test_LDADD): New variable.
9920 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9921 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9922 (weak_alias_test_3.o): New target.
9923 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9924 * testsuite/weak_alias_test_main.cc: New file.
9925 * testsuite/weak_alias_test_1.cc: New file.
9926 * testsuite/weak_alias_test_2.cc: New file.
9927 * testsuite/weak_alias_test_3.cc: New file.
9928
9929 2008-04-08 Ian Lance Taylor <iant@google.com>
9930
9931 * options.h (class General_options): Add --noinhibit-exec option.
9932 * main.cc (main): Check --noinhibit-exec.
9933
9934 * options.h (class General_options): Define --wrap as a special
9935 option. Add wrap_symbols_ field.
9936 (General_options::any_wrap_symbols): New function.
9937 (General_options::is_wrap_symbol): New function.
9938 * options.cc (General_options::parse_wrap): New function.
9939 (General_options::General_options): Initialize wrap_symbols_.
9940 * symtab.cc (Symbol_table::wrap_symbol): New function.
9941 (Symbol_table::add_from_object): Handle --wrap.
9942 * symtab.h (class Symbol_table): Declare wrap_symbol.
9943 * target.h (Target::wrap_char): New function.
9944 (Target::Target_info): Add wrap_char field.
9945 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9946 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9947 * testsuite/testfile.cc (Target_test::test_target_info):
9948 Likewise.
9949
9950 * errors.cc (Errors::undefined_symbol): Mention symbol version if
9951 there is one.
9952
9953 * layout.h (class Layout): Add added_eh_frame_data_ field.
9954 * layout.cc (Layout::Layout): Initialize new field.
9955 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9956 output section until we find a section we merged successfully.
9957 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9958 that the size be non-zero.
9959
9960 * merge.cc (Object_merge_map::get_output_offset): Remove inline
9961 qualifier.
9962
9963 2008-04-08 Craig Silverstein <csilvers@google.com>
9964
9965 * configure.ac: Export new conditional variable HAVE_ZLIB.
9966 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9967 on HAVE_ZLIB.
9968 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9969 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9970
9971 2008-04-07 Ian Lance Taylor <iant@google.com>
9972
9973 * version.cc (version_string): Set to "1.5".
9974
9975 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9976 Add issued_non_pic_error_ field. Declare check_non_pic.
9977 (Target_x86_64::Scan::check_non_pic): New function.
9978 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9979 (Target_x86_64::Scan::global): Likewise.
9980
9981 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9982 addend parameter. Change caller. Handle merge sections.
9983 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9984 Address to Addend. Don't add in the result of
9985 local_section_offset, pass down the addend and use the returned
9986 value.
9987 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9988 Update declarations of local_section_offset and symbol_value.
9989 * testsuite/two_file_test_1.cc (t18): New function.
9990 * testsuite/two_file_test_2.cc (f18): New function.
9991 * testsuite/two_file_test_main.cc (main): Call t18.
9992 * testsuite/two_file_test.h (t18, f18): Declare.
9993
9994 * configure.ac: Don't test for objdump, c++filt, or readelf.
9995 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9996 conditionals.
9997 (TEST_READELF): New variable.
9998 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9999 (check_PROGRAMS): Add two_file_strip_test.
10000 (two_file_strip_test): New target.
10001 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10002 (two_file_same_shared_strip_test_SOURCES): New variable.
10003 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10004 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10005 (two_file_same_shared_strip_test_LDADD): New variable.
10006 (two_file_shared_strip.so): New target.
10007 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10008 (ver_test_5.syms, ver_test_7.syms): Likewise.
10009 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10010 (strip_test_3.stdout): Use TEST_OBJDUMP.
10011 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10012
10013 2008-04-04 Cary Coutant <ccoutant@google.com>
10014
10015 * symtab.h (Symbol::is_weak_undefined): New function.
10016 (Symbol::is_strong_undefined): New function.
10017 (Symbol::is_absolute): New function.
10018 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10019 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10020 absolute symbols.
10021 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10022 (weak_undef_test): New target.
10023 * testsuite/Makefile.in: Rebuild.
10024 * testsuite/weak_undef_file1.cc: New file.
10025 * testsuite/weak_undef_file2.cc: New file.
10026 * testsuite/weak_undef_test.cc: New file.
10027
10028 2008-04-03 Craig Silverstein <csilvers@google.com>
10029
10030 * compressed_output.h (class Output_compressed_section): Use
10031 unsigned buffer.
10032 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10033 add zlib header.
10034 (zlib_compressed_suffix): Removed.
10035 (Output_compressed_section::set_final_data_size): Use unsigned
10036 buffers.
10037 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10038 Fix linker invocation.
10039 (flagstest_o_specialfile_and_compress_debug_sections):
10040 Likewise.
10041 * testsuite/Makefile.in: Regenerated.
10042
10043 2008-04-02 David S. Miller <davem@davemloft.net>
10044
10045 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10046 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10047
10048 2008-04-02 Craig Silverstein <csilvers@google.com>
10049
10050 * TODO: New file.
10051
10052 2008-04-02 Ian Lance Taylor <iant@google.com>
10053
10054 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10055 parameters. Update for new key type to views_. Change all
10056 callers.
10057 (File_read::read): Adjust for byteshift in returned view.
10058 (File_read::add_view): New function, broken out of
10059 find_and_make_view.
10060 (File_read::make_view): New function, broken out of
10061 find_and_make_view.
10062 (File_read::find_or_make_view): Add offset and aligned
10063 parameters. Rewrite accordingly. Change all callers.
10064 (File_read::get_view): Add offset and aligned parameters. Adjust
10065 for byteshift in return value.
10066 (File_read::get_lasting_view): Likewise.
10067 * fileread.h (class File_read): Update declarations.
10068 (class File_read::View): Add byteshift_ field. Add byteshift to
10069 constructor. Add byteshift method.
10070 * archive.h (Archive::clear_uncached_views): New function.
10071 (Archive::get_view): Add aligned parameter. Change all callers.
10072 * object.h (Object::get_view): Add aligned parameter. Change all
10073 callers.
10074 (Object::get_lasting_view): Likewise.
10075
10076 * fileread.cc (File_read::release): Don't call clear_views if
10077 there are multiple objects.
10078 * fileread.h (File_read::clear_uncached_views): New function.
10079 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10080 on the archive.
10081
10082 2008-03-31 Cary Coutant <ccoutant@google.com>
10083
10084 Add thin archive support.
10085 * archive.cc (Archive::armagt): New const.
10086 (Archive::setup): Remove task parameter and calls to unlock.
10087 (Archive::unlock_nested_archives): New function.
10088 (Archive::read_header): Add nested_off parameter. Change
10089 all callers.
10090 (Archive::interpret_header): Likewise.
10091 (Archive::include_all_members): Change to handle thin
10092 archives.
10093 (Archive::include_member): Likewise.
10094 * archive.h (Archive::Archive): Add new parameters and
10095 initializers.
10096 (Archive::armagt): New const.
10097 (Archive::setup): Remove task parameter.
10098 (Archive::unlock_nested_archives): New function.
10099 (Archive::read_header): Add nested_off parameter.
10100 (Archive::interpret_header): Likewise.
10101 (Archive::Nested_archive_table): New typedef.
10102 (Archive::is_thin_archive_): New field.
10103 (Archive::nested_archives_): New field.
10104 (Archive::options_): New field.
10105 (Archive::dirpath_): New field.
10106 (Archive::task_): New field.
10107 * readsyms.cc (Read_symbols::do_read_symbols): Add check
10108 for thin archives. Pass additional parameters to
10109 Archive::Archive. Unlock the archive file after calling
10110 Archive::setup.
10111
10112 2008-03-29 Ian Lance Taylor <iant@google.com>
10113
10114 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10115 version symbol to be local.
10116 * testsuite/ver_test_4.sh: New file.
10117 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10118 (check_DATA): Add ver_test_4.syms.
10119 (ver_test_4.syms): New target.
10120 * testsuite/Makefile.in: Rebuild.
10121
10122 * output.cc
10123 (Output_section::Input_section_sort_entry::has_priority): New
10124 function.
10125 (Output_section::Input_section_sort_entry::match_file_name): New
10126 function.
10127 (Output_section::Input_section_sort_entry::match_section_name):
10128 Remove.
10129 (Output_section::Input_section_sort_entry::match_section_name_prefix):
10130 Remove.
10131 (Output_section::Input_section_sort_entry::match_section_file):
10132 Remove.
10133 (Output_section::Input_section_sort_compare::operator()): Rewrite
10134 using new Input_section_sort_entry functions. Sort crtbegin and
10135 crtend first. Sort sections with no priority before sections with
10136 a priority.
10137 * testsuite/initpri1.c (d3): Check j != 4.
10138 (cd5): New constructor/destructor function.
10139 (main): Check j != 2.
10140
10141 * symtab.cc (Symbol_table::add_from_object): If we don't use the
10142 new symbol when resolving, don't call set_is_default.
10143 * testsuite/ver_test_7.cc: New file.
10144 * testsuite/ver_test_7.sh: New file.
10145 * testsuite/Makefile.am (ver_test_7.so): New target.
10146 (ver_test_7.o): New target.
10147 (check_SCRIPTS): Add ver_test_7.sh.
10148 (check_DATA): Add ver_test_7.syms.
10149 (ver_test_7.syms): New target.
10150
10151 2008-03-28 Ian Lance Taylor <iant@google.com>
10152
10153 * layout.cc (Layout::layout): If we see an input section with a
10154 name that needs sorting, set the must_sort flag for the output
10155 section.
10156 (Layout::make_output_section): If the name of the output section
10157 indicates that it might require sorting, set the may_sort flag.
10158 * output.h (Output_section::may_sort_attached_input_sections): New
10159 function.
10160 (Output_section::set_may_sort_attached_input_sections): New
10161 function.
10162 (Output_section::must_sort_attached_input_sections): New
10163 function.
10164 (Output_section::set_must_sort_attached_input_sections): New
10165 function.
10166 (class Output_section): Declare Input_section_sort_entry. Define
10167 Input_section_sort_compare. Declare
10168 sort_attached_input_sections. Add new fields:
10169 may_sort_attached_input_sections_,
10170 must_sort_attached_input_sections_,
10171 attached_input_sections_are_sorted_.
10172 * output.cc (Output_section::Output_section): Initialize new
10173 fields.
10174 (Output_section::add_input_section): Add an entry to
10175 input_sections_ if may_sort or must_sort are true.
10176 (Output_section::set_final_data_size): Call
10177 sort_attached_input_sections if necessary.
10178 (Output_section::Input_section_sort_entry): Define new class.
10179 (Output_section::Input_section_sort_compare::operator()): New
10180 function.
10181 (Output_section::sort_attached_input_sections): New function.
10182 * configure.ac: Check whether the compiler supports constructor
10183 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
10184 * testsuite/initpri1.c: New file.
10185 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10186 CONSTRUCTOR_PRIORITY.
10187 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10188 (initpri1_LDFLAGS): New variable.
10189 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10190
10191 2008-03-27 Ian Lance Taylor <iant@google.com>
10192
10193 * common.cc (Sort_commons::operator): Correct sorting algorithm.
10194 * testsuite/common_test_1.c: New file.
10195 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10196 (common_test_1_SOURCES): New variable.
10197 (common_test_1_DEPENDENCIES): New variable.
10198 (common_test_1_LDFLAGS): New variable.
10199
10200 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10201 and commons_ correctly when NAME/VERSION does not override
10202 NAME/NULL.
10203 * testsuite/ver_test_6.c: New file.
10204 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10205 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10206 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10207
10208 2008-03-26 Ian Lance Taylor <iant@google.com>
10209
10210 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10211 of an undefined symbol from a version script.
10212 * testsuite/Makefile.am (ver_test_5.so): New target.
10213 (ver_test_5.o): New target.
10214 (check_SCRIPTS): Add ver_test_5.sh.
10215 (check_DATA): Add ver_test_5.syms.
10216 (ver_test_5.syms): New target.
10217 * testsuite/ver_test_5.cc: New file.
10218 * testsuite/ver_test_5.script: New file.
10219 * testsuite/ver_test_5.sh: New file.
10220 * Makefile.in, testsuite/Makefile.in: Rebuild.
10221
10222 PR gold/5986
10223 Fix problems building gold with gcc 4.3.0.
10224 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10225 (gold_error_at_location, gold_warning_at_location): Use it.
10226 * configure.ac: Check whether we can compile and use a template
10227 function with a printf attribute.
10228 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10229 when jumping over bytes.
10230 * object.cc: Instantiate Object::read_section_data.
10231 * debug.h: Include <cstring>
10232 * dwarf_reader.cc: Include <algorithm>
10233 * main.cc: Include <cstring>.
10234 * options.cc: Include <cstring>.
10235 * output.cc: Include <cstring>.
10236 * script.cc: Include <cstring>.
10237 * script.h: Include <string>.
10238 * symtab.cc: Include <cstring> and <algorithm>.
10239 * target-select.cc: Include <cstring>.
10240 * version.cc: Include <string>.
10241 * testsuite/testmain.cc: Include <cstdlib>.
10242 * configure, config.in: Rebuild.
10243
10244 2008-03-25 Ian Lance Taylor <iant@google.com>
10245
10246 * options.cc: Include "../bfd/bfdver.h".
10247 (options::help): Print bug reporting address.
10248
10249 * version.cc (print_version): Adjust output for current value of
10250 BFD_VERSION_STRING.
10251
10252 * NEWS: New file.
10253
10254 * options.cc (options::help): Print list of supported targets.
10255 * target-select.h: Include <vector>.
10256 (class Target_selector): Make machine_, size_, and is_big_endian_
10257 fields const. Add bfd_name_ and instantiated_target_ fields.
10258 (Target_selector::Target_selector): Add bfd_name parameter.
10259 (Target_selector::recognize): Make non-virtual, call
10260 do_recognize.
10261 (Target_selector::recognize_by_name): Make non-virtual, call
10262 do_recognize_by_name.
10263 (Target_selector::supported_names): New function.
10264 (Target_selector::bfd_name): New function.
10265 (Target_selector::do_instantiate_target): New pure virtual
10266 function.
10267 (Target_selector::do_recognize): New virtual function.
10268 (Target_selector::do_recognize_by_name): New virtual function.
10269 (Target_selector::instantiate_target): New private function.
10270 (supported_target_names): Declare.
10271 * target-select.cc (Target_selector::Target_selector): Update for
10272 new parameter and fields.
10273 (select_target_by_name): Check that the name matches before
10274 calling recognize_by_name.
10275 (supported_target_names): New function.
10276 * i386.cc (class Target_selector_i386): Update Target_selector
10277 constructor call. Remove recognize and recognize_by_name. Add
10278 do_instantiate_target.
10279 * x86_64.cc (class Target_selector_x86_64): Likewise.
10280 * testsuite/testfile.cc (class Target_selector_test): Update for
10281 changes to Target_selector.
10282
10283 * README: Rewrite, with some notes on unsupported features.
10284
10285 2008-03-24 Cary Coutant <ccoutant@google.com>
10286
10287 * i386.cc (Target_i386::Got_type): New enum declaration.
10288 (Target_i386::Scan::local): Updated callers of Output_data_got
10289 member functions.
10290 (Target_i386::Scan::global): Likewise.
10291 (Target_i386::Relocate::relocate): Likewise.
10292 (Target_i386::Relocate::relocate_tls): Likewise.
10293 * object.h (Got_offset_list): New class.
10294 (Sized_relobj::local_has_got_offset): Added got_type parameter.
10295 (Sized_relobj::local_got_offset): Likewise.
10296 (Sized_relobj::set_local_got_offset): Likewise.
10297 (Sized_relobj::local_has_tls_got_offset): Removed.
10298 (Sized_relobj::local_tls_got_offset): Removed.
10299 (Sized_relobj::set_local_tls_got_offset): Removed.
10300 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10301 * output.cc (Output_data_got::add_global): Added got_type parameter.
10302 (Output_data_got::add_global_with_rel): Likewise.
10303 (Output_data_got::add_global_with_rela): Likewise.
10304 (Output_data_got::add_global_pair_with_rel): New function.
10305 (Output_data_got::add_global_pair_with_rela): New function.
10306 (Output_data_got::add_local): Added got_type parameter.
10307 (Output_data_got::add_local_with_rel): Likewise.
10308 (Output_data_got::add_local_with_rela): Likewise.
10309 (Output_data_got::add_local_pair_with_rel): New function.
10310 (Output_data_got::add_local_pair_with_rela): New function.
10311 (Output_data_got::add_global_tls): Removed.
10312 (Output_data_got::add_global_tls_with_rel): Removed.
10313 (Output_data_got::add_global_tls_with_rela): Removed.
10314 (Output_data_got::add_local_tls): Removed.
10315 (Output_data_got::add_local_tls_with_rel): Removed.
10316 (Output_data_got::add_local_tls_with_rela): Removed.
10317 * output.h (Output_data_got::add_global): Added got_type parameter.
10318 (Output_data_got::add_global_with_rel): Likewise.
10319 (Output_data_got::add_global_with_rela): Likewise.
10320 (Output_data_got::add_global_pair_with_rel): New function.
10321 (Output_data_got::add_global_pair_with_rela): New function.
10322 (Output_data_got::add_local): Added got_type parameter.
10323 (Output_data_got::add_local_with_rel): Likewise.
10324 (Output_data_got::add_local_with_rela): Likewise.
10325 (Output_data_got::add_local_pair_with_rel): New function.
10326 (Output_data_got::add_local_pair_with_rela): New function.
10327 (Output_data_got::add_global_tls): Removed.
10328 (Output_data_got::add_global_tls_with_rel): Removed.
10329 (Output_data_got::add_global_tls_with_rela): Removed.
10330 (Output_data_got::add_local_tls): Removed.
10331 (Output_data_got::add_local_tls_with_rel): Removed.
10332 (Output_data_got::add_local_tls_with_rela): Removed.
10333 * resolve.cc (Symbol::override_base_with_special): Removed
10334 reference to has_got_offset_ field.
10335 * symtab.cc (Symbol::init_fields): Replaced initialization
10336 of got_offset_ with got_offsets_. Removed initialization
10337 of has_got_offset_
10338 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10339 (Symbol::got_offset): Likewise.
10340 (Symbol::set_got_offset): Likewise.
10341 (Symbol::has_tls_got_offset): Removed.
10342 (Symbol::tls_got_offset): Removed.
10343 (Symbol::set_tls_got_offset): Removed.
10344 (Symbol::got_offset_): Removed.
10345 (Symbol::tls_mod_got_offset_): Removed.
10346 (Symbol::tls_pair_got_offset_): Removed.
10347 (Symbol::got_offsets_): New field.
10348 (Symbol::has_got_offset): Removed.
10349 (Symbol::has_tls_mod_got_offset): Removed.
10350 (Symbol::has_tls_pair_got_offset): Removed.
10351 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10352 (Target_x86_64::Scan::local): Updated callers of Output_data_got
10353 member functions.
10354 (Target_x86_64::Scan::global): Likewise.
10355 (Target_x86_64::Relocate::relocate): Likewise.
10356 (Target_x86_64::Relocate::relocate_tls): Likewise.
10357
10358 2008-03-25 Ben Elliston <bje@au.ibm.com>
10359
10360 * yyscript.y: Fix spelling error in comment.
10361
10362 2008-03-24 Ian Lance Taylor <iant@google.com>
10363
10364 * options.h (class General_options): Define build_id option.
10365 * layout.h (class Layout): Declare write_build_id, create_note,
10366 create_build_id. Add build_id_note_ member.
10367 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10368 "libiberty.h", "md5.h", "sha1.h".
10369 (Layout::Layout): Initialize eh_frame_data_,
10370 eh_frame_hdr_section_, and build_id_note_.
10371 (Layout::finalize): Call create_build_id.
10372 (Layout::create_note): New function, broken out of
10373 Layout::create_gold_note.
10374 (Layout::create_gold_note): Call create_note.
10375 (Layout::create_build_id): New function.
10376 (Layout::write_build_id): New function.
10377 (Close_task_runner::run): Call write_build_id.
10378
10379 * x86_64.cc: Correct license to GPLv3.
10380
10381 2008-03-23 Ian Lance Taylor <iant@google.com>
10382
10383 * options.cc: Include "demangle.h".
10384 (parse_optional_string): New function.
10385 (parse_long_option): Handle takes_optional_argument.
10386 (parse_short_option): Update dash_z initializer. Handle
10387 takes_optional_argument.
10388 (General_options::General_options): Initialize do_demangle_.
10389 (General_options::finalize): Set do_demangle_. Handle demangling
10390 style.
10391 * options.h (parse_optional_string): Declare.
10392 (struct One_option): Add optional_arg field. Update constructor.
10393 Update call constructor calls. Add takes_optional_argument
10394 function.
10395 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
10396 (DEFINE_optional_string): Define.
10397 (General_options::demangle): Change from DEFINE_bool to
10398 DEFINE_optional_string.
10399 (General_options::no_demangle): New function.
10400 (General_options::do_demangle): New function.
10401 (General_options::set_do_demangle): New function.
10402 (General_options::execstack_status_): Move definition to end of
10403 class definition.
10404 (General_options::static_): Likewise.
10405 (General_options::do_demangle_): New field.
10406 * object.cc (big_endian>::get_symbol_location_info): Call
10407 Options::do_demangle, not Options::demangle.
10408 * symtab.cc (demangle): Likewise.
10409
10410 2008-03-22 Ian Lance Taylor <iant@google.com>
10411
10412 * gold.h: Include <cstddef> and <sys/types.h>
10413 * options.h: Include <cstring>.
10414
10415 2008-03-21 Ian Lance Taylor <iant@google.com>
10416
10417 * Added source code to GNU binutils.
This page took 0.254858 seconds and 4 git commands to generate.